@winkcor/quter 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular.cjs +1 -1
- package/dist/angular.mjs +1 -1
- package/dist/{chunk-PJYR3PPM.mjs → chunk-BI4MXPFZ.mjs} +1 -1
- package/dist/chunk-OBIGPYJW.mjs +1 -0
- package/dist/{chunk-2RNYFQOI.mjs → chunk-YNTX4ZO3.mjs} +1 -1
- package/dist/cli.js +2 -2
- package/dist/core/types.d.ts +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/quter-pixels.d.ts +1 -0
- package/dist/react-native.cjs +1 -1
- package/dist/react-native.mjs +1 -1
- package/dist/vanilla.cjs +1 -1
- package/dist/vanilla.global.js +1 -1
- package/dist/vanilla.mjs +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-RW5M2XKX.mjs +0 -1
package/dist/angular.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var se=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var pt=(t,e,r)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var yt=(t,e)=>{for(var r in e)se(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gt(e))!ht.call(t,a)&&a!==r&&se(t,a,{get:()=>e[a],enumerable:!(n=bt(e,a))||n.enumerable});return t};var wt=t=>xt(se({},"__esModule",{value:!0}),t);var ye=(t,e,r)=>pt(t,typeof e!="symbol"?e+"":e,r);var Rr={};yt(Rr,{renderAngularQuter:()=>Sr});module.exports=wt(Rr);function Ct(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function $t(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var le=Ct(),z=$t(le);function At(t,e){return t===0||e===0?0:le[z[t]+z[e]]}function Mt(t,e){return le[z[t]*e%255]}function St(t){let e=[1];for(let r=0;r<t;r++){let n=[1,Mt(2,r)],a=new Array(e.length+n.length-1).fill(0);for(let o=0;o<e.length;o++)for(let c=0;c<n.length;c++)a[o+c]^=At(e[o],n[c]);e=a}return Uint8Array.from(e)}var Ue=new Map;function Rt(t){let e=Ue.get(t);return e||(e=St(t),Ue.set(t,e)),e}function vt(t,e){let r=Rt(e),n=r.length,a=t.length,o=new Uint8Array(a+e);o.set(t);for(let c=0;c<a;c++){let s=o[c];if(s!==0){let f=z[s];for(let i=0;i<n;i++)o[c+i]^=le[z[r[i]]+f]}}return o.slice(a)}var Et=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],Lt=[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],Oe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ee(t,e){return Oe[(t-1)*4+e]}function Qe(t,e,r){let n=(e-1)*4+r,a=Et[n],o=Lt[n],c=Oe[n],s=Math.floor(c/o),f=o-c%o,i=t instanceof Uint8Array?t:Uint8Array.from(t),u=new Array(o),d=new Array(o),$=new Array(o),p=0,b=0;for(let y=0;y<o;y++){let h=y<f?s:s+1;u[y]=p,d[y]=h,h>b&&(b=h),$[y]=vt(i.subarray(p,p+h),a),p+=h}let C=new Uint8Array(i.length+o*a),S=0;for(let y=0;y<b;y++)for(let h=0;h<o;h++)y<d[h]&&(C[S++]=i[u[h]+y]);for(let y=0;y<a;y++)for(let h=0;h<o;h++)C[S++]=$[h][y];return C}var Be={numeric:1,alphanumeric:2,byte:4};function It(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var K=It();function kt(t){return t<128?K[t]:-1}function q(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Pe=[[1,9],[10,26],[27,40]],Ut=[0,4,7];function Ot(t,e){return t==="numeric"?10*Math.floor(e/3)+Ut[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function we(t,e){let r=0;for(let n of t)r+=4+q(n.mode,e)+Ot(n.mode,n.charCount);return Math.ceil(r/8)}function xe(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var j=0,te=1,re=2,Qt=["numeric","alphanumeric","byte"];function Bt(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Te=33,Ne=48;function Pt(t){let e=0,r=0,n=0,a=0;for(let o=0;o<t.length;o++){let c=t.charCodeAt(o);c<128?(r++,c>=48&&c<=57?(n++,a++):K[c]>=0&&a++):c<2048?r+=2:c>=55296&&c<=56319&&(t.charCodeAt(o+1)&64512)===56320?(r+=4,o++):r+=3,e++}return{count:e,totalBytes:r,digits:n,alnums:a}}function Ft(t,e){let r=new Int32Array(e),n=new Uint8Array(e),a=new Uint8Array(e),o=0;for(let c=0;c<t.length;){let s=t.codePointAt(c);r[o]=c,n[o]=Bt(s),s>=48&&s<=57?a[o]=2:kt(s)>=0&&(a[o]=1),o++,c+=s>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:a}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:a}=Pt(t),o=n*Fe+(a-n)*Te+(r-a)*Ne,c=i=>{let u=4+Math.min(q("numeric",i),q("alphanumeric",i),q("byte",i));return Math.ceil((o/6+u)/8)},s;if(n===e?s=xe(t,"numeric",e,r):a===e&&n===0?s=xe(t,"alphanumeric",e,r):a===0&&(s=xe(t,"byte",r,r)),s){let i=[s];return{forVersion:()=>i,minDataBytes:c}}let f;return{forVersion(i){return f??(f=Ft(t,e)),Tt(t,i,e,f)},minDataBytes:c}}function Tt(t,e,r,{cpIndex:n,cpBytes:a,cpClass:o}){let c=(4+q("numeric",e))*6,s=(4+q("alphanumeric",e))*6,f=(4+q("byte",e))*6,i=[c,s,f],u=new Int8Array(r*3).fill(-1),d=new Float64Array(3),$=new Float64Array([c,s,f]);for(let m=0;m<r;m++){let x=m*3,g=o[m];d[j]=1/0,d[te]=1/0,d[re]=$[re]+a[m]*Ne,u[x+re]=re,g!==0&&(d[te]=$[te]+Te,u[x+te]=te),g===2&&(d[j]=$[j]+Fe,u[x+j]=j);for(let l=0;l<3;l++)for(let R=0;R<3;R++){if(u[x+R]===-1)continue;let L=Math.ceil(d[R]/6)*6+i[l];(u[x+l]===-1||L<d[l])&&(d[l]=L,u[x+l]=R)}let A=$;$=d,d=A}let p=j;for(let m=1;m<3;m++)$[m]<$[p]&&(p=m);let b=new Int8Array(r),C=p;for(let m=r-1;m>=0;m--)C=u[m*3+C],b[m]=C;let S=[],y=0,h=0;for(;h<r;){let m=b[h],x=h,g=0;for(;x<r&&b[x]===m;)g+=a[x],x++;S.push({mode:Qt[m],start:n[h],end:x<r?n[x]:t.length,charCount:m===re?g:x-h,byteStart:y,byteEnd:y+g}),y+=g,h=x}return S}var Nt={L:0,M:1,Q:2,H:3},De;function _t(){return De??(De=new TextEncoder)}var Ce=class{constructor(e){ye(this,"bytes");ye(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let a=r-1;a>=0;a--)e>>a&1&&(this.bytes[n>>3]|=128>>(n&7)),n++;this.bitPos=n}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},Dt=[236,17];function qt(t,e,r,n,a){let o=new Ce(n);for(let i of e)if(o.writeBits(Be[i.mode],4),o.writeBits(i.charCount,q(i.mode,r)),i.mode==="numeric")for(let u=i.start;u<i.end;u+=3){let d=Math.min(3,i.end-u),$=t.charCodeAt(u)-48;d>=2&&($=$*10+(t.charCodeAt(u+1)-48)),d>=3&&($=$*10+(t.charCodeAt(u+2)-48)),o.writeBits($,d===3?10:d===2?7:4)}else if(i.mode==="alphanumeric")for(let u=i.start;u<i.end;u+=2)if(u+1<i.end){let d=K[t.charCodeAt(u)]*45+K[t.charCodeAt(u+1)];o.writeBits(d,11)}else o.writeBits(K[t.charCodeAt(u)],6);else for(let u=i.byteStart;u<i.byteEnd;u++)o.writeBits(a[u],8);let c=n*8;if(o.bitLength>c)throw new RangeError(`encoded data (${o.bitLength} bits) exceeds capacity (${c} bits) for the selected version`);o.skipBits(Math.min(4,c-o.bitLength)),o.alignToByte();let s=o.bytes,f=0;for(let i=o.bitLength>>3;i<n;i++)s[i]=Dt[f%2],f++;return s}function qe(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let n=Nt[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let a=_e(t),o=p=>a.forVersion(p),c,s;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);c=r,s=o(c);let p=ee(c,n),b=we(s,c);if(b>p)throw new RangeError(`data too large for version ${c} with EC level "${e}" (needs ${b} bytes, capacity ${p})`)}else{let p;for(let[b,C]of Pe){if(a.minDataBytes(b)>ee(C,n))continue;let S=o(b),y=we(S,b);for(let h=b;h<=C;h++)if(y<=ee(h,n)){p={version:h,segments:S};break}if(p)break}if(!p)throw new RangeError(`data too large for any QR version with EC level "${e}"`);c=p.version,s=p.segments}let i=s.some(p=>p.mode==="byte")?_t().encode(t):null,u=ee(c,n),d=qt(t,s,c,u,i);return{codewords:Qe(d,c,n),version:c,ecLevelIndex:n,segments:s}}var Gt=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function Wt(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,a=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,a)}function Ht(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=Gt[e];for(let n=0;n<12;n++)for(let a=0;a<6;a++)t[e*72+n*6+a]=r(n,a)?1:0}return t}var Ve=Ht(),Ge=1488,We=93,He=2047;function Vt(t,e,r,n,a){let{prevRow:o,colRunVal:c,colRunLen:s,colWin:f}=a;c.fill(-1),s.fill(0),f.fill(0);let i=0,u=0;for(let d=0;d<r;d++){let $=n+d%12*6,p=d*r,b=d>=10,C=0,S=-1,y=0,h=0,m=-1,x=-1;for(let g=0;g<r;g++){let A=p+g,l=t[A]^Ve[$+C]&(e[A]^1);u+=l,l===S?y++:(y>=5&&(i+=y-2),S=l,y=1),h=(h<<1|l)&He,g>=10&&(h===Ge||h===We)&&(i+=40),l===c[g]?s[g]++:(s[g]>=5&&(i+=s[g]-2),c[g]=l,s[g]=1);let R=(f[g]<<1|l)&He;f[g]=R,b&&(R===Ge||R===We)&&(i+=40);let L=o[g];d>0&&g>0&&l===m&&l===L&&l===x&&(i+=3),o[g]=l,x=L,m=l,C++,C===6&&(C=0)}y>=5&&(i+=y-2)}for(let d=0;d<r;d++)s[d]>=5&&(i+=s[d]-2);return i+=Wt(u,r*r),i}function Xt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},a=0,o=1/0;for(let c=0;c<8;c++){let s=Vt(t,e,r,c*72,n);s<o&&(o=s,a=c)}return a}function Xe(t,e,r){let n=Xt(t,e,r),a=n*72;for(let o=0;o<r;o++){let c=a+o%12*6,s=o*r,f=0;for(let i=0;i<r;i++)e[s+i]||(t[s+i]^=Ve[c+f]),f++,f===6&&(f=0)}return n}function Yt(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,n=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,a=[6];for(let o=1;o<e;o++)a.push(r-(e-1-o)*n);return a}var jt=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Kt=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function $e(t,e,r,n,a){for(let o=-1;o<=7;o++)for(let c=-1;c<=7;c++){let s=n+o,f=a+c;if(s<0||f<0||s>=r||f>=r)continue;let i=s*r+f;e[i]=1,o===-1||o===7||c===-1||c===7?t[i]=0:o===0||o===6||c===0||c===6||o>=2&&o<=4&&c>=2&&c<=4?t[i]=1:t[i]=0}}function Jt(t,e,r,n,a){for(let o=-2;o<=2;o++)for(let c=-2;c<=2;c++){let s=(n+o)*r+(a+c);e[s]=1,o===-2||o===2||c===-2||c===2||o===0&&c===0?t[s]=1:t[s]=0}}function Zt(t,e,r){for(let n=8;n<r-8;n++){let a=n%2===0?1:0,o=6*r+n,c=n*r+6;t[o]=a,t[c]=a,e[o]=1,e[c]=1}}var Ye=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function zt(t,e){for(let[r,n]of Ye)t[r*e+n]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function er(t,e,r,n){if(n<7)return;let a=Kt[n-7];for(let o=0;o<18;o++){let c=a>>o&1,s=Math.floor(o/3),f=o%3,i=s*r+(r-11+f),u=(r-11+f)*r+s;t[i]=c,e[i]=1,t[u]=c,e[u]=1}}function tr(t,e,r,n){let a=0,o=n.length*8,c=r-1,s=!0;for(;c>=0;){if(c===6){c--;continue}let f=s?r-1:0,i=s?-1:r,u=s?-1:1;for(let d=f;d!==i;d+=u){let $=d*r;for(let p=0;p<=1;p++){let b=c-p;b<0||e[$+b]||(a<o?(t[$+b]=n[a>>3]>>7-(a&7)&1,a++):t[$+b]=0)}}c-=2,s=!s}}var rr=16,X=new Map;function je(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,a=X.get(n);if(a)return X.delete(n),X.set(n,a),a;let o=nr(t,e,r);return X.set(n,o),X.size>rr&&X.delete(X.keys().next().value),o}function nr(t,e,r){let n=qe(t,e,r),{codewords:a,version:o,ecLevelIndex:c}=n,s=o*4+17,f=new Uint8Array(s*s),i=new Uint8Array(s*s);$e(f,i,s,0,0),$e(f,i,s,0,s-7),$e(f,i,s,s-7,0),Zt(f,i,s);let u=(4*o+9)*s+8;f[u]=1,i[u]=1;let d=Yt(o);for(let b of d)for(let C of d)b<=8&&C<=8||b<=8&&C>=s-8||b>=s-8&&C<=8||Jt(f,i,s,b,C);er(f,i,s,o),zt(i,s),tr(f,i,s,a);let $=Xe(f,i,s),p=jt[c*8+$];return or(f,p,s),{matrix:f,version:o,size:s}}function or(t,e,r){for(let n=0;n<15;n++){let[a,o]=Ye[n];t[a*r+o]=e>>14-n&1}for(let n=0;n<8;n++)t[8*r+r-1-n]=e>>n&1;for(let n=0;n<7;n++)t[(r-7+n)*r+8]=e>>n+8&1;t[(r-8)*r+8]=1}var w=t=>Math.round(t*100)/100,O=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),a=r-n*100,o;return a===0?o=String(n):a%10===0?o=`${n}.${a/10}`:a<10?o=`${n}.0${a}`:o=`${n}.${a}`,e?`-${o}`:o}function Ae(t,e){return t<=7||t>=e-8?7:-1}function Me(t,e){return t<=7?e-8:e}function ar(t,e,r,n){let a=k(O(r)),o=new Array(e),c=new Array(e+1),s=new Array(e+1);for(let i=0;i<=e;i++){let u=O(i*r);c[i]=k(u),s[i]=k(-u),i<e&&(o[i]=k(O(n+i*r)))}let f=[];for(let i=0;i<e;i++){let u=i*e,d=k(O(n+i*r)),$=Ae(i,e)+1,p=Me(i,e),b=-1;for(let C=$;C<p;C++)if(t[u+C]===1)b===-1&&(b=C);else if(b!==-1){let S=C-b;f.push(`M${o[b]},${d}h${c[S]}v${a}h${s[S]}z`),b=-1}if(b!==-1){let C=p-b;f.push(`M${o[b]},${d}h${c[C]}v${a}h${s[C]}z`)}}return f.join(" ")}function ir(t,e,r,n,a){let o=w(r),c=[];if(a==="circle"){let h=o/2,m=w(h),x=`a${k(O(m))},${k(O(m))} 0 1,0 `,g=`${x}${k(O(m*2))},0${x}${k(O(-m*2))},0z`,A=new Array(e);for(let l=0;l<e;l++){let R=w(w(n+l*r)+h);A[l]=`M${k(O(R-m))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(O(w(n+l*r)+h))}${g}`,U=Ae(l,e)+1,E=Me(l,e);for(let I=U;I<E;I++)t[R+I]===1&&c.push(A[I]+L)}return c.join(" ")}let s=w(o*.45),f=[k(O(o)),k(O(o-s)),k(O(o-2*s))],i=[k(O(-o)),k(O(-(o-s))),k(O(-(o-2*s)))],u=k(O(s)),d=k(O(-s)),$=`q${u},0 ${u},${u}`,p=`q0,${u} ${d},${u}`,b=`q${d},0 ${d},${d}`,C=`q0,${d} ${u},${d}`,S=new Array(e),y=new Array(e);for(let h=0;h<e;h++){let m=w(n+h*r);S[h]=k(O(m)),y[h]=k(O(m+s))}for(let h=0;h<e;h++){let m=h*e,x=k(O(w(n+h*r))),g=Ae(h,e)+1,A=Me(h,e);for(let l=g;l<A;l++){if(t[m+l]!==1)continue;let R=h>0&&t[m-e+l]===1,L=l<e-1&&t[m+l+1]===1,U=h<e-1&&t[m+e+l]===1,E=l>0&&t[m+l-1]===1,I=!(R||E),M=!(R||L),v=!(U||L),B=!(U||E);c.push(`M${I?y[l]:S[l]},${x}h${f[(I?1:0)+(M?1:0)]}`+(M?$:"")+`v${f[(M?1:0)+(v?1:0)]}`+(v?p:"")+`h${i[(v?1:0)+(B?1:0)]}`+(B?b:"")+`v${i[(B?1:0)+(I?1:0)]}`+(I?C:"")+"z")}}return c.join(" ")}var cr=2,Ke=new WeakMap;function Je(t,e,r,n,a){let o=Ke.get(t);o||(o=new Map,Ke.set(t,o));let c=`${r}|${n}|${a}`,s=o.get(c);if(s!==void 0)return s;let f=a==="square"?ar(t,e,r,n):ir(t,e,r,n,a);return o.size>=cr&&o.clear(),o.set(c,f),f}var sr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ze(t){return t.replace(sr,"")}function ze(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let n=r+e*2,a=w(t/n);if(t>0&&a===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:a,marginPx:w(e*a),svgSize:w(a*n)}}function ue(t,e,r){let n=w(r);return`M${w(t)},${w(e)}h${n}v${n}h${-n}z`}function fe(t,e,r,n,a){let o=w(Math.min(a,r/2,n/2)),c=w(r-2*o),s=w(n-2*o);return`M${w(t+o)},${w(e)}h${c}q${o},0 ${o},${o}v${s}q0,${o} ${-o},${o}h${-c}q${-o},0 ${-o},${-o}v${-s}q0,${-o} ${o},${-o}z`}function lr(t,e,r,n){if(n==="circle"){let a=w(r/2),o=w(a*2);return`M${w(t)},${w(e+r/2)}a${a},${a} 0 1,0 ${o},0a${a},${a} 0 1,0 ${-o},0z`}return n==="rounded"?fe(t,e,r,r,r*.3):ue(t,e,r)}function ur(t,e,r,n){let a=r/7,o=r-2*a,c=a;if(n==="square"){let i=ue(t,e,r),u=ue(t+c,e+c,o);return`${i} ${u}`}if(n==="rounded"){let i=fe(t,e,r,r,r*.15),u=ue(t+c,e+c,o);return`${i} ${u}`}if(n==="circle"){let i=t+r/2,u=w(e+r/2),d=$=>{let p=w($),b=w(p*2);return`M${w(i-p)},${u}a${p},${p} 0 1,0 ${b},0a${p},${p} 0 1,0 ${-b},0z`};return`${d(r/2)} ${d(o/2)}`}let s=fe(t,e,r,r,r*.35),f=fe(t+c,e+c,o,o,o*.2);return`${s} ${f}`}function et(t,e,r,n,a){let o=w(7*r),c=w(3*r),s=w(2*r);return{square:ur(t,e,o,n),dot:lr(w(t+s),w(e+s),c,a)}}function Se(t,e,r){return r+t*e}function tt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([a,o])=>({x:Se(o,e,r),y:Se(a,e,r)}))}var Y={L:.0225,M:.04,Q:.0625,H:.09},fr=Y.H,dr=.4;function Re(t){return t<=Y.L?"L":t<=Y.M?"M":t<=Y.Q?"Q":"H"}var mr=/[\u0000-\u0020]/g;function de(t){let e=t.replace(mr,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function nt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function ot(t,e,r){let a=(t?e!==void 0?Math.max(0,Math.min(1,e)):dr:0)*fr;return r?{ecLevel:r,absoluteArea:Math.min(a,Y[r]),targetArea:a,clamped:a>Y[r]}:a>0?{ecLevel:Re(a),absoluteArea:a,targetArea:a,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:a,clamped:!1}}function rt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var br={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function at({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:n,moduleSize:a,marginPx:o}){let c=n*a,s=t*c*c,f=Math.sqrt(s*e),i=Math.sqrt(s/e);if(!(f>0)||!(i>0))return br;let u=f/a,d=i/a,$=Y[r]*n*n,p=Math.max(1,n-16),b=Math.min(rt(u),p),C=1;for(;;){let l=Math.min(1,b/u);if(C=Math.min(rt(d*l),p),b*C<=$||b<=1)break;b-=2}let S=Math.min(1,b/u,C/d),y=f*S,h=i*S,m=b*a,x=C*a,g=o+(n-b)/2*a,A=o+(n-C)/2*a;return{clearX:g,clearY:A,clearWidth:m,clearHeight:x,boxX:g+(m-y)/2,boxY:A+(x-h)/2,boxWidth:y,boxHeight:h}}function ve(t,e){let r=t?.square?.style??"square",n=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??n,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function gr(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",backgroundColor:c="#ffffff",corner:s,logo:f,qr:i}=t,u=f?.src&&de(f.src)?f.src:void 0,d=!!(u||f?.custom),$=i?.errorCorrectionLevel,{ecLevel:p,absoluteArea:b,targetArea:C,clamped:S}=ot(d,f?.size,$),y=[];S&&y.push(`[QRCode] logo.size=${f?.size} needs ECL \u2265 "${Re(C)}"; ECL "${$}" set, logo clamped.`);let{matrix:h,size:m}=je(e,p,i?.version),{moduleSize:x,marginPx:g,svgSize:A}=ze(r,n,m),l=ve(s,o),R=Je(h,m,x,g,a),L=tt(m,x,g).map(P=>{let{square:F,dot:W}=et(w(P.x),w(P.y),x,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:w(P.x),y:w(P.y),width:w(7*x),height:w(7*x),fill:l.backgroundColor}},square:{d:F,fill:l.squareColor,fillRule:"evenodd"},dot:{d:W,fill:l.dotColor}}}),U=(f?.margin??0)*x,E=at({absoluteArea:b,aspectRatio:nt(f?.aspectRatio),ecLevel:p,qrSize:m,moduleSize:x,marginPx:g}),I=w(E.boxX+U),M=w(E.boxY+U),v=w(Math.max(0,E.boxWidth-U*2)),B=w(Math.max(0,E.boxHeight-U*2)),N=d&&v>0&&B>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||B<=0)&&y.push(`[QRCode] logo.margin=${f?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:w(r),viewBox:A,ecLevel:p,background:c==="transparent"?void 0:c,modules:R?{d:R,fill:o}:void 0,finders:L,clear:N&&(f?.hideDots??!0)?{x:w(E.clearX),y:w(E.clearY),width:w(E.clearWidth),height:w(E.clearHeight)}:void 0,logo:N?{src:u,x:I,y:M,width:v,height:B,radius:w(gr(f?.radius)*Math.min(v,B)/2)}:void 0,warnings:y}}function ne(t,e){return`${t}${e}`}function hr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Ee(t){let e=hr(t)*Math.PI/180,r=Math.cos(e)/2,n=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-n)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+n)*100)}%`}}function oe(t,e){let{x1:r,y1:n,x2:a,y2:o}=Ee(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${a}" y2="${o}"><stop offset="0%" stop-color="${it(e.startColor)}"/><stop offset="100%" stop-color="${it(e.endColor)}"/></linearGradient>`}function it(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function pr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);e=Math.imul(e^a,16777619),r=Math.imul(r^a,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function G(t){return Ze(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var ct=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),yr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of yr)ct.add(t);function xr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function wr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let a=typeof r=="number"&&r!==0&&!ct.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${xr(e)}:${a}`}).join(";")}function me(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",dotGradient:c,backgroundColor:s="#ffffff",backgroundGradient:f,corner:i,logo:u,qr:d,className:$,style:p,ariaLabel:b,idPrefix:C}=t,S=J(t),y=ve(i,o),h=u?.src&&de(u.src)?u.src:void 0,m=(C??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",x=[e,r,n,a,o,JSON.stringify(c??null),s,JSON.stringify(f??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,i?.backgroundColor??"",JSON.stringify(i?.square?.gradient??null),JSON.stringify(i?.dot?.gradient??null),S.ecLevel,d?.version??"",h??"",u?.size??"",u?.aspectRatio??"",u?.margin??"",u?.hideDots??"",$??"",b??"",C??""];u?.radius!==void 0&&x.push(u.radius),u?.custom&&x.push("custom");let g=`${m}${pr(x.join("\0"))}`,A=`${g}t`,l=`${g}m`,R=`${g}c`,L=ne(g,"d"),U=ne(g,"b"),E=ne(g,"s"),I=ne(g,"p"),{size:M,viewBox:v,background:B,modules:N,finders:P}=S,{clear:F,logo:W}=S,Q=`<svg role="img" aria-labelledby="${A}" width="${M}" height="${M}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(Q+=` class="${G($)}"`),p&&(Q+=` style="${G(wr(p))}"`),Q+=">",Q+=`<title id="${A}">${G(b??`QR code: ${e}`)}</title>`;let ae=[c&&oe(L,c),f&&oe(U,f),i?.square?.gradient&&oe(E,i.square.gradient),i?.dot?.gradient&&oe(I,i.dot.gradient)].filter(Boolean);ae.length&&(Q+=`<defs>${ae.join("")}</defs>`),B!==void 0&&(Q+=`<rect width="${v}" height="${v}" fill="${f?`url(#${U})`:G(B)}"/>`),F&&(Q+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${F.x}" y="${F.y}" width="${F.width}" height="${F.height}" fill="black"/></mask></defs>`),Q+=`<g${F?` mask="url(#${l})"`:""}>`,N&&(Q+=`<path d="${N.d}" fill="${c?`url(#${L})`:G(N.fill)}"/>`);for(let{background:_,square:H,dot:V}of P)Q+="<g>"+(_?`<rect x="${_.x}" y="${_.y}" width="${_.width}" height="${_.height}" fill="${G(_.fill)}"/>`:"")+`<path d="${H.d}" fill="${i?.square?.gradient?`url(#${E})`:G(H.fill)}" fill-rule="evenodd"/><path d="${V.d}" fill="${i?.dot?.gradient?`url(#${I})`:G(V.fill)}"/></g>`;if(Q+="</g>",W?.src){let{x:_,y:H,width:V,height:ie,radius:T}=W;T>0&&(Q+=`<defs><clipPath id="${R}"><rect x="${_}" y="${H}" width="${V}" height="${ie}" rx="${T}" ry="${T}"/></clipPath></defs>`),Q+=`<image href="${G(W.src)}" x="${_}" y="${H}" width="${V}" height="${ie}"${T>0?` clip-path="url(#${R})"`:""}/>`}return Q+="</svg>",Q}function st(t,e,r,n){if(n){let a=Ee(n),o=Number.parseFloat(a.x1)/100*e,c=Number.parseFloat(a.y1)/100*e,s=Number.parseFloat(a.x2)/100*e,f=Number.parseFloat(a.y2)/100*e,i=t.createLinearGradient(o,c,s,f);i.addColorStop(0,n.startColor),i.addColorStop(1,n.endColor),t.fillStyle=i,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function lt(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function ut(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function ft(t,e,r){let{width:n,height:a,matrixSize:o,margin:c,filter:s,backgroundColor:f,backgroundAlpha:i}=r,u=r.gapColor,d=new Uint8ClampedArray(t),$=n/(o+c*2),p=Math.max(r.coreSize??.4,r.minCoreSize??0),b=(1-p)/2,C=(m,x)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(m-.5)**2+(x-.5)**2<=p**2/4;let g=p*.28,A=Math.max(Math.abs(m-.5)-(p/2-g),0),l=Math.max(Math.abs(x-.5)-(p/2-g),0);return A**2+l**2<=g**2},S=(m,x)=>r.clear!==void 0&&m>=r.clear.x&&x>=r.clear.y&&m<r.clear.x+r.clear.width&&x<r.clear.y+r.clear.height,y=(m,x)=>m<8&&x<8||m>=o-8&&x<8||m<8&&x>=o-8,h=(m,x=t)=>{let g=x[m+3]/255,A=e[m+3]/255,l=g+A*(1-g),R=(L,U)=>l===0?0:(L*g+U*A*(1-g))/l;d[m]=R(x[m],e[m]),d[m+1]=R(x[m+1],e[m+1]),d[m+2]=R(x[m+2],e[m+2]),d[m+3]=l*255};for(let m=0;m<a;m+=1)for(let x=0;x<n;x+=1){let g=x/$-c,A=m/$-c,l=(m*n+x)*4;if(g<0||A<0||g>=o||A>=o){d[l]=e[l],d[l+1]=e[l+1],d[l+2]=e[l+2],d[l+3]=e[l+3];continue}let R=Math.floor(g),L=Math.floor(A);if(S(g,A)){d[l]=f[0],d[l+1]=f[1],d[l+2]=f[2],d[l+3]=i;continue}if(y(R,L)){h(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let U=g-R,E=A-L;if(U>=b&&U<1-b&&E>=b&&E<1-b&&C(U,E)){h(l);continue}if(u){let v=u[3]/255,B=e[l+3]/255,N=v+B*(1-v),P=(F,W)=>N===0?0:(F*v+W*B*(1-v))/N;d[l]=P(u[0],e[l]),d[l+1]=P(u[1],e[l+1]),d[l+2]=P(u[2],e[l+2]),d[l+3]=N*255;continue}let M=l;if(s==="color")d[l]=e[M],d[l+1]=e[M+1],d[l+2]=e[M+2];else{let v=e[M]*.2126+e[M+1]*.7152+e[M+2]*.0722;d[l]=v,d[l+1]=v,d[l+2]=v}d[l+3]=e[M+3]}return d}function dt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Le(t){return new Promise((e,r)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>e(n),n.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),n.src=t})}function Cr(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let n=r.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]]}function $r(t,e,r,n,a,o,c){let s=c==="fill"?Math.max(a/e.naturalWidth,o/e.naturalHeight):Math.min(a/e.naturalWidth,o/e.naturalHeight),f=e.naturalWidth*s,i=e.naturalHeight*s;t.drawImage(e,r+(a-f)/2,n+(o-i)/2,f,i)}function Ar(t,e){let r=me({...e,ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),n=new DOMParser().parseFromString(r,"image/svg+xml");t.replaceChildren(document.importNode(n.documentElement,!0))}async function Mr(t,e,r){let{imagePath:n,imageDotSize:a,imageDotStyle:o,imageColor:c,filter:s,fillType:f="scale_to_fit",logo:i,...u}=e;if(!n||!dt(n))throw new Error("The image URL uses an unsupported scheme.");if(i?.src&&!dt(i.src))throw new Error("The center image URL uses an unsupported scheme.");if(f!=="scale_to_fit"&&f!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let d=Le(n),$=i?.src?Le(i.src):Promise.resolve(void 0),[p,b]=await Promise.all([d,$]);if(r())return;let C=i?{...i,src:void 0,custom:!0,aspectRatio:i.aspectRatio??(b?b.naturalWidth/b.naturalHeight:1)}:void 0,S={...u,dotStyle:o??u.dotStyle,backgroundColor:u.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...u.qr},logo:C},y=J(S),h=J({...S,corner:{square:{style:"square"},dot:{style:"square"}}}),m=h.finders[0].square.d,g=Number(m.match(/h([\d.]+)v/)?.[1])/7,A=Number(m.match(/^M([\d.]+),/)?.[1])/g,l=Math.round(h.viewBox/g-A*2),R=l+A*2;if(!Number.isFinite(g)||!Number.isFinite(A)||l<21)throw new Error("Unable to determine QR module dimensions.");let L=me({...S,dotColor:S.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),U=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Le(U);if(r())return;let I=S.size??256,M=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=M,v.height=M;let B=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=M,N.height=M;let P=N.getContext("2d",{willReadFrequently:!0});if(!B||!P)throw new Error("Canvas 2D context is unavailable.");B.drawImage(E,0,0,M,M);let F=e.backgroundColor??"#ffffff",Q=Cr(F==="transparent"?"#ffffff":F),ae=[Q[0],Q[1],Q[2]];st(P,M,F,S.backgroundGradient);let _=M/R,H=A*_,V=l*_;$r(P,p,H,H,V,V,f);let ie=ft(B.getImageData(0,0,M,M).data,P.getImageData(0,0,M,M).data,{width:M,height:M,matrixSize:l,margin:A,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:lt(a),dotStyle:o??u.dotStyle,clear:y.clear?{x:y.clear.x/g-A,y:y.clear.y/g-A,width:y.clear.width/g,height:y.clear.height/g}:void 0,filter:ut(c,s),backgroundColor:ae,backgroundAlpha:F==="transparent"?0:Q[3]}),T=document.createElement("canvas");T.width=Math.round(I),T.height=Math.round(I),T.setAttribute("role","img"),T.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),T.style.width=`${I}px`,T.style.height=`${I}px`;let Ie=T.getContext("2d"),ce=document.createElement("canvas");ce.width=M,ce.height=M;let D=ce.getContext("2d");if(!Ie||!D)throw new Error("Canvas 2D context is unavailable.");let ke=D.createImageData(M,M);if(ke.data.set(ie),D.putImageData(ke,0,0),b&&y.logo){let Z=M/y.viewBox,be=y.logo.x*Z,ge=y.logo.y*Z,he=y.logo.width*Z,pe=y.logo.height*Z;y.logo.radius>0?(D.save(),D.beginPath(),D.roundRect(be,ge,he,pe,y.logo.radius*Z),D.clip(),D.drawImage(b,be,ge,he,pe),D.restore()):D.drawImage(b,be,ge,he,pe)}Ie.drawImage(ce,0,0,T.width,T.height),r()||t.replaceChildren(T)}finally{URL.revokeObjectURL(U)}}function mt(t,e){let r=!1;return e.imagePath?Mr(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):Ar(t,e),()=>{r=!0,t.replaceChildren()}}function Sr(t,e){return mt(t.nativeElement,e)}0&&(module.exports={renderAngularQuter});
|
|
1
|
+
"use strict";var ce=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var yt=(t,e,r)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var xt=(t,e)=>{for(var r in e)ce(t,r,{get:e[r],enumerable:!0})},wt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ht(e))!pt.call(t,a)&&a!==r&&ce(t,a,{get:()=>e[a],enumerable:!(n=gt(e,a))||n.enumerable});return t};var Ct=t=>wt(ce({},"__esModule",{value:!0}),t);var ye=(t,e,r)=>yt(t,typeof e!="symbol"?e+"":e,r);var Rr={};xt(Rr,{renderAngularQuter:()=>Sr});module.exports=Ct(Rr);function $t(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function Mt(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var le=$t(),z=Mt(le);function At(t,e){return t===0||e===0?0:le[z[t]+z[e]]}function St(t,e){return le[z[t]*e%255]}function Rt(t){let e=[1];for(let r=0;r<t;r++){let n=[1,St(2,r)],a=new Array(e.length+n.length-1).fill(0);for(let o=0;o<e.length;o++)for(let s=0;s<n.length;s++)a[o+s]^=At(e[o],n[s]);e=a}return Uint8Array.from(e)}var Ue=new Map;function vt(t){let e=Ue.get(t);return e||(e=Rt(t),Ue.set(t,e)),e}function Et(t,e){let r=vt(e),n=r.length,a=t.length,o=new Uint8Array(a+e);o.set(t);for(let s=0;s<a;s++){let c=o[s];if(c!==0){let u=z[c];for(let i=0;i<n;i++)o[s+i]^=le[z[r[i]]+u]}}return o.slice(a)}var Lt=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],It=[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],Oe=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function ee(t,e){return Oe[(t-1)*4+e]}function Qe(t,e,r){let n=(e-1)*4+r,a=Lt[n],o=It[n],s=Oe[n],c=Math.floor(s/o),u=o-s%o,i=t instanceof Uint8Array?t:Uint8Array.from(t),f=new Array(o),d=new Array(o),$=new Array(o),x=0,g=0;for(let y=0;y<o;y++){let h=y<u?c:c+1;f[y]=x,d[y]=h,h>g&&(g=h),$[y]=Et(i.subarray(x,x+h),a),x+=h}let C=new Uint8Array(i.length+o*a),S=0;for(let y=0;y<g;y++)for(let h=0;h<o;h++)y<d[h]&&(C[S++]=i[f[h]+y]);for(let y=0;y<a;y++)for(let h=0;h<o;h++)C[S++]=$[h][y];return C}var Be={numeric:1,alphanumeric:2,byte:4};function kt(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var K=kt();function Ut(t){return t<128?K[t]:-1}function q(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Pe=[[1,9],[10,26],[27,40]],Ot=[0,4,7];function Qt(t,e){return t==="numeric"?10*Math.floor(e/3)+Ot[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function we(t,e){let r=0;for(let n of t)r+=4+q(n.mode,e)+Qt(n.mode,n.charCount);return Math.ceil(r/8)}function xe(t,e,r,n){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:n}}var Y=0,te=1,re=2,Bt=["numeric","alphanumeric","byte"];function Pt(t){return t<128?1:t<2048?2:t<65536?3:4}var Fe=20,Te=33,Ne=48;function Ft(t){let e=0,r=0,n=0,a=0;for(let o=0;o<t.length;o++){let s=t.charCodeAt(o);s<128?(r++,s>=48&&s<=57?(n++,a++):K[s]>=0&&a++):s<2048?r+=2:s>=55296&&s<=56319&&(t.charCodeAt(o+1)&64512)===56320?(r+=4,o++):r+=3,e++}return{count:e,totalBytes:r,digits:n,alnums:a}}function Tt(t,e){let r=new Int32Array(e),n=new Uint8Array(e),a=new Uint8Array(e),o=0;for(let s=0;s<t.length;){let c=t.codePointAt(s);r[o]=s,n[o]=Pt(c),c>=48&&c<=57?a[o]=2:Ut(c)>=0&&(a[o]=1),o++,s+=c>65535?2:1}return{cpIndex:r,cpBytes:n,cpClass:a}}function _e(t){let{count:e,totalBytes:r,digits:n,alnums:a}=Ft(t),o=n*Fe+(a-n)*Te+(r-a)*Ne,s=i=>{let f=4+Math.min(q("numeric",i),q("alphanumeric",i),q("byte",i));return Math.ceil((o/6+f)/8)},c;if(n===e?c=xe(t,"numeric",e,r):a===e&&n===0?c=xe(t,"alphanumeric",e,r):a===0&&(c=xe(t,"byte",r,r)),c){let i=[c];return{forVersion:()=>i,minDataBytes:s}}let u;return{forVersion(i){return u??(u=Tt(t,e)),Nt(t,i,e,u)},minDataBytes:s}}function Nt(t,e,r,{cpIndex:n,cpBytes:a,cpClass:o}){let s=(4+q("numeric",e))*6,c=(4+q("alphanumeric",e))*6,u=(4+q("byte",e))*6,i=[s,c,u],f=new Int8Array(r*3).fill(-1),d=new Float64Array(3),$=new Float64Array([s,c,u]);for(let b=0;b<r;b++){let p=b*3,m=o[b];d[Y]=1/0,d[te]=1/0,d[re]=$[re]+a[b]*Ne,f[p+re]=re,m!==0&&(d[te]=$[te]+Te,f[p+te]=te),m===2&&(d[Y]=$[Y]+Fe,f[p+Y]=Y);for(let l=0;l<3;l++)for(let R=0;R<3;R++){if(f[p+R]===-1)continue;let L=Math.ceil(d[R]/6)*6+i[l];(f[p+l]===-1||L<d[l])&&(d[l]=L,f[p+l]=R)}let M=$;$=d,d=M}let x=Y;for(let b=1;b<3;b++)$[b]<$[x]&&(x=b);let g=new Int8Array(r),C=x;for(let b=r-1;b>=0;b--)C=f[b*3+C],g[b]=C;let S=[],y=0,h=0;for(;h<r;){let b=g[h],p=h,m=0;for(;p<r&&g[p]===b;)m+=a[p],p++;S.push({mode:Bt[b],start:n[h],end:p<r?n[p]:t.length,charCount:b===re?m:p-h,byteStart:y,byteEnd:y+m}),y+=m,h=p}return S}var _t={L:0,M:1,Q:2,H:3},De;function Dt(){return De??(De=new TextEncoder)}var Ce=class{constructor(e){ye(this,"bytes");ye(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,r){let n=this.bitPos;for(let a=r-1;a>=0;a--)e>>a&1&&(this.bytes[n>>3]|=128>>(n&7)),n++;this.bitPos=n}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},qt=[236,17];function Wt(t,e,r,n,a){let o=new Ce(n);for(let i of e)if(o.writeBits(Be[i.mode],4),o.writeBits(i.charCount,q(i.mode,r)),i.mode==="numeric")for(let f=i.start;f<i.end;f+=3){let d=Math.min(3,i.end-f),$=t.charCodeAt(f)-48;d>=2&&($=$*10+(t.charCodeAt(f+1)-48)),d>=3&&($=$*10+(t.charCodeAt(f+2)-48)),o.writeBits($,d===3?10:d===2?7:4)}else if(i.mode==="alphanumeric")for(let f=i.start;f<i.end;f+=2)if(f+1<i.end){let d=K[t.charCodeAt(f)]*45+K[t.charCodeAt(f+1)];o.writeBits(d,11)}else o.writeBits(K[t.charCodeAt(f)],6);else for(let f=i.byteStart;f<i.byteEnd;f++)o.writeBits(a[f],8);let s=n*8;if(o.bitLength>s)throw new RangeError(`encoded data (${o.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);o.skipBits(Math.min(4,s-o.bitLength)),o.alignToByte();let c=o.bytes,u=0;for(let i=o.bitLength>>3;i<n;i++)c[i]=qt[u%2],u++;return c}function qe(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let n=_t[e];if(typeof n!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let a=_e(t),o=x=>a.forVersion(x),s,c;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);s=r,c=o(s);let x=ee(s,n),g=we(c,s);if(g>x)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${g} bytes, capacity ${x})`)}else{let x;for(let[g,C]of Pe){if(a.minDataBytes(g)>ee(C,n))continue;let S=o(g),y=we(S,g);for(let h=g;h<=C;h++)if(y<=ee(h,n)){x={version:h,segments:S};break}if(x)break}if(!x)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=x.version,c=x.segments}let i=c.some(x=>x.mode==="byte")?Dt().encode(t):null,f=ee(s,n),d=Wt(t,c,s,f,i);return{codewords:Qe(d,s,n),version:s,ecLevelIndex:n,segments:c}}var Gt=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function Ht(t,e){let r=t/e*100,n=Math.floor(Math.abs(r-50)/5)*10,a=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(n,a)}function Vt(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=Gt[e];for(let n=0;n<12;n++)for(let a=0;a<6;a++)t[e*72+n*6+a]=r(n,a)?1:0}return t}var Ve=Vt(),We=1488,Ge=93,He=2047;function Xt(t,e,r,n,a){let{prevRow:o,colRunVal:s,colRunLen:c,colWin:u}=a;s.fill(-1),c.fill(0),u.fill(0);let i=0,f=0;for(let d=0;d<r;d++){let $=n+d%12*6,x=d*r,g=d>=10,C=0,S=-1,y=0,h=0,b=-1,p=-1;for(let m=0;m<r;m++){let M=x+m,l=t[M]^Ve[$+C]&(e[M]^1);f+=l,l===S?y++:(y>=5&&(i+=y-2),S=l,y=1),h=(h<<1|l)&He,m>=10&&(h===We||h===Ge)&&(i+=40),l===s[m]?c[m]++:(c[m]>=5&&(i+=c[m]-2),s[m]=l,c[m]=1);let R=(u[m]<<1|l)&He;u[m]=R,g&&(R===We||R===Ge)&&(i+=40);let L=o[m];d>0&&m>0&&l===b&&l===L&&l===p&&(i+=3),o[m]=l,p=L,b=l,C++,C===6&&(C=0)}y>=5&&(i+=y-2)}for(let d=0;d<r;d++)c[d]>=5&&(i+=c[d]-2);return i+=Ht(f,r*r),i}function jt(t,e,r){let n={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},a=0,o=1/0;for(let s=0;s<8;s++){let c=Xt(t,e,r,s*72,n);c<o&&(o=c,a=s)}return a}function Xe(t,e,r){let n=jt(t,e,r),a=n*72;for(let o=0;o<r;o++){let s=a+o%12*6,c=o*r,u=0;for(let i=0;i<r;i++)e[c+i]||(t[c+i]^=Ve[s+u]),u++,u===6&&(u=0)}return n}function Yt(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,n=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,a=[6];for(let o=1;o<e;o++)a.push(r-(e-1-o)*n);return a}var Kt=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Jt=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function $e(t,e,r,n,a){for(let o=-1;o<=7;o++)for(let s=-1;s<=7;s++){let c=n+o,u=a+s;if(c<0||u<0||c>=r||u>=r)continue;let i=c*r+u;e[i]=1,o===-1||o===7||s===-1||s===7?t[i]=0:o===0||o===6||s===0||s===6||o>=2&&o<=4&&s>=2&&s<=4?t[i]=1:t[i]=0}}function Zt(t,e,r,n,a){for(let o=-2;o<=2;o++)for(let s=-2;s<=2;s++){let c=(n+o)*r+(a+s);e[c]=1,o===-2||o===2||s===-2||s===2||o===0&&s===0?t[c]=1:t[c]=0}}function zt(t,e,r){for(let n=8;n<r-8;n++){let a=n%2===0?1:0,o=6*r+n,s=n*r+6;t[o]=a,t[s]=a,e[o]=1,e[s]=1}}var je=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function er(t,e){for(let[r,n]of je)t[r*e+n]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function tr(t,e,r,n){if(n<7)return;let a=Jt[n-7];for(let o=0;o<18;o++){let s=a>>o&1,c=Math.floor(o/3),u=o%3,i=c*r+(r-11+u),f=(r-11+u)*r+c;t[i]=s,e[i]=1,t[f]=s,e[f]=1}}function rr(t,e,r,n){let a=0,o=n.length*8,s=r-1,c=!0;for(;s>=0;){if(s===6){s--;continue}let u=c?r-1:0,i=c?-1:r,f=c?-1:1;for(let d=u;d!==i;d+=f){let $=d*r;for(let x=0;x<=1;x++){let g=s-x;g<0||e[$+g]||(a<o?(t[$+g]=n[a>>3]>>7-(a&7)&1,a++):t[$+g]=0)}}s-=2,c=!c}}var nr=16,X=new Map;function Ye(t,e="M",r){let n=`${e}|${r??"a"}|${t}`,a=X.get(n);if(a)return X.delete(n),X.set(n,a),a;let o=or(t,e,r);return X.set(n,o),X.size>nr&&X.delete(X.keys().next().value),o}function or(t,e,r){let n=qe(t,e,r),{codewords:a,version:o,ecLevelIndex:s}=n,c=o*4+17,u=new Uint8Array(c*c),i=new Uint8Array(c*c);$e(u,i,c,0,0),$e(u,i,c,0,c-7),$e(u,i,c,c-7,0),zt(u,i,c);let f=(4*o+9)*c+8;u[f]=1,i[f]=1;let d=Yt(o);for(let g of d)for(let C of d)g<=8&&C<=8||g<=8&&C>=c-8||g>=c-8&&C<=8||Zt(u,i,c,g,C);tr(u,i,c,o),er(i,c),rr(u,i,c,a);let $=Xe(u,i,c),x=Kt[s*8+$];return ar(u,x,c),{matrix:u,version:o,size:c}}function ar(t,e,r){for(let n=0;n<15;n++){let[a,o]=je[n];t[a*r+o]=e>>14-n&1}for(let n=0;n<8;n++)t[8*r+r-1-n]=e>>n&1;for(let n=0;n<7;n++)t[(r-7+n)*r+8]=e>>n+8&1;t[(r-8)*r+8]=1}var w=t=>Math.round(t*100)/100,O=t=>Math.round(t*100);function k(t){let e=t<0,r=e?-t:t,n=Math.floor(r/100),a=r-n*100,o;return a===0?o=String(n):a%10===0?o=`${n}.${a/10}`:a<10?o=`${n}.0${a}`:o=`${n}.${a}`,e?`-${o}`:o}function Me(t,e){return t<=7||t>=e-8?7:-1}function Ae(t,e){return t<=7?e-8:e}function ir(t,e,r,n){let a=k(O(r)),o=new Array(e),s=new Array(e+1),c=new Array(e+1);for(let i=0;i<=e;i++){let f=O(i*r);s[i]=k(f),c[i]=k(-f),i<e&&(o[i]=k(O(n+i*r)))}let u=[];for(let i=0;i<e;i++){let f=i*e,d=k(O(n+i*r)),$=Me(i,e)+1,x=Ae(i,e),g=-1;for(let C=$;C<x;C++)if(t[f+C]===1)g===-1&&(g=C);else if(g!==-1){let S=C-g;u.push(`M${o[g]},${d}h${s[S]}v${a}h${c[S]}z`),g=-1}if(g!==-1){let C=x-g;u.push(`M${o[g]},${d}h${s[C]}v${a}h${c[C]}z`)}}return u.join(" ")}function sr(t,e,r,n,a){let o=w(r),s=[];if(a==="circle"){let h=o/2,b=w(h),p=`a${k(O(b))},${k(O(b))} 0 1,0 `,m=`${p}${k(O(b*2))},0${p}${k(O(-b*2))},0z`,M=new Array(e);for(let l=0;l<e;l++){let R=w(w(n+l*r)+h);M[l]=`M${k(O(R-b))},`}for(let l=0;l<e;l++){let R=l*e,L=`${k(O(w(n+l*r)+h))}${m}`,U=Me(l,e)+1,E=Ae(l,e);for(let I=U;I<E;I++)t[R+I]===1&&s.push(M[I]+L)}return s.join(" ")}let c=w(o*.45),u=[k(O(o)),k(O(o-c)),k(O(o-2*c))],i=[k(O(-o)),k(O(-(o-c))),k(O(-(o-2*c)))],f=k(O(c)),d=k(O(-c)),$=`q${f},0 ${f},${f}`,x=`q0,${f} ${d},${f}`,g=`q${d},0 ${d},${d}`,C=`q0,${d} ${f},${d}`,S=new Array(e),y=new Array(e);for(let h=0;h<e;h++){let b=w(n+h*r);S[h]=k(O(b)),y[h]=k(O(b+c))}for(let h=0;h<e;h++){let b=h*e,p=k(O(w(n+h*r))),m=Me(h,e)+1,M=Ae(h,e);for(let l=m;l<M;l++){if(t[b+l]!==1)continue;let R=h>0&&t[b-e+l]===1,L=l<e-1&&t[b+l+1]===1,U=h<e-1&&t[b+e+l]===1,E=l>0&&t[b+l-1]===1,I=!(R||E),A=!(R||L),v=!(U||L),B=!(U||E);s.push(`M${I?y[l]:S[l]},${p}h${u[(I?1:0)+(A?1:0)]}`+(A?$:"")+`v${u[(A?1:0)+(v?1:0)]}`+(v?x:"")+`h${i[(v?1:0)+(B?1:0)]}`+(B?g:"")+`v${i[(B?1:0)+(I?1:0)]}`+(I?C:"")+"z")}}return s.join(" ")}var cr=2,Ke=new WeakMap;function Je(t,e,r,n,a){let o=Ke.get(t);o||(o=new Map,Ke.set(t,o));let s=`${r}|${n}|${a}`,c=o.get(s);if(c!==void 0)return c;let u=a==="square"?ir(t,e,r,n):sr(t,e,r,n,a);return o.size>=cr&&o.clear(),o.set(s,u),u}var lr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ze(t){return t.replace(lr,"")}function ze(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let n=r+e*2,a=w(t/n);if(t>0&&a===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:n,moduleSize:a,marginPx:w(e*a),svgSize:w(a*n)}}function ue(t,e,r){let n=w(r);return`M${w(t)},${w(e)}h${n}v${n}h${-n}z`}function fe(t,e,r,n,a){let o=w(Math.min(a,r/2,n/2)),s=w(r-2*o),c=w(n-2*o);return`M${w(t+o)},${w(e)}h${s}q${o},0 ${o},${o}v${c}q0,${o} ${-o},${o}h${-s}q${-o},0 ${-o},${-o}v${-c}q0,${-o} ${o},${-o}z`}function ur(t,e,r,n){if(n==="circle"){let a=w(r/2),o=w(a*2);return`M${w(t)},${w(e+r/2)}a${a},${a} 0 1,0 ${o},0a${a},${a} 0 1,0 ${-o},0z`}return n==="rounded"?fe(t,e,r,r,r*.3):ue(t,e,r)}function fr(t,e,r,n){let a=r/7,o=r-2*a,s=a;if(n==="square"){let i=ue(t,e,r),f=ue(t+s,e+s,o);return`${i} ${f}`}if(n==="rounded"){let i=fe(t,e,r,r,r*.15),f=ue(t+s,e+s,o);return`${i} ${f}`}if(n==="circle"){let i=t+r/2,f=w(e+r/2),d=$=>{let x=w($),g=w(x*2);return`M${w(i-x)},${f}a${x},${x} 0 1,0 ${g},0a${x},${x} 0 1,0 ${-g},0z`};return`${d(r/2)} ${d(o/2)}`}let c=fe(t,e,r,r,r*.35),u=fe(t+s,e+s,o,o,o*.2);return`${c} ${u}`}function et(t,e,r,n,a){let o=w(7*r),s=w(3*r),c=w(2*r);return{square:fr(t,e,o,n),dot:ur(w(t+c),w(e+c),s,a)}}function Se(t,e,r){return r+t*e}function tt(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([a,o])=>({x:Se(o,e,r),y:Se(a,e,r)}))}var j={L:.0225,M:.04,Q:.0625,H:.09},dr=j.H,mr=.4;function Re(t){return t<=j.L?"L":t<=j.M?"M":t<=j.Q?"Q":"H"}var br=/[\u0000-\u0020]/g;function de(t){let e=t.replace(br,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function nt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function ot(t,e,r){let a=(t?e!==void 0?Math.max(0,Math.min(1,e)):mr:0)*dr;return r?{ecLevel:r,absoluteArea:Math.min(a,j[r]),targetArea:a,clamped:a>j[r]}:a>0?{ecLevel:Re(a),absoluteArea:a,targetArea:a,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:a,clamped:!1}}function rt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var gr={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function at({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:n,moduleSize:a,marginPx:o}){let s=n*a,c=t*s*s,u=Math.sqrt(c*e),i=Math.sqrt(c/e);if(!(u>0)||!(i>0))return gr;let f=u/a,d=i/a,$=j[r]*n*n,x=Math.max(1,n-16),g=Math.min(rt(f),x),C=1;for(;;){let l=Math.min(1,g/f);if(C=Math.min(rt(d*l),x),g*C<=$||g<=1)break;g-=2}let S=Math.min(1,g/f,C/d),y=u*S,h=i*S,b=g*a,p=C*a,m=o+(n-g)/2*a,M=o+(n-C)/2*a;return{clearX:m,clearY:M,clearWidth:b,clearHeight:p,boxX:m+(b-y)/2,boxY:M+(p-h)/2,boxWidth:y,boxHeight:h}}function ve(t,e){let r=t?.square?.style??"square",n=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??n,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function it(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function J(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",backgroundColor:s="#ffffff",corner:c,logo:u,qr:i}=t,f=u?.src&&de(u.src)?u.src:void 0,d=!!(f||u?.custom),$=i?.errorCorrectionLevel,{ecLevel:x,absoluteArea:g,targetArea:C,clamped:S}=ot(d,u?.size,$),y=[];S&&y.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${Re(C)}"; ECL "${$}" set, logo clamped.`);let{matrix:h,size:b}=Ye(e,x,i?.version),{moduleSize:p,marginPx:m,svgSize:M}=ze(r,n,b),l=ve(c,o),R=Je(h,b,p,m,a),L=tt(b,p,m).map(F=>{let{square:P,dot:G}=et(w(F.x),w(F.y),p,l.squareStyle,l.dotStyle);return{...l.backgroundColor===void 0?{}:{background:{x:w(F.x),y:w(F.y),width:w(7*p),height:w(7*p),fill:l.backgroundColor}},square:{d:P,fill:l.squareColor,fillRule:"evenodd"},dot:{d:G,fill:l.dotColor}}}),U=(u?.margin??0)*p,E=at({absoluteArea:g,aspectRatio:nt(u?.aspectRatio),ecLevel:x,qrSize:b,moduleSize:p,marginPx:m}),I=w(E.boxX+U),A=w(E.boxY+U),v=w(Math.max(0,E.boxWidth-U*2)),B=w(Math.max(0,E.boxHeight-U*2)),N=d&&v>0&&B>0;return d&&E.boxWidth>0&&E.boxHeight>0&&(v<=0||B<=0)&&y.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:w(r),viewBox:M,ecLevel:x,background:s==="transparent"?void 0:s,modules:R?{d:R,fill:o}:void 0,finders:L,clear:N&&(u?.hideDots??!0)?{x:w(E.clearX),y:w(E.clearY),width:w(E.clearWidth),height:w(E.clearHeight),radius:w(it(u?.radius)*Math.min(E.clearWidth,E.clearHeight)/2)}:void 0,logo:N?{src:f,x:I,y:A,width:v,height:B,radius:w(it(u?.radius)*Math.min(v,B)/2)}:void 0,warnings:y}}function ne(t,e){return`${t}${e}`}function hr(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Ee(t){let e=hr(t)*Math.PI/180,r=Math.cos(e)/2,n=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-n)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+n)*100)}%`}}function oe(t,e){let{x1:r,y1:n,x2:a,y2:o}=Ee(e);return`<linearGradient id="${t}" x1="${r}" y1="${n}" x2="${a}" y2="${o}"><stop offset="0%" stop-color="${st(e.startColor)}"/><stop offset="100%" stop-color="${st(e.endColor)}"/></linearGradient>`}function st(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function pr(t){let e=2166136261,r=16777619;for(let n=0;n<t.length;n++){let a=t.charCodeAt(n);e=Math.imul(e^a,16777619),r=Math.imul(r^a,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function W(t){return Ze(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var ct=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),yr=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of yr)ct.add(t);function xr(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function wr(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let a=typeof r=="number"&&r!==0&&!ct.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${xr(e)}:${a}`}).join(";")}function me(t){let{value:e,size:r=256,margin:n=4,dotStyle:a="square",dotColor:o="#000000",dotGradient:s,backgroundColor:c="#ffffff",backgroundGradient:u,corner:i,logo:f,qr:d,className:$,style:x,ariaLabel:g,idPrefix:C}=t,S=J(t),y=ve(i,o),h=f?.src&&de(f.src)?f.src:void 0,b=(C??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",p=[e,r,n,a,o,JSON.stringify(s??null),c,JSON.stringify(u??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,i?.backgroundColor??"",JSON.stringify(i?.square?.gradient??null),JSON.stringify(i?.dot?.gradient??null),S.ecLevel,d?.version??"",h??"",f?.size??"",f?.aspectRatio??"",f?.margin??"",f?.hideDots??"",$??"",g??"",C??""];f?.radius!==void 0&&p.push(f.radius),f?.custom&&p.push("custom");let m=`${b}${pr(p.join("\0"))}`,M=`${m}t`,l=`${m}m`,R=`${m}c`,L=ne(m,"d"),U=ne(m,"b"),E=ne(m,"s"),I=ne(m,"p"),{size:A,viewBox:v,background:B,modules:N,finders:F}=S,{clear:P,logo:G}=S,Q=`<svg role="img" aria-labelledby="${M}" width="${A}" height="${A}" viewBox="0 0 ${v} ${v}" xmlns="http://www.w3.org/2000/svg"`;$&&(Q+=` class="${W($)}"`),x&&(Q+=` style="${W(wr(x))}"`),Q+=">",Q+=`<title id="${M}">${W(g??`QR code: ${e}`)}</title>`;let ae=[s&&oe(L,s),u&&oe(U,u),i?.square?.gradient&&oe(E,i.square.gradient),i?.dot?.gradient&&oe(I,i.dot.gradient)].filter(Boolean);ae.length&&(Q+=`<defs>${ae.join("")}</defs>`),B!==void 0&&(Q+=`<rect width="${v}" height="${v}" fill="${u?`url(#${U})`:W(B)}"/>`),P&&(Q+=`<defs><mask id="${l}"><rect width="${v}" height="${v}" fill="white"/><rect x="${P.x}" y="${P.y}" width="${P.width}" height="${P.height}" rx="${P.radius}" ry="${P.radius}" fill="black"/></mask></defs>`),Q+=`<g${P?` mask="url(#${l})"`:""}>`,N&&(Q+=`<path d="${N.d}" fill="${s?`url(#${L})`:W(N.fill)}"/>`);for(let{background:_,square:H,dot:V}of F)Q+="<g>"+(_?`<rect x="${_.x}" y="${_.y}" width="${_.width}" height="${_.height}" fill="${W(_.fill)}"/>`:"")+`<path d="${H.d}" fill="${i?.square?.gradient?`url(#${E})`:W(H.fill)}" fill-rule="evenodd"/><path d="${V.d}" fill="${i?.dot?.gradient?`url(#${I})`:W(V.fill)}"/></g>`;if(Q+="</g>",G?.src){let{x:_,y:H,width:V,height:ie,radius:T}=G;T>0&&(Q+=`<defs><clipPath id="${R}"><rect x="${_}" y="${H}" width="${V}" height="${ie}" rx="${T}" ry="${T}"/></clipPath></defs>`),Q+=`<image href="${W(G.src)}" x="${_}" y="${H}" width="${V}" height="${ie}"${T>0?` clip-path="url(#${R})"`:""}/>`}return Q+="</svg>",Q}function lt(t,e,r,n){if(n){let a=Ee(n),o=Number.parseFloat(a.x1)/100*e,s=Number.parseFloat(a.y1)/100*e,c=Number.parseFloat(a.x2)/100*e,u=Number.parseFloat(a.y2)/100*e,i=t.createLinearGradient(o,s,c,u);i.addColorStop(0,n.startColor),i.addColorStop(1,n.endColor),t.fillStyle=i,t.fillRect(0,0,e,e)}else r!=="transparent"&&(t.fillStyle=r,t.fillRect(0,0,e,e))}function ut(t=0){if(!Number.isFinite(t)||t<0||t>1)throw new RangeError("imageDotSize must be between 0 and 1.");return t}function ft(t,e){return t===void 0?e??"threshold":t?"color":"threshold"}function dt(t,e,r){let{width:n,height:a,matrixSize:o,margin:s,filter:c,backgroundColor:u,backgroundAlpha:i}=r,f=r.gapColor,d=new Uint8ClampedArray(t),$=n/(o+s*2),x=Math.max(r.coreSize??.4,r.minCoreSize??0),g=(1-x)/2,C=(b,p)=>{if(!r.dotStyle||r.dotStyle==="square")return!0;if(r.dotStyle==="circle")return(b-.5)**2+(p-.5)**2<=x**2/4;let m=x*.28,M=Math.max(Math.abs(b-.5)-(x/2-m),0),l=Math.max(Math.abs(p-.5)-(x/2-m),0);return M**2+l**2<=m**2},S=(b,p)=>{let m=r.clear;if(!m||b<m.x||p<m.y||b>=m.x+m.width||p>=m.y+m.height)return!1;let M=Math.min(m.radius??0,m.width/2,m.height/2),l=Math.max(m.x+M,Math.min(b,m.x+m.width-M)),R=Math.max(m.y+M,Math.min(p,m.y+m.height-M));return(b-l)**2+(p-R)**2<=M**2},y=(b,p)=>b<8&&p<8||b>=o-8&&p<8||b<8&&p>=o-8,h=(b,p=t)=>{let m=p[b+3]/255,M=e[b+3]/255,l=m+M*(1-m),R=(L,U)=>l===0?0:(L*m+U*M*(1-m))/l;d[b]=R(p[b],e[b]),d[b+1]=R(p[b+1],e[b+1]),d[b+2]=R(p[b+2],e[b+2]),d[b+3]=l*255};for(let b=0;b<a;b+=1)for(let p=0;p<n;p+=1){let m=p/$-s,M=b/$-s,l=(b*n+p)*4;if(m<0||M<0||m>=o||M>=o){d[l]=e[l],d[l+1]=e[l+1],d[l+2]=e[l+2],d[l+3]=e[l+3];continue}let R=Math.floor(m),L=Math.floor(M);if(S(m,M)){d[l]=u[0],d[l+1]=u[1],d[l+2]=u[2],d[l+3]=i;continue}if(y(R,L)){h(l,r.transparentFinderBackground&&r.finderPixels?r.finderPixels:t);continue}let U=m-R,E=M-L;if(U>=g&&U<1-g&&E>=g&&E<1-g&&C(U,E)){h(l);continue}if(f){let v=f[3]/255,B=e[l+3]/255,N=v+B*(1-v),F=(P,G)=>N===0?0:(P*v+G*B*(1-v))/N;d[l]=F(f[0],e[l]),d[l+1]=F(f[1],e[l+1]),d[l+2]=F(f[2],e[l+2]),d[l+3]=N*255;continue}let A=l;if(c==="color")d[l]=e[A],d[l+1]=e[A+1],d[l+2]=e[A+2];else{let v=e[A]*.2126+e[A+1]*.7152+e[A+2]*.0722;d[l]=v,d[l+1]=v,d[l+2]=v}d[l+3]=e[A+3]}return d}function mt(t){return!/^\s*(?:javascript|vbscript):/i.test(t)&&!/^data:(?!image\/)/i.test(t)}function Le(t){return new Promise((e,r)=>{let n=new Image;n.crossOrigin="anonymous",n.onload=()=>e(n),n.onerror=()=>r(new Error("An image could not be loaded for the QR code.")),n.src=t})}function Cr(t){let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d");if(!r)throw new Error("Canvas 2D context is unavailable.");r.fillStyle=t,r.fillRect(0,0,1,1);let n=r.getImageData(0,0,1,1).data;return[n[0],n[1],n[2],n[3]]}function $r(t,e,r,n,a,o,s){let c=s==="fill"?Math.max(a/e.naturalWidth,o/e.naturalHeight):Math.min(a/e.naturalWidth,o/e.naturalHeight),u=e.naturalWidth*c,i=e.naturalHeight*c;t.drawImage(e,r+(a-u)/2,n+(o-i)/2,u,i)}function Mr(t,e){let r=me({...e,ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),n=new DOMParser().parseFromString(r,"image/svg+xml");t.replaceChildren(document.importNode(n.documentElement,!0))}async function Ar(t,e,r){let{imagePath:n,imageDotSize:a,imageDotStyle:o,imageColor:s,filter:c,fillType:u="scale_to_fit",logo:i,...f}=e;if(!n||!mt(n))throw new Error("The image URL uses an unsupported scheme.");if(i?.src&&!mt(i.src))throw new Error("The center image URL uses an unsupported scheme.");if(u!=="scale_to_fit"&&u!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let d=Le(n),$=i?.src?Le(i.src):Promise.resolve(void 0),[x,g]=await Promise.all([d,$]);if(r())return;let C=i?{...i,src:void 0,custom:!0,aspectRatio:i.aspectRatio??(g?g.naturalWidth/g.naturalHeight:1)}:void 0,S={...f,dotStyle:o??f.dotStyle,backgroundColor:f.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...f.qr},logo:C},y=J(S),h=J({...S,corner:{square:{style:"square"},dot:{style:"square"}}}),b=h.finders[0].square.d,m=Number(b.match(/h([\d.]+)v/)?.[1])/7,M=Number(b.match(/^M([\d.]+),/)?.[1])/m,l=Math.round(h.viewBox/m-M*2),R=l+M*2;if(!Number.isFinite(m)||!Number.isFinite(M)||l<21)throw new Error("Unable to determine QR module dimensions.");let L=me({...S,dotColor:S.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),U=URL.createObjectURL(new Blob([L],{type:"image/svg+xml"}));try{let E=await Le(U);if(r())return;let I=S.size??256,A=Math.max(Math.ceil(R*8),Math.ceil(I*2)),v=document.createElement("canvas");v.width=A,v.height=A;let B=v.getContext("2d",{willReadFrequently:!0}),N=document.createElement("canvas");N.width=A,N.height=A;let F=N.getContext("2d",{willReadFrequently:!0});if(!B||!F)throw new Error("Canvas 2D context is unavailable.");B.drawImage(E,0,0,A,A);let P=e.backgroundColor??"#ffffff",Q=Cr(P==="transparent"?"#ffffff":P),ae=[Q[0],Q[1],Q[2]];lt(F,A,P,S.backgroundGradient);let _=A/R,H=M*_,V=l*_;$r(F,x,H,H,V,V,u);let ie=dt(B.getImageData(0,0,A,A).data,F.getImageData(0,0,A,A).data,{width:A,height:A,matrixSize:l,margin:M,minCoreSize:Math.min(1,R/Math.max(1,Math.round(I))),coreSize:ut(a),dotStyle:o??f.dotStyle,clear:y.clear?{x:y.clear.x/m-M,y:y.clear.y/m-M,width:y.clear.width/m,height:y.clear.height/m,radius:y.clear.radius/m}:void 0,filter:ft(s,c),backgroundColor:ae,backgroundAlpha:P==="transparent"?0:Q[3]}),T=document.createElement("canvas");T.width=Math.round(I),T.height=Math.round(I),T.setAttribute("role","img"),T.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),T.style.width=`${I}px`,T.style.height=`${I}px`;let Ie=T.getContext("2d"),se=document.createElement("canvas");se.width=A,se.height=A;let D=se.getContext("2d");if(!Ie||!D)throw new Error("Canvas 2D context is unavailable.");let ke=D.createImageData(A,A);if(ke.data.set(ie),D.putImageData(ke,0,0),g&&y.logo){let Z=A/y.viewBox,be=y.logo.x*Z,ge=y.logo.y*Z,he=y.logo.width*Z,pe=y.logo.height*Z;y.logo.radius>0?(D.save(),D.beginPath(),D.roundRect(be,ge,he,pe,y.logo.radius*Z),D.clip(),D.drawImage(g,be,ge,he,pe),D.restore()):D.drawImage(g,be,ge,he,pe)}Ie.drawImage(se,0,0,T.width,T.height),r()||t.replaceChildren(T)}finally{URL.revokeObjectURL(U)}}function bt(t,e){let r=!1;return e.imagePath?Ar(t,e,()=>r).catch(n=>{r||(e.onImageError?e.onImageError(n):console.error("quter: unable to render the image-based QR code.",n))}):Mr(t,e),()=>{r=!0,t.replaceChildren()}}function Sr(t,e){return bt(t.nativeElement,e)}0&&(module.exports={renderAngularQuter});
|
package/dist/angular.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-YNTX4ZO3.mjs";import"./chunk-OBIGPYJW.mjs";import"./chunk-BI4MXPFZ.mjs";function l(r,t){return e(r.nativeElement,t)}export{l as renderAngularQuter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var jt=Object.defineProperty;var Kt=(t,e,n)=>e in t?jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var st=(t,e,n)=>Kt(t,typeof e!="symbol"?e+"":e,n);function Jt(){let t=new Uint8Array(512),e=1;for(let n=0;n<256;n++)t[n]=e,e<<=1,e&256&&(e^=285);for(let n=256;n<512;n++)t[n]=t[n-255];return t}function Zt(t){let e=new Uint8Array(256);for(let n=0;n<256;n++)e[t[n]]=n;return e}var nt=Jt(),j=Zt(nt);function zt(t,e){return t===0||e===0?0:nt[j[t]+j[e]]}function te(t,e){return nt[j[t]*e%255]}function ee(t){let e=[1];for(let n=0;n<t;n++){let o=[1,te(2,n)],i=new Array(e.length+o.length-1).fill(0);for(let r=0;r<e.length;r++)for(let s=0;s<o.length;s++)i[r+s]^=zt(e[r],o[s]);e=i}return Uint8Array.from(e)}var xt=new Map;function ne(t){let e=xt.get(t);return e||(e=ee(t),xt.set(t,e)),e}function re(t,e){let n=ne(e),o=n.length,i=t.length,r=new Uint8Array(i+e);r.set(t);for(let s=0;s<i;s++){let a=r[s];if(a!==0){let u=j[a];for(let c=0;c<o;c++)r[s+c]^=nt[j[n[c]]+u]}}return r.slice(i)}var oe=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],ie=[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],$t=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function K(t,e){return $t[(t-1)*4+e]}function At(t,e,n){let o=(e-1)*4+n,i=oe[o],r=ie[o],s=$t[o],a=Math.floor(s/r),u=r-s%r,c=t instanceof Uint8Array?t:Uint8Array.from(t),l=new Array(r),f=new Array(r),A=new Array(r),g=0,b=0;for(let y=0;y<r;y++){let d=y<u?a:a+1;l[y]=g,f[y]=d,d>b&&(b=d),A[y]=re(c.subarray(g,g+d),i),g+=d}let x=new Uint8Array(c.length+r*i),w=0;for(let y=0;y<b;y++)for(let d=0;d<r;d++)y<f[d]&&(x[w++]=c[l[d]+y]);for(let y=0;y<i;y++)for(let d=0;d<r;d++)x[w++]=A[d][y];return x}var Mt={numeric:1,alphanumeric:2,byte:4};function se(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=n;return e}var H=se();function ce(t){return t<128?H[t]:-1}function T(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var wt=[[1,9],[10,26],[27,40]],ae=[0,4,7];function le(t,e){return t==="numeric"?10*Math.floor(e/3)+ae[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function at(t,e){let n=0;for(let o of t)n+=4+T(o.mode,e)+le(o.mode,o.charCount);return Math.ceil(n/8)}function ct(t,e,n,o){return{mode:e,start:0,end:t.length,charCount:n,byteStart:0,byteEnd:o}}var q=0,J=1,Z=2,ue=["numeric","alphanumeric","byte"];function fe(t){return t<128?1:t<2048?2:t<65536?3:4}var St=20,Rt=33,Ct=48;function de(t){let e=0,n=0,o=0,i=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?(n++,s>=48&&s<=57?(o++,i++):H[s]>=0&&i++):s<2048?n+=2:s>=55296&&s<=56319&&(t.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3,e++}return{count:e,totalBytes:n,digits:o,alnums:i}}function me(t,e){let n=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),r=0;for(let s=0;s<t.length;){let a=t.codePointAt(s);n[r]=s,o[r]=fe(a),a>=48&&a<=57?i[r]=2:ce(a)>=0&&(i[r]=1),r++,s+=a>65535?2:1}return{cpIndex:n,cpBytes:o,cpClass:i}}function Et(t){let{count:e,totalBytes:n,digits:o,alnums:i}=de(t),r=o*St+(i-o)*Rt+(n-i)*Ct,s=c=>{let l=4+Math.min(T("numeric",c),T("alphanumeric",c),T("byte",c));return Math.ceil((r/6+l)/8)},a;if(o===e?a=ct(t,"numeric",e,n):i===e&&o===0?a=ct(t,"alphanumeric",e,n):i===0&&(a=ct(t,"byte",n,n)),a){let c=[a];return{forVersion:()=>c,minDataBytes:s}}let u;return{forVersion(c){return u??(u=me(t,e)),be(t,c,e,u)},minDataBytes:s}}function be(t,e,n,{cpIndex:o,cpBytes:i,cpClass:r}){let s=(4+T("numeric",e))*6,a=(4+T("alphanumeric",e))*6,u=(4+T("byte",e))*6,c=[s,a,u],l=new Int8Array(n*3).fill(-1),f=new Float64Array(3),A=new Float64Array([s,a,u]);for(let h=0;h<n;h++){let M=h*3,$=r[h];f[q]=1/0,f[J]=1/0,f[Z]=A[Z]+i[h]*Ct,l[M+Z]=Z,$!==0&&(f[J]=A[J]+Rt,l[M+J]=J),$===2&&(f[q]=A[q]+St,l[M+q]=q);for(let m=0;m<3;m++)for(let S=0;S<3;S++){if(l[M+S]===-1)continue;let v=Math.ceil(f[S]/6)*6+c[m];(l[M+m]===-1||v<f[m])&&(f[m]=v,l[M+m]=S)}let L=A;A=f,f=L}let g=q;for(let h=1;h<3;h++)A[h]<A[g]&&(g=h);let b=new Int8Array(n),x=g;for(let h=n-1;h>=0;h--)x=l[h*3+x],b[h]=x;let w=[],y=0,d=0;for(;d<n;){let h=b[d],M=d,$=0;for(;M<n&&b[M]===h;)$+=i[M],M++;w.push({mode:ue[h],start:o[d],end:M<n?o[M]:t.length,charCount:h===Z?$:M-d,byteStart:y,byteEnd:y+$}),y+=$,d=M}return w}var ge={L:0,M:1,Q:2,H:3},Lt;function pe(){return Lt??(Lt=new TextEncoder)}var lt=class{constructor(e){st(this,"bytes");st(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,n){let o=this.bitPos;for(let i=n-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},he=[236,17];function ye(t,e,n,o,i){let r=new lt(o);for(let c of e)if(r.writeBits(Mt[c.mode],4),r.writeBits(c.charCount,T(c.mode,n)),c.mode==="numeric")for(let l=c.start;l<c.end;l+=3){let f=Math.min(3,c.end-l),A=t.charCodeAt(l)-48;f>=2&&(A=A*10+(t.charCodeAt(l+1)-48)),f>=3&&(A=A*10+(t.charCodeAt(l+2)-48)),r.writeBits(A,f===3?10:f===2?7:4)}else if(c.mode==="alphanumeric")for(let l=c.start;l<c.end;l+=2)if(l+1<c.end){let f=H[t.charCodeAt(l)]*45+H[t.charCodeAt(l+1)];r.writeBits(f,11)}else r.writeBits(H[t.charCodeAt(l)],6);else for(let l=c.byteStart;l<c.byteEnd;l++)r.writeBits(i[l],8);let s=o*8;if(r.bitLength>s)throw new RangeError(`encoded data (${r.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);r.skipBits(Math.min(4,s-r.bitLength)),r.alignToByte();let a=r.bytes,u=0;for(let c=r.bitLength>>3;c<o;c++)a[c]=he[u%2],u++;return a}function vt(t,e="M",n){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=ge[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=Et(t),r=g=>i.forVersion(g),s,a;if(n!==void 0){if(!Number.isInteger(n)||n<1||n>40)throw new RangeError(`version must be an integer between 1 and 40, got ${n}`);s=n,a=r(s);let g=K(s,o),b=at(a,s);if(b>g)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${b} bytes, capacity ${g})`)}else{let g;for(let[b,x]of wt){if(i.minDataBytes(b)>K(x,o))continue;let w=r(b),y=at(w,b);for(let d=b;d<=x;d++)if(y<=K(d,o)){g={version:d,segments:w};break}if(g)break}if(!g)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=g.version,a=g.segments}let c=a.some(g=>g.mode==="byte")?pe().encode(t):null,l=K(s,o),f=ye(t,a,s,l,c);return{codewords:At(f,s,o),version:s,ecLevelIndex:o,segments:a}}var xe=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function $e(t,e){let n=t/e*100,o=Math.floor(Math.abs(n-50)/5)*10,i=Math.ceil(Math.abs(n-50)/5)*10;return Math.min(o,i)}function Ae(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let n=xe[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=n(o,i)?1:0}return t}var Pt=Ae(),It=1488,kt=93,Ut=2047;function Me(t,e,n,o,i){let{prevRow:r,colRunVal:s,colRunLen:a,colWin:u}=i;s.fill(-1),a.fill(0),u.fill(0);let c=0,l=0;for(let f=0;f<n;f++){let A=o+f%12*6,g=f*n,b=f>=10,x=0,w=-1,y=0,d=0,h=-1,M=-1;for(let $=0;$<n;$++){let L=g+$,m=t[L]^Pt[A+x]&(e[L]^1);l+=m,m===w?y++:(y>=5&&(c+=y-2),w=m,y=1),d=(d<<1|m)&Ut,$>=10&&(d===It||d===kt)&&(c+=40),m===s[$]?a[$]++:(a[$]>=5&&(c+=a[$]-2),s[$]=m,a[$]=1);let S=(u[$]<<1|m)&Ut;u[$]=S,b&&(S===It||S===kt)&&(c+=40);let v=r[$];f>0&&$>0&&m===h&&m===v&&m===M&&(c+=3),r[$]=m,M=v,h=m,x++,x===6&&(x=0)}y>=5&&(c+=y-2)}for(let f=0;f<n;f++)a[f]>=5&&(c+=a[f]-2);return c+=$e(l,n*n),c}function we(t,e,n){let o={prevRow:new Uint8Array(n),colRunVal:new Int8Array(n),colRunLen:new Uint16Array(n),colWin:new Uint16Array(n)},i=0,r=1/0;for(let s=0;s<8;s++){let a=Me(t,e,n,s*72,o);a<r&&(r=a,i=s)}return i}function Ot(t,e,n){let o=we(t,e,n),i=o*72;for(let r=0;r<n;r++){let s=i+r%12*6,a=r*n,u=0;for(let c=0;c<n;c++)e[a+c]||(t[a+c]^=Pt[s+u]),u++,u===6&&(u=0)}return o}function Se(t){if(t===1)return[];let e=(t/7|0)+2,n=t*4+10,o=t===32?26:Math.ceil((n-6)/(e-1)/2)*2,i=[6];for(let r=1;r<e;r++)i.push(n-(e-1-r)*o);return i}var Re=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Ce=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function ut(t,e,n,o,i){for(let r=-1;r<=7;r++)for(let s=-1;s<=7;s++){let a=o+r,u=i+s;if(a<0||u<0||a>=n||u>=n)continue;let c=a*n+u;e[c]=1,r===-1||r===7||s===-1||s===7?t[c]=0:r===0||r===6||s===0||s===6||r>=2&&r<=4&&s>=2&&s<=4?t[c]=1:t[c]=0}}function Ee(t,e,n,o,i){for(let r=-2;r<=2;r++)for(let s=-2;s<=2;s++){let a=(o+r)*n+(i+s);e[a]=1,r===-2||r===2||s===-2||s===2||r===0&&s===0?t[a]=1:t[a]=0}}function Le(t,e,n){for(let o=8;o<n-8;o++){let i=o%2===0?1:0,r=6*n+o,s=o*n+6;t[r]=i,t[s]=i,e[r]=1,e[s]=1}}var Bt=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function ve(t,e){for(let[n,o]of Bt)t[n*e+o]=1;for(let n=0;n<8;n++)t[8*e+e-1-n]=1;for(let n=0;n<7;n++)t[(e-7+n)*e+8]=1}function Ie(t,e,n,o){if(o<7)return;let i=Ce[o-7];for(let r=0;r<18;r++){let s=i>>r&1,a=Math.floor(r/3),u=r%3,c=a*n+(n-11+u),l=(n-11+u)*n+a;t[c]=s,e[c]=1,t[l]=s,e[l]=1}}function ke(t,e,n,o){let i=0,r=o.length*8,s=n-1,a=!0;for(;s>=0;){if(s===6){s--;continue}let u=a?n-1:0,c=a?-1:n,l=a?-1:1;for(let f=u;f!==c;f+=l){let A=f*n;for(let g=0;g<=1;g++){let b=s-g;b<0||e[A+b]||(i<r?(t[A+b]=o[i>>3]>>7-(i&7)&1,i++):t[A+b]=0)}}s-=2,a=!a}}var Ue=16,D=new Map;function Tt(t,e="M",n){let o=`${e}|${n??"a"}|${t}`,i=D.get(o);if(i)return D.delete(o),D.set(o,i),i;let r=Pe(t,e,n);return D.set(o,r),D.size>Ue&&D.delete(D.keys().next().value),r}function Pe(t,e,n){let o=vt(t,e,n),{codewords:i,version:r,ecLevelIndex:s}=o,a=r*4+17,u=new Uint8Array(a*a),c=new Uint8Array(a*a);ut(u,c,a,0,0),ut(u,c,a,0,a-7),ut(u,c,a,a-7,0),Le(u,c,a);let l=(4*r+9)*a+8;u[l]=1,c[l]=1;let f=Se(r);for(let b of f)for(let x of f)b<=8&&x<=8||b<=8&&x>=a-8||b>=a-8&&x<=8||Ee(u,c,a,b,x);Ie(u,c,a,r),ve(c,a),ke(u,c,a,i);let A=Ot(u,c,a),g=Re[s*8+A];return Oe(u,g,a),{matrix:u,version:r,size:a}}function Oe(t,e,n){for(let o=0;o<15;o++){let[i,r]=Bt[o];t[i*n+r]=e>>14-o&1}for(let o=0;o<8;o++)t[8*n+n-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(n-7+o)*n+8]=e>>o+8&1;t[(n-8)*n+8]=1}var p=t=>Math.round(t*100)/100,C=t=>Math.round(t*100);function R(t){let e=t<0,n=e?-t:t,o=Math.floor(n/100),i=n-o*100,r;return i===0?r=String(o):i%10===0?r=`${o}.${i/10}`:i<10?r=`${o}.0${i}`:r=`${o}.${i}`,e?`-${r}`:r}function ft(t,e){return t<=7||t>=e-8?7:-1}function dt(t,e){return t<=7?e-8:e}function Be(t,e,n,o){let i=R(C(n)),r=new Array(e),s=new Array(e+1),a=new Array(e+1);for(let c=0;c<=e;c++){let l=C(c*n);s[c]=R(l),a[c]=R(-l),c<e&&(r[c]=R(C(o+c*n)))}let u=[];for(let c=0;c<e;c++){let l=c*e,f=R(C(o+c*n)),A=ft(c,e)+1,g=dt(c,e),b=-1;for(let x=A;x<g;x++)if(t[l+x]===1)b===-1&&(b=x);else if(b!==-1){let w=x-b;u.push(`M${r[b]},${f}h${s[w]}v${i}h${a[w]}z`),b=-1}if(b!==-1){let x=g-b;u.push(`M${r[b]},${f}h${s[x]}v${i}h${a[x]}z`)}}return u.join(" ")}function Te(t,e,n,o,i){let r=p(n),s=[];if(i==="circle"){let d=r/2,h=p(d),M=`a${R(C(h))},${R(C(h))} 0 1,0 `,$=`${M}${R(C(h*2))},0${M}${R(C(-h*2))},0z`,L=new Array(e);for(let m=0;m<e;m++){let S=p(p(o+m*n)+d);L[m]=`M${R(C(S-h))},`}for(let m=0;m<e;m++){let S=m*e,v=`${R(C(p(o+m*n)+d))}${$}`,P=ft(m,e)+1,E=dt(m,e);for(let U=P;U<E;U++)t[S+U]===1&&s.push(L[U]+v)}return s.join(" ")}let a=p(r*.45),u=[R(C(r)),R(C(r-a)),R(C(r-2*a))],c=[R(C(-r)),R(C(-(r-a))),R(C(-(r-2*a)))],l=R(C(a)),f=R(C(-a)),A=`q${l},0 ${l},${l}`,g=`q0,${l} ${f},${l}`,b=`q${f},0 ${f},${f}`,x=`q0,${f} ${l},${f}`,w=new Array(e),y=new Array(e);for(let d=0;d<e;d++){let h=p(o+d*n);w[d]=R(C(h)),y[d]=R(C(h+a))}for(let d=0;d<e;d++){let h=d*e,M=R(C(p(o+d*n))),$=ft(d,e)+1,L=dt(d,e);for(let m=$;m<L;m++){if(t[h+m]!==1)continue;let S=d>0&&t[h-e+m]===1,v=m<e-1&&t[h+m+1]===1,P=d<e-1&&t[h+e+m]===1,E=m>0&&t[h+m-1]===1,U=!(S||E),_=!(S||v),I=!(P||v),O=!(P||E);s.push(`M${U?y[m]:w[m]},${M}h${u[(U?1:0)+(_?1:0)]}`+(_?A:"")+`v${u[(_?1:0)+(I?1:0)]}`+(I?g:"")+`h${c[(I?1:0)+(O?1:0)]}`+(O?b:"")+`v${c[(O?1:0)+(U?1:0)]}`+(U?x:"")+"z")}}return s.join(" ")}var Ne=2,Nt=new WeakMap;function _t(t,e,n,o,i){let r=Nt.get(t);r||(r=new Map,Nt.set(t,r));let s=`${n}|${o}|${i}`,a=r.get(s);if(a!==void 0)return a;let u=i==="square"?Be(t,e,n,o):Te(t,e,n,o,i);return r.size>=Ne&&r.clear(),r.set(s,u),u}var _e=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ft(t){return t.replace(_e,"")}function Dt(t,e,n){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=n+e*2,i=p(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${n}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:p(e*i),svgSize:p(i*o)}}function rt(t,e,n){let o=p(n);return`M${p(t)},${p(e)}h${o}v${o}h${-o}z`}function ot(t,e,n,o,i){let r=p(Math.min(i,n/2,o/2)),s=p(n-2*r),a=p(o-2*r);return`M${p(t+r)},${p(e)}h${s}q${r},0 ${r},${r}v${a}q0,${r} ${-r},${r}h${-s}q${-r},0 ${-r},${-r}v${-a}q0,${-r} ${r},${-r}z`}function Fe(t,e,n,o){if(o==="circle"){let i=p(n/2),r=p(i*2);return`M${p(t)},${p(e+n/2)}a${i},${i} 0 1,0 ${r},0a${i},${i} 0 1,0 ${-r},0z`}return o==="rounded"?ot(t,e,n,n,n*.3):rt(t,e,n)}function De(t,e,n,o){let i=n/7,r=n-2*i,s=i;if(o==="square"){let c=rt(t,e,n),l=rt(t+s,e+s,r);return`${c} ${l}`}if(o==="rounded"){let c=ot(t,e,n,n,n*.15),l=rt(t+s,e+s,r);return`${c} ${l}`}if(o==="circle"){let c=t+n/2,l=p(e+n/2),f=A=>{let g=p(A),b=p(g*2);return`M${p(c-g)},${l}a${g},${g} 0 1,0 ${b},0a${g},${g} 0 1,0 ${-b},0z`};return`${f(n/2)} ${f(r/2)}`}let a=ot(t,e,n,n,n*.35),u=ot(t+s,e+s,r,r,r*.2);return`${a} ${u}`}function Qt(t,e,n,o,i){let r=p(7*n),s=p(3*n),a=p(2*n);return{square:De(t,e,r,o),dot:Fe(p(t+a),p(e+a),s,i)}}function mt(t,e,n){return n+t*e}function Wt(t,e,n){return[[0,0],[0,t-7],[t-7,0]].map(([i,r])=>({x:mt(r,e,n),y:mt(i,e,n)}))}var Q={L:.0225,M:.04,Q:.0625,H:.09},Qe=Q.H,We=.4;function bt(t){return t<=Q.L?"L":t<=Q.M?"M":t<=Q.Q?"Q":"H"}var Ge=/[\u0000-\u0020]/g;function it(t){let e=t.replace(Ge,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function qt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function Ht(t,e,n){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):We:0)*Qe;return n?{ecLevel:n,absoluteArea:Math.min(i,Q[n]),targetArea:i,clamped:i>Q[n]}:i>0?{ecLevel:bt(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function Gt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var qe={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function Vt({absoluteArea:t,aspectRatio:e,ecLevel:n,qrSize:o,moduleSize:i,marginPx:r}){let s=o*i,a=t*s*s,u=Math.sqrt(a*e),c=Math.sqrt(a/e);if(!(u>0)||!(c>0))return qe;let l=u/i,f=c/i,A=Q[n]*o*o,g=Math.max(1,o-16),b=Math.min(Gt(l),g),x=1;for(;;){let m=Math.min(1,b/l);if(x=Math.min(Gt(f*m),g),b*x<=A||b<=1)break;b-=2}let w=Math.min(1,b/l,x/f),y=u*w,d=c*w,h=b*i,M=x*i,$=r+(o-b)/2*i,L=r+(o-x)/2*i;return{clearX:$,clearY:L,clearWidth:h,clearHeight:M,boxX:$+(h-y)/2,boxY:L+(M-d)/2,boxWidth:y,boxHeight:d}}function gt(t,e){let n=t?.square?.style??"square",o=n==="extra-rounded"?"rounded":n==="circle"?"circle":"square";return{squareStyle:n,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function He(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function pt(t){let{value:e,size:n=256,margin:o=4,dotStyle:i="square",dotColor:r="#000000",backgroundColor:s="#ffffff",corner:a,logo:u,qr:c}=t,l=u?.src&&it(u.src)?u.src:void 0,f=!!(l||u?.custom),A=c?.errorCorrectionLevel,{ecLevel:g,absoluteArea:b,targetArea:x,clamped:w}=Ht(f,u?.size,A),y=[];w&&y.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${bt(x)}"; ECL "${A}" set, logo clamped.`);let{matrix:d,size:h}=Tt(e,g,c?.version),{moduleSize:M,marginPx:$,svgSize:L}=Dt(n,o,h),m=gt(a,r),S=_t(d,h,M,$,i),v=Wt(h,M,$).map(G=>{let{square:F,dot:V}=Qt(p(G.x),p(G.y),M,m.squareStyle,m.dotStyle);return{...m.backgroundColor===void 0?{}:{background:{x:p(G.x),y:p(G.y),width:p(7*M),height:p(7*M),fill:m.backgroundColor}},square:{d:F,fill:m.squareColor,fillRule:"evenodd"},dot:{d:V,fill:m.dotColor}}}),P=(u?.margin??0)*M,E=Vt({absoluteArea:b,aspectRatio:qt(u?.aspectRatio),ecLevel:g,qrSize:h,moduleSize:M,marginPx:$}),U=p(E.boxX+P),_=p(E.boxY+P),I=p(Math.max(0,E.boxWidth-P*2)),O=p(Math.max(0,E.boxHeight-P*2)),W=f&&I>0&&O>0;return f&&E.boxWidth>0&&E.boxHeight>0&&(I<=0||O<=0)&&y.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:p(n),viewBox:L,ecLevel:g,background:s==="transparent"?void 0:s,modules:S?{d:S,fill:r}:void 0,finders:v,clear:W&&(u?.hideDots??!0)?{x:p(E.clearX),y:p(E.clearY),width:p(E.clearWidth),height:p(E.clearHeight)}:void 0,logo:W?{src:l,x:U,y:_,width:I,height:O,radius:p(He(u?.radius)*Math.min(I,O)/2)}:void 0,warnings:y}}function z(t,e){return`${t}${e}`}function Ve(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Xe(t){let e=Ve(t)*Math.PI/180,n=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-n)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+n)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function tt(t,e){let{x1:n,y1:o,x2:i,y2:r}=Xe(e);return`<linearGradient id="${t}" x1="${n}" y1="${o}" x2="${i}" y2="${r}"><stop offset="0%" stop-color="${Xt(e.startColor)}"/><stop offset="100%" stop-color="${Xt(e.endColor)}"/></linearGradient>`}function Xt(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ye(t){let e=2166136261,n=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),n=Math.imul(n^i,2246822507)}return(e>>>0).toString(36)+(n>>>0).toString(36)}function N(t){return Ft(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var Yt=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),je=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of je)Yt.add(t);function Ke(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Je(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>{let i=typeof n=="number"&&n!==0&&!Yt.has(e)&&!e.startsWith("--")?`${n}px`:String(n);return`${Ke(e)}:${i}`}).join(";")}function Ze(t){let{value:e,size:n=256,margin:o=4,dotStyle:i="square",dotColor:r="#000000",dotGradient:s,backgroundColor:a="#ffffff",backgroundGradient:u,corner:c,logo:l,qr:f,className:A,style:g,ariaLabel:b,idPrefix:x}=t,w=pt(t),y=gt(c,r),d=l?.src&&it(l.src)?l.src:void 0,h=(x??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",M=[e,n,o,i,r,JSON.stringify(s??null),a,JSON.stringify(u??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,c?.backgroundColor??"",JSON.stringify(c?.square?.gradient??null),JSON.stringify(c?.dot?.gradient??null),w.ecLevel,f?.version??"",d??"",l?.size??"",l?.aspectRatio??"",l?.margin??"",l?.hideDots??"",A??"",b??"",x??""];l?.radius!==void 0&&M.push(l.radius),l?.custom&&M.push("custom");let $=`${h}${Ye(M.join("\0"))}`,L=`${$}t`,m=`${$}m`,S=`${$}c`,v=z($,"d"),P=z($,"b"),E=z($,"s"),U=z($,"p"),{size:_,viewBox:I,background:O,modules:W,finders:G}=w,{clear:F,logo:V}=w,k=`<svg role="img" aria-labelledby="${L}" width="${_}" height="${_}" viewBox="0 0 ${I} ${I}" xmlns="http://www.w3.org/2000/svg"`;A&&(k+=` class="${N(A)}"`),g&&(k+=` style="${N(Je(g))}"`),k+=">",k+=`<title id="${L}">${N(b??`QR code: ${e}`)}</title>`;let ht=[s&&tt(v,s),u&&tt(P,u),c?.square?.gradient&&tt(E,c.square.gradient),c?.dot?.gradient&&tt(U,c.dot.gradient)].filter(Boolean);ht.length&&(k+=`<defs>${ht.join("")}</defs>`),O!==void 0&&(k+=`<rect width="${I}" height="${I}" fill="${u?`url(#${P})`:N(O)}"/>`),F&&(k+=`<defs><mask id="${m}"><rect width="${I}" height="${I}" fill="white"/><rect x="${F.x}" y="${F.y}" width="${F.width}" height="${F.height}" fill="black"/></mask></defs>`),k+=`<g${F?` mask="url(#${m})"`:""}>`,W&&(k+=`<path d="${W.d}" fill="${s?`url(#${v})`:N(W.fill)}"/>`);for(let{background:B,square:X,dot:Y}of G)k+="<g>"+(B?`<rect x="${B.x}" y="${B.y}" width="${B.width}" height="${B.height}" fill="${N(B.fill)}"/>`:"")+`<path d="${X.d}" fill="${c?.square?.gradient?`url(#${E})`:N(X.fill)}" fill-rule="evenodd"/><path d="${Y.d}" fill="${c?.dot?.gradient?`url(#${U})`:N(Y.fill)}"/></g>`;if(k+="</g>",V?.src){let{x:B,y:X,width:Y,height:yt,radius:et}=V;et>0&&(k+=`<defs><clipPath id="${S}"><rect x="${B}" y="${X}" width="${Y}" height="${yt}" rx="${et}" ry="${et}"/></clipPath></defs>`),k+=`<image href="${N(V.src)}" x="${B}" y="${X}" width="${Y}" height="${yt}"${et>0?` clip-path="url(#${S})"`:""}/>`}return k+="</svg>",k}export{pt as a,Xe as b,Ze as c};
|
|
1
|
+
var Kt=Object.defineProperty;var Jt=(t,e,n)=>e in t?Kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var st=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);function Zt(){let t=new Uint8Array(512),e=1;for(let n=0;n<256;n++)t[n]=e,e<<=1,e&256&&(e^=285);for(let n=256;n<512;n++)t[n]=t[n-255];return t}function zt(t){let e=new Uint8Array(256);for(let n=0;n<256;n++)e[t[n]]=n;return e}var nt=Zt(),j=zt(nt);function te(t,e){return t===0||e===0?0:nt[j[t]+j[e]]}function ee(t,e){return nt[j[t]*e%255]}function ne(t){let e=[1];for(let n=0;n<t;n++){let o=[1,ee(2,n)],i=new Array(e.length+o.length-1).fill(0);for(let r=0;r<e.length;r++)for(let s=0;s<o.length;s++)i[r+s]^=te(e[r],o[s]);e=i}return Uint8Array.from(e)}var xt=new Map;function re(t){let e=xt.get(t);return e||(e=ne(t),xt.set(t,e)),e}function oe(t,e){let n=re(e),o=n.length,i=t.length,r=new Uint8Array(i+e);r.set(t);for(let s=0;s<i;s++){let a=r[s];if(a!==0){let u=j[a];for(let c=0;c<o;c++)r[s+c]^=nt[j[n[c]]+u]}}return r.slice(i)}var ie=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],se=[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],$t=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function K(t,e){return $t[(t-1)*4+e]}function At(t,e,n){let o=(e-1)*4+n,i=ie[o],r=se[o],s=$t[o],a=Math.floor(s/r),u=r-s%r,c=t instanceof Uint8Array?t:Uint8Array.from(t),l=new Array(r),f=new Array(r),A=new Array(r),g=0,b=0;for(let y=0;y<r;y++){let d=y<u?a:a+1;l[y]=g,f[y]=d,d>b&&(b=d),A[y]=oe(c.subarray(g,g+d),i),g+=d}let x=new Uint8Array(c.length+r*i),w=0;for(let y=0;y<b;y++)for(let d=0;d<r;d++)y<f[d]&&(x[w++]=c[l[d]+y]);for(let y=0;y<i;y++)for(let d=0;d<r;d++)x[w++]=A[d][y];return x}var Mt={numeric:1,alphanumeric:2,byte:4};function ce(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=n;return e}var H=ce();function ae(t){return t<128?H[t]:-1}function N(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var wt=[[1,9],[10,26],[27,40]],le=[0,4,7];function ue(t,e){return t==="numeric"?10*Math.floor(e/3)+le[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function at(t,e){let n=0;for(let o of t)n+=4+N(o.mode,e)+ue(o.mode,o.charCount);return Math.ceil(n/8)}function ct(t,e,n,o){return{mode:e,start:0,end:t.length,charCount:n,byteStart:0,byteEnd:o}}var q=0,J=1,Z=2,fe=["numeric","alphanumeric","byte"];function de(t){return t<128?1:t<2048?2:t<65536?3:4}var St=20,Rt=33,Ct=48;function me(t){let e=0,n=0,o=0,i=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?(n++,s>=48&&s<=57?(o++,i++):H[s]>=0&&i++):s<2048?n+=2:s>=55296&&s<=56319&&(t.charCodeAt(r+1)&64512)===56320?(n+=4,r++):n+=3,e++}return{count:e,totalBytes:n,digits:o,alnums:i}}function be(t,e){let n=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),r=0;for(let s=0;s<t.length;){let a=t.codePointAt(s);n[r]=s,o[r]=de(a),a>=48&&a<=57?i[r]=2:ae(a)>=0&&(i[r]=1),r++,s+=a>65535?2:1}return{cpIndex:n,cpBytes:o,cpClass:i}}function Et(t){let{count:e,totalBytes:n,digits:o,alnums:i}=me(t),r=o*St+(i-o)*Rt+(n-i)*Ct,s=c=>{let l=4+Math.min(N("numeric",c),N("alphanumeric",c),N("byte",c));return Math.ceil((r/6+l)/8)},a;if(o===e?a=ct(t,"numeric",e,n):i===e&&o===0?a=ct(t,"alphanumeric",e,n):i===0&&(a=ct(t,"byte",n,n)),a){let c=[a];return{forVersion:()=>c,minDataBytes:s}}let u;return{forVersion(c){return u??(u=be(t,e)),ge(t,c,e,u)},minDataBytes:s}}function ge(t,e,n,{cpIndex:o,cpBytes:i,cpClass:r}){let s=(4+N("numeric",e))*6,a=(4+N("alphanumeric",e))*6,u=(4+N("byte",e))*6,c=[s,a,u],l=new Int8Array(n*3).fill(-1),f=new Float64Array(3),A=new Float64Array([s,a,u]);for(let h=0;h<n;h++){let M=h*3,$=r[h];f[q]=1/0,f[J]=1/0,f[Z]=A[Z]+i[h]*Ct,l[M+Z]=Z,$!==0&&(f[J]=A[J]+Rt,l[M+J]=J),$===2&&(f[q]=A[q]+St,l[M+q]=q);for(let m=0;m<3;m++)for(let S=0;S<3;S++){if(l[M+S]===-1)continue;let v=Math.ceil(f[S]/6)*6+c[m];(l[M+m]===-1||v<f[m])&&(f[m]=v,l[M+m]=S)}let L=A;A=f,f=L}let g=q;for(let h=1;h<3;h++)A[h]<A[g]&&(g=h);let b=new Int8Array(n),x=g;for(let h=n-1;h>=0;h--)x=l[h*3+x],b[h]=x;let w=[],y=0,d=0;for(;d<n;){let h=b[d],M=d,$=0;for(;M<n&&b[M]===h;)$+=i[M],M++;w.push({mode:fe[h],start:o[d],end:M<n?o[M]:t.length,charCount:h===Z?$:M-d,byteStart:y,byteEnd:y+$}),y+=$,d=M}return w}var pe={L:0,M:1,Q:2,H:3},Lt;function he(){return Lt??(Lt=new TextEncoder)}var lt=class{constructor(e){st(this,"bytes");st(this,"bitPos",0);this.bytes=new Uint8Array(e)}writeBits(e,n){let o=this.bitPos;for(let i=n-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},ye=[236,17];function xe(t,e,n,o,i){let r=new lt(o);for(let c of e)if(r.writeBits(Mt[c.mode],4),r.writeBits(c.charCount,N(c.mode,n)),c.mode==="numeric")for(let l=c.start;l<c.end;l+=3){let f=Math.min(3,c.end-l),A=t.charCodeAt(l)-48;f>=2&&(A=A*10+(t.charCodeAt(l+1)-48)),f>=3&&(A=A*10+(t.charCodeAt(l+2)-48)),r.writeBits(A,f===3?10:f===2?7:4)}else if(c.mode==="alphanumeric")for(let l=c.start;l<c.end;l+=2)if(l+1<c.end){let f=H[t.charCodeAt(l)]*45+H[t.charCodeAt(l+1)];r.writeBits(f,11)}else r.writeBits(H[t.charCodeAt(l)],6);else for(let l=c.byteStart;l<c.byteEnd;l++)r.writeBits(i[l],8);let s=o*8;if(r.bitLength>s)throw new RangeError(`encoded data (${r.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);r.skipBits(Math.min(4,s-r.bitLength)),r.alignToByte();let a=r.bytes,u=0;for(let c=r.bitLength>>3;c<o;c++)a[c]=ye[u%2],u++;return a}function vt(t,e="M",n){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=pe[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=Et(t),r=g=>i.forVersion(g),s,a;if(n!==void 0){if(!Number.isInteger(n)||n<1||n>40)throw new RangeError(`version must be an integer between 1 and 40, got ${n}`);s=n,a=r(s);let g=K(s,o),b=at(a,s);if(b>g)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${b} bytes, capacity ${g})`)}else{let g;for(let[b,x]of wt){if(i.minDataBytes(b)>K(x,o))continue;let w=r(b),y=at(w,b);for(let d=b;d<=x;d++)if(y<=K(d,o)){g={version:d,segments:w};break}if(g)break}if(!g)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=g.version,a=g.segments}let c=a.some(g=>g.mode==="byte")?he().encode(t):null,l=K(s,o),f=xe(t,a,s,l,c);return{codewords:At(f,s,o),version:s,ecLevelIndex:o,segments:a}}var $e=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function Ae(t,e){let n=t/e*100,o=Math.floor(Math.abs(n-50)/5)*10,i=Math.ceil(Math.abs(n-50)/5)*10;return Math.min(o,i)}function Me(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let n=$e[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=n(o,i)?1:0}return t}var Pt=Me(),It=1488,kt=93,Ut=2047;function we(t,e,n,o,i){let{prevRow:r,colRunVal:s,colRunLen:a,colWin:u}=i;s.fill(-1),a.fill(0),u.fill(0);let c=0,l=0;for(let f=0;f<n;f++){let A=o+f%12*6,g=f*n,b=f>=10,x=0,w=-1,y=0,d=0,h=-1,M=-1;for(let $=0;$<n;$++){let L=g+$,m=t[L]^Pt[A+x]&(e[L]^1);l+=m,m===w?y++:(y>=5&&(c+=y-2),w=m,y=1),d=(d<<1|m)&Ut,$>=10&&(d===It||d===kt)&&(c+=40),m===s[$]?a[$]++:(a[$]>=5&&(c+=a[$]-2),s[$]=m,a[$]=1);let S=(u[$]<<1|m)&Ut;u[$]=S,b&&(S===It||S===kt)&&(c+=40);let v=r[$];f>0&&$>0&&m===h&&m===v&&m===M&&(c+=3),r[$]=m,M=v,h=m,x++,x===6&&(x=0)}y>=5&&(c+=y-2)}for(let f=0;f<n;f++)a[f]>=5&&(c+=a[f]-2);return c+=Ae(l,n*n),c}function Se(t,e,n){let o={prevRow:new Uint8Array(n),colRunVal:new Int8Array(n),colRunLen:new Uint16Array(n),colWin:new Uint16Array(n)},i=0,r=1/0;for(let s=0;s<8;s++){let a=we(t,e,n,s*72,o);a<r&&(r=a,i=s)}return i}function Ot(t,e,n){let o=Se(t,e,n),i=o*72;for(let r=0;r<n;r++){let s=i+r%12*6,a=r*n,u=0;for(let c=0;c<n;c++)e[a+c]||(t[a+c]^=Pt[s+u]),u++,u===6&&(u=0)}return o}function Re(t){if(t===1)return[];let e=(t/7|0)+2,n=t*4+10,o=t===32?26:Math.ceil((n-6)/(e-1)/2)*2,i=[6];for(let r=1;r<e;r++)i.push(n-(e-1-r)*o);return i}var Ce=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Ee=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function ut(t,e,n,o,i){for(let r=-1;r<=7;r++)for(let s=-1;s<=7;s++){let a=o+r,u=i+s;if(a<0||u<0||a>=n||u>=n)continue;let c=a*n+u;e[c]=1,r===-1||r===7||s===-1||s===7?t[c]=0:r===0||r===6||s===0||s===6||r>=2&&r<=4&&s>=2&&s<=4?t[c]=1:t[c]=0}}function Le(t,e,n,o,i){for(let r=-2;r<=2;r++)for(let s=-2;s<=2;s++){let a=(o+r)*n+(i+s);e[a]=1,r===-2||r===2||s===-2||s===2||r===0&&s===0?t[a]=1:t[a]=0}}function ve(t,e,n){for(let o=8;o<n-8;o++){let i=o%2===0?1:0,r=6*n+o,s=o*n+6;t[r]=i,t[s]=i,e[r]=1,e[s]=1}}var Bt=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Ie(t,e){for(let[n,o]of Bt)t[n*e+o]=1;for(let n=0;n<8;n++)t[8*e+e-1-n]=1;for(let n=0;n<7;n++)t[(e-7+n)*e+8]=1}function ke(t,e,n,o){if(o<7)return;let i=Ee[o-7];for(let r=0;r<18;r++){let s=i>>r&1,a=Math.floor(r/3),u=r%3,c=a*n+(n-11+u),l=(n-11+u)*n+a;t[c]=s,e[c]=1,t[l]=s,e[l]=1}}function Ue(t,e,n,o){let i=0,r=o.length*8,s=n-1,a=!0;for(;s>=0;){if(s===6){s--;continue}let u=a?n-1:0,c=a?-1:n,l=a?-1:1;for(let f=u;f!==c;f+=l){let A=f*n;for(let g=0;g<=1;g++){let b=s-g;b<0||e[A+b]||(i<r?(t[A+b]=o[i>>3]>>7-(i&7)&1,i++):t[A+b]=0)}}s-=2,a=!a}}var Pe=16,D=new Map;function Tt(t,e="M",n){let o=`${e}|${n??"a"}|${t}`,i=D.get(o);if(i)return D.delete(o),D.set(o,i),i;let r=Oe(t,e,n);return D.set(o,r),D.size>Pe&&D.delete(D.keys().next().value),r}function Oe(t,e,n){let o=vt(t,e,n),{codewords:i,version:r,ecLevelIndex:s}=o,a=r*4+17,u=new Uint8Array(a*a),c=new Uint8Array(a*a);ut(u,c,a,0,0),ut(u,c,a,0,a-7),ut(u,c,a,a-7,0),ve(u,c,a);let l=(4*r+9)*a+8;u[l]=1,c[l]=1;let f=Re(r);for(let b of f)for(let x of f)b<=8&&x<=8||b<=8&&x>=a-8||b>=a-8&&x<=8||Le(u,c,a,b,x);ke(u,c,a,r),Ie(c,a),Ue(u,c,a,i);let A=Ot(u,c,a),g=Ce[s*8+A];return Be(u,g,a),{matrix:u,version:r,size:a}}function Be(t,e,n){for(let o=0;o<15;o++){let[i,r]=Bt[o];t[i*n+r]=e>>14-o&1}for(let o=0;o<8;o++)t[8*n+n-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(n-7+o)*n+8]=e>>o+8&1;t[(n-8)*n+8]=1}var p=t=>Math.round(t*100)/100,C=t=>Math.round(t*100);function R(t){let e=t<0,n=e?-t:t,o=Math.floor(n/100),i=n-o*100,r;return i===0?r=String(o):i%10===0?r=`${o}.${i/10}`:i<10?r=`${o}.0${i}`:r=`${o}.${i}`,e?`-${r}`:r}function ft(t,e){return t<=7||t>=e-8?7:-1}function dt(t,e){return t<=7?e-8:e}function Te(t,e,n,o){let i=R(C(n)),r=new Array(e),s=new Array(e+1),a=new Array(e+1);for(let c=0;c<=e;c++){let l=C(c*n);s[c]=R(l),a[c]=R(-l),c<e&&(r[c]=R(C(o+c*n)))}let u=[];for(let c=0;c<e;c++){let l=c*e,f=R(C(o+c*n)),A=ft(c,e)+1,g=dt(c,e),b=-1;for(let x=A;x<g;x++)if(t[l+x]===1)b===-1&&(b=x);else if(b!==-1){let w=x-b;u.push(`M${r[b]},${f}h${s[w]}v${i}h${a[w]}z`),b=-1}if(b!==-1){let x=g-b;u.push(`M${r[b]},${f}h${s[x]}v${i}h${a[x]}z`)}}return u.join(" ")}function Ne(t,e,n,o,i){let r=p(n),s=[];if(i==="circle"){let d=r/2,h=p(d),M=`a${R(C(h))},${R(C(h))} 0 1,0 `,$=`${M}${R(C(h*2))},0${M}${R(C(-h*2))},0z`,L=new Array(e);for(let m=0;m<e;m++){let S=p(p(o+m*n)+d);L[m]=`M${R(C(S-h))},`}for(let m=0;m<e;m++){let S=m*e,v=`${R(C(p(o+m*n)+d))}${$}`,P=ft(m,e)+1,E=dt(m,e);for(let U=P;U<E;U++)t[S+U]===1&&s.push(L[U]+v)}return s.join(" ")}let a=p(r*.45),u=[R(C(r)),R(C(r-a)),R(C(r-2*a))],c=[R(C(-r)),R(C(-(r-a))),R(C(-(r-2*a)))],l=R(C(a)),f=R(C(-a)),A=`q${l},0 ${l},${l}`,g=`q0,${l} ${f},${l}`,b=`q${f},0 ${f},${f}`,x=`q0,${f} ${l},${f}`,w=new Array(e),y=new Array(e);for(let d=0;d<e;d++){let h=p(o+d*n);w[d]=R(C(h)),y[d]=R(C(h+a))}for(let d=0;d<e;d++){let h=d*e,M=R(C(p(o+d*n))),$=ft(d,e)+1,L=dt(d,e);for(let m=$;m<L;m++){if(t[h+m]!==1)continue;let S=d>0&&t[h-e+m]===1,v=m<e-1&&t[h+m+1]===1,P=d<e-1&&t[h+e+m]===1,E=m>0&&t[h+m-1]===1,U=!(S||E),F=!(S||v),I=!(P||v),O=!(P||E);s.push(`M${U?y[m]:w[m]},${M}h${u[(U?1:0)+(F?1:0)]}`+(F?A:"")+`v${u[(F?1:0)+(I?1:0)]}`+(I?g:"")+`h${c[(I?1:0)+(O?1:0)]}`+(O?b:"")+`v${c[(O?1:0)+(U?1:0)]}`+(U?x:"")+"z")}}return s.join(" ")}var _e=2,Nt=new WeakMap;function _t(t,e,n,o,i){let r=Nt.get(t);r||(r=new Map,Nt.set(t,r));let s=`${n}|${o}|${i}`,a=r.get(s);if(a!==void 0)return a;let u=i==="square"?Te(t,e,n,o):Ne(t,e,n,o,i);return r.size>=_e&&r.clear(),r.set(s,u),u}var Fe=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function Ft(t){return t.replace(Fe,"")}function Dt(t,e,n){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=n+e*2,i=p(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${n}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:p(e*i),svgSize:p(i*o)}}function rt(t,e,n){let o=p(n);return`M${p(t)},${p(e)}h${o}v${o}h${-o}z`}function ot(t,e,n,o,i){let r=p(Math.min(i,n/2,o/2)),s=p(n-2*r),a=p(o-2*r);return`M${p(t+r)},${p(e)}h${s}q${r},0 ${r},${r}v${a}q0,${r} ${-r},${r}h${-s}q${-r},0 ${-r},${-r}v${-a}q0,${-r} ${r},${-r}z`}function De(t,e,n,o){if(o==="circle"){let i=p(n/2),r=p(i*2);return`M${p(t)},${p(e+n/2)}a${i},${i} 0 1,0 ${r},0a${i},${i} 0 1,0 ${-r},0z`}return o==="rounded"?ot(t,e,n,n,n*.3):rt(t,e,n)}function Qe(t,e,n,o){let i=n/7,r=n-2*i,s=i;if(o==="square"){let c=rt(t,e,n),l=rt(t+s,e+s,r);return`${c} ${l}`}if(o==="rounded"){let c=ot(t,e,n,n,n*.15),l=rt(t+s,e+s,r);return`${c} ${l}`}if(o==="circle"){let c=t+n/2,l=p(e+n/2),f=A=>{let g=p(A),b=p(g*2);return`M${p(c-g)},${l}a${g},${g} 0 1,0 ${b},0a${g},${g} 0 1,0 ${-b},0z`};return`${f(n/2)} ${f(r/2)}`}let a=ot(t,e,n,n,n*.35),u=ot(t+s,e+s,r,r,r*.2);return`${a} ${u}`}function Qt(t,e,n,o,i){let r=p(7*n),s=p(3*n),a=p(2*n);return{square:Qe(t,e,r,o),dot:De(p(t+a),p(e+a),s,i)}}function mt(t,e,n){return n+t*e}function Wt(t,e,n){return[[0,0],[0,t-7],[t-7,0]].map(([i,r])=>({x:mt(r,e,n),y:mt(i,e,n)}))}var Q={L:.0225,M:.04,Q:.0625,H:.09},We=Q.H,Ge=.4;function bt(t){return t<=Q.L?"L":t<=Q.M?"M":t<=Q.Q?"Q":"H"}var qe=/[\u0000-\u0020]/g;function it(t){let e=t.replace(qe,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function qt(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function Ht(t,e,n){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):Ge:0)*We;return n?{ecLevel:n,absoluteArea:Math.min(i,Q[n]),targetArea:i,clamped:i>Q[n]}:i>0?{ecLevel:bt(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function Gt(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var He={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function Vt({absoluteArea:t,aspectRatio:e,ecLevel:n,qrSize:o,moduleSize:i,marginPx:r}){let s=o*i,a=t*s*s,u=Math.sqrt(a*e),c=Math.sqrt(a/e);if(!(u>0)||!(c>0))return He;let l=u/i,f=c/i,A=Q[n]*o*o,g=Math.max(1,o-16),b=Math.min(Gt(l),g),x=1;for(;;){let m=Math.min(1,b/l);if(x=Math.min(Gt(f*m),g),b*x<=A||b<=1)break;b-=2}let w=Math.min(1,b/l,x/f),y=u*w,d=c*w,h=b*i,M=x*i,$=r+(o-b)/2*i,L=r+(o-x)/2*i;return{clearX:$,clearY:L,clearWidth:h,clearHeight:M,boxX:$+(h-y)/2,boxY:L+(M-d)/2,boxWidth:y,boxHeight:d}}function gt(t,e){let n=t?.square?.style??"square",o=n==="extra-rounded"?"rounded":n==="circle"?"circle":"square";return{squareStyle:n,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function Xt(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function pt(t){let{value:e,size:n=256,margin:o=4,dotStyle:i="square",dotColor:r="#000000",backgroundColor:s="#ffffff",corner:a,logo:u,qr:c}=t,l=u?.src&&it(u.src)?u.src:void 0,f=!!(l||u?.custom),A=c?.errorCorrectionLevel,{ecLevel:g,absoluteArea:b,targetArea:x,clamped:w}=Ht(f,u?.size,A),y=[];w&&y.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${bt(x)}"; ECL "${A}" set, logo clamped.`);let{matrix:d,size:h}=Tt(e,g,c?.version),{moduleSize:M,marginPx:$,svgSize:L}=Dt(n,o,h),m=gt(a,r),S=_t(d,h,M,$,i),v=Wt(h,M,$).map(G=>{let{square:B,dot:V}=Qt(p(G.x),p(G.y),M,m.squareStyle,m.dotStyle);return{...m.backgroundColor===void 0?{}:{background:{x:p(G.x),y:p(G.y),width:p(7*M),height:p(7*M),fill:m.backgroundColor}},square:{d:B,fill:m.squareColor,fillRule:"evenodd"},dot:{d:V,fill:m.dotColor}}}),P=(u?.margin??0)*M,E=Vt({absoluteArea:b,aspectRatio:qt(u?.aspectRatio),ecLevel:g,qrSize:h,moduleSize:M,marginPx:$}),U=p(E.boxX+P),F=p(E.boxY+P),I=p(Math.max(0,E.boxWidth-P*2)),O=p(Math.max(0,E.boxHeight-P*2)),W=f&&I>0&&O>0;return f&&E.boxWidth>0&&E.boxHeight>0&&(I<=0||O<=0)&&y.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:p(n),viewBox:L,ecLevel:g,background:s==="transparent"?void 0:s,modules:S?{d:S,fill:r}:void 0,finders:v,clear:W&&(u?.hideDots??!0)?{x:p(E.clearX),y:p(E.clearY),width:p(E.clearWidth),height:p(E.clearHeight),radius:p(Xt(u?.radius)*Math.min(E.clearWidth,E.clearHeight)/2)}:void 0,logo:W?{src:l,x:U,y:F,width:I,height:O,radius:p(Xt(u?.radius)*Math.min(I,O)/2)}:void 0,warnings:y}}function z(t,e){return`${t}${e}`}function Ve(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Xe(t){let e=Ve(t)*Math.PI/180,n=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-n)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+n)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function tt(t,e){let{x1:n,y1:o,x2:i,y2:r}=Xe(e);return`<linearGradient id="${t}" x1="${n}" y1="${o}" x2="${i}" y2="${r}"><stop offset="0%" stop-color="${Yt(e.startColor)}"/><stop offset="100%" stop-color="${Yt(e.endColor)}"/></linearGradient>`}function Yt(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ye(t){let e=2166136261,n=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),n=Math.imul(n^i,2246822507)}return(e>>>0).toString(36)+(n>>>0).toString(36)}function _(t){return Ft(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var jt=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),je=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of je)jt.add(t);function Ke(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Je(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>{let i=typeof n=="number"&&n!==0&&!jt.has(e)&&!e.startsWith("--")?`${n}px`:String(n);return`${Ke(e)}:${i}`}).join(";")}function Ze(t){let{value:e,size:n=256,margin:o=4,dotStyle:i="square",dotColor:r="#000000",dotGradient:s,backgroundColor:a="#ffffff",backgroundGradient:u,corner:c,logo:l,qr:f,className:A,style:g,ariaLabel:b,idPrefix:x}=t,w=pt(t),y=gt(c,r),d=l?.src&&it(l.src)?l.src:void 0,h=(x??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",M=[e,n,o,i,r,JSON.stringify(s??null),a,JSON.stringify(u??null),y.squareStyle,y.squareColor,y.dotStyle,y.dotColor,c?.backgroundColor??"",JSON.stringify(c?.square?.gradient??null),JSON.stringify(c?.dot?.gradient??null),w.ecLevel,f?.version??"",d??"",l?.size??"",l?.aspectRatio??"",l?.margin??"",l?.hideDots??"",A??"",b??"",x??""];l?.radius!==void 0&&M.push(l.radius),l?.custom&&M.push("custom");let $=`${h}${Ye(M.join("\0"))}`,L=`${$}t`,m=`${$}m`,S=`${$}c`,v=z($,"d"),P=z($,"b"),E=z($,"s"),U=z($,"p"),{size:F,viewBox:I,background:O,modules:W,finders:G}=w,{clear:B,logo:V}=w,k=`<svg role="img" aria-labelledby="${L}" width="${F}" height="${F}" viewBox="0 0 ${I} ${I}" xmlns="http://www.w3.org/2000/svg"`;A&&(k+=` class="${_(A)}"`),g&&(k+=` style="${_(Je(g))}"`),k+=">",k+=`<title id="${L}">${_(b??`QR code: ${e}`)}</title>`;let ht=[s&&tt(v,s),u&&tt(P,u),c?.square?.gradient&&tt(E,c.square.gradient),c?.dot?.gradient&&tt(U,c.dot.gradient)].filter(Boolean);ht.length&&(k+=`<defs>${ht.join("")}</defs>`),O!==void 0&&(k+=`<rect width="${I}" height="${I}" fill="${u?`url(#${P})`:_(O)}"/>`),B&&(k+=`<defs><mask id="${m}"><rect width="${I}" height="${I}" fill="white"/><rect x="${B.x}" y="${B.y}" width="${B.width}" height="${B.height}" rx="${B.radius}" ry="${B.radius}" fill="black"/></mask></defs>`),k+=`<g${B?` mask="url(#${m})"`:""}>`,W&&(k+=`<path d="${W.d}" fill="${s?`url(#${v})`:_(W.fill)}"/>`);for(let{background:T,square:X,dot:Y}of G)k+="<g>"+(T?`<rect x="${T.x}" y="${T.y}" width="${T.width}" height="${T.height}" fill="${_(T.fill)}"/>`:"")+`<path d="${X.d}" fill="${c?.square?.gradient?`url(#${E})`:_(X.fill)}" fill-rule="evenodd"/><path d="${Y.d}" fill="${c?.dot?.gradient?`url(#${U})`:_(Y.fill)}"/></g>`;if(k+="</g>",V?.src){let{x:T,y:X,width:Y,height:yt,radius:et}=V;et>0&&(k+=`<defs><clipPath id="${S}"><rect x="${T}" y="${X}" width="${Y}" height="${yt}" rx="${et}" ry="${et}"/></clipPath></defs>`),k+=`<image href="${_(V.src)}" x="${T}" y="${X}" width="${Y}" height="${yt}"${et>0?` clip-path="url(#${S})"`:""}/>`}return k+="</svg>",k}export{pt as a,Xe as b,Ze as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as v}from"./chunk-BI4MXPFZ.mjs";function L(u,n,l,m){if(m){let s=v(m),h=Number.parseFloat(s.x1)/100*n,f=Number.parseFloat(s.y1)/100*n,Q=Number.parseFloat(s.x2)/100*n,p=Number.parseFloat(s.y2)/100*n,y=u.createLinearGradient(h,f,Q,p);y.addColorStop(0,m.startColor),y.addColorStop(1,m.endColor),u.fillStyle=y,u.fillRect(0,0,n,n)}else l!=="transparent"&&(u.fillStyle=l,u.fillRect(0,0,n,n))}function j(u=0){if(!Number.isFinite(u)||u<0||u>1)throw new RangeError("imageDotSize must be between 0 and 1.");return u}function z(u,n){return u===void 0?n??"threshold":u?"color":"threshold"}function H(u,n,l){let{width:m,height:s,matrixSize:h,margin:f,filter:Q,backgroundColor:p,backgroundAlpha:y}=l,C=l.gapColor,o=new Uint8ClampedArray(u),I=m/(h+f*2),S=Math.max(l.coreSize??.4,l.minCoreSize??0),F=(1-S)/2,N=(e,a)=>{if(!l.dotStyle||l.dotStyle==="square")return!0;if(l.dotStyle==="circle")return(e-.5)**2+(a-.5)**2<=S**2/4;let t=S*.28,c=Math.max(Math.abs(e-.5)-(S/2-t),0),r=Math.max(Math.abs(a-.5)-(S/2-t),0);return c**2+r**2<=t**2},D=(e,a)=>{let t=l.clear;if(!t||e<t.x||a<t.y||e>=t.x+t.width||a>=t.y+t.height)return!1;let c=Math.min(t.radius??0,t.width/2,t.height/2),r=Math.max(t.x+c,Math.min(e,t.x+t.width-c)),b=Math.max(t.y+c,Math.min(a,t.y+t.height-c));return(e-r)**2+(a-b)**2<=c**2},B=(e,a)=>e<8&&a<8||e>=h-8&&a<8||e<8&&a>=h-8,R=(e,a=u)=>{let t=a[e+3]/255,c=n[e+3]/255,r=t+c*(1-t),b=(M,A)=>r===0?0:(M*t+A*c*(1-t))/r;o[e]=b(a[e],n[e]),o[e+1]=b(a[e+1],n[e+1]),o[e+2]=b(a[e+2],n[e+2]),o[e+3]=r*255};for(let e=0;e<s;e+=1)for(let a=0;a<m;a+=1){let t=a/I-f,c=e/I-f,r=(e*m+a)*4;if(t<0||c<0||t>=h||c>=h){o[r]=n[r],o[r+1]=n[r+1],o[r+2]=n[r+2],o[r+3]=n[r+3];continue}let b=Math.floor(t),M=Math.floor(c);if(D(t,c)){o[r]=p[0],o[r+1]=p[1],o[r+2]=p[2],o[r+3]=y;continue}if(B(b,M)){R(r,l.transparentFinderBackground&&l.finderPixels?l.finderPixels:u);continue}let A=t-b,w=c-M;if(A>=F&&A<1-F&&w>=F&&w<1-F&&N(A,w)){R(r);continue}if(C){let d=C[3]/255,U=n[r+3]/255,g=d+U*(1-d),k=(G,q)=>g===0?0:(G*d+q*U*(1-d))/g;o[r]=k(C[0],n[r]),o[r+1]=k(C[1],n[r+1]),o[r+2]=k(C[2],n[r+2]),o[r+3]=g*255;continue}let i=r;if(Q==="color")o[r]=n[i],o[r+1]=n[i+1],o[r+2]=n[i+2];else{let d=n[i]*.2126+n[i+1]*.7152+n[i+2]*.0722;o[r]=d,o[r+1]=d,o[r+2]=d}o[r+3]=n[i+3]}return o}export{L as a,j as b,z as c,H as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,b as $,c as j,d as V}from"./chunk-
|
|
1
|
+
import{a as N,b as $,c as j,d as V}from"./chunk-OBIGPYJW.mjs";import{a as D,c as H}from"./chunk-BI4MXPFZ.mjs";function J(a){return!/^\s*(?:javascript|vbscript):/i.test(a)&&!/^data:(?!image\/)/i.test(a)}function z(a){return new Promise((e,o)=>{let t=new Image;t.crossOrigin="anonymous",t.onload=()=>e(t),t.onerror=()=>o(new Error("An image could not be loaded for the QR code.")),t.src=a})}function ae(a){let e=document.createElement("canvas");e.width=1,e.height=1;let o=e.getContext("2d");if(!o)throw new Error("Canvas 2D context is unavailable.");o.fillStyle=a,o.fillRect(0,0,1,1);let t=o.getImageData(0,0,1,1).data;return[t[0],t[1],t[2],t[3]]}function ne(a,e,o,t,b,u,E){let p=E==="fill"?Math.max(b/e.naturalWidth,u/e.naturalHeight):Math.min(b/e.naturalWidth,u/e.naturalHeight),m=e.naturalWidth*p,i=e.naturalHeight*p;a.drawImage(e,o+(b-m)/2,t+(u-i)/2,m,i)}function ie(a,e){let o=H({...e,ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),t=new DOMParser().parseFromString(o,"image/svg+xml");a.replaceChildren(document.importNode(t.documentElement,!0))}async function le(a,e,o){let{imagePath:t,imageDotSize:b,imageDotStyle:u,imageColor:E,filter:p,fillType:m="scale_to_fit",logo:i,...w}=e;if(!t||!J(t))throw new Error("The image URL uses an unsupported scheme.");if(i?.src&&!J(i.src))throw new Error("The center image URL uses an unsupported scheme.");if(m!=="scale_to_fit"&&m!=="fill")throw new Error('The image fill type must be "scale_to_fit" or "fill".');let K=z(t),X=i?.src?z(i.src):Promise.resolve(void 0),[Y,g]=await Promise.all([K,X]);if(o())return;let Z=i?{...i,src:void 0,custom:!0,aspectRatio:i.aspectRatio??(g?g.naturalWidth/g.naturalHeight:1)}:void 0,f={...w,dotStyle:u??w.dotStyle,backgroundColor:w.backgroundColor??"#ffffff",qr:{errorCorrectionLevel:"H",...w.qr},logo:Z},n=D(f),T=D({...f,corner:{square:{style:"square"},dot:{style:"square"}}}),_=T.finders[0].square.d,c=Number(_.match(/h([\d.]+)v/)?.[1])/7,d=Number(_.match(/^M([\d.]+),/)?.[1])/c,C=Math.round(T.viewBox/c-d*2),L=C+d*2;if(!Number.isFinite(c)||!Number.isFinite(d)||C<21)throw new Error("Unable to determine QR module dimensions.");let ee=H({...f,dotColor:f.dotColor??"#000000",backgroundColor:"#ffffff",ariaLabel:e.ariaLabel??`QR code: ${e.value}`}),U=URL.createObjectURL(new Blob([ee],{type:"image/svg+xml"}));try{let te=await z(U);if(o())return;let h=f.size??256,r=Math.max(Math.ceil(L*8),Math.ceil(h*2)),S=document.createElement("canvas");S.width=r,S.height=r;let Q=S.getContext("2d",{willReadFrequently:!0}),M=document.createElement("canvas");M.width=r,M.height=r;let x=M.getContext("2d",{willReadFrequently:!0});if(!Q||!x)throw new Error("Canvas 2D context is unavailable.");Q.drawImage(te,0,0,r,r);let y=e.backgroundColor??"#ffffff",I=ae(y==="transparent"?"#ffffff":y),re=[I[0],I[1],I[2]];N(x,r,y,f.backgroundGradient);let B=r/L,F=d*B,W=C*B;ne(x,Y,F,F,W,W,m);let oe=V(Q.getImageData(0,0,r,r).data,x.getImageData(0,0,r,r).data,{width:r,height:r,matrixSize:C,margin:d,minCoreSize:Math.min(1,L/Math.max(1,Math.round(h))),coreSize:$(b),dotStyle:u??w.dotStyle,clear:n.clear?{x:n.clear.x/c-d,y:n.clear.y/c-d,width:n.clear.width/c,height:n.clear.height/c,radius:n.clear.radius/c}:void 0,filter:j(E,p),backgroundColor:re,backgroundAlpha:y==="transparent"?0:I[3]}),l=document.createElement("canvas");l.width=Math.round(h),l.height=Math.round(h),l.setAttribute("role","img"),l.setAttribute("aria-label",e.ariaLabel??`QR code: ${e.value}`),l.style.width=`${h}px`,l.style.height=`${h}px`;let A=l.getContext("2d"),R=document.createElement("canvas");R.width=r,R.height=r;let s=R.getContext("2d");if(!A||!s)throw new Error("Canvas 2D context is unavailable.");let G=s.createImageData(r,r);if(G.data.set(oe),s.putImageData(G,0,0),g&&n.logo){let v=r/n.viewBox,k=n.logo.x*v,P=n.logo.y*v,q=n.logo.width*v,O=n.logo.height*v;n.logo.radius>0?(s.save(),s.beginPath(),s.roundRect(k,P,q,O,n.logo.radius*v),s.clip(),s.drawImage(g,k,P,q,O),s.restore()):s.drawImage(g,k,P,q,O)}A.drawImage(R,0,0,l.width,l.height),o()||a.replaceChildren(l)}finally{URL.revokeObjectURL(U)}}function me(a,e){let o=!1;return e.imagePath?le(a,e,()=>o).catch(t=>{o||(e.onImageError?e.onImageError(t):console.error("quter: unable to render the image-based QR code.",t))}):ie(a,e),()=>{o=!0,a.replaceChildren()}}export{me as a};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{readFile as Zt,writeFile as zt}from"fs/promises";import{extname as er,resolve as ye}from"path";import{pathToFileURL as tr}from"url";function Ke(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function Je(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var re=Ke(),Y=Je(re);function Ze(t,e){return t===0||e===0?0:re[Y[t]+Y[e]]}function ze(t,e){return re[Y[t]*e%255]}function et(t){let e=[1];for(let r=0;r<t;r++){let o=[1,ze(2,r)],i=new Array(e.length+o.length-1).fill(0);for(let n=0;n<e.length;n++)for(let s=0;s<o.length;s++)i[n+s]^=Ze(e[n],o[s]);e=i}return Uint8Array.from(e)}var we=new Map;function tt(t){let e=we.get(t);return e||(e=et(t),we.set(t,e)),e}function rt(t,e){let r=tt(e),o=r.length,i=t.length,n=new Uint8Array(i+e);n.set(t);for(let s=0;s<i;s++){let a=n[s];if(a!==0){let u=Y[a];for(let c=0;c<o;c++)n[s+c]^=re[Y[r[c]]+u]}}return n.slice(i)}var nt=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],ot=[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],Se=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function K(t,e){return Se[(t-1)*4+e]}function Ae(t,e,r){let o=(e-1)*4+r,i=nt[o],n=ot[o],s=Se[o],a=Math.floor(s/n),u=n-s%n,c=t instanceof Uint8Array?t:Uint8Array.from(t),l=new Array(n),f=new Array(n),p=new Array(n),b=0,m=0;for(let $=0;$<n;$++){let d=$<u?a:a+1;l[$]=b,f[$]=d,d>m&&(m=d),p[$]=rt(c.subarray(b,b+d),i),b+=d}let w=new Uint8Array(c.length+n*i),A=0;for(let $=0;$<m;$++)for(let d=0;d<n;d++)$<f[d]&&(w[A++]=c[l[d]+$]);for(let $=0;$<i;$++)for(let d=0;d<n;d++)w[A++]=p[d][$];return w}var Me={numeric:1,alphanumeric:2,byte:4};function it(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var H=it();function st(t){return t<128?H[t]:-1}function T(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Ce=[[1,9],[10,26],[27,40]],ct=[0,4,7];function at(t,e){return t==="numeric"?10*Math.floor(e/3)+ct[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function le(t,e){let r=0;for(let o of t)r+=4+T(o.mode,e)+at(o.mode,o.charCount);return Math.ceil(r/8)}function ae(t,e,r,o){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:o}}var W=0,J=1,Z=2,lt=["numeric","alphanumeric","byte"];function ut(t){return t<128?1:t<2048?2:t<65536?3:4}var Re=20,Ee=33,ve=48;function ft(t){let e=0,r=0,o=0,i=0;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);s<128?(r++,s>=48&&s<=57?(o++,i++):H[s]>=0&&i++):s<2048?r+=2:s>=55296&&s<=56319&&(t.charCodeAt(n+1)&64512)===56320?(r+=4,n++):r+=3,e++}return{count:e,totalBytes:r,digits:o,alnums:i}}function dt(t,e){let r=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),n=0;for(let s=0;s<t.length;){let a=t.codePointAt(s);r[n]=s,o[n]=ut(a),a>=48&&a<=57?i[n]=2:st(a)>=0&&(i[n]=1),n++,s+=a>65535?2:1}return{cpIndex:r,cpBytes:o,cpClass:i}}function Le(t){let{count:e,totalBytes:r,digits:o,alnums:i}=ft(t),n=o*Re+(i-o)*Ee+(r-i)*ve,s=c=>{let l=4+Math.min(T("numeric",c),T("alphanumeric",c),T("byte",c));return Math.ceil((n/6+l)/8)},a;if(o===e?a=ae(t,"numeric",e,r):i===e&&o===0?a=ae(t,"alphanumeric",e,r):i===0&&(a=ae(t,"byte",r,r)),a){let c=[a];return{forVersion:()=>c,minDataBytes:s}}let u;return{forVersion(c){return u??=dt(t,e),mt(t,c,e,u)},minDataBytes:s}}function mt(t,e,r,{cpIndex:o,cpBytes:i,cpClass:n}){let s=(4+T("numeric",e))*6,a=(4+T("alphanumeric",e))*6,u=(4+T("byte",e))*6,c=[s,a,u],l=new Int8Array(r*3).fill(-1),f=new Float64Array(3),p=new Float64Array([s,a,u]);for(let y=0;y<r;y++){let S=y*3,x=n[y];f[W]=1/0,f[J]=1/0,f[Z]=p[Z]+i[y]*ve,l[S+Z]=Z,x!==0&&(f[J]=p[J]+Ee,l[S+J]=J),x===2&&(f[W]=p[W]+Re,l[S+W]=W);for(let g=0;g<3;g++)for(let M=0;M<3;M++){if(l[S+M]===-1)continue;let L=Math.ceil(f[M]/6)*6+c[g];(l[S+g]===-1||L<f[g])&&(f[g]=L,l[S+g]=M)}let E=p;p=f,f=E}let b=W;for(let y=1;y<3;y++)p[y]<p[b]&&(b=y);let m=new Int8Array(r),w=b;for(let y=r-1;y>=0;y--)w=l[y*3+w],m[y]=w;let A=[],$=0,d=0;for(;d<r;){let y=m[d],S=d,x=0;for(;S<r&&m[S]===y;)x+=i[S],S++;A.push({mode:lt[y],start:o[d],end:S<r?o[S]:t.length,charCount:y===Z?x:S-d,byteStart:$,byteEnd:$+x}),$+=x,d=S}return A}var gt={L:0,M:1,Q:2,H:3},bt;function pt(){return bt??=new TextEncoder}var ue=class{bytes;bitPos=0;constructor(e){this.bytes=new Uint8Array(e)}writeBits(e,r){let o=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},ht=[236,17];function yt(t,e,r,o,i){let n=new ue(o);for(let c of e)if(n.writeBits(Me[c.mode],4),n.writeBits(c.charCount,T(c.mode,r)),c.mode==="numeric")for(let l=c.start;l<c.end;l+=3){let f=Math.min(3,c.end-l),p=t.charCodeAt(l)-48;f>=2&&(p=p*10+(t.charCodeAt(l+1)-48)),f>=3&&(p=p*10+(t.charCodeAt(l+2)-48)),n.writeBits(p,f===3?10:f===2?7:4)}else if(c.mode==="alphanumeric")for(let l=c.start;l<c.end;l+=2)if(l+1<c.end){let f=H[t.charCodeAt(l)]*45+H[t.charCodeAt(l+1)];n.writeBits(f,11)}else n.writeBits(H[t.charCodeAt(l)],6);else for(let l=c.byteStart;l<c.byteEnd;l++)n.writeBits(i[l],8);let s=o*8;if(n.bitLength>s)throw new RangeError(`encoded data (${n.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);n.skipBits(Math.min(4,s-n.bitLength)),n.alignToByte();let a=n.bytes,u=0;for(let c=n.bitLength>>3;c<o;c++)a[c]=ht[u%2],u++;return a}function ke(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=gt[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=Le(t),n=b=>i.forVersion(b),s,a;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);s=r,a=n(s);let b=K(s,o),m=le(a,s);if(m>b)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${m} bytes, capacity ${b})`)}else{let b;for(let[m,w]of Ce){if(i.minDataBytes(m)>K(w,o))continue;let A=n(m),$=le(A,m);for(let d=m;d<=w;d++)if($<=K(d,o)){b={version:d,segments:A};break}if(b)break}if(!b)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=b.version,a=b.segments}let c=a.some(b=>b.mode==="byte")?pt().encode(t):null,l=K(s,o),f=yt(t,a,s,l,c);return{codewords:Ae(f,s,o),version:s,ecLevelIndex:o,segments:a}}var xt=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function $t(t,e){let r=t/e*100,o=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(o,i)}function wt(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=xt[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=r(o,i)?1:0}return t}var Ue=wt(),Ie=1488,Pe=93,Oe=2047;function St(t,e,r,o,i){let{prevRow:n,colRunVal:s,colRunLen:a,colWin:u}=i;s.fill(-1),a.fill(0),u.fill(0);let c=0,l=0;for(let f=0;f<r;f++){let p=o+f%12*6,b=f*r,m=f>=10,w=0,A=-1,$=0,d=0,y=-1,S=-1;for(let x=0;x<r;x++){let E=b+x,g=t[E]^Ue[p+w]&(e[E]^1);l+=g,g===A?$++:($>=5&&(c+=$-2),A=g,$=1),d=(d<<1|g)&Oe,x>=10&&(d===Ie||d===Pe)&&(c+=40),g===s[x]?a[x]++:(a[x]>=5&&(c+=a[x]-2),s[x]=g,a[x]=1);let M=(u[x]<<1|g)&Oe;u[x]=M,m&&(M===Ie||M===Pe)&&(c+=40);let L=n[x];f>0&&x>0&&g===y&&g===L&&g===S&&(c+=3),n[x]=g,S=L,y=g,w++,w===6&&(w=0)}$>=5&&(c+=$-2)}for(let f=0;f<r;f++)a[f]>=5&&(c+=a[f]-2);return c+=$t(l,r*r),c}function At(t,e,r){let o={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,n=1/0;for(let s=0;s<8;s++){let a=St(t,e,r,s*72,o);a<n&&(n=a,i=s)}return i}function Be(t,e,r){let o=At(t,e,r),i=o*72;for(let n=0;n<r;n++){let s=i+n%12*6,a=n*r,u=0;for(let c=0;c<r;c++)e[a+c]||(t[a+c]^=Ue[s+u]),u++,u===6&&(u=0)}return o}function Mt(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,o=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,i=[6];for(let n=1;n<e;n++)i.push(r-(e-1-n)*o);return i}var Ct=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Rt=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function fe(t,e,r,o,i){for(let n=-1;n<=7;n++)for(let s=-1;s<=7;s++){let a=o+n,u=i+s;if(a<0||u<0||a>=r||u>=r)continue;let c=a*r+u;e[c]=1,n===-1||n===7||s===-1||s===7?t[c]=0:n===0||n===6||s===0||s===6||n>=2&&n<=4&&s>=2&&s<=4?t[c]=1:t[c]=0}}function Et(t,e,r,o,i){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++){let a=(o+n)*r+(i+s);e[a]=1,n===-2||n===2||s===-2||s===2||n===0&&s===0?t[a]=1:t[a]=0}}function vt(t,e,r){for(let o=8;o<r-8;o++){let i=o%2===0?1:0,n=6*r+o,s=o*r+6;t[n]=i,t[s]=i,e[n]=1,e[s]=1}}var Te=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function Lt(t,e){for(let[r,o]of Te)t[r*e+o]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function kt(t,e,r,o){if(o<7)return;let i=Rt[o-7];for(let n=0;n<18;n++){let s=i>>n&1,a=Math.floor(n/3),u=n%3,c=a*r+(r-11+u),l=(r-11+u)*r+a;t[c]=s,e[c]=1,t[l]=s,e[l]=1}}function It(t,e,r,o){let i=0,n=o.length*8,s=r-1,a=!0;for(;s>=0;){if(s===6){s--;continue}let u=a?r-1:0,c=a?-1:r,l=a?-1:1;for(let f=u;f!==c;f+=l){let p=f*r;for(let b=0;b<=1;b++){let m=s-b;m<0||e[p+m]||(i<n?(t[p+m]=o[i>>3]>>7-(i&7)&1,i++):t[p+m]=0)}}s-=2,a=!a}}var Pt=16,F=new Map;function ne(t,e="M",r){let o=`${e}|${r??"a"}|${t}`,i=F.get(o);if(i)return F.delete(o),F.set(o,i),i;let n=Ot(t,e,r);return F.set(o,n),F.size>Pt&&F.delete(F.keys().next().value),n}function Ot(t,e,r){let o=ke(t,e,r),{codewords:i,version:n,ecLevelIndex:s}=o,a=n*4+17,u=new Uint8Array(a*a),c=new Uint8Array(a*a);fe(u,c,a,0,0),fe(u,c,a,0,a-7),fe(u,c,a,a-7,0),vt(u,c,a);let l=(4*n+9)*a+8;u[l]=1,c[l]=1;let f=Mt(n);for(let m of f)for(let w of f)m<=8&&w<=8||m<=8&&w>=a-8||m>=a-8&&w<=8||Et(u,c,a,m,w);kt(u,c,a,n),Lt(c,a),It(u,c,a,i);let p=Be(u,c,a),b=Ct[s*8+p];return Ut(u,b,a),{matrix:u,version:n,size:a}}function Ut(t,e,r){for(let o=0;o<15;o++){let[i,n]=Te[o];t[i*r+n]=e>>14-o&1}for(let o=0;o<8;o++)t[8*r+r-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(r-7+o)*r+8]=e>>o+8&1;t[(r-8)*r+8]=1}var h=t=>Math.round(t*100)/100,R=t=>Math.round(t*100);function C(t){let e=t<0,r=e?-t:t,o=Math.floor(r/100),i=r-o*100,n;return i===0?n=String(o):i%10===0?n=`${o}.${i/10}`:i<10?n=`${o}.0${i}`:n=`${o}.${i}`,e?`-${n}`:n}function de(t,e){return t<=7||t>=e-8?7:-1}function me(t,e){return t<=7?e-8:e}function Bt(t,e,r,o){let i=C(R(r)),n=new Array(e),s=new Array(e+1),a=new Array(e+1);for(let c=0;c<=e;c++){let l=R(c*r);s[c]=C(l),a[c]=C(-l),c<e&&(n[c]=C(R(o+c*r)))}let u=[];for(let c=0;c<e;c++){let l=c*e,f=C(R(o+c*r)),p=de(c,e)+1,b=me(c,e),m=-1;for(let w=p;w<b;w++)if(t[l+w]===1)m===-1&&(m=w);else if(m!==-1){let A=w-m;u.push(`M${n[m]},${f}h${s[A]}v${i}h${a[A]}z`),m=-1}if(m!==-1){let w=b-m;u.push(`M${n[m]},${f}h${s[w]}v${i}h${a[w]}z`)}}return u.join(" ")}function Tt(t,e,r,o,i){let n=h(r),s=[];if(i==="circle"){let d=n/2,y=h(d),S=`a${C(R(y))},${C(R(y))} 0 1,0 `,x=`${S}${C(R(y*2))},0${S}${C(R(-y*2))},0z`,E=new Array(e);for(let g=0;g<e;g++){let M=h(h(o+g*r)+d);E[g]=`M${C(R(M-y))},`}for(let g=0;g<e;g++){let M=g*e,L=`${C(R(h(o+g*r)+d))}${x}`,O=de(g,e)+1,v=me(g,e);for(let P=O;P<v;P++)t[M+P]===1&&s.push(E[P]+L)}return s.join(" ")}let a=h(n*.45),u=[C(R(n)),C(R(n-a)),C(R(n-2*a))],c=[C(R(-n)),C(R(-(n-a))),C(R(-(n-2*a)))],l=C(R(a)),f=C(R(-a)),p=`q${l},0 ${l},${l}`,b=`q0,${l} ${f},${l}`,m=`q${f},0 ${f},${f}`,w=`q0,${f} ${l},${f}`,A=new Array(e),$=new Array(e);for(let d=0;d<e;d++){let y=h(o+d*r);A[d]=C(R(y)),$[d]=C(R(y+a))}for(let d=0;d<e;d++){let y=d*e,S=C(R(h(o+d*r))),x=de(d,e)+1,E=me(d,e);for(let g=x;g<E;g++){if(t[y+g]!==1)continue;let M=d>0&&t[y-e+g]===1,L=g<e-1&&t[y+g+1]===1,O=d<e-1&&t[y+e+g]===1,v=g>0&&t[y+g-1]===1,P=!(M||v),N=!(M||L),k=!(O||L),U=!(O||v);s.push(`M${P?$[g]:A[g]},${S}h${u[(P?1:0)+(N?1:0)]}`+(N?p:"")+`v${u[(N?1:0)+(k?1:0)]}`+(k?b:"")+`h${c[(k?1:0)+(U?1:0)]}`+(U?m:"")+`v${c[(U?1:0)+(P?1:0)]}`+(P?w:"")+"z")}}return s.join(" ")}var qt=2,qe=new WeakMap;function Ne(t,e,r,o,i){let n=qe.get(t);n||(n=new Map,qe.set(t,n));let s=`${r}|${o}|${i}`,a=n.get(s);if(a!==void 0)return a;let u=i==="square"?Bt(t,e,r,o):Tt(t,e,r,o,i);return n.size>=qt&&n.clear(),n.set(s,u),u}var Nt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function De(t){return t.replace(Nt,"")}function se(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=r+e*2,i=h(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:h(e*i),svgSize:h(i*o)}}function oe(t,e,r){let o=h(r);return`M${h(t)},${h(e)}h${o}v${o}h${-o}z`}function ie(t,e,r,o,i){let n=h(Math.min(i,r/2,o/2)),s=h(r-2*n),a=h(o-2*n);return`M${h(t+n)},${h(e)}h${s}q${n},0 ${n},${n}v${a}q0,${n} ${-n},${n}h${-s}q${-n},0 ${-n},${-n}v${-a}q0,${-n} ${n},${-n}z`}function Dt(t,e,r,o){if(o==="circle"){let i=h(r/2),n=h(i*2);return`M${h(t)},${h(e+r/2)}a${i},${i} 0 1,0 ${n},0a${i},${i} 0 1,0 ${-n},0z`}return o==="rounded"?ie(t,e,r,r,r*.3):oe(t,e,r)}function Ft(t,e,r,o){let i=r/7,n=r-2*i,s=i;if(o==="square"){let c=oe(t,e,r),l=oe(t+s,e+s,n);return`${c} ${l}`}if(o==="rounded"){let c=ie(t,e,r,r,r*.15),l=oe(t+s,e+s,n);return`${c} ${l}`}if(o==="circle"){let c=t+r/2,l=h(e+r/2),f=p=>{let b=h(p),m=h(b*2);return`M${h(c-b)},${l}a${b},${b} 0 1,0 ${m},0a${b},${b} 0 1,0 ${-m},0z`};return`${f(r/2)} ${f(n/2)}`}let a=ie(t,e,r,r,r*.35),u=ie(t+s,e+s,n,n,n*.2);return`${a} ${u}`}function Fe(t,e,r,o,i){let n=h(7*r),s=h(3*r),a=h(2*r);return{square:Ft(t,e,n,o),dot:Dt(h(t+a),h(e+a),s,i)}}function ge(t,e,r){return r+t*e}function _e(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,n])=>({x:ge(n,e,r),y:ge(i,e,r)}))}var _={L:.0225,M:.04,Q:.0625,H:.09},_t=_.H,Qt=.4;function be(t){return t<=_.L?"L":t<=_.M?"M":t<=_.Q?"Q":"H"}var Gt=/[\u0000-\u0020]/g;function ce(t){let e=t.replace(Gt,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function Ge(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function We(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):Qt:0)*_t;return r?{ecLevel:r,absoluteArea:Math.min(i,_[r]),targetArea:i,clamped:i>_[r]}:i>0?{ecLevel:be(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function Qe(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var Wt={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function He({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:o,moduleSize:i,marginPx:n}){let s=o*i,a=t*s*s,u=Math.sqrt(a*e),c=Math.sqrt(a/e);if(!(u>0)||!(c>0))return Wt;let l=u/i,f=c/i,p=_[r]*o*o,b=Math.max(1,o-16),m=Math.min(Qe(l),b),w=1;for(;;){let g=Math.min(1,m/l);if(w=Math.min(Qe(f*g),b),m*w<=p||m<=1)break;m-=2}let A=Math.min(1,m/l,w/f),$=u*A,d=c*A,y=m*i,S=w*i,x=n+(o-m)/2*i,E=n+(o-w)/2*i;return{clearX:x,clearY:E,clearWidth:y,clearHeight:S,boxX:x+(y-$)/2,boxY:E+(S-d)/2,boxWidth:$,boxHeight:d}}function pe(t,e){let r=t?.square?.style??"square",o=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function Ht(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function Ve(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",backgroundColor:s="#ffffff",corner:a,logo:u,qr:c}=t,l=u?.src&&ce(u.src)?u.src:void 0,f=!!(l||u?.custom),p=c?.errorCorrectionLevel,{ecLevel:b,absoluteArea:m,targetArea:w,clamped:A}=We(f,u?.size,p),$=[];A&&$.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${be(w)}"; ECL "${p}" set, logo clamped.`);let{matrix:d,size:y}=ne(e,b,c?.version),{moduleSize:S,marginPx:x,svgSize:E}=se(r,o,y),g=pe(a,n),M=Ne(d,y,S,x,i),L=_e(y,S,x).map(G=>{let{square:D,dot:V}=Fe(h(G.x),h(G.y),S,g.squareStyle,g.dotStyle);return{...g.backgroundColor===void 0?{}:{background:{x:h(G.x),y:h(G.y),width:h(7*S),height:h(7*S),fill:g.backgroundColor}},square:{d:D,fill:g.squareColor,fillRule:"evenodd"},dot:{d:V,fill:g.dotColor}}}),O=(u?.margin??0)*S,v=He({absoluteArea:m,aspectRatio:Ge(u?.aspectRatio),ecLevel:b,qrSize:y,moduleSize:S,marginPx:x}),P=h(v.boxX+O),N=h(v.boxY+O),k=h(Math.max(0,v.boxWidth-O*2)),U=h(Math.max(0,v.boxHeight-O*2)),Q=f&&k>0&&U>0;return f&&v.boxWidth>0&&v.boxHeight>0&&(k<=0||U<=0)&&$.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:h(r),viewBox:E,ecLevel:b,background:s==="transparent"?void 0:s,modules:M?{d:M,fill:n}:void 0,finders:L,clear:Q&&(u?.hideDots??!0)?{x:h(v.clearX),y:h(v.clearY),width:h(v.clearWidth),height:h(v.clearHeight)}:void 0,logo:Q?{src:l,x:P,y:N,width:k,height:U,radius:h(Ht(u?.radius)*Math.min(k,U)/2)}:void 0,warnings:$}}function z(t,e){return`${t}${e}`}function Vt(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Xt(t){let e=Vt(t)*Math.PI/180,r=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function ee(t,e){let{x1:r,y1:o,x2:i,y2:n}=Xt(e);return`<linearGradient id="${t}" x1="${r}" y1="${o}" x2="${i}" y2="${n}"><stop offset="0%" stop-color="${Xe(e.startColor)}"/><stop offset="100%" stop-color="${Xe(e.endColor)}"/></linearGradient>`}function Xe(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function jt(t){let e=2166136261,r=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function q(t){return De(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var je=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),Yt=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of Yt)je.add(t);function Kt(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Jt(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!je.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${Kt(e)}:${i}`}).join(";")}function he(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",dotGradient:s,backgroundColor:a="#ffffff",backgroundGradient:u,corner:c,logo:l,qr:f,className:p,style:b,ariaLabel:m,idPrefix:w}=t,A=Ve(t),$=pe(c,n),d=l?.src&&ce(l.src)?l.src:void 0,y=(w??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",S=[e,r,o,i,n,JSON.stringify(s??null),a,JSON.stringify(u??null),$.squareStyle,$.squareColor,$.dotStyle,$.dotColor,c?.backgroundColor??"",JSON.stringify(c?.square?.gradient??null),JSON.stringify(c?.dot?.gradient??null),A.ecLevel,f?.version??"",d??"",l?.size??"",l?.aspectRatio??"",l?.margin??"",l?.hideDots??"",p??"",m??"",w??""];l?.radius!==void 0&&S.push(l.radius),l?.custom&&S.push("custom");let x=`${y}${jt(S.join("\0"))}`,E=`${x}t`,g=`${x}m`,M=`${x}c`,L=z(x,"d"),O=z(x,"b"),v=z(x,"s"),P=z(x,"p"),{size:N,viewBox:k,background:U,modules:Q,finders:G}=A,{clear:D,logo:V}=A,I=`<svg role="img" aria-labelledby="${E}" width="${N}" height="${N}" viewBox="0 0 ${k} ${k}" xmlns="http://www.w3.org/2000/svg"`;p&&(I+=` class="${q(p)}"`),b&&(I+=` style="${q(Jt(b))}"`),I+=">",I+=`<title id="${E}">${q(m??`QR code: ${e}`)}</title>`;let xe=[s&&ee(L,s),u&&ee(O,u),c?.square?.gradient&&ee(v,c.square.gradient),c?.dot?.gradient&&ee(P,c.dot.gradient)].filter(Boolean);xe.length&&(I+=`<defs>${xe.join("")}</defs>`),U!==void 0&&(I+=`<rect width="${k}" height="${k}" fill="${u?`url(#${O})`:q(U)}"/>`),D&&(I+=`<defs><mask id="${g}"><rect width="${k}" height="${k}" fill="white"/><rect x="${D.x}" y="${D.y}" width="${D.width}" height="${D.height}" fill="black"/></mask></defs>`),I+=`<g${D?` mask="url(#${g})"`:""}>`,Q&&(I+=`<path d="${Q.d}" fill="${s?`url(#${L})`:q(Q.fill)}"/>`);for(let{background:B,square:X,dot:j}of G)I+="<g>"+(B?`<rect x="${B.x}" y="${B.y}" width="${B.width}" height="${B.height}" fill="${q(B.fill)}"/>`:"")+`<path d="${X.d}" fill="${c?.square?.gradient?`url(#${v})`:q(X.fill)}" fill-rule="evenodd"/><path d="${j.d}" fill="${c?.dot?.gradient?`url(#${P})`:q(j.fill)}"/></g>`;if(I+="</g>",V?.src){let{x:B,y:X,width:j,height:$e,radius:te}=V;te>0&&(I+=`<defs><clipPath id="${M}"><rect x="${B}" y="${X}" width="${j}" height="${$e}" rx="${te}" ry="${te}"/></clipPath></defs>`),I+=`<image href="${q(V.src)}" x="${B}" y="${X}" width="${j}" height="${$e}"${te>0?` clip-path="url(#${M})"`:""}/>`}return I+="</svg>",I}var rr=`Usage: quter <text> [options]
|
|
2
|
+
import{readFile as Zt,writeFile as zt}from"fs/promises";import{extname as er,resolve as ye}from"path";import{pathToFileURL as tr}from"url";function Je(){let t=new Uint8Array(512),e=1;for(let r=0;r<256;r++)t[r]=e,e<<=1,e&256&&(e^=285);for(let r=256;r<512;r++)t[r]=t[r-255];return t}function Ze(t){let e=new Uint8Array(256);for(let r=0;r<256;r++)e[t[r]]=r;return e}var re=Je(),Y=Ze(re);function ze(t,e){return t===0||e===0?0:re[Y[t]+Y[e]]}function et(t,e){return re[Y[t]*e%255]}function tt(t){let e=[1];for(let r=0;r<t;r++){let o=[1,et(2,r)],i=new Array(e.length+o.length-1).fill(0);for(let n=0;n<e.length;n++)for(let s=0;s<o.length;s++)i[n+s]^=ze(e[n],o[s]);e=i}return Uint8Array.from(e)}var we=new Map;function rt(t){let e=we.get(t);return e||(e=tt(t),we.set(t,e)),e}function nt(t,e){let r=rt(e),o=r.length,i=t.length,n=new Uint8Array(i+e);n.set(t);for(let s=0;s<i;s++){let a=n[s];if(a!==0){let u=Y[a];for(let c=0;c<o;c++)n[s+c]^=re[Y[r[c]]+u]}}return n.slice(i)}var ot=[7,10,13,17,10,16,22,28,15,26,18,22,20,18,26,16,26,24,18,22,18,16,24,28,20,18,18,26,24,22,22,26,30,22,20,24,18,26,24,28,20,30,28,24,24,22,26,28,26,22,24,22,30,24,20,24,22,24,30,24,24,28,24,30,28,28,28,28,30,26,28,28,28,26,26,26,28,26,30,28,28,26,28,30,28,28,30,24,30,28,30,30,30,28,30,30,26,28,30,30,28,28,28,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30,30,28,30,30],it=[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],Se=[19,16,13,9,34,28,22,16,55,44,34,26,80,64,48,36,108,86,62,46,136,108,76,60,156,124,88,66,194,154,110,86,232,182,132,100,274,216,154,122,324,254,180,140,370,290,206,158,428,334,244,180,461,365,261,197,523,415,295,223,589,453,325,253,647,507,367,283,721,563,397,313,795,627,445,341,861,669,485,385,932,714,512,406,1006,782,568,442,1094,860,614,464,1174,914,664,514,1276,1e3,718,538,1370,1062,754,596,1468,1128,808,628,1531,1193,871,661,1631,1267,911,701,1735,1373,985,745,1843,1455,1033,793,1955,1541,1115,845,2071,1631,1171,901,2191,1725,1231,961,2306,1812,1286,986,2434,1914,1354,1054,2566,1992,1426,1096,2702,2102,1502,1142,2812,2216,1582,1222,2956,2334,1666,1276];function K(t,e){return Se[(t-1)*4+e]}function Me(t,e,r){let o=(e-1)*4+r,i=ot[o],n=it[o],s=Se[o],a=Math.floor(s/n),u=n-s%n,c=t instanceof Uint8Array?t:Uint8Array.from(t),l=new Array(n),f=new Array(n),h=new Array(n),b=0,m=0;for(let $=0;$<n;$++){let d=$<u?a:a+1;l[$]=b,f[$]=d,d>m&&(m=d),h[$]=nt(c.subarray(b,b+d),i),b+=d}let w=new Uint8Array(c.length+n*i),M=0;for(let $=0;$<m;$++)for(let d=0;d<n;d++)$<f[d]&&(w[M++]=c[l[d]+$]);for(let $=0;$<i;$++)for(let d=0;d<n;d++)w[M++]=h[d][$];return w}var Ae={numeric:1,alphanumeric:2,byte:4};function st(){let t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e=new Int8Array(128).fill(-1);for(let r=0;r<t.length;r++)e[t.charCodeAt(r)]=r;return e}var H=st();function ct(t){return t<128?H[t]:-1}function q(t,e){return t==="numeric"?e<=9?10:e<=26?12:14:t==="alphanumeric"?e<=9?9:e<=26?11:13:e<=9?8:16}var Ce=[[1,9],[10,26],[27,40]],at=[0,4,7];function lt(t,e){return t==="numeric"?10*Math.floor(e/3)+at[e%3]:t==="alphanumeric"?11*Math.floor(e/2)+6*(e%2):8*e}function le(t,e){let r=0;for(let o of t)r+=4+q(o.mode,e)+lt(o.mode,o.charCount);return Math.ceil(r/8)}function ae(t,e,r,o){return{mode:e,start:0,end:t.length,charCount:r,byteStart:0,byteEnd:o}}var G=0,J=1,Z=2,ut=["numeric","alphanumeric","byte"];function ft(t){return t<128?1:t<2048?2:t<65536?3:4}var Re=20,Ee=33,ve=48;function dt(t){let e=0,r=0,o=0,i=0;for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);s<128?(r++,s>=48&&s<=57?(o++,i++):H[s]>=0&&i++):s<2048?r+=2:s>=55296&&s<=56319&&(t.charCodeAt(n+1)&64512)===56320?(r+=4,n++):r+=3,e++}return{count:e,totalBytes:r,digits:o,alnums:i}}function mt(t,e){let r=new Int32Array(e),o=new Uint8Array(e),i=new Uint8Array(e),n=0;for(let s=0;s<t.length;){let a=t.codePointAt(s);r[n]=s,o[n]=ft(a),a>=48&&a<=57?i[n]=2:ct(a)>=0&&(i[n]=1),n++,s+=a>65535?2:1}return{cpIndex:r,cpBytes:o,cpClass:i}}function Le(t){let{count:e,totalBytes:r,digits:o,alnums:i}=dt(t),n=o*Re+(i-o)*Ee+(r-i)*ve,s=c=>{let l=4+Math.min(q("numeric",c),q("alphanumeric",c),q("byte",c));return Math.ceil((n/6+l)/8)},a;if(o===e?a=ae(t,"numeric",e,r):i===e&&o===0?a=ae(t,"alphanumeric",e,r):i===0&&(a=ae(t,"byte",r,r)),a){let c=[a];return{forVersion:()=>c,minDataBytes:s}}let u;return{forVersion(c){return u??=mt(t,e),gt(t,c,e,u)},minDataBytes:s}}function gt(t,e,r,{cpIndex:o,cpBytes:i,cpClass:n}){let s=(4+q("numeric",e))*6,a=(4+q("alphanumeric",e))*6,u=(4+q("byte",e))*6,c=[s,a,u],l=new Int8Array(r*3).fill(-1),f=new Float64Array(3),h=new Float64Array([s,a,u]);for(let y=0;y<r;y++){let S=y*3,x=n[y];f[G]=1/0,f[J]=1/0,f[Z]=h[Z]+i[y]*ve,l[S+Z]=Z,x!==0&&(f[J]=h[J]+Ee,l[S+J]=J),x===2&&(f[G]=h[G]+Re,l[S+G]=G);for(let g=0;g<3;g++)for(let A=0;A<3;A++){if(l[S+A]===-1)continue;let L=Math.ceil(f[A]/6)*6+c[g];(l[S+g]===-1||L<f[g])&&(f[g]=L,l[S+g]=A)}let v=h;h=f,f=v}let b=G;for(let y=1;y<3;y++)h[y]<h[b]&&(b=y);let m=new Int8Array(r),w=b;for(let y=r-1;y>=0;y--)w=l[y*3+w],m[y]=w;let M=[],$=0,d=0;for(;d<r;){let y=m[d],S=d,x=0;for(;S<r&&m[S]===y;)x+=i[S],S++;M.push({mode:ut[y],start:o[d],end:S<r?o[S]:t.length,charCount:y===Z?x:S-d,byteStart:$,byteEnd:$+x}),$+=x,d=S}return M}var bt={L:0,M:1,Q:2,H:3},pt;function ht(){return pt??=new TextEncoder}var ue=class{bytes;bitPos=0;constructor(e){this.bytes=new Uint8Array(e)}writeBits(e,r){let o=this.bitPos;for(let i=r-1;i>=0;i--)e>>i&1&&(this.bytes[o>>3]|=128>>(o&7)),o++;this.bitPos=o}get bitLength(){return this.bitPos}skipBits(e){this.bitPos+=e}alignToByte(){this.bitPos=this.bitPos+7&-8}},yt=[236,17];function xt(t,e,r,o,i){let n=new ue(o);for(let c of e)if(n.writeBits(Ae[c.mode],4),n.writeBits(c.charCount,q(c.mode,r)),c.mode==="numeric")for(let l=c.start;l<c.end;l+=3){let f=Math.min(3,c.end-l),h=t.charCodeAt(l)-48;f>=2&&(h=h*10+(t.charCodeAt(l+1)-48)),f>=3&&(h=h*10+(t.charCodeAt(l+2)-48)),n.writeBits(h,f===3?10:f===2?7:4)}else if(c.mode==="alphanumeric")for(let l=c.start;l<c.end;l+=2)if(l+1<c.end){let f=H[t.charCodeAt(l)]*45+H[t.charCodeAt(l+1)];n.writeBits(f,11)}else n.writeBits(H[t.charCodeAt(l)],6);else for(let l=c.byteStart;l<c.byteEnd;l++)n.writeBits(i[l],8);let s=o*8;if(n.bitLength>s)throw new RangeError(`encoded data (${n.bitLength} bits) exceeds capacity (${s} bits) for the selected version`);n.skipBits(Math.min(4,s-n.bitLength)),n.alignToByte();let a=n.bytes,u=0;for(let c=n.bitLength>>3;c<o;c++)a[c]=yt[u%2],u++;return a}function ke(t,e="M",r){if(typeof t!="string")throw new TypeError(`data must be a string, got ${typeof t}`);if(t.length===0)throw new RangeError("data must not be empty");let o=bt[e];if(typeof o!="number")throw new RangeError(`errorCorrectionLevel must be one of "L", "M", "Q", "H", got ${JSON.stringify(e)}`);let i=Le(t),n=b=>i.forVersion(b),s,a;if(r!==void 0){if(!Number.isInteger(r)||r<1||r>40)throw new RangeError(`version must be an integer between 1 and 40, got ${r}`);s=r,a=n(s);let b=K(s,o),m=le(a,s);if(m>b)throw new RangeError(`data too large for version ${s} with EC level "${e}" (needs ${m} bytes, capacity ${b})`)}else{let b;for(let[m,w]of Ce){if(i.minDataBytes(m)>K(w,o))continue;let M=n(m),$=le(M,m);for(let d=m;d<=w;d++)if($<=K(d,o)){b={version:d,segments:M};break}if(b)break}if(!b)throw new RangeError(`data too large for any QR version with EC level "${e}"`);s=b.version,a=b.segments}let c=a.some(b=>b.mode==="byte")?ht().encode(t):null,l=K(s,o),f=xt(t,a,s,l,c);return{codewords:Me(f,s,o),version:s,ecLevelIndex:o,segments:a}}var $t=[(t,e)=>(t+e)%2===0,(t,e)=>t%2===0,(t,e)=>e%3===0,(t,e)=>(t+e)%3===0,(t,e)=>(Math.floor(t/2)+Math.floor(e/3))%2===0,(t,e)=>t*e%2+t*e%3===0,(t,e)=>(t*e%2+t*e%3)%2===0,(t,e)=>((t+e)%2+t*e%3)%2===0];function wt(t,e){let r=t/e*100,o=Math.floor(Math.abs(r-50)/5)*10,i=Math.ceil(Math.abs(r-50)/5)*10;return Math.min(o,i)}function St(){let t=new Uint8Array(576);for(let e=0;e<8;e++){let r=$t[e];for(let o=0;o<12;o++)for(let i=0;i<6;i++)t[e*72+o*6+i]=r(o,i)?1:0}return t}var Ue=St(),Ie=1488,Pe=93,Oe=2047;function Mt(t,e,r,o,i){let{prevRow:n,colRunVal:s,colRunLen:a,colWin:u}=i;s.fill(-1),a.fill(0),u.fill(0);let c=0,l=0;for(let f=0;f<r;f++){let h=o+f%12*6,b=f*r,m=f>=10,w=0,M=-1,$=0,d=0,y=-1,S=-1;for(let x=0;x<r;x++){let v=b+x,g=t[v]^Ue[h+w]&(e[v]^1);l+=g,g===M?$++:($>=5&&(c+=$-2),M=g,$=1),d=(d<<1|g)&Oe,x>=10&&(d===Ie||d===Pe)&&(c+=40),g===s[x]?a[x]++:(a[x]>=5&&(c+=a[x]-2),s[x]=g,a[x]=1);let A=(u[x]<<1|g)&Oe;u[x]=A,m&&(A===Ie||A===Pe)&&(c+=40);let L=n[x];f>0&&x>0&&g===y&&g===L&&g===S&&(c+=3),n[x]=g,S=L,y=g,w++,w===6&&(w=0)}$>=5&&(c+=$-2)}for(let f=0;f<r;f++)a[f]>=5&&(c+=a[f]-2);return c+=wt(l,r*r),c}function At(t,e,r){let o={prevRow:new Uint8Array(r),colRunVal:new Int8Array(r),colRunLen:new Uint16Array(r),colWin:new Uint16Array(r)},i=0,n=1/0;for(let s=0;s<8;s++){let a=Mt(t,e,r,s*72,o);a<n&&(n=a,i=s)}return i}function Be(t,e,r){let o=At(t,e,r),i=o*72;for(let n=0;n<r;n++){let s=i+n%12*6,a=n*r,u=0;for(let c=0;c<r;c++)e[a+c]||(t[a+c]^=Ue[s+u]),u++,u===6&&(u=0)}return o}function Ct(t){if(t===1)return[];let e=(t/7|0)+2,r=t*4+10,o=t===32?26:Math.ceil((r-6)/(e-1)/2)*2,i=[6];for(let n=1;n<e;n++)i.push(r-(e-1-n)*o);return i}var Rt=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],Et=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017];function fe(t,e,r,o,i){for(let n=-1;n<=7;n++)for(let s=-1;s<=7;s++){let a=o+n,u=i+s;if(a<0||u<0||a>=r||u>=r)continue;let c=a*r+u;e[c]=1,n===-1||n===7||s===-1||s===7?t[c]=0:n===0||n===6||s===0||s===6||n>=2&&n<=4&&s>=2&&s<=4?t[c]=1:t[c]=0}}function vt(t,e,r,o,i){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++){let a=(o+n)*r+(i+s);e[a]=1,n===-2||n===2||s===-2||s===2||n===0&&s===0?t[a]=1:t[a]=0}}function Lt(t,e,r){for(let o=8;o<r-8;o++){let i=o%2===0?1:0,n=6*r+o,s=o*r+6;t[n]=i,t[s]=i,e[n]=1,e[s]=1}}var Te=[[8,0],[8,1],[8,2],[8,3],[8,4],[8,5],[8,7],[8,8],[7,8],[5,8],[4,8],[3,8],[2,8],[1,8],[0,8]];function kt(t,e){for(let[r,o]of Te)t[r*e+o]=1;for(let r=0;r<8;r++)t[8*e+e-1-r]=1;for(let r=0;r<7;r++)t[(e-7+r)*e+8]=1}function It(t,e,r,o){if(o<7)return;let i=Et[o-7];for(let n=0;n<18;n++){let s=i>>n&1,a=Math.floor(n/3),u=n%3,c=a*r+(r-11+u),l=(r-11+u)*r+a;t[c]=s,e[c]=1,t[l]=s,e[l]=1}}function Pt(t,e,r,o){let i=0,n=o.length*8,s=r-1,a=!0;for(;s>=0;){if(s===6){s--;continue}let u=a?r-1:0,c=a?-1:r,l=a?-1:1;for(let f=u;f!==c;f+=l){let h=f*r;for(let b=0;b<=1;b++){let m=s-b;m<0||e[h+m]||(i<n?(t[h+m]=o[i>>3]>>7-(i&7)&1,i++):t[h+m]=0)}}s-=2,a=!a}}var Ot=16,F=new Map;function ne(t,e="M",r){let o=`${e}|${r??"a"}|${t}`,i=F.get(o);if(i)return F.delete(o),F.set(o,i),i;let n=Ut(t,e,r);return F.set(o,n),F.size>Ot&&F.delete(F.keys().next().value),n}function Ut(t,e,r){let o=ke(t,e,r),{codewords:i,version:n,ecLevelIndex:s}=o,a=n*4+17,u=new Uint8Array(a*a),c=new Uint8Array(a*a);fe(u,c,a,0,0),fe(u,c,a,0,a-7),fe(u,c,a,a-7,0),Lt(u,c,a);let l=(4*n+9)*a+8;u[l]=1,c[l]=1;let f=Ct(n);for(let m of f)for(let w of f)m<=8&&w<=8||m<=8&&w>=a-8||m>=a-8&&w<=8||vt(u,c,a,m,w);It(u,c,a,n),kt(c,a),Pt(u,c,a,i);let h=Be(u,c,a),b=Rt[s*8+h];return Bt(u,b,a),{matrix:u,version:n,size:a}}function Bt(t,e,r){for(let o=0;o<15;o++){let[i,n]=Te[o];t[i*r+n]=e>>14-o&1}for(let o=0;o<8;o++)t[8*r+r-1-o]=e>>o&1;for(let o=0;o<7;o++)t[(r-7+o)*r+8]=e>>o+8&1;t[(r-8)*r+8]=1}var p=t=>Math.round(t*100)/100,R=t=>Math.round(t*100);function C(t){let e=t<0,r=e?-t:t,o=Math.floor(r/100),i=r-o*100,n;return i===0?n=String(o):i%10===0?n=`${o}.${i/10}`:i<10?n=`${o}.0${i}`:n=`${o}.${i}`,e?`-${n}`:n}function de(t,e){return t<=7||t>=e-8?7:-1}function me(t,e){return t<=7?e-8:e}function Tt(t,e,r,o){let i=C(R(r)),n=new Array(e),s=new Array(e+1),a=new Array(e+1);for(let c=0;c<=e;c++){let l=R(c*r);s[c]=C(l),a[c]=C(-l),c<e&&(n[c]=C(R(o+c*r)))}let u=[];for(let c=0;c<e;c++){let l=c*e,f=C(R(o+c*r)),h=de(c,e)+1,b=me(c,e),m=-1;for(let w=h;w<b;w++)if(t[l+w]===1)m===-1&&(m=w);else if(m!==-1){let M=w-m;u.push(`M${n[m]},${f}h${s[M]}v${i}h${a[M]}z`),m=-1}if(m!==-1){let w=b-m;u.push(`M${n[m]},${f}h${s[w]}v${i}h${a[w]}z`)}}return u.join(" ")}function qt(t,e,r,o,i){let n=p(r),s=[];if(i==="circle"){let d=n/2,y=p(d),S=`a${C(R(y))},${C(R(y))} 0 1,0 `,x=`${S}${C(R(y*2))},0${S}${C(R(-y*2))},0z`,v=new Array(e);for(let g=0;g<e;g++){let A=p(p(o+g*r)+d);v[g]=`M${C(R(A-y))},`}for(let g=0;g<e;g++){let A=g*e,L=`${C(R(p(o+g*r)+d))}${x}`,O=de(g,e)+1,E=me(g,e);for(let P=O;P<E;P++)t[A+P]===1&&s.push(v[P]+L)}return s.join(" ")}let a=p(n*.45),u=[C(R(n)),C(R(n-a)),C(R(n-2*a))],c=[C(R(-n)),C(R(-(n-a))),C(R(-(n-2*a)))],l=C(R(a)),f=C(R(-a)),h=`q${l},0 ${l},${l}`,b=`q0,${l} ${f},${l}`,m=`q${f},0 ${f},${f}`,w=`q0,${f} ${l},${f}`,M=new Array(e),$=new Array(e);for(let d=0;d<e;d++){let y=p(o+d*r);M[d]=C(R(y)),$[d]=C(R(y+a))}for(let d=0;d<e;d++){let y=d*e,S=C(R(p(o+d*r))),x=de(d,e)+1,v=me(d,e);for(let g=x;g<v;g++){if(t[y+g]!==1)continue;let A=d>0&&t[y-e+g]===1,L=g<e-1&&t[y+g+1]===1,O=d<e-1&&t[y+e+g]===1,E=g>0&&t[y+g-1]===1,P=!(A||E),D=!(A||L),k=!(O||L),U=!(O||E);s.push(`M${P?$[g]:M[g]},${S}h${u[(P?1:0)+(D?1:0)]}`+(D?h:"")+`v${u[(D?1:0)+(k?1:0)]}`+(k?b:"")+`h${c[(k?1:0)+(U?1:0)]}`+(U?m:"")+`v${c[(U?1:0)+(P?1:0)]}`+(P?w:"")+"z")}}return s.join(" ")}var Nt=2,qe=new WeakMap;function Ne(t,e,r,o,i){let n=qe.get(t);n||(n=new Map,qe.set(t,n));let s=`${r}|${o}|${i}`,a=n.get(s);if(a!==void 0)return a;let u=i==="square"?Tt(t,e,r,o):qt(t,e,r,o,i);return n.size>=Nt&&n.clear(),n.set(s,u),u}var Dt=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g;function De(t){return t.replace(Dt,"")}function se(t,e,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`[QRCode] size must be a non-negative number, got ${String(t)}`);if(!Number.isFinite(e)||e<0)throw new RangeError(`[QRCode] margin must be a non-negative number, got ${String(e)}`);let o=r+e*2,i=p(t/o);if(t>0&&i===0)throw new RangeError(`[QRCode] margin ${e} leaves no room for a ${r}-module symbol at size ${t}`);return{totalModules:o,moduleSize:i,marginPx:p(e*i),svgSize:p(i*o)}}function oe(t,e,r){let o=p(r);return`M${p(t)},${p(e)}h${o}v${o}h${-o}z`}function ie(t,e,r,o,i){let n=p(Math.min(i,r/2,o/2)),s=p(r-2*n),a=p(o-2*n);return`M${p(t+n)},${p(e)}h${s}q${n},0 ${n},${n}v${a}q0,${n} ${-n},${n}h${-s}q${-n},0 ${-n},${-n}v${-a}q0,${-n} ${n},${-n}z`}function Ft(t,e,r,o){if(o==="circle"){let i=p(r/2),n=p(i*2);return`M${p(t)},${p(e+r/2)}a${i},${i} 0 1,0 ${n},0a${i},${i} 0 1,0 ${-n},0z`}return o==="rounded"?ie(t,e,r,r,r*.3):oe(t,e,r)}function _t(t,e,r,o){let i=r/7,n=r-2*i,s=i;if(o==="square"){let c=oe(t,e,r),l=oe(t+s,e+s,n);return`${c} ${l}`}if(o==="rounded"){let c=ie(t,e,r,r,r*.15),l=oe(t+s,e+s,n);return`${c} ${l}`}if(o==="circle"){let c=t+r/2,l=p(e+r/2),f=h=>{let b=p(h),m=p(b*2);return`M${p(c-b)},${l}a${b},${b} 0 1,0 ${m},0a${b},${b} 0 1,0 ${-m},0z`};return`${f(r/2)} ${f(n/2)}`}let a=ie(t,e,r,r,r*.35),u=ie(t+s,e+s,n,n,n*.2);return`${a} ${u}`}function Fe(t,e,r,o,i){let n=p(7*r),s=p(3*r),a=p(2*r);return{square:_t(t,e,n,o),dot:Ft(p(t+a),p(e+a),s,i)}}function ge(t,e,r){return r+t*e}function _e(t,e,r){return[[0,0],[0,t-7],[t-7,0]].map(([i,n])=>({x:ge(n,e,r),y:ge(i,e,r)}))}var _={L:.0225,M:.04,Q:.0625,H:.09},Qt=_.H,Wt=.4;function be(t){return t<=_.L?"L":t<=_.M?"M":t<=_.Q?"Q":"H"}var Gt=/[\u0000-\u0020]/g;function ce(t){let e=t.replace(Gt,"").toLowerCase();return!(e.startsWith("javascript:")||e.startsWith("data:")&&!e.startsWith("data:image/"))}function We(t){return t!==void 0&&Number.isFinite(t)&&t>0?t:1}function Ge(t,e,r){let i=(t?e!==void 0?Math.max(0,Math.min(1,e)):Wt:0)*Qt;return r?{ecLevel:r,absoluteArea:Math.min(i,_[r]),targetArea:i,clamped:i>_[r]}:i>0?{ecLevel:be(i),absoluteArea:i,targetArea:i,clamped:!1}:{ecLevel:"M",absoluteArea:0,targetArea:i,clamped:!1}}function Qe(t){let e=Math.ceil(t);return Math.max(1,e%2===0?e+1:e)}var Ht={clearX:0,clearY:0,clearWidth:0,clearHeight:0,boxX:0,boxY:0,boxWidth:0,boxHeight:0};function He({absoluteArea:t,aspectRatio:e,ecLevel:r,qrSize:o,moduleSize:i,marginPx:n}){let s=o*i,a=t*s*s,u=Math.sqrt(a*e),c=Math.sqrt(a/e);if(!(u>0)||!(c>0))return Ht;let l=u/i,f=c/i,h=_[r]*o*o,b=Math.max(1,o-16),m=Math.min(Qe(l),b),w=1;for(;;){let g=Math.min(1,m/l);if(w=Math.min(Qe(f*g),b),m*w<=h||m<=1)break;m-=2}let M=Math.min(1,m/l,w/f),$=u*M,d=c*M,y=m*i,S=w*i,x=n+(o-m)/2*i,v=n+(o-w)/2*i;return{clearX:x,clearY:v,clearWidth:y,clearHeight:S,boxX:x+(y-$)/2,boxY:v+(S-d)/2,boxWidth:$,boxHeight:d}}function pe(t,e){let r=t?.square?.style??"square",o=r==="extra-rounded"?"rounded":r==="circle"?"circle":"square";return{squareStyle:r,squareColor:t?.square?.color??e,dotStyle:t?.dot?.style??o,dotColor:t?.dot?.color??e,backgroundColor:t?.backgroundColor}}function Ve(t){return t!==void 0&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):0}function Xe(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",backgroundColor:s="#ffffff",corner:a,logo:u,qr:c}=t,l=u?.src&&ce(u.src)?u.src:void 0,f=!!(l||u?.custom),h=c?.errorCorrectionLevel,{ecLevel:b,absoluteArea:m,targetArea:w,clamped:M}=Ge(f,u?.size,h),$=[];M&&$.push(`[QRCode] logo.size=${u?.size} needs ECL \u2265 "${be(w)}"; ECL "${h}" set, logo clamped.`);let{matrix:d,size:y}=ne(e,b,c?.version),{moduleSize:S,marginPx:x,svgSize:v}=se(r,o,y),g=pe(a,n),A=Ne(d,y,S,x,i),L=_e(y,S,x).map(W=>{let{square:B,dot:V}=Fe(p(W.x),p(W.y),S,g.squareStyle,g.dotStyle);return{...g.backgroundColor===void 0?{}:{background:{x:p(W.x),y:p(W.y),width:p(7*S),height:p(7*S),fill:g.backgroundColor}},square:{d:B,fill:g.squareColor,fillRule:"evenodd"},dot:{d:V,fill:g.dotColor}}}),O=(u?.margin??0)*S,E=He({absoluteArea:m,aspectRatio:We(u?.aspectRatio),ecLevel:b,qrSize:y,moduleSize:S,marginPx:x}),P=p(E.boxX+O),D=p(E.boxY+O),k=p(Math.max(0,E.boxWidth-O*2)),U=p(Math.max(0,E.boxHeight-O*2)),Q=f&&k>0&&U>0;return f&&E.boxWidth>0&&E.boxHeight>0&&(k<=0||U<=0)&&$.push(`[QRCode] logo.margin=${u?.margin} is measured in modules and leaves no room for the logo; it was not rendered.`),{size:p(r),viewBox:v,ecLevel:b,background:s==="transparent"?void 0:s,modules:A?{d:A,fill:n}:void 0,finders:L,clear:Q&&(u?.hideDots??!0)?{x:p(E.clearX),y:p(E.clearY),width:p(E.clearWidth),height:p(E.clearHeight),radius:p(Ve(u?.radius)*Math.min(E.clearWidth,E.clearHeight)/2)}:void 0,logo:Q?{src:l,x:P,y:D,width:k,height:U,radius:p(Ve(u?.radius)*Math.min(k,U)/2)}:void 0,warnings:$}}function z(t,e){return`${t}${e}`}function Vt(t){let e=t.angle??0;return Number.isFinite(e)?(e%360+360)%360:0}function Xt(t){let e=Vt(t)*Math.PI/180,r=Math.cos(e)/2,o=Math.sin(e)/2;return{x1:`${Math.round((.5-r)*100)}%`,y1:`${Math.round((.5-o)*100)}%`,x2:`${Math.round((.5+r)*100)}%`,y2:`${Math.round((.5+o)*100)}%`}}function ee(t,e){let{x1:r,y1:o,x2:i,y2:n}=Xt(e);return`<linearGradient id="${t}" x1="${r}" y1="${o}" x2="${i}" y2="${n}"><stop offset="0%" stop-color="${je(e.startColor)}"/><stop offset="100%" stop-color="${je(e.endColor)}"/></linearGradient>`}function je(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function jt(t){let e=2166136261,r=16777619;for(let o=0;o<t.length;o++){let i=t.charCodeAt(o);e=Math.imul(e^i,16777619),r=Math.imul(r^i,2246822507)}return(e>>>0).toString(36)+(r>>>0).toString(36)}function N(t){return De(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var Ye=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]),Yt=["WebkitAnimationIterationCount","msAnimationIterationCount","MozAnimationIterationCount","WebkitBoxFlex","MozBoxFlex","MozBoxFlexGroup","WebkitBoxOrdinalGroup","WebkitColumnCount","WebkitColumns","WebkitFlex","msFlex","WebkitFlexGrow","msFlexGrow","WebkitFlexPositive","msFlexPositive","WebkitFlexShrink","msFlexShrink","msFlexNegative","msFlexOrder","msGridRow","msGridRowSpan","msGridColumn","msGridColumnSpan","WebkitLineClamp","MozLineClamp","msZoom"];for(let t of Yt)Ye.add(t);function Kt(t){return t.startsWith("--")?t:t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^ms-/,"-ms-")}function Jt(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,r])=>{let i=typeof r=="number"&&r!==0&&!Ye.has(e)&&!e.startsWith("--")?`${r}px`:String(r);return`${Kt(e)}:${i}`}).join(";")}function he(t){let{value:e,size:r=256,margin:o=4,dotStyle:i="square",dotColor:n="#000000",dotGradient:s,backgroundColor:a="#ffffff",backgroundGradient:u,corner:c,logo:l,qr:f,className:h,style:b,ariaLabel:m,idPrefix:w}=t,M=Xe(t),$=pe(c,n),d=l?.src&&ce(l.src)?l.src:void 0,y=(w??"qr").replace(/[^A-Za-z0-9_-]/g,"")||"qr",S=[e,r,o,i,n,JSON.stringify(s??null),a,JSON.stringify(u??null),$.squareStyle,$.squareColor,$.dotStyle,$.dotColor,c?.backgroundColor??"",JSON.stringify(c?.square?.gradient??null),JSON.stringify(c?.dot?.gradient??null),M.ecLevel,f?.version??"",d??"",l?.size??"",l?.aspectRatio??"",l?.margin??"",l?.hideDots??"",h??"",m??"",w??""];l?.radius!==void 0&&S.push(l.radius),l?.custom&&S.push("custom");let x=`${y}${jt(S.join("\0"))}`,v=`${x}t`,g=`${x}m`,A=`${x}c`,L=z(x,"d"),O=z(x,"b"),E=z(x,"s"),P=z(x,"p"),{size:D,viewBox:k,background:U,modules:Q,finders:W}=M,{clear:B,logo:V}=M,I=`<svg role="img" aria-labelledby="${v}" width="${D}" height="${D}" viewBox="0 0 ${k} ${k}" xmlns="http://www.w3.org/2000/svg"`;h&&(I+=` class="${N(h)}"`),b&&(I+=` style="${N(Jt(b))}"`),I+=">",I+=`<title id="${v}">${N(m??`QR code: ${e}`)}</title>`;let xe=[s&&ee(L,s),u&&ee(O,u),c?.square?.gradient&&ee(E,c.square.gradient),c?.dot?.gradient&&ee(P,c.dot.gradient)].filter(Boolean);xe.length&&(I+=`<defs>${xe.join("")}</defs>`),U!==void 0&&(I+=`<rect width="${k}" height="${k}" fill="${u?`url(#${O})`:N(U)}"/>`),B&&(I+=`<defs><mask id="${g}"><rect width="${k}" height="${k}" fill="white"/><rect x="${B.x}" y="${B.y}" width="${B.width}" height="${B.height}" rx="${B.radius}" ry="${B.radius}" fill="black"/></mask></defs>`),I+=`<g${B?` mask="url(#${g})"`:""}>`,Q&&(I+=`<path d="${Q.d}" fill="${s?`url(#${L})`:N(Q.fill)}"/>`);for(let{background:T,square:X,dot:j}of W)I+="<g>"+(T?`<rect x="${T.x}" y="${T.y}" width="${T.width}" height="${T.height}" fill="${N(T.fill)}"/>`:"")+`<path d="${X.d}" fill="${c?.square?.gradient?`url(#${E})`:N(X.fill)}" fill-rule="evenodd"/><path d="${j.d}" fill="${c?.dot?.gradient?`url(#${P})`:N(j.fill)}"/></g>`;if(I+="</g>",V?.src){let{x:T,y:X,width:j,height:$e,radius:te}=V;te>0&&(I+=`<defs><clipPath id="${A}"><rect x="${T}" y="${X}" width="${j}" height="${$e}" rx="${te}" ry="${te}"/></clipPath></defs>`),I+=`<image href="${N(V.src)}" x="${T}" y="${X}" width="${j}" height="${$e}"${te>0?` clip-path="url(#${A})"`:""}/>`}return I+="</svg>",I}var rr=`Usage: quter <text> [options]
|
|
3
3
|
|
|
4
4
|
Options:
|
|
5
5
|
-o, --output <file> Write SVG to a file (default: stdout)
|
|
@@ -19,6 +19,6 @@ Options:
|
|
|
19
19
|
--corner-dot-color <color>
|
|
20
20
|
Inner finder-pattern dot color
|
|
21
21
|
-h, --help Show this help
|
|
22
|
-
`,nr={".gif":"image/gif",".jpeg":"image/jpeg",".jpg":"image/jpeg",".png":"image/png",".svg":"image/svg+xml",".webp":"image/webp"};function or(t){return t==="square"||t==="rounded"||t==="extra-rounded"||t==="circle"}function ir(t){return t==="square"||t==="rounded"||t==="circle"}function sr(t){return t==="square"||t==="circle"||t==="rounded"}function cr(t){let e={help:!1},r=!1,o=(i,n)=>{let s=t[n+1];if(s===void 0||s.startsWith("--"))throw new Error(`Missing value for ${i}.`);return s};for(let i=0;i<t.length;i+=1){let n=t[i];if(n==="--"){r=!0;continue}if(!r&&(n==="--help"||n==="-h"))return e.help=!0,e;if(!r&&(n==="--output"||n==="-o")){e.output=o(n,i),i+=1;continue}if(!r&&n==="--logo"){e.logoPath=o(n,i),i+=1;continue}if(!r&&n==="--image"){e.imagePath=o(n,i),i+=1;continue}if(!r&&n==="--logo-size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<0||s>1)throw new Error("--logo-size must be between 0 and 1.");e.logoSize=s,i+=1;continue}if(!r&&n==="--image-dot-size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<0||s>1)throw new Error("--image-dot-size must be between 0 and 1.");e.imageDotSize=s,i+=1;continue}if(!r&&n==="--size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<=0)throw new Error("--size must be a positive number.");e.size=s,i+=1;continue}if(!r&&n==="--dot-style"){let s=o(n,i);if(!sr(s))throw new Error("--dot-style must be square, circle, or rounded.");e.dotStyle=s,i+=1;continue}if(!r&&n==="--dot-color"){e.dotColor=o(n,i),i+=1;continue}if(!r&&n==="--background-color"){e.backgroundColor=o(n,i),i+=1;continue}if(!r&&n==="--corner-style"){let s=o(n,i);if(!or(s))throw new Error("--corner-style must be square, rounded, extra-rounded, or circle.");e.corner={...e.corner,square:{...e.corner?.square,style:s}},i+=1;continue}if(!r&&n==="--corner-color"){let s=o(n,i);e.corner={...e.corner,square:{...e.corner?.square,color:s}},i+=1;continue}if(!r&&n==="--corner-dot-style"){let s=o(n,i);if(!ir(s))throw new Error("--corner-dot-style must be square, rounded, or circle.");e.corner={...e.corner,dot:{...e.corner?.dot,style:s}},i+=1;continue}if(!r&&n==="--corner-dot-color"){let s=o(n,i);e.corner={...e.corner,dot:{...e.corner?.dot,color:s}},i+=1;continue}if(!r&&n.startsWith("-"))throw new Error(`Unknown option: ${n}`);if(e.value!==void 0)throw new Error("Provide only one text value to encode.");e.value=n}if(!e.value?.trim())throw new Error("Provide the text or URL to encode.");return e}async function
|
|
22
|
+
`,nr={".gif":"image/gif",".jpeg":"image/jpeg",".jpg":"image/jpeg",".png":"image/png",".svg":"image/svg+xml",".webp":"image/webp"};function or(t){return t==="square"||t==="rounded"||t==="extra-rounded"||t==="circle"}function ir(t){return t==="square"||t==="rounded"||t==="circle"}function sr(t){return t==="square"||t==="circle"||t==="rounded"}function cr(t){let e={help:!1},r=!1,o=(i,n)=>{let s=t[n+1];if(s===void 0||s.startsWith("--"))throw new Error(`Missing value for ${i}.`);return s};for(let i=0;i<t.length;i+=1){let n=t[i];if(n==="--"){r=!0;continue}if(!r&&(n==="--help"||n==="-h"))return e.help=!0,e;if(!r&&(n==="--output"||n==="-o")){e.output=o(n,i),i+=1;continue}if(!r&&n==="--logo"){e.logoPath=o(n,i),i+=1;continue}if(!r&&n==="--image"){e.imagePath=o(n,i),i+=1;continue}if(!r&&n==="--logo-size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<0||s>1)throw new Error("--logo-size must be between 0 and 1.");e.logoSize=s,i+=1;continue}if(!r&&n==="--image-dot-size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<0||s>1)throw new Error("--image-dot-size must be between 0 and 1.");e.imageDotSize=s,i+=1;continue}if(!r&&n==="--size"){let s=Number(o(n,i));if(!Number.isFinite(s)||s<=0)throw new Error("--size must be a positive number.");e.size=s,i+=1;continue}if(!r&&n==="--dot-style"){let s=o(n,i);if(!sr(s))throw new Error("--dot-style must be square, circle, or rounded.");e.dotStyle=s,i+=1;continue}if(!r&&n==="--dot-color"){e.dotColor=o(n,i),i+=1;continue}if(!r&&n==="--background-color"){e.backgroundColor=o(n,i),i+=1;continue}if(!r&&n==="--corner-style"){let s=o(n,i);if(!or(s))throw new Error("--corner-style must be square, rounded, extra-rounded, or circle.");e.corner={...e.corner,square:{...e.corner?.square,style:s}},i+=1;continue}if(!r&&n==="--corner-color"){let s=o(n,i);e.corner={...e.corner,square:{...e.corner?.square,color:s}},i+=1;continue}if(!r&&n==="--corner-dot-style"){let s=o(n,i);if(!ir(s))throw new Error("--corner-dot-style must be square, rounded, or circle.");e.corner={...e.corner,dot:{...e.corner?.dot,style:s}},i+=1;continue}if(!r&&n==="--corner-dot-color"){let s=o(n,i);e.corner={...e.corner,dot:{...e.corner?.dot,color:s}},i+=1;continue}if(!r&&n.startsWith("-"))throw new Error(`Unknown option: ${n}`);if(e.value!==void 0)throw new Error("Provide only one text value to encode.");e.value=n}if(!e.value?.trim())throw new Error("Provide the text or URL to encode.");return e}async function Ke(t){let e=ye(t),r=nr[er(e).toLowerCase()];if(!r)throw new Error(`Unsupported image format: ${t}`);let o=await Zt(e);return`data:${r};base64,${o.toString("base64")}`}function ar(t,e,r,o){let{matrix:i,size:n}=ne(r,"H",o.qr?.version),s=se(o.size??256,o.margin??4,n),a=s.moduleSize,u=o.imageDotSize??.4,c=(1-u)/2,l=[];if(u>0)for(let S=0;S<n;S+=1)for(let x=0;x<n;x+=1){let v=s.marginPx+x*a+c*a,g=s.marginPx+S*a+c*a,A=a*u;l.push(`<rect x="${v}" y="${g}" width="${A}" height="${A}" fill="${i[S*n+x]?"#000000":"#ffffff"}"/>`)}let h=/<path d="[^"]*" fill="[^"]*"\/>/.exec(t);if(!h||h.index===void 0)throw new Error("Unable to prepare QR modules for image blending.");let b=t.lastIndexOf("<g",h.index),m=t.indexOf(">",b)+1,w=t.slice(0,h.index)+t.slice(h.index+h[0].length),M=s.marginPx,$=n*a,d=`<image href="${e}" x="${M}" y="${M}" width="${$}" height="${$}" preserveAspectRatio="xMidYMid slice"/>`+l.join(""),y=[[0,0],[n-8,0],[0,n-8]].map(([S,x])=>`<rect x="${M+S*a}" y="${M+x*a}" width="${8*a}" height="${8*a}" fill="#ffffff"/>`).join("");return w.slice(0,m)+d+y+w.slice(m)}async function lr(t){let e=cr(t);if(e.help){process.stdout.write(rr);return}let{value:r,output:o,logoPath:i,logoSize:n,imagePath:s,imageDotSize:a,help:u,...c}=e;i&&(c.logo={src:await Ke(i),size:n}),s&&((c.backgroundColor===void 0||c.backgroundColor==="transparent")&&(c.backgroundColor="#ffffff"),c.qr={errorCorrectionLevel:"H",...c.qr});let l=he({...c,value:r}),f=s?ar(l,await Ke(s),r,e):l;if(o){let h=ye(o);await zt(h,f,"utf8"),process.stdout.write(`Wrote ${h}
|
|
23
23
|
`);return}process.stdout.write(f)}process.argv[1]&&import.meta.url===tr(ye(process.argv[1])).href&&lr(process.argv.slice(2)).catch(t=>{process.stderr.write(`quter: ${t instanceof Error?t.message:String(t)}
|
|
24
24
|
`),process.exitCode=1});export{cr as parseCliArgs};
|
package/dist/core/types.d.ts
CHANGED
|
@@ -155,7 +155,9 @@ export interface QRGeometry {
|
|
|
155
155
|
/** The three finder patterns: top left, top right, bottom left. */
|
|
156
156
|
finders: QRFinder[];
|
|
157
157
|
/** Area to cut out of `modules` and `finders`, present when dots hide behind the logo. */
|
|
158
|
-
clear?: QRRect
|
|
158
|
+
clear?: QRRect & {
|
|
159
|
+
radius: number;
|
|
160
|
+
};
|
|
159
161
|
/** Present when a logo is drawn. */
|
|
160
162
|
logo?: QRLogoGeometry;
|
|
161
163
|
/** Developer-facing notes, such as a logo that was clamped to fit. */
|