7 lines
65 KiB
JavaScript
7 lines
65 KiB
JavaScript
import{g as Yt}from"./_commonjsHelpers-Cpj98o6Y.js";function $t(kt,Gt){for(var Dt=0;Dt<Gt.length;Dt++){const ft=Gt[Dt];if(typeof ft!="string"&&!Array.isArray(ft)){for(const it in ft)if(it!=="default"&&!(it in kt)){const Y=Object.getOwnPropertyDescriptor(ft,it);Y&&Object.defineProperty(kt,it,Y.get?Y:{enumerable:!0,get:()=>ft[it]})}}}return Object.freeze(Object.defineProperty(kt,Symbol.toStringTag,{value:"Module"}))}var Xt={exports:{}};(function(kt,Gt){(function(Dt,ft){kt.exports=ft()})(self,function(){return(()=>{var Dt={192:(Y,V)=>{var dt,qt,Nt=function(){var st=function(m,y){var v=m,f=Ct[y],d=null,p=0,P=null,C=[],z={},X=function(u,w){d=function(l){for(var _=new Array(l),b=0;b<l;b+=1){_[b]=new Array(l);for(var I=0;I<l;I+=1)_[b][I]=null}return _}(p=4*v+17),$(0,0),$(p-7,0),$(0,p-7),W(),H(),tt(u,w),v>=7&&rt(u),P==null&&(P=mt(v,f,C)),Mt(P,w)},$=function(u,w){for(var l=-1;l<=7;l+=1)if(!(u+l<=-1||p<=u+l))for(var _=-1;_<=7;_+=1)w+_<=-1||p<=w+_||(d[u+l][w+_]=0<=l&&l<=6&&(_==0||_==6)||0<=_&&_<=6&&(l==0||l==6)||2<=l&&l<=4&&2<=_&&_<=4)},H=function(){for(var u=8;u<p-8;u+=1)d[u][6]==null&&(d[u][6]=u%2==0);for(var w=8;w<p-8;w+=1)d[6][w]==null&&(d[6][w]=w%2==0)},W=function(){for(var u=pt.getPatternPosition(v),w=0;w<u.length;w+=1)for(var l=0;l<u.length;l+=1){var _=u[w],b=u[l];if(d[_][b]==null)for(var I=-2;I<=2;I+=1)for(var L=-2;L<=2;L+=1)d[_+I][b+L]=I==-2||I==2||L==-2||L==2||I==0&&L==0}},rt=function(u){for(var w=pt.getBCHTypeNumber(v),l=0;l<18;l+=1){var _=!u&&(w>>l&1)==1;d[Math.floor(l/3)][l%3+p-8-3]=_}for(l=0;l<18;l+=1)_=!u&&(w>>l&1)==1,d[l%3+p-8-3][Math.floor(l/3)]=_},tt=function(u,w){for(var l=f<<3|w,_=pt.getBCHTypeInfo(l),b=0;b<15;b+=1){var I=!u&&(_>>b&1)==1;b<6?d[b][8]=I:b<8?d[b+1][8]=I:d[p-15+b][8]=I}for(b=0;b<15;b+=1)I=!u&&(_>>b&1)==1,b<8?d[8][p-b-1]=I:b<9?d[8][15-b-1+1]=I:d[8][15-b-1]=I;d[p-8][8]=!u},Mt=function(u,w){for(var l=-1,_=p-1,b=7,I=0,L=pt.getMaskFunction(w),N=p-1;N>0;N-=2)for(N==6&&(N-=1);;){for(var a=0;a<2;a+=1)if(d[_][N-a]==null){var t=!1;I<u.length&&(t=(u[I]>>>b&1)==1),L(_,N-a)&&(t=!t),d[_][N-a]=t,(b-=1)==-1&&(I+=1,b=7)}if((_+=l)<0||p<=_){_-=l,l=-l;break}}},mt=function(u,w,l){for(var _=Rt.getRSBlocks(u,w),b=K(),I=0;I<l.length;I+=1){var L=l[I];b.put(L.getMode(),4),b.put(L.getLength(),pt.getLengthInBits(L.getMode(),u)),L.write(b)}var N=0;for(I=0;I<_.length;I+=1)N+=_[I].dataCount;if(b.getLengthInBits()>8*N)throw"code length overflow. ("+b.getLengthInBits()+">"+8*N+")";for(b.getLengthInBits()+4<=8*N&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*N||(b.put(236,8),b.getLengthInBits()>=8*N));)b.put(17,8);return function(a,t){for(var e=0,r=0,n=0,i=new Array(t.length),o=new Array(t.length),s=0;s<t.length;s+=1){var c=t[s].dataCount,g=t[s].totalCount-c;r=Math.max(r,c),n=Math.max(n,g),i[s]=new Array(c);for(var h=0;h<i[s].length;h+=1)i[s][h]=255&a.getBuffer()[h+e];e+=c;var x=pt.getErrorCorrectPolynomial(g),M=Pt(i[s],x.getLength()-1).mod(x);for(o[s]=new Array(x.getLength()-1),h=0;h<o[s].length;h+=1){var A=h+M.getLength()-o[s].length;o[s][h]=A>=0?M.getAt(A):0}}var E=0;for(h=0;h<t.length;h+=1)E+=t[h].totalCount;var T=new Array(E),R=0;for(h=0;h<r;h+=1)for(s=0;s<t.length;s+=1)h<i[s].length&&(T[R]=i[s][h],R+=1);for(h=0;h<n;h+=1)for(s=0;s<t.length;s+=1)h<o[s].length&&(T[R]=o[s][h],R+=1);return T}(b,_)};z.addData=function(u,w){var l=null;switch(w=w||"Byte"){case"Numeric":l=Bt(u);break;case"Alphanumeric":l=Lt(u);break;case"Byte":l=Tt(u);break;case"Kanji":l=xt(u);break;default:throw"mode:"+w}C.push(l),P=null},z.isDark=function(u,w){if(u<0||p<=u||w<0||p<=w)throw u+","+w;return d[u][w]},z.getModuleCount=function(){return p},z.make=function(){if(v<1){for(var u=1;u<40;u++){for(var w=Rt.getRSBlocks(u,f),l=K(),_=0;_<C.length;_++){var b=C[_];l.put(b.getMode(),4),l.put(b.getLength(),pt.getLengthInBits(b.getMode(),u)),b.write(l)}var I=0;for(_=0;_<w.length;_++)I+=w[_].dataCount;if(l.getLengthInBits()<=8*I)break}v=u}X(!1,function(){for(var L=0,N=0,a=0;a<8;a+=1){X(!0,a);var t=pt.getLostPoint(z);(a==0||L>t)&&(L=t,N=a)}return N}())},z.createTableTag=function(u,w){u=u||2;var l="";l+='<table style="',l+=" border-width: 0px; border-style: none;",l+=" border-collapse: collapse;",l+=" padding: 0px; margin: "+(w=w===void 0?4*u:w)+"px;",l+='">',l+="<tbody>";for(var _=0;_<z.getModuleCount();_+=1){l+="<tr>";for(var b=0;b<z.getModuleCount();b+=1)l+='<td style="',l+=" border-width: 0px; border-style: none;",l+=" border-collapse: collapse;",l+=" padding: 0px; margin: 0px;",l+=" width: "+u+"px;",l+=" height: "+u+"px;",l+=" background-color: ",l+=z.isDark(_,b)?"#000000":"#ffffff",l+=";",l+='"/>';l+="</tr>"}return(l+="</tbody>")+"</table>"},z.createSvgTag=function(u,w,l,_){var b={};typeof arguments[0]=="object"&&(u=(b=arguments[0]).cellSize,w=b.margin,l=b.alt,_=b.title),u=u||2,w=w===void 0?4*u:w,(l=typeof l=="string"?{text:l}:l||{}).text=l.text||null,l.id=l.text?l.id||"qrcode-description":null,(_=typeof _=="string"?{text:_}:_||{}).text=_.text||null,_.id=_.text?_.id||"qrcode-title":null;var I,L,N,a,t=z.getModuleCount()*u+2*w,e="";for(a="l"+u+",0 0,"+u+" -"+u+",0 0,-"+u+"z ",e+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',e+=b.scalable?"":' width="'+t+'px" height="'+t+'px"',e+=' viewBox="0 0 '+t+" "+t+'" ',e+=' preserveAspectRatio="xMinYMin meet"',e+=_.text||l.text?' role="img" aria-labelledby="'+Q([_.id,l.id].join(" ").trim())+'"':"",e+=">",e+=_.text?'<title id="'+Q(_.id)+'">'+Q(_.text)+"</title>":"",e+=l.text?'<description id="'+Q(l.id)+'">'+Q(l.text)+"</description>":"",e+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',e+='<path d="',L=0;L<z.getModuleCount();L+=1)for(N=L*u+w,I=0;I<z.getModuleCount();I+=1)z.isDark(L,I)&&(e+="M"+(I*u+w)+","+N+a);return(e+='" stroke="transparent" fill="black"/>')+"</svg>"},z.createDataURL=function(u,w){u=u||2,w=w===void 0?4*u:w;var l=z.getModuleCount()*u+2*w,_=w,b=l-w;return zt(l,l,function(I,L){if(_<=I&&I<b&&_<=L&&L<b){var N=Math.floor((I-_)/u),a=Math.floor((L-_)/u);return z.isDark(a,N)?0:1}return 1})},z.createImgTag=function(u,w,l){u=u||2,w=w===void 0?4*u:w;var _=z.getModuleCount()*u+2*w,b="";return b+="<img",b+=' src="',b+=z.createDataURL(u,w),b+='"',b+=' width="',b+=_,b+='"',b+=' height="',b+=_,b+='"',l&&(b+=' alt="',b+=Q(l),b+='"'),b+"/>"};var Q=function(u){for(var w="",l=0;l<u.length;l+=1){var _=u.charAt(l);switch(_){case"<":w+="<";break;case">":w+=">";break;case"&":w+="&";break;case'"':w+=""";break;default:w+=_}}return w};return z.createASCII=function(u,w){if((u=u||1)<2)return function(i){i=i===void 0?2:i;var o,s,c,g,h,x=1*z.getModuleCount()+2*i,M=i,A=x-i,E={"██":"█","█ ":"▀"," █":"▄"," ":" "},T={"██":"▀","█ ":"▀"," █":" "," ":" "},R="";for(o=0;o<x;o+=2){for(c=Math.floor((o-M)/1),g=Math.floor((o+1-M)/1),s=0;s<x;s+=1)h="█",M<=s&&s<A&&M<=o&&o<A&&z.isDark(c,Math.floor((s-M)/1))&&(h=" "),M<=s&&s<A&&M<=o+1&&o+1<A&&z.isDark(g,Math.floor((s-M)/1))?h+=" ":h+="█",R+=i<1&&o+1>=A?T[h]:E[h];R+=`
|
|
`}return x%2&&i>0?R.substring(0,R.length-x-1)+Array(x+1).join("▀"):R.substring(0,R.length-1)}(w);u-=1,w=w===void 0?2*u:w;var l,_,b,I,L=z.getModuleCount()*u+2*w,N=w,a=L-w,t=Array(u+1).join("██"),e=Array(u+1).join(" "),r="",n="";for(l=0;l<L;l+=1){for(b=Math.floor((l-N)/u),n="",_=0;_<L;_+=1)I=1,N<=_&&_<a&&N<=l&&l<a&&z.isDark(b,Math.floor((_-N)/u))&&(I=0),n+=I?t:e;for(b=0;b<u;b+=1)r+=n+`
|
|
`}return r.substring(0,r.length-1)},z.renderTo2dContext=function(u,w){w=w||2;for(var l=z.getModuleCount(),_=0;_<l;_++)for(var b=0;b<l;b++)u.fillStyle=z.isDark(_,b)?"black":"white",u.fillRect(_*w,b*w,w,w)},z};st.stringToBytes=(st.stringToBytesFuncs={default:function(m){for(var y=[],v=0;v<m.length;v+=1){var f=m.charCodeAt(v);y.push(255&f)}return y}}).default,st.createStringToBytes=function(m,y){var v=function(){for(var d=jt(m),p=function(){var H=d.read();if(H==-1)throw"eof";return H},P=0,C={};;){var z=d.read();if(z==-1)break;var X=p(),$=p()<<8|p();C[String.fromCharCode(z<<8|X)]=$,P+=1}if(P!=y)throw P+" != "+y;return C}(),f=63;return function(d){for(var p=[],P=0;P<d.length;P+=1){var C=d.charCodeAt(P);if(C<128)p.push(C);else{var z=v[d.charAt(P)];typeof z=="number"?(255&z)==z?p.push(z):(p.push(z>>>8),p.push(255&z)):p.push(f)}}return p}};var gt,ut,ct,j,lt,Ct={L:1,M:0,Q:3,H:2},pt=(gt=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],ut=1335,ct=7973,lt=function(m){for(var y=0;m!=0;)y+=1,m>>>=1;return y},(j={}).getBCHTypeInfo=function(m){for(var y=m<<10;lt(y)-lt(ut)>=0;)y^=ut<<lt(y)-lt(ut);return 21522^(m<<10|y)},j.getBCHTypeNumber=function(m){for(var y=m<<12;lt(y)-lt(ct)>=0;)y^=ct<<lt(y)-lt(ct);return m<<12|y},j.getPatternPosition=function(m){return gt[m-1]},j.getMaskFunction=function(m){switch(m){case 0:return function(y,v){return(y+v)%2==0};case 1:return function(y,v){return y%2==0};case 2:return function(y,v){return v%3==0};case 3:return function(y,v){return(y+v)%3==0};case 4:return function(y,v){return(Math.floor(y/2)+Math.floor(v/3))%2==0};case 5:return function(y,v){return y*v%2+y*v%3==0};case 6:return function(y,v){return(y*v%2+y*v%3)%2==0};case 7:return function(y,v){return(y*v%3+(y+v)%2)%2==0};default:throw"bad maskPattern:"+m}},j.getErrorCorrectPolynomial=function(m){for(var y=Pt([1],0),v=0;v<m;v+=1)y=y.multiply(Pt([1,vt.gexp(v)],0));return y},j.getLengthInBits=function(m,y){if(1<=y&&y<10)switch(m){case 1:return 10;case 2:return 9;case 4:case 8:return 8;default:throw"mode:"+m}else if(y<27)switch(m){case 1:return 12;case 2:return 11;case 4:return 16;case 8:return 10;default:throw"mode:"+m}else{if(!(y<41))throw"type:"+y;switch(m){case 1:return 14;case 2:return 13;case 4:return 16;case 8:return 12;default:throw"mode:"+m}}},j.getLostPoint=function(m){for(var y=m.getModuleCount(),v=0,f=0;f<y;f+=1)for(var d=0;d<y;d+=1){for(var p=0,P=m.isDark(f,d),C=-1;C<=1;C+=1)if(!(f+C<0||y<=f+C))for(var z=-1;z<=1;z+=1)d+z<0||y<=d+z||C==0&&z==0||P==m.isDark(f+C,d+z)&&(p+=1);p>5&&(v+=3+p-5)}for(f=0;f<y-1;f+=1)for(d=0;d<y-1;d+=1){var X=0;m.isDark(f,d)&&(X+=1),m.isDark(f+1,d)&&(X+=1),m.isDark(f,d+1)&&(X+=1),m.isDark(f+1,d+1)&&(X+=1),X!=0&&X!=4||(v+=3)}for(f=0;f<y;f+=1)for(d=0;d<y-6;d+=1)m.isDark(f,d)&&!m.isDark(f,d+1)&&m.isDark(f,d+2)&&m.isDark(f,d+3)&&m.isDark(f,d+4)&&!m.isDark(f,d+5)&&m.isDark(f,d+6)&&(v+=40);for(d=0;d<y;d+=1)for(f=0;f<y-6;f+=1)m.isDark(f,d)&&!m.isDark(f+1,d)&&m.isDark(f+2,d)&&m.isDark(f+3,d)&&m.isDark(f+4,d)&&!m.isDark(f+5,d)&&m.isDark(f+6,d)&&(v+=40);var $=0;for(d=0;d<y;d+=1)for(f=0;f<y;f+=1)m.isDark(f,d)&&($+=1);return v+Math.abs(100*$/y/y-50)/5*10},j),vt=function(){for(var m=new Array(256),y=new Array(256),v=0;v<8;v+=1)m[v]=1<<v;for(v=8;v<256;v+=1)m[v]=m[v-4]^m[v-5]^m[v-6]^m[v-8];for(v=0;v<255;v+=1)y[m[v]]=v;return{glog:function(f){if(f<1)throw"glog("+f+")";return y[f]},gexp:function(f){for(;f<0;)f+=255;for(;f>=256;)f-=255;return m[f]}}}();function Pt(m,y){if(m.length===void 0)throw m.length+"/"+y;var v=function(){for(var d=0;d<m.length&&m[d]==0;)d+=1;for(var p=new Array(m.length-d+y),P=0;P<m.length-d;P+=1)p[P]=m[P+d];return p}(),f={getAt:function(d){return v[d]},getLength:function(){return v.length},multiply:function(d){for(var p=new Array(f.getLength()+d.getLength()-1),P=0;P<f.getLength();P+=1)for(var C=0;C<d.getLength();C+=1)p[P+C]^=vt.gexp(vt.glog(f.getAt(P))+vt.glog(d.getAt(C)));return Pt(p,0)},mod:function(d){if(f.getLength()-d.getLength()<0)return f;for(var p=vt.glog(f.getAt(0))-vt.glog(d.getAt(0)),P=new Array(f.getLength()),C=0;C<f.getLength();C+=1)P[C]=f.getAt(C);for(C=0;C<d.getLength();C+=1)P[C]^=vt.gexp(vt.glog(d.getAt(C))+p);return Pt(P,0).mod(d)}};return f}var Rt=function(){var m=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],y=function(f,d){var p={};return p.totalCount=f,p.dataCount=d,p},v={getRSBlocks:function(f,d){var p=function(rt,tt){switch(tt){case Ct.L:return m[4*(rt-1)+0];case Ct.M:return m[4*(rt-1)+1];case Ct.Q:return m[4*(rt-1)+2];case Ct.H:return m[4*(rt-1)+3];default:return}}(f,d);if(p===void 0)throw"bad rs block @ typeNumber:"+f+"/errorCorrectionLevel:"+d;for(var P=p.length/3,C=[],z=0;z<P;z+=1)for(var X=p[3*z+0],$=p[3*z+1],H=p[3*z+2],W=0;W<X;W+=1)C.push(y($,H));return C}};return v}(),K=function(){var m=[],y=0,v={getBuffer:function(){return m},getAt:function(f){var d=Math.floor(f/8);return(m[d]>>>7-f%8&1)==1},put:function(f,d){for(var p=0;p<d;p+=1)v.putBit((f>>>d-p-1&1)==1)},getLengthInBits:function(){return y},putBit:function(f){var d=Math.floor(y/8);m.length<=d&&m.push(0),f&&(m[d]|=128>>>y%8),y+=1}};return v},Bt=function(m){var y=m,v={getMode:function(){return 1},getLength:function(p){return y.length},write:function(p){for(var P=y,C=0;C+2<P.length;)p.put(f(P.substring(C,C+3)),10),C+=3;C<P.length&&(P.length-C==1?p.put(f(P.substring(C,C+1)),4):P.length-C==2&&p.put(f(P.substring(C,C+2)),7))}},f=function(p){for(var P=0,C=0;C<p.length;C+=1)P=10*P+d(p.charAt(C));return P},d=function(p){if("0"<=p&&p<="9")return p.charCodeAt(0)-48;throw"illegal char :"+p};return v},Lt=function(m){var y=m,v={getMode:function(){return 2},getLength:function(d){return y.length},write:function(d){for(var p=y,P=0;P+1<p.length;)d.put(45*f(p.charAt(P))+f(p.charAt(P+1)),11),P+=2;P<p.length&&d.put(f(p.charAt(P)),6)}},f=function(d){if("0"<=d&&d<="9")return d.charCodeAt(0)-48;if("A"<=d&&d<="Z")return d.charCodeAt(0)-65+10;switch(d){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+d}};return v},Tt=function(m){var y=st.stringToBytes(m);return{getMode:function(){return 4},getLength:function(v){return y.length},write:function(v){for(var f=0;f<y.length;f+=1)v.put(y[f],8)}}},xt=function(m){var y=st.stringToBytesFuncs.SJIS;if(!y)throw"sjis not supported.";(function(f,d){var p=y("友");if(p.length!=2||(p[0]<<8|p[1])!=38726)throw"sjis not supported."})();var v=y(m);return{getMode:function(){return 8},getLength:function(f){return~~(v.length/2)},write:function(f){for(var d=v,p=0;p+1<d.length;){var P=(255&d[p])<<8|255&d[p+1];if(33088<=P&&P<=40956)P-=33088;else{if(!(57408<=P&&P<=60351))throw"illegal char at "+(p+1)+"/"+P;P-=49472}P=192*(P>>>8&255)+(255&P),f.put(P,13),p+=2}if(p<d.length)throw"illegal char at "+(p+1)}}},Ft=function(){var m=[],y={writeByte:function(v){m.push(255&v)},writeShort:function(v){y.writeByte(v),y.writeByte(v>>>8)},writeBytes:function(v,f,d){f=f||0,d=d||v.length;for(var p=0;p<d;p+=1)y.writeByte(v[p+f])},writeString:function(v){for(var f=0;f<v.length;f+=1)y.writeByte(v.charCodeAt(f))},toByteArray:function(){return m},toString:function(){var v="";v+="[";for(var f=0;f<m.length;f+=1)f>0&&(v+=","),v+=m[f];return v+"]"}};return y},jt=function(m){var y=m,v=0,f=0,d=0,p={read:function(){for(;d<8;){if(v>=y.length){if(d==0)return-1;throw"unexpected end of file./"+d}var C=y.charAt(v);if(v+=1,C=="=")return d=0,-1;C.match(/^\s$/)||(f=f<<6|P(C.charCodeAt(0)),d+=6)}var z=f>>>d-8&255;return d-=8,z}},P=function(C){if(65<=C&&C<=90)return C-65;if(97<=C&&C<=122)return C-97+26;if(48<=C&&C<=57)return C-48+52;if(C==43)return 62;if(C==47)return 63;throw"c:"+C};return p},zt=function(m,y,v){for(var f=function($,H){var W=$,rt=H,tt=new Array($*H),Mt={setPixel:function(u,w,l){tt[w*W+u]=l},write:function(u){u.writeString("GIF87a"),u.writeShort(W),u.writeShort(rt),u.writeByte(128),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(0),u.writeByte(255),u.writeByte(255),u.writeByte(255),u.writeString(","),u.writeShort(0),u.writeShort(0),u.writeShort(W),u.writeShort(rt),u.writeByte(0);var w=mt(2);u.writeByte(2);for(var l=0;w.length-l>255;)u.writeByte(255),u.writeBytes(w,l,255),l+=255;u.writeByte(w.length-l),u.writeBytes(w,l,w.length-l),u.writeByte(0),u.writeString(";")}},mt=function(u){for(var w=1<<u,l=1+(1<<u),_=u+1,b=Q(),I=0;I<w;I+=1)b.add(String.fromCharCode(I));b.add(String.fromCharCode(w)),b.add(String.fromCharCode(l));var L,N,a,t=Ft(),e=(L=t,N=0,a=0,{write:function(o,s){if(o>>>s)throw"length over";for(;N+s>=8;)L.writeByte(255&(o<<N|a)),s-=8-N,o>>>=8-N,a=0,N=0;a|=o<<N,N+=s},flush:function(){N>0&&L.writeByte(a)}});e.write(w,_);var r=0,n=String.fromCharCode(tt[r]);for(r+=1;r<tt.length;){var i=String.fromCharCode(tt[r]);r+=1,b.contains(n+i)?n+=i:(e.write(b.indexOf(n),_),b.size()<4095&&(b.size()==1<<_&&(_+=1),b.add(n+i)),n=i)}return e.write(b.indexOf(n),_),e.write(l,_),e.flush(),t.toByteArray()},Q=function(){var u={},w=0,l={add:function(_){if(l.contains(_))throw"dup key:"+_;u[_]=w,w+=1},size:function(){return w},indexOf:function(_){return u[_]},contains:function(_){return u[_]!==void 0}};return l};return Mt}(m,y),d=0;d<y;d+=1)for(var p=0;p<m;p+=1)f.setPixel(p,d,v(p,d));var P=Ft();f.write(P);for(var C=function(){var $=0,H=0,W=0,rt="",tt={},Mt=function(Q){rt+=String.fromCharCode(mt(63&Q))},mt=function(Q){if(!(Q<0)){if(Q<26)return 65+Q;if(Q<52)return Q-26+97;if(Q<62)return Q-52+48;if(Q==62)return 43;if(Q==63)return 47}throw"n:"+Q};return tt.writeByte=function(Q){for($=$<<8|255&Q,H+=8,W+=1;H>=6;)Mt($>>>H-6),H-=6},tt.flush=function(){if(H>0&&(Mt($<<6-H),$=0,H=0),W%3!=0)for(var Q=3-W%3,u=0;u<Q;u+=1)rt+="="},tt.toString=function(){return rt},tt}(),z=P.toByteArray(),X=0;X<z.length;X+=1)C.writeByte(z[X]);return C.flush(),"data:image/gif;base64,"+C};return st}();Nt.stringToBytesFuncs["UTF-8"]=function(st){return function(gt){for(var ut=[],ct=0;ct<gt.length;ct++){var j=gt.charCodeAt(ct);j<128?ut.push(j):j<2048?ut.push(192|j>>6,128|63&j):j<55296||j>=57344?ut.push(224|j>>12,128|j>>6&63,128|63&j):(ct++,j=65536+((1023&j)<<10|1023>.charCodeAt(ct)),ut.push(240|j>>18,128|j>>12&63,128|j>>6&63,128|63&j))}return ut}(st)},(qt=typeof(dt=function(){return Nt})=="function"?dt.apply(V,[]):dt)===void 0||(Y.exports=qt)},796:(Y,V,dt)=>{dt.d(V,{default:()=>N});var qt=function(){return(qt=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)},Nt=function(){for(var a=0,t=0,e=arguments.length;t<e;t++)a+=arguments[t].length;var r=Array(a),n=0;for(t=0;t<e;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,n++)r[n]=i[o];return r},st=function(a){return!!a&&typeof a=="object"&&!Array.isArray(a)};function gt(a){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(!t.length)return a;var r=t.shift();return r!==void 0&&st(a)&&st(r)?(a=qt({},a),Object.keys(r).forEach(function(n){var i=a[n],o=r[n];Array.isArray(i)&&Array.isArray(o)?a[n]=o:st(i)&&st(o)?a[n]=gt(Object.assign({},i),o):a[n]=o}),gt.apply(void 0,Nt([a],t))):a}function ut(a,t){var e=document.createElement("a");e.download=t,e.href=a,document.body.appendChild(e),e.click(),document.body.removeChild(e)}function ct(a){var t=a.originalHeight,e=a.originalWidth,r=a.maxHiddenDots,n=a.maxHiddenAxisDots,i=a.dotSize,o={x:0,y:0},s={x:0,y:0};if(t<=0||e<=0||r<=0||i<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};var c=t/e;return o.x=Math.floor(Math.sqrt(r/c)),o.x<=0&&(o.x=1),n&&n<o.x&&(o.x=n),o.x%2==0&&o.x--,s.x=o.x*i,o.y=1+2*Math.ceil((o.x*c-1)/2),s.y=Math.round(s.x*c),(o.y*o.x>r||n&&n<o.y)&&(n&&n<o.y?(o.y=n,o.y%2==0&&o.x--):o.y-=2,s.y=o.y*i,o.x=1+2*Math.ceil((o.y/c-1)/2),s.x=Math.round(s.y/c)),{height:s.y,width:s.x,hideYDots:o.y,hideXDots:o.x}}const j={L:.07,M:.15,Q:.25,H:.3},lt="dots",Ct="rounded",pt="classy",vt="classy-rounded",Pt="square",Rt="extra-rounded";var K=function(){return(K=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const Bt=function(){function a(t){var e=t.context,r=t.type;this._context=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i,o=this._context;switch(this._type){case lt:i=this._drawDot;break;case pt:i=this._drawClassy;break;case vt:i=this._drawClassyRounded;break;case Ct:i=this._drawRounded;break;case Rt:i=this._drawExtraRounded;break;case Pt:default:i=this._drawSquare}i.call(this,{x:t,y:e,size:r,context:o,getNeighbor:n})},a.prototype._rotateFigure=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation,s=o===void 0?0:o,c=t.draw,g=e+n/2,h=r+n/2;i.translate(g,h),s&&i.rotate(s),c(),i.closePath(),s&&i.rotate(-s),i.translate(-g,-h)},a.prototype._basicDot=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(0,0,e/2,0,2*Math.PI)}}))},a.prototype._basicSquare=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.rect(-e/2,-e/2,e,e)}}))},a.prototype._basicSideRounded=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(0,0,e/2,-Math.PI/2,Math.PI/2),r.lineTo(-e/2,e/2),r.lineTo(-e/2,-e/2),r.lineTo(0,-e/2)}}))},a.prototype._basicCornerRounded=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(0,0,e/2,-Math.PI/2,0),r.lineTo(e/2,e/2),r.lineTo(-e/2,e/2),r.lineTo(-e/2,-e/2),r.lineTo(0,-e/2)}}))},a.prototype._basicCornerExtraRounded=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(-e/2,e/2,e,-Math.PI/2,0),r.lineTo(-e/2,e/2),r.lineTo(-e/2,-e/2)}}))},a.prototype._basicCornersRounded=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(0,0,e/2,-Math.PI/2,0),r.lineTo(e/2,e/2),r.lineTo(0,e/2),r.arc(0,0,e/2,Math.PI/2,Math.PI),r.lineTo(-e/2,-e/2),r.lineTo(0,-e/2)}}))},a.prototype._basicCornersExtraRounded=function(t){var e=t.size,r=t.context;this._rotateFigure(K(K({},t),{draw:function(){r.arc(-e/2,e/2,e,-Math.PI/2,0),r.arc(e/2,-e/2,e,Math.PI/2,Math.PI)}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size,i=t.context;this._basicDot({x:e,y:r,size:n,context:i,rotation:0})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size,i=t.context;this._basicSquare({x:e,y:r,size:n,context:i,rotation:0})},a.prototype._drawRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor,s=o?+o(-1,0):0,c=o?+o(1,0):0,g=o?+o(0,-1):0,h=o?+o(0,1):0,x=s+c+g+h;if(x!==0)if(x>2||s&&c||g&&h)this._basicSquare({x:e,y:r,size:n,context:i,rotation:0});else{if(x===2){var M=0;return s&&g?M=Math.PI/2:g&&c?M=Math.PI:c&&h&&(M=-Math.PI/2),void this._basicCornerRounded({x:e,y:r,size:n,context:i,rotation:M})}if(x===1)return M=0,g?M=Math.PI/2:c?M=Math.PI:h&&(M=-Math.PI/2),void this._basicSideRounded({x:e,y:r,size:n,context:i,rotation:M})}else this._basicDot({x:e,y:r,size:n,context:i,rotation:0})},a.prototype._drawExtraRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor,s=o?+o(-1,0):0,c=o?+o(1,0):0,g=o?+o(0,-1):0,h=o?+o(0,1):0,x=s+c+g+h;if(x!==0)if(x>2||s&&c||g&&h)this._basicSquare({x:e,y:r,size:n,context:i,rotation:0});else{if(x===2){var M=0;return s&&g?M=Math.PI/2:g&&c?M=Math.PI:c&&h&&(M=-Math.PI/2),void this._basicCornerExtraRounded({x:e,y:r,size:n,context:i,rotation:M})}if(x===1)return M=0,g?M=Math.PI/2:c?M=Math.PI:h&&(M=-Math.PI/2),void this._basicSideRounded({x:e,y:r,size:n,context:i,rotation:M})}else this._basicDot({x:e,y:r,size:n,context:i,rotation:0})},a.prototype._drawClassy=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor,s=o?+o(-1,0):0,c=o?+o(1,0):0,g=o?+o(0,-1):0,h=o?+o(0,1):0;s+c+g+h!==0?s||g?c||h?this._basicSquare({x:e,y:r,size:n,context:i,rotation:0}):this._basicCornerRounded({x:e,y:r,size:n,context:i,rotation:Math.PI/2}):this._basicCornerRounded({x:e,y:r,size:n,context:i,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:r,size:n,context:i,rotation:Math.PI/2})},a.prototype._drawClassyRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.getNeighbor,s=o?+o(-1,0):0,c=o?+o(1,0):0,g=o?+o(0,-1):0,h=o?+o(0,1):0;s+c+g+h!==0?s||g?c||h?this._basicSquare({x:e,y:r,size:n,context:i,rotation:0}):this._basicCornerExtraRounded({x:e,y:r,size:n,context:i,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:e,y:r,size:n,context:i,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:r,size:n,context:i,rotation:Math.PI/2})},a}(),Lt="square",Tt="extra-rounded";var xt=function(){return(xt=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const Ft=function(){function a(t){var e=t.context,r=t.type;this._context=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i,o=this._context;switch(this._type){case Lt:i=this._drawSquare;break;case Tt:i=this._drawExtraRounded;break;case"dot":default:i=this._drawDot}i.call(this,{x:t,y:e,size:r,context:o,rotation:n})},a.prototype._rotateFigure=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation,s=o===void 0?0:o,c=t.draw,g=e+n/2,h=r+n/2;i.translate(g,h),s&&i.rotate(s),c(),i.closePath(),s&&i.rotate(-s),i.translate(-g,-h)},a.prototype._basicDot=function(t){var e=t.size,r=t.context,n=e/7;this._rotateFigure(xt(xt({},t),{draw:function(){r.arc(0,0,e/2,0,2*Math.PI),r.arc(0,0,e/2-n,0,2*Math.PI)}}))},a.prototype._basicSquare=function(t){var e=t.size,r=t.context,n=e/7;this._rotateFigure(xt(xt({},t),{draw:function(){r.rect(-e/2,-e/2,e,e),r.rect(-e/2+n,-e/2+n,e-2*n,e-2*n)}}))},a.prototype._basicExtraRounded=function(t){var e=t.size,r=t.context,n=e/7;this._rotateFigure(xt(xt({},t),{draw:function(){r.arc(-n,-n,2.5*n,Math.PI,-Math.PI/2),r.lineTo(n,-3.5*n),r.arc(n,-n,2.5*n,-Math.PI/2,0),r.lineTo(3.5*n,-n),r.arc(n,n,2.5*n,0,Math.PI/2),r.lineTo(-n,3.5*n),r.arc(-n,n,2.5*n,Math.PI/2,Math.PI),r.lineTo(-3.5*n,-n),r.arc(-n,-n,1.5*n,Math.PI,-Math.PI/2),r.lineTo(n,-2.5*n),r.arc(n,-n,1.5*n,-Math.PI/2,0),r.lineTo(2.5*n,-n),r.arc(n,n,1.5*n,0,Math.PI/2),r.lineTo(-n,2.5*n),r.arc(-n,n,1.5*n,Math.PI/2,Math.PI),r.lineTo(-2.5*n,-n)}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation;this._basicDot({x:e,y:r,size:n,context:i,rotation:o})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation;this._basicSquare({x:e,y:r,size:n,context:i,rotation:o})},a.prototype._drawExtraRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation;this._basicExtraRounded({x:e,y:r,size:n,context:i,rotation:o})},a}(),jt="square";var zt=function(){return(zt=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const m=function(){function a(t){var e=t.context,r=t.type;this._context=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i,o=this._context;switch(this._type){case jt:i=this._drawSquare;break;case"dot":default:i=this._drawDot}i.call(this,{x:t,y:e,size:r,context:o,rotation:n})},a.prototype._rotateFigure=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation,s=o===void 0?0:o,c=t.draw,g=e+n/2,h=r+n/2;i.translate(g,h),s&&i.rotate(s),c(),i.closePath(),s&&i.rotate(-s),i.translate(-g,-h)},a.prototype._basicDot=function(t){var e=t.size,r=t.context;this._rotateFigure(zt(zt({},t),{draw:function(){r.arc(0,0,e/2,0,2*Math.PI)}}))},a.prototype._basicSquare=function(t){var e=t.size,r=t.context;this._rotateFigure(zt(zt({},t),{draw:function(){r.rect(-e/2,-e/2,e,e)}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation;this._basicDot({x:e,y:r,size:n,context:i,rotation:o})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size,i=t.context,o=t.rotation;this._basicSquare({x:e,y:r,size:n,context:i,rotation:o})},a}(),y="radial";var v=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],f=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];const d=function(){function a(t){this._canvas=document.createElement("canvas"),this._canvas.width=t.width,this._canvas.height=t.height,this._options=t}return Object.defineProperty(a.prototype,"context",{get:function(){return this._canvas.getContext("2d")},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this._canvas.width},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this._canvas.height},enumerable:!1,configurable:!0}),a.prototype.getCanvas=function(){return this._canvas},a.prototype.clear=function(){var t=this.context;t&&t.clearRect(0,0,this._canvas.width,this._canvas.height)},a.prototype.drawQR=function(t){return e=this,r=void 0,i=function(){var o,s,c,g,h,x,M,A,E,T=this;return function(R,B){var D,k,S,F,q={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return F={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function U(Z){return function(at){return function(O){if(D)throw new TypeError("Generator is already executing.");for(;q;)try{if(D=1,k&&(S=2&O[0]?k.return:O[0]?k.throw||((S=k.return)&&S.call(k),0):k.next)&&!(S=S.call(k,O[1])).done)return S;switch(k=0,S&&(O=[2&O[0],S.value]),O[0]){case 0:case 1:S=O;break;case 4:return q.label++,{value:O[1],done:!1};case 5:q.label++,k=O[1],O=[0];continue;case 7:O=q.ops.pop(),q.trys.pop();continue;default:if(!((S=(S=q.trys).length>0&&S[S.length-1])||O[0]!==6&&O[0]!==2)){q=0;continue}if(O[0]===3&&(!S||O[1]>S[0]&&O[1]<S[3])){q.label=O[1];break}if(O[0]===6&&q.label<S[1]){q.label=S[1],S=O;break}if(S&&q.label<S[2]){q.label=S[2],q.ops.push(O);break}S[2]&&q.ops.pop(),q.trys.pop();continue}O=B.call(R,q)}catch(et){O=[6,et],k=0}finally{D=S=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([Z,at])}}}(this,function(R){switch(R.label){case 0:return o=t.getModuleCount(),s=Math.min(this._options.width,this._options.height)-2*this._options.margin,c=Math.floor(s/o),g={hideXDots:0,hideYDots:0,width:0,height:0},this._qr=t,this._options.image?[4,this.loadImage()]:[3,2];case 1:if(R.sent(),!this._image)return[2];h=this._options,x=h.imageOptions,M=h.qrOptions,A=x.imageSize*j[M.errorCorrectionLevel],E=Math.floor(A*o*o),g=ct({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:E,maxHiddenAxisDots:o-14,dotSize:c}),R.label=2;case 2:return this.clear(),this.drawBackground(),this.drawDots(function(B,D){var k,S,F,q,U,Z;return!(T._options.imageOptions.hideBackgroundDots&&B>=(o-g.hideXDots)/2&&B<(o+g.hideXDots)/2&&D>=(o-g.hideYDots)/2&&D<(o+g.hideYDots)/2||!((k=v[B])===null||k===void 0)&&k[D]||!((S=v[B-o+7])===null||S===void 0)&&S[D]||!((F=v[B])===null||F===void 0)&&F[D-o+7]||!((q=f[B])===null||q===void 0)&&q[D]||!((U=f[B-o+7])===null||U===void 0)&&U[D]||!((Z=f[B])===null||Z===void 0)&&Z[D-o+7])}),this.drawCorners(),this._options.image&&this.drawImage({width:g.width,height:g.height,count:o,dotSize:c}),[2]}})},new((n=void 0)||(n=Promise))(function(o,s){function c(x){try{h(i.next(x))}catch(M){s(M)}}function g(x){try{h(i.throw(x))}catch(M){s(M)}}function h(x){var M;x.done?o(x.value):(M=x.value,M instanceof n?M:new n(function(A){A(M)})).then(c,g)}h((i=i.apply(e,r||[])).next())});var e,r,n,i},a.prototype.drawBackground=function(){var t=this.context,e=this._options;if(t){if(e.backgroundOptions.gradient){var r=e.backgroundOptions.gradient,n=this._createGradient({context:t,options:r,additionalRotation:0,x:0,y:0,size:this._canvas.width>this._canvas.height?this._canvas.width:this._canvas.height});r.colorStops.forEach(function(i){var o=i.offset,s=i.color;n.addColorStop(o,s)}),t.fillStyle=n}else e.backgroundOptions.color&&(t.fillStyle=e.backgroundOptions.color);t.fillRect(0,0,this._canvas.width,this._canvas.height)}},a.prototype.drawDots=function(t){var e=this;if(!this._qr)throw"QR code is not defined";var r=this.context;if(!r)throw"QR code is not defined";var n=this._options,i=this._qr.getModuleCount();if(i>n.width||i>n.height)throw"The canvas is too small.";var o=Math.min(n.width,n.height)-2*n.margin,s=Math.floor(o/i),c=Math.floor((n.width-i*s)/2),g=Math.floor((n.height-i*s)/2),h=new Bt({context:r,type:n.dotsOptions.type});r.beginPath();for(var x=function(R){for(var B=function(k){return t&&!t(R,k)?"continue":M._qr.isDark(R,k)?void h.draw(c+R*s,g+k*s,s,function(S,F){return!(R+S<0||k+F<0||R+S>=i||k+F>=i)&&!(t&&!t(R+S,k+F))&&!!e._qr&&e._qr.isDark(R+S,k+F)}):"continue"},D=0;D<i;D++)B(D)},M=this,A=0;A<i;A++)x(A);if(n.dotsOptions.gradient){var E=n.dotsOptions.gradient,T=this._createGradient({context:r,options:E,additionalRotation:0,x:c,y:g,size:i*s});E.colorStops.forEach(function(R){var B=R.offset,D=R.color;T.addColorStop(B,D)}),r.fillStyle=r.strokeStyle=T}else n.dotsOptions.color&&(r.fillStyle=r.strokeStyle=n.dotsOptions.color);r.fill("evenodd")},a.prototype.drawCorners=function(t){var e=this;if(!this._qr)throw"QR code is not defined";var r=this.context;if(!r)throw"QR code is not defined";var n=this._options,i=this._qr.getModuleCount(),o=Math.min(n.width,n.height)-2*n.margin,s=Math.floor(o/i),c=7*s,g=3*s,h=Math.floor((n.width-i*s)/2),x=Math.floor((n.height-i*s)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(function(M){var A,E,T,R,B,D,k,S,F,q,U=M[0],Z=M[1],at=M[2];if(!t||t(U,Z)){var O=h+U*s*(i-7),et=x+Z*s*(i-7);if(!((A=n.cornersSquareOptions)===null||A===void 0)&&A.type){var Ot=new Ft({context:r,type:(E=n.cornersSquareOptions)===null||E===void 0?void 0:E.type});r.beginPath(),Ot.draw(O,et,c,at)}else{var yt=new Bt({context:r,type:n.dotsOptions.type});r.beginPath();for(var bt=function(G){for(var _t=function(nt){if(!(!((T=v[G])===null||T===void 0)&&T[nt]))return"continue";yt.draw(O+G*s,et+nt*s,s,function(At,It){var ot;return!!(!((ot=v[G+At])===null||ot===void 0)&&ot[nt+It])})},J=0;J<v[G].length;J++)_t(J)},wt=0;wt<v.length;wt++)bt(wt)}if(!((R=n.cornersSquareOptions)===null||R===void 0)&&R.gradient){var ht=n.cornersSquareOptions.gradient,Qt=e._createGradient({context:r,options:ht,additionalRotation:at,x:O,y:et,size:c});ht.colorStops.forEach(function(G){var _t=G.offset,J=G.color;Qt.addColorStop(_t,J)}),r.fillStyle=r.strokeStyle=Qt}else!((B=n.cornersSquareOptions)===null||B===void 0)&&B.color&&(r.fillStyle=r.strokeStyle=n.cornersSquareOptions.color);if(r.fill("evenodd"),(D=n.cornersDotOptions)===null||D===void 0?void 0:D.type){var St=new m({context:r,type:(k=n.cornersDotOptions)===null||k===void 0?void 0:k.type});r.beginPath(),St.draw(O+2*s,et+2*s,g,at)}else{yt=new Bt({context:r,type:n.dotsOptions.type}),r.beginPath();var Et=function(G){for(var _t=function(nt){if(!(!((S=f[G])===null||S===void 0)&&S[nt]))return"continue";yt.draw(O+G*s,et+nt*s,s,function(At,It){var ot;return!!(!((ot=f[G+At])===null||ot===void 0)&&ot[nt+It])})},J=0;J<f[G].length;J++)_t(J)};for(wt=0;wt<f.length;wt++)Et(wt)}if(!((F=n.cornersDotOptions)===null||F===void 0)&&F.gradient){ht=n.cornersDotOptions.gradient;var Ht=e._createGradient({context:r,options:ht,additionalRotation:at,x:O+2*s,y:et+2*s,size:g});ht.colorStops.forEach(function(G){var _t=G.offset,J=G.color;Ht.addColorStop(_t,J)}),r.fillStyle=r.strokeStyle=Ht}else!((q=n.cornersDotOptions)===null||q===void 0)&&q.color&&(r.fillStyle=r.strokeStyle=n.cornersDotOptions.color);r.fill("evenodd")}})},a.prototype.loadImage=function(){var t=this;return new Promise(function(e,r){var n=t._options,i=new Image;if(!n.image)return r("Image is not defined");typeof n.imageOptions.crossOrigin=="string"&&(i.crossOrigin=n.imageOptions.crossOrigin),t._image=i,i.onload=function(){e()},i.src=n.image})},a.prototype.drawImage=function(t){var e=t.width,r=t.height,n=t.count,i=t.dotSize,o=this.context;if(!o)throw"canvasContext is not defined";if(!this._image)throw"image is not defined";var s=this._options,c=Math.floor((s.width-n*i)/2),g=Math.floor((s.height-n*i)/2),h=c+s.imageOptions.margin+(n*i-e)/2,x=g+s.imageOptions.margin+(n*i-r)/2,M=e-2*s.imageOptions.margin,A=r-2*s.imageOptions.margin;o.drawImage(this._image,h,x,M<0?0:M,A<0?0:A)},a.prototype._createGradient=function(t){var e,r=t.context,n=t.options,i=t.additionalRotation,o=t.x,s=t.y,c=t.size;if(n.type===y)e=r.createRadialGradient(o+c/2,s+c/2,0,o+c/2,s+c/2,c/2);else{var g=((n.rotation||0)+i)%(2*Math.PI),h=(g+2*Math.PI)%(2*Math.PI),x=o+c/2,M=s+c/2,A=o+c/2,E=s+c/2;h>=0&&h<=.25*Math.PI||h>1.75*Math.PI&&h<=2*Math.PI?(x-=c/2,M-=c/2*Math.tan(g),A+=c/2,E+=c/2*Math.tan(g)):h>.25*Math.PI&&h<=.75*Math.PI?(M-=c/2,x-=c/2/Math.tan(g),E+=c/2,A+=c/2/Math.tan(g)):h>.75*Math.PI&&h<=1.25*Math.PI?(x+=c/2,M+=c/2*Math.tan(g),A-=c/2,E-=c/2*Math.tan(g)):h>1.25*Math.PI&&h<=1.75*Math.PI&&(M+=c/2,x+=c/2/Math.tan(g),E-=c/2,A-=c/2/Math.tan(g)),e=r.createLinearGradient(Math.round(x),Math.round(M),Math.round(A),Math.round(E))}return e},a}();var p=function(){return(p=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const P=function(){function a(t){var e=t.svg,r=t.type;this._svg=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i;switch(this._type){case lt:i=this._drawDot;break;case pt:i=this._drawClassy;break;case vt:i=this._drawClassyRounded;break;case Ct:i=this._drawRounded;break;case Rt:i=this._drawExtraRounded;break;case Pt:default:i=this._drawSquare}i.call(this,{x:t,y:e,size:r,getNeighbor:n})},a.prototype._rotateFigure=function(t){var e,r=t.x,n=t.y,i=t.size,o=t.rotation,s=o===void 0?0:o,c=r+i/2,g=n+i/2;(0,t.draw)(),(e=this._element)===null||e===void 0||e.setAttribute("transform","rotate("+180*s/Math.PI+","+c+","+g+")")},a.prototype._basicDot=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","circle"),e._element.setAttribute("cx",String(n+r/2)),e._element.setAttribute("cy",String(i+r/2)),e._element.setAttribute("r",String(r/2))}}))},a.prototype._basicSquare=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","rect"),e._element.setAttribute("x",String(n)),e._element.setAttribute("y",String(i)),e._element.setAttribute("width",String(r)),e._element.setAttribute("height",String(r))}}))},a.prototype._basicSideRounded=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("d","M "+n+" "+i+"v "+r+"h "+r/2+"a "+r/2+" "+r/2+", 0, 0, 0, 0 "+-r)}}))},a.prototype._basicCornerRounded=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("d","M "+n+" "+i+"v "+r+"h "+r+"v "+-r/2+"a "+r/2+" "+r/2+", 0, 0, 0, "+-r/2+" "+-r/2)}}))},a.prototype._basicCornerExtraRounded=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("d","M "+n+" "+i+"v "+r+"h "+r+"a "+r+" "+r+", 0, 0, 0, "+-r+" "+-r)}}))},a.prototype._basicCornersRounded=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(p(p({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("d","M "+n+" "+i+"v "+r/2+"a "+r/2+" "+r/2+", 0, 0, 0, "+r/2+" "+r/2+"h "+r/2+"v "+-r/2+"a "+r/2+" "+r/2+", 0, 0, 0, "+-r/2+" "+-r/2)}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size;this._basicDot({x:e,y:r,size:n,rotation:0})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size;this._basicSquare({x:e,y:r,size:n,rotation:0})},a.prototype._drawRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,c=i?+i(0,-1):0,g=i?+i(0,1):0,h=o+s+c+g;if(h!==0)if(h>2||o&&s||c&&g)this._basicSquare({x:e,y:r,size:n,rotation:0});else{if(h===2){var x=0;return o&&c?x=Math.PI/2:c&&s?x=Math.PI:s&&g&&(x=-Math.PI/2),void this._basicCornerRounded({x:e,y:r,size:n,rotation:x})}if(h===1)return x=0,c?x=Math.PI/2:s?x=Math.PI:g&&(x=-Math.PI/2),void this._basicSideRounded({x:e,y:r,size:n,rotation:x})}else this._basicDot({x:e,y:r,size:n,rotation:0})},a.prototype._drawExtraRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,c=i?+i(0,-1):0,g=i?+i(0,1):0,h=o+s+c+g;if(h!==0)if(h>2||o&&s||c&&g)this._basicSquare({x:e,y:r,size:n,rotation:0});else{if(h===2){var x=0;return o&&c?x=Math.PI/2:c&&s?x=Math.PI:s&&g&&(x=-Math.PI/2),void this._basicCornerExtraRounded({x:e,y:r,size:n,rotation:x})}if(h===1)return x=0,c?x=Math.PI/2:s?x=Math.PI:g&&(x=-Math.PI/2),void this._basicSideRounded({x:e,y:r,size:n,rotation:x})}else this._basicDot({x:e,y:r,size:n,rotation:0})},a.prototype._drawClassy=function(t){var e=t.x,r=t.y,n=t.size,i=t.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,c=i?+i(0,-1):0,g=i?+i(0,1):0;o+s+c+g!==0?o||c?s||g?this._basicSquare({x:e,y:r,size:n,rotation:0}):this._basicCornerRounded({x:e,y:r,size:n,rotation:Math.PI/2}):this._basicCornerRounded({x:e,y:r,size:n,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:r,size:n,rotation:Math.PI/2})},a.prototype._drawClassyRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.getNeighbor,o=i?+i(-1,0):0,s=i?+i(1,0):0,c=i?+i(0,-1):0,g=i?+i(0,1):0;o+s+c+g!==0?o||c?s||g?this._basicSquare({x:e,y:r,size:n,rotation:0}):this._basicCornerExtraRounded({x:e,y:r,size:n,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:e,y:r,size:n,rotation:-Math.PI/2}):this._basicCornersRounded({x:e,y:r,size:n,rotation:Math.PI/2})},a}();var C=function(){return(C=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const z=function(){function a(t){var e=t.svg,r=t.type;this._svg=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i;switch(this._type){case Lt:i=this._drawSquare;break;case Tt:i=this._drawExtraRounded;break;case"dot":default:i=this._drawDot}i.call(this,{x:t,y:e,size:r,rotation:n})},a.prototype._rotateFigure=function(t){var e,r=t.x,n=t.y,i=t.size,o=t.rotation,s=o===void 0?0:o,c=r+i/2,g=n+i/2;(0,t.draw)(),(e=this._element)===null||e===void 0||e.setAttribute("transform","rotate("+180*s/Math.PI+","+c+","+g+")")},a.prototype._basicDot=function(t){var e=this,r=t.size,n=t.x,i=t.y,o=r/7;this._rotateFigure(C(C({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("clip-rule","evenodd"),e._element.setAttribute("d","M "+(n+r/2)+" "+i+"a "+r/2+" "+r/2+" 0 1 0 0.1 0zm 0 "+o+"a "+(r/2-o)+" "+(r/2-o)+" 0 1 1 -0.1 0Z")}}))},a.prototype._basicSquare=function(t){var e=this,r=t.size,n=t.x,i=t.y,o=r/7;this._rotateFigure(C(C({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("clip-rule","evenodd"),e._element.setAttribute("d","M "+n+" "+i+"v "+r+"h "+r+"v "+-r+"zM "+(n+o)+" "+(i+o)+"h "+(r-2*o)+"v "+(r-2*o)+"h "+(2*o-r)+"z")}}))},a.prototype._basicExtraRounded=function(t){var e=this,r=t.size,n=t.x,i=t.y,o=r/7;this._rotateFigure(C(C({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","path"),e._element.setAttribute("clip-rule","evenodd"),e._element.setAttribute("d","M "+n+" "+(i+2.5*o)+"v "+2*o+"a "+2.5*o+" "+2.5*o+", 0, 0, 0, "+2.5*o+" "+2.5*o+"h "+2*o+"a "+2.5*o+" "+2.5*o+", 0, 0, 0, "+2.5*o+" "+2.5*-o+"v "+-2*o+"a "+2.5*o+" "+2.5*o+", 0, 0, 0, "+2.5*-o+" "+2.5*-o+"h "+-2*o+"a "+2.5*o+" "+2.5*o+", 0, 0, 0, "+2.5*-o+" "+2.5*o+"M "+(n+2.5*o)+" "+(i+o)+"h "+2*o+"a "+1.5*o+" "+1.5*o+", 0, 0, 1, "+1.5*o+" "+1.5*o+"v "+2*o+"a "+1.5*o+" "+1.5*o+", 0, 0, 1, "+1.5*-o+" "+1.5*o+"h "+-2*o+"a "+1.5*o+" "+1.5*o+", 0, 0, 1, "+1.5*-o+" "+1.5*-o+"v "+-2*o+"a "+1.5*o+" "+1.5*o+", 0, 0, 1, "+1.5*o+" "+1.5*-o)}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size,i=t.rotation;this._basicDot({x:e,y:r,size:n,rotation:i})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size,i=t.rotation;this._basicSquare({x:e,y:r,size:n,rotation:i})},a.prototype._drawExtraRounded=function(t){var e=t.x,r=t.y,n=t.size,i=t.rotation;this._basicExtraRounded({x:e,y:r,size:n,rotation:i})},a}();var X=function(){return(X=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};const $=function(){function a(t){var e=t.svg,r=t.type;this._svg=e,this._type=r}return a.prototype.draw=function(t,e,r,n){var i;switch(this._type){case jt:i=this._drawSquare;break;case"dot":default:i=this._drawDot}i.call(this,{x:t,y:e,size:r,rotation:n})},a.prototype._rotateFigure=function(t){var e,r=t.x,n=t.y,i=t.size,o=t.rotation,s=o===void 0?0:o,c=r+i/2,g=n+i/2;(0,t.draw)(),(e=this._element)===null||e===void 0||e.setAttribute("transform","rotate("+180*s/Math.PI+","+c+","+g+")")},a.prototype._basicDot=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(X(X({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","circle"),e._element.setAttribute("cx",String(n+r/2)),e._element.setAttribute("cy",String(i+r/2)),e._element.setAttribute("r",String(r/2))}}))},a.prototype._basicSquare=function(t){var e=this,r=t.size,n=t.x,i=t.y;this._rotateFigure(X(X({},t),{draw:function(){e._element=document.createElementNS("http://www.w3.org/2000/svg","rect"),e._element.setAttribute("x",String(n)),e._element.setAttribute("y",String(i)),e._element.setAttribute("width",String(r)),e._element.setAttribute("height",String(r))}}))},a.prototype._drawDot=function(t){var e=t.x,r=t.y,n=t.size,i=t.rotation;this._basicDot({x:e,y:r,size:n,rotation:i})},a.prototype._drawSquare=function(t){var e=t.x,r=t.y,n=t.size,i=t.rotation;this._basicSquare({x:e,y:r,size:n,rotation:i})},a}();var H=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],W=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];const rt=function(){function a(t){this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(t.width)),this._element.setAttribute("height",String(t.height)),this._defs=document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._options=t}return Object.defineProperty(a.prototype,"width",{get:function(){return this._options.width},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this._options.height},enumerable:!1,configurable:!0}),a.prototype.getElement=function(){return this._element},a.prototype.clear=function(){var t,e=this._element;this._element=e.cloneNode(!1),(t=e?.parentNode)===null||t===void 0||t.replaceChild(this._element,e),this._defs=document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs)},a.prototype.drawQR=function(t){return e=this,r=void 0,i=function(){var o,s,c,g,h,x,M,A,E,T=this;return function(R,B){var D,k,S,F,q={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return F={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function U(Z){return function(at){return function(O){if(D)throw new TypeError("Generator is already executing.");for(;q;)try{if(D=1,k&&(S=2&O[0]?k.return:O[0]?k.throw||((S=k.return)&&S.call(k),0):k.next)&&!(S=S.call(k,O[1])).done)return S;switch(k=0,S&&(O=[2&O[0],S.value]),O[0]){case 0:case 1:S=O;break;case 4:return q.label++,{value:O[1],done:!1};case 5:q.label++,k=O[1],O=[0];continue;case 7:O=q.ops.pop(),q.trys.pop();continue;default:if(!((S=(S=q.trys).length>0&&S[S.length-1])||O[0]!==6&&O[0]!==2)){q=0;continue}if(O[0]===3&&(!S||O[1]>S[0]&&O[1]<S[3])){q.label=O[1];break}if(O[0]===6&&q.label<S[1]){q.label=S[1],S=O;break}if(S&&q.label<S[2]){q.label=S[2],q.ops.push(O);break}S[2]&&q.ops.pop(),q.trys.pop();continue}O=B.call(R,q)}catch(et){O=[6,et],k=0}finally{D=S=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([Z,at])}}}(this,function(R){switch(R.label){case 0:return o=t.getModuleCount(),s=Math.min(this._options.width,this._options.height)-2*this._options.margin,c=Math.floor(s/o),g={hideXDots:0,hideYDots:0,width:0,height:0},this._qr=t,this._options.image?[4,this.loadImage()]:[3,2];case 1:if(R.sent(),!this._image)return[2];h=this._options,x=h.imageOptions,M=h.qrOptions,A=x.imageSize*j[M.errorCorrectionLevel],E=Math.floor(A*o*o),g=ct({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:E,maxHiddenAxisDots:o-14,dotSize:c}),R.label=2;case 2:return this.clear(),this.drawBackground(),this.drawDots(function(B,D){var k,S,F,q,U,Z;return!(T._options.imageOptions.hideBackgroundDots&&B>=(o-g.hideXDots)/2&&B<(o+g.hideXDots)/2&&D>=(o-g.hideYDots)/2&&D<(o+g.hideYDots)/2||!((k=H[B])===null||k===void 0)&&k[D]||!((S=H[B-o+7])===null||S===void 0)&&S[D]||!((F=H[B])===null||F===void 0)&&F[D-o+7]||!((q=W[B])===null||q===void 0)&&q[D]||!((U=W[B-o+7])===null||U===void 0)&&U[D]||!((Z=W[B])===null||Z===void 0)&&Z[D-o+7])}),this.drawCorners(),this._options.image&&this.drawImage({width:g.width,height:g.height,count:o,dotSize:c}),[2]}})},new((n=void 0)||(n=Promise))(function(o,s){function c(x){try{h(i.next(x))}catch(M){s(M)}}function g(x){try{h(i.throw(x))}catch(M){s(M)}}function h(x){var M;x.done?o(x.value):(M=x.value,M instanceof n?M:new n(function(A){A(M)})).then(c,g)}h((i=i.apply(e,r||[])).next())});var e,r,n,i},a.prototype.drawBackground=function(){var t,e,r=this._element,n=this._options;if(r){var i=(t=n.backgroundOptions)===null||t===void 0?void 0:t.gradient,o=(e=n.backgroundOptions)===null||e===void 0?void 0:e.color;(i||o)&&this._createColor({options:i,color:o,additionalRotation:0,x:0,y:0,height:n.height,width:n.width,name:"background-color"})}},a.prototype.drawDots=function(t){var e,r,n=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var s=Math.min(i.width,i.height)-2*i.margin,c=Math.floor(s/o),g=Math.floor((i.width-o*c)/2),h=Math.floor((i.height-o*c)/2),x=new P({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(e=i.dotsOptions)===null||e===void 0?void 0:e.gradient,color:i.dotsOptions.color,additionalRotation:0,x:g,y:h,height:o*c,width:o*c,name:"dot-color"});for(var M=function(T){for(var R=function(D){return t&&!t(T,D)?"continue":!((r=A._qr)===null||r===void 0)&&r.isDark(T,D)?(x.draw(g+T*c,h+D*c,c,function(k,S){return!(T+k<0||D+S<0||T+k>=o||D+S>=o)&&!(t&&!t(T+k,D+S))&&!!n._qr&&n._qr.isDark(T+k,D+S)}),void(x._element&&A._dotsClipPath&&A._dotsClipPath.appendChild(x._element))):"continue"},B=0;B<o;B++)R(B)},A=this,E=0;E<o;E++)M(E)},a.prototype.drawCorners=function(){var t=this;if(!this._qr)throw"QR code is not defined";var e=this._element,r=this._options;if(!e)throw"Element code is not defined";var n=this._qr.getModuleCount(),i=Math.min(r.width,r.height)-2*r.margin,o=Math.floor(i/n),s=7*o,c=3*o,g=Math.floor((r.width-n*o)/2),h=Math.floor((r.height-n*o)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach(function(x){var M,A,E,T,R,B,D,k,S,F,q,U,Z=x[0],at=x[1],O=x[2],et=g+Z*o*(n-7),Ot=h+at*o*(n-7),yt=t._dotsClipPath,bt=t._dotsClipPath;if((!((M=r.cornersSquareOptions)===null||M===void 0)&&M.gradient||!((A=r.cornersSquareOptions)===null||A===void 0)&&A.color)&&((yt=document.createElementNS("http://www.w3.org/2000/svg","clipPath")).setAttribute("id","clip-path-corners-square-color-"+Z+"-"+at),t._defs.appendChild(yt),t._cornersSquareClipPath=t._cornersDotClipPath=bt=yt,t._createColor({options:(E=r.cornersSquareOptions)===null||E===void 0?void 0:E.gradient,color:(T=r.cornersSquareOptions)===null||T===void 0?void 0:T.color,additionalRotation:O,x:et,y:Ot,height:s,width:s,name:"corners-square-color-"+Z+"-"+at})),(R=r.cornersSquareOptions)===null||R===void 0?void 0:R.type){var wt=new z({svg:t._element,type:r.cornersSquareOptions.type});wt.draw(et,Ot,s,O),wt._element&&yt&&yt.appendChild(wt._element)}else for(var ht=new P({svg:t._element,type:r.dotsOptions.type}),Qt=function(G){for(var _t=function(nt){if(!(!((B=H[G])===null||B===void 0)&&B[nt]))return"continue";ht.draw(et+G*o,Ot+nt*o,o,function(At,It){var ot;return!!(!((ot=H[G+At])===null||ot===void 0)&&ot[nt+It])}),ht._element&&yt&&yt.appendChild(ht._element)},J=0;J<H[G].length;J++)_t(J)},St=0;St<H.length;St++)Qt(St);if((!((D=r.cornersDotOptions)===null||D===void 0)&&D.gradient||!((k=r.cornersDotOptions)===null||k===void 0)&&k.color)&&((bt=document.createElementNS("http://www.w3.org/2000/svg","clipPath")).setAttribute("id","clip-path-corners-dot-color-"+Z+"-"+at),t._defs.appendChild(bt),t._cornersDotClipPath=bt,t._createColor({options:(S=r.cornersDotOptions)===null||S===void 0?void 0:S.gradient,color:(F=r.cornersDotOptions)===null||F===void 0?void 0:F.color,additionalRotation:O,x:et+2*o,y:Ot+2*o,height:c,width:c,name:"corners-dot-color-"+Z+"-"+at})),(q=r.cornersDotOptions)===null||q===void 0?void 0:q.type){var Et=new $({svg:t._element,type:r.cornersDotOptions.type});Et.draw(et+2*o,Ot+2*o,c,O),Et._element&&bt&&bt.appendChild(Et._element)}else{ht=new P({svg:t._element,type:r.dotsOptions.type});var Ht=function(G){for(var _t=function(nt){if(!(!((U=W[G])===null||U===void 0)&&U[nt]))return"continue";ht.draw(et+G*o,Ot+nt*o,o,function(At,It){var ot;return!!(!((ot=W[G+At])===null||ot===void 0)&&ot[nt+It])}),ht._element&&bt&&bt.appendChild(ht._element)},J=0;J<W[G].length;J++)_t(J)};for(St=0;St<W.length;St++)Ht(St)}})},a.prototype.loadImage=function(){var t=this;return new Promise(function(e,r){var n=t._options,i=new Image;if(!n.image)return r("Image is not defined");typeof n.imageOptions.crossOrigin=="string"&&(i.crossOrigin=n.imageOptions.crossOrigin),t._image=i,i.onload=function(){e()},i.src=n.image})},a.prototype.drawImage=function(t){var e=t.width,r=t.height,n=t.count,i=t.dotSize,o=this._options,s=Math.floor((o.width-n*i)/2),c=Math.floor((o.height-n*i)/2),g=s+o.imageOptions.margin+(n*i-e)/2,h=c+o.imageOptions.margin+(n*i-r)/2,x=e-2*o.imageOptions.margin,M=r-2*o.imageOptions.margin,A=document.createElementNS("http://www.w3.org/2000/svg","image");A.setAttribute("href",o.image||""),A.setAttribute("x",String(g)),A.setAttribute("y",String(h)),A.setAttribute("width",x+"px"),A.setAttribute("height",M+"px"),this._element.appendChild(A)},a.prototype._createColor=function(t){var e=t.options,r=t.color,n=t.additionalRotation,i=t.x,o=t.y,s=t.height,c=t.width,g=t.name,h=c>s?c:s,x=document.createElementNS("http://www.w3.org/2000/svg","rect");if(x.setAttribute("x",String(i)),x.setAttribute("y",String(o)),x.setAttribute("height",String(s)),x.setAttribute("width",String(c)),x.setAttribute("clip-path","url('#clip-path-"+g+"')"),e){var M;if(e.type===y)(M=document.createElementNS("http://www.w3.org/2000/svg","radialGradient")).setAttribute("id",g),M.setAttribute("gradientUnits","userSpaceOnUse"),M.setAttribute("fx",String(i+c/2)),M.setAttribute("fy",String(o+s/2)),M.setAttribute("cx",String(i+c/2)),M.setAttribute("cy",String(o+s/2)),M.setAttribute("r",String(h/2));else{var A=((e.rotation||0)+n)%(2*Math.PI),E=(A+2*Math.PI)%(2*Math.PI),T=i+c/2,R=o+s/2,B=i+c/2,D=o+s/2;E>=0&&E<=.25*Math.PI||E>1.75*Math.PI&&E<=2*Math.PI?(T-=c/2,R-=s/2*Math.tan(A),B+=c/2,D+=s/2*Math.tan(A)):E>.25*Math.PI&&E<=.75*Math.PI?(R-=s/2,T-=c/2/Math.tan(A),D+=s/2,B+=c/2/Math.tan(A)):E>.75*Math.PI&&E<=1.25*Math.PI?(T+=c/2,R+=s/2*Math.tan(A),B-=c/2,D-=s/2*Math.tan(A)):E>1.25*Math.PI&&E<=1.75*Math.PI&&(R+=s/2,T+=c/2/Math.tan(A),D-=s/2,B-=c/2/Math.tan(A)),(M=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",g),M.setAttribute("gradientUnits","userSpaceOnUse"),M.setAttribute("x1",String(Math.round(T))),M.setAttribute("y1",String(Math.round(R))),M.setAttribute("x2",String(Math.round(B))),M.setAttribute("y2",String(Math.round(D)))}e.colorStops.forEach(function(k){var S=k.offset,F=k.color,q=document.createElementNS("http://www.w3.org/2000/svg","stop");q.setAttribute("offset",100*S+"%"),q.setAttribute("stop-color",F),M.appendChild(q)}),x.setAttribute("fill","url('#"+g+"')"),this._defs.appendChild(M)}else r&&x.setAttribute("fill",r);this._element.appendChild(x)},a}(),tt="canvas";for(var Mt={},mt=0;mt<=40;mt++)Mt[mt]=mt;const Q={type:tt,width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:Mt[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{color:"#fff"}};var u=function(){return(u=Object.assign||function(a){for(var t,e=1,r=arguments.length;e<r;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(a[n]=t[n]);return a}).apply(this,arguments)};function w(a){var t=u({},a);if(!t.colorStops||!t.colorStops.length)throw"Field 'colorStops' is required in gradient";return t.rotation?t.rotation=Number(t.rotation):t.rotation=0,t.colorStops=t.colorStops.map(function(e){return u(u({},e),{offset:Number(e.offset)})}),t}function l(a){var t=u({},a);return t.width=Number(t.width),t.height=Number(t.height),t.margin=Number(t.margin),t.imageOptions=u(u({},t.imageOptions),{hideBackgroundDots:!!t.imageOptions.hideBackgroundDots,imageSize:Number(t.imageOptions.imageSize),margin:Number(t.imageOptions.margin)}),t.margin>Math.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=u({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=w(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=u({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=w(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=u({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=w(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=u({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=w(t.backgroundOptions.gradient))),t}var _=dt(192),b=dt.n(_),I=function(a,t,e,r){return new(e||(e=Promise))(function(n,i){function o(g){try{c(r.next(g))}catch(h){i(h)}}function s(g){try{c(r.throw(g))}catch(h){i(h)}}function c(g){var h;g.done?n(g.value):(h=g.value,h instanceof e?h:new e(function(x){x(h)})).then(o,s)}c((r=r.apply(a,[])).next())})},L=function(a,t){var e,r,n,i,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(g){return function(h){if(e)throw new TypeError("Generator is already executing.");for(;o;)try{if(e=1,r&&(n=2&h[0]?r.return:h[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,h[1])).done)return n;switch(r=0,n&&(h=[2&h[0],n.value]),h[0]){case 0:case 1:n=h;break;case 4:return o.label++,{value:h[1],done:!1};case 5:o.label++,r=h[1],h=[0];continue;case 7:h=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||h[0]!==6&&h[0]!==2)){o=0;continue}if(h[0]===3&&(!n||h[1]>n[0]&&h[1]<n[3])){o.label=h[1];break}if(h[0]===6&&o.label<n[1]){o.label=n[1],n=h;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(h);break}n[2]&&o.ops.pop(),o.trys.pop();continue}h=t.call(a,o)}catch(x){h=[6,x],r=0}finally{e=n=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([c,g])}}};const N=function(){function a(t){this._options=t?l(gt(Q,t)):Q,this.update()}return a._clearContainer=function(t){t&&(t.innerHTML="")},a.prototype._getQRStylingElement=function(t){return t===void 0&&(t="png"),I(this,void 0,void 0,function(){var e,r,n;return L(this,function(i){switch(i.label){case 0:if(!this._qr)throw"QR code is empty";return t.toLowerCase()!=="svg"?[3,2]:(r=void 0,e=void 0,this._svg&&this._svgDrawingPromise?(e=this._svg,r=this._svgDrawingPromise):(e=new rt(this._options),r=e.drawQR(this._qr)),[4,r]);case 1:return i.sent(),[2,e];case 2:return r=void 0,n=void 0,this._canvas&&this._canvasDrawingPromise?(n=this._canvas,r=this._canvasDrawingPromise):(n=new d(this._options),r=n.drawQR(this._qr)),[4,r];case 3:return i.sent(),[2,n]}})})},a.prototype.update=function(t){a._clearContainer(this._container),this._options=t?l(gt(this._options,t)):this._options,this._options.data&&(this._qr=b()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||function(e){switch(!0){case/^[0-9]*$/.test(e):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(e):return"Alphanumeric";default:return"Byte"}}(this._options.data)),this._qr.make(),this._options.type===tt?(this._canvas=new d(this._options),this._canvasDrawingPromise=this._canvas.drawQR(this._qr),this._svgDrawingPromise=void 0,this._svg=void 0):(this._svg=new rt(this._options),this._svgDrawingPromise=this._svg.drawQR(this._qr),this._canvasDrawingPromise=void 0,this._canvas=void 0),this.append(this._container))},a.prototype.append=function(t){if(t){if(typeof t.appendChild!="function")throw"Container should be a single DOM node";this._options.type===tt?this._canvas&&t.appendChild(this._canvas.getCanvas()):this._svg&&t.appendChild(this._svg.getElement()),this._container=t}},a.prototype.getRawData=function(t){return t===void 0&&(t="png"),I(this,void 0,void 0,function(){var e,r,n;return L(this,function(i){switch(i.label){case 0:if(!this._qr)throw"QR code is empty";return[4,this._getQRStylingElement(t)];case 1:return e=i.sent(),t.toLowerCase()==="svg"?(r=new XMLSerializer,n=r.serializeToString(e.getElement()),[2,new Blob([`<?xml version="1.0" standalone="no"?>\r
|
|
`+n],{type:"image/svg+xml"})]):[2,new Promise(function(o){return e.getCanvas().toBlob(o,"image/"+t,1)})]}})})},a.prototype.download=function(t){return I(this,void 0,void 0,function(){var e,r,n,i,o;return L(this,function(s){switch(s.label){case 0:if(!this._qr)throw"QR code is empty";return e="png",r="qr",typeof t=="string"?(e=t,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof t=="object"&&t!==null&&(t.name&&(r=t.name),t.extension&&(e=t.extension)),[4,this._getQRStylingElement(e)];case 1:return n=s.sent(),e.toLowerCase()==="svg"?(i=new XMLSerializer,o=`<?xml version="1.0" standalone="no"?>\r
|
|
`+(o=i.serializeToString(n.getElement())),ut("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(o),r+".svg")):ut(n.getCanvas().toDataURL("image/"+e),r+"."+e),[2]}})})},a}()}},ft={};function it(Y){if(ft[Y])return ft[Y].exports;var V=ft[Y]={exports:{}};return Dt[Y](V,V.exports,it),V.exports}return it.n=Y=>{var V=Y&&Y.__esModule?()=>Y.default:()=>Y;return it.d(V,{a:V}),V},it.d=(Y,V)=>{for(var dt in V)it.o(V,dt)&&!it.o(Y,dt)&&Object.defineProperty(Y,dt,{enumerable:!0,get:V[dt]})},it.o=(Y,V)=>Object.prototype.hasOwnProperty.call(Y,V),it(796)})().default})})(Xt);var Ut=Xt.exports;const Wt=Yt(Ut),Jt=$t({__proto__:null,default:Wt},[Ut]);export{Jt as q};
|
|
//# sourceMappingURL=qr-code-styling-CvBVNv73.js.map
|