qrdx 0.0.60 → 0.0.62
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/README.md +3 -2
- package/dist/angular.js +7 -2
- package/dist/angular.js.map +1 -1
- package/dist/angular.mjs +7 -2
- package/dist/angular.mjs.map +1 -1
- package/dist/core.js +7 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -7
- package/dist/core.mjs.map +1 -1
- package/dist/element.browser.mjs +6 -6
- package/dist/element.browser.mjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/element.js.map +1 -1
- package/dist/element.mjs +1 -1
- package/dist/element.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +2 -2
- package/dist/node.mjs.map +1 -1
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/dist/src/angular.d.ts +2 -1
- package/dist/src/api.d.ts +2 -3
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/element.d.ts +2 -0
- package/dist/src/element.d.ts.map +1 -1
- package/dist/src/helpers.d.ts +2 -2
- package/dist/src/helpers.d.ts.map +1 -1
- package/dist/src/logo-budget.d.ts +3 -1
- package/dist/src/logo-budget.d.ts.map +1 -1
- package/dist/src/looks.d.ts +2 -2
- package/dist/src/looks.d.ts.map +1 -1
- package/dist/src/plain.d.ts.map +1 -1
- package/dist/src/print.d.ts.map +1 -1
- package/dist/src/qr-code-canvas.d.ts +2 -8
- package/dist/src/qr-code-canvas.d.ts.map +1 -1
- package/dist/src/qr-code-props.d.ts +1 -1
- package/dist/src/qr-code-props.d.ts.map +1 -1
- package/dist/src/qr-code-svg.d.ts +2 -3
- package/dist/src/qr-code-svg.d.ts.map +1 -1
- package/dist/src/qr-code.d.ts +2 -2
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/qr-frame-svg.d.ts +2 -3
- package/dist/src/qr-frame-svg.d.ts.map +1 -1
- package/dist/src/rasterize.d.ts +8 -0
- package/dist/src/rasterize.d.ts.map +1 -1
- package/dist/src/react-elements.d.ts.map +1 -1
- package/dist/src/scan-score.d.ts +34 -0
- package/dist/src/scan-score.d.ts.map +1 -1
- package/dist/src/symbol.d.ts +13 -0
- package/dist/src/symbol.d.ts.map +1 -0
- package/dist/src/utils/print-shared.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/vue.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/qr.d.ts +2 -0
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/react.d.ts +21 -3
- package/dist/types/react.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +16 -16
- package/dist/vanilla.browser.mjs.map +1 -1
- package/dist/vue.js +1 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +1 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +4 -6
- package/src/angular.ts +2 -0
- package/src/api.tsx +3 -4
- package/src/element.ts +3 -0
- package/src/helpers.ts +27 -10
- package/src/logo-budget.ts +9 -8
- package/src/looks.ts +17 -14
- package/src/plain.tsx +5 -7
- package/src/print.ts +3 -6
- package/src/qr-code-canvas.tsx +39 -34
- package/src/qr-code-props.ts +4 -0
- package/src/qr-code-svg.tsx +3 -4
- package/src/qr-code.tsx +7 -5
- package/src/qr-frame-svg.tsx +3 -4
- package/src/rasterize.ts +14 -1
- package/src/react-elements.ts +40 -2
- package/src/scan-score.ts +225 -51
- package/src/symbol.ts +27 -0
- package/src/utils/print-shared.ts +5 -9
- package/src/utils.tsx +9 -9
- package/src/vue.ts +1 -0
- package/types/qr.ts +6 -0
- package/types/react.ts +22 -3
package/dist/qr-code-canvas.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{useEffect as Li,useRef as Lr,useState as _i}from"react";var ge;(l=>{class e{constructor(i,s,c,u){this.version=i;this.errorCorrectionLevel=s;if(i<e.MIN_VERSION||i>e.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let d=this.addEccAndInterleave(c);if(this.drawCodewords(d),u==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);let p=this.getPenaltyScore();p<h&&(u=b,h=p),this.applyMask(b)}}o(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(i,s){let c=l.QrSegment.makeSegments(i);return e.encodeSegments(c,s)}static encodeBinary(i,s){let c=l.QrSegment.makeBytes(i);return e.encodeSegments([c],s)}static encodeSegments(i,s,c=1,u=40,m=-1,d=!0){if(!(e.MIN_VERSION<=c&&c<=u&&u<=e.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,b;for(h=c;;h++){let x=e.getNumDataCodewords(h,s)*8,E=r.getTotalBits(i,h);if(E<=x){b=E;break}if(h>=u)throw new RangeError("Data too long")}for(let x of[e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])d&&b<=e.getNumDataCodewords(h,x)*8&&(s=x);let p=[];for(let x of i){t(x.mode.modeBits,4,p),t(x.numChars,x.mode.numCharCountBits(h),p);for(let E of x.getData())p.push(E)}o(p.length==b);let g=e.getNumDataCodewords(h,s)*8;o(p.length<=g),t(0,Math.min(4,g-p.length),p),t(0,(8-p.length%8)%8,p),o(p.length%8==0);for(let x=236;p.length<g;x^=253)t(x,8,p);let f=[];for(;f.length*8<p.length;)f.push(0);return p.forEach((x,E)=>f[E>>>3]|=x<<7-(E&7)),new e(h,s,f,m)}size;mask;modules=[];isFunction=[];getModule(i,s){return 0<=i&&i<this.size&&0<=s&&s<this.size&&this.modules[s][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let i=this.getAlignmentPatternPositions(),s=i.length;for(let c=0;c<s;c++)for(let u=0;u<s;u++)c==0&&u==0||c==0&&u==s-1||c==s-1&&u==0||this.drawAlignmentPattern(i[c],i[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){let s=this.errorCorrectionLevel.formatBits<<3|i,c=s;for(let m=0;m<10;m++)c=c<<1^(c>>>9)*1335;let u=(s<<10|c)^21522;o(u>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(u,m));this.setFunctionModule(8,7,n(u,6)),this.setFunctionModule(8,8,n(u,7)),this.setFunctionModule(7,8,n(u,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(u,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(u,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(u,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let c=0;c<12;c++)i=i<<1^(i>>>11)*7973;let s=this.version<<12|i;o(s>>>18==0);for(let c=0;c<18;c++){let u=n(s,c),m=this.size-11+c%3,d=Math.floor(c/3);this.setFunctionModule(m,d,u),this.setFunctionModule(d,m,u)}}drawFinderPattern(i,s){for(let c=-4;c<=4;c++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(c)),d=i+u,h=s+c;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,m!=2&&m!=4)}}drawAlignmentPattern(i,s){for(let c=-2;c<=2;c++)for(let u=-2;u<=2;u++)this.setFunctionModule(i+u,s+c,Math.max(Math.abs(u),Math.abs(c))!=1)}setFunctionModule(i,s,c){this.modules[s][i]=c,this.isFunction[s][i]=!0}addEccAndInterleave(i){let s=this.version,c=this.errorCorrectionLevel;if(i.length!=e.getNumDataCodewords(s,c))throw new RangeError("Invalid argument");let u=e.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][s],m=e.ECC_CODEWORDS_PER_BLOCK[c.ordinal][s],d=Math.floor(e.getNumRawDataModules(s)/8),h=u-d%u,b=Math.floor(d/u),p=[],g=e.reedSolomonComputeDivisor(m);for(let x=0,E=0;x<u;x++){let A=i.slice(E,E+b-m+(x<h?0:1));E+=A.length;let M=e.reedSolomonComputeRemainder(A,g);x<h&&A.push(0),p.push(A.concat(M))}let f=[];for(let x=0;x<p[0].length;x++)p.forEach((E,A)=>{(x!=b-m||A>=h)&&f.push(E[x])});return o(f.length==d),f}drawCodewords(i){if(i.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){let d=c-m,b=(c+1&2)==0?this.size-1-u:u;!this.isFunction[b][d]&&s<i.length*8&&(this.modules[b][d]=n(i[s>>>3],7-(s&7)),s++)}}o(s==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let c=0;c<this.size;c++){let u;switch(i){case 0:u=(c+s)%2==0;break;case 1:u=s%2==0;break;case 2:u=c%3==0;break;case 3:u=(c+s)%3==0;break;case 4:u=(Math.floor(c/3)+Math.floor(s/2))%2==0;break;case 5:u=c*s%2+c*s%3==0;break;case 6:u=(c*s%2+c*s%3)%2==0;break;case 7:u=((c+s)%2+c*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][c]&&u&&(this.modules[s][c]=!this.modules[s][c])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[m][p]==d?(h++,h==5?i+=e.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*e.PENALTY_N3),d=this.modules[m][p],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*e.PENALTY_N3}for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][m]==d?(h++,h==5?i+=e.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*e.PENALTY_N3),d=this.modules[p][m],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*e.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let d=0;d<this.size-1;d++){let h=this.modules[m][d];h==this.modules[m][d+1]&&h==this.modules[m+1][d]&&h==this.modules[m+1][d+1]&&(i+=e.PENALTY_N2)}let s=0;for(let m of this.modules)s=m.reduce((d,h)=>d+(h?1:0),s);let c=this.size*this.size,u=Math.ceil(Math.abs(s*20-c*10)/c)-1;return o(0<=u&&u<=9),i+=u*e.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{let i=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2,c=[6];for(let u=this.size-7;c.length<i;u-=s)c.splice(1,0,u);return c}}static getNumRawDataModules(i){if(i<e.MIN_VERSION||i>e.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*i+128)*i+64;if(i>=2){let c=Math.floor(i/7)+2;s-=(25*c-10)*c-55,i>=7&&(s-=36)}return o(208<=s&&s<=29648),s}static getNumDataCodewords(i,s){return Math.floor(e.getNumRawDataModules(i)/8)-e.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i]*e.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let s=[];for(let u=0;u<i-1;u++)s.push(0);s.push(1);let c=1;for(let u=0;u<i;u++){for(let m=0;m<s.length;m++)s[m]=e.reedSolomonMultiply(s[m],c),m+1<s.length&&(s[m]^=s[m+1]);c=e.reedSolomonMultiply(c,2)}return s}static reedSolomonComputeRemainder(i,s){let c=s.map(u=>0);for(let u of i){let m=u^c.shift();c.push(0),s.forEach((d,h)=>c[h]^=e.reedSolomonMultiply(d,m))}return c}static reedSolomonMultiply(i,s){if(i>>>8||s>>>8)throw new RangeError("Byte out of range");let c=0;for(let u=7;u>=0;u--)c=c<<1^(c>>>7)*285,c^=(s>>>u&1)*i;return o(c>>>8==0),c}finderPenaltyCountPatterns(i){let s=i[1];o(s<=this.size*3);let c=s>0&&i[2]==s&&i[3]==s*3&&i[4]==s&&i[5]==s;return(c&&i[0]>=s*4&&i[6]>=s?1:0)+(c&&i[6]>=s*4&&i[0]>=s?1:0)}finderPenaltyTerminateAndCount(i,s,c){return i&&(this.finderPenaltyAddHistory(s,c),s=0),s+=this.size,this.finderPenaltyAddHistory(s,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(i,s){s[0]==0&&(i+=this.size),s.pop(),s.unshift(i)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}l.QrCode=e;function t(a,i,s){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let c=i-1;c>=0;c--)s.push(a>>>c&1)}function n(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}class r{constructor(i,s,c){this.mode=i;this.numChars=s;this.bitData=c;if(s<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}mode;numChars;bitData;static makeBytes(i){let s=[];for(let c of i)t(c,8,s);return new r(r.Mode.BYTE,i.length,s)}static makeNumeric(i){if(!r.isNumeric(i))throw new RangeError("String contains non-numeric characters");let s=[];for(let c=0;c<i.length;){let u=Math.min(i.length-c,3);t(parseInt(i.substr(c,u),10),u*3+1,s),c+=u}return new r(r.Mode.NUMERIC,i.length,s)}static makeAlphanumeric(i){if(!r.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],c;for(c=0;c+2<=i.length;c+=2){let u=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c))*45;u+=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c+1)),t(u,11,s)}return c<i.length&&t(r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)),6,s),new r(r.Mode.ALPHANUMERIC,i.length,s)}static makeSegments(i){return i==""?[]:r.isNumeric(i)?[r.makeNumeric(i)]:r.isAlphanumeric(i)?[r.makeAlphanumeric(i)]:[r.makeBytes(r.toUtf8ByteArray(i))]}static makeEci(i){let s=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)t(i,8,s);else if(i<16384)t(2,2,s),t(i,14,s);else if(i<1e6)t(6,3,s),t(i,21,s);else throw new RangeError("ECI assignment value out of range");return new r(r.Mode.ECI,0,s)}static isNumeric(i){return r.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return r.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,s){let c=0;for(let u of i){let m=u.mode.numCharCountBits(s);if(u.numChars>=1<<m)return 1/0;c+=4+m+u.bitData.length}return c}static toUtf8ByteArray(i){i=encodeURI(i);let s=[];for(let c=0;c<i.length;c++)i.charAt(c)!="%"?s.push(i.charCodeAt(c)):(s.push(parseInt(i.substr(c+1,2),16)),c+=2);return s}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}l.QrSegment=r})(ge||={});(t=>{let e;(o=>{class n{constructor(l,a){this.ordinal=l;this.formatBits=a}ordinal;formatBits;static LOW=new n(0,1);static MEDIUM=new n(1,0);static QUARTILE=new n(2,3);static HIGH=new n(3,2)}o.Ecc=n})(e=t.QrCode||={})})(ge||={});(t=>{let e;(o=>{class n{constructor(l,a){this.modeBits=l;this.numBitsCharCount=a}modeBits;numBitsCharCount;static NUMERIC=new n(1,[10,12,14]);static ALPHANUMERIC=new n(2,[9,11,13]);static BYTE=new n(4,[8,16,16]);static KANJI=new n(8,[8,10,12]);static ECI=new n(7,[0,0,0]);numCharCountBits(l){return this.numBitsCharCount[Math.floor((l+7)/17)]}}o.Mode=n})(e=t.QrSegment||={})})(ge||={});var H=ge;var te={L:H.QrCode.Ecc.LOW,M:H.QrCode.Ecc.MEDIUM,Q:H.QrCode.Ecc.QUARTILE,H:H.QrCode.Ecc.HIGH},Ge=128,be="Q",ne="#FFFFFF",Qe="#000000";var ze=0;var Ye=.1;var Ce=24;var Xt=.5,Le=1.5;var Zt=.07;var jt=3,ht=64,pt=8,Kt=.42;var Jt=.5,en=2;var tn="#d1d5db";function $r(e,t=3){let n=10**t;return Math.round(e*n)/n+0}function y(e,t=3){return String($r(e,t))}function We(e,...t){let n=e[0]??"";for(let o=0;o<t.length;o++){let r=t[o];n+=(typeof r=="number"?y(r):r)+(e[o+1]??"")}return n}var kr={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Nr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,gt=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function _e(e,t=Number.POSITIVE_INFINITY){if(!Nr.test(e))return null;let n=[],o=0,r=()=>{for(;o<e.length&&/[\s,]/.test(e[o]);)o++},l=()=>{r(),gt.lastIndex=o;let s=gt.exec(e);if(!s)return null;let c=s[0],u=c.indexOf(".");if(u>=0&&c.length-u-1>t)return null;o=gt.lastIndex;let m=Number(c);return Number.isFinite(m)?m:null},a=()=>{r();let s=e[o];return s==="0"||s==="1"?(o++,s==="1"?1:0):null},i=()=>(r(),o<e.length&&/[0-9.+-]/.test(e[o]));for(r();o<e.length;){let s=e[o],c=s.toUpperCase(),u=kr[c];if(u===void 0||n.length===0&&c!=="M")return null;if(o++,u===0){n.push({command:s,values:[]}),r();continue}let m=s,d=!0;for(;d||i();){let h=[];for(let b=0;b<u;b++){let p=c==="A"&&(b===3||b===4)?a():l();if(p===null)return null;h.push(p)}n.push({command:m,values:h}),c==="M"&&(m=s==="M"?"L":"l"),d=!1}r()}return n}function nn(e){let t=0;for(let{command:n}of e)t+=n.toUpperCase()==="A"?4:1;return t}function bt(e,t=1,n=0,o=0){let r="";for(let{command:l,values:a}of e){let i=l.toUpperCase(),s=l===i,c=s?n:0,u=s?o:0,m;switch(i){case"Z":m=[];break;case"H":m=[y(a[0]*t+c)];break;case"V":m=[y(a[0]*t+u)];break;case"A":m=[y(Math.abs(a[0])*t),y(Math.abs(a[1])*t),y(a[2]),String(a[3]),String(a[4]),y(a[5]*t+c),y(a[6]*t+u)];break;default:m=a.map((d,h)=>y(d*t+(h%2===0?c:u)))}r+=l+m.join(" ")}return r}function on(e,t=.25){let n=[],o=[],r=[0,0],l=[0,0],a=()=>{o.length>2&&n.push(o),o=[]};for(let i of e)if(i.op==="M")a(),r=[i.x,i.y],l=r,o.push(r);else if(i.op==="L")l=[i.x,i.y],o.push(l);else if(i.op==="C"){let s=l,c=[i.x1,i.y1],u=[i.x2,i.y2],m=[i.x,i.y],d=Math.hypot(c[0]-s[0],c[1]-s[1])+Math.hypot(u[0]-c[0],u[1]-c[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),h=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(d/(4*t)))));for(let b=1;b<=h;b++){let p=b/h,g=1-p;o.push([g*g*g*s[0]+3*g*g*p*c[0]+3*g*p*p*u[0]+p*p*p*m[0],g*g*g*s[1]+3*g*g*p*c[1]+3*g*p*p*u[1]+p*p*p*m[1]])}l=m}else a(),l=r;return a(),n}function Ve(e,t){let n=[r=>r[0]-t.x0,r=>t.x1-r[0],r=>r[1]-t.y0,r=>t.y1-r[1]],o=e;for(let r of n){if(o.length===0)break;let l=o;o=[];for(let a=0;a<l.length;a++){let i=l[a],s=l[(a+l.length-1)%l.length],c=r(i),u=r(s);c>=0?(u<0&&o.push(rn(s,i,u,c)),o.push(i)):u>=0&&o.push(rn(s,i,u,c))}}return o.length>2?o:[]}function rn(e,t,n,o){let r=n/(n-o);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function sn(e){return e.filter(t=>t.length>2).map(t=>`M${t.map(([n,o])=>`${y(n)} ${y(o)}`).join("L")}Z`).join("")}function an(e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=(a,i)=>{t=Math.min(t,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i)};for(let a of e)a.op==="C"?(l(a.x1,a.y1),l(a.x2,a.y2),l(a.x,a.y)):a.op!=="Z"&&l(a.x,a.y);return Number.isFinite(t)?{x0:t,y0:n,x1:o,y1:r}:null}var yt=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Or(e,t,n,o,r,l,a,i,s){if(e===i&&t===s)return[];let c=Math.abs(n),u=Math.abs(o);if(c===0||u===0)return[{op:"L",x:i,y:s}];let m=r*Math.PI/180,d=Math.cos(m),h=Math.sin(m),b=(e-i)/2,p=(t-s)/2,g=d*b+h*p,f=-h*b+d*p,x=g*g/(c*c)+f*f/(u*u);x>1&&(c*=Math.sqrt(x),u*=Math.sqrt(x));let E=c*c*u*u-c*c*f*f-u*u*g*g,A=c*c*f*f+u*u*g*g,M=(l===a?-1:1)*Math.sqrt(Math.max(0,E/A)),S=M*c*f/u,R=-M*u*g/c,C=d*S-h*R+(e+i)/2,$=h*S+d*R+(t+s)/2,B=(G,O,k,ee)=>Math.atan2(G*ee-O*k,G*k+O*ee),q=B(1,0,(g-S)/c,(f-R)/u),W=B((g-S)/c,(f-R)/u,(-g-S)/c,(-f-R)/u);!a&&W>0?W-=2*Math.PI:a&&W<0&&(W+=2*Math.PI);let V=Math.max(1,Math.ceil(Math.abs(W)/(Math.PI/2)-1e-9)),se=W/V,Me=4/3*Math.tan(se/4),Ae=(G,O)=>[C+c*d*G-u*h*O,$+c*h*G+u*d*O],J=[];for(let G=0;G<V;G++){let O=q+G*se,k=O+se,[ee,Re]=Ae(Math.cos(O)-Me*Math.sin(O),Math.sin(O)+Me*Math.cos(O)),[Fe,Be]=Ae(Math.cos(k)+Me*Math.sin(k),Math.sin(k)-Me*Math.cos(k)),[Qt,mt]=G===V-1?[i,s]:Ae(Math.cos(k),Math.sin(k));J.push({op:"C",x1:ee,y1:Re,x2:Fe,y2:Be,x:Qt,y:mt})}return J}function Xe(e){let t=[],n=0,o=0,r=0,l=0,a=0,i="",s=null,c=null,u=()=>{for(;n<e.length&&/[\s,]/.test(e[n]);)n++},m=()=>{u(),yt.lastIndex=n;let b=yt.exec(e);return b?(n=yt.lastIndex,Number(b[0])):null},d=()=>{u();let b=e[n];return b==="0"||b==="1"?(n++,b==="1"):null},h=b=>{let p=[];for(let g=0;g<b;g++){let f=m();if(f===null)return null;p.push(f)}return p};for(;u(),!(n>=e.length);){let b=e[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(b))i=b,n++;else if(!i||i==="Z"||i==="z")break;let p=i===i.toLowerCase(),g=p?o:0,f=p?r:0,x=i.toUpperCase();if(x==="Z"){t.push({op:"Z"}),o=l,r=a,s=null,c=null;continue}if(x==="A"){let S=h(3),R=d(),C=d(),$=h(2);if(!(S&&$)||R===null||C===null)break;let[B,q,W]=S,V=$[0]+g,se=$[1]+f;t.push(...Or(o,r,B,q,W,R,C,V,se)),o=V,r=se,s=null,c=null;continue}let E={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[x]??0,A=h(E);if(!A)break;let M=A;switch(x){case"M":o=M[0]+g,r=M[1]+f,l=o,a=r,t.push({op:"M",x:o,y:r}),i=p?"l":"L",s=null,c=null;break;case"L":case"H":case"V":x!=="V"&&(o=M[0]+g),x==="V"?r=M[0]+f:x==="L"&&(r=M[1]+f),t.push({op:"L",x:o,y:r}),s=null,c=null;break;case"C":case"S":{let S,R;x==="C"?(S=[M[0]+g,M[1]+f],R=M.slice(2)):(S=s?[2*o-s[0],2*r-s[1]]:[o,r],R=M);let C=[R[0]+g,R[1]+f],$=[R[2]+g,R[3]+f];t.push({op:"C",x1:S[0],y1:S[1],x2:C[0],y2:C[1],x:$[0],y:$[1]}),[o,r]=$,s=C,c=null;break}case"Q":case"T":{let S,R;x==="Q"?(S=[M[0]+g,M[1]+f],R=[M[2]+g,M[3]+f]):(S=c?[2*o-c[0],2*r-c[1]]:[o,r],R=[M[0]+g,M[1]+f]),t.push({op:"C",x1:o+2/3*(S[0]-o),y1:r+2/3*(S[1]-r),x2:R[0]+2/3*(S[0]-R[0]),y2:R[1]+2/3*(S[1]-R[1]),x:R[0],y:R[1]}),[o,r]=R,c=S,s=null;break}default:break}}return t}var ln=.5522847498;function xt(e,t,n,o,r=0,l=0){if(n<=0||o<=0)return[];let a=Math.min(Math.max(r,0),n/2),i=Math.min(Math.max(l,0),o/2);if(a===0||i===0)return[{op:"M",x:e,y:t},{op:"L",x:e+n,y:t},{op:"L",x:e+n,y:t+o},{op:"L",x:e,y:t+o},{op:"Z"}];let s=a*ln,c=i*ln,u=e+n,m=t+o;return[{op:"M",x:e+a,y:t},{op:"L",x:u-a,y:t},{op:"C",x1:u-a+s,y1:t,x2:u,y2:t+i-c,x:u,y:t+i},{op:"L",x:u,y:m-i},{op:"C",x1:u,y1:m-i+c,x2:u-a+s,y2:m,x:u-a,y:m},{op:"L",x:e+a,y:m},{op:"C",x1:e+a-s,y1:m,x2:e,y2:m-i+c,x:e,y:m-i},{op:"L",x:e,y:t+i},{op:"C",x1:e,y1:t+i-c,x2:e+a-s,y2:t,x:e+a,y:t},{op:"Z"}]}var un="qrdx.frame",mn=1,fn="custom",I={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:Ce},dn=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Ze=.95,Dr=200,hn=["frame","text","accent","background"],Br=/[\t\n\v\f\r\u0085\u2028\u2029]/g,qr=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function St(e,t=Ce){let n=e.slice(0,1e3).normalize("NFC").replace(Br," ").replace(qr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,t)).join("").trim()}var je=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6;function Mt(e){let t=Ke(e);return{x0:e.qr.x-t,y0:e.qr.y-t,x1:e.qr.x+e.qr.size+t,y1:e.qr.y+e.qr.size+t}}function Ur(e){return{x0:e.qr.x,y0:e.qr.y,x1:e.qr.x+e.qr.size,y1:e.qr.y+e.qr.size}}function Ke(e){return e.qr.padding??e.qr.size*I.defaultPadding}var At=.52,Hr=.35;function Gr(e){let t=e.fontSize??e.box.height*At;return Math.min(t*Le,e.box.height*Ze)}var Et=(e,t)=>Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0)>1e-6&&Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)>1e-6;function cn(e){let t=Mt(e),n=Math.min(e.qr.radius??0,(t.x1-t.x0)/2,(t.y1-t.y0)/2),o=[[t.x0+n,t.y0+n,Math.PI],[t.x1-n,t.y0+n,-Math.PI/2],[t.x1-n,t.y1-n,0],[t.x0+n,t.y1-n,Math.PI/2]],r=[];for(let[l,a,i]of o)for(let s=0;s<=8;s++){let c=i+Math.PI/2*(s/8);r.push([l+n*Math.cos(c),a+n*Math.sin(c)])}return r}function Qr([e,t],n,o){if(e<n.x-.01||t<n.y-.01||e>n.x+n.width+.01||t>n.y+n.height+.01)return!1;let l=Math.min(o,n.width/2,n.height/2),a=Math.min(Math.max(e,n.x+l),n.x+n.width-l),i=Math.min(Math.max(t,n.y+l),n.y+n.height-l);return Math.hypot(e-a,t-i)<=l+.01}function zr(e){let t=0;return e.forEach(([n,o],r)=>{let[l,a]=e[(r+1)%e.length];t+=n*a-l*o}),Math.abs(t)/2}function Yr(e,t,n){let o=Mt(t);if(!Et(n,o))return!1;if("stroke"in e&&e.stroke)return!0;if(e.fill==="background")return!1;if(e.type==="rect"&&e.hole){let{hole:r}=e;return!cn(t).every(l=>Qr(l,r,r.radius??0))}if(e.type==="circle"&&e.hole){let r=e.hole;return!cn(t).every(([l,a])=>Math.hypot(l-e.cx,a-e.cy)<=r+.01)}if(e.type==="polygon"){let r=Ve(e.points,o);return r.length>2&&zr(r)>1e-6}return!0}function Rt(e){let t=Wr(e),n="stroke"in e?e.stroke:void 0;if(!(n&&t.bounds))return t;let o=e.type==="circle"||e.type==="ellipse"?n.width/2:e.type==="rect"?n.width*Math.SQRT2/2:n.width*2,{x0:r,y0:l,x1:a,y1:i}=t.bounds;return{bounds:{x0:r-o,y0:l-o,x1:a+o,y1:i+o},segments:t.segments*2}}function Wr(e){switch(e.type){case"rect":return{bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case"circle":return{bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case"ellipse":return{bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case"polygon":{let t=e.points.map(([o])=>o),n=e.points.map(([,o])=>o);return{bounds:{x0:Math.min(...t),y0:Math.min(...n),x1:Math.max(...t),y1:Math.max(...n)},segments:e.points.length}}case"path":{let t=_e(e.d,I.maxDecimals);return t?{bounds:an(Xe(e.d)),segments:nn(t)}:{bounds:null,segments:0}}case"line":{let t=e.width/2,n=Math.hypot(e.x2-e.x1,e.y2-e.y1),o=e.dash?Math.ceil(n/(e.dash[0]+e.dash[1])):1;return{bounds:{x0:Math.min(e.x1,e.x2)-t,y0:Math.min(e.y1,e.y2)-t,x1:Math.max(e.x1,e.x2)+t,y1:Math.max(e.y1,e.y2)+t},segments:o*(e.cap==="round"?4:5)}}default:return{bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:Dr}}}function pn(e,t){let n=I,o=new TextEncoder().encode(JSON.stringify(e)).length;if(o>n.maxBytes){t(`The spec is ${o} bytes; the limit is ${n.maxBytes}`);return}let{width:r,height:l}=e.artboard,a=Math.max(r,l)*.005,i={x0:-a,y0:-a,x1:r+a,y1:l+a},s=f=>f.x0>=i.x0&&f.y0>=i.y0&&f.x1<=i.x1&&f.y1<=i.y1,{qr:c}=e,u=Ke(e);c.plate!=="none"&&u<c.size*n.minPadding-1e-9&&t(`qr.padding must be at least ${n.minPadding*100}% of qr.size`,["qr","padding"]),c.size<Math.min(r,l)*n.minQrShare-1e-9&&t(`qr.size must be at least ${n.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let m=Mt(e);(m.x0<-1e-9||m.y0<-1e-9||m.x1>r+1e-9||m.y1>l+1e-9)&&t("The code and its padding must sit inside the artboard",["qr"]),(c.radius??0)>(c.size+2*u)/2&&t("qr.radius is larger than half the plate",["qr","radius"]);let d=0,h=0;e.shapes.forEach((f,x)=>{let E=["shapes",x],{bounds:A,segments:M}=Rt(f);if(!A){t("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...E,"d"]);return}if(s(A)||t("The shape extends outside the artboard",E),f.type==="rect"&&f.hole){let{hole:S}=f;(S.x<f.x||S.y<f.y||S.x+S.width>f.x+f.width+1e-9||S.y+S.height>f.y+f.height+1e-9)&&t("The hole must sit inside its rect",[...E,"hole"])}f.type==="circle"&&f.hole&&f.hole>=f.r&&t("The hole must be smaller than the circle",[...E,"hole"]),"stroke"in f&&f.stroke&&f.stroke.width>Math.min(r,l)*.1+1e-9&&t("A stroke may be at most 10% of the artboard's shorter side",[...E,"stroke","width"]),c.plate==="background"&&Yr(f,e,A)&&t('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',E),d+=M,typeof f.fill=="object"&&"gradient"in f.fill&&(h+=(f.fill.gradient.steps??32)*M)}),d>n.maxSegments&&t(`The shapes have ${d} segments; the limit is ${n.maxSegments}`,["shapes"]),h>n.maxGradientWork&&t("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let b=[],p=new Set,g=new Set;e.labels.forEach((f,x)=>{let E=["labels",x];p.has(f.id)&&t(`Label id "${f.id}" is used twice`,[...E,"id"]),p.add(f.id),f.slot!=="fixed"&&(g.has(f.slot)&&t(`Only one label may use the ${f.slot} slot`,[...E,"slot"]),g.add(f.slot));let A=f.maxLength??n.maxTextLength;f.text!==St(f.text,A)&&t(`Label text must be at most ${A} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...E,"text"]);let M;if(f.type==="text"){M={x0:f.box.x,y0:f.box.y,x1:f.box.x+f.box.width,y1:f.box.y+f.box.height},f.fontSize!==void 0&&f.fontSize>f.box.height*Ze+1e-9&&t("fontSize may be at most 95% of the label's row height",[...E,"fontSize"]);let S=f.box.y+f.box.height/2,R=Gr(f)*Hr,C={x0:M.x0,x1:M.x1,y0:S-R,y1:S+R};(Et(M,Ur(e))||Et(C,m))&&t("The label overlaps the code or its padding",[...E,"box"])}else{let{cx:S,cy:R,radius:C}=f.curve,$=f.fontSize*Le*.6;M={x0:S-C-$,y0:R-C-$,x1:S+C+$,y1:R+C+$};let B=Math.hypot(Math.max(m.x0-S,0,S-m.x1),Math.max(m.y0-R,0,R-m.y1));Math.hypot(Math.max(Math.abs(m.x0-S),Math.abs(m.x1-S)),Math.max(Math.abs(m.y0-R),Math.abs(m.y1-R)))<=C-$||B>=C+$||t("The curved label crosses the code or its padding",[...E,"curve"])}if(s(M)||t("The label extends outside the artboard",E),f.collapse){let S=f.collapse,R=S.y+S.height;(S.y<-1e-9||R>l+1e-9)&&t("The collapse band must sit inside the artboard",[...E,"collapse"]),R>m.y0+1e-6&&S.y<m.y1-1e-6&&t("The collapse band crosses the code or its padding",[...E,"collapse"]);for(let C of b)R>C.y+1e-6&&S.y<C.y+C.height-1e-6&&t("Collapse bands may not overlap",[...E,"collapse"]);b.push(S)}})}var Ft=(e,t=0)=>{for(let n=t;n<e.length;n++)if(e[n]?.continue!==!0)return!0;return!1};function re(e,t=[],n={}){return{...n,run(o){let r=e({value:o,issues:[]}),l=Ft(r.issues);for(let a of t){if(a.hasLength){let s=r.value;if(r.issues.some(c=>c.continue===!1)||s===null||s===void 0||s.length===void 0)continue}else if(l)continue;let i=r.issues.length;a.run(r),!l&&r.issues.length>i&&(l=Ft(r.issues,i))}return r}}}function Vr(e){if(typeof e=="number")return Number.isNaN(e)?"NaN":Number.isFinite(e)?"number":String(e);if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let t=e.constructor;if(Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&t)return t.name}return typeof e}var me=(e,t)=>({path:[],message:`Invalid input: expected ${e}, received ${Vr(t)}`}),Xr={string:"characters",array:"items"};function Z(e,t,n,o){let r=Xr[t],l=e?"Too big":"Too small",a=`${e?"<=":">="}${n}`;return{path:[],message:r?`${l}: expected ${t} to have ${a} ${r}`:`${l}: expected ${t} to be ${a}`,continue:o}}var wt=e=>typeof e=="string"?`"${e}"`:`${e}`,xn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function _t(e,t,n){for(let o of n)o.path.unshift(t),e.push(o)}var Zr=e=>e>=55296&&e<=56319,jr=e=>e>=56320&&e<=57343;function Kr(e){let t=e.length;for(let n=0;n<e.length-1;n++)Zr(e.charCodeAt(n))&&jr(e.charCodeAt(n+1))&&(t--,n++);return t}var En=e=>Array.isArray(e)?"array":typeof e=="string"?"string":"unknown",Te=e=>({run(t){t.value<e&&t.issues.push(Z(!1,"number",e,!0))}}),$e=e=>({run(t){t.value>e&&t.issues.push(Z(!0,"number",e,!0))}}),Ee=(e,t="Invalid input")=>({run(n){e(n.value)||n.issues.push({path:[],message:t,continue:!0})}}),Sn=e=>typeof e=="string"?Kr(e):e.length,Mn=e=>({hasLength:!0,run(t){let n=t.value;Sn(n)<e&&t.issues.push(Z(!1,En(n),e,!0))}}),It=e=>({hasLength:!0,run(t){let n=t.value;Sn(n)>e&&t.issues.push(Z(!0,En(n),e,!0))}}),An=(e,t)=>({run(n){e.lastIndex=0,e.test(n.value)||n.issues.push({path:[],message:t??`Invalid string: must match pattern ${e}`,continue:!0})}}),Jr={run(e){let t=e.value;Number.isInteger(t)?Number.isSafeInteger(t)||e.issues.push(t>0?Z(!0,"int",Number.MAX_SAFE_INTEGER,!0):Z(!1,"int",Number.MIN_SAFE_INTEGER,!0)):e.issues.push({...me("int",t),continue:!1})}},fe=(...e)=>re(t=>{let n=t.value;return typeof n=="number"&&Number.isFinite(n)||t.issues.push(me("number",n)),t},e),Rn=(...e)=>fe(Jr,...e),Je=(...e)=>re(t=>(typeof t.value!="string"&&t.issues.push(me("string",t.value)),t),e);function z(e){let t=e.length===1?`Invalid input: expected ${wt(e[0])}`:`Invalid option: expected one of ${e.map(wt).join("|")}`;return re(n=>(e.includes(n.value)||n.issues.push({path:[],message:t}),n),[],{values:e})}var Q=e=>z([e]),P=e=>({optional:!0,run:t=>t===void 0?{value:t,issues:[]}:e.run(t)});function L(e,t=[]){let n=Object.keys(e),o=new Set(n);return re(r=>{let l=r.value;if(!xn(l))return r.issues.push(me("object",l)),r;let a={};for(let s of n){let c=e[s],u=c.run(l[s]),m=s in l;_t(r.issues,s,u.issues),m||c.optional||u.issues.length>0||r.issues.push({path:[s],message:"Invalid input: expected nonoptional, received undefined"}),m&&(a[s]=u.value)}r.value=a;let i=[];for(let s in l)o.has(s)||i.push(s);return i.length>0&&r.issues.push({path:[],message:`Unrecognized key${i.length>1?"s":""}: ${i.map(wt).join(", ")}`,continue:!0}),r},t,{shape:e})}function Pt(e,t,n){let o=[];return t!==void 0&&o.push(Mn(t)),n!==void 0&&o.push(It(n)),re(r=>{let l=r.value;if(Array.isArray(l)&&n!==void 0&&l.length>n)return r.issues.push(Z(!0,"array",n,!1)),r;if(!Array.isArray(l))return r.issues.push(me("array",l)),r;let a=new Array(l.length);for(let i=0;i<l.length;i++){let s=e.run(l[i]);_t(r.issues,i,s.issues),a[i]=s.value}return r.value=a,r},o)}function Ct(e){return re(t=>{let n=t.value;if(!Array.isArray(n))return t.issues.push(me("tuple",n)),t;if(n.length<e.length)return t.issues.push(Z(!1,"array",e.length,void 0)),t;n.length>e.length&&t.issues.push(Z(!0,"array",e.length,void 0));let o=[];return e.forEach((r,l)=>{let a=r.run(n[l]);_t(t.issues,l,a.issues),o[l]=a.value}),t.value=o,t})}function xe(e){return re(t=>{let n=[];for(let r of e){let l=r.run(t.value);if(l.issues.length===0)return l;n.push(l)}let o=n.filter(r=>!Ft(r.issues));return o.length===1?o[0]:(t.issues.push({path:[],message:"Invalid input"}),t)})}function Fn(e,t){let n=new Map;for(let r of t)for(let l of r.shape?.[e]?.values??[])n.set(l,r);let o=`Invalid discriminator value. Expected ${[...n.keys()].map(r=>`'${r}'`).join(" | ")}`;return re(r=>{let l=r.value;if(!xn(l))return r.issues.push(me("object",l)),r;let a=n.get(l[e]);return a?a.run(l):(r.issues.push({path:[e],message:o}),r)})}var eo=Ee(je,`Numbers may have at most ${I.maxDecimals} decimals`),tt=[Te(-I.maxCoordinate),$e(I.maxCoordinate),eo],v=fe(...tt),N=fe(...tt,Ee(e=>e>0,"Must be greater than 0")),et=fe(...tt,Ee(e=>e>=0,"Must not be negative")),ve=Je(An(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color")),gn=xe([z(hn),ve]),wn=e=>L({mix:Ct([e,e]),amount:fe(Te(0),$e(1),Ee(je))}),ye=xe([gn,wn(gn)]),to=xe([ve,wn(xe([z(["frame","accent","background"]),ve]))]),ue=xe([ye,L({gradient:L({from:ye,to:ye,direction:P(z(["horizontal","vertical"])),steps:P(Rn(Te(2),$e(I.maxGradientSteps)))})})]),Lt=()=>({x:v,y:v,width:N,height:N}),Ie=L({color:ye,width:N}),no=Fn("type",[L({type:Q("rect"),...Lt(),radius:P(et),fill:ue,hole:P(L({...Lt(),radius:P(et)})),stroke:P(Ie)}),L({type:Q("circle"),cx:v,cy:v,r:N,hole:P(N),fill:ue,stroke:P(Ie)}),L({type:Q("ellipse"),cx:v,cy:v,rx:N,ry:N,fill:ue,stroke:P(Ie)}),L({type:Q("polygon"),points:Pt(Ct([v,v]),3,I.maxPolygonPoints),fill:ue,stroke:P(Ie)}),L({type:Q("path"),d:Je(Mn(2),It(I.maxPathLength)),fill:ue,fillRule:P(z(["nonzero","evenodd"])),stroke:P(Ie)}),L({type:Q("line"),x1:v,y1:v,x2:v,y2:v,width:N,cap:P(z(["butt","round"])),dash:P(Ct([N,N])),fill:ue}),L({type:Q("icon"),icon:z(dn),x:v,y:v,size:N,fill:ue})]),bn=()=>({id:Je(An(/^[a-z][a-z0-9-]{0,31}$/)),slot:z(["primary","secondary","fixed"]),text:Je(It(200)),maxLength:P(Rn(Te(1),$e(Ce))),color:ye,weight:P(z(["bold","regular"])),collapse:P(L({y:v,height:N}))}),ro=Fn("type",[L({type:Q("text"),...bn(),box:L(Lt()),align:P(z(["start","middle","end"])),fontSize:P(N)}),L({type:Q("curved"),...bn(),curve:L({cx:v,cy:v,radius:N,side:z(["top","bottom"]),spread:P(fe(Te(20),$e(300),Ee(je)))}),fontSize:N})]),yn=fe(...tt,Ee(e=>e>=I.minArtboard&&e<=I.maxArtboard,`Artboard sides must be ${I.minArtboard} to ${I.maxArtboard} units`)),oo=L({kind:Q(un),version:Q(mn),artboard:L({width:yn,height:yn}),qr:L({x:v,y:v,size:N,padding:P(et),radius:P(et),plate:P(z(["opaque","background","none"]))}),colors:L({frame:ve,text:P(to),accent:P(ve)}),shapes:Pt(no,void 0,I.maxShapes),labels:Pt(ro,void 0,I.maxLabels),bleed:P(xe([Q("none"),ye]))},[{run(e){pn(e.value,(t,n=[])=>{e.issues.push({path:[...n],message:t,continue:!0})})}}]);function Pn(e){let t=oo.run(e);return t.issues.length===0?{success:!0,data:t.value}:{success:!1,issues:t.issues.map(({path:n,message:o})=>({path:n,message:o}))}}var Cn=({path:e,message:t})=>e.length>0?`${e.join(".")}: ${t}`:t;function U(e){if(e.length===0)return"";let[t,...n]=e;return`M${y(t[0])} ${y(t[1])}${n.map(([o,r])=>`L${y(o)} ${y(r)}`).join("")}Z`}function _(e,t,n){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(n)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(n)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function F(e,t,n,o,r=0){let l=Math.min(n,o)/2,[a,i,s,c]=(typeof r=="number"?[r,r,r,r]:r).map(m=>Math.max(0,Math.min(m,l))),u=(m,d,h)=>m>0?`A${y(m)} ${y(m)} 0 0 1 ${y(d)} ${y(h)}`:"";return`M${y(e+a)} ${y(t)}H${y(e+n-i)}${u(i,e+n,t+i)}V${y(t+o-s)}${u(s,e+n-s,t+o)}H${y(e+c)}${u(c,e,t+o-c)}V${y(t+a)}${u(a,e+a,t)}Z`}function nt(e,t,n,o,r=5){return Array.from({length:r*2},(l,a)=>{let i=a%2===0?n:o,s=-Math.PI/2+Math.PI/r*a;return[e+i*Math.cos(s),t+i*Math.sin(s)]})}function Ln(e,t,n){let o=n/2,r=(l,a)=>`${y(e+l*o)} ${y(t+a*o)}`;return`M${r(0,-.52)}C${r(.18,-.92)} ${r(.98,-.94)} ${r(1,-.34)}C${r(1,.12)} ${r(.5,.48)} ${r(0,.92)}C${r(-.5,.48)} ${r(-1,.12)} ${r(-1,-.34)}C${r(-.98,-.94)} ${r(-.18,-.92)} ${r(0,-.52)}Z`}function vt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}var _n=24,oe=(e,t,n,o)=>{let r=o*Math.PI/180;return[e+n*Math.cos(r),t+n*Math.sin(r)]},rt=([e,t])=>`${y(e)} ${y(t)}`;function Se(e,t,n,o,r,l){let a=l-r>180?1:0;return`M${rt(oe(e,t,o,r))}A${y(o)} ${y(o)} 0 ${a} 1 ${rt(oe(e,t,o,l))}L${rt(oe(e,t,n,l))}A${y(n)} ${y(n)} 0 ${a} 0 ${rt(oe(e,t,n,r))}Z`}function ke(e,t,n,o){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function io(e){let t=0;return e.forEach(([n,o],r)=>{let[l,a]=e[(r+1)%e.length];t+=n*a-l*o}),t/2}function In(e){return U(io(e)<0?[...e].reverse():e)}function ot(e,t,n,o,r){let l=Math.hypot(n-e,o-t)||1,a=-(o-t)/l*(r/2),i=(n-e)/l*(r/2);return In([[e+a,t+i],[n+a,o+i],[n-a,o-i],[e-a,t-i]])}var D=(...e)=>({d:e.join(""),fillRule:"nonzero"}),j=(...e)=>({d:e.join(""),fillRule:"evenodd"});function so(){let e=[];for(let t of[0,60,120]){let[n,o]=oe(12,12,10.5,t+180),[r,l]=oe(12,12,10.5,t);e.push(ot(n,o,r,l,2))}for(let t=0;t<6;t++){let n=t*60,[o,r]=oe(12,12,6.2,n);for(let l of[-45,45]){let[a,i]=oe(o,r,3.6,n+l);e.push(ot(o,r,a,i,1.7))}}return D(...e)}var ao={wifi:()=>D(Se(12,20,4.6,7.2,-135,-45),Se(12,20,9.2,11.8,-135,-45),Se(12,20,13.8,16.4,-135,-45),_(12,20,2.2)),star:()=>D(U(nt(12,12.8,11.6,4.8))),heart:()=>D(Ln(12,12.4,22)),phone:()=>j(F(6,1.5,12,21,2.6),F(7.8,4.2,8.4,13.4,.6),_(12,19.8,1.1)),headphones:()=>D(Se(12,13,7.6,9.8,-180,0),F(2,12,5,9.5,2),F(17,12,5,9.5,2)),calendar:()=>j(F(2.5,4,19,17.5,2.5),F(4.6,9,14.8,10.6,.8),F(7,11.4,2.6,2.6,.4),F(10.7,11.4,2.6,2.6,.4),F(14.4,11.4,2.6,2.6,.4),F(7,15.1,2.6,2.6,.4),F(10.7,15.1,2.6,2.6,.4),F(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),F(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>D(_(12,7.5,4.6),"M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"),chat:()=>j(F(2,3,20,14,4),U([[6.5,17],[11.5,17],[5.8,21.8]]),_(7.5,10,1.5),_(12,10,1.5),_(16.5,10,1.5)),bag:()=>D(F(3.5,7.5,17,14.5,2),Se(12,7.5,3.1,4.8,-180,0)),bell:()=>D("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",F(1.5,18.2,21,2.6,1.3),F(11.2,6.6,1.6,2.6,0),F(9.8,4.6,4.4,2.4,1.2)),cup:()=>D("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",Se(17,10.2,1.7,3.6,-90,90),F(2,20.6,17,2,1),F(7,1.6,1.6,3.4,.8),F(11.6,1.6,1.6,3.4,.8)),card:()=>j(F(1.5,4.5,21,15,2.5),F(1.5,8,21,3,0),F(4.5,13.6,4.6,3.2,.6)),check:()=>j(_(12,12,10.5),U([[6.6,12.4],[8.4,10.6],[10.6,12.8],[15.8,7.6],[17.6,9.4],[10.6,16.4]])),info:()=>j(_(12,12,10.5),_(12,7.2,1.6),F(10.6,10,2.8,8,.8)),home:()=>j(U([[12,2.5],[22.5,11.5],[19.5,11.5],[19.5,21.5],[4.5,21.5],[4.5,11.5],[1.5,11.5]]),F(10,14.5,4,7,[.6,.6,0,0])),pin:()=>j("M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",_(12,9.5,3)),share:()=>D(ot(6,12,18,5,1.8),ot(6,12,18,19,1.8),_(18,5,3.2),_(6,12,3.2),_(18,19,3.2)),download:()=>D(F(10.6,2,2.8,9.5,0),U([[6,10],[18,10],[12,16.5]]),U([[2.5,15],[5.3,15],[5.3,19],[18.7,19],[18.7,15],[21.5,15],[21.5,21.8],[2.5,21.8]])),clock:()=>j(_(12,12,10.5),_(12,12,8.4),U([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:so,pumpkin:()=>D(ke(7.8,14.6,5.8,6.9),ke(16.2,14.6,5.8,6.9),ke(12,14.6,4.8,7.4),F(10.9,3.4,2.2,4.6,.8),In([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>D(U([[12,1.5],[16.8,8.2],[7.2,8.2]]),U([[12,5.2],[19,13.6],[5,13.6]]),U([[12,9.4],[21.2,19.2],[2.8,19.2]]),F(10.4,18.6,3.2,3.9,.4)),sparkle:()=>D(U(nt(9.5,13.5,9,2.4,4)),U(nt(19,5,4,1.1,4))),gift:()=>D(F(3,11.2,7.8,10.6,1),F(13.2,11.2,7.8,10.6,1),F(2,7.4,8.8,3.2,1),F(13.2,7.4,8.8,3.2,1),ke(8.8,4.8,2.9,1.9),ke(15.2,4.8,2.9,1.9))};function vn(e){return ao[e]()}var lo={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},co=Object.fromEntries(Object.entries(lo).map(([e,t])=>[e,[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]]));function Tn(e,t){let n=e.trim(),o=Number.parseFloat(n);return Number.isNaN(o)?Number.NaN:n.endsWith("%")?o/100*t:o}function de(e){if(!e)return null;let t=e.trim().toLowerCase();if(t==="transparent")return{r:0,g:0,b:0,a:0};let n=co[t];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(t.startsWith("#")){let r=t.slice(1);return(r.length===3||r.length===4)&&(r=r.split("").map(l=>l+l).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(r)?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:r.length===8?Number.parseInt(r.slice(6,8),16)/255:1}:null}let o=/^rgba?\(([^)]*)\)$/.exec(t);if(o){let[r,l]=o[1].split("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length!==(l===void 0&&a.length===4?4:3))return null;let i=l??a[3],[s,c,u]=a.slice(0,3).map(h=>Tn(h,255)),m=i===void 0?1:Tn(i,1);if([s,c,u,m].some(h=>Number.isNaN(h)))return null;let d=(h,b)=>Math.min(Math.max(h,0),b);return{r:d(s,255),g:d(c,255),b:d(u,255),a:d(m,1)}}return null}function $n(e){return e===" "?.3:/[MWmw@%]/.test(e)?.92:/[A-Z0-9#&]/.test(e)?.72:/[il.,:;!'|1]/.test(e)?.32:.6}function $t(e){let t=0;for(let n of e)t+=$n(n);return Math.max(t,1)}var Tt=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0");function it(e,t,n){let o=de(e)??{r:0,g:0,b:0,a:1},r=de(t)??{r:255,g:255,b:255,a:1},l=Math.min(1,Math.max(0,n));return`#${Tt(o.r+(r.r-o.r)*l)}${Tt(o.g+(r.g-o.g)*l)}${Tt(o.b+(r.b-o.b)*l)}`}function kn(e,t,n,o,r,l,a,i){let s=[...e],c=r*.08,u=s.map(p=>$n(p)*r),m=u.reduce((p,g)=>p+g,0)+c*Math.max(0,s.length-1),d=l==="top"?o-r*.35:o+r*.35,h=[],b=0;return s.forEach((p,g)=>{let f=u[g],x=(b+f/2)/d;if(b+=f+c,p.trim()==="")return;let E=l==="top"?-Math.PI/2-m/2/d+x:Math.PI/2+m/2/d-x;h.push({text:p,x:t+d*Math.cos(E),y:n+d*Math.sin(E),fontSize:r,maxWidth:r*2,color:a,rotate:E*180/Math.PI+(l==="top"?90:-90),field:i})}),h}function Ne(e,t="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||t:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||t:t}var st=class extends Error{issues;constructor(t){super(`Invalid frame spec: ${t.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=t}},Nn=new WeakMap;function kt(e){if(e&&typeof e=="object"){let n=Nn.get(e);if(n)return n}if(e==null)throw new st(['A "custom" frame needs a spec']);let t=Pn(e);if(!t.success)throw new st(t.issues.map(Cn));return typeof e=="object"&&Nn.set(e,t.data),t.data}var uo=e=>{let t=de(e);return!!(t&&t.a>=1)};function mo(e,t){let n=Ne(t,ne);return e.qr.plate==="none"?{color:n,plate:!1}:uo(n)?{color:n,plate:!0}:e.qr.plate==="background"?{color:n,plate:!1}:{color:ne,plate:!0}}function Dn(e,t,n=ne){let o=t.color||e.colors.frame,r=t.secondaryColor||e.colors.accent||o,l=s=>s==="frame"?o:s==="accent"?r:s==="background"?n:s,a=e.colors.text,i=t.textColor||(a===void 0?o:typeof a=="string"?a:it(l(a.mix[0]),l(a.mix[1]),a.amount));return{frame:o,text:i,accent:r}}function fo(e,t,n){let o=Dn(t,e,n),r=l=>{switch(l){case"frame":return o.frame;case"text":return o.text;case"accent":return o.accent;case"background":return n;default:return l}};return l=>typeof l=="string"?r(l):it(r(l.mix[0]),r(l.mix[1]),l.amount)}function On(e,t,n=0,o=0){let r=_e(e);return r?bt(r,t,n,o):""}function ho(e,t,n,o){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function po(e,t){let[n,o,r,l]=[e.x1*t,e.y1*t,e.x2*t,e.y2*t],a=Math.hypot(r-n,l-o),i=e.width*t/2,s=a>0?(r-n)/a:1,c=a>0?(l-o)/a:0,u=-c*i,m=s*i,d=(g,f)=>{let x=[n+s*g,o+c*g],E=[n+s*f,o+c*f];if(e.cap==="round"&&f-g>2*i){let A=[x[0]+s*i,x[1]+c*i],M=[E[0]-s*i,E[1]-c*i];return`M${y(A[0]-u)} ${y(A[1]-m)}L${y(M[0]-u)} ${y(M[1]-m)}A${y(i)} ${y(i)} 0 0 1 ${y(M[0]+u)} ${y(M[1]+m)}L${y(A[0]+u)} ${y(A[1]+m)}A${y(i)} ${y(i)} 0 0 1 ${y(A[0]-u)} ${y(A[1]-m)}Z`}return`M${y(x[0]-u)} ${y(x[1]-m)}L${y(E[0]-u)} ${y(E[1]-m)}L${y(E[0]+u)} ${y(E[1]+m)}L${y(x[0]+u)} ${y(x[1]+m)}Z`};if(!e.dash)return{type:"path",d:d(0,a),fillRule:"nonzero"};let h=e.dash[0]*t,b=h+e.dash[1]*t,p=[];for(let g=0;g+h<=a+1e-6;g+=b)p.push(d(g,g+h));return{type:"path",d:p.join(""),fillRule:"nonzero"}}function go(e,t){switch(e.type){case"rect":return{type:"rect",x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t,radius:(e.radius??0)*t,...e.hole&&{hole:{x:e.hole.x*t,y:e.hole.y*t,width:e.hole.width*t,height:e.hole.height*t,radius:(e.hole.radius??0)*t}}};case"circle":return{type:"path",d:_(e.cx*t,e.cy*t,e.r*t)+(e.hole?_(e.cx*t,e.cy*t,e.hole*t):""),fillRule:e.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:ho(e.cx*t,e.cy*t,e.rx*t,e.ry*t),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:e.points.map(([n,o])=>[n*t,o*t])};case"path":return{type:"path",d:On(e.d,t),fillRule:e.fillRule??"nonzero"};case"line":return po(e,t);default:{let n=vn(e.icon);return{type:"path",d:On(n.d,e.size*t/_n,e.x*t,e.y*t),fillRule:n.fillRule}}}}function bo(e){if(e.type==="rect"){let{x:t,y:n,width:o,height:r,radius:l,hole:a}=e;return[...xt(t,n,o,r,l,l),...a?xt(a.x,a.y,a.width,a.height,a.radius,a.radius):[]]}return e.type==="polygon"?[...e.points.map(([t,n],o)=>o===0?{op:"M",x:t,y:n}:{op:"L",x:t,y:n}),{op:"Z"}]:Xe(e.d)}function yo(e,t,n){let o=bo(e),r=on(o,.2),l=e.type==="rect"?e.hole?"evenodd":"nonzero":e.type==="path"?e.fillRule??"nonzero":"nonzero",a=t.direction==="vertical",i=g=>a?g[1]:g[0],s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let g of r)for(let f of g)s=Math.min(s,i(f)),c=Math.max(c,i(f));if(!(c>s))return[];let u=t.steps??32,m=n(t.from),d=n(t.to),h=c-s,b=h*.002,p=[];for(let g=0;g<u;g++){let f=s+h*g/u,x=Math.min(c,s+h*(g+1)/u+(g+1<u?b:0)),E=a?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:f,y1:x}:{x0:f,x1:x,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},A=r.map(M=>Ve(M,E)).filter(M=>M.length>2);A.length!==0&&p.push({type:"path",d:sn(A),fill:it(m,d,(g+.5)/u),fillRule:l})}return p}function xo(e,t,n){let o=go(e,t),r="stroke"in e&&e.stroke?{stroke:n(e.stroke.color),strokeWidth:e.stroke.width*t}:void 0;if(typeof e.fill=="object"&&"gradient"in e.fill){let l=yo(o,e.fill.gradient,n);return r?[...l,{...o,fill:"none",...r}]:l}return[{...o,fill:n(e.fill),...r}]}function Eo(e,t){let n=Math.min(e.maxLength??I.maxTextLength,I.maxTextLength),o=e.slot==="primary"?t.text??e.text:e.slot==="secondary"?t.secondaryText??e.text:e.text;return St(o,n)}function So(e){return e===void 0||!Number.isFinite(e)?1:Math.min(Le,Math.max(Xt,e))}function Mo(e,t,n,o,r,l){let a=r(e.color),i=e.weight==="regular"?{fontWeight:400}:{};if(e.type==="curved"){let{cx:p,cy:g,radius:f,side:x,spread:E=140}=e.curve,A=f*o*(E*Math.PI/180),M=Math.min(e.fontSize*o*n,A/($t(t)+.08*t.length));return kn(t,p*o,g*o,f*o,M,x,a,l).map(S=>({...S,...i}))}let s=e.box.x*o,c=e.box.y*o,u=e.box.width*o,m=e.box.height*o;if(!(m>0))return[];let d=(e.fontSize??e.box.height*At)*o,h=Math.min(d*n,m*Ze,u/$t(t)),b=e.align??"middle";return[{text:t,x:b==="start"?s:b==="end"?s+u:s+u/2,y:c+m/2+h*.35,fontSize:h,maxWidth:u,color:a,...b!=="middle"&&{align:b},...i,field:l}]}function Ao(e){let t=0,n=0,o=0,r=0;return e.map(({command:l,values:a})=>{let i=l.toUpperCase(),s=l!==i;switch(i){case"Z":return t=o,n=r,{command:"Z",values:[]};case"H":return t=(s?t:0)+a[0],{command:"H",values:[t]};case"V":return n=(s?n:0)+a[0],{command:"V",values:[n]};case"A":return t=(s?t:0)+a[5],n=(s?n:0)+a[6],{command:"A",values:[...a.slice(0,5),t,n]};default:{let c=a.map((u,m)=>s?u+(m%2===0?t:n):u);return t=c.at(-2),n=c.at(-1),i==="M"&&(o=t,r=n),{command:i,values:c}}}})}function Ro(e,t){let n=_e(e);return n?bt(Ao(n).map(({command:o,values:r})=>o==="V"?{command:o,values:[t(r[0])]}:o==="H"||o==="Z"?{command:o,values:r}:o==="A"?{command:o,values:[...r.slice(0,6),t(r[6])]}:{command:o,values:r.map((l,a)=>a%2===1?t(l):l)})):e}function Fo(e,t){let n=(o,r)=>{let l=t(o);return{y:l,height:t(o+r)-l}};switch(e.type){case"rect":return{...e,...n(e.y,e.height),...e.hole&&{hole:{...e.hole,...n(e.hole.y,e.hole.height)}}};case"circle":case"ellipse":return{...e,cy:t(e.cy)};case"polygon":return{...e,points:e.points.map(([o,r])=>[o,t(r)])};case"path":return{...e,d:Ro(e.d,t)};case"line":return{...e,y1:t(e.y1),y2:t(e.y2)};default:return{...e,y:t(e.y)}}}function wo(e,t){if(t.length===0)return e;let n=r=>{let l=r;for(let a of t)l-=Math.min(Math.max(r-a.y,0),a.height);return l},o=(r,l)=>t.some(a=>r>=a.y-1e-6&&l<=a.y+a.height+1e-6);return{...e,artboard:{...e.artboard,height:n(e.artboard.height)},qr:{...e.qr,y:n(e.qr.y)},shapes:e.shapes.filter(r=>{let{bounds:l}=Rt(r);return!(l&&o(l.y0,l.y1))}).map(r=>Fo(r,n)),labels:e.labels.map(r=>{if(r.type==="curved")return{...r,curve:{...r.curve,cy:n(r.curve.cy)}};let l=n(r.box.y);return{...r,box:{...r.box,y:l,height:n(r.box.y+r.box.height)-l}}})}}function Nt(e,t,n,o,r={}){let l=new Map(t.labels.map(g=>[g.id,Eo(g,n)])),a=wo(t,t.labels.flatMap(g=>g.collapse&&!l.get(g.id)?[g.collapse]:[])),i=e/a.qr.size,s=mo(a,o),c=fo(n,a,s.color),u=a.shapes.flatMap(g=>xo(g,i,c));if(s.plate){let g=Ke(a)*i;u.push({type:"rect",x:a.qr.x*i-g,y:a.qr.y*i-g,width:e+2*g,height:e+2*g,radius:(a.qr.radius??0)*i,fill:s.color})}let m=So(n.fontScale),d=a.labels.flatMap(g=>{let f=l.get(g.id);if(!f)return[];let x=(g.slot==="fixed"?void 0:r[g.slot])??g.id;return Mo(g,f,m,i,c,x)}),h=d[0],b=h&&h.rotate===void 0?h:null,p=a.bleed??"none";return{width:a.artboard.width*i,height:a.artboard.height*i,qrX:a.qr.x*i,qrY:a.qr.y*i,qrSize:e,shapes:u,label:b,extraLabels:b?d.slice(1):d,squareEdges:p!=="none",color:c(p==="none"?"frame":p)}}function Bn(e,t,n){return Nt(e,kt(t.spec),t,n)}var qn={kind:"qrdx.frame",version:1,artboard:{width:1600,height:1470},qr:{x:300,y:120,size:1e3,padding:70,radius:10,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"polygon",points:[[0,1250],[190,1250],[190,1470],[0,1470],[50.4,1360]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[1600,1250],[1549.6,1360],[1600,1470],[1410,1470],[1410,1250]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[90,1420],[170,1470],[90,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"polygon",points:[[1510,1420],[1510,1470],[1430,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"rect",x:220,y:40,width:1160,height:1160,radius:20,fill:"background"},{type:"rect",x:180,y:0,width:1240,height:1240,radius:60,fill:"frame",hole:{x:220,y:40,width:1160,height:1160,radius:20}},{type:"rect",x:90,y:1200,width:1420,height:220,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:170,y:1200,width:1260,height:220}}]};var Ot={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:120,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:40,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:220}}],bleed:"frame"};var Un={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}],bleed:"frame"};var Hn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1600},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1600,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"top",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}},{type:"text",id:"bottom",slot:"secondary",text:"",color:"text",box:{x:120,y:1380,width:1e3,height:220}}],bleed:"frame"};var Gn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,fill:"frame",hole:{x:40,y:40,width:1160,height:1260}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}],bleed:"frame"};var Qn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1530},qr:{x:120,y:120,size:1e3,padding:80,radius:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:1400,radius:120,fill:"frame"},{type:"path",d:"M161.2 1380L62 1530Q198.4 1458.5 396.8 1380Z",fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:200},collapse:{y:1220,height:160}}]};var zn={kind:"qrdx.frame",version:1,artboard:{width:1978.214,height:1978.214},qr:{x:489.107,y:489.107,size:1e3,padding:50,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"circle",cx:989.107,cy:989.107,r:779.107,fill:"background"},{type:"circle",cx:989.107,cy:989.107,r:989.107,hole:779.107,fill:"frame"},{type:"circle",cx:105,cy:989.107,r:14.7,fill:"text"},{type:"circle",cx:1873.214,cy:989.107,r:14.7,fill:"text"}],labels:[{type:"curved",id:"top",slot:"primary",text:"Scan me",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"top",spread:140},fontSize:105},{type:"curved",id:"bottom",slot:"secondary",text:"",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"bottom",spread:140},fontSize:105}]};var Yn={kind:"qrdx.frame",version:1,artboard:{width:1320,height:1558},qr:{x:160,y:130,size:1e3,padding:60},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:370,width:1320,height:1188,fill:{mix:["frame","#FFFFFF"],amount:.45}},{type:"polygon",points:[[0,370],[660,0],[1320,370]],fill:{mix:["frame","#FFFFFF"],amount:.25}},{type:"rect",x:80,y:50,width:1160,height:1268,fill:"background"},{type:"rect",x:68,y:38,width:1184,height:1280,fill:"frame",hole:{x:80,y:50,width:1160,height:1268}},{type:"polygon",points:[[0,1178],[660,1318],[1320,1178],[1320,1558],[0,1558]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:160,y:1318,width:1e3,height:220}}]};var Wn={kind:"qrdx.frame",version:1,artboard:{width:1230,height:1430},qr:{x:115,y:115,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1230,height:1430,fill:"background"},{type:"polygon",points:[[0,0],[200,0],[200,35],[35,35],[35,200],[0,200]],fill:"frame"},{type:"polygon",points:[[1230,0],[1030,0],[1030,35],[1195,35],[1195,200],[1230,200]],fill:"frame"},{type:"polygon",points:[[1230,1230],[1030,1230],[1030,1195],[1195,1195],[1195,1030],[1230,1030]],fill:"frame"},{type:"polygon",points:[[0,1230],[200,1230],[200,1195],[35,1195],[35,1030],[0,1030]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:80,y:1210,width:1070,height:200},collapse:{y:1230,height:200}}]};var at={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1360},qr:{x:130,y:130,size:1e3,padding:40,plate:"background"},colors:{frame:"#7c3aed",text:{mix:["frame","accent"],amount:.5},accent:"#db2777"},shapes:[{type:"rect",x:50,y:50,width:1160,height:1260,radius:50,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1360,radius:100,fill:{gradient:{from:"frame",to:"accent",direction:"horizontal",steps:48}},hole:{x:50,y:50,width:1160,height:1260,radius:50}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1130,width:1e3,height:180},collapse:{y:1210,height:100}}]};var Vn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1460},qr:{x:130,y:260,size:1e3,padding:46,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"frame",hole:{x:22,y:22,width:1216,height:1416,radius:8}},{type:"rect",x:45,y:45,width:1170,height:1370,fill:"frame",hole:{x:53,y:53,width:1154,height:1354}},{type:"rect",x:378,y:181,width:504,height:8,fill:"frame"},{type:"polygon",points:[[630,163],[652,185],[630,207],[608,185]],fill:"frame"}],labels:[{type:"text",id:"title",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:30,width:1e3,height:170},collapse:{y:84,height:130}},{type:"text",id:"footer",slot:"secondary",text:"",color:"text",box:{x:130,y:1270,width:1e3,height:160},collapse:{y:1306,height:70}}]};var Xn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1610},qr:{x:130,y:250,size:1e3,padding:75,radius:55},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1610,radius:170,fill:"frame"},{type:"rect",x:50,y:170,width:1160,height:1290,radius:60,fill:"background"},{type:"rect",x:520,y:67,width:220,height:36,radius:18,fill:"background"},{type:"rect",x:480,y:1520,width:300,height:30,radius:15,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1290,width:1e3,height:170},collapse:{y:1330,height:130}}]};var Zn={kind:"qrdx.frame",version:1,artboard:{width:1325,height:1555},qr:{x:150,y:150,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:25,y:25,width:1300,height:1530,radius:15,fill:{mix:["frame","#FFFFFF"],amount:.72}},{type:"rect",x:0,y:0,width:1300,height:1530,radius:15,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:150,y:1260,width:1e3,height:240}}]};var jn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,radius:60,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,radius:100,fill:"frame",hole:{x:40,y:40,width:1160,height:1260,radius:60}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}]};var Kn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:120,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:40,width:1160,height:1160,radius:30}},{type:"polygon",points:[[540,1385],[620,1265],[700,1385]],fill:"frame"},{type:"rect",x:0,y:1345,width:1240,height:220,radius:110,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1345,width:1e3,height:220}}]};var Jn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:445,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:220,radius:110,fill:"frame"},{type:"polygon",points:[[540,180],[700,180],[620,300]],fill:"frame"},{type:"rect",x:40,y:365,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:325,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:365,width:1160,height:1160,radius:30}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}]};var er={kind:"qrdx.frame",version:1,artboard:{width:1420,height:1590},qr:{x:195,y:195,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:30,y:30,width:1390,height:1560,radius:155,fill:{mix:["frame","#FFFFFF"],amount:.7}},{type:"rect",x:0,y:0,width:1390,height:1560,radius:155,fill:"#FFFFFF"},{type:"rect",x:25,y:25,width:1340,height:1510,radius:130,fill:"frame"},{type:"rect",x:95,y:95,width:1200,height:1200,radius:40,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:175,y:1295,width:1040,height:240},collapse:{y:1365,height:170}}]};var tr={kind:"qrdx.frame",version:1,artboard:{width:1280,height:1620},qr:{x:140,y:320,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M140 0H1140L1280 140V1580A40 40 0 0 1 1240 1620H40A40 40 0 0 1 0 1580V140ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:"frame",fillRule:"evenodd"},{type:"path",d:"M572 115.2A68 68 0 1 1 708 115.2A68 68 0 1 1 572 115.2ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:{mix:["frame","#FFFFFF"],amount:.35},fillRule:"evenodd"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:140,y:1400,width:1e3,height:220},collapse:{y:1420,height:160}}]};var nr={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1490},qr:{x:130,y:130,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M40 0H1220A40 40 0 0 1 1260 40V1215A55 55 0 0 0 1260 1325V1450A40 40 0 0 1 1220 1490H40A40 40 0 0 1 0 1450V1325A55 55 0 0 0 0 1215V40A40 40 0 0 1 40 0Z",fill:"frame"},{type:"line",x1:77,y1:1270,x2:1147,y2:1270,width:12,dash:[30,22],fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1270,width:1e3,height:220}}]};var T=(e,t,n,o,r)=>({style:e,name:t,tags:r,labelOn:o,spec:n}),rr=[T("banner-bottom","Banner",Ot,"frame",["bottom","band"]),T("banner-top","Top banner",Un,"frame",["top","band"]),T("banner-top-bottom","Two banners",Hn,"frame",["top","bottom","band"]),T("border","Border",Gn,"background",["square","outline"]),T("rounded-border","Rounded",jn,"background",["border","outline"]),T("gradient-border","Gradient",at,"background",["border","colorful"]),T("focus","Focus",Wn,"background",["corners","brackets"]),T("speech-bubble","Bubble",Kn,"frame",["speech"]),T("speech-bubble-top","Bubble top",Jn,"frame",["speech"]),T("chat-bubble","Chat",Qn,"frame",["message","bubble"]),T("circle","Circle",zn,"frame",["round","ring","curved"]),T("badge","Ribbon",qn,"frame",["badge","banner"]),T("sticker","Sticker",er,"frame",["label"]),T("polaroid","Polaroid",Zn,"frame",["photo","picture"]),T("phone","Phone",Xn,"background",["mobile","screen"]),T("ticket","Ticket",nr,"frame",["event","pass"]),T("tag","Tag",tr,"frame",["price","label"]),T("envelope","Envelope",Yn,"frame",["mail","letter"]),T("menu-card","Menu card",Vn,"background",["menu","restaurant"])],Yo=new Map(rr.map(e=>[e.style,e]));function Wo(e){return Yo.get(e)}var ia=Object.fromEntries(rr.map(e=>[e.style,e.spec])),sa={from:at.colors.frame,to:at.colors.accent};var Vo={primary:"text",secondary:"secondaryText"};function or(e,t,n){let o=Wo(t.style)?.spec??Ot;return Nt(e,kt(o),t,n,Vo)}var Xo="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function ar(e){return!!(e?.style&&e.style!=="none")}function lr(e,t,n){return t.style===fn?Bn(e,t,n):or(e,t,n)}function Zo(e){return[...e.label?[e.label]:[],...e.extraLabels??[]]}function cr(e,t){let n=({x:r,y:l,width:a,height:i,radius:s})=>{let c=Math.min(s,a/2,i/2);e.moveTo(r+c,l),e.arcTo(r+a,l,r+a,l+i,c),e.arcTo(r+a,l+i,r,l+i,c),e.arcTo(r,l+i,r,l,c),e.arcTo(r,l,r+a,l,c),e.closePath()},o=(r,l)=>{r.stroke&&r.strokeWidth&&(e.strokeStyle=r.stroke,e.lineWidth=r.strokeWidth,e.lineJoin="miter",e.miterLimit=4,l?e.stroke(l):e.stroke())};for(let r of t.shapes){let l=!(r.fill==="transparent"||r.fill==="none");if(l||r.stroke){if(e.fillStyle=r.fill,r.type==="path"){if(typeof Path2D<"u"){let a=new Path2D(r.d);l&&e.fill(a,r.fillRule??"nonzero"),o(r,a)}continue}e.beginPath(),r.type==="polygon"?(r.points.forEach(([a,i],s)=>{s===0?e.moveTo(a,i):e.lineTo(a,i)}),e.closePath(),l&&e.fill()):(n(r),r.hole&&n(r.hole),l&&e.fill("evenodd")),o(r)}}for(let r of Zo(t))e.fillStyle=r.color,e.font=`${r.fontWeight??700} ${r.fontSize}px ${Xo}`,e.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",e.textBaseline="alphabetic",r.rotate?(e.save(),e.translate(r.x,r.y),e.rotate(r.rotate*Math.PI/180),e.fillText(r.text,0,0,r.maxWidth),e.restore()):e.fillText(r.text,r.x,r.y,r.maxWidth)}var jo=.22,Ko=.14;function Jo(e,t){let n=e.w*t,o=e.h*t;return{x:e.x+n,y:e.y+o,w:e.w-2*n,h:e.h-2*o}}function Dt(e,t,n){if(e.beginPath(),t==="circle"){e.arc(n.x+n.w/2,n.y+n.h/2,Math.min(n.w,n.h)/2,0,Math.PI*2);return}let o=t==="rounded"?Math.min(n.w,n.h)*jo:0;o>0&&typeof e.roundRect=="function"?e.roundRect(n.x,n.y,n.w,n.h,o):e.rect(n.x,n.y,n.w,n.h)}function ur(e,t){return t?Jo(e,Ko):e}var{QrCode:Bt}=H,ei={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function ti(e){let t=e*4+17,n=new Uint8Array(t*t),o=(a,i)=>{a>=0&&i>=0&&a<t&&i<t&&(n[i*t+a]=1)};for(let a=0;a<t;a++)o(6,a),o(a,6);for(let[a,i]of[[3,3],[t-4,3],[3,t-4]])for(let s=-4;s<=4;s++)for(let c=-4;c<=4;c++)o(a+c,i+s);let r=[];if(e>1){let a=Math.floor(e/7)+2,i=e===32?26:Math.ceil((e*4+4)/(a*2-2))*2;r.push(6);for(let s=t-7;r.length<a;s-=i)r.splice(1,0,s)}let l=r.length-1;for(let[a,i]of r.entries())for(let[s,c]of r.entries())if(!(a===0&&s===0||a===0&&s===l||a===l&&s===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)o(i+m,c+u);for(let a=0;a<=8;a++)o(8,a),o(a,8);for(let a=0;a<8;a++)o(t-1-a,8),o(8,t-1-a);if(e>=7)for(let a=0;a<18;a++){let i=t-11+a%3,s=Math.floor(a/3);o(i,s),o(s,i)}return n}function ni(e,t){let n=e*4+17,o=te[t].ordinal,r=Bt.NUM_ERROR_CORRECTION_BLOCKS[o]?.[e]??0,l=Bt.ECC_CODEWORDS_PER_BLOCK[o]?.[e]??0,a=Math.floor(Bt.getNumRawDataModules(e)/8),i=r-a%r,s=Math.floor(a/r),c=Array.from({length:r},(A,M)=>s+(M<i?0:1)),u=[],m=[],d=s-l;for(let A=0;A<=s;A++)for(let M=0;M<r;M++)if(M<i){if(A===d)continue;u.push(M),m.push(A<d?A:A-1)}else u.push(M),m.push(A);if(u.length!==a)throw new Error(`Codeword map: interleave mismatch at version ${e}`);let h=ti(e),b=new Int16Array(n*n).fill(-1),p=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),f=a*8,x=0;for(let A=n-1;A>=1;A-=2){A===6&&(A=5);let M=(A+1&2)===0;for(let S=0;S<n;S++)for(let R=0;R<2;R++){let C=A-R,B=(M?n-1-S:S)*n+C;if(!h[B]&&x<f){let q=x>>>3;b[B]=u[q],p[B]=m[q],g[B]=7-(x&7),x++}}}if(x!==f)throw new Error(`Codeword map: placement mismatch at version ${e}`);let E=ei[`${e}${t}`]??0;return{version:e,level:t,size:n,blocks:r,eccPerBlock:l,blockLengths:c,correctable:Math.floor((l-E)/2),block:b,codeword:p,bit:g}}var ri=8,he=new Map;function mr(e,t){if(!(Number.isInteger(e)&&e>=1&&e<=40))throw new RangeError(`QR version must be 1\u201340, got ${e}`);let n=`${e}${t}`,o=he.get(n);if(o)return he.delete(n),he.set(n,o),o;let r=ni(e,t);if(he.size>=ri){let l=he.keys().next().value;l!==void 0&&he.delete(l)}return he.set(n,r),r}function fr(e,t){let n=new Array(e.blocks).fill(0),o=new Set;for(let r of t){let l=e.block[r]??-1;if(l<0)continue;let a=l*4096+e.codeword[r];o.has(a)||(o.add(a),n[l]=n[l]+1)}return n}var oi={2:6,3:12};function dr(e){let t=[e.start],n=e.start;for(let o of e.segments){let r=o.at(-1);if(o.length===1)t.push(r);else{let l=oi[o.length];for(let a=1;a<=l;a++){let i=a/l,s=1-i;if(o.length===2){let[c]=o;t.push([s*s*n[0]+2*s*i*c[0]+i*i*r[0],s*s*n[1]+2*s*i*c[1]+i*i*r[1]])}else{let[c,u]=o;t.push([s*s*s*n[0]+3*s*s*i*c[0]+3*s*i*i*u[0]+i*i*i*r[0],s*s*s*n[1]+3*s*s*i*c[1]+3*s*i*i*u[1]+i*i*i*r[1]])}}}n=r}return t}function pr(e,t){let n=[];for(let o of e)for(let r=0;r<o.length;r++){let[l,a]=o[r],[i,s]=o[(r+1)%o.length];a<=t!=s<=t&&n.push(l+(t-a)/(s-a)*(i-l))}return n.sort((o,r)=>o-r)}function gr(e,t){let n=0;for(let o of e)if(o<t)n++;else break;return n%2===1}function ii(e,t,n){return gr(pr(e,n),t)}function br(e){let t=new Map;return(n,o)=>{let r=t.get(o);return r||(r=pr(e,o),t.set(o,r)),gr(r,n)}}function si(e,t,n,o){let r=n[0]-e,l=n[1]-t,a=o[0]-n[0],i=o[1]-n[1],s=u=>Math.max(Math.abs(r+u*a),Math.abs(l+u*i)),c=Math.min(s(0),s(1));for(let[u,m]of[[l-r,a-i],[-(r+l),a+i]])if(m!==0){let d=u/m;d>0&&d<1&&(c=Math.min(c,s(d)))}return c}function ai(e,t,n){if(!ii(e,t,n))return 0;let o=Number.POSITIVE_INFINITY;for(let r of e)for(let l=0;l<r.length;l++)o=Math.min(o,si(t,n,r[l],r[(l+1)%r.length]));return Number.isFinite(o)?o:0}function li(e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l of e)for(let[a,i]of l)t=Math.min(t,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i);return{x0:t,y0:n,x1:o,y1:r}}function yr(e){let t=e.map(dr),n=li(t),o=n.x1-n.x0,r=n.y1-n.y0;if(!(o>0&&r>0))return null;let l=(b,p)=>{let g=Math.max(b-n.x0,n.x1-b,p-n.y0,n.y1-p);return g>0?ai(t,b,p)/(2*g):0},a={cx:n.x0+o/2,cy:n.y0+r/2,value:0};a.value=l(a.cx,a.cy);let i=32;for(let b=1;b<i;b++)for(let p=1;p<i;p++){let g=n.x0+o*p/i,f=n.y0+r*b/i,x=l(g,f);x>a.value&&(a={cx:g,cy:f,value:x})}let s=o/i,c=r/i;for(let b=0;b<6;b++){let p=a;for(let g=-2;g<=2;g++)for(let f=-2;f<=2;f++){let x=p.cx+s*f/2,E=p.cy+c*g/2,A=l(x,E);A>a.value&&(a={cx:x,cy:E,value:A})}s/=2,c/=2}if(a.value<=0)return null;let m=.5/Math.max(a.cx-n.x0,n.x1-a.cx,a.cy-n.y0,n.y1-a.cy),d=([b,p])=>[.5+(b-a.cx)*m,.5+(p-a.cy)*m],h=e.map(b=>({start:d(b.start),segments:b.segments.map(p=>p.map(d))}));return{rings:h,polygons:h.map(dr),half:a.value}}function xr(e,t){let n=([r,l])=>`${y(r*t)} ${y(l*t)}`,o="";for(let r of e.rings){o+=`M${n(r.start)}`;for(let l of r.segments){let a=l.length===1?"L":l.length===2?"Q":"C";o+=a+l.map(n).join(" ")}o+="Z"}return o}var ci={start:[0,-.58],segments:[[[.2,-.92],[1,-.97],[1,-.3]],[[1,.3],[.62,.6],[0,.92]],[[-.62,.6],[-1,.3],[-1,-.3]],[[-1,-.97],[-.2,-.92],[0,-.58]]]},hr;function Er(){return hr??=yr([ci]),hr}function ui(e){let{width:t,height:n,cells:o}=e;return Number.isInteger(t)&&Number.isInteger(n)&&t>=pt&&n>=pt&&t<=ht&&n<=ht&&typeof o=="string"&&o.length===t*n&&/^[01]*$/.test(o)?(r,l)=>r>=0&&l>=0&&r<t&&l<n&&o[l*t+r]==="1":null}var K=([e,t])=>`${e},${t}`;function mi(e,t,n){let o=(s,c)=>e(s-1,c-1),r=new Map,l=(s,c)=>{for(let[u,m]of[[s,c],[c,s]]){let d=r.get(K(u))??[];d.push(m),r.set(K(u),d)}};for(let s=0;s<=n;s++)for(let c=0;c<=t;c++){let u=o(c,s),m=o(c+1,s),d=o(c+1,s+1),h=o(c,s+1),b=[c,s-.5],p=[c+.5,s],g=[c,s+.5],f=[c-.5,s];switch((u?8:0)+(m?4:0)+(d?2:0)+(h?1:0)){case 1:case 14:l(f,g);break;case 2:case 13:l(g,p);break;case 3:case 12:l(f,p);break;case 4:case 11:l(b,p);break;case 6:case 9:l(b,g);break;case 7:case 8:l(f,b);break;case 5:l(b,p),l(f,g);break;case 10:l(f,b),l(g,p);break;default:break}}let a=[],i=new Set;for(let[s,c]of r){if(i.has(s)||c.length===0)continue;let[u,m]=s.split(",").map(Number),d=[[u,m]];i.add(s);let h=[u,m],b=c[0];for(;!i.has(K(b));){i.add(K(b)),d.push(b);let p=fi(r.get(K(b))??[],h,i);if(!p)break;h=b,b=p}d.length>=3&&a.push(di(d))}return a}function fi(e,t,n){let o=K(t);return e.find(r=>K(r)!==o&&!n.has(K(r)))??e.find(r=>K(r)!==o)}function di(e){let t=[];for(let n=0;n<e.length;n++){let o=e[(n-1+e.length)%e.length],r=e[n],l=e[(n+1)%e.length],a=(r[0]-o[0])*(l[1]-r[1])-(r[1]-o[1])*(l[0]-r[0]);Math.abs(a)>1e-9&&t.push(r)}return t.length>=3?t:e}function hi(e){let t=(l,a)=>[(l[0]+a[0])/2,(l[1]+a[1])/2],n=e.length,o=t(e[n-1],e[0]),r=e.map((l,a)=>[l,t(l,e[(a+1)%n])]);return{start:o,segments:r}}var Oe=new Map;function Sr(e){let t=`${e.width}x${e.height}:${e.cells}`,n=Oe.get(t);if(n)return n;let o=ui(e),r;if(!o)r={outline:null,problem:"invalid"};else if(e.cells.includes("1")){let l=mi(o,e.width,e.height),a=l.length>0?yr(l.map(hi)):null;r=a&&2*a.half>=Kt?{outline:a,problem:null}:{outline:null,problem:a?"thin":"empty"}}else r={outline:null,problem:"empty"};return Oe.size>16&&Oe.delete(Oe.keys().next().value),Oe.set(t,r),r}var pi=1,Mr=.5,Ar=.5,gi=.5;function lt(e){return Math.max(e,jt)}function ct(e){return e==="heart"?Er():typeof e=="object"&&e?.type==="silhouette"?Sr(e).outline:null}function Rr(e){return e==="circle"||ct(e)!==null}function ie(e,t,n){if(n==="circle"){let a=lt(t),i=(e/2+a)*Math.SQRT2+pi;return Math.ceil(i-e/2)}let o=ct(n);if(!o)return t;let r=lt(t),l=(e+2*(r+gi))/(2*o.half);return Math.ceil((l-e)/2-1e-9)}function Fr(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function bi(e,t,n){let o=ie(t,n,"circle"),r=lt(n),l=t+2*o,a=l/2,i=a-Mr-.5,s=Fr(Number.parseInt(vt(e),36)||1),c=o-r,u=o+t+r;return Array.from({length:l},(m,d)=>Array.from({length:l},(h,b)=>{let p=s()<Ar;return b>=c&&b<u&&d>=c&&d<u?!1:p&&Math.hypot(b+.5-a,d+.5-a)<=i}))}var yi=Array.from({length:8},(e,t)=>{let n=t*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function qt(e,t,n,o){if(o==="circle")return bi(e,t,n);let r=ct(o);if(!r)return null;let l=ie(t,n,o),a=lt(n),i=t+2*l,s=br(r.polygons),c=.5+Mr,u=(b,p)=>{let g=b+.5,f=p+.5;return s(g/i,f/i)?yi.every(([x,E])=>s((g+x*c)/i,(f+E*c)/i)):!1},m=Fr(Number.parseInt(vt(e),36)||1),d=l-a,h=l+t+a;return Array.from({length:i},(b,p)=>Array.from({length:i},(g,f)=>{let x=m()<Ar;return f>=d&&f<h&&p>=d&&p<h?!1:x&&u(f,p)}))}function Ut(e,t){if(e==="circle")return{circle:t/2};let n=ct(e);return n?{path:xr(n,t)}:null}function wr(e,t,n,o){if(!(e&&Number.isFinite(e))||e<=0||Rr(o)||n<=0)return 0;let r=Math.min(Jt,en*n/(t+2*n));return Math.min(e,r)}var Mi=({r:e,g:t,b:n})=>[.2126*e+.7152*t+.0722*n,.299*e+.587*t+.114*n],Ga=Mi(de(tn));function Pr(e,t){return e.slice().map((n,o)=>o<t.y||o>=t.y+t.h?n:n.map((r,l)=>l<t.x||l>=t.x+t.w?r:!1))}function Ht(e,t=0){let n=[];return e.forEach((o,r)=>{let l=null;o.forEach((a,i)=>{if(!a&&l!==null){n.push(We`M${l+t} ${r+t}h${i-l}v1H${l+t}z`),l=null;return}if(i===o.length-1){if(!a)return;l===null?n.push(We`M${i+t},${r+t} h1v1H${i+t}z`):n.push(We`M${l+t},${r+t} h${i+1-l}v1H${l+t}z`);return}a&&l===null&&(l=i)})}),n.join("")}function De(e,t,n,o){if(o==null)return null;let r=e.length,l=Math.floor(t*Ye),a=(r+2*n)/t,i=(o.width||l)*a,s=(o.height||l)*a,c=o.x==null?r/2-i/2:o.x*a,u=o.y==null?r/2-s/2:o.y*a,m=null;if(o.excavate){let d=Math.max(0,o.padding??0)*a,h=Math.floor(c-d),b=Math.floor(u-d),p=Math.ceil(i+c+d-h),g=Math.ceil(s+u+d-b);m={x:h,y:b,w:p,h:g}}return{x:c,y:u,h:s,w:i,excavation:m}}function ut(e){let t=e.level??be,{imageSettings:n}=e,o=e.isOGContext&&n?.excavate&&(t==="L"||t==="M")?"Q":t;if(e.autoLevel&&n&&o!=="H"){let r=H.QrCode.encodeText(e.value,te[o]).getModules(),l=De(r,e.size??Ge,ie(r.length,e.margin??ze,e.shape),n);l&&(l.excavation?l.excavation.w*l.excavation.h:l.w*l.h)/(r.length*r.length)>Zt&&(o="H")}return o}var Gt=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var Ai=.6,Ri=["L","M","Q","H"];function Fi(e){let t=H.QrCode.encodeText(e.value,te[e.level]),n=Ri[t.errorCorrectionLevel.ordinal]??e.level;return{code:e,cells:t.getModules(),layoutMargin:ie(t.size,e.margin,e.shape),map:mr(t.version,n),level:n,version:t.version}}function wi(e,t){let{cells:n,map:o}=e,r=n.length,l=De(n,e.code.size,e.layoutMargin,t);if(!l)return null;let a=l.excavation??{x:Math.floor(l.x),y:Math.floor(l.y),w:Math.ceil(l.x+l.w)-Math.floor(l.x),h:Math.ceil(l.y+l.h)-Math.floor(l.y)},i=[];for(let c=Math.max(0,a.y);c<Math.min(r,a.y+a.h);c++)for(let u=Math.max(0,a.x);u<Math.min(r,a.x+a.w);u++)i.push(c*r+u);let s=fr(o,i);return{worst:Math.max(0,...s),correctable:o.correctable,budget:Math.floor(o.correctable*Ai),level:e.level,version:e.version}}var Pi=e=>!e||e.worst<=e.budget;function Ci(e,t,n,o){let r=t.map(i=>Fi({...e,level:i})),l=i=>{let s=o(i);return r.every(c=>Pi(wi(c,s)))};if(l(n))return n;let a=e.size*.005;for(let i=n-a;i>0;i-=a)if(l(i))return i;return 0}function Cr(e,t){if(!t)return;let n=Math.floor(e.size*Ye),o=t.width||n,r=t.height||n,l=d=>{if(d===o)return t;let h=r*d/o;return{...t,width:d,height:h,...t.x!=null&&{x:t.x+(o-d)/2},...t.y!=null&&{y:t.y+(r-h)/2}}},a=e.level??be,i={value:e.value,size:e.size,margin:e.margin,shape:e.shape},s=d=>ut({...e,level:a,imageSettings:d}),c=d=>{let h=Ci(i,[d],o,l);return h>0?l(h):void 0},u=s(t);if(u===a)return c(a);let m=c(u);return m&&s(m)===u?m:c(a)}import{Fragment as Ii,jsx as _r,jsxs as vi}from"react/jsx-runtime";function bl(e){let{value:t,size:n=Ge,level:o=be,bgColor:r=ne,fgColor:l=Qe,margin:a=ze,style:i,imageSettings:s,eyeColor:c,dotColor:u,bodyPattern:m,cornerEyePattern:d,cornerEyeDotPattern:h,isOGContext:b,templateId:p,customTemplate:g,customProps:f,frame:x,art:E,eyeColors:A,moduleScale:M,eyeShapes:S,eyeGradient:R,halo:C,shadow:$,autoLevel:B,shape:q,bgRadius:W,backdrop:V,frameLabelMarkers:se,partMarkers:Me,...Ae}=e,J=Cr({value:t,size:n,margin:a,level:o,shape:q,autoLevel:B},s),G=ut({value:t,size:n,level:o,margin:a,imageSettings:J,autoLevel:B,shape:q}),O=J?.src,k=ar(x)?lr(n,x,r):null,ee=k?.width??n,Re=k?.height??n,Fe=Lr(null),Be=Lr(null),[Qt,mt]=_i(!1);Li(()=>{if(Fe.current!=null){let ft=Fe.current,w=ft.getContext("2d");if(!w)return;let X=H.QrCode.encodeText(t,te[G]).getModules(),ae=ie(X.length,a,q),dt=qt(t,X.length,a,q),Y=X.length+ae*2,le=De(X,n,ae,J),qe=Be.current,Yt=le!=null&&qe?.complete&&qe.naturalHeight!==0&&qe.naturalWidth!==0;Yt&&le.excavation!=null&&(X=Pr(X,le.excavation));let Ue=window.devicePixelRatio||1;ft.width=ee*Ue,ft.height=Re*Ue,w.scale(Ue,Ue),k&&(cr(w,k),w.translate(k.qrX,k.qrY));let Wt=n/Y;w.scale(Wt,Wt),w.fillStyle=Ne(r,ne);let we=Ut(q,Y),Vt=wr(W,X.length,ae,q)*Y;if(we&&"circle"in we?(w.beginPath(),w.arc(Y/2,Y/2,we.circle,0,2*Math.PI),w.fill()):we&&Gt?w.fill(new Path2D(we.path),"evenodd"):Vt>0&&typeof w.roundRect=="function"?(V&&(w.save(),w.fillStyle=V,w.fillRect(0,0,Y,Y),w.restore()),w.beginPath(),w.roundRect(0,0,Y,Y,Vt),w.fill()):w.fillRect(0,0,Y,Y),w.fillStyle=Ne(l,Qe),Gt)w.fill(new Path2D(Ht(X,ae))),dt&&w.fill(new Path2D(Ht(dt,0)));else for(let[He,pe]of[[X,ae],[dt??[],0]])He.forEach((Pe,ce)=>{Pe.forEach((vr,Tr)=>{vr&&w.fillRect(Tr+pe,ce+pe,1,1)})});if(Yt){let He={x:le.x+ae,y:le.y+ae,w:le.w,h:le.h},pe=J?.shape??"square",Pe=J?.plate,ce=ur(He,Pe);w.save(),Pe&&(Dt(w,pe,He),w.fillStyle=Pe,w.fill()),pe!=="square"&&(Dt(w,pe,ce),w.clip()),w.drawImage(qe,ce.x,ce.y,ce.w,ce.h),w.restore()}}});let Ir={height:Re,width:ee,...i},zt=null;return O!=null&&(zt=_r("img",{alt:"QR code",onLoad:()=>{mt(!0)},ref:Be,src:O,style:{display:"none"}},O)),vi(Ii,{children:[_r("canvas",{height:Re,ref:Fe,style:Ir,width:ee,...Ae}),zt]})}export{bl as QRCodeCanvas};
|
|
1
|
+
"use client";import{createElement as zt,Fragment as Ii,useEffect as vi,useRef as Ir,useState as Ti}from"react";var he;(l=>{class e{constructor(i,s,c,u){this.version=i;this.errorCorrectionLevel=s;if(i<e.MIN_VERSION||i>e.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let d=this.addEccAndInterleave(c);if(this.drawCodewords(d),u==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);let p=this.getPenaltyScore();p<h&&(u=b,h=p),this.applyMask(b)}}o(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(i,s){let c=l.QrSegment.makeSegments(i);return e.encodeSegments(c,s)}static encodeBinary(i,s){let c=l.QrSegment.makeBytes(i);return e.encodeSegments([c],s)}static encodeSegments(i,s,c=1,u=40,m=-1,d=!0){if(!(e.MIN_VERSION<=c&&c<=u&&u<=e.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,b;for(h=c;;h++){let x=e.getNumDataCodewords(h,s)*8,E=r.getTotalBits(i,h);if(E<=x){b=E;break}if(h>=u)throw new RangeError("Data too long")}for(let x of[e.Ecc.MEDIUM,e.Ecc.QUARTILE,e.Ecc.HIGH])d&&b<=e.getNumDataCodewords(h,x)*8&&(s=x);let p=[];for(let x of i){t(x.mode.modeBits,4,p),t(x.numChars,x.mode.numCharCountBits(h),p);for(let E of x.getData())p.push(E)}o(p.length==b);let g=e.getNumDataCodewords(h,s)*8;o(p.length<=g),t(0,Math.min(4,g-p.length),p),t(0,(8-p.length%8)%8,p),o(p.length%8==0);for(let x=236;p.length<g;x^=253)t(x,8,p);let f=[];for(;f.length*8<p.length;)f.push(0);return p.forEach((x,E)=>f[E>>>3]|=x<<7-(E&7)),new e(h,s,f,m)}size;mask;modules=[];isFunction=[];getModule(i,s){return 0<=i&&i<this.size&&0<=s&&s<this.size&&this.modules[s][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let i=this.getAlignmentPatternPositions(),s=i.length;for(let c=0;c<s;c++)for(let u=0;u<s;u++)c==0&&u==0||c==0&&u==s-1||c==s-1&&u==0||this.drawAlignmentPattern(i[c],i[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){let s=this.errorCorrectionLevel.formatBits<<3|i,c=s;for(let m=0;m<10;m++)c=c<<1^(c>>>9)*1335;let u=(s<<10|c)^21522;o(u>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(u,m));this.setFunctionModule(8,7,n(u,6)),this.setFunctionModule(8,8,n(u,7)),this.setFunctionModule(7,8,n(u,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(u,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(u,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(u,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let c=0;c<12;c++)i=i<<1^(i>>>11)*7973;let s=this.version<<12|i;o(s>>>18==0);for(let c=0;c<18;c++){let u=n(s,c),m=this.size-11+c%3,d=Math.floor(c/3);this.setFunctionModule(m,d,u),this.setFunctionModule(d,m,u)}}drawFinderPattern(i,s){for(let c=-4;c<=4;c++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(c)),d=i+u,h=s+c;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,m!=2&&m!=4)}}drawAlignmentPattern(i,s){for(let c=-2;c<=2;c++)for(let u=-2;u<=2;u++)this.setFunctionModule(i+u,s+c,Math.max(Math.abs(u),Math.abs(c))!=1)}setFunctionModule(i,s,c){this.modules[s][i]=c,this.isFunction[s][i]=!0}addEccAndInterleave(i){let s=this.version,c=this.errorCorrectionLevel;if(i.length!=e.getNumDataCodewords(s,c))throw new RangeError("Invalid argument");let u=e.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][s],m=e.ECC_CODEWORDS_PER_BLOCK[c.ordinal][s],d=Math.floor(e.getNumRawDataModules(s)/8),h=u-d%u,b=Math.floor(d/u),p=[],g=e.reedSolomonComputeDivisor(m);for(let x=0,E=0;x<u;x++){let A=i.slice(E,E+b-m+(x<h?0:1));E+=A.length;let M=e.reedSolomonComputeRemainder(A,g);x<h&&A.push(0),p.push(A.concat(M))}let f=[];for(let x=0;x<p[0].length;x++)p.forEach((E,A)=>{(x!=b-m||A>=h)&&f.push(E[x])});return o(f.length==d),f}drawCodewords(i){if(i.length!=Math.floor(e.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){let d=c-m,b=(c+1&2)==0?this.size-1-u:u;!this.isFunction[b][d]&&s<i.length*8&&(this.modules[b][d]=n(i[s>>>3],7-(s&7)),s++)}}o(s==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let c=0;c<this.size;c++){let u;switch(i){case 0:u=(c+s)%2==0;break;case 1:u=s%2==0;break;case 2:u=c%3==0;break;case 3:u=(c+s)%3==0;break;case 4:u=(Math.floor(c/3)+Math.floor(s/2))%2==0;break;case 5:u=c*s%2+c*s%3==0;break;case 6:u=(c*s%2+c*s%3)%2==0;break;case 7:u=((c+s)%2+c*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][c]&&u&&(this.modules[s][c]=!this.modules[s][c])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[m][p]==d?(h++,h==5?i+=e.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*e.PENALTY_N3),d=this.modules[m][p],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*e.PENALTY_N3}for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][m]==d?(h++,h==5?i+=e.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*e.PENALTY_N3),d=this.modules[p][m],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*e.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let d=0;d<this.size-1;d++){let h=this.modules[m][d];h==this.modules[m][d+1]&&h==this.modules[m+1][d]&&h==this.modules[m+1][d+1]&&(i+=e.PENALTY_N2)}let s=0;for(let m of this.modules)s=m.reduce((d,h)=>d+(h?1:0),s);let c=this.size*this.size,u=Math.ceil(Math.abs(s*20-c*10)/c)-1;return o(0<=u&&u<=9),i+=u*e.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{let i=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2,c=[6];for(let u=this.size-7;c.length<i;u-=s)c.splice(1,0,u);return c}}static getNumRawDataModules(i){if(i<e.MIN_VERSION||i>e.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*i+128)*i+64;if(i>=2){let c=Math.floor(i/7)+2;s-=(25*c-10)*c-55,i>=7&&(s-=36)}return o(208<=s&&s<=29648),s}static getNumDataCodewords(i,s){return Math.floor(e.getNumRawDataModules(i)/8)-e.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i]*e.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let s=[];for(let u=0;u<i-1;u++)s.push(0);s.push(1);let c=1;for(let u=0;u<i;u++){for(let m=0;m<s.length;m++)s[m]=e.reedSolomonMultiply(s[m],c),m+1<s.length&&(s[m]^=s[m+1]);c=e.reedSolomonMultiply(c,2)}return s}static reedSolomonComputeRemainder(i,s){let c=s.map(u=>0);for(let u of i){let m=u^c.shift();c.push(0),s.forEach((d,h)=>c[h]^=e.reedSolomonMultiply(d,m))}return c}static reedSolomonMultiply(i,s){if(i>>>8||s>>>8)throw new RangeError("Byte out of range");let c=0;for(let u=7;u>=0;u--)c=c<<1^(c>>>7)*285,c^=(s>>>u&1)*i;return o(c>>>8==0),c}finderPenaltyCountPatterns(i){let s=i[1];o(s<=this.size*3);let c=s>0&&i[2]==s&&i[3]==s*3&&i[4]==s&&i[5]==s;return(c&&i[0]>=s*4&&i[6]>=s?1:0)+(c&&i[6]>=s*4&&i[0]>=s?1:0)}finderPenaltyTerminateAndCount(i,s,c){return i&&(this.finderPenaltyAddHistory(s,c),s=0),s+=this.size,this.finderPenaltyAddHistory(s,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(i,s){s[0]==0&&(i+=this.size),s.pop(),s.unshift(i)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}l.QrCode=e;function t(a,i,s){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let c=i-1;c>=0;c--)s.push(a>>>c&1)}function n(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}class r{constructor(i,s,c){this.mode=i;this.numChars=s;this.bitData=c;if(s<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}mode;numChars;bitData;static makeBytes(i){let s=[];for(let c of i)t(c,8,s);return new r(r.Mode.BYTE,i.length,s)}static makeNumeric(i){if(!r.isNumeric(i))throw new RangeError("String contains non-numeric characters");let s=[];for(let c=0;c<i.length;){let u=Math.min(i.length-c,3);t(parseInt(i.substr(c,u),10),u*3+1,s),c+=u}return new r(r.Mode.NUMERIC,i.length,s)}static makeAlphanumeric(i){if(!r.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],c;for(c=0;c+2<=i.length;c+=2){let u=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c))*45;u+=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c+1)),t(u,11,s)}return c<i.length&&t(r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)),6,s),new r(r.Mode.ALPHANUMERIC,i.length,s)}static makeSegments(i){return i==""?[]:r.isNumeric(i)?[r.makeNumeric(i)]:r.isAlphanumeric(i)?[r.makeAlphanumeric(i)]:[r.makeBytes(r.toUtf8ByteArray(i))]}static makeEci(i){let s=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)t(i,8,s);else if(i<16384)t(2,2,s),t(i,14,s);else if(i<1e6)t(6,3,s),t(i,21,s);else throw new RangeError("ECI assignment value out of range");return new r(r.Mode.ECI,0,s)}static isNumeric(i){return r.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return r.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,s){let c=0;for(let u of i){let m=u.mode.numCharCountBits(s);if(u.numChars>=1<<m)return 1/0;c+=4+m+u.bitData.length}return c}static toUtf8ByteArray(i){i=encodeURI(i);let s=[];for(let c=0;c<i.length;c++)i.charAt(c)!="%"?s.push(i.charCodeAt(c)):(s.push(parseInt(i.substr(c+1,2),16)),c+=2);return s}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}l.QrSegment=r})(he||={});(t=>{let e;(o=>{class n{constructor(l,a){this.ordinal=l;this.formatBits=a}ordinal;formatBits;static LOW=new n(0,1);static MEDIUM=new n(1,0);static QUARTILE=new n(2,3);static HIGH=new n(3,2)}o.Ecc=n})(e=t.QrCode||={})})(he||={});(t=>{let e;(o=>{class n{constructor(l,a){this.modeBits=l;this.numBitsCharCount=a}modeBits;numBitsCharCount;static NUMERIC=new n(1,[10,12,14]);static ALPHANUMERIC=new n(2,[9,11,13]);static BYTE=new n(4,[8,16,16]);static KANJI=new n(8,[8,10,12]);static ECI=new n(7,[0,0,0]);numCharCountBits(l){return this.numBitsCharCount[Math.floor((l+7)/17)]}}o.Mode=n})(e=t.QrSegment||={})})(he||={});var G=he;var Qe={L:G.QrCode.Ecc.LOW,M:G.QrCode.Ecc.MEDIUM,Q:G.QrCode.Ecc.QUARTILE,H:G.QrCode.Ecc.HIGH},ze=128,pe="Q",te="#FFFFFF",Ye="#000000";var We=0;var Ve=.1;var Pe=24;var jt=.5,Ce=1.5;var Kt=.07;var Jt=3,pt=64,gt=8,en=.42;var tn=.5,nn=2;var rn="#d1d5db";function Nr(e,t=3){let n=10**t;return Math.round(e*n)/n+0}function y(e,t=3){return String(Nr(e,t))}function Xe(e,...t){let n=e[0]??"";for(let o=0;o<t.length;o++){let r=t[o];n+=(typeof r=="number"?y(r):r)+(e[o+1]??"")}return n}var Or={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Dr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,bt=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Le(e,t=Number.POSITIVE_INFINITY){if(!Dr.test(e))return null;let n=[],o=0,r=()=>{for(;o<e.length&&/[\s,]/.test(e[o]);)o++},l=()=>{r(),bt.lastIndex=o;let s=bt.exec(e);if(!s)return null;let c=s[0],u=c.indexOf(".");if(u>=0&&c.length-u-1>t)return null;o=bt.lastIndex;let m=Number(c);return Number.isFinite(m)?m:null},a=()=>{r();let s=e[o];return s==="0"||s==="1"?(o++,s==="1"?1:0):null},i=()=>(r(),o<e.length&&/[0-9.+-]/.test(e[o]));for(r();o<e.length;){let s=e[o],c=s.toUpperCase(),u=Or[c];if(u===void 0||n.length===0&&c!=="M")return null;if(o++,u===0){n.push({command:s,values:[]}),r();continue}let m=s,d=!0;for(;d||i();){let h=[];for(let b=0;b<u;b++){let p=c==="A"&&(b===3||b===4)?a():l();if(p===null)return null;h.push(p)}n.push({command:m,values:h}),c==="M"&&(m=s==="M"?"L":"l"),d=!1}r()}return n}function on(e){let t=0;for(let{command:n}of e)t+=n.toUpperCase()==="A"?4:1;return t}function yt(e,t=1,n=0,o=0){let r="";for(let{command:l,values:a}of e){let i=l.toUpperCase(),s=l===i,c=s?n:0,u=s?o:0,m;switch(i){case"Z":m=[];break;case"H":m=[y(a[0]*t+c)];break;case"V":m=[y(a[0]*t+u)];break;case"A":m=[y(Math.abs(a[0])*t),y(Math.abs(a[1])*t),y(a[2]),String(a[3]),String(a[4]),y(a[5]*t+c),y(a[6]*t+u)];break;default:m=a.map((d,h)=>y(d*t+(h%2===0?c:u)))}r+=l+m.join(" ")}return r}function an(e,t=.25){let n=[],o=[],r=[0,0],l=[0,0],a=()=>{o.length>2&&n.push(o),o=[]};for(let i of e)if(i.op==="M")a(),r=[i.x,i.y],l=r,o.push(r);else if(i.op==="L")l=[i.x,i.y],o.push(l);else if(i.op==="C"){let s=l,c=[i.x1,i.y1],u=[i.x2,i.y2],m=[i.x,i.y],d=Math.hypot(c[0]-s[0],c[1]-s[1])+Math.hypot(u[0]-c[0],u[1]-c[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),h=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(d/(4*t)))));for(let b=1;b<=h;b++){let p=b/h,g=1-p;o.push([g*g*g*s[0]+3*g*g*p*c[0]+3*g*p*p*u[0]+p*p*p*m[0],g*g*g*s[1]+3*g*g*p*c[1]+3*g*p*p*u[1]+p*p*p*m[1]])}l=m}else a(),l=r;return a(),n}function Ze(e,t){let n=[r=>r[0]-t.x0,r=>t.x1-r[0],r=>r[1]-t.y0,r=>t.y1-r[1]],o=e;for(let r of n){if(o.length===0)break;let l=o;o=[];for(let a=0;a<l.length;a++){let i=l[a],s=l[(a+l.length-1)%l.length],c=r(i),u=r(s);c>=0?(u<0&&o.push(sn(s,i,u,c)),o.push(i)):u>=0&&o.push(sn(s,i,u,c))}}return o.length>2?o:[]}function sn(e,t,n,o){let r=n/(n-o);return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r]}function ln(e){return e.filter(t=>t.length>2).map(t=>`M${t.map(([n,o])=>`${y(n)} ${y(o)}`).join("L")}Z`).join("")}function cn(e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,l=(a,i)=>{t=Math.min(t,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i)};for(let a of e)a.op==="C"?(l(a.x1,a.y1),l(a.x2,a.y2),l(a.x,a.y)):a.op!=="Z"&&l(a.x,a.y);return Number.isFinite(t)?{x0:t,y0:n,x1:o,y1:r}:null}var xt=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Br(e,t,n,o,r,l,a,i,s){if(e===i&&t===s)return[];let c=Math.abs(n),u=Math.abs(o);if(c===0||u===0)return[{op:"L",x:i,y:s}];let m=r*Math.PI/180,d=Math.cos(m),h=Math.sin(m),b=(e-i)/2,p=(t-s)/2,g=d*b+h*p,f=-h*b+d*p,x=g*g/(c*c)+f*f/(u*u);x>1&&(c*=Math.sqrt(x),u*=Math.sqrt(x));let E=c*c*u*u-c*c*f*f-u*u*g*g,A=c*c*f*f+u*u*g*g,M=(l===a?-1:1)*Math.sqrt(Math.max(0,E/A)),S=M*c*f/u,R=-M*u*g/c,C=d*S-h*R+(e+i)/2,$=h*S+d*R+(t+s)/2,B=(k,U,H,W)=>Math.atan2(k*W-U*H,k*H+U*W),Y=B(1,0,(g-S)/c,(f-R)/u),O=B((g-S)/c,(f-R)/u,(-g-S)/c,(-f-R)/u);!a&&O>0?O-=2*Math.PI:a&&O<0&&(O+=2*Math.PI);let ee=Math.max(1,Math.ceil(Math.abs(O)/(Math.PI/2)-1e-9)),X=O/ee,Se=4/3*Math.tan(X/4),De=(k,U)=>[C+c*d*k-u*h*U,$+c*h*k+u*d*U],Be=[];for(let k=0;k<ee;k++){let U=Y+k*X,H=U+X,[W,Me]=De(Math.cos(U)-Se*Math.sin(U),Math.sin(U)+Se*Math.cos(U)),[Ae,Re]=De(Math.cos(H)+Se*Math.sin(H),Math.sin(H)-Se*Math.cos(H)),[qe,Yt]=k===ee-1?[i,s]:De(Math.cos(H),Math.sin(H));Be.push({op:"C",x1:W,y1:Me,x2:Ae,y2:Re,x:qe,y:Yt})}return Be}function je(e){let t=[],n=0,o=0,r=0,l=0,a=0,i="",s=null,c=null,u=()=>{for(;n<e.length&&/[\s,]/.test(e[n]);)n++},m=()=>{u(),xt.lastIndex=n;let b=xt.exec(e);return b?(n=xt.lastIndex,Number(b[0])):null},d=()=>{u();let b=e[n];return b==="0"||b==="1"?(n++,b==="1"):null},h=b=>{let p=[];for(let g=0;g<b;g++){let f=m();if(f===null)return null;p.push(f)}return p};for(;u(),!(n>=e.length);){let b=e[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(b))i=b,n++;else if(!i||i==="Z"||i==="z")break;let p=i===i.toLowerCase(),g=p?o:0,f=p?r:0,x=i.toUpperCase();if(x==="Z"){t.push({op:"Z"}),o=l,r=a,s=null,c=null;continue}if(x==="A"){let S=h(3),R=d(),C=d(),$=h(2);if(!(S&&$)||R===null||C===null)break;let[B,Y,O]=S,ee=$[0]+g,X=$[1]+f;t.push(...Br(o,r,B,Y,O,R,C,ee,X)),o=ee,r=X,s=null,c=null;continue}let E={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[x]??0,A=h(E);if(!A)break;let M=A;switch(x){case"M":o=M[0]+g,r=M[1]+f,l=o,a=r,t.push({op:"M",x:o,y:r}),i=p?"l":"L",s=null,c=null;break;case"L":case"H":case"V":x!=="V"&&(o=M[0]+g),x==="V"?r=M[0]+f:x==="L"&&(r=M[1]+f),t.push({op:"L",x:o,y:r}),s=null,c=null;break;case"C":case"S":{let S,R;x==="C"?(S=[M[0]+g,M[1]+f],R=M.slice(2)):(S=s?[2*o-s[0],2*r-s[1]]:[o,r],R=M);let C=[R[0]+g,R[1]+f],$=[R[2]+g,R[3]+f];t.push({op:"C",x1:S[0],y1:S[1],x2:C[0],y2:C[1],x:$[0],y:$[1]}),[o,r]=$,s=C,c=null;break}case"Q":case"T":{let S,R;x==="Q"?(S=[M[0]+g,M[1]+f],R=[M[2]+g,M[3]+f]):(S=c?[2*o-c[0],2*r-c[1]]:[o,r],R=[M[0]+g,M[1]+f]),t.push({op:"C",x1:o+2/3*(S[0]-o),y1:r+2/3*(S[1]-r),x2:R[0]+2/3*(S[0]-R[0]),y2:R[1]+2/3*(S[1]-R[1]),x:R[0],y:R[1]}),[o,r]=R,c=S,s=null;break}default:break}}return t}var un=.5522847498;function Et(e,t,n,o,r=0,l=0){if(n<=0||o<=0)return[];let a=Math.min(Math.max(r,0),n/2),i=Math.min(Math.max(l,0),o/2);if(a===0||i===0)return[{op:"M",x:e,y:t},{op:"L",x:e+n,y:t},{op:"L",x:e+n,y:t+o},{op:"L",x:e,y:t+o},{op:"Z"}];let s=a*un,c=i*un,u=e+n,m=t+o;return[{op:"M",x:e+a,y:t},{op:"L",x:u-a,y:t},{op:"C",x1:u-a+s,y1:t,x2:u,y2:t+i-c,x:u,y:t+i},{op:"L",x:u,y:m-i},{op:"C",x1:u,y1:m-i+c,x2:u-a+s,y2:m,x:u-a,y:m},{op:"L",x:e+a,y:m},{op:"C",x1:e+a-s,y1:m,x2:e,y2:m-i+c,x:e,y:m-i},{op:"L",x:e,y:t+i},{op:"C",x1:e,y1:t+i-c,x2:e+a-s,y2:t,x:e+a,y:t},{op:"Z"}]}var fn="qrdx.frame",dn=1,hn="custom",I={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:Pe},pn=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Ke=.95,qr=200,gn=["frame","text","accent","background"],Ur=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Hr=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function Mt(e,t=Pe){let n=e.slice(0,1e3).normalize("NFC").replace(Ur," ").replace(Hr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,t)).join("").trim()}var Je=e=>Math.abs(e*1e3-Math.round(e*1e3))<1e-6;function At(e){let t=et(e);return{x0:e.qr.x-t,y0:e.qr.y-t,x1:e.qr.x+e.qr.size+t,y1:e.qr.y+e.qr.size+t}}function Gr(e){return{x0:e.qr.x,y0:e.qr.y,x1:e.qr.x+e.qr.size,y1:e.qr.y+e.qr.size}}function et(e){return e.qr.padding??e.qr.size*I.defaultPadding}var Rt=.52,Qr=.35;function zr(e){let t=e.fontSize??e.box.height*Rt;return Math.min(t*Ce,e.box.height*Ke)}var St=(e,t)=>Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0)>1e-6&&Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)>1e-6;function mn(e){let t=At(e),n=Math.min(e.qr.radius??0,(t.x1-t.x0)/2,(t.y1-t.y0)/2),o=[[t.x0+n,t.y0+n,Math.PI],[t.x1-n,t.y0+n,-Math.PI/2],[t.x1-n,t.y1-n,0],[t.x0+n,t.y1-n,Math.PI/2]],r=[];for(let[l,a,i]of o)for(let s=0;s<=8;s++){let c=i+Math.PI/2*(s/8);r.push([l+n*Math.cos(c),a+n*Math.sin(c)])}return r}function Yr([e,t],n,o){if(e<n.x-.01||t<n.y-.01||e>n.x+n.width+.01||t>n.y+n.height+.01)return!1;let l=Math.min(o,n.width/2,n.height/2),a=Math.min(Math.max(e,n.x+l),n.x+n.width-l),i=Math.min(Math.max(t,n.y+l),n.y+n.height-l);return Math.hypot(e-a,t-i)<=l+.01}function Wr(e){let t=0;return e.forEach(([n,o],r)=>{let[l,a]=e[(r+1)%e.length];t+=n*a-l*o}),Math.abs(t)/2}function Vr(e,t,n){let o=At(t);if(!St(n,o))return!1;if("stroke"in e&&e.stroke)return!0;if(e.fill==="background")return!1;if(e.type==="rect"&&e.hole){let{hole:r}=e;return!mn(t).every(l=>Yr(l,r,r.radius??0))}if(e.type==="circle"&&e.hole){let r=e.hole;return!mn(t).every(([l,a])=>Math.hypot(l-e.cx,a-e.cy)<=r+.01)}if(e.type==="polygon"){let r=Ze(e.points,o);return r.length>2&&Wr(r)>1e-6}return!0}function Ft(e){let t=Xr(e),n="stroke"in e?e.stroke:void 0;if(!(n&&t.bounds))return t;let o=e.type==="circle"||e.type==="ellipse"?n.width/2:e.type==="rect"?n.width*Math.SQRT2/2:n.width*2,{x0:r,y0:l,x1:a,y1:i}=t.bounds;return{bounds:{x0:r-o,y0:l-o,x1:a+o,y1:i+o},segments:t.segments*2}}function Xr(e){switch(e.type){case"rect":return{bounds:{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height},segments:e.hole?18:9};case"circle":return{bounds:{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r},segments:e.hole?10:5};case"ellipse":return{bounds:{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry},segments:5};case"polygon":{let t=e.points.map(([o])=>o),n=e.points.map(([,o])=>o);return{bounds:{x0:Math.min(...t),y0:Math.min(...n),x1:Math.max(...t),y1:Math.max(...n)},segments:e.points.length}}case"path":{let t=Le(e.d,I.maxDecimals);return t?{bounds:cn(je(e.d)),segments:on(t)}:{bounds:null,segments:0}}case"line":{let t=e.width/2,n=Math.hypot(e.x2-e.x1,e.y2-e.y1),o=e.dash?Math.ceil(n/(e.dash[0]+e.dash[1])):1;return{bounds:{x0:Math.min(e.x1,e.x2)-t,y0:Math.min(e.y1,e.y2)-t,x1:Math.max(e.x1,e.x2)+t,y1:Math.max(e.y1,e.y2)+t},segments:o*(e.cap==="round"?4:5)}}default:return{bounds:{x0:e.x,y0:e.y,x1:e.x+e.size,y1:e.y+e.size},segments:qr}}}function bn(e,t){let n=I,o=new TextEncoder().encode(JSON.stringify(e)).length;if(o>n.maxBytes){t(`The spec is ${o} bytes; the limit is ${n.maxBytes}`);return}let{width:r,height:l}=e.artboard,a=Math.max(r,l)*.005,i={x0:-a,y0:-a,x1:r+a,y1:l+a},s=f=>f.x0>=i.x0&&f.y0>=i.y0&&f.x1<=i.x1&&f.y1<=i.y1,{qr:c}=e,u=et(e);c.plate!=="none"&&u<c.size*n.minPadding-1e-9&&t(`qr.padding must be at least ${n.minPadding*100}% of qr.size`,["qr","padding"]),c.size<Math.min(r,l)*n.minQrShare-1e-9&&t(`qr.size must be at least ${n.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let m=At(e);(m.x0<-1e-9||m.y0<-1e-9||m.x1>r+1e-9||m.y1>l+1e-9)&&t("The code and its padding must sit inside the artboard",["qr"]),(c.radius??0)>(c.size+2*u)/2&&t("qr.radius is larger than half the plate",["qr","radius"]);let d=0,h=0;e.shapes.forEach((f,x)=>{let E=["shapes",x],{bounds:A,segments:M}=Ft(f);if(!A){t("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...E,"d"]);return}if(s(A)||t("The shape extends outside the artboard",E),f.type==="rect"&&f.hole){let{hole:S}=f;(S.x<f.x||S.y<f.y||S.x+S.width>f.x+f.width+1e-9||S.y+S.height>f.y+f.height+1e-9)&&t("The hole must sit inside its rect",[...E,"hole"])}f.type==="circle"&&f.hole&&f.hole>=f.r&&t("The hole must be smaller than the circle",[...E,"hole"]),"stroke"in f&&f.stroke&&f.stroke.width>Math.min(r,l)*.1+1e-9&&t("A stroke may be at most 10% of the artboard's shorter side",[...E,"stroke","width"]),c.plate==="background"&&Vr(f,e,A)&&t('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',E),d+=M,typeof f.fill=="object"&&"gradient"in f.fill&&(h+=(f.fill.gradient.steps??32)*M)}),d>n.maxSegments&&t(`The shapes have ${d} segments; the limit is ${n.maxSegments}`,["shapes"]),h>n.maxGradientWork&&t("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let b=[],p=new Set,g=new Set;e.labels.forEach((f,x)=>{let E=["labels",x];p.has(f.id)&&t(`Label id "${f.id}" is used twice`,[...E,"id"]),p.add(f.id),f.slot!=="fixed"&&(g.has(f.slot)&&t(`Only one label may use the ${f.slot} slot`,[...E,"slot"]),g.add(f.slot));let A=f.maxLength??n.maxTextLength;f.text!==Mt(f.text,A)&&t(`Label text must be at most ${A} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...E,"text"]);let M;if(f.type==="text"){M={x0:f.box.x,y0:f.box.y,x1:f.box.x+f.box.width,y1:f.box.y+f.box.height},f.fontSize!==void 0&&f.fontSize>f.box.height*Ke+1e-9&&t("fontSize may be at most 95% of the label's row height",[...E,"fontSize"]);let S=f.box.y+f.box.height/2,R=zr(f)*Qr,C={x0:M.x0,x1:M.x1,y0:S-R,y1:S+R};(St(M,Gr(e))||St(C,m))&&t("The label overlaps the code or its padding",[...E,"box"])}else{let{cx:S,cy:R,radius:C}=f.curve,$=f.fontSize*Ce*.6;M={x0:S-C-$,y0:R-C-$,x1:S+C+$,y1:R+C+$};let B=Math.hypot(Math.max(m.x0-S,0,S-m.x1),Math.max(m.y0-R,0,R-m.y1));Math.hypot(Math.max(Math.abs(m.x0-S),Math.abs(m.x1-S)),Math.max(Math.abs(m.y0-R),Math.abs(m.y1-R)))<=C-$||B>=C+$||t("The curved label crosses the code or its padding",[...E,"curve"])}if(s(M)||t("The label extends outside the artboard",E),f.collapse){let S=f.collapse,R=S.y+S.height;(S.y<-1e-9||R>l+1e-9)&&t("The collapse band must sit inside the artboard",[...E,"collapse"]),R>m.y0+1e-6&&S.y<m.y1-1e-6&&t("The collapse band crosses the code or its padding",[...E,"collapse"]);for(let C of b)R>C.y+1e-6&&S.y<C.y+C.height-1e-6&&t("Collapse bands may not overlap",[...E,"collapse"]);b.push(S)}})}var wt=(e,t=0)=>{for(let n=t;n<e.length;n++)if(e[n]?.continue!==!0)return!0;return!1};function ne(e,t=[],n={}){return{...n,run(o){let r=e({value:o,issues:[]}),l=wt(r.issues);for(let a of t){if(a.hasLength){let s=r.value;if(r.issues.some(c=>c.continue===!1)||s===null||s===void 0||s.length===void 0)continue}else if(l)continue;let i=r.issues.length;a.run(r),!l&&r.issues.length>i&&(l=wt(r.issues,i))}return r}}}function Zr(e){if(typeof e=="number")return Number.isNaN(e)?"NaN":Number.isFinite(e)?"number":String(e);if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object"){let t=e.constructor;if(Object.getPrototypeOf(e)!==Object.prototype&&"constructor"in e&&t)return t.name}return typeof e}var ce=(e,t)=>({path:[],message:`Invalid input: expected ${e}, received ${Zr(t)}`}),jr={string:"characters",array:"items"};function j(e,t,n,o){let r=jr[t],l=e?"Too big":"Too small",a=`${e?"<=":">="}${n}`;return{path:[],message:r?`${l}: expected ${t} to have ${a} ${r}`:`${l}: expected ${t} to be ${a}`,continue:o}}var Pt=e=>typeof e=="string"?`"${e}"`:`${e}`,Sn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function It(e,t,n){for(let o of n)o.path.unshift(t),e.push(o)}var Kr=e=>e>=55296&&e<=56319,Jr=e=>e>=56320&&e<=57343;function eo(e){let t=e.length;for(let n=0;n<e.length-1;n++)Kr(e.charCodeAt(n))&&Jr(e.charCodeAt(n+1))&&(t--,n++);return t}var Mn=e=>Array.isArray(e)?"array":typeof e=="string"?"string":"unknown",ve=e=>({run(t){t.value<e&&t.issues.push(j(!1,"number",e,!0))}}),Te=e=>({run(t){t.value>e&&t.issues.push(j(!0,"number",e,!0))}}),ye=(e,t="Invalid input")=>({run(n){e(n.value)||n.issues.push({path:[],message:t,continue:!0})}}),An=e=>typeof e=="string"?eo(e):e.length,Rn=e=>({hasLength:!0,run(t){let n=t.value;An(n)<e&&t.issues.push(j(!1,Mn(n),e,!0))}}),vt=e=>({hasLength:!0,run(t){let n=t.value;An(n)>e&&t.issues.push(j(!0,Mn(n),e,!0))}}),Fn=(e,t)=>({run(n){e.lastIndex=0,e.test(n.value)||n.issues.push({path:[],message:t??`Invalid string: must match pattern ${e}`,continue:!0})}}),to={run(e){let t=e.value;Number.isInteger(t)?Number.isSafeInteger(t)||e.issues.push(t>0?j(!0,"int",Number.MAX_SAFE_INTEGER,!0):j(!1,"int",Number.MIN_SAFE_INTEGER,!0)):e.issues.push({...ce("int",t),continue:!1})}},ue=(...e)=>ne(t=>{let n=t.value;return typeof n=="number"&&Number.isFinite(n)||t.issues.push(ce("number",n)),t},e),wn=(...e)=>ue(to,...e),tt=(...e)=>ne(t=>(typeof t.value!="string"&&t.issues.push(ce("string",t.value)),t),e);function z(e){let t=e.length===1?`Invalid input: expected ${Pt(e[0])}`:`Invalid option: expected one of ${e.map(Pt).join("|")}`;return ne(n=>(e.includes(n.value)||n.issues.push({path:[],message:t}),n),[],{values:e})}var Q=e=>z([e]),P=e=>({optional:!0,run:t=>t===void 0?{value:t,issues:[]}:e.run(t)});function L(e,t=[]){let n=Object.keys(e),o=new Set(n);return ne(r=>{let l=r.value;if(!Sn(l))return r.issues.push(ce("object",l)),r;let a={};for(let s of n){let c=e[s],u=c.run(l[s]),m=s in l;It(r.issues,s,u.issues),m||c.optional||u.issues.length>0||r.issues.push({path:[s],message:"Invalid input: expected nonoptional, received undefined"}),m&&(a[s]=u.value)}r.value=a;let i=[];for(let s in l)o.has(s)||i.push(s);return i.length>0&&r.issues.push({path:[],message:`Unrecognized key${i.length>1?"s":""}: ${i.map(Pt).join(", ")}`,continue:!0}),r},t,{shape:e})}function Ct(e,t,n){let o=[];return t!==void 0&&o.push(Rn(t)),n!==void 0&&o.push(vt(n)),ne(r=>{let l=r.value;if(Array.isArray(l)&&n!==void 0&&l.length>n)return r.issues.push(j(!0,"array",n,!1)),r;if(!Array.isArray(l))return r.issues.push(ce("array",l)),r;let a=new Array(l.length);for(let i=0;i<l.length;i++){let s=e.run(l[i]);It(r.issues,i,s.issues),a[i]=s.value}return r.value=a,r},o)}function Lt(e){return ne(t=>{let n=t.value;if(!Array.isArray(n))return t.issues.push(ce("tuple",n)),t;if(n.length<e.length)return t.issues.push(j(!1,"array",e.length,void 0)),t;n.length>e.length&&t.issues.push(j(!0,"array",e.length,void 0));let o=[];return e.forEach((r,l)=>{let a=r.run(n[l]);It(t.issues,l,a.issues),o[l]=a.value}),t.value=o,t})}function be(e){return ne(t=>{let n=[];for(let r of e){let l=r.run(t.value);if(l.issues.length===0)return l;n.push(l)}let o=n.filter(r=>!wt(r.issues));return o.length===1?o[0]:(t.issues.push({path:[],message:"Invalid input"}),t)})}function Pn(e,t){let n=new Map;for(let r of t)for(let l of r.shape?.[e]?.values??[])n.set(l,r);let o=`Invalid discriminator value. Expected ${[...n.keys()].map(r=>`'${r}'`).join(" | ")}`;return ne(r=>{let l=r.value;if(!Sn(l))return r.issues.push(ce("object",l)),r;let a=n.get(l[e]);return a?a.run(l):(r.issues.push({path:[e],message:o}),r)})}var no=ye(Je,`Numbers may have at most ${I.maxDecimals} decimals`),rt=[ve(-I.maxCoordinate),Te(I.maxCoordinate),no],v=ue(...rt),N=ue(...rt,ye(e=>e>0,"Must be greater than 0")),nt=ue(...rt,ye(e=>e>=0,"Must not be negative")),Ie=tt(Fn(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color")),yn=be([z(gn),Ie]),Cn=e=>L({mix:Lt([e,e]),amount:ue(ve(0),Te(1),ye(Je))}),ge=be([yn,Cn(yn)]),ro=be([Ie,Cn(be([z(["frame","accent","background"]),Ie]))]),le=be([ge,L({gradient:L({from:ge,to:ge,direction:P(z(["horizontal","vertical"])),steps:P(wn(ve(2),Te(I.maxGradientSteps)))})})]),_t=()=>({x:v,y:v,width:N,height:N}),_e=L({color:ge,width:N}),oo=Pn("type",[L({type:Q("rect"),..._t(),radius:P(nt),fill:le,hole:P(L({..._t(),radius:P(nt)})),stroke:P(_e)}),L({type:Q("circle"),cx:v,cy:v,r:N,hole:P(N),fill:le,stroke:P(_e)}),L({type:Q("ellipse"),cx:v,cy:v,rx:N,ry:N,fill:le,stroke:P(_e)}),L({type:Q("polygon"),points:Ct(Lt([v,v]),3,I.maxPolygonPoints),fill:le,stroke:P(_e)}),L({type:Q("path"),d:tt(Rn(2),vt(I.maxPathLength)),fill:le,fillRule:P(z(["nonzero","evenodd"])),stroke:P(_e)}),L({type:Q("line"),x1:v,y1:v,x2:v,y2:v,width:N,cap:P(z(["butt","round"])),dash:P(Lt([N,N])),fill:le}),L({type:Q("icon"),icon:z(pn),x:v,y:v,size:N,fill:le})]),xn=()=>({id:tt(Fn(/^[a-z][a-z0-9-]{0,31}$/)),slot:z(["primary","secondary","fixed"]),text:tt(vt(200)),maxLength:P(wn(ve(1),Te(Pe))),color:ge,weight:P(z(["bold","regular"])),collapse:P(L({y:v,height:N}))}),io=Pn("type",[L({type:Q("text"),...xn(),box:L(_t()),align:P(z(["start","middle","end"])),fontSize:P(N)}),L({type:Q("curved"),...xn(),curve:L({cx:v,cy:v,radius:N,side:z(["top","bottom"]),spread:P(ue(ve(20),Te(300),ye(Je)))}),fontSize:N})]),En=ue(...rt,ye(e=>e>=I.minArtboard&&e<=I.maxArtboard,`Artboard sides must be ${I.minArtboard} to ${I.maxArtboard} units`)),so=L({kind:Q(fn),version:Q(dn),artboard:L({width:En,height:En}),qr:L({x:v,y:v,size:N,padding:P(nt),radius:P(nt),plate:P(z(["opaque","background","none"]))}),colors:L({frame:Ie,text:P(ro),accent:P(Ie)}),shapes:Ct(oo,void 0,I.maxShapes),labels:Ct(io,void 0,I.maxLabels),bleed:P(be([Q("none"),ge]))},[{run(e){bn(e.value,(t,n=[])=>{e.issues.push({path:[...n],message:t,continue:!0})})}}]);function Ln(e){let t=so.run(e);return t.issues.length===0?{success:!0,data:t.value}:{success:!1,issues:t.issues.map(({path:n,message:o})=>({path:n,message:o}))}}var _n=({path:e,message:t})=>e.length>0?`${e.join(".")}: ${t}`:t;function q(e){if(e.length===0)return"";let[t,...n]=e;return`M${y(t[0])} ${y(t[1])}${n.map(([o,r])=>`L${y(o)} ${y(r)}`).join("")}Z`}function _(e,t,n){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(n)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(n)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function F(e,t,n,o,r=0){let l=Math.min(n,o)/2,[a,i,s,c]=(typeof r=="number"?[r,r,r,r]:r).map(m=>Math.max(0,Math.min(m,l))),u=(m,d,h)=>m>0?`A${y(m)} ${y(m)} 0 0 1 ${y(d)} ${y(h)}`:"";return`M${y(e+a)} ${y(t)}H${y(e+n-i)}${u(i,e+n,t+i)}V${y(t+o-s)}${u(s,e+n-s,t+o)}H${y(e+c)}${u(c,e,t+o-c)}V${y(t+a)}${u(a,e+a,t)}Z`}function ot(e,t,n,o,r=5){return Array.from({length:r*2},(l,a)=>{let i=a%2===0?n:o,s=-Math.PI/2+Math.PI/r*a;return[e+i*Math.cos(s),t+i*Math.sin(s)]})}function In(e,t,n){let o=n/2,r=(l,a)=>`${y(e+l*o)} ${y(t+a*o)}`;return`M${r(0,-.52)}C${r(.18,-.92)} ${r(.98,-.94)} ${r(1,-.34)}C${r(1,.12)} ${r(.5,.48)} ${r(0,.92)}C${r(-.5,.48)} ${r(-1,.12)} ${r(-1,-.34)}C${r(-.98,-.94)} ${r(-.18,-.92)} ${r(0,-.52)}Z`}function Tt(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}var vn=24,re=(e,t,n,o)=>{let r=o*Math.PI/180;return[e+n*Math.cos(r),t+n*Math.sin(r)]},it=([e,t])=>`${y(e)} ${y(t)}`;function xe(e,t,n,o,r,l){let a=l-r>180?1:0;return`M${it(re(e,t,o,r))}A${y(o)} ${y(o)} 0 ${a} 1 ${it(re(e,t,o,l))}L${it(re(e,t,n,l))}A${y(n)} ${y(n)} 0 ${a} 0 ${it(re(e,t,n,r))}Z`}function $e(e,t,n,o){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function ao(e){let t=0;return e.forEach(([n,o],r)=>{let[l,a]=e[(r+1)%e.length];t+=n*a-l*o}),t/2}function Tn(e){return q(ao(e)<0?[...e].reverse():e)}function st(e,t,n,o,r){let l=Math.hypot(n-e,o-t)||1,a=-(o-t)/l*(r/2),i=(n-e)/l*(r/2);return Tn([[e+a,t+i],[n+a,o+i],[n-a,o-i],[e-a,t-i]])}var D=(...e)=>({d:e.join(""),fillRule:"nonzero"}),K=(...e)=>({d:e.join(""),fillRule:"evenodd"});function lo(){let e=[];for(let t of[0,60,120]){let[n,o]=re(12,12,10.5,t+180),[r,l]=re(12,12,10.5,t);e.push(st(n,o,r,l,2))}for(let t=0;t<6;t++){let n=t*60,[o,r]=re(12,12,6.2,n);for(let l of[-45,45]){let[a,i]=re(o,r,3.6,n+l);e.push(st(o,r,a,i,1.7))}}return D(...e)}var co={wifi:()=>D(xe(12,20,4.6,7.2,-135,-45),xe(12,20,9.2,11.8,-135,-45),xe(12,20,13.8,16.4,-135,-45),_(12,20,2.2)),star:()=>D(q(ot(12,12.8,11.6,4.8))),heart:()=>D(In(12,12.4,22)),phone:()=>K(F(6,1.5,12,21,2.6),F(7.8,4.2,8.4,13.4,.6),_(12,19.8,1.1)),headphones:()=>D(xe(12,13,7.6,9.8,-180,0),F(2,12,5,9.5,2),F(17,12,5,9.5,2)),calendar:()=>K(F(2.5,4,19,17.5,2.5),F(4.6,9,14.8,10.6,.8),F(7,11.4,2.6,2.6,.4),F(10.7,11.4,2.6,2.6,.4),F(14.4,11.4,2.6,2.6,.4),F(7,15.1,2.6,2.6,.4),F(10.7,15.1,2.6,2.6,.4),F(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),F(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>D(_(12,7.5,4.6),"M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"),chat:()=>K(F(2,3,20,14,4),q([[6.5,17],[11.5,17],[5.8,21.8]]),_(7.5,10,1.5),_(12,10,1.5),_(16.5,10,1.5)),bag:()=>D(F(3.5,7.5,17,14.5,2),xe(12,7.5,3.1,4.8,-180,0)),bell:()=>D("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",F(1.5,18.2,21,2.6,1.3),F(11.2,6.6,1.6,2.6,0),F(9.8,4.6,4.4,2.4,1.2)),cup:()=>D("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",xe(17,10.2,1.7,3.6,-90,90),F(2,20.6,17,2,1),F(7,1.6,1.6,3.4,.8),F(11.6,1.6,1.6,3.4,.8)),card:()=>K(F(1.5,4.5,21,15,2.5),F(1.5,8,21,3,0),F(4.5,13.6,4.6,3.2,.6)),check:()=>K(_(12,12,10.5),q([[6.6,12.4],[8.4,10.6],[10.6,12.8],[15.8,7.6],[17.6,9.4],[10.6,16.4]])),info:()=>K(_(12,12,10.5),_(12,7.2,1.6),F(10.6,10,2.8,8,.8)),home:()=>K(q([[12,2.5],[22.5,11.5],[19.5,11.5],[19.5,21.5],[4.5,21.5],[4.5,11.5],[1.5,11.5]]),F(10,14.5,4,7,[.6,.6,0,0])),pin:()=>K("M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",_(12,9.5,3)),share:()=>D(st(6,12,18,5,1.8),st(6,12,18,19,1.8),_(18,5,3.2),_(6,12,3.2),_(18,19,3.2)),download:()=>D(F(10.6,2,2.8,9.5,0),q([[6,10],[18,10],[12,16.5]]),q([[2.5,15],[5.3,15],[5.3,19],[18.7,19],[18.7,15],[21.5,15],[21.5,21.8],[2.5,21.8]])),clock:()=>K(_(12,12,10.5),_(12,12,8.4),q([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:lo,pumpkin:()=>D($e(7.8,14.6,5.8,6.9),$e(16.2,14.6,5.8,6.9),$e(12,14.6,4.8,7.4),F(10.9,3.4,2.2,4.6,.8),Tn([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>D(q([[12,1.5],[16.8,8.2],[7.2,8.2]]),q([[12,5.2],[19,13.6],[5,13.6]]),q([[12,9.4],[21.2,19.2],[2.8,19.2]]),F(10.4,18.6,3.2,3.9,.4)),sparkle:()=>D(q(ot(9.5,13.5,9,2.4,4)),q(ot(19,5,4,1.1,4))),gift:()=>D(F(3,11.2,7.8,10.6,1),F(13.2,11.2,7.8,10.6,1),F(2,7.4,8.8,3.2,1),F(13.2,7.4,8.8,3.2,1),$e(8.8,4.8,2.9,1.9),$e(15.2,4.8,2.9,1.9))};function $n(e){return co[e]()}var uo={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"778899",lightslategrey:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},mo=Object.fromEntries(Object.entries(uo).map(([e,t])=>[e,[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]]));function kn(e,t){let n=e.trim(),o=Number.parseFloat(n);return Number.isNaN(o)?Number.NaN:n.endsWith("%")?o/100*t:o}function me(e){if(!e)return null;let t=e.trim().toLowerCase();if(t==="transparent")return{r:0,g:0,b:0,a:0};let n=mo[t];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(t.startsWith("#")){let r=t.slice(1);return(r.length===3||r.length===4)&&(r=r.split("").map(l=>l+l).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(r)?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:r.length===8?Number.parseInt(r.slice(6,8),16)/255:1}:null}let o=/^rgba?\(([^)]*)\)$/.exec(t);if(o){let[r,l]=o[1].split("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length!==(l===void 0&&a.length===4?4:3))return null;let i=l??a[3],[s,c,u]=a.slice(0,3).map(h=>kn(h,255)),m=i===void 0?1:kn(i,1);if([s,c,u,m].some(h=>Number.isNaN(h)))return null;let d=(h,b)=>Math.min(Math.max(h,0),b);return{r:d(s,255),g:d(c,255),b:d(u,255),a:d(m,1)}}return null}function Nn(e){return e===" "?.3:/[MWmw@%]/.test(e)?.92:/[A-Z0-9#&]/.test(e)?.72:/[il.,:;!'|1]/.test(e)?.32:.6}function kt(e){let t=0;for(let n of e)t+=Nn(n);return Math.max(t,1)}var $t=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0");function at(e,t,n){let o=me(e)??{r:0,g:0,b:0,a:1},r=me(t)??{r:255,g:255,b:255,a:1},l=Math.min(1,Math.max(0,n));return`#${$t(o.r+(r.r-o.r)*l)}${$t(o.g+(r.g-o.g)*l)}${$t(o.b+(r.b-o.b)*l)}`}function On(e,t,n,o,r,l,a,i){let s=[...e],c=r*.08,u=s.map(p=>Nn(p)*r),m=u.reduce((p,g)=>p+g,0)+c*Math.max(0,s.length-1),d=l==="top"?o-r*.35:o+r*.35,h=[],b=0;return s.forEach((p,g)=>{let f=u[g],x=(b+f/2)/d;if(b+=f+c,p.trim()==="")return;let E=l==="top"?-Math.PI/2-m/2/d+x:Math.PI/2+m/2/d-x;h.push({text:p,x:t+d*Math.cos(E),y:n+d*Math.sin(E),fontSize:r,maxWidth:r*2,color:a,rotate:E*180/Math.PI+(l==="top"?90:-90),field:i})}),h}function ke(e,t="#000000"){return e?typeof e=="string"?e:e.type==="solid"?e.color:e.type==="image"?e.underlay||t:(e.type==="linear"||e.type==="radial"||e.type==="angular")&&e.stops[0]?.color||t:t}var lt=class extends Error{issues;constructor(t){super(`Invalid frame spec: ${t.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=t}},Dn=new WeakMap;function Nt(e){if(e&&typeof e=="object"){let n=Dn.get(e);if(n)return n}if(e==null)throw new lt(['A "custom" frame needs a spec']);let t=Ln(e);if(!t.success)throw new lt(t.issues.map(_n));return typeof e=="object"&&Dn.set(e,t.data),t.data}var fo=e=>{let t=me(e);return!!(t&&t.a>=1)};function ho(e,t){let n=ke(t,te);return e.qr.plate==="none"?{color:n,plate:!1}:fo(n)?{color:n,plate:!0}:e.qr.plate==="background"?{color:n,plate:!1}:{color:te,plate:!0}}function qn(e,t,n=te){let o=t.color||e.colors.frame,r=t.secondaryColor||e.colors.accent||o,l=s=>s==="frame"?o:s==="accent"?r:s==="background"?n:s,a=e.colors.text,i=t.textColor||(a===void 0?o:typeof a=="string"?a:at(l(a.mix[0]),l(a.mix[1]),a.amount));return{frame:o,text:i,accent:r}}function po(e,t,n){let o=qn(t,e,n),r=l=>{switch(l){case"frame":return o.frame;case"text":return o.text;case"accent":return o.accent;case"background":return n;default:return l}};return l=>typeof l=="string"?r(l):at(r(l.mix[0]),r(l.mix[1]),l.amount)}function Bn(e,t,n=0,o=0){let r=Le(e);return r?yt(r,t,n,o):""}function go(e,t,n,o){return`M${y(e-n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e+n)} ${y(t)}A${y(n)} ${y(o)} 0 1 1 ${y(e-n)} ${y(t)}Z`}function bo(e,t){let[n,o,r,l]=[e.x1*t,e.y1*t,e.x2*t,e.y2*t],a=Math.hypot(r-n,l-o),i=e.width*t/2,s=a>0?(r-n)/a:1,c=a>0?(l-o)/a:0,u=-c*i,m=s*i,d=(g,f)=>{let x=[n+s*g,o+c*g],E=[n+s*f,o+c*f];if(e.cap==="round"&&f-g>2*i){let A=[x[0]+s*i,x[1]+c*i],M=[E[0]-s*i,E[1]-c*i];return`M${y(A[0]-u)} ${y(A[1]-m)}L${y(M[0]-u)} ${y(M[1]-m)}A${y(i)} ${y(i)} 0 0 1 ${y(M[0]+u)} ${y(M[1]+m)}L${y(A[0]+u)} ${y(A[1]+m)}A${y(i)} ${y(i)} 0 0 1 ${y(A[0]-u)} ${y(A[1]-m)}Z`}return`M${y(x[0]-u)} ${y(x[1]-m)}L${y(E[0]-u)} ${y(E[1]-m)}L${y(E[0]+u)} ${y(E[1]+m)}L${y(x[0]+u)} ${y(x[1]+m)}Z`};if(!e.dash)return{type:"path",d:d(0,a),fillRule:"nonzero"};let h=e.dash[0]*t,b=h+e.dash[1]*t,p=[];for(let g=0;g+h<=a+1e-6;g+=b)p.push(d(g,g+h));return{type:"path",d:p.join(""),fillRule:"nonzero"}}function yo(e,t){switch(e.type){case"rect":return{type:"rect",x:e.x*t,y:e.y*t,width:e.width*t,height:e.height*t,radius:(e.radius??0)*t,...e.hole&&{hole:{x:e.hole.x*t,y:e.hole.y*t,width:e.hole.width*t,height:e.hole.height*t,radius:(e.hole.radius??0)*t}}};case"circle":return{type:"path",d:_(e.cx*t,e.cy*t,e.r*t)+(e.hole?_(e.cx*t,e.cy*t,e.hole*t):""),fillRule:e.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:go(e.cx*t,e.cy*t,e.rx*t,e.ry*t),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:e.points.map(([n,o])=>[n*t,o*t])};case"path":return{type:"path",d:Bn(e.d,t),fillRule:e.fillRule??"nonzero"};case"line":return bo(e,t);default:{let n=$n(e.icon);return{type:"path",d:Bn(n.d,e.size*t/vn,e.x*t,e.y*t),fillRule:n.fillRule}}}}function xo(e){if(e.type==="rect"){let{x:t,y:n,width:o,height:r,radius:l,hole:a}=e;return[...Et(t,n,o,r,l,l),...a?Et(a.x,a.y,a.width,a.height,a.radius,a.radius):[]]}return e.type==="polygon"?[...e.points.map(([t,n],o)=>o===0?{op:"M",x:t,y:n}:{op:"L",x:t,y:n}),{op:"Z"}]:je(e.d)}function Eo(e,t,n){let o=xo(e),r=an(o,.2),l=e.type==="rect"?e.hole?"evenodd":"nonzero":e.type==="path"?e.fillRule??"nonzero":"nonzero",a=t.direction==="vertical",i=g=>a?g[1]:g[0],s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let g of r)for(let f of g)s=Math.min(s,i(f)),c=Math.max(c,i(f));if(!(c>s))return[];let u=t.steps??32,m=n(t.from),d=n(t.to),h=c-s,b=h*.002,p=[];for(let g=0;g<u;g++){let f=s+h*g/u,x=Math.min(c,s+h*(g+1)/u+(g+1<u?b:0)),E=a?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:f,y1:x}:{x0:f,x1:x,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},A=r.map(M=>Ze(M,E)).filter(M=>M.length>2);A.length!==0&&p.push({type:"path",d:ln(A),fill:at(m,d,(g+.5)/u),fillRule:l})}return p}function So(e,t,n){let o=yo(e,t),r="stroke"in e&&e.stroke?{stroke:n(e.stroke.color),strokeWidth:e.stroke.width*t}:void 0;if(typeof e.fill=="object"&&"gradient"in e.fill){let l=Eo(o,e.fill.gradient,n);return r?[...l,{...o,fill:"none",...r}]:l}return[{...o,fill:n(e.fill),...r}]}function Mo(e,t){let n=Math.min(e.maxLength??I.maxTextLength,I.maxTextLength),o=e.slot==="primary"?t.text??e.text:e.slot==="secondary"?t.secondaryText??e.text:e.text;return Mt(o,n)}function Ao(e){return e===void 0||!Number.isFinite(e)?1:Math.min(Ce,Math.max(jt,e))}function Ro(e,t,n,o,r,l){let a=r(e.color),i=e.weight==="regular"?{fontWeight:400}:{};if(e.type==="curved"){let{cx:p,cy:g,radius:f,side:x,spread:E=140}=e.curve,A=f*o*(E*Math.PI/180),M=Math.min(e.fontSize*o*n,A/(kt(t)+.08*t.length));return On(t,p*o,g*o,f*o,M,x,a,l).map(S=>({...S,...i}))}let s=e.box.x*o,c=e.box.y*o,u=e.box.width*o,m=e.box.height*o;if(!(m>0))return[];let d=(e.fontSize??e.box.height*Rt)*o,h=Math.min(d*n,m*Ke,u/kt(t)),b=e.align??"middle";return[{text:t,x:b==="start"?s:b==="end"?s+u:s+u/2,y:c+m/2+h*.35,fontSize:h,maxWidth:u,color:a,...b!=="middle"&&{align:b},...i,field:l}]}function Fo(e){let t=0,n=0,o=0,r=0;return e.map(({command:l,values:a})=>{let i=l.toUpperCase(),s=l!==i;switch(i){case"Z":return t=o,n=r,{command:"Z",values:[]};case"H":return t=(s?t:0)+a[0],{command:"H",values:[t]};case"V":return n=(s?n:0)+a[0],{command:"V",values:[n]};case"A":return t=(s?t:0)+a[5],n=(s?n:0)+a[6],{command:"A",values:[...a.slice(0,5),t,n]};default:{let c=a.map((u,m)=>s?u+(m%2===0?t:n):u);return t=c.at(-2),n=c.at(-1),i==="M"&&(o=t,r=n),{command:i,values:c}}}})}function wo(e,t){let n=Le(e);return n?yt(Fo(n).map(({command:o,values:r})=>o==="V"?{command:o,values:[t(r[0])]}:o==="H"||o==="Z"?{command:o,values:r}:o==="A"?{command:o,values:[...r.slice(0,6),t(r[6])]}:{command:o,values:r.map((l,a)=>a%2===1?t(l):l)})):e}function Po(e,t){let n=(o,r)=>{let l=t(o);return{y:l,height:t(o+r)-l}};switch(e.type){case"rect":return{...e,...n(e.y,e.height),...e.hole&&{hole:{...e.hole,...n(e.hole.y,e.hole.height)}}};case"circle":case"ellipse":return{...e,cy:t(e.cy)};case"polygon":return{...e,points:e.points.map(([o,r])=>[o,t(r)])};case"path":return{...e,d:wo(e.d,t)};case"line":return{...e,y1:t(e.y1),y2:t(e.y2)};default:return{...e,y:t(e.y)}}}function Co(e,t){if(t.length===0)return e;let n=r=>{let l=r;for(let a of t)l-=Math.min(Math.max(r-a.y,0),a.height);return l},o=(r,l)=>t.some(a=>r>=a.y-1e-6&&l<=a.y+a.height+1e-6);return{...e,artboard:{...e.artboard,height:n(e.artboard.height)},qr:{...e.qr,y:n(e.qr.y)},shapes:e.shapes.filter(r=>{let{bounds:l}=Ft(r);return!(l&&o(l.y0,l.y1))}).map(r=>Po(r,n)),labels:e.labels.map(r=>{if(r.type==="curved")return{...r,curve:{...r.curve,cy:n(r.curve.cy)}};let l=n(r.box.y);return{...r,box:{...r.box,y:l,height:n(r.box.y+r.box.height)-l}}})}}function Ot(e,t,n,o,r={}){let l=new Map(t.labels.map(g=>[g.id,Mo(g,n)])),a=Co(t,t.labels.flatMap(g=>g.collapse&&!l.get(g.id)?[g.collapse]:[])),i=e/a.qr.size,s=ho(a,o),c=po(n,a,s.color),u=a.shapes.flatMap(g=>So(g,i,c));if(s.plate){let g=et(a)*i;u.push({type:"rect",x:a.qr.x*i-g,y:a.qr.y*i-g,width:e+2*g,height:e+2*g,radius:(a.qr.radius??0)*i,fill:s.color})}let m=Ao(n.fontScale),d=a.labels.flatMap(g=>{let f=l.get(g.id);if(!f)return[];let x=(g.slot==="fixed"?void 0:r[g.slot])??g.id;return Ro(g,f,m,i,c,x)}),h=d[0],b=h&&h.rotate===void 0?h:null,p=a.bleed??"none";return{width:a.artboard.width*i,height:a.artboard.height*i,qrX:a.qr.x*i,qrY:a.qr.y*i,qrSize:e,shapes:u,label:b,extraLabels:b?d.slice(1):d,squareEdges:p!=="none",color:c(p==="none"?"frame":p)}}function Un(e,t,n){return Ot(e,Nt(t.spec),t,n)}var Hn={kind:"qrdx.frame",version:1,artboard:{width:1600,height:1470},qr:{x:300,y:120,size:1e3,padding:70,radius:10,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"polygon",points:[[0,1250],[190,1250],[190,1470],[0,1470],[50.4,1360]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[1600,1250],[1549.6,1360],[1600,1470],[1410,1470],[1410,1250]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[90,1420],[170,1470],[90,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"polygon",points:[[1510,1420],[1510,1470],[1430,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"rect",x:220,y:40,width:1160,height:1160,radius:20,fill:"background"},{type:"rect",x:180,y:0,width:1240,height:1240,radius:60,fill:"frame",hole:{x:220,y:40,width:1160,height:1160,radius:20}},{type:"rect",x:90,y:1200,width:1420,height:220,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:170,y:1200,width:1260,height:220}}]};var Dt={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:120,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:40,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:220}}],bleed:"frame"};var Gn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}],bleed:"frame"};var Qn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1600},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1600,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"top",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}},{type:"text",id:"bottom",slot:"secondary",text:"",color:"text",box:{x:120,y:1380,width:1e3,height:220}}],bleed:"frame"};var zn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,fill:"frame",hole:{x:40,y:40,width:1160,height:1260}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}],bleed:"frame"};var Yn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1530},qr:{x:120,y:120,size:1e3,padding:80,radius:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:1400,radius:120,fill:"frame"},{type:"path",d:"M161.2 1380L62 1530Q198.4 1458.5 396.8 1380Z",fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:200},collapse:{y:1220,height:160}}]};var Wn={kind:"qrdx.frame",version:1,artboard:{width:1978.214,height:1978.214},qr:{x:489.107,y:489.107,size:1e3,padding:50,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"circle",cx:989.107,cy:989.107,r:779.107,fill:"background"},{type:"circle",cx:989.107,cy:989.107,r:989.107,hole:779.107,fill:"frame"},{type:"circle",cx:105,cy:989.107,r:14.7,fill:"text"},{type:"circle",cx:1873.214,cy:989.107,r:14.7,fill:"text"}],labels:[{type:"curved",id:"top",slot:"primary",text:"Scan me",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"top",spread:140},fontSize:105},{type:"curved",id:"bottom",slot:"secondary",text:"",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"bottom",spread:140},fontSize:105}]};var Vn={kind:"qrdx.frame",version:1,artboard:{width:1320,height:1558},qr:{x:160,y:130,size:1e3,padding:60},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:370,width:1320,height:1188,fill:{mix:["frame","#FFFFFF"],amount:.45}},{type:"polygon",points:[[0,370],[660,0],[1320,370]],fill:{mix:["frame","#FFFFFF"],amount:.25}},{type:"rect",x:80,y:50,width:1160,height:1268,fill:"background"},{type:"rect",x:68,y:38,width:1184,height:1280,fill:"frame",hole:{x:80,y:50,width:1160,height:1268}},{type:"polygon",points:[[0,1178],[660,1318],[1320,1178],[1320,1558],[0,1558]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:160,y:1318,width:1e3,height:220}}]};var Xn={kind:"qrdx.frame",version:1,artboard:{width:1230,height:1430},qr:{x:115,y:115,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1230,height:1430,fill:"background"},{type:"polygon",points:[[0,0],[200,0],[200,35],[35,35],[35,200],[0,200]],fill:"frame"},{type:"polygon",points:[[1230,0],[1030,0],[1030,35],[1195,35],[1195,200],[1230,200]],fill:"frame"},{type:"polygon",points:[[1230,1230],[1030,1230],[1030,1195],[1195,1195],[1195,1030],[1230,1030]],fill:"frame"},{type:"polygon",points:[[0,1230],[200,1230],[200,1195],[35,1195],[35,1030],[0,1030]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:80,y:1210,width:1070,height:200},collapse:{y:1230,height:200}}]};var ct={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1360},qr:{x:130,y:130,size:1e3,padding:40,plate:"background"},colors:{frame:"#7c3aed",text:{mix:["frame","accent"],amount:.5},accent:"#db2777"},shapes:[{type:"rect",x:50,y:50,width:1160,height:1260,radius:50,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1360,radius:100,fill:{gradient:{from:"frame",to:"accent",direction:"horizontal",steps:48}},hole:{x:50,y:50,width:1160,height:1260,radius:50}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1130,width:1e3,height:180},collapse:{y:1210,height:100}}]};var Zn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1460},qr:{x:130,y:260,size:1e3,padding:46,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"frame",hole:{x:22,y:22,width:1216,height:1416,radius:8}},{type:"rect",x:45,y:45,width:1170,height:1370,fill:"frame",hole:{x:53,y:53,width:1154,height:1354}},{type:"rect",x:378,y:181,width:504,height:8,fill:"frame"},{type:"polygon",points:[[630,163],[652,185],[630,207],[608,185]],fill:"frame"}],labels:[{type:"text",id:"title",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:30,width:1e3,height:170},collapse:{y:84,height:130}},{type:"text",id:"footer",slot:"secondary",text:"",color:"text",box:{x:130,y:1270,width:1e3,height:160},collapse:{y:1306,height:70}}]};var jn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1610},qr:{x:130,y:250,size:1e3,padding:75,radius:55},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1610,radius:170,fill:"frame"},{type:"rect",x:50,y:170,width:1160,height:1290,radius:60,fill:"background"},{type:"rect",x:520,y:67,width:220,height:36,radius:18,fill:"background"},{type:"rect",x:480,y:1520,width:300,height:30,radius:15,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1290,width:1e3,height:170},collapse:{y:1330,height:130}}]};var Kn={kind:"qrdx.frame",version:1,artboard:{width:1325,height:1555},qr:{x:150,y:150,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:25,y:25,width:1300,height:1530,radius:15,fill:{mix:["frame","#FFFFFF"],amount:.72}},{type:"rect",x:0,y:0,width:1300,height:1530,radius:15,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:150,y:1260,width:1e3,height:240}}]};var Jn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,radius:60,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,radius:100,fill:"frame",hole:{x:40,y:40,width:1160,height:1260,radius:60}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}]};var er={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:120,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:40,width:1160,height:1160,radius:30}},{type:"polygon",points:[[540,1385],[620,1265],[700,1385]],fill:"frame"},{type:"rect",x:0,y:1345,width:1240,height:220,radius:110,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1345,width:1e3,height:220}}]};var tr={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:445,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:220,radius:110,fill:"frame"},{type:"polygon",points:[[540,180],[700,180],[620,300]],fill:"frame"},{type:"rect",x:40,y:365,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:325,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:365,width:1160,height:1160,radius:30}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}]};var nr={kind:"qrdx.frame",version:1,artboard:{width:1420,height:1590},qr:{x:195,y:195,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:30,y:30,width:1390,height:1560,radius:155,fill:{mix:["frame","#FFFFFF"],amount:.7}},{type:"rect",x:0,y:0,width:1390,height:1560,radius:155,fill:"#FFFFFF"},{type:"rect",x:25,y:25,width:1340,height:1510,radius:130,fill:"frame"},{type:"rect",x:95,y:95,width:1200,height:1200,radius:40,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:175,y:1295,width:1040,height:240},collapse:{y:1365,height:170}}]};var rr={kind:"qrdx.frame",version:1,artboard:{width:1280,height:1620},qr:{x:140,y:320,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M140 0H1140L1280 140V1580A40 40 0 0 1 1240 1620H40A40 40 0 0 1 0 1580V140ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:"frame",fillRule:"evenodd"},{type:"path",d:"M572 115.2A68 68 0 1 1 708 115.2A68 68 0 1 1 572 115.2ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:{mix:["frame","#FFFFFF"],amount:.35},fillRule:"evenodd"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:140,y:1400,width:1e3,height:220},collapse:{y:1420,height:160}}]};var or={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1490},qr:{x:130,y:130,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M40 0H1220A40 40 0 0 1 1260 40V1215A55 55 0 0 0 1260 1325V1450A40 40 0 0 1 1220 1490H40A40 40 0 0 1 0 1450V1325A55 55 0 0 0 0 1215V40A40 40 0 0 1 40 0Z",fill:"frame"},{type:"line",x1:77,y1:1270,x2:1147,y2:1270,width:12,dash:[30,22],fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1270,width:1e3,height:220}}]};var T=(e,t,n,o,r)=>({style:e,name:t,tags:r,labelOn:o,spec:n}),ir=[T("banner-bottom","Banner",Dt,"frame",["bottom","band"]),T("banner-top","Top banner",Gn,"frame",["top","band"]),T("banner-top-bottom","Two banners",Qn,"frame",["top","bottom","band"]),T("border","Border",zn,"background",["square","outline"]),T("rounded-border","Rounded",Jn,"background",["border","outline"]),T("gradient-border","Gradient",ct,"background",["border","colorful"]),T("focus","Focus",Xn,"background",["corners","brackets"]),T("speech-bubble","Bubble",er,"frame",["speech"]),T("speech-bubble-top","Bubble top",tr,"frame",["speech"]),T("chat-bubble","Chat",Yn,"frame",["message","bubble"]),T("circle","Circle",Wn,"frame",["round","ring","curved"]),T("badge","Ribbon",Hn,"frame",["badge","banner"]),T("sticker","Sticker",nr,"frame",["label"]),T("polaroid","Polaroid",Kn,"frame",["photo","picture"]),T("phone","Phone",jn,"background",["mobile","screen"]),T("ticket","Ticket",or,"frame",["event","pass"]),T("tag","Tag",rr,"frame",["price","label"]),T("envelope","Envelope",Vn,"frame",["mail","letter"]),T("menu-card","Menu card",Zn,"background",["menu","restaurant"])],Vo=new Map(ir.map(e=>[e.style,e]));function Xo(e){return Vo.get(e)}var sa=Object.fromEntries(ir.map(e=>[e.style,e.spec])),aa={from:ct.colors.frame,to:ct.colors.accent};var Zo={primary:"text",secondary:"secondaryText"};function sr(e,t,n){let o=Xo(t.style)?.spec??Dt;return Ot(e,Nt(o),t,n,Zo)}var jo="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function cr(e){return!!(e?.style&&e.style!=="none")}function ur(e,t,n){return t.style===hn?Un(e,t,n):sr(e,t,n)}function Ko(e){return[...e.label?[e.label]:[],...e.extraLabels??[]]}function mr(e,t){let n=({x:r,y:l,width:a,height:i,radius:s})=>{let c=Math.min(s,a/2,i/2);e.moveTo(r+c,l),e.arcTo(r+a,l,r+a,l+i,c),e.arcTo(r+a,l+i,r,l+i,c),e.arcTo(r,l+i,r,l,c),e.arcTo(r,l,r+a,l,c),e.closePath()},o=(r,l)=>{r.stroke&&r.strokeWidth&&(e.strokeStyle=r.stroke,e.lineWidth=r.strokeWidth,e.lineJoin="miter",e.miterLimit=4,l?e.stroke(l):e.stroke())};for(let r of t.shapes){let l=!(r.fill==="transparent"||r.fill==="none");if(l||r.stroke){if(e.fillStyle=r.fill,r.type==="path"){if(typeof Path2D<"u"){let a=new Path2D(r.d);l&&e.fill(a,r.fillRule??"nonzero"),o(r,a)}continue}e.beginPath(),r.type==="polygon"?(r.points.forEach(([a,i],s)=>{s===0?e.moveTo(a,i):e.lineTo(a,i)}),e.closePath(),l&&e.fill()):(n(r),r.hole&&n(r.hole),l&&e.fill("evenodd")),o(r)}}for(let r of Ko(t))e.fillStyle=r.color,e.font=`${r.fontWeight??700} ${r.fontSize}px ${jo}`,e.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",e.textBaseline="alphabetic",r.rotate?(e.save(),e.translate(r.x,r.y),e.rotate(r.rotate*Math.PI/180),e.fillText(r.text,0,0,r.maxWidth),e.restore()):e.fillText(r.text,r.x,r.y,r.maxWidth)}var Jo=.22,ei=.14;function ti(e,t){let n=e.w*t,o=e.h*t;return{x:e.x+n,y:e.y+o,w:e.w-2*n,h:e.h-2*o}}function Bt(e,t,n){if(e.beginPath(),t==="circle"){e.arc(n.x+n.w/2,n.y+n.h/2,Math.min(n.w,n.h)/2,0,Math.PI*2);return}let o=t==="rounded"?Math.min(n.w,n.h)*Jo:0;o>0&&typeof e.roundRect=="function"?e.roundRect(n.x,n.y,n.w,n.h,o):e.rect(n.x,n.y,n.w,n.h)}function fr(e,t){return t?ti(e,ei):e}var{QrCode:qt}=G,ni={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function ri(e){let t=e*4+17,n=new Uint8Array(t*t),o=(a,i)=>{a>=0&&i>=0&&a<t&&i<t&&(n[i*t+a]=1)};for(let a=0;a<t;a++)o(6,a),o(a,6);for(let[a,i]of[[3,3],[t-4,3],[3,t-4]])for(let s=-4;s<=4;s++)for(let c=-4;c<=4;c++)o(a+c,i+s);let r=[];if(e>1){let a=Math.floor(e/7)+2,i=e===32?26:Math.ceil((e*4+4)/(a*2-2))*2;r.push(6);for(let s=t-7;r.length<a;s-=i)r.splice(1,0,s)}let l=r.length-1;for(let[a,i]of r.entries())for(let[s,c]of r.entries())if(!(a===0&&s===0||a===0&&s===l||a===l&&s===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)o(i+m,c+u);for(let a=0;a<=8;a++)o(8,a),o(a,8);for(let a=0;a<8;a++)o(t-1-a,8),o(8,t-1-a);if(e>=7)for(let a=0;a<18;a++){let i=t-11+a%3,s=Math.floor(a/3);o(i,s),o(s,i)}return n}function oi(e,t){let n=e*4+17,o=Qe[t].ordinal,r=qt.NUM_ERROR_CORRECTION_BLOCKS[o]?.[e]??0,l=qt.ECC_CODEWORDS_PER_BLOCK[o]?.[e]??0,a=Math.floor(qt.getNumRawDataModules(e)/8),i=r-a%r,s=Math.floor(a/r),c=Array.from({length:r},(A,M)=>s+(M<i?0:1)),u=[],m=[],d=s-l;for(let A=0;A<=s;A++)for(let M=0;M<r;M++)if(M<i){if(A===d)continue;u.push(M),m.push(A<d?A:A-1)}else u.push(M),m.push(A);if(u.length!==a)throw new Error(`Codeword map: interleave mismatch at version ${e}`);let h=ri(e),b=new Int16Array(n*n).fill(-1),p=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),f=a*8,x=0;for(let A=n-1;A>=1;A-=2){A===6&&(A=5);let M=(A+1&2)===0;for(let S=0;S<n;S++)for(let R=0;R<2;R++){let C=A-R,B=(M?n-1-S:S)*n+C;if(!h[B]&&x<f){let Y=x>>>3;b[B]=u[Y],p[B]=m[Y],g[B]=7-(x&7),x++}}}if(x!==f)throw new Error(`Codeword map: placement mismatch at version ${e}`);let E=ni[`${e}${t}`]??0;return{version:e,level:t,size:n,blocks:r,eccPerBlock:l,blockLengths:c,correctable:Math.floor((l-E)/2),block:b,codeword:p,bit:g}}var ii=8,fe=new Map;function dr(e,t){if(!(Number.isInteger(e)&&e>=1&&e<=40))throw new RangeError(`QR version must be 1\u201340, got ${e}`);let n=`${e}${t}`,o=fe.get(n);if(o)return fe.delete(n),fe.set(n,o),o;let r=oi(e,t);if(fe.size>=ii){let l=fe.keys().next().value;l!==void 0&&fe.delete(l)}return fe.set(n,r),r}function hr(e,t){let n=new Array(e.blocks).fill(0),o=new Set;for(let r of t){let l=e.block[r]??-1;if(l<0)continue;let a=l*4096+e.codeword[r];o.has(a)||(o.add(a),n[l]=n[l]+1)}return n}var si={2:6,3:12};function pr(e){let t=[e.start],n=e.start;for(let o of e.segments){let r=o.at(-1);if(o.length===1)t.push(r);else{let l=si[o.length];for(let a=1;a<=l;a++){let i=a/l,s=1-i;if(o.length===2){let[c]=o;t.push([s*s*n[0]+2*s*i*c[0]+i*i*r[0],s*s*n[1]+2*s*i*c[1]+i*i*r[1]])}else{let[c,u]=o;t.push([s*s*s*n[0]+3*s*s*i*c[0]+3*s*i*i*u[0]+i*i*i*r[0],s*s*s*n[1]+3*s*s*i*c[1]+3*s*i*i*u[1]+i*i*i*r[1]])}}}n=r}return t}function br(e,t){let n=[];for(let o of e)for(let r=0;r<o.length;r++){let[l,a]=o[r],[i,s]=o[(r+1)%o.length];a<=t!=s<=t&&n.push(l+(t-a)/(s-a)*(i-l))}return n.sort((o,r)=>o-r)}function yr(e,t){let n=0;for(let o of e)if(o<t)n++;else break;return n%2===1}function ai(e,t,n){return yr(br(e,n),t)}function xr(e){let t=new Map;return(n,o)=>{let r=t.get(o);return r||(r=br(e,o),t.set(o,r)),yr(r,n)}}function li(e,t,n,o){let r=n[0]-e,l=n[1]-t,a=o[0]-n[0],i=o[1]-n[1],s=u=>Math.max(Math.abs(r+u*a),Math.abs(l+u*i)),c=Math.min(s(0),s(1));for(let[u,m]of[[l-r,a-i],[-(r+l),a+i]])if(m!==0){let d=u/m;d>0&&d<1&&(c=Math.min(c,s(d)))}return c}function ci(e,t,n){if(!ai(e,t,n))return 0;let o=Number.POSITIVE_INFINITY;for(let r of e)for(let l=0;l<r.length;l++)o=Math.min(o,li(t,n,r[l],r[(l+1)%r.length]));return Number.isFinite(o)?o:0}function ui(e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let l of e)for(let[a,i]of l)t=Math.min(t,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i);return{x0:t,y0:n,x1:o,y1:r}}function Er(e){let t=e.map(pr),n=ui(t),o=n.x1-n.x0,r=n.y1-n.y0;if(!(o>0&&r>0))return null;let l=(b,p)=>{let g=Math.max(b-n.x0,n.x1-b,p-n.y0,n.y1-p);return g>0?ci(t,b,p)/(2*g):0},a={cx:n.x0+o/2,cy:n.y0+r/2,value:0};a.value=l(a.cx,a.cy);let i=32;for(let b=1;b<i;b++)for(let p=1;p<i;p++){let g=n.x0+o*p/i,f=n.y0+r*b/i,x=l(g,f);x>a.value&&(a={cx:g,cy:f,value:x})}let s=o/i,c=r/i;for(let b=0;b<6;b++){let p=a;for(let g=-2;g<=2;g++)for(let f=-2;f<=2;f++){let x=p.cx+s*f/2,E=p.cy+c*g/2,A=l(x,E);A>a.value&&(a={cx:x,cy:E,value:A})}s/=2,c/=2}if(a.value<=0)return null;let m=.5/Math.max(a.cx-n.x0,n.x1-a.cx,a.cy-n.y0,n.y1-a.cy),d=([b,p])=>[.5+(b-a.cx)*m,.5+(p-a.cy)*m],h=e.map(b=>({start:d(b.start),segments:b.segments.map(p=>p.map(d))}));return{rings:h,polygons:h.map(pr),half:a.value}}function Sr(e,t){let n=([r,l])=>`${y(r*t)} ${y(l*t)}`,o="";for(let r of e.rings){o+=`M${n(r.start)}`;for(let l of r.segments){let a=l.length===1?"L":l.length===2?"Q":"C";o+=a+l.map(n).join(" ")}o+="Z"}return o}var mi={start:[0,-.58],segments:[[[.2,-.92],[1,-.97],[1,-.3]],[[1,.3],[.62,.6],[0,.92]],[[-.62,.6],[-1,.3],[-1,-.3]],[[-1,-.97],[-.2,-.92],[0,-.58]]]},gr;function Mr(){return gr??=Er([mi]),gr}function fi(e){let{width:t,height:n,cells:o}=e;return Number.isInteger(t)&&Number.isInteger(n)&&t>=gt&&n>=gt&&t<=pt&&n<=pt&&typeof o=="string"&&o.length===t*n&&/^[01]*$/.test(o)?(r,l)=>r>=0&&l>=0&&r<t&&l<n&&o[l*t+r]==="1":null}var J=([e,t])=>`${e},${t}`;function di(e,t,n){let o=(s,c)=>e(s-1,c-1),r=new Map,l=(s,c)=>{for(let[u,m]of[[s,c],[c,s]]){let d=r.get(J(u))??[];d.push(m),r.set(J(u),d)}};for(let s=0;s<=n;s++)for(let c=0;c<=t;c++){let u=o(c,s),m=o(c+1,s),d=o(c+1,s+1),h=o(c,s+1),b=[c,s-.5],p=[c+.5,s],g=[c,s+.5],f=[c-.5,s];switch((u?8:0)+(m?4:0)+(d?2:0)+(h?1:0)){case 1:case 14:l(f,g);break;case 2:case 13:l(g,p);break;case 3:case 12:l(f,p);break;case 4:case 11:l(b,p);break;case 6:case 9:l(b,g);break;case 7:case 8:l(f,b);break;case 5:l(b,p),l(f,g);break;case 10:l(f,b),l(g,p);break;default:break}}let a=[],i=new Set;for(let[s,c]of r){if(i.has(s)||c.length===0)continue;let[u,m]=s.split(",").map(Number),d=[[u,m]];i.add(s);let h=[u,m],b=c[0];for(;!i.has(J(b));){i.add(J(b)),d.push(b);let p=hi(r.get(J(b))??[],h,i);if(!p)break;h=b,b=p}d.length>=3&&a.push(pi(d))}return a}function hi(e,t,n){let o=J(t);return e.find(r=>J(r)!==o&&!n.has(J(r)))??e.find(r=>J(r)!==o)}function pi(e){let t=[];for(let n=0;n<e.length;n++){let o=e[(n-1+e.length)%e.length],r=e[n],l=e[(n+1)%e.length],a=(r[0]-o[0])*(l[1]-r[1])-(r[1]-o[1])*(l[0]-r[0]);Math.abs(a)>1e-9&&t.push(r)}return t.length>=3?t:e}function gi(e){let t=(l,a)=>[(l[0]+a[0])/2,(l[1]+a[1])/2],n=e.length,o=t(e[n-1],e[0]),r=e.map((l,a)=>[l,t(l,e[(a+1)%n])]);return{start:o,segments:r}}var Ne=new Map;function Ar(e){let t=`${e.width}x${e.height}:${e.cells}`,n=Ne.get(t);if(n)return n;let o=fi(e),r;if(!o)r={outline:null,problem:"invalid"};else if(e.cells.includes("1")){let l=di(o,e.width,e.height),a=l.length>0?Er(l.map(gi)):null;r=a&&2*a.half>=en?{outline:a,problem:null}:{outline:null,problem:a?"thin":"empty"}}else r={outline:null,problem:"empty"};return Ne.size>16&&Ne.delete(Ne.keys().next().value),Ne.set(t,r),r}var bi=1,Rr=.5,Fr=.5,yi=.5;function ut(e){return Math.max(e,Jt)}function mt(e){return e==="heart"?Mr():typeof e=="object"&&e?.type==="silhouette"?Ar(e).outline:null}function wr(e){return e==="circle"||mt(e)!==null}function oe(e,t,n){if(n==="circle"){let a=ut(t),i=(e/2+a)*Math.SQRT2+bi;return Math.ceil(i-e/2)}let o=mt(n);if(!o)return t;let r=ut(t),l=(e+2*(r+yi))/(2*o.half);return Math.ceil((l-e)/2-1e-9)}function Pr(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function xi(e,t,n){let o=oe(t,n,"circle"),r=ut(n),l=t+2*o,a=l/2,i=a-Rr-.5,s=Pr(Number.parseInt(Tt(e),36)||1),c=o-r,u=o+t+r;return Array.from({length:l},(m,d)=>Array.from({length:l},(h,b)=>{let p=s()<Fr;return b>=c&&b<u&&d>=c&&d<u?!1:p&&Math.hypot(b+.5-a,d+.5-a)<=i}))}var Ei=Array.from({length:8},(e,t)=>{let n=t*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Ut(e,t,n,o){if(o==="circle")return xi(e,t,n);let r=mt(o);if(!r)return null;let l=oe(t,n,o),a=ut(n),i=t+2*l,s=xr(r.polygons),c=.5+Rr,u=(b,p)=>{let g=b+.5,f=p+.5;return s(g/i,f/i)?Ei.every(([x,E])=>s((g+x*c)/i,(f+E*c)/i)):!1},m=Pr(Number.parseInt(Tt(e),36)||1),d=l-a,h=l+t+a;return Array.from({length:i},(b,p)=>Array.from({length:i},(g,f)=>{let x=m()<Fr;return f>=d&&f<h&&p>=d&&p<h?!1:x&&u(f,p)}))}function Ht(e,t){if(e==="circle")return{circle:t/2};let n=mt(e);return n?{path:Sr(n,t)}:null}function Ee(e,t,n){return G.QrCode.encodeSegments(G.QrSegment.makeSegments(e),Qe[t],G.QrCode.MIN_VERSION,G.QrCode.MAX_VERSION,-1,!n)}function Cr(e,t,n,o){if(!(e&&Number.isFinite(e))||e<=0||wr(o)||n<=0)return 0;let r=Math.min(tn,nn*n/(t+2*n));return Math.min(e,r)}var Ri=({r:e,g:t,b:n})=>[.2126*e+.7152*t+.0722*n,.299*e+.587*t+.114*n],Wa=Ri(me(rn));function Lr(e,t){return e.slice().map((n,o)=>o<t.y||o>=t.y+t.h?n:n.map((r,l)=>l<t.x||l>=t.x+t.w?r:!1))}function Gt(e,t=0){let n=[];return e.forEach((o,r)=>{let l=null;o.forEach((a,i)=>{if(!a&&l!==null){n.push(Xe`M${l+t} ${r+t}h${i-l}v1H${l+t}z`),l=null;return}if(i===o.length-1){if(!a)return;l===null?n.push(Xe`M${i+t},${r+t} h1v1H${i+t}z`):n.push(Xe`M${l+t},${r+t} h${i+1-l}v1H${l+t}z`);return}a&&l===null&&(l=i)})}),n.join("")}function Oe(e,t,n,o){if(o==null)return null;let r=e.length,l=Math.floor(t*Ve),a=(r+2*n)/t,i=(o.width||l)*a,s=(o.height||l)*a,c=o.x==null?r/2-i/2:o.x*a,u=o.y==null?r/2-s/2:o.y*a,m=null;if(o.excavate){let d=Math.max(0,o.padding??0)*a,h=Math.floor(c-d),b=Math.floor(u-d),p=Math.ceil(i+c+d-h),g=Math.ceil(s+u+d-b);m={x:h,y:b,w:p,h:g}}return{x:c,y:u,h:s,w:i,excavation:m}}function ft(e){let t=e.level??pe,{imageSettings:n}=e,o=e.isOGContext&&n?.excavate&&(t==="L"||t==="M")?"Q":t;if(e.autoLevel&&n&&o!=="H"){let r=Ee(e.value,o,e.exactLevel).getModules(),l=Oe(r,e.size??ze,oe(r.length,e.margin??We,e.shape),n);l&&(l.excavation?l.excavation.w*l.excavation.h:l.w*l.h)/(r.length*r.length)>Kt&&(o="H")}return o}var Qt=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var Fi=.6,wi=["L","M","Q","H"];function Pi(e){let t=Ee(e.value,e.level,e.exactLevel),n=wi[t.errorCorrectionLevel.ordinal]??e.level;return{code:e,cells:t.getModules(),layoutMargin:oe(t.size,e.margin,e.shape),map:dr(t.version,n),level:n,version:t.version}}function Ci(e,t){let{cells:n,map:o}=e,r=n.length,l=Oe(n,e.code.size,e.layoutMargin,t);if(!l)return null;let a=l.excavation??{x:Math.floor(l.x),y:Math.floor(l.y),w:Math.ceil(l.x+l.w)-Math.floor(l.x),h:Math.ceil(l.y+l.h)-Math.floor(l.y)},i=[];for(let c=Math.max(0,a.y);c<Math.min(r,a.y+a.h);c++)for(let u=Math.max(0,a.x);u<Math.min(r,a.x+a.w);u++)i.push(c*r+u);let s=hr(o,i);return{worst:Math.max(0,...s),correctable:o.correctable,budget:Math.floor(o.correctable*Fi),level:e.level,version:e.version}}var Li=e=>!e||e.worst<=e.budget;function _i(e,t,n,o){let r=t.map(i=>Pi({...e,level:i})),l=i=>{let s=o(i);return r.every(c=>Li(Ci(c,s)))};if(l(n))return n;let a=e.size*.005;for(let i=n-a;i>0;i-=a)if(l(i))return i;return 0}function _r(e,t){if(!t)return;let n=Math.floor(e.size*Ve),o=t.width||n,r=t.height||n,l=d=>{if(d===o)return t;let h=r*d/o;return{...t,width:d,height:h,...t.x!=null&&{x:t.x+(o-d)/2},...t.y!=null&&{y:t.y+(r-h)/2}}},a=e.level??pe,i={value:e.value,size:e.size,margin:e.margin,shape:e.shape,exactLevel:e.exactLevel},s=d=>ft({...e,level:a,imageSettings:d}),c=d=>{let h=_i(i,[d],o,l);return h>0?l(h):void 0},u=s(t);if(u===a)return c(a);let m=c(u);return m&&s(m)===u?m:c(a)}function Sl(e){let{value:t,size:n=ze,level:o=pe,bgColor:r=te,fgColor:l=Ye,margin:a=We,style:i,imageSettings:s,eyeColor:c,dotColor:u,bodyPattern:m,cornerEyePattern:d,cornerEyeDotPattern:h,isOGContext:b,templateId:p,customTemplate:g,customProps:f,frame:x,art:E,eyeColors:A,moduleScale:M,eyeShapes:S,eyeGradient:R,halo:C,shadow:$,autoLevel:B,exactLevel:Y,shape:O,bgRadius:ee,backdrop:X,frameLabelMarkers:Se,partMarkers:De,...Be}=e,k=_r({value:t,size:n,margin:a,level:o,shape:O,autoLevel:B,exactLevel:Y},s),U=ft({value:t,size:n,level:o,margin:a,imageSettings:k,autoLevel:B,exactLevel:Y,shape:O}),H=k?.src,W=cr(x)?ur(n,x,r):null,Me=W?.width??n,Ae=W?.height??n,Re=Ir(null),qe=Ir(null),[Yt,vr]=Ti(!1);vi(()=>{if(Re.current!=null){let dt=Re.current,w=dt.getContext("2d");if(!w)return;let Z=Ee(t,U,Y).getModules(),ie=oe(Z.length,a,O),ht=Ut(t,Z.length,a,O),V=Z.length+ie*2,se=Oe(Z,n,ie,k),Ue=qe.current,Vt=se!=null&&Ue?.complete&&Ue.naturalHeight!==0&&Ue.naturalWidth!==0;Vt&&se.excavation!=null&&(Z=Lr(Z,se.excavation));let He=window.devicePixelRatio||1;dt.width=Me*He,dt.height=Ae*He,w.scale(He,He),W&&(mr(w,W),w.translate(W.qrX,W.qrY));let Xt=n/V;w.scale(Xt,Xt),w.fillStyle=ke(r,te);let Fe=Ht(O,V),Zt=Cr(ee,Z.length,ie,O)*V;if(Fe&&"circle"in Fe?(w.beginPath(),w.arc(V/2,V/2,Fe.circle,0,2*Math.PI),w.fill()):Fe&&Qt?w.fill(new Path2D(Fe.path),"evenodd"):Zt>0&&typeof w.roundRect=="function"?(X&&(w.save(),w.fillStyle=X,w.fillRect(0,0,V,V),w.restore()),w.beginPath(),w.roundRect(0,0,V,V,Zt),w.fill()):w.fillRect(0,0,V,V),w.fillStyle=ke(l,Ye),Qt)w.fill(new Path2D(Gt(Z,ie))),ht&&w.fill(new Path2D(Gt(ht,0)));else for(let[Ge,de]of[[Z,ie],[ht??[],0]])Ge.forEach((we,ae)=>{we.forEach(($r,kr)=>{$r&&w.fillRect(kr+de,ae+de,1,1)})});if(Vt){let Ge={x:se.x+ie,y:se.y+ie,w:se.w,h:se.h},de=k?.shape??"square",we=k?.plate,ae=fr(Ge,we);w.save(),we&&(Bt(w,de,Ge),w.fillStyle=we,w.fill()),de!=="square"&&(Bt(w,de,ae),w.clip()),w.drawImage(Ue,ae.x,ae.y,ae.w,ae.h),w.restore()}}});let Tr={height:Ae,width:Me,...i},Wt=null;return H!=null&&(Wt=zt("img",{alt:"QR code",key:H,onLoad:()=>{vr(!0)},ref:qe,src:H,style:{display:"none"}})),zt(Ii,null,zt("canvas",{height:Ae,ref:Re,style:Tr,width:Me,...Be}),Wt)}export{Sl as QRCodeCanvas};
|
|
2
2
|
/**
|
|
3
3
|
* @license QR Code generator library (TypeScript)
|
|
4
4
|
* Copyright (c) Project Nayuki.
|