Qrcode-zZc5BE7m.js 26 KB

12345678
  1. import{B as W,a3 as Qt,b_ as qt,bm as bt,o as $t,v as Xt,_ as Zt}from"./index-CKIhG1T4.js";import{C as Wt,a as Bt,f as Tt,w as Gt,V as te,D as at,E as It,T as ee,X as ne,W as Mt,u as J,F as Pt,$ as re,_ as oe,Y as ie,a4 as se,n as ae}from"./spreadSheetsDesignerVue-MRUT1X_l.js";var q={},Nt={},R={};let ut;const ue=[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];R.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},R.getSymbolTotalCodewords=function(t){return ue[t]},R.getBCHDigit=function(t){let r=0;for(;t!==0;)r++,t>>>=1;return r},R.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');ut=t},R.isKanjiModeEnabled=function(){return ut!==void 0},R.toSJIS=function(t){return ut(t)};var S,G={};function Rt(){this.buffer=[],this.length=0}(S=G).L={bit:1},S.M={bit:0},S.Q={bit:3},S.H={bit:2},S.isValid=function(t){return t&&t.bit!==void 0&&t.bit>=0&&t.bit<4},S.from=function(t,r){if(S.isValid(t))return t;try{return function(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return S.L;case"m":case"medium":return S.M;case"q":case"quartile":return S.Q;case"h":case"high":return S.H;default:throw new Error("Unknown EC Level: "+e)}}(t)}catch{return r}},Rt.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)==1},put:function(t,r){for(let e=0;e<r;e++)this.putBit((t>>>r-e-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}};var ce=Rt;function $(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)}$.prototype.set=function(t,r,e,n){const o=t*this.size+r;this.data[o]=e,n&&(this.reservedBit[o]=!0)},$.prototype.get=function(t,r){return this.data[t*this.size+r]},$.prototype.xor=function(t,r,e){this.data[t*this.size+r]^=e},$.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]};var le=$,Lt={};(function(t){const r=R.getSymbolSize;t.getRowColCoords=function(e){if(e===1)return[];const n=Math.floor(e/7)+2,o=r(e),i=o===145?26:2*Math.ceil((o-13)/(2*n-2)),s=[o-7];for(let f=1;f<n-1;f++)s[f]=s[f-1]-i;return s.push(6),s.reverse()},t.getPositions=function(e){const n=[],o=t.getRowColCoords(e),i=o.length;for(let s=0;s<i;s++)for(let f=0;f<i;f++)s===0&&f===0||s===0&&f===i-1||s===i-1&&f===0||n.push([o[s],o[f]]);return n}})(Lt);var xt={};const fe=R.getSymbolSize;xt.getPositions=function(t){const r=fe(t);return[[0,0],[r-7,0],[0,r-7]]};var St={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function r(e,n,o){switch(e){case t.Patterns.PATTERN000:return(n+o)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return o%3==0;case t.Patterns.PATTERN011:return(n+o)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(o/3))%2==0;case t.Patterns.PATTERN101:return n*o%2+n*o%3==0;case t.Patterns.PATTERN110:return(n*o%2+n*o%3)%2==0;case t.Patterns.PATTERN111:return(n*o%3+(n+o)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const n=e.size;let o=0,i=0,s=0,f=null,p=null;for(let a=0;a<n;a++){i=s=0,f=p=null;for(let h=0;h<n;h++){let u=e.get(a,h);u===f?i++:(i>=5&&(o+=i-5+3),f=u,i=1),u=e.get(h,a),u===p?s++:(s>=5&&(o+=s-5+3),p=u,s=1)}i>=5&&(o+=i-5+3),s>=5&&(o+=s-5+3)}return o},t.getPenaltyN2=function(e){const n=e.size;let o=0;for(let i=0;i<n-1;i++)for(let s=0;s<n-1;s++){const f=e.get(i,s)+e.get(i,s+1)+e.get(i+1,s)+e.get(i+1,s+1);f!==4&&f!==0||o++}return 3*o},t.getPenaltyN3=function(e){const n=e.size;let o=0,i=0,s=0;for(let f=0;f<n;f++){i=s=0;for(let p=0;p<n;p++)i=i<<1&2047|e.get(f,p),p>=10&&(i===1488||i===93)&&o++,s=s<<1&2047|e.get(p,f),p>=10&&(s===1488||s===93)&&o++}return 40*o},t.getPenaltyN4=function(e){let n=0;const o=e.data.length;for(let i=0;i<o;i++)n+=e.data[i];return 10*Math.abs(Math.ceil(100*n/o/5)-10)},t.applyMask=function(e,n){const o=n.size;for(let i=0;i<o;i++)for(let s=0;s<o;s++)n.isReserved(s,i)||n.xor(s,i,r(e,s,i))},t.getBestMask=function(e,n){const o=Object.keys(t.Patterns).length;let i=0,s=1/0;for(let f=0;f<o;f++){n(f),t.applyMask(f,e);const p=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(f,e),p<s&&(s=p,i=f)}return i}})(St);var tt={};const H=G,et=[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],nt=[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];tt.getBlocksCount=function(t,r){switch(r){case H.L:return et[4*(t-1)+0];case H.M:return et[4*(t-1)+1];case H.Q:return et[4*(t-1)+2];case H.H:return et[4*(t-1)+3];default:return}},tt.getTotalCodewordsCount=function(t,r){switch(r){case H.L:return nt[4*(t-1)+0];case H.M:return nt[4*(t-1)+1];case H.Q:return nt[4*(t-1)+2];case H.H:return nt[4*(t-1)+3];default:return}};var Ut={},rt={};const X=new Uint8Array(512),ot=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)X[r]=t,ot[t]=r,t<<=1,256&t&&(t^=285);for(let r=255;r<512;r++)X[r]=X[r-255]})(),rt.log=function(t){if(t<1)throw new Error("log("+t+")");return ot[t]},rt.exp=function(t){return X[t]},rt.mul=function(t,r){return t===0||r===0?0:X[ot[t]+ot[r]]},function(t){const r=rt;t.mul=function(e,n){const o=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let s=0;s<n.length;s++)o[i+s]^=r.mul(e[i],n[s]);return o},t.mod=function(e,n){let o=new Uint8Array(e);for(;o.length-n.length>=0;){const i=o[0];for(let f=0;f<n.length;f++)o[f]^=r.mul(n[f],i);let s=0;for(;s<o.length&&o[s]===0;)s++;o=o.slice(s)}return o},t.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=t.mul(n,new Uint8Array([1,r.exp(o)]));return n}}(Ut);const kt=Ut;function ct(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}ct.prototype.initialize=function(t){this.degree=t,this.genPoly=kt.generateECPolynomial(this.degree)},ct.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(t.length+this.degree);r.set(t);const e=kt.mod(r,this.genPoly),n=this.degree-e.length;if(n>0){const o=new Uint8Array(this.degree);return o.set(e,n),o}return e};var de=ct,zt={},Y={},_t={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},U={};const Dt="[0-9]+";let Z="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Z=Z.replace(/u/g,"\\u");const he="(?:(?![A-Z0-9 $%*+\\-./:]|"+Z+`)(?:.|[\r
  2. ]))+`;U.KANJI=new RegExp(Z,"g"),U.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),U.BYTE=new RegExp(he,"g"),U.NUMERIC=new RegExp(Dt,"g"),U.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const ge=new RegExp("^"+Z+"$"),pe=new RegExp("^"+Dt+"$"),we=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");U.testKanji=function(t){return ge.test(t)},U.testNumeric=function(t){return pe.test(t)},U.testAlphanumeric=function(t){return we.test(t)},function(t){const r=_t,e=U;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(n,o){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!r.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?n.ccBits[0]:o<27?n.ccBits[1]:n.ccBits[2]},t.getBestModeForData=function(n){return e.testNumeric(n)?t.NUMERIC:e.testAlphanumeric(n)?t.ALPHANUMERIC:e.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},t.from=function(n,o){if(t.isValid(n))return n;try{return function(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.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: "+i)}}(n)}catch{return o}}}(Y),function(t){const r=R,e=tt,n=G,o=Y,i=_t,s=r.getBCHDigit(7973);function f(a,h){return o.getCharCountIndicator(a,h)+4}function p(a,h){let u=0;return a.forEach(function(d){const y=f(d.mode,h);u+=y+d.getBitsLength()}),u}t.from=function(a,h){return i.isValid(a)?parseInt(a,10):h},t.getCapacity=function(a,h,u){if(!i.isValid(a))throw new Error("Invalid QR Code version");u===void 0&&(u=o.BYTE);const d=8*(r.getSymbolTotalCodewords(a)-e.getTotalCodewordsCount(a,h));if(u===o.MIXED)return d;const y=d-f(u,a);switch(u){case o.NUMERIC:return Math.floor(y/10*3);case o.ALPHANUMERIC:return Math.floor(y/11*2);case o.KANJI:return Math.floor(y/13);case o.BYTE:default:return Math.floor(y/8)}},t.getBestVersionForData=function(a,h){let u;const d=n.from(h,n.M);if(Array.isArray(a)){if(a.length>1)return function(y,l){for(let g=1;g<=40;g++)if(p(y,g)<=t.getCapacity(g,l,o.MIXED))return g}(a,d);if(a.length===0)return 1;u=a[0]}else u=a;return function(y,l,g){for(let c=1;c<=40;c++)if(l<=t.getCapacity(c,g,y))return c}(u.mode,u.getLength(),d)},t.getEncodedBits=function(a){if(!i.isValid(a)||a<7)throw new Error("Invalid QR Code version");let h=a<<12;for(;r.getBCHDigit(h)-s>=0;)h^=7973<<r.getBCHDigit(h)-s;return a<<12|h}}(zt);var Ft={};const lt=R,Ht=lt.getBCHDigit(1335);Ft.getEncodedBits=function(t,r){const e=t.bit<<3|r;let n=e<<10;for(;lt.getBCHDigit(n)-Ht>=0;)n^=1335<<lt.getBCHDigit(n)-Ht;return 21522^(e<<10|n)};var Yt={};const me=Y;function K(t){this.mode=me.NUMERIC,this.data=t.toString()}K.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},K.prototype.getLength=function(){return this.data.length},K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)},K.prototype.write=function(t){let r,e,n;for(r=0;r+3<=this.data.length;r+=3)e=this.data.substr(r,3),n=parseInt(e,10),t.put(n,10);const o=this.data.length-r;o>0&&(e=this.data.substr(r),n=parseInt(e,10),t.put(n,3*o+1))};var ye=K;const Ee=Y,ft=["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 O(t){this.mode=Ee.ALPHANUMERIC,this.data=t}O.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},O.prototype.getLength=function(){return this.data.length},O.prototype.getBitsLength=function(){return O.getBitsLength(this.data.length)},O.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let e=45*ft.indexOf(this.data[r]);e+=ft.indexOf(this.data[r+1]),t.put(e,11)}this.data.length%2&&t.put(ft.indexOf(this.data[r]),6)};var ve=O;const Ce=Y;function j(t){this.mode=Ce.BYTE,this.data=typeof t=="string"?new TextEncoder().encode(t):new Uint8Array(t)}j.getBitsLength=function(t){return 8*t},j.prototype.getLength=function(){return this.data.length},j.prototype.getBitsLength=function(){return j.getBitsLength(this.data.length)},j.prototype.write=function(t){for(let r=0,e=this.data.length;r<e;r++)t.put(this.data[r],8)};var Ae=j;const be=Y,Be=R;function V(t){this.mode=be.KANJI,this.data=t}V.getBitsLength=function(t){return 13*t},V.prototype.getLength=function(){return this.data.length},V.prototype.getBitsLength=function(){return V.getBitsLength(this.data.length)},V.prototype.write=function(t){let r;for(r=0;r<this.data.length;r++){let e=Be.toSJIS(this.data[r]);if(e>=33088&&e<=40956)e-=33088;else{if(!(e>=57408&&e<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+`
  3. Make sure your charset is UTF-8`);e-=49472}e=192*(e>>>8&255)+(255&e),t.put(e,13)}};var Te=V,Jt={exports:{}};(function(t){var r={single_source_shortest_paths:function(e,n,o){var i={},s={};s[n]=0;var f,p,a,h,u,d,y,l=r.PriorityQueue.make();for(l.push(n,0);!l.empty();)for(a in p=(f=l.pop()).value,h=f.cost,u=e[p]||{})u.hasOwnProperty(a)&&(d=h+u[a],y=s[a],(s[a]===void 0||y>d)&&(s[a]=d,l.push(a,d),i[a]=p));if(o!==void 0&&s[o]===void 0){var g=["Could not find a path from ",n," to ",o,"."].join("");throw new Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,n){for(var o=[],i=n;i;)o.push(i),e[i],i=e[i];return o.reverse(),o},find_path:function(e,n,o){var i=r.single_source_shortest_paths(e,n,o);return r.extract_shortest_path_from_predecessor_list(i,o)},PriorityQueue:{make:function(e){var n,o=r.PriorityQueue,i={};for(n in e=e||{},o)o.hasOwnProperty(n)&&(i[n]=o[n]);return i.queue=[],i.sorter=e.sorter||o.default_sorter,i},default_sorter:function(e,n){return e.cost-n.cost},push:function(e,n){var o={value:e,cost:n};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=r})(Jt);var Ie=Jt.exports;(function(t){const r=Y,e=ye,n=ve,o=Ae,i=Te,s=U,f=R,p=Ie;function a(l){return unescape(encodeURIComponent(l)).length}function h(l,g,c){const E=[];let m;for(;(m=l.exec(c))!==null;)E.push({data:m[0],index:m.index,mode:g,length:m[0].length});return E}function u(l){const g=h(s.NUMERIC,r.NUMERIC,l),c=h(s.ALPHANUMERIC,r.ALPHANUMERIC,l);let E,m;return f.isKanjiModeEnabled()?(E=h(s.BYTE,r.BYTE,l),m=h(s.KANJI,r.KANJI,l)):(E=h(s.BYTE_KANJI,r.BYTE,l),m=[]),g.concat(c,E,m).sort(function(v,w){return v.index-w.index}).map(function(v){return{data:v.data,mode:v.mode,length:v.length}})}function d(l,g){switch(g){case r.NUMERIC:return e.getBitsLength(l);case r.ALPHANUMERIC:return n.getBitsLength(l);case r.KANJI:return i.getBitsLength(l);case r.BYTE:return o.getBitsLength(l)}}function y(l,g){let c;const E=r.getBestModeForData(l);if(c=r.from(g,E),c!==r.BYTE&&c.bit<E.bit)throw new Error('"'+l+'" cannot be encoded with mode '+r.toString(c)+`.
  4. Suggested mode is: `+r.toString(E));switch(c!==r.KANJI||f.isKanjiModeEnabled()||(c=r.BYTE),c){case r.NUMERIC:return new e(l);case r.ALPHANUMERIC:return new n(l);case r.KANJI:return new i(l);case r.BYTE:return new o(l)}}t.fromArray=function(l){return l.reduce(function(g,c){return typeof c=="string"?g.push(y(c,null)):c.data&&g.push(y(c.data,c.mode)),g},[])},t.fromString=function(l,g){const c=function(w){const A=[];for(let b=0;b<w.length;b++){const C=w[b];switch(C.mode){case r.NUMERIC:A.push([C,{data:C.data,mode:r.ALPHANUMERIC,length:C.length},{data:C.data,mode:r.BYTE,length:C.length}]);break;case r.ALPHANUMERIC:A.push([C,{data:C.data,mode:r.BYTE,length:C.length}]);break;case r.KANJI:A.push([C,{data:C.data,mode:r.BYTE,length:a(C.data)}]);break;case r.BYTE:A.push([{data:C.data,mode:r.BYTE,length:a(C.data)}])}}return A}(u(l,f.isKanjiModeEnabled())),E=function(w,A){const b={},C={start:{}};let P=["start"];for(let N=0;N<w.length;N++){const k=w[N],z=[];for(let I=0;I<k.length;I++){const T=k[I],L=""+N+I;z.push(L),b[L]={node:T,lastCount:0},C[L]={};for(let _=0;_<P.length;_++){const B=P[_];b[B]&&b[B].node.mode===T.mode?(C[B][L]=d(b[B].lastCount+T.length,T.mode)-d(b[B].lastCount,T.mode),b[B].lastCount+=T.length):(b[B]&&(b[B].lastCount=T.length),C[B][L]=d(T.length,T.mode)+4+r.getCharCountIndicator(T.mode,A))}}P=z}for(let N=0;N<P.length;N++)C[P[N]].end=0;return{map:C,table:b}}(c,g),m=p.find_path(E.map,"start","end"),v=[];for(let w=1;w<m.length-1;w++)v.push(E.table[m[w]].node);return t.fromArray(v.reduce(function(w,A){const b=w.length-1>=0?w[w.length-1]:null;return b&&b.mode===A.mode?(w[w.length-1].data+=A.data,w):(w.push(A),w)},[]))},t.rawSplit=function(l){return t.fromArray(u(l,f.isKanjiModeEnabled()))}})(Yt);const it=R,dt=G,Me=ce,Pe=le,Ne=Lt,Re=xt,ht=St,gt=tt,Le=de,st=zt,xe=Ft,Se=Y,pt=Yt;function wt(t,r,e){const n=t.size,o=xe.getEncodedBits(r,e);let i,s;for(i=0;i<15;i++)s=(o>>i&1)==1,i<6?t.set(i,8,s,!0):i<8?t.set(i+1,8,s,!0):t.set(n-15+i,8,s,!0),i<8?t.set(8,n-i-1,s,!0):i<9?t.set(8,15-i-1+1,s,!0):t.set(8,15-i-1,s,!0);t.set(n-8,8,1,!0)}function Ue(t,r,e,n){let o;if(Array.isArray(t))o=pt.fromArray(t);else{if(typeof t!="string")throw new Error("Invalid data");{let a=r;if(!a){const h=pt.rawSplit(t);a=st.getBestVersionForData(h,e)}o=pt.fromString(t,a||40)}}const i=st.getBestVersionForData(o,e);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(r){if(r<i)throw new Error(`
  5. The chosen QR Code version cannot contain this amount of data.
  6. Minimum version required to store current data is: `+i+`.
  7. `)}else r=i;const s=function(a,h,u){const d=new Me;u.forEach(function(g){d.put(g.mode.bit,4),d.put(g.getLength(),Se.getCharCountIndicator(g.mode,a)),g.write(d)});const y=8*(it.getSymbolTotalCodewords(a)-gt.getTotalCodewordsCount(a,h));for(d.getLengthInBits()+4<=y&&d.put(0,4);d.getLengthInBits()%8!=0;)d.putBit(0);const l=(y-d.getLengthInBits())/8;for(let g=0;g<l;g++)d.put(g%2?17:236,8);return function(g,c,E){const m=it.getSymbolTotalCodewords(c),v=m-gt.getTotalCodewordsCount(c,E),w=gt.getBlocksCount(c,E),A=w-m%w,b=Math.floor(m/w),C=Math.floor(v/w),P=C+1,N=b-C,k=new Le(N);let z=0;const I=new Array(w),T=new Array(w);let L=0;const _=new Uint8Array(g.buffer);for(let D=0;D<w;D++){const F=D<A?C:P;I[D]=_.slice(z,z+F),T[D]=k.encode(I[D]),z+=F,L=Math.max(L,F)}const B=new Uint8Array(m);let M,x,Q=0;for(M=0;M<L;M++)for(x=0;x<w;x++)M<I[x].length&&(B[Q++]=I[x][M]);for(M=0;M<N;M++)for(x=0;x<w;x++)B[Q++]=T[x][M];return B}(d,a,h)}(r,e,o),f=it.getSymbolSize(r),p=new Pe(f);return function(a,h){const u=a.size,d=Re.getPositions(h);for(let y=0;y<d.length;y++){const l=d[y][0],g=d[y][1];for(let c=-1;c<=7;c++)if(!(l+c<=-1||u<=l+c))for(let E=-1;E<=7;E++)g+E<=-1||u<=g+E||(c>=0&&c<=6&&(E===0||E===6)||E>=0&&E<=6&&(c===0||c===6)||c>=2&&c<=4&&E>=2&&E<=4?a.set(l+c,g+E,!0,!0):a.set(l+c,g+E,!1,!0))}}(p,r),function(a){const h=a.size;for(let u=8;u<h-8;u++){const d=u%2==0;a.set(u,6,d,!0),a.set(6,u,d,!0)}}(p),function(a,h){const u=Ne.getPositions(h);for(let d=0;d<u.length;d++){const y=u[d][0],l=u[d][1];for(let g=-2;g<=2;g++)for(let c=-2;c<=2;c++)g===-2||g===2||c===-2||c===2||g===0&&c===0?a.set(y+g,l+c,!0,!0):a.set(y+g,l+c,!1,!0)}}(p,r),wt(p,e,0),r>=7&&function(a,h){const u=a.size,d=st.getEncodedBits(h);let y,l,g;for(let c=0;c<18;c++)y=Math.floor(c/3),l=c%3+u-8-3,g=(d>>c&1)==1,a.set(y,l,g,!0),a.set(l,y,g,!0)}(p,r),function(a,h){const u=a.size;let d=-1,y=u-1,l=7,g=0;for(let c=u-1;c>0;c-=2)for(c===6&&c--;;){for(let E=0;E<2;E++)if(!a.isReserved(y,c-E)){let m=!1;g<h.length&&(m=(h[g]>>>l&1)==1),a.set(y,c-E,m),l--,l===-1&&(g++,l=7)}if(y+=d,y<0||u<=y){y-=d,d=-d;break}}}(p,s),isNaN(n)&&(n=ht.getBestMask(p,wt.bind(null,p,e))),ht.applyMask(n,p),wt(p,e,n),{modules:p,version:r,errorCorrectionLevel:e,maskPattern:n,segments:o}}Nt.create=function(t,r){if(t===void 0||t==="")throw new Error("No input text");let e,n,o=dt.M;return r!==void 0&&(o=dt.from(r.errorCorrectionLevel,dt.M),e=st.from(r.version),n=ht.from(r.maskPattern),r.toSJISFunc&&it.setToSJISFunction(r.toSJISFunc)),Ue(t,e,o,n)};var Kt={},mt={};(function(t){function r(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let n=e.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+e);n.length!==3&&n.length!==4||(n=Array.prototype.concat.apply([],n.map(function(i){return[i,i]}))),n.length===6&&n.push("F","F");const o=parseInt(n.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:255&o,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:o,scale:o?4:i,margin:n,color:{dark:r(e.color.dark||"#000000ff"),light:r(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,n){return n.width&&n.width>=e+2*n.margin?n.width/(e+2*n.margin):n.scale},t.getImageWidth=function(e,n){const o=t.getScale(e,n);return Math.floor((e+2*n.margin)*o)},t.qrToImageData=function(e,n,o){const i=n.modules.size,s=n.modules.data,f=t.getScale(i,o),p=Math.floor((i+2*o.margin)*f),a=o.margin*f,h=[o.color.light,o.color.dark];for(let u=0;u<p;u++)for(let d=0;d<p;d++){let y=4*(u*p+d),l=o.color.light;u>=a&&d>=a&&u<p-a&&d<p-a&&(l=h[s[Math.floor((u-a)/f)*i+Math.floor((d-a)/f)]?1:0]),e[y++]=l.r,e[y++]=l.g,e[y++]=l.b,e[y]=l.a}}})(mt),function(t){const r=mt;t.render=function(e,n,o){let i=o,s=n;i!==void 0||n&&n.getContext||(i=n,n=void 0),n||(s=function(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}()),i=r.getOptions(i);const f=r.getImageWidth(e.modules.size,i),p=s.getContext("2d"),a=p.createImageData(f,f);return r.qrToImageData(a.data,e,i),function(h,u,d){h.clearRect(0,0,u.width,u.height),u.style||(u.style={}),u.height=d,u.width=d,u.style.height=d+"px",u.style.width=d+"px"}(p,s,f),p.putImageData(a,0,0),s},t.renderToDataURL=function(e,n,o){let i=o;i!==void 0||n&&n.getContext||(i=n,n=void 0),i||(i={});const s=t.render(e,n,i),f=i.type||"image/png",p=i.rendererOpts||{};return s.toDataURL(f,p.quality)}}(Kt);var Ot={};const ke=mt;function jt(t,r){const e=t.a/255,n=r+'="'+t.hex+'"';return e<1?n+" "+r+'-opacity="'+e.toFixed(2).slice(1)+'"':n}function yt(t,r,e){let n=t+r;return e!==void 0&&(n+=" "+e),n}Ot.render=function(t,r,e){const n=ke.getOptions(r),o=t.modules.size,i=t.modules.data,s=o+2*n.margin,f=n.color.light.a?"<path "+jt(n.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",p="<path "+jt(n.color.dark,"stroke")+' d="'+function(u,d,y){let l="",g=0,c=!1,E=0;for(let m=0;m<u.length;m++){const v=Math.floor(m%d),w=Math.floor(m/d);v||c||(c=!0),u[m]?(E++,m>0&&v>0&&u[m-1]||(l+=c?yt("M",v+y,.5+w+y):yt("m",g,0),g=0,c=!1),v+1<d&&u[m+1]||(l+=yt("h",E),E=0)):g++}return l}(i,o,n.margin)+'"/>',a='viewBox="0 0 '+s+" "+s+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+a+' shape-rendering="crispEdges">'+f+p+`</svg>
  8. `;return typeof e=="function"&&e(null,h),h};const Et=Nt,Vt=Kt,ze=Ot;function vt(t,r,e,n,o){const i=[].slice.call(arguments,1),s=i.length,f=typeof i[s-1]=="function";if(!(f||typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then))throw new Error("Callback required as last argument");if(!f){if(s<1)throw new Error("Too few arguments provided");return s===1?(e=r,r=n=void 0):s!==2||r.getContext||(n=e,e=r,r=void 0),new Promise(function(p,a){try{const h=Et.create(e,n);p(t(h,r,n))}catch(h){a(h)}})}if(s<2)throw new Error("Too few arguments provided");s===2?(o=e,e=r,r=n=void 0):s===3&&(r.getContext&&o===void 0?(o=n,n=void 0):(o=n,n=e,e=r,r=void 0));try{const p=Et.create(e,n);o(null,t(p,r,n))}catch(p){o(p)}}q.create=Et.create,q.toCanvas=vt.bind(null,Vt.render),q.toDataURL=vt.bind(null,Vt.renderToDataURL),q.toString=vt.bind(null,function(t,r,e){return ze.render(t,e)});const _e={class:"absolute left-[50%] top-[50%] font-bold"},De=Zt(Wt({name:"Qrcode",__name:"Qrcode",props:{tag:W.string.validate(t=>["canvas","img"].includes(t)).def("canvas"),text:{type:[String,Array],default:null},options:{type:Object,default:()=>({})},width:W.number.def(200),logo:{type:[String,Object],default:""},disabled:W.bool.def(!1),disabledText:W.string.def("")},emits:["done","click","disabled-click"],setup(t,{emit:r}){const e=t,n=r,{getPrefixCls:o}=Qt(),i=o("qrcode"),{toCanvas:s,toDataURL:f}=q,p=Bt(!0),a=Bt(null),h=Tt(()=>String(e.text)),u=Tt(()=>({width:e.width+"px",height:e.width+"px"}));Gt(()=>h.value,m=>{m&&(async()=>{await ae();const v=qt(e.options||{});if(e.tag==="canvas"){v.errorCorrectionLevel=v.errorCorrectionLevel||l(J(h));const w=await y(J(h),v);v.scale=e.width===0?void 0:e.width/w*4;const A=await s(J(a),J(h),v);if(e.logo){const b=await d(A);n("done",b),p.value=!1}else n("done",A.toDataURL()),p.value=!1}else{const w=await f(h.value,{errorCorrectionLevel:"H",width:e.width,...v});J(a).src=w,n("done",w),p.value=!1}})()},{deep:!0,immediate:!0});const d=m=>{const v=m.width,w=Object.assign({logoSize:.15,bgColor:"#ffffff",borderSize:.05,crossOrigin:"anonymous",borderRadius:8,logoRadius:0},bt(e.logo)?{}:e.logo),{logoSize:A=.15,bgColor:b="#ffffff",borderSize:C=.05,crossOrigin:P="anonymous",borderRadius:N=8,logoRadius:k=0}=w,z=bt(e.logo)?e.logo:e.logo.src,I=v*A,T=v*(1-A)/2,L=v*(A+C),_=v*(1-A-C)/2,B=m.getContext("2d");if(!B)return;g(B)(_,_,L,L,N),B.fillStyle=b,B.fill();const M=new Image;return(P||k)&&M.setAttribute("crossOrigin",P),M.src=z,new Promise(x=>{M.onload=()=>{var Q;k?(D=>{const F=document.createElement("canvas");F.width=T+I,F.height=T+I;const Ct=F.getContext("2d");if(!Ct||!B||(Ct.drawImage(D,T,T,I,I),g(B)(T,T,I,I,k),!B))return;const At=B.createPattern(F,"no-repeat");At&&(B.fillStyle=At,B.fill())})(M):(Q=M,B.drawImage(Q,T,T,I,I)),x(m.toDataURL())}})},y=async(m,v)=>{const w=document.createElement("canvas");return await s(w,m,v),w.width},l=m=>m.length>36?"M":m.length>16?"Q":"H",g=m=>(v,w,A,b,C)=>{const P=Math.min(A,b);return C>P/2&&(C=P/2),m.beginPath(),m.moveTo(v+C,w),m.arcTo(v+A,w,v+A,w+b,C),m.arcTo(v+A,w+b,v,w+b,C),m.arcTo(v,w+b,v,w,C),m.arcTo(v,w,v+A,w,C),m.closePath(),m},c=()=>{n("click")},E=()=>{n("disabled-click")};return(m,v)=>{const w=$t,A=Xt;return te((at(),It("div",{class:Mt([J(i),"relative inline-block"]),style:se(u.value)},[(at(),ee(ne(t.tag),{ref_key:"wrapRef",ref:a,onClick:c},null,512)),t.disabled?(at(),It("div",{key:0,class:Mt([`${J(i)}--disabled`,"absolute left-0 top-0 h-full w-full flex items-center justify-center"]),onClick:E},[Pt("div",_e,[re(w,{size:30,color:"var(--el-color-primary)",icon:"ep:refresh-right"}),Pt("div",null,oe(t.disabledText),1)])],2)):ie("",!0)],6)),[[A,p.value]])}}}),[["__scopeId","data-v-8fc6cf2d"]]);export{De as _};