qrdx 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +17 -17
- package/dist/element.browser.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/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/src/frame-spec.d.ts.map +1 -1
- package/dist/src/frame.d.ts +13 -3
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/template/arrow.d.ts +0 -1
- package/dist/src/template/arrow.d.ts.map +1 -1
- package/dist/src/template/frame-template.d.ts +19 -0
- package/dist/src/template/frame-template.d.ts.map +1 -0
- package/dist/src/template/halloween.d.ts +0 -1
- package/dist/src/template/halloween.d.ts.map +1 -1
- package/dist/src/template/square-border.d.ts +0 -1
- package/dist/src/template/square-border.d.ts.map +1 -1
- package/dist/src/template/standard-box.d.ts +0 -1
- package/dist/src/template/standard-box.d.ts.map +1 -1
- package/dist/src/template/striked-box.d.ts +0 -1
- package/dist/src/template/striked-box.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +554 -0
- package/dist/types/frame-spec.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/qr.d.ts +111 -0
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/template.d.ts +7 -0
- package/dist/types/template.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +15 -15
- package/dist/vanilla.browser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/frame-spec.ts +17 -2
- package/src/frame.tsx +57 -7
- package/src/template/arrow.ts +14 -0
- package/src/template/frame-template.tsx +70 -0
- package/src/template/halloween.ts +14 -0
- package/src/template/specs/arrow.json +26 -0
- package/src/template/specs/halloween.json +144 -0
- package/src/template/specs/square-border.json +27 -0
- package/src/template/specs/standard-box.json +31 -0
- package/src/template/specs/striked-box.json +56 -0
- package/src/template/square-border.ts +14 -0
- package/src/template/standard-box.ts +14 -0
- package/src/template/striked-box.ts +14 -0
- package/types/frame-spec.ts +67 -4
- package/types/template.ts +7 -0
- package/src/template/arrow.tsx +0 -40
- package/src/template/halloween.tsx +0 -147
- package/src/template/square-border.tsx +0 -43
- package/src/template/standard-box.tsx +0 -43
- package/src/template/striked-box.tsx +0 -42
package/dist/qr-code-canvas.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{useEffect as ki,useRef as ar,useState as zi}from"react";var gt;(c=>{class t{constructor(o,a,l,u){this.version=o;this.errorCorrectionLevel=a;if(o<t.MIN_VERSION||o>t.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=o*4+17;let m=[];for(let f=0;f<this.size;f++)m.push(!1);for(let f=0;f<this.size;f++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(l);if(this.drawCodewords(p),u==-1){let f=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);let h=this.getPenaltyScore();h<f&&(u=y,f=h),this.applyMask(y)}}r(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(o,a){let l=c.QrSegment.makeSegments(o);return t.encodeSegments(l,a)}static encodeBinary(o,a){let l=c.QrSegment.makeBytes(o);return t.encodeSegments([l],a)}static encodeSegments(o,a,l=1,u=40,m=-1,p=!0){if(!(t.MIN_VERSION<=l&&l<=u&&u<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let f,y;for(f=l;;f++){let d=t.getNumDataCodewords(f,a)*8,C=i.getTotalBits(o,f);if(C<=d){y=C;break}if(f>=u)throw new RangeError("Data too long")}for(let d of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&y<=t.getNumDataCodewords(f,d)*8&&(a=d);let h=[];for(let d of o){e(d.mode.modeBits,4,h),e(d.numChars,d.mode.numCharCountBits(f),h);for(let C of d.getData())h.push(C)}r(h.length==y);let g=t.getNumDataCodewords(f,a)*8;r(h.length<=g),e(0,Math.min(4,g-h.length),h),e(0,(8-h.length%8)%8,h),r(h.length%8==0);for(let d=236;h.length<g;d^=253)e(d,8,h);let x=[];for(;x.length*8<h.length;)x.push(0);return h.forEach((d,C)=>x[C>>>3]|=d<<7-(C&7)),new t(f,a,x,m)}size;mask;modules=[];isFunction=[];getModule(o,a){return 0<=o&&o<this.size&&0<=a&&a<this.size&&this.modules[a][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let o=this.getAlignmentPatternPositions(),a=o.length;for(let l=0;l<a;l++)for(let u=0;u<a;u++)l==0&&u==0||l==0&&u==a-1||l==a-1&&u==0||this.drawAlignmentPattern(o[l],o[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){let a=this.errorCorrectionLevel.formatBits<<3|o,l=a;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;let u=(a<<10|l)^21522;r(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 o=this.version;for(let l=0;l<12;l++)o=o<<1^(o>>>11)*7973;let a=this.version<<12|o;r(a>>>18==0);for(let l=0;l<18;l++){let u=n(a,l),m=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(m,p,u),this.setFunctionModule(p,m,u)}}drawFinderPattern(o,a){for(let l=-4;l<=4;l++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(l)),p=o+u,f=a+l;0<=p&&p<this.size&&0<=f&&f<this.size&&this.setFunctionModule(p,f,m!=2&&m!=4)}}drawAlignmentPattern(o,a){for(let l=-2;l<=2;l++)for(let u=-2;u<=2;u++)this.setFunctionModule(o+u,a+l,Math.max(Math.abs(u),Math.abs(l))!=1)}setFunctionModule(o,a,l){this.modules[a][o]=l,this.isFunction[a][o]=!0}addEccAndInterleave(o){let a=this.version,l=this.errorCorrectionLevel;if(o.length!=t.getNumDataCodewords(a,l))throw new RangeError("Invalid argument");let u=t.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a],m=t.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a],p=Math.floor(t.getNumRawDataModules(a)/8),f=u-p%u,y=Math.floor(p/u),h=[],g=t.reedSolomonComputeDivisor(m);for(let d=0,C=0;d<u;d++){let M=o.slice(C,C+y-m+(d<f?0:1));C+=M.length;let F=t.reedSolomonComputeRemainder(M,g);d<f&&M.push(0),h.push(M.concat(F))}let x=[];for(let d=0;d<h[0].length;d++)h.forEach((C,M)=>{(d!=y-m||M>=f)&&x.push(C[d])});return r(x.length==p),x}drawCodewords(o){if(o.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){let p=l-m,y=(l+1&2)==0?this.size-1-u:u;!this.isFunction[y][p]&&a<o.length*8&&(this.modules[y][p]=n(o[a>>>3],7-(a&7)),a++)}}r(a==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let l=0;l<this.size;l++){let u;switch(o){case 0:u=(l+a)%2==0;break;case 1:u=a%2==0;break;case 2:u=l%3==0;break;case 3:u=(l+a)%3==0;break;case 4:u=(Math.floor(l/3)+Math.floor(a/2))%2==0;break;case 5:u=l*a%2+l*a%3==0;break;case 6:u=(l*a%2+l*a%3)%2==0;break;case 7:u=((l+a)%2+l*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][l]&&u&&(this.modules[a][l]=!this.modules[a][l])}}getPenaltyScore(){let o=0;for(let m=0;m<this.size;m++){let p=!1,f=0,y=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[m][h]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,y),p||(o+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[m][h],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,y)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,f=0,y=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][m]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,y),p||(o+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[h][m],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,y)*t.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){let f=this.modules[m][p];f==this.modules[m][p+1]&&f==this.modules[m+1][p]&&f==this.modules[m+1][p+1]&&(o+=t.PENALTY_N2)}let a=0;for(let m of this.modules)a=m.reduce((p,f)=>p+(f?1:0),a);let l=this.size*this.size,u=Math.ceil(Math.abs(a*20-l*10)/l)-1;return r(0<=u&&u<=9),o+=u*t.PENALTY_N4,r(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{let o=Math.floor(this.version/7)+2,a=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2,l=[6];for(let u=this.size-7;l.length<o;u-=a)l.splice(1,0,u);return l}}static getNumRawDataModules(o){if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*o+128)*o+64;if(o>=2){let l=Math.floor(o/7)+2;a-=(25*l-10)*l-55,o>=7&&(a-=36)}return r(208<=a&&a<=29648),a}static getNumDataCodewords(o,a){return Math.floor(t.getNumRawDataModules(o)/8)-t.ECC_CODEWORDS_PER_BLOCK[a.ordinal][o]*t.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let a=[];for(let u=0;u<o-1;u++)a.push(0);a.push(1);let l=1;for(let u=0;u<o;u++){for(let m=0;m<a.length;m++)a[m]=t.reedSolomonMultiply(a[m],l),m+1<a.length&&(a[m]^=a[m+1]);l=t.reedSolomonMultiply(l,2)}return a}static reedSolomonComputeRemainder(o,a){let l=a.map(u=>0);for(let u of o){let m=u^l.shift();l.push(0),a.forEach((p,f)=>l[f]^=t.reedSolomonMultiply(p,m))}return l}static reedSolomonMultiply(o,a){if(o>>>8||a>>>8)throw new RangeError("Byte out of range");let l=0;for(let u=7;u>=0;u--)l=l<<1^(l>>>7)*285,l^=(a>>>u&1)*o;return r(l>>>8==0),l}finderPenaltyCountPatterns(o){let a=o[1];r(a<=this.size*3);let l=a>0&&o[2]==a&&o[3]==a*3&&o[4]==a&&o[5]==a;return(l&&o[0]>=a*4&&o[6]>=a?1:0)+(l&&o[6]>=a*4&&o[0]>=a?1:0)}finderPenaltyTerminateAndCount(o,a,l){return o&&(this.finderPenaltyAddHistory(a,l),a=0),a+=this.size,this.finderPenaltyAddHistory(a,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(o,a){a[0]==0&&(o+=this.size),a.pop(),a.unshift(o)}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]]}c.QrCode=t;function e(s,o,a){if(o<0||o>31||s>>>o)throw new RangeError("Value out of range");for(let l=o-1;l>=0;l--)a.push(s>>>l&1)}function n(s,o){return(s>>>o&1)!=0}function r(s){if(!s)throw new Error("Assertion error")}class i{constructor(o,a,l){this.mode=o;this.numChars=a;this.bitData=l;if(a<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}mode;numChars;bitData;static makeBytes(o){let a=[];for(let l of o)e(l,8,a);return new i(i.Mode.BYTE,o.length,a)}static makeNumeric(o){if(!i.isNumeric(o))throw new RangeError("String contains non-numeric characters");let a=[];for(let l=0;l<o.length;){let u=Math.min(o.length-l,3);e(parseInt(o.substr(l,u),10),u*3+1,a),l+=u}return new i(i.Mode.NUMERIC,o.length,a)}static makeAlphanumeric(o){if(!i.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],l;for(l=0;l+2<=o.length;l+=2){let u=i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l))*45;u+=i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l+1)),e(u,11,a)}return l<o.length&&e(i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l)),6,a),new i(i.Mode.ALPHANUMERIC,o.length,a)}static makeSegments(o){return o==""?[]:i.isNumeric(o)?[i.makeNumeric(o)]:i.isAlphanumeric(o)?[i.makeAlphanumeric(o)]:[i.makeBytes(i.toUtf8ByteArray(o))]}static makeEci(o){let a=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)e(o,8,a);else if(o<16384)e(2,2,a),e(o,14,a);else if(o<1e6)e(6,3,a),e(o,21,a);else throw new RangeError("ECI assignment value out of range");return new i(i.Mode.ECI,0,a)}static isNumeric(o){return i.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return i.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,a){let l=0;for(let u of o){let m=u.mode.numCharCountBits(a);if(u.numChars>=1<<m)return 1/0;l+=4+m+u.bitData.length}return l}static toUtf8ByteArray(o){o=encodeURI(o);let a=[];for(let l=0;l<o.length;l++)o.charAt(l)!="%"?a.push(o.charCodeAt(l)):(a.push(parseInt(o.substr(l+1,2),16)),l+=2);return a}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}c.QrSegment=i})(gt||={});(e=>{let t;(r=>{class n{constructor(c,s){this.ordinal=c;this.formatBits=s}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)}r.Ecc=n})(t=e.QrCode||={})})(gt||={});(e=>{let t;(r=>{class n{constructor(c,s){this.modeBits=c;this.numBitsCharCount=s}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(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}r.Mode=n})(t=e.QrSegment||={})})(gt||={});var Q=gt;var tt={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},kt=128,yt="Q",et="#FFFFFF",zt="#000000";var Bt=0;var qt=.1;import{z as nt}from"zod";var ur=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],bt=24;var re=.5,xt=1.5,mr=nt.enum(ur),oe=nt.object({style:mr,text:nt.string().max(bt).optional(),color:nt.string().optional(),textColor:nt.string().optional(),secondaryText:nt.string().max(bt).optional(),secondaryColor:nt.string().optional(),fontScale:nt.number().min(re).max(xt).optional()});import{z as S}from"zod";function pr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function b(t,e=3){return String(pr(t,e))}function Dt(t,...e){let n=t[0]??"";for(let r=0;r<e.length;r++){let i=e[r];n+=(typeof i=="number"?b(i):i)+(t[r+1]??"")}return n}var dr={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},fr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,ie=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Ct(t,e=Number.POSITIVE_INFINITY){if(!fr.test(t))return null;let n=[],r=0,i=()=>{for(;r<t.length&&/[\s,]/.test(t[r]);)r++},c=()=>{i(),ie.lastIndex=r;let a=ie.exec(t);if(!a)return null;let l=a[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;r=ie.lastIndex;let m=Number(l);return Number.isFinite(m)?m:null},s=()=>{i();let a=t[r];return a==="0"||a==="1"?(r++,a==="1"?1:0):null},o=()=>(i(),r<t.length&&/[0-9.+-]/.test(t[r]));for(i();r<t.length;){let a=t[r],l=a.toUpperCase(),u=dr[l];if(u===void 0||n.length===0&&l!=="M")return null;if(r++,u===0){n.push({command:a,values:[]}),i();continue}let m=a,p=!0;for(;p||o();){let f=[];for(let y=0;y<u;y++){let h=l==="A"&&(y===3||y===4)?s():c();if(h===null)return null;f.push(h)}n.push({command:m,values:f}),l==="M"&&(m=a==="M"?"L":"l"),p=!1}i()}return n}function Ne(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ae(t,e=1,n=0,r=0){let i="";for(let{command:c,values:s}of t){let o=c.toUpperCase(),a=c===o,l=a?n:0,u=a?r:0,m;switch(o){case"Z":m=[];break;case"H":m=[b(s[0]*e+l)];break;case"V":m=[b(s[0]*e+u)];break;case"A":m=[b(Math.abs(s[0])*e),b(Math.abs(s[1])*e),b(s[2]),String(s[3]),String(s[4]),b(s[5]*e+l),b(s[6]*e+u)];break;default:m=s.map((p,f)=>b(p*e+(f%2===0?l:u)))}i+=c+m.join(" ")}return i}function ke(t,e=.25){let n=[],r=[],i=[0,0],c=[0,0],s=()=>{r.length>2&&n.push(r),r=[]};for(let o of t)if(o.op==="M")s(),i=[o.x,o.y],c=i,r.push(i);else if(o.op==="L")c=[o.x,o.y],r.push(c);else if(o.op==="C"){let a=c,l=[o.x1,o.y1],u=[o.x2,o.y2],m=[o.x,o.y],p=Math.hypot(l[0]-a[0],l[1]-a[1])+Math.hypot(u[0]-l[0],u[1]-l[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),f=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(p/(4*e)))));for(let y=1;y<=f;y++){let h=y/f,g=1-h;r.push([g*g*g*a[0]+3*g*g*h*l[0]+3*g*h*h*u[0]+h*h*h*m[0],g*g*g*a[1]+3*g*g*h*l[1]+3*g*h*h*u[1]+h*h*h*m[1]])}c=m}else s(),c=i;return s(),n}function Gt(t,e){let n=[i=>i[0]-e.x0,i=>e.x1-i[0],i=>i[1]-e.y0,i=>e.y1-i[1]],r=t;for(let i of n){if(r.length===0)break;let c=r;r=[];for(let s=0;s<c.length;s++){let o=c[s],a=c[(s+c.length-1)%c.length],l=i(o),u=i(a);l>=0?(u<0&&r.push(Oe(a,o,u,l)),r.push(o)):u>=0&&r.push(Oe(a,o,u,l))}}return r.length>2?r:[]}function Oe(t,e,n,r){let i=n/(n-r);return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function ze(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,r])=>`${b(n)} ${b(r)}`).join("L")}Z`).join("")}function Be(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,c=(s,o)=>{e=Math.min(e,s),n=Math.min(n,o),r=Math.max(r,s),i=Math.max(i,o)};for(let s of t)s.op==="C"?(c(s.x1,s.y1),c(s.x2,s.y2),c(s.x,s.y)):s.op!=="Z"&&c(s.x,s.y);return Number.isFinite(e)?{x0:e,y0:n,x1:r,y1:i}:null}var se=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function hr(t,e,n,r,i,c,s,o,a){if(t===o&&e===a)return[];let l=Math.abs(n),u=Math.abs(r);if(l===0||u===0)return[{op:"L",x:o,y:a}];let m=i*Math.PI/180,p=Math.cos(m),f=Math.sin(m),y=(t-o)/2,h=(e-a)/2,g=p*y+f*h,x=-f*y+p*h,d=g*g/(l*l)+x*x/(u*u);d>1&&(l*=Math.sqrt(d),u*=Math.sqrt(d));let C=l*l*u*u-l*l*x*x-u*u*g*g,M=l*l*x*x+u*u*g*g,F=(c===s?-1:1)*Math.sqrt(Math.max(0,C/M)),P=F*l*x/u,E=-F*u*g/l,I=p*P-f*E+(t+o)/2,w=f*P+p*E+(e+a)/2,N=(G,U,V,dt)=>Math.atan2(G*dt-U*V,G*V+U*dt),B=N(1,0,(g-P)/l,(x-E)/u),H=N((g-P)/l,(x-E)/u,(-g-P)/l,(-x-E)/u);!s&&H>0?H-=2*Math.PI:s&&H<0&&(H+=2*Math.PI);let Y=Math.max(1,Math.ceil(Math.abs(H)/(Math.PI/2)-1e-9)),D=H/Y,K=4/3*Math.tan(D/4),it=(G,U)=>[I+l*p*G-u*f*U,w+l*f*G+u*p*U],pt=[];for(let G=0;G<Y;G++){let U=B+G*D,V=U+D,[dt,$t]=it(Math.cos(U)-K*Math.sin(U),Math.sin(U)+K*Math.cos(U)),[Mt,v]=it(Math.cos(V)+K*Math.sin(V),Math.sin(V)-K*Math.cos(V)),[j,J]=G===Y-1?[o,a]:it(Math.cos(V),Math.sin(V));pt.push({op:"C",x1:dt,y1:$t,x2:Mt,y2:v,x:j,y:J})}return pt}function Qt(t){let e=[],n=0,r=0,i=0,c=0,s=0,o="",a=null,l=null,u=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{u(),se.lastIndex=n;let y=se.exec(t);return y?(n=se.lastIndex,Number(y[0])):null},p=()=>{u();let y=t[n];return y==="0"||y==="1"?(n++,y==="1"):null},f=y=>{let h=[];for(let g=0;g<y;g++){let x=m();if(x===null)return null;h.push(x)}return h};for(;u(),!(n>=t.length);){let y=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(y))o=y,n++;else if(!o||o==="Z"||o==="z")break;let h=o===o.toLowerCase(),g=h?r:0,x=h?i:0,d=o.toUpperCase();if(d==="Z"){e.push({op:"Z"}),r=c,i=s,a=null,l=null;continue}if(d==="A"){let P=f(3),E=p(),I=p(),w=f(2);if(!(P&&w)||E===null||I===null)break;let[N,B,H]=P,Y=w[0]+g,D=w[1]+x;e.push(...hr(r,i,N,B,H,E,I,Y,D)),r=Y,i=D,a=null,l=null;continue}let C={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[d]??0,M=f(C);if(!M)break;let F=M;switch(d){case"M":r=F[0]+g,i=F[1]+x,c=r,s=i,e.push({op:"M",x:r,y:i}),o=h?"l":"L",a=null,l=null;break;case"L":case"H":case"V":d!=="V"&&(r=F[0]+g),d==="V"?i=F[0]+x:d==="L"&&(i=F[1]+x),e.push({op:"L",x:r,y:i}),a=null,l=null;break;case"C":case"S":{let P,E;d==="C"?(P=[F[0]+g,F[1]+x],E=F.slice(2)):(P=a?[2*r-a[0],2*i-a[1]]:[r,i],E=F);let I=[E[0]+g,E[1]+x],w=[E[2]+g,E[3]+x];e.push({op:"C",x1:P[0],y1:P[1],x2:I[0],y2:I[1],x:w[0],y:w[1]}),[r,i]=w,a=I,l=null;break}case"Q":case"T":{let P,E;d==="Q"?(P=[F[0]+g,F[1]+x],E=[F[2]+g,F[3]+x]):(P=l?[2*r-l[0],2*i-l[1]]:[r,i],E=[F[0]+g,F[1]+x]),e.push({op:"C",x1:r+2/3*(P[0]-r),y1:i+2/3*(P[1]-i),x2:E[0]+2/3*(P[0]-E[0]),y2:E[1]+2/3*(P[1]-E[1]),x:E[0],y:E[1]}),[r,i]=E,l=P,a=null;break}default:break}}return e}var qe=.5522847498;function le(t,e,n,r,i=0,c=0){if(n<=0||r<=0)return[];let s=Math.min(Math.max(i,0),n/2),o=Math.min(Math.max(c,0),r/2);if(s===0||o===0)return[{op:"M",x:t,y:e},{op:"L",x:t+n,y:e},{op:"L",x:t+n,y:e+r},{op:"L",x:t,y:e+r},{op:"Z"}];let a=s*qe,l=o*qe,u=t+n,m=e+r;return[{op:"M",x:t+s,y:e},{op:"L",x:u-s,y:e},{op:"C",x1:u-s+a,y1:e,x2:u,y2:e+o-l,x:u,y:e+o},{op:"L",x:u,y:m-o},{op:"C",x1:u,y1:m-o+l,x2:u-s+a,y2:m,x:u-s,y:m},{op:"L",x:t+s,y:m},{op:"C",x1:t+s-a,y1:m,x2:t,y2:m-o+l,x:t,y:m-o},{op:"L",x:t,y:e+o},{op:"C",x1:t,y1:e+o-l,x2:t+s-a,y2:e,x:t+s,y:e},{op:"Z"}]}var gr="qrdx.frame",yr=1,me="custom",O={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:bt},br=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Ht=.95,xr=200,Sr=["frame","text","accent","background"],Mr=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Er=/[\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 pe(t,e=bt){let n=t.slice(0,1e3).normalize("NFC").replace(Mr," ").replace(Er,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var de=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,_=S.number().min(-O.maxCoordinate).max(O.maxCoordinate).refine(de,{message:`Numbers may have at most ${O.maxDecimals} decimals`}),k=_.refine(t=>t>0,{message:"Must be greater than 0"}),Ut=_.refine(t=>t>=0,{message:"Must not be negative"}),Rt=S.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),De=S.union([S.enum(Sr),Rt]),Ue=t=>S.object({mix:S.tuple([t,t]),amount:S.number().min(0).max(1).refine(de)}).strict(),Pt=S.union([De,Ue(De)]),Fr=S.union([Rt,Ue(S.union([S.enum(["frame","accent","background"]),Rt]))]),lt=S.union([Pt,S.object({gradient:S.object({from:Pt,to:Pt,direction:S.enum(["horizontal","vertical"]).optional(),steps:S.int().min(2).max(O.maxGradientSteps).optional()}).strict()}).strict()]),ce={x:_,y:_,width:k,height:k},Cr=S.object({type:S.literal("rect"),...ce,radius:Ut.optional(),fill:lt,hole:S.object({...ce,radius:Ut.optional()}).strict().optional()}).strict(),Pr=S.object({type:S.literal("circle"),cx:_,cy:_,r:k,hole:k.optional(),fill:lt}).strict(),Rr=S.object({type:S.literal("ellipse"),cx:_,cy:_,rx:k,ry:k,fill:lt}).strict(),Ar=S.object({type:S.literal("polygon"),points:S.array(S.tuple([_,_])).min(3).max(O.maxPolygonPoints),fill:lt}).strict(),wr=S.object({type:S.literal("path"),d:S.string().min(2).max(O.maxPathLength),fill:lt,fillRule:S.enum(["nonzero","evenodd"]).optional()}).strict(),Lr=S.object({type:S.literal("line"),x1:_,y1:_,x2:_,y2:_,width:k,cap:S.enum(["butt","round"]).optional(),dash:S.tuple([k,k]).optional(),fill:lt}).strict(),Ir=S.object({type:S.literal("icon"),icon:S.enum(br),x:_,y:_,size:k,fill:lt}).strict(),vr=S.discriminatedUnion("type",[Cr,Pr,Rr,Ar,wr,Lr,Ir]),He={id:S.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:S.enum(["primary","secondary","fixed"]),text:S.string().max(200),maxLength:S.int().min(1).max(bt).optional(),color:Pt,weight:S.enum(["bold","regular"]).optional(),collapse:S.object({y:_,height:k}).strict().optional()},_r=S.object({type:S.literal("text"),...He,box:S.object(ce).strict(),align:S.enum(["start","middle","end"]).optional(),fontSize:k.optional()}).strict(),$r=S.object({type:S.literal("curved"),...He,curve:S.object({cx:_,cy:_,radius:k,side:S.enum(["top","bottom"]),spread:S.number().min(20).max(300).refine(de).optional()}).strict(),fontSize:k}).strict(),Tr=S.discriminatedUnion("type",[_r,$r]),Ge=_.refine(t=>t>=O.minArtboard&&t<=O.maxArtboard,{message:`Artboard sides must be ${O.minArtboard} to ${O.maxArtboard} units`}),Nr=S.object({kind:S.literal(gr),version:S.literal(yr),artboard:S.object({width:Ge,height:Ge}).strict(),qr:S.object({x:_,y:_,size:k,padding:Ut.optional(),radius:Ut.optional(),plate:S.enum(["opaque","background"]).optional()}).strict(),colors:S.object({frame:Rt,text:Fr.optional(),accent:Rt.optional()}).strict(),shapes:S.array(vr).max(O.maxShapes),labels:S.array(Tr).max(O.maxLabels),bleed:S.union([S.literal("none"),Pt]).optional()}).strict();function fe(t){let e=Vt(t);return{x0:t.qr.x-e,y0:t.qr.y-e,x1:t.qr.x+t.qr.size+e,y1:t.qr.y+t.qr.size+e}}function Or(t){return{x0:t.qr.x,y0:t.qr.y,x1:t.qr.x+t.qr.size,y1:t.qr.y+t.qr.size}}function Vt(t){return t.qr.padding??t.qr.size*O.defaultPadding}var he=.52,kr=.35;function zr(t){let e=t.fontSize??t.box.height*he;return Math.min(e*xt,t.box.height*Ht)}var ue=(t,e)=>Math.min(t.x1,e.x1)-Math.max(t.x0,e.x0)>1e-6&&Math.min(t.y1,e.y1)-Math.max(t.y0,e.y0)>1e-6;function Qe(t){let e=fe(t),n=Math.min(t.qr.radius??0,(e.x1-e.x0)/2,(e.y1-e.y0)/2),r=[[e.x0+n,e.y0+n,Math.PI],[e.x1-n,e.y0+n,-Math.PI/2],[e.x1-n,e.y1-n,0],[e.x0+n,e.y1-n,Math.PI/2]],i=[];for(let[c,s,o]of r)for(let a=0;a<=8;a++){let l=o+Math.PI/2*(a/8);i.push([c+n*Math.cos(l),s+n*Math.sin(l)])}return i}function Br([t,e],n,r){if(t<n.x-.01||e<n.y-.01||t>n.x+n.width+.01||e>n.y+n.height+.01)return!1;let c=Math.min(r,n.width/2,n.height/2),s=Math.min(Math.max(t,n.x+c),n.x+n.width-c),o=Math.min(Math.max(e,n.y+c),n.y+n.height-c);return Math.hypot(t-s,e-o)<=c+.01}function qr(t){let e=0;return t.forEach(([n,r],i)=>{let[c,s]=t[(i+1)%t.length];e+=n*s-c*r}),Math.abs(e)/2}function Dr(t,e,n){let r=fe(e);if(t.fill==="background"||!ue(n,r))return!1;if(t.type==="rect"&&t.hole){let{hole:i}=t;return!Qe(e).every(c=>Br(c,i,i.radius??0))}if(t.type==="circle"&&t.hole){let i=t.hole;return!Qe(e).every(([c,s])=>Math.hypot(c-t.cx,s-t.cy)<=i+.01)}if(t.type==="polygon"){let i=Gt(t.points,r);return i.length>2&&qr(i)>1e-6}return!0}function ge(t){switch(t.type){case"rect":return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},segments:t.hole?18:9};case"circle":return{bounds:{x0:t.cx-t.r,y0:t.cy-t.r,x1:t.cx+t.r,y1:t.cy+t.r},segments:t.hole?10:5};case"ellipse":return{bounds:{x0:t.cx-t.rx,y0:t.cy-t.ry,x1:t.cx+t.rx,y1:t.cy+t.ry},segments:5};case"polygon":{let e=t.points.map(([r])=>r),n=t.points.map(([,r])=>r);return{bounds:{x0:Math.min(...e),y0:Math.min(...n),x1:Math.max(...e),y1:Math.max(...n)},segments:t.points.length}}case"path":{let e=Ct(t.d,O.maxDecimals);return e?{bounds:Be(Qt(t.d)),segments:Ne(e)}:{bounds:null,segments:0}}case"line":{let e=t.width/2,n=Math.hypot(t.x2-t.x1,t.y2-t.y1),r=t.dash?Math.ceil(n/(t.dash[0]+t.dash[1])):1;return{bounds:{x0:Math.min(t.x1,t.x2)-e,y0:Math.min(t.y1,t.y2)-e,x1:Math.max(t.x1,t.x2)+e,y1:Math.max(t.y1,t.y2)+e},segments:r*(t.cap==="round"?4:5)}}default:return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.size,y1:t.y+t.size},segments:xr}}}function Gr(t,e){let n=(d,C=[])=>e.addIssue({code:"custom",message:d,path:C}),r=O,i=new TextEncoder().encode(JSON.stringify(t)).length;if(i>r.maxBytes){n(`The spec is ${i} bytes; the limit is ${r.maxBytes}`);return}let{width:c,height:s}=t.artboard,o=Math.max(c,s)*.005,a={x0:-o,y0:-o,x1:c+o,y1:s+o},l=d=>d.x0>=a.x0&&d.y0>=a.y0&&d.x1<=a.x1&&d.y1<=a.y1,{qr:u}=t,m=Vt(t);m<u.size*r.minPadding-1e-9&&n(`qr.padding must be at least ${r.minPadding*100}% of qr.size`,["qr","padding"]),u.size<Math.min(c,s)*r.minQrShare-1e-9&&n(`qr.size must be at least ${r.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=fe(t);(p.x0<-1e-9||p.y0<-1e-9||p.x1>c+1e-9||p.y1>s+1e-9)&&n("The code and its padding must sit inside the artboard",["qr"]),(u.radius??0)>(u.size+2*m)/2&&n("qr.radius is larger than half the plate",["qr","radius"]);let f=0,y=0;t.shapes.forEach((d,C)=>{let M=["shapes",C],{bounds:F,segments:P}=ge(d);if(!F){n("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",[...M,"d"]);return}if(l(F)||n("The shape extends outside the artboard",M),d.type==="rect"&&d.hole){let{hole:E}=d;(E.x<d.x||E.y<d.y||E.x+E.width>d.x+d.width+1e-9||E.y+E.height>d.y+d.height+1e-9)&&n("The hole must sit inside its rect",[...M,"hole"])}d.type==="circle"&&d.hole&&d.hole>=d.r&&n("The hole must be smaller than the circle",[...M,"hole"]),u.plate==="background"&&Dr(d,t,F)&&n('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',M),f+=P,typeof d.fill=="object"&&"gradient"in d.fill&&(y+=(d.fill.gradient.steps??32)*P)}),f>r.maxSegments&&n(`The shapes have ${f} segments; the limit is ${r.maxSegments}`,["shapes"]),y>r.maxGradientWork&&n("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=[],g=new Set,x=new Set;t.labels.forEach((d,C)=>{let M=["labels",C];g.has(d.id)&&n(`Label id "${d.id}" is used twice`,[...M,"id"]),g.add(d.id),d.slot!=="fixed"&&(x.has(d.slot)&&n(`Only one label may use the ${d.slot} slot`,[...M,"slot"]),x.add(d.slot));let F=d.maxLength??r.maxTextLength;d.text!==pe(d.text,F)&&n(`Label text must be at most ${F} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...M,"text"]);let P;if(d.type==="text"){P={x0:d.box.x,y0:d.box.y,x1:d.box.x+d.box.width,y1:d.box.y+d.box.height},d.fontSize!==void 0&&d.fontSize>d.box.height*Ht+1e-9&&n("fontSize may be at most 95% of the label's row height",[...M,"fontSize"]);let E=d.box.y+d.box.height/2,I=zr(d)*kr,w={x0:P.x0,x1:P.x1,y0:E-I,y1:E+I};(ue(P,Or(t))||ue(w,p))&&n("The label overlaps the code or its padding",[...M,"box"])}else{let{cx:E,cy:I,radius:w}=d.curve,N=d.fontSize*xt*.6;P={x0:E-w-N,y0:I-w-N,x1:E+w+N,y1:I+w+N};let B=Math.hypot(Math.max(p.x0-E,0,E-p.x1),Math.max(p.y0-I,0,I-p.y1));Math.hypot(Math.max(Math.abs(p.x0-E),Math.abs(p.x1-E)),Math.max(Math.abs(p.y0-I),Math.abs(p.y1-I)))<=w-N||B>=w+N||n("The curved label crosses the code or its padding",[...M,"curve"])}if(l(P)||n("The label extends outside the artboard",M),d.collapse){let E=d.collapse,I=E.y+E.height;(E.y<-1e-9||I>s+1e-9)&&n("The collapse band must sit inside the artboard",[...M,"collapse"]),I>p.y0+1e-6&&E.y<p.y1-1e-6&&n("The collapse band crosses the code or its padding",[...M,"collapse"]);for(let w of h)I>w.y+1e-6&&E.y<w.y+w.height-1e-6&&n("Collapse bands may not overlap",[...M,"collapse"]);h.push(E)}})}var ye=Nr.superRefine(Gr);var Qr=oe.extend({style:S.literal(me),spec:ye}),Ve=S.discriminatedUnion("style",[oe,Qr]);function q(t){if(t.length===0)return"";let[e,...n]=t;return`M${b(e[0])} ${b(e[1])}${n.map(([r,i])=>`L${b(r)} ${b(i)}`).join("")}Z`}function $(t,e,n){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function A(t,e,n,r,i=0){let c=Math.min(n,r)/2,[s,o,a,l]=(typeof i=="number"?[i,i,i,i]:i).map(m=>Math.max(0,Math.min(m,c))),u=(m,p,f)=>m>0?`A${b(m)} ${b(m)} 0 0 1 ${b(p)} ${b(f)}`:"";return`M${b(t+s)} ${b(e)}H${b(t+n-o)}${u(o,t+n,e+o)}V${b(e+r-a)}${u(a,t+n-a,e+r)}H${b(t+l)}${u(l,t,e+r-l)}V${b(e+s)}${u(s,t+s,e)}Z`}function Yt(t,e,n,r,i=5){return Array.from({length:i*2},(c,s)=>{let o=s%2===0?n:r,a=-Math.PI/2+Math.PI/i*s;return[t+o*Math.cos(a),e+o*Math.sin(a)]})}function Ye(t,e,n){let r=n/2,i=(c,s)=>`${b(t+c*r)} ${b(e+s*r)}`;return`M${i(0,-.52)}C${i(.18,-.92)} ${i(.98,-.94)} ${i(1,-.34)}C${i(1,.12)} ${i(.5,.48)} ${i(0,.92)}C${i(-.5,.48)} ${i(-1,.12)} ${i(-1,-.34)}C${i(-.98,-.94)} ${i(-.18,-.92)} ${i(0,-.52)}Z`}function be(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}var je=24,rt=(t,e,n,r)=>{let i=r*Math.PI/180;return[t+n*Math.cos(i),e+n*Math.sin(i)]},jt=([t,e])=>`${b(t)} ${b(e)}`;function St(t,e,n,r,i,c){let s=c-i>180?1:0;return`M${jt(rt(t,e,r,i))}A${b(r)} ${b(r)} 0 ${s} 1 ${jt(rt(t,e,r,c))}L${jt(rt(t,e,n,c))}A${b(n)} ${b(n)} 0 ${s} 0 ${jt(rt(t,e,n,i))}Z`}function At(t,e,n,r){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function Ur(t){let e=0;return t.forEach(([n,r],i)=>{let[c,s]=t[(i+1)%t.length];e+=n*s-c*r}),e/2}function Ze(t){return q(Ur(t)<0?[...t].reverse():t)}function Zt(t,e,n,r,i){let c=Math.hypot(n-t,r-e)||1,s=-(r-e)/c*(i/2),o=(n-t)/c*(i/2);return Ze([[t+s,e+o],[n+s,r+o],[n-s,r-o],[t-s,e-o]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),Z=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Hr(){let t=[];for(let e of[0,60,120]){let[n,r]=rt(12,12,10.5,e+180),[i,c]=rt(12,12,10.5,e);t.push(Zt(n,r,i,c,2))}for(let e=0;e<6;e++){let n=e*60,[r,i]=rt(12,12,6.2,n);for(let c of[-45,45]){let[s,o]=rt(r,i,3.6,n+c);t.push(Zt(r,i,s,o,1.7))}}return z(...t)}var Vr={wifi:()=>z(St(12,20,4.6,7.2,-135,-45),St(12,20,9.2,11.8,-135,-45),St(12,20,13.8,16.4,-135,-45),$(12,20,2.2)),star:()=>z(q(Yt(12,12.8,11.6,4.8))),heart:()=>z(Ye(12,12.4,22)),phone:()=>Z(A(6,1.5,12,21,2.6),A(7.8,4.2,8.4,13.4,.6),$(12,19.8,1.1)),headphones:()=>z(St(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>Z(A(2.5,4,19,17.5,2.5),A(4.6,9,14.8,10.6,.8),A(7,11.4,2.6,2.6,.4),A(10.7,11.4,2.6,2.6,.4),A(14.4,11.4,2.6,2.6,.4),A(7,15.1,2.6,2.6,.4),A(10.7,15.1,2.6,2.6,.4),A(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),A(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>z($(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:()=>Z(A(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:()=>z(A(3.5,7.5,17,14.5,2),St(12,7.5,3.1,4.8,-180,0)),bell:()=>z("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",A(1.5,18.2,21,2.6,1.3),A(11.2,6.6,1.6,2.6,0),A(9.8,4.6,4.4,2.4,1.2)),cup:()=>z("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",St(17,10.2,1.7,3.6,-90,90),A(2,20.6,17,2,1),A(7,1.6,1.6,3.4,.8),A(11.6,1.6,1.6,3.4,.8)),card:()=>Z(A(1.5,4.5,21,15,2.5),A(1.5,8,21,3,0),A(4.5,13.6,4.6,3.2,.6)),check:()=>Z($(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:()=>Z($(12,12,10.5),$(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>Z(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]]),A(10,14.5,4,7,[.6,.6,0,0])),pin:()=>Z("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:()=>z(Zt(6,12,18,5,1.8),Zt(6,12,18,19,1.8),$(18,5,3.2),$(6,12,3.2),$(18,19,3.2)),download:()=>z(A(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:()=>Z($(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:Hr,pumpkin:()=>z(At(7.8,14.6,5.8,6.9),At(16.2,14.6,5.8,6.9),At(12,14.6,4.8,7.4),A(10.9,3.4,2.2,4.6,.8),Ze([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>z(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]]),A(10.4,18.6,3.2,3.9,.4)),sparkle:()=>z(q(Yt(9.5,13.5,9,2.4,4)),q(Yt(19,5,4,1.1,4))),gift:()=>z(A(3,11.2,7.8,10.6,1),A(13.2,11.2,7.8,10.6,1),A(2,7.4,8.8,3.2,1),A(13.2,7.4,8.8,3.2,1),At(8.8,4.8,2.9,1.9),At(15.2,4.8,2.9,1.9))};function Xe(t){return Vr[t]()}var Yr={black:[0,0,0],white:[255,255,255],red:[255,0,0],green:[0,128,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],yellow:[255,255,0],orange:[255,165,0],purple:[128,0,128],pink:[255,192,203],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],teal:[0,128,128],aqua:[0,255,255],cyan:[0,255,255],fuchsia:[255,0,255],magenta:[255,0,255]};function We(t,e){let n=t.trim(),r=Number.parseFloat(n);return Number.isNaN(r)?Number.NaN:n.endsWith("%")?r/100*e:r}function wt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=Yr[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let i=e.slice(1);return(i.length===3||i.length===4)&&(i=i.split("").map(c=>c+c).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(i)?{r:Number.parseInt(i.slice(0,2),16),g:Number.parseInt(i.slice(2,4),16),b:Number.parseInt(i.slice(4,6),16),a:i.length===8?Number.parseInt(i.slice(6,8),16)/255:1}:null}let r=/^rgba?\(([^)]*)\)$/.exec(e);if(r){let[i,c]=r[1].split("/"),s=i.split(/[\s,]+/).filter(Boolean);if(s.length!==(c===void 0&&s.length===4?4:3))return null;let o=c??s[3],[a,l,u]=s.slice(0,3).map(f=>We(f,255)),m=o===void 0?1:We(o,1);if([a,l,u,m].some(f=>Number.isNaN(f)))return null;let p=(f,y)=>Math.min(Math.max(f,0),y);return{r:p(a,255),g:p(l,255),b:p(u,255),a:p(m,1)}}return null}function Ke(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Se(t){let e=0;for(let n of t)e+=Ke(n);return Math.max(e,1)}var xe=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function Xt(t,e,n){let r=wt(t)??{r:0,g:0,b:0,a:1},i=wt(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${xe(r.r+(i.r-r.r)*c)}${xe(r.g+(i.g-r.g)*c)}${xe(r.b+(i.b-r.b)*c)}`}function Je(t,e,n,r,i,c,s,o){let a=[...t],l=i*.08,u=a.map(h=>Ke(h)*i),m=u.reduce((h,g)=>h+g,0)+l*Math.max(0,a.length-1),p=c==="top"?r-i*.35:r+i*.35,f=[],y=0;return a.forEach((h,g)=>{let x=u[g],d=(y+x/2)/p;if(y+=x+l,h.trim()==="")return;let C=c==="top"?-Math.PI/2-m/2/p+d:Math.PI/2+m/2/p-d;f.push({text:h,x:e+p*Math.cos(C),y:n+p*Math.sin(C),fontSize:i,maxWidth:i*2,color:s,rotate:C*180/Math.PI+(c==="top"?90:-90),field:o})}),f}function Lt(t,e="#000000"){return t?typeof t=="string"?t:t.type==="solid"?t.color:t.type==="image"?t.underlay||e:(t.type==="linear"||t.type==="radial"||t.type==="angular")&&t.stops[0]?.color||e:e}var Wt=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},tn=new WeakMap;function Me(t){if(t&&typeof t=="object"){let n=tn.get(t);if(n)return n}if(t==null)throw new Wt(['A "custom" frame needs a spec']);let e=ye.safeParse(t);if(!e.success)throw new Wt(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&tn.set(t,e.data),e.data}var jr=t=>{let e=wt(t);return!!(e&&e.a>=1)};function Zr(t,e){let n=Lt(e,et);return jr(n)?{color:n,plate:!0}:t.qr.plate==="background"?{color:n,plate:!1}:{color:et,plate:!0}}function nn(t,e,n=et){let r=e.color||t.colors.frame,i=e.secondaryColor||t.colors.accent||r,c=a=>a==="frame"?r:a==="accent"?i:a==="background"?n:a,s=t.colors.text,o=e.textColor||(s===void 0?r:typeof s=="string"?s:Xt(c(s.mix[0]),c(s.mix[1]),s.amount));return{frame:r,text:o,accent:i}}function Xr(t,e,n){let r=nn(e,t,n),i=c=>{switch(c){case"frame":return r.frame;case"text":return r.text;case"accent":return r.accent;case"background":return n;default:return c}};return c=>typeof c=="string"?i(c):Xt(i(c.mix[0]),i(c.mix[1]),c.amount)}function en(t,e,n=0,r=0){let i=Ct(t);return i?ae(i,e,n,r):""}function Wr(t,e,n,r){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function Kr(t,e){let[n,r,i,c]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],s=Math.hypot(i-n,c-r),o=t.width*e/2,a=s>0?(i-n)/s:1,l=s>0?(c-r)/s:0,u=-l*o,m=a*o,p=(g,x)=>{let d=[n+a*g,r+l*g],C=[n+a*x,r+l*x];if(t.cap==="round"&&x-g>2*o){let M=[d[0]+a*o,d[1]+l*o],F=[C[0]-a*o,C[1]-l*o];return`M${b(M[0]-u)} ${b(M[1]-m)}L${b(F[0]-u)} ${b(F[1]-m)}A${b(o)} ${b(o)} 0 0 1 ${b(F[0]+u)} ${b(F[1]+m)}L${b(M[0]+u)} ${b(M[1]+m)}A${b(o)} ${b(o)} 0 0 1 ${b(M[0]-u)} ${b(M[1]-m)}Z`}return`M${b(d[0]-u)} ${b(d[1]-m)}L${b(C[0]-u)} ${b(C[1]-m)}L${b(C[0]+u)} ${b(C[1]+m)}L${b(d[0]+u)} ${b(d[1]+m)}Z`};if(!t.dash)return{type:"path",d:p(0,s),fillRule:"nonzero"};let f=t.dash[0]*e,y=f+t.dash[1]*e,h=[];for(let g=0;g+f<=s+1e-6;g+=y)h.push(p(g,g+f));return{type:"path",d:h.join(""),fillRule:"nonzero"}}function Jr(t,e){switch(t.type){case"rect":return{type:"rect",x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,radius:(t.radius??0)*e,...t.hole&&{hole:{x:t.hole.x*e,y:t.hole.y*e,width:t.hole.width*e,height:t.hole.height*e,radius:(t.hole.radius??0)*e}}};case"circle":return{type:"path",d:$(t.cx*e,t.cy*e,t.r*e)+(t.hole?$(t.cx*e,t.cy*e,t.hole*e):""),fillRule:t.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:Wr(t.cx*e,t.cy*e,t.rx*e,t.ry*e),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:t.points.map(([n,r])=>[n*e,r*e])};case"path":return{type:"path",d:en(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return Kr(t,e);default:{let n=Xe(t.icon);return{type:"path",d:en(n.d,t.size*e/je,t.x*e,t.y*e),fillRule:n.fillRule}}}}function to(t){if(t.type==="rect"){let{x:e,y:n,width:r,height:i,radius:c,hole:s}=t;return[...le(e,n,r,i,c,c),...s?le(s.x,s.y,s.width,s.height,s.radius,s.radius):[]]}return t.type==="polygon"?[...t.points.map(([e,n],r)=>r===0?{op:"M",x:e,y:n}:{op:"L",x:e,y:n}),{op:"Z"}]:Qt(t.d)}function eo(t,e,n){let r=to(t),i=ke(r,.2),c=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",s=e.direction==="vertical",o=g=>s?g[1]:g[0],a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let g of i)for(let x of g)a=Math.min(a,o(x)),l=Math.max(l,o(x));if(!(l>a))return[];let u=e.steps??32,m=n(e.from),p=n(e.to),f=l-a,y=f*.002,h=[];for(let g=0;g<u;g++){let x=a+f*g/u,d=Math.min(l,a+f*(g+1)/u+(g+1<u?y:0)),C=s?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:x,y1:d}:{x0:x,x1:d,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},M=i.map(F=>Gt(F,C)).filter(F=>F.length>2);M.length!==0&&h.push({type:"path",d:ze(M),fill:Xt(m,p,(g+.5)/u),fillRule:c})}return h}function no(t,e,n){let r=Jr(t,e);return typeof t.fill=="object"&&"gradient"in t.fill?eo(r,t.fill.gradient,n):[{...r,fill:n(t.fill)}]}function ro(t,e){let n=Math.min(t.maxLength??O.maxTextLength,O.maxTextLength),r=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return pe(r,n)}function oo(t){return t===void 0||!Number.isFinite(t)?1:Math.min(xt,Math.max(re,t))}function io(t,e,n,r,i,c){let s=i(t.color),o=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:h,cy:g,radius:x,side:d,spread:C=140}=t.curve,M=x*r*(C*Math.PI/180),F=Math.min(t.fontSize*r*n,M/(Se(e)+.08*e.length));return Je(e,h*r,g*r,x*r,F,d,s,c).map(P=>({...P,...o}))}let a=t.box.x*r,l=t.box.y*r,u=t.box.width*r,m=t.box.height*r;if(!(m>0))return[];let p=(t.fontSize??t.box.height*he)*r,f=Math.min(p*n,m*Ht,u/Se(e)),y=t.align??"middle";return[{text:e,x:y==="start"?a:y==="end"?a+u:a+u/2,y:l+m/2+f*.35,fontSize:f,maxWidth:u,color:s,...y!=="middle"&&{align:y},...o,field:c}]}function ao(t){let e=0,n=0,r=0,i=0;return t.map(({command:c,values:s})=>{let o=c.toUpperCase(),a=c!==o;switch(o){case"Z":return e=r,n=i,{command:"Z",values:[]};case"H":return e=(a?e:0)+s[0],{command:"H",values:[e]};case"V":return n=(a?n:0)+s[0],{command:"V",values:[n]};case"A":return e=(a?e:0)+s[5],n=(a?n:0)+s[6],{command:"A",values:[...s.slice(0,5),e,n]};default:{let l=s.map((u,m)=>a?u+(m%2===0?e:n):u);return e=l.at(-2),n=l.at(-1),o==="M"&&(r=e,i=n),{command:o,values:l}}}})}function so(t,e){let n=Ct(t);return n?ae(ao(n).map(({command:r,values:i})=>r==="V"?{command:r,values:[e(i[0])]}:r==="H"||r==="Z"?{command:r,values:i}:r==="A"?{command:r,values:[...i.slice(0,6),e(i[6])]}:{command:r,values:i.map((c,s)=>s%2===1?e(c):c)})):t}function lo(t,e){let n=(r,i)=>{let c=e(r);return{y:c,height:e(r+i)-c}};switch(t.type){case"rect":return{...t,...n(t.y,t.height),...t.hole&&{hole:{...t.hole,...n(t.hole.y,t.hole.height)}}};case"circle":case"ellipse":return{...t,cy:e(t.cy)};case"polygon":return{...t,points:t.points.map(([r,i])=>[r,e(i)])};case"path":return{...t,d:so(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function co(t,e){if(e.length===0)return t;let n=i=>{let c=i;for(let s of e)c-=Math.min(Math.max(i-s.y,0),s.height);return c},r=(i,c)=>e.some(s=>i>=s.y-1e-6&&c<=s.y+s.height+1e-6);return{...t,artboard:{...t.artboard,height:n(t.artboard.height)},qr:{...t.qr,y:n(t.qr.y)},shapes:t.shapes.filter(i=>{let{bounds:c}=ge(i);return!(c&&r(c.y0,c.y1))}).map(i=>lo(i,n)),labels:t.labels.map(i=>{if(i.type==="curved")return{...i,curve:{...i.curve,cy:n(i.curve.cy)}};let c=n(i.box.y);return{...i,box:{...i.box,y:c,height:n(i.box.y+i.box.height)-c}}})}}function Ee(t,e,n,r,i={}){let c=new Map(e.labels.map(g=>[g.id,ro(g,n)])),s=co(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),o=t/s.qr.size,a=Zr(s,r),l=Xr(n,s,a.color),u=s.shapes.flatMap(g=>no(g,o,l));if(a.plate){let g=Vt(s)*o;u.push({type:"rect",x:s.qr.x*o-g,y:s.qr.y*o-g,width:t+2*g,height:t+2*g,radius:(s.qr.radius??0)*o,fill:a.color})}let m=oo(n.fontScale),p=s.labels.flatMap(g=>{let x=c.get(g.id);if(!x)return[];let d=(g.slot==="fixed"?void 0:i[g.slot])??g.id;return io(g,x,m,o,l,d)}),f=p[0],y=f&&f.rotate===void 0?f:null,h=s.bleed??"none";return{width:s.artboard.width*o,height:s.artboard.height*o,qrX:s.qr.x*o,qrY:s.qr.y*o,qrSize:t,shapes:u,label:y,extraLabels:y?p.slice(1):p,squareEdges:h!=="none",color:l(h==="none"?"frame":h)}}function rn(t,e,n){return Ee(t,Me(e.spec),e,n)}var on={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 Fe={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 an={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 sn={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 ln={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 cn={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 un={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 mn={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 pn={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 Kt={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 dn={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 fn={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 hn={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 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,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 yn={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 bn={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 xn={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 Sn={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 Mn={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=(t,e,n,r,i)=>({style:t,name:e,tags:i,labelOn:r,spec:n}),En=[T("banner-bottom","Banner",Fe,"frame",["bottom","band"]),T("banner-top","Top banner",an,"frame",["top","band"]),T("banner-top-bottom","Two banners",sn,"frame",["top","bottom","band"]),T("border","Border",ln,"background",["square","outline"]),T("rounded-border","Rounded",gn,"background",["border","outline"]),T("gradient-border","Gradient",Kt,"background",["border","colorful"]),T("focus","Focus",pn,"background",["corners","brackets"]),T("speech-bubble","Bubble",yn,"frame",["speech"]),T("speech-bubble-top","Bubble top",bn,"frame",["speech"]),T("chat-bubble","Chat",cn,"frame",["message","bubble"]),T("circle","Circle",un,"frame",["round","ring","curved"]),T("badge","Ribbon",on,"frame",["badge","banner"]),T("sticker","Sticker",xn,"frame",["label"]),T("polaroid","Polaroid",hn,"frame",["photo","picture"]),T("phone","Phone",fn,"background",["mobile","screen"]),T("ticket","Ticket",Mn,"frame",["event","pass"]),T("tag","Tag",Sn,"frame",["price","label"]),T("envelope","Envelope",mn,"frame",["mail","letter"]),T("menu-card","Menu card",dn,"background",["menu","restaurant"])],Io=new Map(En.map(t=>[t.style,t]));function vo(t){return Io.get(t)}var ms=Object.fromEntries(En.map(t=>[t.style,t.spec])),ps={from:Kt.colors.frame,to:Kt.colors.accent};var _o={primary:"text",secondary:"secondaryText"};function Fn(t,e,n){let r=vo(e.style)?.spec??Fe;return Ee(t,Me(r),e,n,_o)}var $o="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function Rn(t){return!!(t?.style&&t.style!=="none")}function An(t,e,n){return e.style===me?rn(t,e,n):Fn(t,e,n)}function To(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function wn(t,e){let n=({x:r,y:i,width:c,height:s,radius:o})=>{let a=Math.min(o,c/2,s/2);t.moveTo(r+a,i),t.arcTo(r+c,i,r+c,i+s,a),t.arcTo(r+c,i+s,r,i+s,a),t.arcTo(r,i+s,r,i,a),t.arcTo(r,i,r+c,i,a),t.closePath()};for(let r of e.shapes)if(!(r.fill==="transparent"||r.fill==="none")){if(t.fillStyle=r.fill,r.type==="path"){typeof Path2D<"u"&&t.fill(new Path2D(r.d),r.fillRule??"nonzero");continue}t.beginPath(),r.type==="polygon"?(r.points.forEach(([i,c],s)=>{s===0?t.moveTo(i,c):t.lineTo(i,c)}),t.closePath(),t.fill()):(n(r),r.hole&&n(r.hole),t.fill("evenodd"))}for(let r of To(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${$o}`,t.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",t.textBaseline="alphabetic",r.rotate?(t.save(),t.translate(r.x,r.y),t.rotate(r.rotate*Math.PI/180),t.fillText(r.text,0,0,r.maxWidth),t.restore()):t.fillText(r.text,r.x,r.y,r.maxWidth)}var No=.22,Oo=.14;function ko(t,e){let n=t.w*e,r=t.h*e;return{x:t.x+n,y:t.y+r,w:t.w-2*n,h:t.h-2*r}}function Ce(t,e,n){if(t.beginPath(),e==="circle"){t.arc(n.x+n.w/2,n.y+n.h/2,Math.min(n.w,n.h)/2,0,Math.PI*2);return}let r=e==="rounded"?Math.min(n.w,n.h)*No:0;r>0&&typeof t.roundRect=="function"?t.roundRect(n.x,n.y,n.w,n.h,r):t.rect(n.x,n.y,n.w,n.h)}function Ln(t,e){return e?ko(t,Oo):t}var{QrCode:Pe}=Q,zo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function Bo(t){let e=t*4+17,n=new Uint8Array(e*e),r=(s,o)=>{s>=0&&o>=0&&s<e&&o<e&&(n[o*e+s]=1)};for(let s=0;s<e;s++)r(6,s),r(s,6);for(let[s,o]of[[3,3],[e-4,3],[3,e-4]])for(let a=-4;a<=4;a++)for(let l=-4;l<=4;l++)r(s+l,o+a);let i=[];if(t>1){let s=Math.floor(t/7)+2,o=t===32?26:Math.ceil((t*4+4)/(s*2-2))*2;i.push(6);for(let a=e-7;i.length<s;a-=o)i.splice(1,0,a)}let c=i.length-1;for(let[s,o]of i.entries())for(let[a,l]of i.entries())if(!(s===0&&a===0||s===0&&a===c||s===c&&a===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)r(o+m,l+u);for(let s=0;s<=8;s++)r(8,s),r(s,8);for(let s=0;s<8;s++)r(e-1-s,8),r(8,e-1-s);if(t>=7)for(let s=0;s<18;s++){let o=e-11+s%3,a=Math.floor(s/3);r(o,a),r(a,o)}return n}function qo(t,e){let n=t*4+17,r=tt[e].ordinal,i=Pe.NUM_ERROR_CORRECTION_BLOCKS[r]?.[t]??0,c=Pe.ECC_CODEWORDS_PER_BLOCK[r]?.[t]??0,s=Math.floor(Pe.getNumRawDataModules(t)/8),o=i-s%i,a=Math.floor(s/i),l=Array.from({length:i},(M,F)=>a+(F<o?0:1)),u=[],m=[],p=a-c;for(let M=0;M<=a;M++)for(let F=0;F<i;F++)if(F<o){if(M===p)continue;u.push(F),m.push(M<p?M:M-1)}else u.push(F),m.push(M);if(u.length!==s)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let f=Bo(t),y=new Int16Array(n*n).fill(-1),h=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),x=s*8,d=0;for(let M=n-1;M>=1;M-=2){M===6&&(M=5);let F=(M+1&2)===0;for(let P=0;P<n;P++)for(let E=0;E<2;E++){let I=M-E,N=(F?n-1-P:P)*n+I;if(!f[N]&&d<x){let B=d>>>3;y[N]=u[B],h[N]=m[B],g[N]=7-(d&7),d++}}}if(d!==x)throw new Error(`Codeword map: placement mismatch at version ${t}`);let C=zo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:i,eccPerBlock:c,blockLengths:l,correctable:Math.floor((c-C)/2),block:y,codeword:h,bit:g}}var Do=8,ct=new Map;function In(t,e){if(!(Number.isInteger(t)&&t>=1&&t<=40))throw new RangeError(`QR version must be 1\u201340, got ${t}`);let n=`${t}${e}`,r=ct.get(n);if(r)return ct.delete(n),ct.set(n,r),r;let i=qo(t,e);if(ct.size>=Do){let c=ct.keys().next().value;c!==void 0&&ct.delete(c)}return ct.set(n,i),i}function vn(t,e){let n=new Array(t.blocks).fill(0),r=new Set;for(let i of e){let c=t.block[i]??-1;if(c<0)continue;let s=c*4096+t.codeword[i];r.has(s)||(r.add(s),n[c]=n[c]+1)}return n}import{z as R}from"zod";import{z as X}from"zod";var Go=["logo","halftone"],Qo=X.enum(Go),_n={logo:["blend","badge"],halftone:["color","mono"]},Uo=X.enum([..._n.logo,..._n.halftone]),Jt=192,$n=t=>Math.ceil(t/3)*4,Ho=X.object({width:X.number().int().min(1).max(Jt),height:X.number().int().min(1).max(Jt),data:X.string().max($n(Jt*Jt*4))}).refine(t=>t.data.length===$n(t.width*t.height*4),{message:"Art image data does not match its width and height"}),Tn=X.object({mode:Qo,image:Ho,intensity:X.number().min(0).max(1).optional(),variant:Uo.optional(),matchEyes:X.boolean().optional()});import{z as L}from"zod";var Ls=L.enum(["solid","linear","radial","angular","image"]),Vo=L.object({type:L.literal("solid"),color:L.string()}),Re=L.object({color:L.string(),offset:L.number().min(0).max(100)}),Yo=L.object({type:L.literal("linear"),stops:L.array(Re).min(2),angle:L.number().optional().default(0)}),jo=L.object({type:L.literal("radial"),stops:L.array(Re).min(2)}),Zo=L.object({type:L.literal("angular"),stops:L.array(Re).min(2),angle:L.number().optional().default(0)}),Xo=L.enum(["cover","contain","tile"]),Wo=L.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),Ko=L.object({type:L.literal("image"),src:L.string().min(1),fit:Xo.optional().default("cover"),scale:L.number().min(.1).max(4).optional().default(1),position:Wo.optional().default("center"),opacity:L.number().min(0).max(1).optional().default(1),underlay:L.string().optional()}),ut=L.union([L.string(),Vo,Yo,jo,Zo,Ko]);import{z as Nn}from"zod";var On=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Jo=["diamond","star","banner"],kn=Nn.enum([...On,...Jo]),_s=Nn.enum(On);import{z as zn}from"zod";var Bn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ti=["curly"],qn=zn.enum([...Bn,...ti]),Ns=zn.enum(Bn);import{z as ei}from"zod";var ni=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Dn=ei.enum(ni);var ri=["square","rounded","circle"],Gn=R.enum(ri),oi=R.object({src:R.string(),height:R.number(),width:R.number(),excavate:R.boolean(),x:R.number().optional(),y:R.number().optional(),padding:R.number().min(0).optional(),shape:Gn.optional(),plate:R.string().optional()}),ii=.1,ai=.3;var si=2,Vs=R.object({size:R.number().min(ii).max(ai).optional(),padding:R.number().min(0).max(si).optional(),x:R.number().min(0).max(1).optional(),y:R.number().min(0).max(1).optional(),shape:Gn.optional(),plate:R.string().optional()}),li=R.enum(["L","M","Q","H"]),ci=.5,ui=1,Qn=.07,mi=["square","circle","heart"],pi=R.enum(mi),Un=3,mt=64,It=8,Hn=.42,di=R.object({type:R.literal("silhouette"),width:R.number().int().min(It).max(mt),height:R.number().int().min(It).max(mt),cells:R.string().max(mt*mt).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(t=>t.cells.length===t.width*t.height,{message:"Silhouette cells do not match its width and height"}),fi=R.union([pi,di]);var Ae=R.object({outer:ut.optional(),inner:ut.optional()}),hi=R.object({topLeft:Ae.optional(),topRight:Ae.optional(),bottomLeft:Ae.optional()}),Ys=R.object({value:R.string(),size:R.number().optional(),level:li.optional(),bgColor:ut.optional(),fgColor:ut.optional(),eyeColor:ut.optional(),dotColor:ut.optional(),bodyPattern:Dn.optional(),cornerEyePattern:qn.optional(),cornerEyeDotPattern:kn.optional(),margin:R.number().optional(),imageSettings:oi.optional(),isOGContext:R.boolean().optional(),templateId:R.string().optional(),customProps:R.record(R.string(),R.any()).optional(),frame:Ve.optional(),art:Tn.optional(),eyeColors:hi.optional(),moduleScale:R.number().min(ci).max(ui).optional(),autoLevel:R.boolean().optional(),shape:fi.optional()});var gi={2:6,3:12};function Vn(t){let e=[t.start],n=t.start;for(let r of t.segments){let i=r.at(-1);if(r.length===1)e.push(i);else{let c=gi[r.length];for(let s=1;s<=c;s++){let o=s/c,a=1-o;if(r.length===2){let[l]=r;e.push([a*a*n[0]+2*a*o*l[0]+o*o*i[0],a*a*n[1]+2*a*o*l[1]+o*o*i[1]])}else{let[l,u]=r;e.push([a*a*a*n[0]+3*a*a*o*l[0]+3*a*o*o*u[0]+o*o*o*i[0],a*a*a*n[1]+3*a*a*o*l[1]+3*a*o*o*u[1]+o*o*o*i[1]])}}}n=i}return e}function jn(t,e){let n=[];for(let r of t)for(let i=0;i<r.length;i++){let[c,s]=r[i],[o,a]=r[(i+1)%r.length];s<=e!=a<=e&&n.push(c+(e-s)/(a-s)*(o-c))}return n.sort((r,i)=>r-i)}function Zn(t,e){let n=0;for(let r of t)if(r<e)n++;else break;return n%2===1}function yi(t,e,n){return Zn(jn(t,n),e)}function Xn(t){let e=new Map;return(n,r)=>{let i=e.get(r);return i||(i=jn(t,r),e.set(r,i)),Zn(i,n)}}function bi(t,e,n,r){let i=n[0]-t,c=n[1]-e,s=r[0]-n[0],o=r[1]-n[1],a=u=>Math.max(Math.abs(i+u*s),Math.abs(c+u*o)),l=Math.min(a(0),a(1));for(let[u,m]of[[c-i,s-o],[-(i+c),s+o]])if(m!==0){let p=u/m;p>0&&p<1&&(l=Math.min(l,a(p)))}return l}function xi(t,e,n){if(!yi(t,e,n))return 0;let r=Number.POSITIVE_INFINITY;for(let i of t)for(let c=0;c<i.length;c++)r=Math.min(r,bi(e,n,i[c],i[(c+1)%i.length]));return Number.isFinite(r)?r:0}function Si(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(let c of t)for(let[s,o]of c)e=Math.min(e,s),n=Math.min(n,o),r=Math.max(r,s),i=Math.max(i,o);return{x0:e,y0:n,x1:r,y1:i}}function Wn(t){let e=t.map(Vn),n=Si(e),r=n.x1-n.x0,i=n.y1-n.y0;if(!(r>0&&i>0))return null;let c=(y,h)=>{let g=Math.max(y-n.x0,n.x1-y,h-n.y0,n.y1-h);return g>0?xi(e,y,h)/(2*g):0},s={cx:n.x0+r/2,cy:n.y0+i/2,value:0};s.value=c(s.cx,s.cy);let o=32;for(let y=1;y<o;y++)for(let h=1;h<o;h++){let g=n.x0+r*h/o,x=n.y0+i*y/o,d=c(g,x);d>s.value&&(s={cx:g,cy:x,value:d})}let a=r/o,l=i/o;for(let y=0;y<6;y++){let h=s;for(let g=-2;g<=2;g++)for(let x=-2;x<=2;x++){let d=h.cx+a*x/2,C=h.cy+l*g/2,M=c(d,C);M>s.value&&(s={cx:d,cy:C,value:M})}a/=2,l/=2}if(s.value<=0)return null;let m=.5/Math.max(s.cx-n.x0,n.x1-s.cx,s.cy-n.y0,n.y1-s.cy),p=([y,h])=>[.5+(y-s.cx)*m,.5+(h-s.cy)*m],f=t.map(y=>({start:p(y.start),segments:y.segments.map(h=>h.map(p))}));return{rings:f,polygons:f.map(Vn),half:s.value}}function Kn(t,e){let n=([i,c])=>`${b(i*e)} ${b(c*e)}`,r="";for(let i of t.rings){r+=`M${n(i.start)}`;for(let c of i.segments){let s=c.length===1?"L":c.length===2?"Q":"C";r+=s+c.map(n).join(" ")}r+="Z"}return r}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]]]},Yn;function Jn(){return Yn??=Wn([Mi]),Yn}function Ei(t){let{width:e,height:n,cells:r}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=It&&n>=It&&e<=mt&&n<=mt&&typeof r=="string"&&r.length===e*n&&/^[01]*$/.test(r)?(i,c)=>i>=0&&c>=0&&i<e&&c<n&&r[c*e+i]==="1":null}var W=([t,e])=>`${t},${e}`;function Fi(t,e,n){let r=(a,l)=>t(a-1,l-1),i=new Map,c=(a,l)=>{for(let[u,m]of[[a,l],[l,a]]){let p=i.get(W(u))??[];p.push(m),i.set(W(u),p)}};for(let a=0;a<=n;a++)for(let l=0;l<=e;l++){let u=r(l,a),m=r(l+1,a),p=r(l+1,a+1),f=r(l,a+1),y=[l,a-.5],h=[l+.5,a],g=[l,a+.5],x=[l-.5,a];switch((u?8:0)+(m?4:0)+(p?2:0)+(f?1:0)){case 1:case 14:c(x,g);break;case 2:case 13:c(g,h);break;case 3:case 12:c(x,h);break;case 4:case 11:c(y,h);break;case 6:case 9:c(y,g);break;case 7:case 8:c(x,y);break;case 5:c(y,h),c(x,g);break;case 10:c(x,y),c(g,h);break;default:break}}let s=[],o=new Set;for(let[a,l]of i){if(o.has(a)||l.length===0)continue;let[u,m]=a.split(",").map(Number),p=[[u,m]];o.add(a);let f=[u,m],y=l[0];for(;!o.has(W(y));){o.add(W(y)),p.push(y);let h=Ci(i.get(W(y))??[],f,o);if(!h)break;f=y,y=h}p.length>=3&&s.push(Pi(p))}return s}function Ci(t,e,n){let r=W(e);return t.find(i=>W(i)!==r&&!n.has(W(i)))??t.find(i=>W(i)!==r)}function Pi(t){let e=[];for(let n=0;n<t.length;n++){let r=t[(n-1+t.length)%t.length],i=t[n],c=t[(n+1)%t.length],s=(i[0]-r[0])*(c[1]-i[1])-(i[1]-r[1])*(c[0]-i[0]);Math.abs(s)>1e-9&&e.push(i)}return e.length>=3?e:t}function Ri(t){let e=(c,s)=>[(c[0]+s[0])/2,(c[1]+s[1])/2],n=t.length,r=e(t[n-1],t[0]),i=t.map((c,s)=>[c,e(c,t[(s+1)%n])]);return{start:r,segments:i}}var vt=new Map;function tr(t){let e=`${t.width}x${t.height}:${t.cells}`,n=vt.get(e);if(n)return n;let r=Ei(t),i;if(!r)i={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=Fi(r,t.width,t.height),s=c.length>0?Wn(c.map(Ri)):null;i=s&&2*s.half>=Hn?{outline:s,problem:null}:{outline:null,problem:s?"thin":"empty"}}else i={outline:null,problem:"empty"};return vt.size>16&&vt.delete(vt.keys().next().value),vt.set(e,i),i}var Ai=1,er=.5,nr=.5,wi=.5;function te(t){return Math.max(t,Un)}function we(t){return t==="heart"?Jn():typeof t=="object"&&t?.type==="silhouette"?tr(t).outline:null}function ot(t,e,n){if(n==="circle"){let s=te(e),o=(t/2+s)*Math.SQRT2+Ai;return Math.ceil(o-t/2)}let r=we(n);if(!r)return e;let i=te(e),c=(t+2*(i+wi))/(2*r.half);return Math.ceil((c-t)/2-1e-9)}function rr(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function Li(t,e,n){let r=ot(e,n,"circle"),i=te(n),c=e+2*r,s=c/2,o=s-er-.5,a=rr(Number.parseInt(be(t),36)||1),l=r-i,u=r+e+i;return Array.from({length:c},(m,p)=>Array.from({length:c},(f,y)=>{let h=a()<nr;return y>=l&&y<u&&p>=l&&p<u?!1:h&&Math.hypot(y+.5-s,p+.5-s)<=o}))}var Ii=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Le(t,e,n,r){if(r==="circle")return Li(t,e,n);let i=we(r);if(!i)return null;let c=ot(e,n,r),s=te(n),o=e+2*c,a=Xn(i.polygons),l=.5+er,u=(y,h)=>{let g=y+.5,x=h+.5;return a(g/o,x/o)?Ii.every(([d,C])=>a((g+d*l)/o,(x+C*l)/o)):!1},m=rr(Number.parseInt(be(t),36)||1),p=c-s,f=c+e+s;return Array.from({length:o},(y,h)=>Array.from({length:o},(g,x)=>{let d=m()<nr;return x>=p&&x<f&&h>=p&&h<f?!1:d&&u(x,h)}))}function Ie(t,e){if(t==="circle")return{circle:e/2};let n=we(t);return n?{path:Kn(n,e)}:null}function or(t,e){return t.slice().map((n,r)=>r<e.y||r>=e.y+e.h?n:n.map((i,c)=>c<e.x||c>=e.x+e.w?i:!1))}function ve(t,e=0){let n=[];return t.forEach((r,i)=>{let c=null;r.forEach((s,o)=>{if(!s&&c!==null){n.push(Dt`M${c+e} ${i+e}h${o-c}v1H${c+e}z`),c=null;return}if(o===r.length-1){if(!s)return;c===null?n.push(Dt`M${o+e},${i+e} h1v1H${o+e}z`):n.push(Dt`M${c+e},${i+e} h${o+1-c}v1H${c+e}z`);return}s&&c===null&&(c=o)})}),n.join("")}function _t(t,e,n,r){if(r==null)return null;let i=t.length,c=Math.floor(e*qt),s=(i+2*n)/e,o=(r.width||c)*s,a=(r.height||c)*s,l=r.x==null?i/2-o/2:r.x*s,u=r.y==null?i/2-a/2:r.y*s,m=null;if(r.excavate){let p=Math.max(0,r.padding??0)*s,f=Math.floor(l-p),y=Math.floor(u-p),h=Math.ceil(o+l+p-f),g=Math.ceil(a+u+p-y);m={x:f,y,w:h,h:g}}return{x:l,y:u,h:a,w:o,excavation:m}}function ee(t){let e=t.level??yt,{imageSettings:n}=t,r=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&r!=="H"){let i=Q.QrCode.encodeText(t.value,tt[r]).getModules(),c=_t(i,t.size??kt,ot(i.length,t.margin??Bt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(i.length*i.length)>Qn&&(r="H")}return r}var _e=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var vi=.6,_i=["L","M","Q","H"];function $i(t){let e=Q.QrCode.encodeText(t.value,tt[t.level]),n=_i[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:ot(e.size,t.margin,t.shape),map:In(e.version,n),level:n,version:e.version}}function Ti(t,e){let{cells:n,map:r}=t,i=n.length,c=_t(n,t.code.size,t.layoutMargin,e);if(!c)return null;let s=c.excavation??{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.ceil(c.x+c.w)-Math.floor(c.x),h:Math.ceil(c.y+c.h)-Math.floor(c.y)},o=[];for(let l=Math.max(0,s.y);l<Math.min(i,s.y+s.h);l++)for(let u=Math.max(0,s.x);u<Math.min(i,s.x+s.w);u++)o.push(l*i+u);let a=vn(r,o);return{worst:Math.max(0,...a),correctable:r.correctable,budget:Math.floor(r.correctable*vi),level:t.level,version:t.version}}var Ni=t=>!t||t.worst<=t.budget;function Oi(t,e,n,r){let i=e.map(o=>$i({...t,level:o})),c=o=>{let a=r(o);return i.every(l=>Ni(Ti(l,a)))};if(c(n))return n;let s=t.size*.005;for(let o=n-s;o>0;o-=s)if(c(o))return o;return 0}function ir(t,e){if(!e)return;let n=Math.floor(t.size*qt),r=e.width||n,i=e.height||n,c=p=>{if(p===r)return e;let f=i*p/r;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(r-p)/2},...e.y!=null&&{y:e.y+(i-f)/2}}},s=t.level??yt,o={value:t.value,size:t.size,margin:t.margin,shape:t.shape},a=p=>ee({...t,level:s,imageSettings:p}),l=p=>{let f=Oi(o,[p],r,c);return f>0?c(f):void 0},u=a(e);if(u===s)return l(s);let m=l(u);return m&&a(m)===u?m:l(s)}import{Fragment as Bi,jsx as sr,jsxs as qi}from"react/jsx-runtime";function Rl(t){let{value:e,size:n=kt,level:r=yt,bgColor:i=et,fgColor:c=zt,margin:s=Bt,style:o,imageSettings:a,eyeColor:l,dotColor:u,bodyPattern:m,cornerEyePattern:p,cornerEyeDotPattern:f,isOGContext:y,templateId:h,customTemplate:g,customProps:x,frame:d,art:C,eyeColors:M,moduleScale:F,frameLabelMarkers:P,partMarkers:E,autoLevel:I,shape:w,...N}=t,B=ir({value:e,size:n,margin:s,level:r,shape:w,autoLevel:I},a),H=ee({value:e,size:n,level:r,margin:s,imageSettings:B,autoLevel:I,shape:w}),Y=B?.src,D=Rn(d)?An(n,d,i):null,K=D?.width??n,it=D?.height??n,pt=ar(null),G=ar(null),[U,V]=zi(!1);ki(()=>{if(pt.current!=null){let Mt=pt.current,v=Mt.getContext("2d");if(!v)return;let j=Q.QrCode.encodeText(e,tt[H]).getModules(),J=ot(j.length,s,w),ne=Le(e,j.length,s,w),ft=j.length+J*2,at=_t(j,n,J,B),Tt=G.current,$e=at!=null&&Tt?.complete&&Tt.naturalHeight!==0&&Tt.naturalWidth!==0;$e&&at.excavation!=null&&(j=or(j,at.excavation));let Nt=window.devicePixelRatio||1;Mt.width=K*Nt,Mt.height=it*Nt,v.scale(Nt,Nt),D&&(wn(v,D),v.translate(D.qrX,D.qrY));let Te=n/ft;v.scale(Te,Te),v.fillStyle=Lt(i,et);let Et=Ie(w,ft);if(Et&&"circle"in Et?(v.beginPath(),v.arc(ft/2,ft/2,Et.circle,0,2*Math.PI),v.fill()):Et&&_e?v.fill(new Path2D(Et.path),"evenodd"):v.fillRect(0,0,ft,ft),v.fillStyle=Lt(c,zt),_e)v.fill(new Path2D(ve(j,J))),ne&&v.fill(new Path2D(ve(ne,0)));else for(let[Ot,ht]of[[j,J],[ne??[],0]])Ot.forEach((Ft,st)=>{Ft.forEach((lr,cr)=>{lr&&v.fillRect(cr+ht,st+ht,1,1)})});if($e){let Ot={x:at.x+J,y:at.y+J,w:at.w,h:at.h},ht=B?.shape??"square",Ft=B?.plate,st=Ln(Ot,Ft);v.save(),Ft&&(Ce(v,ht,Ot),v.fillStyle=Ft,v.fill()),ht!=="square"&&(Ce(v,ht,st),v.clip()),v.drawImage(Tt,st.x,st.y,st.w,st.h),v.restore()}}});let dt={height:it,width:K,...o},$t=null;return Y!=null&&($t=sr("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:G,src:Y,style:{display:"none"}},Y)),qi(Bi,{children:[sr("canvas",{height:it,ref:pt,style:dt,width:K,...N}),$t]})}export{Rl as QRCodeCanvas};
|
|
1
|
+
"use client";import{useEffect as Bi,useRef as sr,useState as qi}from"react";var gt;(c=>{class t{constructor(i,a,l,u){this.version=i;this.errorCorrectionLevel=a;if(i<t.MIN_VERSION||i>t.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 f=0;f<this.size;f++)m.push(!1);for(let f=0;f<this.size;f++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(l);if(this.drawCodewords(p),u==-1){let f=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);let h=this.getPenaltyScore();h<f&&(u=y,f=h),this.applyMask(y)}}o(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(i,a){let l=c.QrSegment.makeSegments(i);return t.encodeSegments(l,a)}static encodeBinary(i,a){let l=c.QrSegment.makeBytes(i);return t.encodeSegments([l],a)}static encodeSegments(i,a,l=1,u=40,m=-1,p=!0){if(!(t.MIN_VERSION<=l&&l<=u&&u<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let f,y;for(f=l;;f++){let d=t.getNumDataCodewords(f,a)*8,C=r.getTotalBits(i,f);if(C<=d){y=C;break}if(f>=u)throw new RangeError("Data too long")}for(let d of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&y<=t.getNumDataCodewords(f,d)*8&&(a=d);let h=[];for(let d of i){e(d.mode.modeBits,4,h),e(d.numChars,d.mode.numCharCountBits(f),h);for(let C of d.getData())h.push(C)}o(h.length==y);let g=t.getNumDataCodewords(f,a)*8;o(h.length<=g),e(0,Math.min(4,g-h.length),h),e(0,(8-h.length%8)%8,h),o(h.length%8==0);for(let d=236;h.length<g;d^=253)e(d,8,h);let x=[];for(;x.length*8<h.length;)x.push(0);return h.forEach((d,C)=>x[C>>>3]|=d<<7-(C&7)),new t(f,a,x,m)}size;mask;modules=[];isFunction=[];getModule(i,a){return 0<=i&&i<this.size&&0<=a&&a<this.size&&this.modules[a][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let i=this.getAlignmentPatternPositions(),a=i.length;for(let l=0;l<a;l++)for(let u=0;u<a;u++)l==0&&u==0||l==0&&u==a-1||l==a-1&&u==0||this.drawAlignmentPattern(i[l],i[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){let a=this.errorCorrectionLevel.formatBits<<3|i,l=a;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;let u=(a<<10|l)^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 l=0;l<12;l++)i=i<<1^(i>>>11)*7973;let a=this.version<<12|i;o(a>>>18==0);for(let l=0;l<18;l++){let u=n(a,l),m=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(m,p,u),this.setFunctionModule(p,m,u)}}drawFinderPattern(i,a){for(let l=-4;l<=4;l++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(l)),p=i+u,f=a+l;0<=p&&p<this.size&&0<=f&&f<this.size&&this.setFunctionModule(p,f,m!=2&&m!=4)}}drawAlignmentPattern(i,a){for(let l=-2;l<=2;l++)for(let u=-2;u<=2;u++)this.setFunctionModule(i+u,a+l,Math.max(Math.abs(u),Math.abs(l))!=1)}setFunctionModule(i,a,l){this.modules[a][i]=l,this.isFunction[a][i]=!0}addEccAndInterleave(i){let a=this.version,l=this.errorCorrectionLevel;if(i.length!=t.getNumDataCodewords(a,l))throw new RangeError("Invalid argument");let u=t.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a],m=t.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a],p=Math.floor(t.getNumRawDataModules(a)/8),f=u-p%u,y=Math.floor(p/u),h=[],g=t.reedSolomonComputeDivisor(m);for(let d=0,C=0;d<u;d++){let M=i.slice(C,C+y-m+(d<f?0:1));C+=M.length;let F=t.reedSolomonComputeRemainder(M,g);d<f&&M.push(0),h.push(M.concat(F))}let x=[];for(let d=0;d<h[0].length;d++)h.forEach((C,M)=>{(d!=y-m||M>=f)&&x.push(C[d])});return o(x.length==p),x}drawCodewords(i){if(i.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){let p=l-m,y=(l+1&2)==0?this.size-1-u:u;!this.isFunction[y][p]&&a<i.length*8&&(this.modules[y][p]=n(i[a>>>3],7-(a&7)),a++)}}o(a==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let l=0;l<this.size;l++){let u;switch(i){case 0:u=(l+a)%2==0;break;case 1:u=a%2==0;break;case 2:u=l%3==0;break;case 3:u=(l+a)%3==0;break;case 4:u=(Math.floor(l/3)+Math.floor(a/2))%2==0;break;case 5:u=l*a%2+l*a%3==0;break;case 6:u=(l*a%2+l*a%3)%2==0;break;case 7:u=((l+a)%2+l*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][l]&&u&&(this.modules[a][l]=!this.modules[a][l])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let p=!1,f=0,y=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[m][h]==p?(f++,f==5?i+=t.PENALTY_N1:f>5&&i++):(this.finderPenaltyAddHistory(f,y),p||(i+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[m][h],f=1);i+=this.finderPenaltyTerminateAndCount(p,f,y)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,f=0,y=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][m]==p?(f++,f==5?i+=t.PENALTY_N1:f>5&&i++):(this.finderPenaltyAddHistory(f,y),p||(i+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[h][m],f=1);i+=this.finderPenaltyTerminateAndCount(p,f,y)*t.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){let f=this.modules[m][p];f==this.modules[m][p+1]&&f==this.modules[m+1][p]&&f==this.modules[m+1][p+1]&&(i+=t.PENALTY_N2)}let a=0;for(let m of this.modules)a=m.reduce((p,f)=>p+(f?1:0),a);let l=this.size*this.size,u=Math.ceil(Math.abs(a*20-l*10)/l)-1;return o(0<=u&&u<=9),i+=u*t.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{let i=Math.floor(this.version/7)+2,a=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2,l=[6];for(let u=this.size-7;l.length<i;u-=a)l.splice(1,0,u);return l}}static getNumRawDataModules(i){if(i<t.MIN_VERSION||i>t.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*i+128)*i+64;if(i>=2){let l=Math.floor(i/7)+2;a-=(25*l-10)*l-55,i>=7&&(a-=36)}return o(208<=a&&a<=29648),a}static getNumDataCodewords(i,a){return Math.floor(t.getNumRawDataModules(i)/8)-t.ECC_CODEWORDS_PER_BLOCK[a.ordinal][i]*t.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let a=[];for(let u=0;u<i-1;u++)a.push(0);a.push(1);let l=1;for(let u=0;u<i;u++){for(let m=0;m<a.length;m++)a[m]=t.reedSolomonMultiply(a[m],l),m+1<a.length&&(a[m]^=a[m+1]);l=t.reedSolomonMultiply(l,2)}return a}static reedSolomonComputeRemainder(i,a){let l=a.map(u=>0);for(let u of i){let m=u^l.shift();l.push(0),a.forEach((p,f)=>l[f]^=t.reedSolomonMultiply(p,m))}return l}static reedSolomonMultiply(i,a){if(i>>>8||a>>>8)throw new RangeError("Byte out of range");let l=0;for(let u=7;u>=0;u--)l=l<<1^(l>>>7)*285,l^=(a>>>u&1)*i;return o(l>>>8==0),l}finderPenaltyCountPatterns(i){let a=i[1];o(a<=this.size*3);let l=a>0&&i[2]==a&&i[3]==a*3&&i[4]==a&&i[5]==a;return(l&&i[0]>=a*4&&i[6]>=a?1:0)+(l&&i[6]>=a*4&&i[0]>=a?1:0)}finderPenaltyTerminateAndCount(i,a,l){return i&&(this.finderPenaltyAddHistory(a,l),a=0),a+=this.size,this.finderPenaltyAddHistory(a,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(i,a){a[0]==0&&(i+=this.size),a.pop(),a.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]]}c.QrCode=t;function e(s,i,a){if(i<0||i>31||s>>>i)throw new RangeError("Value out of range");for(let l=i-1;l>=0;l--)a.push(s>>>l&1)}function n(s,i){return(s>>>i&1)!=0}function o(s){if(!s)throw new Error("Assertion error")}class r{constructor(i,a,l){this.mode=i;this.numChars=a;this.bitData=l;if(a<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}mode;numChars;bitData;static makeBytes(i){let a=[];for(let l of i)e(l,8,a);return new r(r.Mode.BYTE,i.length,a)}static makeNumeric(i){if(!r.isNumeric(i))throw new RangeError("String contains non-numeric characters");let a=[];for(let l=0;l<i.length;){let u=Math.min(i.length-l,3);e(parseInt(i.substr(l,u),10),u*3+1,a),l+=u}return new r(r.Mode.NUMERIC,i.length,a)}static makeAlphanumeric(i){if(!r.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],l;for(l=0;l+2<=i.length;l+=2){let u=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l))*45;u+=r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l+1)),e(u,11,a)}return l<i.length&&e(r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l)),6,a),new r(r.Mode.ALPHANUMERIC,i.length,a)}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 a=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)e(i,8,a);else if(i<16384)e(2,2,a),e(i,14,a);else if(i<1e6)e(6,3,a),e(i,21,a);else throw new RangeError("ECI assignment value out of range");return new r(r.Mode.ECI,0,a)}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,a){let l=0;for(let u of i){let m=u.mode.numCharCountBits(a);if(u.numChars>=1<<m)return 1/0;l+=4+m+u.bitData.length}return l}static toUtf8ByteArray(i){i=encodeURI(i);let a=[];for(let l=0;l<i.length;l++)i.charAt(l)!="%"?a.push(i.charCodeAt(l)):(a.push(parseInt(i.substr(l+1,2),16)),l+=2);return a}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}c.QrSegment=r})(gt||={});(e=>{let t;(o=>{class n{constructor(c,s){this.ordinal=c;this.formatBits=s}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})(t=e.QrCode||={})})(gt||={});(e=>{let t;(o=>{class n{constructor(c,s){this.modeBits=c;this.numBitsCharCount=s}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(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}o.Mode=n})(t=e.QrSegment||={})})(gt||={});var Q=gt;var tt={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},zt=128,yt="Q",et="#FFFFFF",Bt="#000000";var qt=0;var Dt=.1;import{z as nt}from"zod";var mr=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],bt=24;var oe=.5,xt=1.5,pr=nt.enum(mr),ie=nt.object({style:pr,text:nt.string().max(bt).optional(),color:nt.string().optional(),textColor:nt.string().optional(),secondaryText:nt.string().max(bt).optional(),secondaryColor:nt.string().optional(),fontScale:nt.number().min(oe).max(xt).optional()});import{z as S}from"zod";function dr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function b(t,e=3){return String(dr(t,e))}function Gt(t,...e){let n=t[0]??"";for(let o=0;o<e.length;o++){let r=e[o];n+=(typeof r=="number"?b(r):r)+(t[o+1]??"")}return n}var fr={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},hr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,ae=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Pt(t,e=Number.POSITIVE_INFINITY){if(!hr.test(t))return null;let n=[],o=0,r=()=>{for(;o<t.length&&/[\s,]/.test(t[o]);)o++},c=()=>{r(),ae.lastIndex=o;let a=ae.exec(t);if(!a)return null;let l=a[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;o=ae.lastIndex;let m=Number(l);return Number.isFinite(m)?m:null},s=()=>{r();let a=t[o];return a==="0"||a==="1"?(o++,a==="1"?1:0):null},i=()=>(r(),o<t.length&&/[0-9.+-]/.test(t[o]));for(r();o<t.length;){let a=t[o],l=a.toUpperCase(),u=fr[l];if(u===void 0||n.length===0&&l!=="M")return null;if(o++,u===0){n.push({command:a,values:[]}),r();continue}let m=a,p=!0;for(;p||i();){let f=[];for(let y=0;y<u;y++){let h=l==="A"&&(y===3||y===4)?s():c();if(h===null)return null;f.push(h)}n.push({command:m,values:f}),l==="M"&&(m=a==="M"?"L":"l"),p=!1}r()}return n}function ke(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function se(t,e=1,n=0,o=0){let r="";for(let{command:c,values:s}of t){let i=c.toUpperCase(),a=c===i,l=a?n:0,u=a?o:0,m;switch(i){case"Z":m=[];break;case"H":m=[b(s[0]*e+l)];break;case"V":m=[b(s[0]*e+u)];break;case"A":m=[b(Math.abs(s[0])*e),b(Math.abs(s[1])*e),b(s[2]),String(s[3]),String(s[4]),b(s[5]*e+l),b(s[6]*e+u)];break;default:m=s.map((p,f)=>b(p*e+(f%2===0?l:u)))}r+=c+m.join(" ")}return r}function ze(t,e=.25){let n=[],o=[],r=[0,0],c=[0,0],s=()=>{o.length>2&&n.push(o),o=[]};for(let i of t)if(i.op==="M")s(),r=[i.x,i.y],c=r,o.push(r);else if(i.op==="L")c=[i.x,i.y],o.push(c);else if(i.op==="C"){let a=c,l=[i.x1,i.y1],u=[i.x2,i.y2],m=[i.x,i.y],p=Math.hypot(l[0]-a[0],l[1]-a[1])+Math.hypot(u[0]-l[0],u[1]-l[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),f=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(p/(4*e)))));for(let y=1;y<=f;y++){let h=y/f,g=1-h;o.push([g*g*g*a[0]+3*g*g*h*l[0]+3*g*h*h*u[0]+h*h*h*m[0],g*g*g*a[1]+3*g*g*h*l[1]+3*g*h*h*u[1]+h*h*h*m[1]])}c=m}else s(),c=r;return s(),n}function Qt(t,e){let n=[r=>r[0]-e.x0,r=>e.x1-r[0],r=>r[1]-e.y0,r=>e.y1-r[1]],o=t;for(let r of n){if(o.length===0)break;let c=o;o=[];for(let s=0;s<c.length;s++){let i=c[s],a=c[(s+c.length-1)%c.length],l=r(i),u=r(a);l>=0?(u<0&&o.push(Oe(a,i,u,l)),o.push(i)):u>=0&&o.push(Oe(a,i,u,l))}}return o.length>2?o:[]}function Oe(t,e,n,o){let r=n/(n-o);return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Be(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,o])=>`${b(n)} ${b(o)}`).join("L")}Z`).join("")}function qe(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,c=(s,i)=>{e=Math.min(e,s),n=Math.min(n,i),o=Math.max(o,s),r=Math.max(r,i)};for(let s of t)s.op==="C"?(c(s.x1,s.y1),c(s.x2,s.y2),c(s.x,s.y)):s.op!=="Z"&&c(s.x,s.y);return Number.isFinite(e)?{x0:e,y0:n,x1:o,y1:r}:null}var le=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function gr(t,e,n,o,r,c,s,i,a){if(t===i&&e===a)return[];let l=Math.abs(n),u=Math.abs(o);if(l===0||u===0)return[{op:"L",x:i,y:a}];let m=r*Math.PI/180,p=Math.cos(m),f=Math.sin(m),y=(t-i)/2,h=(e-a)/2,g=p*y+f*h,x=-f*y+p*h,d=g*g/(l*l)+x*x/(u*u);d>1&&(l*=Math.sqrt(d),u*=Math.sqrt(d));let C=l*l*u*u-l*l*x*x-u*u*g*g,M=l*l*x*x+u*u*g*g,F=(c===s?-1:1)*Math.sqrt(Math.max(0,C/M)),P=F*l*x/u,E=-F*u*g/l,I=p*P-f*E+(t+i)/2,w=f*P+p*E+(e+a)/2,N=(G,U,V,dt)=>Math.atan2(G*dt-U*V,G*V+U*dt),B=N(1,0,(g-P)/l,(x-E)/u),H=N((g-P)/l,(x-E)/u,(-g-P)/l,(-x-E)/u);!s&&H>0?H-=2*Math.PI:s&&H<0&&(H+=2*Math.PI);let Y=Math.max(1,Math.ceil(Math.abs(H)/(Math.PI/2)-1e-9)),D=H/Y,K=4/3*Math.tan(D/4),it=(G,U)=>[I+l*p*G-u*f*U,w+l*f*G+u*p*U],pt=[];for(let G=0;G<Y;G++){let U=B+G*D,V=U+D,[dt,$t]=it(Math.cos(U)-K*Math.sin(U),Math.sin(U)+K*Math.cos(U)),[Et,v]=it(Math.cos(V)+K*Math.sin(V),Math.sin(V)-K*Math.cos(V)),[j,J]=G===Y-1?[i,a]:it(Math.cos(V),Math.sin(V));pt.push({op:"C",x1:dt,y1:$t,x2:Et,y2:v,x:j,y:J})}return pt}function Ut(t){let e=[],n=0,o=0,r=0,c=0,s=0,i="",a=null,l=null,u=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{u(),le.lastIndex=n;let y=le.exec(t);return y?(n=le.lastIndex,Number(y[0])):null},p=()=>{u();let y=t[n];return y==="0"||y==="1"?(n++,y==="1"):null},f=y=>{let h=[];for(let g=0;g<y;g++){let x=m();if(x===null)return null;h.push(x)}return h};for(;u(),!(n>=t.length);){let y=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(y))i=y,n++;else if(!i||i==="Z"||i==="z")break;let h=i===i.toLowerCase(),g=h?o:0,x=h?r:0,d=i.toUpperCase();if(d==="Z"){e.push({op:"Z"}),o=c,r=s,a=null,l=null;continue}if(d==="A"){let P=f(3),E=p(),I=p(),w=f(2);if(!(P&&w)||E===null||I===null)break;let[N,B,H]=P,Y=w[0]+g,D=w[1]+x;e.push(...gr(o,r,N,B,H,E,I,Y,D)),o=Y,r=D,a=null,l=null;continue}let C={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[d]??0,M=f(C);if(!M)break;let F=M;switch(d){case"M":o=F[0]+g,r=F[1]+x,c=o,s=r,e.push({op:"M",x:o,y:r}),i=h?"l":"L",a=null,l=null;break;case"L":case"H":case"V":d!=="V"&&(o=F[0]+g),d==="V"?r=F[0]+x:d==="L"&&(r=F[1]+x),e.push({op:"L",x:o,y:r}),a=null,l=null;break;case"C":case"S":{let P,E;d==="C"?(P=[F[0]+g,F[1]+x],E=F.slice(2)):(P=a?[2*o-a[0],2*r-a[1]]:[o,r],E=F);let I=[E[0]+g,E[1]+x],w=[E[2]+g,E[3]+x];e.push({op:"C",x1:P[0],y1:P[1],x2:I[0],y2:I[1],x:w[0],y:w[1]}),[o,r]=w,a=I,l=null;break}case"Q":case"T":{let P,E;d==="Q"?(P=[F[0]+g,F[1]+x],E=[F[2]+g,F[3]+x]):(P=l?[2*o-l[0],2*r-l[1]]:[o,r],E=[F[0]+g,F[1]+x]),e.push({op:"C",x1:o+2/3*(P[0]-o),y1:r+2/3*(P[1]-r),x2:E[0]+2/3*(P[0]-E[0]),y2:E[1]+2/3*(P[1]-E[1]),x:E[0],y:E[1]}),[o,r]=E,l=P,a=null;break}default:break}}return e}var De=.5522847498;function ce(t,e,n,o,r=0,c=0){if(n<=0||o<=0)return[];let s=Math.min(Math.max(r,0),n/2),i=Math.min(Math.max(c,0),o/2);if(s===0||i===0)return[{op:"M",x:t,y:e},{op:"L",x:t+n,y:e},{op:"L",x:t+n,y:e+o},{op:"L",x:t,y:e+o},{op:"Z"}];let a=s*De,l=i*De,u=t+n,m=e+o;return[{op:"M",x:t+s,y:e},{op:"L",x:u-s,y:e},{op:"C",x1:u-s+a,y1:e,x2:u,y2:e+i-l,x:u,y:e+i},{op:"L",x:u,y:m-i},{op:"C",x1:u,y1:m-i+l,x2:u-s+a,y2:m,x:u-s,y:m},{op:"L",x:t+s,y:m},{op:"C",x1:t+s-a,y1:m,x2:t,y2:m-i+l,x:t,y:m-i},{op:"L",x:t,y:e+i},{op:"C",x1:t,y1:e+i-l,x2:t+s-a,y2:e,x:t+s,y:e},{op:"Z"}]}var yr="qrdx.frame",br=1,pe="custom",k={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:bt},xr=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Vt=.95,Sr=200,Mr=["frame","text","accent","background"],Er=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Fr=/[\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 de(t,e=bt){let n=t.slice(0,1e3).normalize("NFC").replace(Er," ").replace(Fr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var fe=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,_=S.number().min(-k.maxCoordinate).max(k.maxCoordinate).refine(fe,{message:`Numbers may have at most ${k.maxDecimals} decimals`}),O=_.refine(t=>t>0,{message:"Must be greater than 0"}),Ht=_.refine(t=>t>=0,{message:"Must not be negative"}),Rt=S.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),Ge=S.union([S.enum(Mr),Rt]),He=t=>S.object({mix:S.tuple([t,t]),amount:S.number().min(0).max(1).refine(fe)}).strict(),St=S.union([Ge,He(Ge)]),Cr=S.union([Rt,He(S.union([S.enum(["frame","accent","background"]),Rt]))]),lt=S.union([St,S.object({gradient:S.object({from:St,to:St,direction:S.enum(["horizontal","vertical"]).optional(),steps:S.int().min(2).max(k.maxGradientSteps).optional()}).strict()}).strict()]),ue={x:_,y:_,width:O,height:O},At=S.object({color:St,width:O}).strict(),Pr=S.object({type:S.literal("rect"),...ue,radius:Ht.optional(),fill:lt,hole:S.object({...ue,radius:Ht.optional()}).strict().optional(),stroke:At.optional()}).strict(),Rr=S.object({type:S.literal("circle"),cx:_,cy:_,r:O,hole:O.optional(),fill:lt,stroke:At.optional()}).strict(),Ar=S.object({type:S.literal("ellipse"),cx:_,cy:_,rx:O,ry:O,fill:lt,stroke:At.optional()}).strict(),wr=S.object({type:S.literal("polygon"),points:S.array(S.tuple([_,_])).min(3).max(k.maxPolygonPoints),fill:lt,stroke:At.optional()}).strict(),Lr=S.object({type:S.literal("path"),d:S.string().min(2).max(k.maxPathLength),fill:lt,fillRule:S.enum(["nonzero","evenodd"]).optional(),stroke:At.optional()}).strict(),Ir=S.object({type:S.literal("line"),x1:_,y1:_,x2:_,y2:_,width:O,cap:S.enum(["butt","round"]).optional(),dash:S.tuple([O,O]).optional(),fill:lt}).strict(),vr=S.object({type:S.literal("icon"),icon:S.enum(xr),x:_,y:_,size:O,fill:lt}).strict(),_r=S.discriminatedUnion("type",[Pr,Rr,Ar,wr,Lr,Ir,vr]),Ve={id:S.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:S.enum(["primary","secondary","fixed"]),text:S.string().max(200),maxLength:S.int().min(1).max(bt).optional(),color:St,weight:S.enum(["bold","regular"]).optional(),collapse:S.object({y:_,height:O}).strict().optional()},Tr=S.object({type:S.literal("text"),...Ve,box:S.object(ue).strict(),align:S.enum(["start","middle","end"]).optional(),fontSize:O.optional()}).strict(),$r=S.object({type:S.literal("curved"),...Ve,curve:S.object({cx:_,cy:_,radius:O,side:S.enum(["top","bottom"]),spread:S.number().min(20).max(300).refine(fe).optional()}).strict(),fontSize:O}).strict(),Nr=S.discriminatedUnion("type",[Tr,$r]),Qe=_.refine(t=>t>=k.minArtboard&&t<=k.maxArtboard,{message:`Artboard sides must be ${k.minArtboard} to ${k.maxArtboard} units`}),kr=S.object({kind:S.literal(yr),version:S.literal(br),artboard:S.object({width:Qe,height:Qe}).strict(),qr:S.object({x:_,y:_,size:O,padding:Ht.optional(),radius:Ht.optional(),plate:S.enum(["opaque","background","none"]).optional()}).strict(),colors:S.object({frame:Rt,text:Cr.optional(),accent:Rt.optional()}).strict(),shapes:S.array(_r).max(k.maxShapes),labels:S.array(Nr).max(k.maxLabels),bleed:S.union([S.literal("none"),St]).optional()}).strict();function he(t){let e=Yt(t);return{x0:t.qr.x-e,y0:t.qr.y-e,x1:t.qr.x+t.qr.size+e,y1:t.qr.y+t.qr.size+e}}function Or(t){return{x0:t.qr.x,y0:t.qr.y,x1:t.qr.x+t.qr.size,y1:t.qr.y+t.qr.size}}function Yt(t){return t.qr.padding??t.qr.size*k.defaultPadding}var ge=.52,zr=.35;function Br(t){let e=t.fontSize??t.box.height*ge;return Math.min(e*xt,t.box.height*Vt)}var me=(t,e)=>Math.min(t.x1,e.x1)-Math.max(t.x0,e.x0)>1e-6&&Math.min(t.y1,e.y1)-Math.max(t.y0,e.y0)>1e-6;function Ue(t){let e=he(t),n=Math.min(t.qr.radius??0,(e.x1-e.x0)/2,(e.y1-e.y0)/2),o=[[e.x0+n,e.y0+n,Math.PI],[e.x1-n,e.y0+n,-Math.PI/2],[e.x1-n,e.y1-n,0],[e.x0+n,e.y1-n,Math.PI/2]],r=[];for(let[c,s,i]of o)for(let a=0;a<=8;a++){let l=i+Math.PI/2*(a/8);r.push([c+n*Math.cos(l),s+n*Math.sin(l)])}return r}function qr([t,e],n,o){if(t<n.x-.01||e<n.y-.01||t>n.x+n.width+.01||e>n.y+n.height+.01)return!1;let c=Math.min(o,n.width/2,n.height/2),s=Math.min(Math.max(t,n.x+c),n.x+n.width-c),i=Math.min(Math.max(e,n.y+c),n.y+n.height-c);return Math.hypot(t-s,e-i)<=c+.01}function Dr(t){let e=0;return t.forEach(([n,o],r)=>{let[c,s]=t[(r+1)%t.length];e+=n*s-c*o}),Math.abs(e)/2}function Gr(t,e,n){let o=he(e);if(!me(n,o))return!1;if("stroke"in t&&t.stroke)return!0;if(t.fill==="background")return!1;if(t.type==="rect"&&t.hole){let{hole:r}=t;return!Ue(e).every(c=>qr(c,r,r.radius??0))}if(t.type==="circle"&&t.hole){let r=t.hole;return!Ue(e).every(([c,s])=>Math.hypot(c-t.cx,s-t.cy)<=r+.01)}if(t.type==="polygon"){let r=Qt(t.points,o);return r.length>2&&Dr(r)>1e-6}return!0}function ye(t){let e=Qr(t),n="stroke"in t?t.stroke:void 0;if(!(n&&e.bounds))return e;let o=t.type==="circle"||t.type==="ellipse"?n.width/2:t.type==="rect"?n.width*Math.SQRT2/2:n.width*2,{x0:r,y0:c,x1:s,y1:i}=e.bounds;return{bounds:{x0:r-o,y0:c-o,x1:s+o,y1:i+o},segments:e.segments*2}}function Qr(t){switch(t.type){case"rect":return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},segments:t.hole?18:9};case"circle":return{bounds:{x0:t.cx-t.r,y0:t.cy-t.r,x1:t.cx+t.r,y1:t.cy+t.r},segments:t.hole?10:5};case"ellipse":return{bounds:{x0:t.cx-t.rx,y0:t.cy-t.ry,x1:t.cx+t.rx,y1:t.cy+t.ry},segments:5};case"polygon":{let e=t.points.map(([o])=>o),n=t.points.map(([,o])=>o);return{bounds:{x0:Math.min(...e),y0:Math.min(...n),x1:Math.max(...e),y1:Math.max(...n)},segments:t.points.length}}case"path":{let e=Pt(t.d,k.maxDecimals);return e?{bounds:qe(Ut(t.d)),segments:ke(e)}:{bounds:null,segments:0}}case"line":{let e=t.width/2,n=Math.hypot(t.x2-t.x1,t.y2-t.y1),o=t.dash?Math.ceil(n/(t.dash[0]+t.dash[1])):1;return{bounds:{x0:Math.min(t.x1,t.x2)-e,y0:Math.min(t.y1,t.y2)-e,x1:Math.max(t.x1,t.x2)+e,y1:Math.max(t.y1,t.y2)+e},segments:o*(t.cap==="round"?4:5)}}default:return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.size,y1:t.y+t.size},segments:Sr}}}function Ur(t,e){let n=(d,C=[])=>e.addIssue({code:"custom",message:d,path:C}),o=k,r=new TextEncoder().encode(JSON.stringify(t)).length;if(r>o.maxBytes){n(`The spec is ${r} bytes; the limit is ${o.maxBytes}`);return}let{width:c,height:s}=t.artboard,i=Math.max(c,s)*.005,a={x0:-i,y0:-i,x1:c+i,y1:s+i},l=d=>d.x0>=a.x0&&d.y0>=a.y0&&d.x1<=a.x1&&d.y1<=a.y1,{qr:u}=t,m=Yt(t);u.plate!=="none"&&m<u.size*o.minPadding-1e-9&&n(`qr.padding must be at least ${o.minPadding*100}% of qr.size`,["qr","padding"]),u.size<Math.min(c,s)*o.minQrShare-1e-9&&n(`qr.size must be at least ${o.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=he(t);(p.x0<-1e-9||p.y0<-1e-9||p.x1>c+1e-9||p.y1>s+1e-9)&&n("The code and its padding must sit inside the artboard",["qr"]),(u.radius??0)>(u.size+2*m)/2&&n("qr.radius is larger than half the plate",["qr","radius"]);let f=0,y=0;t.shapes.forEach((d,C)=>{let M=["shapes",C],{bounds:F,segments:P}=ye(d);if(!F){n("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",[...M,"d"]);return}if(l(F)||n("The shape extends outside the artboard",M),d.type==="rect"&&d.hole){let{hole:E}=d;(E.x<d.x||E.y<d.y||E.x+E.width>d.x+d.width+1e-9||E.y+E.height>d.y+d.height+1e-9)&&n("The hole must sit inside its rect",[...M,"hole"])}d.type==="circle"&&d.hole&&d.hole>=d.r&&n("The hole must be smaller than the circle",[...M,"hole"]),"stroke"in d&&d.stroke&&d.stroke.width>Math.min(c,s)*.1+1e-9&&n("A stroke may be at most 10% of the artboard's shorter side",[...M,"stroke","width"]),u.plate==="background"&&Gr(d,t,F)&&n('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',M),f+=P,typeof d.fill=="object"&&"gradient"in d.fill&&(y+=(d.fill.gradient.steps??32)*P)}),f>o.maxSegments&&n(`The shapes have ${f} segments; the limit is ${o.maxSegments}`,["shapes"]),y>o.maxGradientWork&&n("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=[],g=new Set,x=new Set;t.labels.forEach((d,C)=>{let M=["labels",C];g.has(d.id)&&n(`Label id "${d.id}" is used twice`,[...M,"id"]),g.add(d.id),d.slot!=="fixed"&&(x.has(d.slot)&&n(`Only one label may use the ${d.slot} slot`,[...M,"slot"]),x.add(d.slot));let F=d.maxLength??o.maxTextLength;d.text!==de(d.text,F)&&n(`Label text must be at most ${F} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...M,"text"]);let P;if(d.type==="text"){P={x0:d.box.x,y0:d.box.y,x1:d.box.x+d.box.width,y1:d.box.y+d.box.height},d.fontSize!==void 0&&d.fontSize>d.box.height*Vt+1e-9&&n("fontSize may be at most 95% of the label's row height",[...M,"fontSize"]);let E=d.box.y+d.box.height/2,I=Br(d)*zr,w={x0:P.x0,x1:P.x1,y0:E-I,y1:E+I};(me(P,Or(t))||me(w,p))&&n("The label overlaps the code or its padding",[...M,"box"])}else{let{cx:E,cy:I,radius:w}=d.curve,N=d.fontSize*xt*.6;P={x0:E-w-N,y0:I-w-N,x1:E+w+N,y1:I+w+N};let B=Math.hypot(Math.max(p.x0-E,0,E-p.x1),Math.max(p.y0-I,0,I-p.y1));Math.hypot(Math.max(Math.abs(p.x0-E),Math.abs(p.x1-E)),Math.max(Math.abs(p.y0-I),Math.abs(p.y1-I)))<=w-N||B>=w+N||n("The curved label crosses the code or its padding",[...M,"curve"])}if(l(P)||n("The label extends outside the artboard",M),d.collapse){let E=d.collapse,I=E.y+E.height;(E.y<-1e-9||I>s+1e-9)&&n("The collapse band must sit inside the artboard",[...M,"collapse"]),I>p.y0+1e-6&&E.y<p.y1-1e-6&&n("The collapse band crosses the code or its padding",[...M,"collapse"]);for(let w of h)I>w.y+1e-6&&E.y<w.y+w.height-1e-6&&n("Collapse bands may not overlap",[...M,"collapse"]);h.push(E)}})}var be=kr.superRefine(Ur);var Hr=ie.extend({style:S.literal(pe),spec:be}),Ye=S.discriminatedUnion("style",[ie,Hr]);function q(t){if(t.length===0)return"";let[e,...n]=t;return`M${b(e[0])} ${b(e[1])}${n.map(([o,r])=>`L${b(o)} ${b(r)}`).join("")}Z`}function T(t,e,n){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function A(t,e,n,o,r=0){let c=Math.min(n,o)/2,[s,i,a,l]=(typeof r=="number"?[r,r,r,r]:r).map(m=>Math.max(0,Math.min(m,c))),u=(m,p,f)=>m>0?`A${b(m)} ${b(m)} 0 0 1 ${b(p)} ${b(f)}`:"";return`M${b(t+s)} ${b(e)}H${b(t+n-i)}${u(i,t+n,e+i)}V${b(e+o-a)}${u(a,t+n-a,e+o)}H${b(t+l)}${u(l,t,e+o-l)}V${b(e+s)}${u(s,t+s,e)}Z`}function jt(t,e,n,o,r=5){return Array.from({length:r*2},(c,s)=>{let i=s%2===0?n:o,a=-Math.PI/2+Math.PI/r*s;return[t+i*Math.cos(a),e+i*Math.sin(a)]})}function je(t,e,n){let o=n/2,r=(c,s)=>`${b(t+c*o)} ${b(e+s*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 xe(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}var Ze=24,rt=(t,e,n,o)=>{let r=o*Math.PI/180;return[t+n*Math.cos(r),e+n*Math.sin(r)]},Zt=([t,e])=>`${b(t)} ${b(e)}`;function Mt(t,e,n,o,r,c){let s=c-r>180?1:0;return`M${Zt(rt(t,e,o,r))}A${b(o)} ${b(o)} 0 ${s} 1 ${Zt(rt(t,e,o,c))}L${Zt(rt(t,e,n,c))}A${b(n)} ${b(n)} 0 ${s} 0 ${Zt(rt(t,e,n,r))}Z`}function wt(t,e,n,o){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(o)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(o)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function Vr(t){let e=0;return t.forEach(([n,o],r)=>{let[c,s]=t[(r+1)%t.length];e+=n*s-c*o}),e/2}function Xe(t){return q(Vr(t)<0?[...t].reverse():t)}function Xt(t,e,n,o,r){let c=Math.hypot(n-t,o-e)||1,s=-(o-e)/c*(r/2),i=(n-t)/c*(r/2);return Xe([[t+s,e+i],[n+s,o+i],[n-s,o-i],[t-s,e-i]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),Z=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Yr(){let t=[];for(let e of[0,60,120]){let[n,o]=rt(12,12,10.5,e+180),[r,c]=rt(12,12,10.5,e);t.push(Xt(n,o,r,c,2))}for(let e=0;e<6;e++){let n=e*60,[o,r]=rt(12,12,6.2,n);for(let c of[-45,45]){let[s,i]=rt(o,r,3.6,n+c);t.push(Xt(o,r,s,i,1.7))}}return z(...t)}var jr={wifi:()=>z(Mt(12,20,4.6,7.2,-135,-45),Mt(12,20,9.2,11.8,-135,-45),Mt(12,20,13.8,16.4,-135,-45),T(12,20,2.2)),star:()=>z(q(jt(12,12.8,11.6,4.8))),heart:()=>z(je(12,12.4,22)),phone:()=>Z(A(6,1.5,12,21,2.6),A(7.8,4.2,8.4,13.4,.6),T(12,19.8,1.1)),headphones:()=>z(Mt(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>Z(A(2.5,4,19,17.5,2.5),A(4.6,9,14.8,10.6,.8),A(7,11.4,2.6,2.6,.4),A(10.7,11.4,2.6,2.6,.4),A(14.4,11.4,2.6,2.6,.4),A(7,15.1,2.6,2.6,.4),A(10.7,15.1,2.6,2.6,.4),A(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),A(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>z(T(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:()=>Z(A(2,3,20,14,4),q([[6.5,17],[11.5,17],[5.8,21.8]]),T(7.5,10,1.5),T(12,10,1.5),T(16.5,10,1.5)),bag:()=>z(A(3.5,7.5,17,14.5,2),Mt(12,7.5,3.1,4.8,-180,0)),bell:()=>z("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",A(1.5,18.2,21,2.6,1.3),A(11.2,6.6,1.6,2.6,0),A(9.8,4.6,4.4,2.4,1.2)),cup:()=>z("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",Mt(17,10.2,1.7,3.6,-90,90),A(2,20.6,17,2,1),A(7,1.6,1.6,3.4,.8),A(11.6,1.6,1.6,3.4,.8)),card:()=>Z(A(1.5,4.5,21,15,2.5),A(1.5,8,21,3,0),A(4.5,13.6,4.6,3.2,.6)),check:()=>Z(T(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:()=>Z(T(12,12,10.5),T(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>Z(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]]),A(10,14.5,4,7,[.6,.6,0,0])),pin:()=>Z("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",T(12,9.5,3)),share:()=>z(Xt(6,12,18,5,1.8),Xt(6,12,18,19,1.8),T(18,5,3.2),T(6,12,3.2),T(18,19,3.2)),download:()=>z(A(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:()=>Z(T(12,12,10.5),T(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:Yr,pumpkin:()=>z(wt(7.8,14.6,5.8,6.9),wt(16.2,14.6,5.8,6.9),wt(12,14.6,4.8,7.4),A(10.9,3.4,2.2,4.6,.8),Xe([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>z(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]]),A(10.4,18.6,3.2,3.9,.4)),sparkle:()=>z(q(jt(9.5,13.5,9,2.4,4)),q(jt(19,5,4,1.1,4))),gift:()=>z(A(3,11.2,7.8,10.6,1),A(13.2,11.2,7.8,10.6,1),A(2,7.4,8.8,3.2,1),A(13.2,7.4,8.8,3.2,1),wt(8.8,4.8,2.9,1.9),wt(15.2,4.8,2.9,1.9))};function We(t){return jr[t]()}var Zr={black:[0,0,0],white:[255,255,255],red:[255,0,0],green:[0,128,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],yellow:[255,255,0],orange:[255,165,0],purple:[128,0,128],pink:[255,192,203],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],teal:[0,128,128],aqua:[0,255,255],cyan:[0,255,255],fuchsia:[255,0,255],magenta:[255,0,255]};function Ke(t,e){let n=t.trim(),o=Number.parseFloat(n);return Number.isNaN(o)?Number.NaN:n.endsWith("%")?o/100*e:o}function Lt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=Zr[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let r=e.slice(1);return(r.length===3||r.length===4)&&(r=r.split("").map(c=>c+c).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(e);if(o){let[r,c]=o[1].split("/"),s=r.split(/[\s,]+/).filter(Boolean);if(s.length!==(c===void 0&&s.length===4?4:3))return null;let i=c??s[3],[a,l,u]=s.slice(0,3).map(f=>Ke(f,255)),m=i===void 0?1:Ke(i,1);if([a,l,u,m].some(f=>Number.isNaN(f)))return null;let p=(f,y)=>Math.min(Math.max(f,0),y);return{r:p(a,255),g:p(l,255),b:p(u,255),a:p(m,1)}}return null}function Je(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Me(t){let e=0;for(let n of t)e+=Je(n);return Math.max(e,1)}var Se=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function Wt(t,e,n){let o=Lt(t)??{r:0,g:0,b:0,a:1},r=Lt(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${Se(o.r+(r.r-o.r)*c)}${Se(o.g+(r.g-o.g)*c)}${Se(o.b+(r.b-o.b)*c)}`}function tn(t,e,n,o,r,c,s,i){let a=[...t],l=r*.08,u=a.map(h=>Je(h)*r),m=u.reduce((h,g)=>h+g,0)+l*Math.max(0,a.length-1),p=c==="top"?o-r*.35:o+r*.35,f=[],y=0;return a.forEach((h,g)=>{let x=u[g],d=(y+x/2)/p;if(y+=x+l,h.trim()==="")return;let C=c==="top"?-Math.PI/2-m/2/p+d:Math.PI/2+m/2/p-d;f.push({text:h,x:e+p*Math.cos(C),y:n+p*Math.sin(C),fontSize:r,maxWidth:r*2,color:s,rotate:C*180/Math.PI+(c==="top"?90:-90),field:i})}),f}function It(t,e="#000000"){return t?typeof t=="string"?t:t.type==="solid"?t.color:t.type==="image"?t.underlay||e:(t.type==="linear"||t.type==="radial"||t.type==="angular")&&t.stops[0]?.color||e:e}var Kt=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},en=new WeakMap;function Ee(t){if(t&&typeof t=="object"){let n=en.get(t);if(n)return n}if(t==null)throw new Kt(['A "custom" frame needs a spec']);let e=be.safeParse(t);if(!e.success)throw new Kt(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&en.set(t,e.data),e.data}var Xr=t=>{let e=Lt(t);return!!(e&&e.a>=1)};function Wr(t,e){let n=It(e,et);return t.qr.plate==="none"?{color:n,plate:!1}:Xr(n)?{color:n,plate:!0}:t.qr.plate==="background"?{color:n,plate:!1}:{color:et,plate:!0}}function rn(t,e,n=et){let o=e.color||t.colors.frame,r=e.secondaryColor||t.colors.accent||o,c=a=>a==="frame"?o:a==="accent"?r:a==="background"?n:a,s=t.colors.text,i=e.textColor||(s===void 0?o:typeof s=="string"?s:Wt(c(s.mix[0]),c(s.mix[1]),s.amount));return{frame:o,text:i,accent:r}}function Kr(t,e,n){let o=rn(e,t,n),r=c=>{switch(c){case"frame":return o.frame;case"text":return o.text;case"accent":return o.accent;case"background":return n;default:return c}};return c=>typeof c=="string"?r(c):Wt(r(c.mix[0]),r(c.mix[1]),c.amount)}function nn(t,e,n=0,o=0){let r=Pt(t);return r?se(r,e,n,o):""}function Jr(t,e,n,o){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(o)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(o)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function to(t,e){let[n,o,r,c]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],s=Math.hypot(r-n,c-o),i=t.width*e/2,a=s>0?(r-n)/s:1,l=s>0?(c-o)/s:0,u=-l*i,m=a*i,p=(g,x)=>{let d=[n+a*g,o+l*g],C=[n+a*x,o+l*x];if(t.cap==="round"&&x-g>2*i){let M=[d[0]+a*i,d[1]+l*i],F=[C[0]-a*i,C[1]-l*i];return`M${b(M[0]-u)} ${b(M[1]-m)}L${b(F[0]-u)} ${b(F[1]-m)}A${b(i)} ${b(i)} 0 0 1 ${b(F[0]+u)} ${b(F[1]+m)}L${b(M[0]+u)} ${b(M[1]+m)}A${b(i)} ${b(i)} 0 0 1 ${b(M[0]-u)} ${b(M[1]-m)}Z`}return`M${b(d[0]-u)} ${b(d[1]-m)}L${b(C[0]-u)} ${b(C[1]-m)}L${b(C[0]+u)} ${b(C[1]+m)}L${b(d[0]+u)} ${b(d[1]+m)}Z`};if(!t.dash)return{type:"path",d:p(0,s),fillRule:"nonzero"};let f=t.dash[0]*e,y=f+t.dash[1]*e,h=[];for(let g=0;g+f<=s+1e-6;g+=y)h.push(p(g,g+f));return{type:"path",d:h.join(""),fillRule:"nonzero"}}function eo(t,e){switch(t.type){case"rect":return{type:"rect",x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,radius:(t.radius??0)*e,...t.hole&&{hole:{x:t.hole.x*e,y:t.hole.y*e,width:t.hole.width*e,height:t.hole.height*e,radius:(t.hole.radius??0)*e}}};case"circle":return{type:"path",d:T(t.cx*e,t.cy*e,t.r*e)+(t.hole?T(t.cx*e,t.cy*e,t.hole*e):""),fillRule:t.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:Jr(t.cx*e,t.cy*e,t.rx*e,t.ry*e),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:t.points.map(([n,o])=>[n*e,o*e])};case"path":return{type:"path",d:nn(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return to(t,e);default:{let n=We(t.icon);return{type:"path",d:nn(n.d,t.size*e/Ze,t.x*e,t.y*e),fillRule:n.fillRule}}}}function no(t){if(t.type==="rect"){let{x:e,y:n,width:o,height:r,radius:c,hole:s}=t;return[...ce(e,n,o,r,c,c),...s?ce(s.x,s.y,s.width,s.height,s.radius,s.radius):[]]}return t.type==="polygon"?[...t.points.map(([e,n],o)=>o===0?{op:"M",x:e,y:n}:{op:"L",x:e,y:n}),{op:"Z"}]:Ut(t.d)}function ro(t,e,n){let o=no(t),r=ze(o,.2),c=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",s=e.direction==="vertical",i=g=>s?g[1]:g[0],a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let g of r)for(let x of g)a=Math.min(a,i(x)),l=Math.max(l,i(x));if(!(l>a))return[];let u=e.steps??32,m=n(e.from),p=n(e.to),f=l-a,y=f*.002,h=[];for(let g=0;g<u;g++){let x=a+f*g/u,d=Math.min(l,a+f*(g+1)/u+(g+1<u?y:0)),C=s?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:x,y1:d}:{x0:x,x1:d,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},M=r.map(F=>Qt(F,C)).filter(F=>F.length>2);M.length!==0&&h.push({type:"path",d:Be(M),fill:Wt(m,p,(g+.5)/u),fillRule:c})}return h}function oo(t,e,n){let o=eo(t,e),r="stroke"in t&&t.stroke?{stroke:n(t.stroke.color),strokeWidth:t.stroke.width*e}:void 0;if(typeof t.fill=="object"&&"gradient"in t.fill){let c=ro(o,t.fill.gradient,n);return r?[...c,{...o,fill:"none",...r}]:c}return[{...o,fill:n(t.fill),...r}]}function io(t,e){let n=Math.min(t.maxLength??k.maxTextLength,k.maxTextLength),o=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return de(o,n)}function ao(t){return t===void 0||!Number.isFinite(t)?1:Math.min(xt,Math.max(oe,t))}function so(t,e,n,o,r,c){let s=r(t.color),i=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:h,cy:g,radius:x,side:d,spread:C=140}=t.curve,M=x*o*(C*Math.PI/180),F=Math.min(t.fontSize*o*n,M/(Me(e)+.08*e.length));return tn(e,h*o,g*o,x*o,F,d,s,c).map(P=>({...P,...i}))}let a=t.box.x*o,l=t.box.y*o,u=t.box.width*o,m=t.box.height*o;if(!(m>0))return[];let p=(t.fontSize??t.box.height*ge)*o,f=Math.min(p*n,m*Vt,u/Me(e)),y=t.align??"middle";return[{text:e,x:y==="start"?a:y==="end"?a+u:a+u/2,y:l+m/2+f*.35,fontSize:f,maxWidth:u,color:s,...y!=="middle"&&{align:y},...i,field:c}]}function lo(t){let e=0,n=0,o=0,r=0;return t.map(({command:c,values:s})=>{let i=c.toUpperCase(),a=c!==i;switch(i){case"Z":return e=o,n=r,{command:"Z",values:[]};case"H":return e=(a?e:0)+s[0],{command:"H",values:[e]};case"V":return n=(a?n:0)+s[0],{command:"V",values:[n]};case"A":return e=(a?e:0)+s[5],n=(a?n:0)+s[6],{command:"A",values:[...s.slice(0,5),e,n]};default:{let l=s.map((u,m)=>a?u+(m%2===0?e:n):u);return e=l.at(-2),n=l.at(-1),i==="M"&&(o=e,r=n),{command:i,values:l}}}})}function co(t,e){let n=Pt(t);return n?se(lo(n).map(({command:o,values:r})=>o==="V"?{command:o,values:[e(r[0])]}:o==="H"||o==="Z"?{command:o,values:r}:o==="A"?{command:o,values:[...r.slice(0,6),e(r[6])]}:{command:o,values:r.map((c,s)=>s%2===1?e(c):c)})):t}function uo(t,e){let n=(o,r)=>{let c=e(o);return{y:c,height:e(o+r)-c}};switch(t.type){case"rect":return{...t,...n(t.y,t.height),...t.hole&&{hole:{...t.hole,...n(t.hole.y,t.hole.height)}}};case"circle":case"ellipse":return{...t,cy:e(t.cy)};case"polygon":return{...t,points:t.points.map(([o,r])=>[o,e(r)])};case"path":return{...t,d:co(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function mo(t,e){if(e.length===0)return t;let n=r=>{let c=r;for(let s of e)c-=Math.min(Math.max(r-s.y,0),s.height);return c},o=(r,c)=>e.some(s=>r>=s.y-1e-6&&c<=s.y+s.height+1e-6);return{...t,artboard:{...t.artboard,height:n(t.artboard.height)},qr:{...t.qr,y:n(t.qr.y)},shapes:t.shapes.filter(r=>{let{bounds:c}=ye(r);return!(c&&o(c.y0,c.y1))}).map(r=>uo(r,n)),labels:t.labels.map(r=>{if(r.type==="curved")return{...r,curve:{...r.curve,cy:n(r.curve.cy)}};let c=n(r.box.y);return{...r,box:{...r.box,y:c,height:n(r.box.y+r.box.height)-c}}})}}function Fe(t,e,n,o,r={}){let c=new Map(e.labels.map(g=>[g.id,io(g,n)])),s=mo(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),i=t/s.qr.size,a=Wr(s,o),l=Kr(n,s,a.color),u=s.shapes.flatMap(g=>oo(g,i,l));if(a.plate){let g=Yt(s)*i;u.push({type:"rect",x:s.qr.x*i-g,y:s.qr.y*i-g,width:t+2*g,height:t+2*g,radius:(s.qr.radius??0)*i,fill:a.color})}let m=ao(n.fontScale),p=s.labels.flatMap(g=>{let x=c.get(g.id);if(!x)return[];let d=(g.slot==="fixed"?void 0:r[g.slot])??g.id;return so(g,x,m,i,l,d)}),f=p[0],y=f&&f.rotate===void 0?f:null,h=s.bleed??"none";return{width:s.artboard.width*i,height:s.artboard.height*i,qrX:s.qr.x*i,qrY:s.qr.y*i,qrSize:t,shapes:u,label:y,extraLabels:y?p.slice(1):p,squareEdges:h!=="none",color:l(h==="none"?"frame":h)}}function on(t,e,n){return Fe(t,Ee(e.spec),e,n)}var an={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 Ce={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 sn={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 ln={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 cn={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 un={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 mn={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 pn={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 dn={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 Jt={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 fn={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 hn={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 gn={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 yn={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 bn={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 xn={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 Sn={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 Mn={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 En={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,n,o,r)=>({style:t,name:e,tags:r,labelOn:o,spec:n}),Fn=[$("banner-bottom","Banner",Ce,"frame",["bottom","band"]),$("banner-top","Top banner",sn,"frame",["top","band"]),$("banner-top-bottom","Two banners",ln,"frame",["top","bottom","band"]),$("border","Border",cn,"background",["square","outline"]),$("rounded-border","Rounded",yn,"background",["border","outline"]),$("gradient-border","Gradient",Jt,"background",["border","colorful"]),$("focus","Focus",dn,"background",["corners","brackets"]),$("speech-bubble","Bubble",bn,"frame",["speech"]),$("speech-bubble-top","Bubble top",xn,"frame",["speech"]),$("chat-bubble","Chat",un,"frame",["message","bubble"]),$("circle","Circle",mn,"frame",["round","ring","curved"]),$("badge","Ribbon",an,"frame",["badge","banner"]),$("sticker","Sticker",Sn,"frame",["label"]),$("polaroid","Polaroid",gn,"frame",["photo","picture"]),$("phone","Phone",hn,"background",["mobile","screen"]),$("ticket","Ticket",En,"frame",["event","pass"]),$("tag","Tag",Mn,"frame",["price","label"]),$("envelope","Envelope",pn,"frame",["mail","letter"]),$("menu-card","Menu card",fn,"background",["menu","restaurant"])],_o=new Map(Fn.map(t=>[t.style,t]));function To(t){return _o.get(t)}var ds=Object.fromEntries(Fn.map(t=>[t.style,t.spec])),fs={from:Jt.colors.frame,to:Jt.colors.accent};var $o={primary:"text",secondary:"secondaryText"};function Cn(t,e,n){let o=To(e.style)?.spec??Ce;return Fe(t,Ee(o),e,n,$o)}var No="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function An(t){return!!(t?.style&&t.style!=="none")}function wn(t,e,n){return e.style===pe?on(t,e,n):Cn(t,e,n)}function ko(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function Ln(t,e){let n=({x:r,y:c,width:s,height:i,radius:a})=>{let l=Math.min(a,s/2,i/2);t.moveTo(r+l,c),t.arcTo(r+s,c,r+s,c+i,l),t.arcTo(r+s,c+i,r,c+i,l),t.arcTo(r,c+i,r,c,l),t.arcTo(r,c,r+s,c,l),t.closePath()},o=(r,c)=>{r.stroke&&r.strokeWidth&&(t.strokeStyle=r.stroke,t.lineWidth=r.strokeWidth,t.lineJoin="miter",t.miterLimit=4,c?t.stroke(c):t.stroke())};for(let r of e.shapes){let c=!(r.fill==="transparent"||r.fill==="none");if(c||r.stroke){if(t.fillStyle=r.fill,r.type==="path"){if(typeof Path2D<"u"){let s=new Path2D(r.d);c&&t.fill(s,r.fillRule??"nonzero"),o(r,s)}continue}t.beginPath(),r.type==="polygon"?(r.points.forEach(([s,i],a)=>{a===0?t.moveTo(s,i):t.lineTo(s,i)}),t.closePath(),c&&t.fill()):(n(r),r.hole&&n(r.hole),c&&t.fill("evenodd")),o(r)}}for(let r of ko(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${No}`,t.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",t.textBaseline="alphabetic",r.rotate?(t.save(),t.translate(r.x,r.y),t.rotate(r.rotate*Math.PI/180),t.fillText(r.text,0,0,r.maxWidth),t.restore()):t.fillText(r.text,r.x,r.y,r.maxWidth)}var Oo=.22,zo=.14;function Bo(t,e){let n=t.w*e,o=t.h*e;return{x:t.x+n,y:t.y+o,w:t.w-2*n,h:t.h-2*o}}function Pe(t,e,n){if(t.beginPath(),e==="circle"){t.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=e==="rounded"?Math.min(n.w,n.h)*Oo:0;o>0&&typeof t.roundRect=="function"?t.roundRect(n.x,n.y,n.w,n.h,o):t.rect(n.x,n.y,n.w,n.h)}function In(t,e){return e?Bo(t,zo):t}var{QrCode:Re}=Q,qo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function Do(t){let e=t*4+17,n=new Uint8Array(e*e),o=(s,i)=>{s>=0&&i>=0&&s<e&&i<e&&(n[i*e+s]=1)};for(let s=0;s<e;s++)o(6,s),o(s,6);for(let[s,i]of[[3,3],[e-4,3],[3,e-4]])for(let a=-4;a<=4;a++)for(let l=-4;l<=4;l++)o(s+l,i+a);let r=[];if(t>1){let s=Math.floor(t/7)+2,i=t===32?26:Math.ceil((t*4+4)/(s*2-2))*2;r.push(6);for(let a=e-7;r.length<s;a-=i)r.splice(1,0,a)}let c=r.length-1;for(let[s,i]of r.entries())for(let[a,l]of r.entries())if(!(s===0&&a===0||s===0&&a===c||s===c&&a===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)o(i+m,l+u);for(let s=0;s<=8;s++)o(8,s),o(s,8);for(let s=0;s<8;s++)o(e-1-s,8),o(8,e-1-s);if(t>=7)for(let s=0;s<18;s++){let i=e-11+s%3,a=Math.floor(s/3);o(i,a),o(a,i)}return n}function Go(t,e){let n=t*4+17,o=tt[e].ordinal,r=Re.NUM_ERROR_CORRECTION_BLOCKS[o]?.[t]??0,c=Re.ECC_CODEWORDS_PER_BLOCK[o]?.[t]??0,s=Math.floor(Re.getNumRawDataModules(t)/8),i=r-s%r,a=Math.floor(s/r),l=Array.from({length:r},(M,F)=>a+(F<i?0:1)),u=[],m=[],p=a-c;for(let M=0;M<=a;M++)for(let F=0;F<r;F++)if(F<i){if(M===p)continue;u.push(F),m.push(M<p?M:M-1)}else u.push(F),m.push(M);if(u.length!==s)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let f=Do(t),y=new Int16Array(n*n).fill(-1),h=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),x=s*8,d=0;for(let M=n-1;M>=1;M-=2){M===6&&(M=5);let F=(M+1&2)===0;for(let P=0;P<n;P++)for(let E=0;E<2;E++){let I=M-E,N=(F?n-1-P:P)*n+I;if(!f[N]&&d<x){let B=d>>>3;y[N]=u[B],h[N]=m[B],g[N]=7-(d&7),d++}}}if(d!==x)throw new Error(`Codeword map: placement mismatch at version ${t}`);let C=qo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:r,eccPerBlock:c,blockLengths:l,correctable:Math.floor((c-C)/2),block:y,codeword:h,bit:g}}var Qo=8,ct=new Map;function vn(t,e){if(!(Number.isInteger(t)&&t>=1&&t<=40))throw new RangeError(`QR version must be 1\u201340, got ${t}`);let n=`${t}${e}`,o=ct.get(n);if(o)return ct.delete(n),ct.set(n,o),o;let r=Go(t,e);if(ct.size>=Qo){let c=ct.keys().next().value;c!==void 0&&ct.delete(c)}return ct.set(n,r),r}function _n(t,e){let n=new Array(t.blocks).fill(0),o=new Set;for(let r of e){let c=t.block[r]??-1;if(c<0)continue;let s=c*4096+t.codeword[r];o.has(s)||(o.add(s),n[c]=n[c]+1)}return n}import{z as R}from"zod";import{z as X}from"zod";var Uo=["logo","halftone"],Ho=X.enum(Uo),Tn={logo:["blend","badge"],halftone:["color","mono"]},Vo=X.enum([...Tn.logo,...Tn.halftone]),te=192,$n=t=>Math.ceil(t/3)*4,Yo=X.object({width:X.number().int().min(1).max(te),height:X.number().int().min(1).max(te),data:X.string().max($n(te*te*4))}).refine(t=>t.data.length===$n(t.width*t.height*4),{message:"Art image data does not match its width and height"}),Nn=X.object({mode:Ho,image:Yo,intensity:X.number().min(0).max(1).optional(),variant:Vo.optional(),matchEyes:X.boolean().optional()});import{z as L}from"zod";var Ts=L.enum(["solid","linear","radial","angular","image"]),jo=L.object({type:L.literal("solid"),color:L.string()}),Ae=L.object({color:L.string(),offset:L.number().min(0).max(100)}),Zo=L.object({type:L.literal("linear"),stops:L.array(Ae).min(2),angle:L.number().optional().default(0)}),Xo=L.object({type:L.literal("radial"),stops:L.array(Ae).min(2)}),Wo=L.object({type:L.literal("angular"),stops:L.array(Ae).min(2),angle:L.number().optional().default(0)}),Ko=L.enum(["cover","contain","tile"]),Jo=L.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),ti=L.object({type:L.literal("image"),src:L.string().min(1),fit:Ko.optional().default("cover"),scale:L.number().min(.1).max(4).optional().default(1),position:Jo.optional().default("center"),opacity:L.number().min(0).max(1).optional().default(1),underlay:L.string().optional()}),ut=L.union([L.string(),jo,Zo,Xo,Wo,ti]);import{z as kn}from"zod";var On=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],ei=["diamond","star","banner"],zn=kn.enum([...On,...ei]),ks=kn.enum(On);import{z as Bn}from"zod";var qn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ni=["curly"],Dn=Bn.enum([...qn,...ni]),Bs=Bn.enum(qn);import{z as ri}from"zod";var oi=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Gn=ri.enum(oi);var ii=["square","rounded","circle"],Qn=R.enum(ii),ai=R.object({src:R.string(),height:R.number(),width:R.number(),excavate:R.boolean(),x:R.number().optional(),y:R.number().optional(),padding:R.number().min(0).optional(),shape:Qn.optional(),plate:R.string().optional()}),si=.1,li=.3;var ci=2,Xs=R.object({size:R.number().min(si).max(li).optional(),padding:R.number().min(0).max(ci).optional(),x:R.number().min(0).max(1).optional(),y:R.number().min(0).max(1).optional(),shape:Qn.optional(),plate:R.string().optional()}),ui=R.enum(["L","M","Q","H"]),mi=.5,pi=1,Un=.07,di=["square","circle","heart"],fi=R.enum(di),Hn=3,mt=64,vt=8,Vn=.42,hi=R.object({type:R.literal("silhouette"),width:R.number().int().min(vt).max(mt),height:R.number().int().min(vt).max(mt),cells:R.string().max(mt*mt).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(t=>t.cells.length===t.width*t.height,{message:"Silhouette cells do not match its width and height"}),gi=R.union([fi,hi]);var we=R.object({outer:ut.optional(),inner:ut.optional()}),yi=R.object({topLeft:we.optional(),topRight:we.optional(),bottomLeft:we.optional()}),Ws=R.object({value:R.string(),size:R.number().optional(),level:ui.optional(),bgColor:ut.optional(),fgColor:ut.optional(),eyeColor:ut.optional(),dotColor:ut.optional(),bodyPattern:Gn.optional(),cornerEyePattern:Dn.optional(),cornerEyeDotPattern:zn.optional(),margin:R.number().optional(),imageSettings:ai.optional(),isOGContext:R.boolean().optional(),templateId:R.string().optional(),customProps:R.record(R.string(),R.any()).optional(),frame:Ye.optional(),art:Nn.optional(),eyeColors:yi.optional(),moduleScale:R.number().min(mi).max(pi).optional(),autoLevel:R.boolean().optional(),shape:gi.optional()});var bi={2:6,3:12};function Yn(t){let e=[t.start],n=t.start;for(let o of t.segments){let r=o.at(-1);if(o.length===1)e.push(r);else{let c=bi[o.length];for(let s=1;s<=c;s++){let i=s/c,a=1-i;if(o.length===2){let[l]=o;e.push([a*a*n[0]+2*a*i*l[0]+i*i*r[0],a*a*n[1]+2*a*i*l[1]+i*i*r[1]])}else{let[l,u]=o;e.push([a*a*a*n[0]+3*a*a*i*l[0]+3*a*i*i*u[0]+i*i*i*r[0],a*a*a*n[1]+3*a*a*i*l[1]+3*a*i*i*u[1]+i*i*i*r[1]])}}}n=r}return e}function Zn(t,e){let n=[];for(let o of t)for(let r=0;r<o.length;r++){let[c,s]=o[r],[i,a]=o[(r+1)%o.length];s<=e!=a<=e&&n.push(c+(e-s)/(a-s)*(i-c))}return n.sort((o,r)=>o-r)}function Xn(t,e){let n=0;for(let o of t)if(o<e)n++;else break;return n%2===1}function xi(t,e,n){return Xn(Zn(t,n),e)}function Wn(t){let e=new Map;return(n,o)=>{let r=e.get(o);return r||(r=Zn(t,o),e.set(o,r)),Xn(r,n)}}function Si(t,e,n,o){let r=n[0]-t,c=n[1]-e,s=o[0]-n[0],i=o[1]-n[1],a=u=>Math.max(Math.abs(r+u*s),Math.abs(c+u*i)),l=Math.min(a(0),a(1));for(let[u,m]of[[c-r,s-i],[-(r+c),s+i]])if(m!==0){let p=u/m;p>0&&p<1&&(l=Math.min(l,a(p)))}return l}function Mi(t,e,n){if(!xi(t,e,n))return 0;let o=Number.POSITIVE_INFINITY;for(let r of t)for(let c=0;c<r.length;c++)o=Math.min(o,Si(e,n,r[c],r[(c+1)%r.length]));return Number.isFinite(o)?o:0}function Ei(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let c of t)for(let[s,i]of c)e=Math.min(e,s),n=Math.min(n,i),o=Math.max(o,s),r=Math.max(r,i);return{x0:e,y0:n,x1:o,y1:r}}function Kn(t){let e=t.map(Yn),n=Ei(e),o=n.x1-n.x0,r=n.y1-n.y0;if(!(o>0&&r>0))return null;let c=(y,h)=>{let g=Math.max(y-n.x0,n.x1-y,h-n.y0,n.y1-h);return g>0?Mi(e,y,h)/(2*g):0},s={cx:n.x0+o/2,cy:n.y0+r/2,value:0};s.value=c(s.cx,s.cy);let i=32;for(let y=1;y<i;y++)for(let h=1;h<i;h++){let g=n.x0+o*h/i,x=n.y0+r*y/i,d=c(g,x);d>s.value&&(s={cx:g,cy:x,value:d})}let a=o/i,l=r/i;for(let y=0;y<6;y++){let h=s;for(let g=-2;g<=2;g++)for(let x=-2;x<=2;x++){let d=h.cx+a*x/2,C=h.cy+l*g/2,M=c(d,C);M>s.value&&(s={cx:d,cy:C,value:M})}a/=2,l/=2}if(s.value<=0)return null;let m=.5/Math.max(s.cx-n.x0,n.x1-s.cx,s.cy-n.y0,n.y1-s.cy),p=([y,h])=>[.5+(y-s.cx)*m,.5+(h-s.cy)*m],f=t.map(y=>({start:p(y.start),segments:y.segments.map(h=>h.map(p))}));return{rings:f,polygons:f.map(Yn),half:s.value}}function Jn(t,e){let n=([r,c])=>`${b(r*e)} ${b(c*e)}`,o="";for(let r of t.rings){o+=`M${n(r.start)}`;for(let c of r.segments){let s=c.length===1?"L":c.length===2?"Q":"C";o+=s+c.map(n).join(" ")}o+="Z"}return o}var Fi={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]]]},jn;function tr(){return jn??=Kn([Fi]),jn}function Ci(t){let{width:e,height:n,cells:o}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=vt&&n>=vt&&e<=mt&&n<=mt&&typeof o=="string"&&o.length===e*n&&/^[01]*$/.test(o)?(r,c)=>r>=0&&c>=0&&r<e&&c<n&&o[c*e+r]==="1":null}var W=([t,e])=>`${t},${e}`;function Pi(t,e,n){let o=(a,l)=>t(a-1,l-1),r=new Map,c=(a,l)=>{for(let[u,m]of[[a,l],[l,a]]){let p=r.get(W(u))??[];p.push(m),r.set(W(u),p)}};for(let a=0;a<=n;a++)for(let l=0;l<=e;l++){let u=o(l,a),m=o(l+1,a),p=o(l+1,a+1),f=o(l,a+1),y=[l,a-.5],h=[l+.5,a],g=[l,a+.5],x=[l-.5,a];switch((u?8:0)+(m?4:0)+(p?2:0)+(f?1:0)){case 1:case 14:c(x,g);break;case 2:case 13:c(g,h);break;case 3:case 12:c(x,h);break;case 4:case 11:c(y,h);break;case 6:case 9:c(y,g);break;case 7:case 8:c(x,y);break;case 5:c(y,h),c(x,g);break;case 10:c(x,y),c(g,h);break;default:break}}let s=[],i=new Set;for(let[a,l]of r){if(i.has(a)||l.length===0)continue;let[u,m]=a.split(",").map(Number),p=[[u,m]];i.add(a);let f=[u,m],y=l[0];for(;!i.has(W(y));){i.add(W(y)),p.push(y);let h=Ri(r.get(W(y))??[],f,i);if(!h)break;f=y,y=h}p.length>=3&&s.push(Ai(p))}return s}function Ri(t,e,n){let o=W(e);return t.find(r=>W(r)!==o&&!n.has(W(r)))??t.find(r=>W(r)!==o)}function Ai(t){let e=[];for(let n=0;n<t.length;n++){let o=t[(n-1+t.length)%t.length],r=t[n],c=t[(n+1)%t.length],s=(r[0]-o[0])*(c[1]-r[1])-(r[1]-o[1])*(c[0]-r[0]);Math.abs(s)>1e-9&&e.push(r)}return e.length>=3?e:t}function wi(t){let e=(c,s)=>[(c[0]+s[0])/2,(c[1]+s[1])/2],n=t.length,o=e(t[n-1],t[0]),r=t.map((c,s)=>[c,e(c,t[(s+1)%n])]);return{start:o,segments:r}}var _t=new Map;function er(t){let e=`${t.width}x${t.height}:${t.cells}`,n=_t.get(e);if(n)return n;let o=Ci(t),r;if(!o)r={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=Pi(o,t.width,t.height),s=c.length>0?Kn(c.map(wi)):null;r=s&&2*s.half>=Vn?{outline:s,problem:null}:{outline:null,problem:s?"thin":"empty"}}else r={outline:null,problem:"empty"};return _t.size>16&&_t.delete(_t.keys().next().value),_t.set(e,r),r}var Li=1,nr=.5,rr=.5,Ii=.5;function ee(t){return Math.max(t,Hn)}function Le(t){return t==="heart"?tr():typeof t=="object"&&t?.type==="silhouette"?er(t).outline:null}function ot(t,e,n){if(n==="circle"){let s=ee(e),i=(t/2+s)*Math.SQRT2+Li;return Math.ceil(i-t/2)}let o=Le(n);if(!o)return e;let r=ee(e),c=(t+2*(r+Ii))/(2*o.half);return Math.ceil((c-t)/2-1e-9)}function or(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function vi(t,e,n){let o=ot(e,n,"circle"),r=ee(n),c=e+2*o,s=c/2,i=s-nr-.5,a=or(Number.parseInt(xe(t),36)||1),l=o-r,u=o+e+r;return Array.from({length:c},(m,p)=>Array.from({length:c},(f,y)=>{let h=a()<rr;return y>=l&&y<u&&p>=l&&p<u?!1:h&&Math.hypot(y+.5-s,p+.5-s)<=i}))}var _i=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Ie(t,e,n,o){if(o==="circle")return vi(t,e,n);let r=Le(o);if(!r)return null;let c=ot(e,n,o),s=ee(n),i=e+2*c,a=Wn(r.polygons),l=.5+nr,u=(y,h)=>{let g=y+.5,x=h+.5;return a(g/i,x/i)?_i.every(([d,C])=>a((g+d*l)/i,(x+C*l)/i)):!1},m=or(Number.parseInt(xe(t),36)||1),p=c-s,f=c+e+s;return Array.from({length:i},(y,h)=>Array.from({length:i},(g,x)=>{let d=m()<rr;return x>=p&&x<f&&h>=p&&h<f?!1:d&&u(x,h)}))}function ve(t,e){if(t==="circle")return{circle:e/2};let n=Le(t);return n?{path:Jn(n,e)}:null}function ir(t,e){return t.slice().map((n,o)=>o<e.y||o>=e.y+e.h?n:n.map((r,c)=>c<e.x||c>=e.x+e.w?r:!1))}function _e(t,e=0){let n=[];return t.forEach((o,r)=>{let c=null;o.forEach((s,i)=>{if(!s&&c!==null){n.push(Gt`M${c+e} ${r+e}h${i-c}v1H${c+e}z`),c=null;return}if(i===o.length-1){if(!s)return;c===null?n.push(Gt`M${i+e},${r+e} h1v1H${i+e}z`):n.push(Gt`M${c+e},${r+e} h${i+1-c}v1H${c+e}z`);return}s&&c===null&&(c=i)})}),n.join("")}function Tt(t,e,n,o){if(o==null)return null;let r=t.length,c=Math.floor(e*Dt),s=(r+2*n)/e,i=(o.width||c)*s,a=(o.height||c)*s,l=o.x==null?r/2-i/2:o.x*s,u=o.y==null?r/2-a/2:o.y*s,m=null;if(o.excavate){let p=Math.max(0,o.padding??0)*s,f=Math.floor(l-p),y=Math.floor(u-p),h=Math.ceil(i+l+p-f),g=Math.ceil(a+u+p-y);m={x:f,y,w:h,h:g}}return{x:l,y:u,h:a,w:i,excavation:m}}function ne(t){let e=t.level??yt,{imageSettings:n}=t,o=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&o!=="H"){let r=Q.QrCode.encodeText(t.value,tt[o]).getModules(),c=Tt(r,t.size??zt,ot(r.length,t.margin??qt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(r.length*r.length)>Un&&(o="H")}return o}var Te=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var Ti=.6,$i=["L","M","Q","H"];function Ni(t){let e=Q.QrCode.encodeText(t.value,tt[t.level]),n=$i[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:ot(e.size,t.margin,t.shape),map:vn(e.version,n),level:n,version:e.version}}function ki(t,e){let{cells:n,map:o}=t,r=n.length,c=Tt(n,t.code.size,t.layoutMargin,e);if(!c)return null;let s=c.excavation??{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.ceil(c.x+c.w)-Math.floor(c.x),h:Math.ceil(c.y+c.h)-Math.floor(c.y)},i=[];for(let l=Math.max(0,s.y);l<Math.min(r,s.y+s.h);l++)for(let u=Math.max(0,s.x);u<Math.min(r,s.x+s.w);u++)i.push(l*r+u);let a=_n(o,i);return{worst:Math.max(0,...a),correctable:o.correctable,budget:Math.floor(o.correctable*Ti),level:t.level,version:t.version}}var Oi=t=>!t||t.worst<=t.budget;function zi(t,e,n,o){let r=e.map(i=>Ni({...t,level:i})),c=i=>{let a=o(i);return r.every(l=>Oi(ki(l,a)))};if(c(n))return n;let s=t.size*.005;for(let i=n-s;i>0;i-=s)if(c(i))return i;return 0}function ar(t,e){if(!e)return;let n=Math.floor(t.size*Dt),o=e.width||n,r=e.height||n,c=p=>{if(p===o)return e;let f=r*p/o;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(o-p)/2},...e.y!=null&&{y:e.y+(r-f)/2}}},s=t.level??yt,i={value:t.value,size:t.size,margin:t.margin,shape:t.shape},a=p=>ne({...t,level:s,imageSettings:p}),l=p=>{let f=zi(i,[p],o,c);return f>0?c(f):void 0},u=a(e);if(u===s)return l(s);let m=l(u);return m&&a(m)===u?m:l(s)}import{Fragment as Di,jsx as lr,jsxs as Gi}from"react/jsx-runtime";function Il(t){let{value:e,size:n=zt,level:o=yt,bgColor:r=et,fgColor:c=Bt,margin:s=qt,style:i,imageSettings:a,eyeColor:l,dotColor:u,bodyPattern:m,cornerEyePattern:p,cornerEyeDotPattern:f,isOGContext:y,templateId:h,customTemplate:g,customProps:x,frame:d,art:C,eyeColors:M,moduleScale:F,frameLabelMarkers:P,partMarkers:E,autoLevel:I,shape:w,...N}=t,B=ar({value:e,size:n,margin:s,level:o,shape:w,autoLevel:I},a),H=ne({value:e,size:n,level:o,margin:s,imageSettings:B,autoLevel:I,shape:w}),Y=B?.src,D=An(d)?wn(n,d,r):null,K=D?.width??n,it=D?.height??n,pt=sr(null),G=sr(null),[U,V]=qi(!1);Bi(()=>{if(pt.current!=null){let Et=pt.current,v=Et.getContext("2d");if(!v)return;let j=Q.QrCode.encodeText(e,tt[H]).getModules(),J=ot(j.length,s,w),re=Ie(e,j.length,s,w),ft=j.length+J*2,at=Tt(j,n,J,B),Nt=G.current,$e=at!=null&&Nt?.complete&&Nt.naturalHeight!==0&&Nt.naturalWidth!==0;$e&&at.excavation!=null&&(j=ir(j,at.excavation));let kt=window.devicePixelRatio||1;Et.width=K*kt,Et.height=it*kt,v.scale(kt,kt),D&&(Ln(v,D),v.translate(D.qrX,D.qrY));let Ne=n/ft;v.scale(Ne,Ne),v.fillStyle=It(r,et);let Ft=ve(w,ft);if(Ft&&"circle"in Ft?(v.beginPath(),v.arc(ft/2,ft/2,Ft.circle,0,2*Math.PI),v.fill()):Ft&&Te?v.fill(new Path2D(Ft.path),"evenodd"):v.fillRect(0,0,ft,ft),v.fillStyle=It(c,Bt),Te)v.fill(new Path2D(_e(j,J))),re&&v.fill(new Path2D(_e(re,0)));else for(let[Ot,ht]of[[j,J],[re??[],0]])Ot.forEach((Ct,st)=>{Ct.forEach((cr,ur)=>{cr&&v.fillRect(ur+ht,st+ht,1,1)})});if($e){let Ot={x:at.x+J,y:at.y+J,w:at.w,h:at.h},ht=B?.shape??"square",Ct=B?.plate,st=In(Ot,Ct);v.save(),Ct&&(Pe(v,ht,Ot),v.fillStyle=Ct,v.fill()),ht!=="square"&&(Pe(v,ht,st),v.clip()),v.drawImage(Nt,st.x,st.y,st.w,st.h),v.restore()}}});let dt={height:it,width:K,...i},$t=null;return Y!=null&&($t=lr("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:G,src:Y,style:{display:"none"}},Y)),Gi(Di,{children:[lr("canvas",{height:it,ref:pt,style:dt,width:K,...N}),$t]})}export{Il as QRCodeCanvas};
|
|
2
2
|
/**
|
|
3
3
|
* @license QR Code generator library (TypeScript)
|
|
4
4
|
* Copyright (c) Project Nayuki.
|