mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
9 lines
27 KiB
JavaScript
9 lines
27 KiB
JavaScript
import{p as $}from"./propTypes-c3354283.js";import{K as kt,G as mt,H as zt}from"./index-c61a73ff.js";import{d as Ht}from"./refresh-right-6177e75c.js";var O={},Kt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Bt={},M={};let ct;const Ot=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];M.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};M.getSymbolTotalCodewords=function(e){return Ot[e]};M.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};M.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ct=e};M.isKanjiModeEnabled=function(){return typeof ct<"u"};M.toSJIS=function(e){return ct(e)};var W={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,o){if(t.isValid(r))return r;try{return e(r)}catch{return o}}})(W);function pt(){this.buffer=[],this.length=0}pt.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let i=0;i<e;i++)this.putBit((t>>>e-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Jt=pt;function J(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}J.prototype.set=function(t,e,i,r){const o=t*this.size+e;this.data[o]=i,r&&(this.reservedBit[o]=!0)};J.prototype.get=function(t,e){return this.data[t*this.size+e]};J.prototype.xor=function(t,e,i){this.data[t*this.size+e]^=i};J.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Yt=J,bt={};(function(t){const e=M.getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const o=Math.floor(r/7)+2,n=e(r),s=n===145?26:Math.ceil((n-13)/(2*o-2))*2,a=[n-7];for(let u=1;u<o-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const o=[],n=t.getRowColCoords(r),s=n.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||o.push([n[a],n[u]]);return o}})(bt);var At={};const $t=M.getSymbolSize,Ct=7;At.getPositions=function(e){const i=$t(e);return[[0,0],[i-Ct,0],[0,i-Ct]]};var Tt={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},t.from=function(o){return t.isValid(o)?parseInt(o,10):void 0},t.getPenaltyN1=function(o){const n=o.size;let s=0,a=0,u=0,f=null,d=null;for(let p=0;p<n;p++){a=u=0,f=d=null;for(let C=0;C<n;C++){let w=o.get(p,C);w===f?a++:(a>=5&&(s+=e.N1+(a-5)),f=w,a=1),w=o.get(C,p),w===d?u++:(u>=5&&(s+=e.N1+(u-5)),d=w,u=1)}a>=5&&(s+=e.N1+(a-5)),u>=5&&(s+=e.N1+(u-5))}return s},t.getPenaltyN2=function(o){const n=o.size;let s=0;for(let a=0;a<n-1;a++)for(let u=0;u<n-1;u++){const f=o.get(a,u)+o.get(a,u+1)+o.get(a+1,u)+o.get(a+1,u+1);(f===4||f===0)&&s++}return s*e.N2},t.getPenaltyN3=function(o){const n=o.size;let s=0,a=0,u=0;for(let f=0;f<n;f++){a=u=0;for(let d=0;d<n;d++)a=a<<1&2047|o.get(f,d),d>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|o.get(d,f),d>=10&&(u===1488||u===93)&&s++}return s*e.N3},t.getPenaltyN4=function(o){let n=0;const s=o.data.length;for(let u=0;u<s;u++)n+=o.data[u];return Math.abs(Math.ceil(n*100/s/5)-10)*e.N4};function i(r,o,n){switch(r){case t.Patterns.PATTERN000:return(o+n)%2===0;case t.Patterns.PATTERN001:return o%2===0;case t.Patterns.PATTERN010:return n%3===0;case t.Patterns.PATTERN011:return(o+n)%3===0;case t.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(n/3))%2===0;case t.Patterns.PATTERN101:return o*n%2+o*n%3===0;case t.Patterns.PATTERN110:return(o*n%2+o*n%3)%2===0;case t.Patterns.PATTERN111:return(o*n%3+(o+n)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(o,n){const s=n.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)n.isReserved(u,a)||n.xor(u,a,i(o,u,a))},t.getBestMask=function(o,n){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let f=0;f<s;f++){n(f),t.applyMask(f,o);const d=t.getPenaltyN1(o)+t.getPenaltyN2(o)+t.getPenaltyN3(o)+t.getPenaltyN4(o);t.applyMask(f,o),d<u&&(u=d,a=f)}return a}})(Tt);var X={};const L=W,j=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Q=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];X.getBlocksCount=function(e,i){switch(i){case L.L:return j[(e-1)*4+0];case L.M:return j[(e-1)*4+1];case L.Q:return j[(e-1)*4+2];case L.H:return j[(e-1)*4+3];default:return}};X.getTotalCodewordsCount=function(e,i){switch(i){case L.L:return Q[(e-1)*4+0];case L.M:return Q[(e-1)*4+1];case L.Q:return Q[(e-1)*4+2];case L.H:return Q[(e-1)*4+3];default:return}};var Nt={},Z={};const H=new Uint8Array(512),G=new Uint8Array(256);(function(){let e=1;for(let i=0;i<255;i++)H[i]=e,G[e]=i,e<<=1,e&256&&(e^=285);for(let i=255;i<512;i++)H[i]=H[i-255]})();Z.log=function(e){if(e<1)throw new Error("log("+e+")");return G[e]};Z.exp=function(e){return H[e]};Z.mul=function(e,i){return e===0||i===0?0:H[G[e]+G[i]]};(function(t){const e=Z;t.mul=function(r,o){const n=new Uint8Array(r.length+o.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<o.length;a++)n[s+a]^=e.mul(r[s],o[a]);return n},t.mod=function(r,o){let n=new Uint8Array(r);for(;n.length-o.length>=0;){const s=n[0];for(let u=0;u<o.length;u++)n[u]^=e.mul(o[u],s);let a=0;for(;a<n.length&&n[a]===0;)a++;n=n.slice(a)}return n},t.generateECPolynomial=function(r){let o=new Uint8Array([1]);for(let n=0;n<r;n++)o=t.mul(o,new Uint8Array([1,e.exp(n)]));return o}})(Nt);const It=Nt;function lt(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}lt.prototype.initialize=function(e){this.degree=e,this.genPoly=It.generateECPolynomial(this.degree)};lt.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const i=new Uint8Array(e.length+this.degree);i.set(e);const r=It.mod(i,this.genPoly),o=this.degree-r.length;if(o>0){const n=new Uint8Array(this.degree);return n.set(r,o),n}return r};var jt=lt,St={},v={},ft={};ft.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var P={};const Mt="[0-9]+",Qt="[A-Z $%*+\\-./:]+";let K="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";K=K.replace(/u/g,"\\u");const Gt="(?:(?![A-Z0-9 $%*+\\-./:]|"+K+`)(?:.|[\r
|
|
]))+`;P.KANJI=new RegExp(K,"g");P.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");P.BYTE=new RegExp(Gt,"g");P.NUMERIC=new RegExp(Mt,"g");P.ALPHANUMERIC=new RegExp(Qt,"g");const qt=new RegExp("^"+K+"$"),Wt=new RegExp("^"+Mt+"$"),Xt=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");P.testKanji=function(e){return qt.test(e)};P.testNumeric=function(e){return Wt.test(e)};P.testAlphanumeric=function(e){return Xt.test(e)};(function(t){const e=ft,i=P;t.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(n,s){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?n.ccBits[0]:s<27?n.ccBits[1]:n.ccBits[2]},t.getBestModeForData=function(n){return i.testNumeric(n)?t.NUMERIC:i.testAlphanumeric(n)?t.ALPHANUMERIC:i.testKanji(n)?t.KANJI:t.BYTE},t.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},t.isValid=function(n){return n&&n.bit&&n.ccBits};function r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+o)}}t.from=function(n,s){if(t.isValid(n))return n;try{return r(n)}catch{return s}}})(v);(function(t){const e=M,i=X,r=W,o=v,n=ft,s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,a=e.getBCHDigit(s);function u(C,w,y){for(let c=1;c<=40;c++)if(w<=t.getCapacity(c,y,C))return c}function f(C,w){return o.getCharCountIndicator(C,w)+4}function d(C,w){let y=0;return C.forEach(function(c){const E=f(c.mode,w);y+=E+c.getBitsLength()}),y}function p(C,w){for(let y=1;y<=40;y++)if(d(C,y)<=t.getCapacity(y,w,o.MIXED))return y}t.from=function(w,y){return n.isValid(w)?parseInt(w,10):y},t.getCapacity=function(w,y,c){if(!n.isValid(w))throw new Error("Invalid QR Code version");typeof c>"u"&&(c=o.BYTE);const E=e.getSymbolTotalCodewords(w),l=i.getTotalCodewordsCount(w,y),m=(E-l)*8;if(c===o.MIXED)return m;const h=m-f(c,w);switch(c){case o.NUMERIC:return Math.floor(h/10*3);case o.ALPHANUMERIC:return Math.floor(h/11*2);case o.KANJI:return Math.floor(h/13);case o.BYTE:default:return Math.floor(h/8)}},t.getBestVersionForData=function(w,y){let c;const E=r.from(y,r.M);if(Array.isArray(w)){if(w.length>1)return p(w,E);if(w.length===0)return 1;c=w[0]}else c=w;return u(c.mode,c.getLength(),E)},t.getEncodedBits=function(w){if(!n.isValid(w)||w<7)throw new Error("Invalid QR Code version");let y=w<<12;for(;e.getBCHDigit(y)-a>=0;)y^=s<<e.getBCHDigit(y)-a;return w<<12|y}})(St);var Pt={};const it=M,Rt=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,Zt=1<<14|1<<12|1<<10|1<<4|1<<1,yt=it.getBCHDigit(Rt);Pt.getEncodedBits=function(e,i){const r=e.bit<<3|i;let o=r<<10;for(;it.getBCHDigit(o)-yt>=0;)o^=Rt<<it.getBCHDigit(o)-yt;return(r<<10|o)^Zt};var Lt={};const xt=v;function V(t){this.mode=xt.NUMERIC,this.data=t.toString()}V.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};V.prototype.getLength=function(){return this.data.length};V.prototype.getBitsLength=function(){return V.getBitsLength(this.data.length)};V.prototype.write=function(e){let i,r,o;for(i=0;i+3<=this.data.length;i+=3)r=this.data.substr(i,3),o=parseInt(r,10),e.put(o,10);const n=this.data.length-i;n>0&&(r=this.data.substr(i),o=parseInt(r,10),e.put(o,n*3+1))};var te=V;const ee=v,tt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function U(t){this.mode=ee.ALPHANUMERIC,this.data=t}U.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(e){let i;for(i=0;i+2<=this.data.length;i+=2){let r=tt.indexOf(this.data[i])*45;r+=tt.indexOf(this.data[i+1]),e.put(r,11)}this.data.length%2&&e.put(tt.indexOf(this.data[i]),6)};var ne=U,oe=function(e){for(var i=[],r=e.length,o=0;o<r;o++){var n=e.charCodeAt(o);if(n>=55296&&n<=56319&&r>o+1){var s=e.charCodeAt(o+1);s>=56320&&s<=57343&&(n=(n-55296)*1024+s-56320+65536,o+=1)}if(n<128){i.push(n);continue}if(n<2048){i.push(n>>6|192),i.push(n&63|128);continue}if(n<55296||n>=57344&&n<65536){i.push(n>>12|224),i.push(n>>6&63|128),i.push(n&63|128);continue}if(n>=65536&&n<=1114111){i.push(n>>18|240),i.push(n>>12&63|128),i.push(n>>6&63|128),i.push(n&63|128);continue}i.push(239,191,189)}return new Uint8Array(i).buffer};const re=oe,ie=v;function _(t){this.mode=ie.BYTE,typeof t=="string"&&(t=re(t)),this.data=new Uint8Array(t)}_.getBitsLength=function(e){return e*8};_.prototype.getLength=function(){return this.data.length};_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)};_.prototype.write=function(t){for(let e=0,i=this.data.length;e<i;e++)t.put(this.data[e],8)};var se=_;const ue=v,ae=M;function F(t){this.mode=ue.KANJI,this.data=t}F.getBitsLength=function(e){return e*13};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let i=ae.toSJIS(this.data[e]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),t.put(i,13)}};var ce=F,vt={exports:{}};(function(t){var e={single_source_shortest_paths:function(i,r,o){var n={},s={};s[r]=0;var a=e.PriorityQueue.make();a.push(r,0);for(var u,f,d,p,C,w,y,c,E;!a.empty();){u=a.pop(),f=u.value,p=u.cost,C=i[f]||{};for(d in C)C.hasOwnProperty(d)&&(w=C[d],y=p+w,c=s[d],E=typeof s[d]>"u",(E||c>y)&&(s[d]=y,a.push(d,y),n[d]=f))}if(typeof o<"u"&&typeof s[o]>"u"){var l=["Could not find a path from ",r," to ",o,"."].join("");throw new Error(l)}return n},extract_shortest_path_from_predecessor_list:function(i,r){for(var o=[],n=r;n;)o.push(n),i[n],n=i[n];return o.reverse(),o},find_path:function(i,r,o){var n=e.single_source_shortest_paths(i,r,o);return e.extract_shortest_path_from_predecessor_list(n,o)},PriorityQueue:{make:function(i){var r=e.PriorityQueue,o={},n;i=i||{};for(n in r)r.hasOwnProperty(n)&&(o[n]=r[n]);return o.queue=[],o.sorter=i.sorter||r.default_sorter,o},default_sorter:function(i,r){return i.cost-r.cost},push:function(i,r){var o={value:i,cost:r};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(vt);var le=vt.exports;(function(t){const e=v,i=te,r=ne,o=se,n=ce,s=P,a=M,u=le;function f(l){return unescape(encodeURIComponent(l)).length}function d(l,m,h){const g=[];let B;for(;(B=l.exec(h))!==null;)g.push({data:B[0],index:B.index,mode:m,length:B[0].length});return g}function p(l){const m=d(s.NUMERIC,e.NUMERIC,l),h=d(s.ALPHANUMERIC,e.ALPHANUMERIC,l);let g,B;return a.isKanjiModeEnabled()?(g=d(s.BYTE,e.BYTE,l),B=d(s.KANJI,e.KANJI,l)):(g=d(s.BYTE_KANJI,e.BYTE,l),B=[]),m.concat(h,g,B).sort(function(A,S){return A.index-S.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function C(l,m){switch(m){case e.NUMERIC:return i.getBitsLength(l);case e.ALPHANUMERIC:return r.getBitsLength(l);case e.KANJI:return n.getBitsLength(l);case e.BYTE:return o.getBitsLength(l)}}function w(l){return l.reduce(function(m,h){const g=m.length-1>=0?m[m.length-1]:null;return g&&g.mode===h.mode?(m[m.length-1].data+=h.data,m):(m.push(h),m)},[])}function y(l){const m=[];for(let h=0;h<l.length;h++){const g=l[h];switch(g.mode){case e.NUMERIC:m.push([g,{data:g.data,mode:e.ALPHANUMERIC,length:g.length},{data:g.data,mode:e.BYTE,length:g.length}]);break;case e.ALPHANUMERIC:m.push([g,{data:g.data,mode:e.BYTE,length:g.length}]);break;case e.KANJI:m.push([g,{data:g.data,mode:e.BYTE,length:f(g.data)}]);break;case e.BYTE:m.push([{data:g.data,mode:e.BYTE,length:f(g.data)}])}}return m}function c(l,m){const h={},g={start:{}};let B=["start"];for(let b=0;b<l.length;b++){const A=l[b],S=[];for(let I=0;I<A.length;I++){const N=A[I],R=""+b+I;S.push(R),h[R]={node:N,lastCount:0},g[R]={};for(let D=0;D<B.length;D++){const T=B[D];h[T]&&h[T].node.mode===N.mode?(g[T][R]=C(h[T].lastCount+N.length,N.mode)-C(h[T].lastCount,N.mode),h[T].lastCount+=N.length):(h[T]&&(h[T].lastCount=N.length),g[T][R]=C(N.length,N.mode)+4+e.getCharCountIndicator(N.mode,m))}}B=S}for(let b=0;b<B.length;b++)g[B[b]].end=0;return{map:g,table:h}}function E(l,m){let h;const g=e.getBestModeForData(l);if(h=e.from(m,g),h!==e.BYTE&&h.bit<g.bit)throw new Error('"'+l+'" cannot be encoded with mode '+e.toString(h)+`.
|
|
Suggested mode is: `+e.toString(g));switch(h===e.KANJI&&!a.isKanjiModeEnabled()&&(h=e.BYTE),h){case e.NUMERIC:return new i(l);case e.ALPHANUMERIC:return new r(l);case e.KANJI:return new n(l);case e.BYTE:return new o(l)}}t.fromArray=function(m){return m.reduce(function(h,g){return typeof g=="string"?h.push(E(g,null)):g.data&&h.push(E(g.data,g.mode)),h},[])},t.fromString=function(m,h){const g=p(m,a.isKanjiModeEnabled()),B=y(g),b=c(B,h),A=u.find_path(b.map,"start","end"),S=[];for(let I=1;I<A.length-1;I++)S.push(b.table[A[I]].node);return t.fromArray(w(S))},t.rawSplit=function(m){return t.fromArray(p(m,a.isKanjiModeEnabled()))}})(Lt);const x=M,et=W,fe=Jt,de=Yt,ge=bt,he=At,st=Tt,ut=X,we=jt,q=St,me=Pt,Ce=v,nt=Lt;function ye(t,e){const i=t.size,r=he.getPositions(e);for(let o=0;o<r.length;o++){const n=r[o][0],s=r[o][1];for(let a=-1;a<=7;a++)if(!(n+a<=-1||i<=n+a))for(let u=-1;u<=7;u++)s+u<=-1||i<=s+u||(a>=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(n+a,s+u,!0,!0):t.set(n+a,s+u,!1,!0))}}function Ee(t){const e=t.size;for(let i=8;i<e-8;i++){const r=i%2===0;t.set(i,6,r,!0),t.set(6,i,r,!0)}}function Be(t,e){const i=ge.getPositions(e);for(let r=0;r<i.length;r++){const o=i[r][0],n=i[r][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?t.set(o+s,n+a,!0,!0):t.set(o+s,n+a,!1,!0)}}function pe(t,e){const i=t.size,r=q.getEncodedBits(e);let o,n,s;for(let a=0;a<18;a++)o=Math.floor(a/3),n=a%3+i-8-3,s=(r>>a&1)===1,t.set(o,n,s,!0),t.set(n,o,s,!0)}function ot(t,e,i){const r=t.size,o=me.getEncodedBits(e,i);let n,s;for(n=0;n<15;n++)s=(o>>n&1)===1,n<6?t.set(n,8,s,!0):n<8?t.set(n+1,8,s,!0):t.set(r-15+n,8,s,!0),n<8?t.set(8,r-n-1,s,!0):n<9?t.set(8,15-n-1+1,s,!0):t.set(8,15-n-1,s,!0);t.set(r-8,8,1,!0)}function be(t,e){const i=t.size;let r=-1,o=i-1,n=7,s=0;for(let a=i-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(o,a-u)){let f=!1;s<e.length&&(f=(e[s]>>>n&1)===1),t.set(o,a-u,f),n--,n===-1&&(s++,n=7)}if(o+=r,o<0||i<=o){o-=r,r=-r;break}}}function Ae(t,e,i){const r=new fe;i.forEach(function(u){r.put(u.mode.bit,4),r.put(u.getLength(),Ce.getCharCountIndicator(u.mode,t)),u.write(r)});const o=x.getSymbolTotalCodewords(t),n=ut.getTotalCodewordsCount(t,e),s=(o-n)*8;for(r.getLengthInBits()+4<=s&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(s-r.getLengthInBits())/8;for(let u=0;u<a;u++)r.put(u%2?17:236,8);return Te(r,t,e)}function Te(t,e,i){const r=x.getSymbolTotalCodewords(e),o=ut.getTotalCodewordsCount(e,i),n=r-o,s=ut.getBlocksCount(e,i),a=r%s,u=s-a,f=Math.floor(r/s),d=Math.floor(n/s),p=d+1,C=f-d,w=new we(C);let y=0;const c=new Array(s),E=new Array(s);let l=0;const m=new Uint8Array(t.buffer);for(let A=0;A<s;A++){const S=A<u?d:p;c[A]=m.slice(y,y+S),E[A]=w.encode(c[A]),y+=S,l=Math.max(l,S)}const h=new Uint8Array(r);let g=0,B,b;for(B=0;B<l;B++)for(b=0;b<s;b++)B<c[b].length&&(h[g++]=c[b][B]);for(B=0;B<C;B++)for(b=0;b<s;b++)h[g++]=E[b][B];return h}function Ne(t,e,i,r){let o;if(Array.isArray(t))o=nt.fromArray(t);else if(typeof t=="string"){let f=e;if(!f){const d=nt.rawSplit(t);f=q.getBestVersionForData(d,i)}o=nt.fromString(t,f||40)}else throw new Error("Invalid data");const n=q.getBestVersionForData(o,i);if(!n)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=n;else if(e<n)throw new Error(`
|
|
The chosen QR Code version cannot contain this amount of data.
|
|
Minimum version required to store current data is: `+n+`.
|
|
`);const s=Ae(e,i,o),a=x.getSymbolSize(e),u=new de(a);return ye(u,e),Ee(u),Be(u,e),ot(u,i,0),e>=7&&pe(u,e),be(u,s),isNaN(r)&&(r=st.getBestMask(u,ot.bind(null,u,i))),st.applyMask(r,u),ot(u,i,r),{modules:u,version:e,errorCorrectionLevel:i,maskPattern:r,segments:o}}Bt.create=function(e,i){if(typeof e>"u"||e==="")throw new Error("No input text");let r=et.M,o,n;return typeof i<"u"&&(r=et.from(i.errorCorrectionLevel,et.M),o=q.from(i.version),n=st.from(i.maskPattern),i.toSJISFunc&&x.setToSJISFunction(i.toSJISFunc)),Ne(e,o,r,n)};var Dt={},dt={};(function(t){function e(i){if(typeof i=="number"&&(i=i.toString()),typeof i!="string")throw new Error("Color should be defined as hex string");let r=i.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+i);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(n){return[n,n]}))),r.length===6&&r.push("F","F");const o=parseInt(r.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+r.slice(0,6).join("")}}t.getOptions=function(r){r||(r={}),r.color||(r.color={});const o=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,n=r.width&&r.width>=21?r.width:void 0,s=r.scale||4;return{width:n,scale:n?4:s,margin:o,color:{dark:e(r.color.dark||"#000000ff"),light:e(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},t.getScale=function(r,o){return o.width&&o.width>=r+o.margin*2?o.width/(r+o.margin*2):o.scale},t.getImageWidth=function(r,o){const n=t.getScale(r,o);return Math.floor((r+o.margin*2)*n)},t.qrToImageData=function(r,o,n){const s=o.modules.size,a=o.modules.data,u=t.getScale(s,n),f=Math.floor((s+n.margin*2)*u),d=n.margin*u,p=[n.color.light,n.color.dark];for(let C=0;C<f;C++)for(let w=0;w<f;w++){let y=(C*f+w)*4,c=n.color.light;if(C>=d&&w>=d&&C<f-d&&w<f-d){const E=Math.floor((C-d)/u),l=Math.floor((w-d)/u);c=p[a[E*s+l]?1:0]}r[y++]=c.r,r[y++]=c.g,r[y++]=c.b,r[y]=c.a}}})(dt);(function(t){const e=dt;function i(o,n,s){o.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=s,n.width=s,n.style.height=s+"px",n.style.width=s+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(n,s,a){let u=a,f=s;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(f=r()),u=e.getOptions(u);const d=e.getImageWidth(n.modules.size,u),p=f.getContext("2d"),C=p.createImageData(d,d);return e.qrToImageData(C.data,n,u),i(p,f,d),p.putImageData(C,0,0),f},t.renderToDataURL=function(n,s,a){let u=a;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const f=t.render(n,s,u),d=u.type||"image/png",p=u.rendererOpts||{};return f.toDataURL(d,p.quality)}})(Dt);var Vt={};const Ie=dt;function Et(t,e){const i=t.a/255,r=e+'="'+t.hex+'"';return i<1?r+" "+e+'-opacity="'+i.toFixed(2).slice(1)+'"':r}function rt(t,e,i){let r=t+e;return typeof i<"u"&&(r+=" "+i),r}function Se(t,e,i){let r="",o=0,n=!1,s=0;for(let a=0;a<t.length;a++){const u=Math.floor(a%e),f=Math.floor(a/e);!u&&!n&&(n=!0),t[a]?(s++,a>0&&u>0&&t[a-1]||(r+=n?rt("M",u+i,.5+f+i):rt("m",o,0),o=0,n=!1),u+1<e&&t[a+1]||(r+=rt("h",s),s=0)):o++}return r}Vt.render=function(e,i,r){const o=Ie.getOptions(i),n=e.modules.size,s=e.modules.data,a=n+o.margin*2,u=o.color.light.a?"<path "+Et(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",f="<path "+Et(o.color.dark,"stroke")+' d="'+Se(s,n,o.margin)+'"/>',d='viewBox="0 0 '+a+" "+a+'"',C='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+u+f+`</svg>
|
|
`;return typeof r=="function"&&r(null,C),C};const Me=Kt,at=Bt,Ut=Dt,Pe=Vt;function gt(t,e,i,r,o){const n=[].slice.call(arguments,1),s=n.length,a=typeof n[s-1]=="function";if(!a&&!Me())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=i,i=e,e=r=void 0):s===3&&(e.getContext&&typeof o>"u"?(o=r,r=void 0):(o=r,r=i,i=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(i=e,e=r=void 0):s===2&&!e.getContext&&(r=i,i=e,e=void 0),new Promise(function(u,f){try{const d=at.create(i,r);u(t(d,e,r))}catch(d){f(d)}})}try{const u=at.create(i,r);o(null,t(u,e,r))}catch(u){o(u)}}O.create=at.create;O.toCanvas=gt.bind(null,Ut.render);O.toDataURL=gt.bind(null,Ut.renderToDataURL);O.toString=gt.bind(null,function(t,e,i){return Pe.render(t,i)});const Re={tag:$.string.validate(t=>["canvas","img"].includes(t)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:$.number.def(200),logo:{type:[String,Object],default:()=>""},disabled:$.bool.def(!1),disabledText:$.string.def("")},Le=Vue.defineComponent({name:"ReQrcode",props:Re,emits:["done","click","disabled-click"],setup(t,{emit:e}){const{toCanvas:i,toDataURL:r}=O,o=Vue.ref(!0),n=Vue.ref(null),s=Vue.computed(()=>String(t.text)),a=Vue.computed(()=>({width:t.width+"px",height:t.width+"px"})),u=async()=>{await Vue.nextTick();const c=kt(t.options||{});if(t.tag==="canvas"){c.errorCorrectionLevel=c.errorCorrectionLevel||p(Vue.unref(s));const E=await d(Vue.unref(s),c);c.scale=t.width===0?void 0:t.width/E*4;const l=await i(Vue.unref(n),Vue.unref(s),c);if(t.logo){const m=await f(l);e("done",m),o.value=!1}else e("done",l.toDataURL()),o.value=!1}else{const E=await r(s.value,{errorCorrectionLevel:"H",width:t.width,...c});Vue.unref(n).src=E,e("done",E),o.value=!1}};Vue.watch(()=>s.value,c=>{c&&u()},{deep:!0,immediate:!0});const f=c=>{const E=c.width,l=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},mt(t.logo)?{}:t.logo),{logoSize:m=.15,bgColor:h="#ffffff",borderSize:g=.05,crossOrigin:B="anonymous",borderRadius:b=8,logoRadius:A=0}=l,S=mt(t.logo)?t.logo:t.logo.src,I=E*m,N=E*(1-m)/2,R=E*(m+g),D=E*(1-m-g)/2,T=c.getContext("2d");if(!T)return;C(T)(D,D,R,R,b),T.fillStyle=h,T.fill();const k=new Image;(B||A)&&k.setAttribute("crossOrigin",B),k.src=S;const _t=z=>{T.drawImage(z,N,N,I,I)},Ft=z=>{const Y=document.createElement("canvas");Y.width=N+I,Y.height=N+I;const ht=Y.getContext("2d");if(!ht||!T||(ht.drawImage(z,N,N,I,I),C(T)(N,N,I,I,A),!T))return;const wt=T.createPattern(Y,"no-repeat");wt&&(T.fillStyle=wt,T.fill())};return new Promise(z=>{k.onload=()=>{A?Ft(k):_t(k),z(c.toDataURL())}})},d=async(c,E)=>{const l=document.createElement("canvas");return await i(l,c,E),l.width},p=c=>c.length>36?"M":c.length>16?"Q":"H",C=c=>(E,l,m,h,g)=>{const B=Math.min(m,h);return g>B/2&&(g=B/2),c.beginPath(),c.moveTo(E+g,l),c.arcTo(E+m,l,E+m,l+h,g),c.arcTo(E+m,l+h,E,l+h,g),c.arcTo(E,l+h,E,l,g),c.arcTo(E,l,E+m,l,g),c.closePath(),c},w=()=>{e("click")},y=()=>{e("disabled-click")};return()=>Vue.createVNode(Vue.Fragment,null,[Vue.withDirectives(Vue.createVNode("div",{class:"qrcode relative inline-block",style:Vue.unref(a)},[t.tag==="canvas"?Vue.createVNode("canvas",{ref:n,onClick:w},null):Vue.createVNode("img",{ref:n,onClick:w},null),t.disabled&&Vue.createVNode("div",{class:"qrcode--disabled absolute top-0 left-0 flex w-full h-full items-center justify-center",onClick:y},[Vue.createVNode("div",{class:"absolute top-[50%] left-[50%] font-bold"},[Vue.createVNode(Vue.resolveComponent("iconify-icon-offline"),{class:"cursor-pointer",icon:Ht,width:"30",color:"var(--el-color-primary)"},null),Vue.createVNode("div",null,[t.disabledText])])])]),[[Vue.resolveDirective("loading"),Vue.unref(o)]])])}}),ve=zt(Le),_e=ve;export{_e as R};
|