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.
Files changed (62) hide show
  1. package/dist/core.js +7 -7
  2. package/dist/core.js.map +1 -1
  3. package/dist/core.mjs +7 -7
  4. package/dist/core.mjs.map +1 -1
  5. package/dist/element.browser.mjs +17 -17
  6. package/dist/element.browser.mjs.map +1 -1
  7. package/dist/index.js +7 -7
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +7 -7
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/qr-code-canvas.js +1 -1
  12. package/dist/qr-code-canvas.js.map +1 -1
  13. package/dist/qr-code-canvas.mjs +1 -1
  14. package/dist/qr-code-canvas.mjs.map +1 -1
  15. package/dist/src/frame-spec.d.ts.map +1 -1
  16. package/dist/src/frame.d.ts +13 -3
  17. package/dist/src/frame.d.ts.map +1 -1
  18. package/dist/src/template/arrow.d.ts +0 -1
  19. package/dist/src/template/arrow.d.ts.map +1 -1
  20. package/dist/src/template/frame-template.d.ts +19 -0
  21. package/dist/src/template/frame-template.d.ts.map +1 -0
  22. package/dist/src/template/halloween.d.ts +0 -1
  23. package/dist/src/template/halloween.d.ts.map +1 -1
  24. package/dist/src/template/square-border.d.ts +0 -1
  25. package/dist/src/template/square-border.d.ts.map +1 -1
  26. package/dist/src/template/standard-box.d.ts +0 -1
  27. package/dist/src/template/standard-box.d.ts.map +1 -1
  28. package/dist/src/template/striked-box.d.ts +0 -1
  29. package/dist/src/template/striked-box.d.ts.map +1 -1
  30. package/dist/types/frame-spec.d.ts +554 -0
  31. package/dist/types/frame-spec.d.ts.map +1 -1
  32. package/dist/types/index.js +2 -2
  33. package/dist/types/index.js.map +1 -1
  34. package/dist/types/index.mjs +2 -2
  35. package/dist/types/index.mjs.map +1 -1
  36. package/dist/types/qr.d.ts +111 -0
  37. package/dist/types/qr.d.ts.map +1 -1
  38. package/dist/types/template.d.ts +7 -0
  39. package/dist/types/template.d.ts.map +1 -1
  40. package/dist/vanilla.browser.mjs +15 -15
  41. package/dist/vanilla.browser.mjs.map +1 -1
  42. package/package.json +1 -1
  43. package/src/frame-spec.ts +17 -2
  44. package/src/frame.tsx +57 -7
  45. package/src/template/arrow.ts +14 -0
  46. package/src/template/frame-template.tsx +70 -0
  47. package/src/template/halloween.ts +14 -0
  48. package/src/template/specs/arrow.json +26 -0
  49. package/src/template/specs/halloween.json +144 -0
  50. package/src/template/specs/square-border.json +27 -0
  51. package/src/template/specs/standard-box.json +31 -0
  52. package/src/template/specs/striked-box.json +56 -0
  53. package/src/template/square-border.ts +14 -0
  54. package/src/template/standard-box.ts +14 -0
  55. package/src/template/striked-box.ts +14 -0
  56. package/types/frame-spec.ts +67 -4
  57. package/types/template.ts +7 -0
  58. package/src/template/arrow.tsx +0 -40
  59. package/src/template/halloween.tsx +0 -147
  60. package/src/template/square-border.tsx +0 -43
  61. package/src/template/standard-box.tsx +0 -43
  62. package/src/template/striked-box.tsx +0 -42
@@ -1,4 +1,4 @@
1
- "use strict";"use client";var ie=Object.defineProperty;var pr=Object.getOwnPropertyDescriptor;var dr=Object.getOwnPropertyNames;var fr=Object.prototype.hasOwnProperty;var hr=(t,e)=>{for(var n in e)ie(t,n,{get:e[n],enumerable:!0})},gr=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of dr(e))!fr.call(t,o)&&o!==n&&ie(t,o,{get:()=>e[o],enumerable:!(r=pr(e,o))||r.enumerable});return t};var yr=t=>gr(ie({},"__esModule",{value:!0}),t);var Hi={};hr(Hi,{QRCodeCanvas:()=>Ui});module.exports=yr(Hi);var pt=require("react");var bt;(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)}}r(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=o.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)}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(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;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 i=this.version;for(let l=0;l<12;l++)i=i<<1^(i>>>11)*7973;let a=this.version<<12|i;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(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 r(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++)}}r(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 r(0<=u&&u<=9),i+=u*t.PENALTY_N4,r(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 r(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 r(l>>>8==0),l}finderPenaltyCountPatterns(i){let a=i[1];r(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 r(s){if(!s)throw new Error("Assertion error")}class o{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 o(o.Mode.BYTE,i.length,a)}static makeNumeric(i){if(!o.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 o(o.Mode.NUMERIC,i.length,a)}static makeAlphanumeric(i){if(!o.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=o.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l))*45;u+=o.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l+1)),e(u,11,a)}return l<i.length&&e(o.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l)),6,a),new o(o.Mode.ALPHANUMERIC,i.length,a)}static makeSegments(i){return i==""?[]:o.isNumeric(i)?[o.makeNumeric(i)]:o.isAlphanumeric(i)?[o.makeAlphanumeric(i)]:[o.makeBytes(o.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 o(o.Mode.ECI,0,a)}static isNumeric(i){return o.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return o.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=o})(bt||={});(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||={})})(bt||={});(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||={})})(bt||={});var Q=bt;var et={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},Bt=128,xt="Q",nt="#FFFFFF",qt="#000000";var Dt=0;var Gt=.1;var X=require("zod"),br=["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"],St=24;var ae=.5,Mt=1.5,xr=X.z.enum(br),se=X.z.object({style:xr,text:X.z.string().max(St).optional(),color:X.z.string().optional(),textColor:X.z.string().optional(),secondaryText:X.z.string().max(St).optional(),secondaryColor:X.z.string().optional(),fontScale:X.z.number().min(ae).max(Mt).optional()});var S=require("zod");function Sr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function b(t,e=3){return String(Sr(t,e))}function Qt(t,...e){let n=t[0]??"";for(let r=0;r<e.length;r++){let o=e[r];n+=(typeof o=="number"?b(o):o)+(t[r+1]??"")}return n}var Mr={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Er=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,le=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Rt(t,e=Number.POSITIVE_INFINITY){if(!Er.test(t))return null;let n=[],r=0,o=()=>{for(;r<t.length&&/[\s,]/.test(t[r]);)r++},c=()=>{o(),le.lastIndex=r;let a=le.exec(t);if(!a)return null;let l=a[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;r=le.lastIndex;let m=Number(l);return Number.isFinite(m)?m:null},s=()=>{o();let a=t[r];return a==="0"||a==="1"?(r++,a==="1"?1:0):null},i=()=>(o(),r<t.length&&/[0-9.+-]/.test(t[r]));for(o();r<t.length;){let a=t[r],l=a.toUpperCase(),u=Mr[l];if(u===void 0||n.length===0&&l!=="M")return null;if(r++,u===0){n.push({command:a,values:[]}),o();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}o()}return n}function qe(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ce(t,e=1,n=0,r=0){let o="";for(let{command:c,values:s}of t){let i=c.toUpperCase(),a=c===i,l=a?n:0,u=a?r: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)))}o+=c+m.join(" ")}return o}function Ge(t,e=.25){let n=[],r=[],o=[0,0],c=[0,0],s=()=>{r.length>2&&n.push(r),r=[]};for(let i of t)if(i.op==="M")s(),o=[i.x,i.y],c=o,r.push(o);else if(i.op==="L")c=[i.x,i.y],r.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;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=o;return s(),n}function Ut(t,e){let n=[o=>o[0]-e.x0,o=>e.x1-o[0],o=>o[1]-e.y0,o=>e.y1-o[1]],r=t;for(let o of n){if(r.length===0)break;let c=r;r=[];for(let s=0;s<c.length;s++){let i=c[s],a=c[(s+c.length-1)%c.length],l=o(i),u=o(a);l>=0?(u<0&&r.push(De(a,i,u,l)),r.push(i)):u>=0&&r.push(De(a,i,u,l))}}return r.length>2?r:[]}function De(t,e,n,r){let o=n/(n-r);return[t[0]+(e[0]-t[0])*o,t[1]+(e[1]-t[1])*o]}function Qe(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,r])=>`${b(n)} ${b(r)}`).join("L")}Z`).join("")}function Ue(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,c=(s,i)=>{e=Math.min(e,s),n=Math.min(n,i),r=Math.max(r,s),o=Math.max(o,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:r,y1:o}:null}var ue=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Fr(t,e,n,r,o,c,s,i,a){if(t===i&&e===a)return[];let l=Math.abs(n),u=Math.abs(r);if(l===0||u===0)return[{op:"L",x:i,y:a}];let m=o*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,ht)=>Math.atan2(G*ht-U*V,G*V+U*ht),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,J=4/3*Math.tan(D/4),it=(G,U)=>[I+l*p*G-u*f*U,w+l*f*G+u*p*U],ft=[];for(let G=0;G<Y;G++){let U=B+G*D,V=U+D,[ht,Nt]=it(Math.cos(U)-J*Math.sin(U),Math.sin(U)+J*Math.cos(U)),[Ft,v]=it(Math.cos(V)+J*Math.sin(V),Math.sin(V)-J*Math.cos(V)),[j,tt]=G===Y-1?[i,a]:it(Math.cos(V),Math.sin(V));ft.push({op:"C",x1:ht,y1:Nt,x2:Ft,y2:v,x:j,y:tt})}return ft}function Ht(t){let e=[],n=0,r=0,o=0,c=0,s=0,i="",a=null,l=null,u=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{u(),ue.lastIndex=n;let y=ue.exec(t);return y?(n=ue.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?r:0,x=h?o:0,d=i.toUpperCase();if(d==="Z"){e.push({op:"Z"}),r=c,o=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(...Fr(r,o,N,B,H,E,I,Y,D)),r=Y,o=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,o=F[1]+x,c=r,s=o,e.push({op:"M",x:r,y:o}),i=h?"l":"L",a=null,l=null;break;case"L":case"H":case"V":d!=="V"&&(r=F[0]+g),d==="V"?o=F[0]+x:d==="L"&&(o=F[1]+x),e.push({op:"L",x:r,y:o}),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*o-a[1]]:[r,o],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,o]=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*o-l[1]]:[r,o],E=[F[0]+g,F[1]+x]),e.push({op:"C",x1:r+2/3*(P[0]-r),y1:o+2/3*(P[1]-o),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,o]=E,l=P,a=null;break}default:break}}return e}var He=.5522847498;function me(t,e,n,r,o=0,c=0){if(n<=0||r<=0)return[];let s=Math.min(Math.max(o,0),n/2),i=Math.min(Math.max(c,0),r/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+r},{op:"L",x:t,y:e+r},{op:"Z"}];let a=s*He,l=i*He,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+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 Cr="qrdx.frame",Pr=1,fe="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:St},Rr=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Yt=.95,Ar=200,wr=["frame","text","accent","background"],Lr=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Ir=/[\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 he(t,e=St){let n=t.slice(0,1e3).normalize("NFC").replace(Lr," ").replace(Ir,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var ge=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,_=S.z.number().min(-O.maxCoordinate).max(O.maxCoordinate).refine(ge,{message:`Numbers may have at most ${O.maxDecimals} decimals`}),k=_.refine(t=>t>0,{message:"Must be greater than 0"}),Vt=_.refine(t=>t>=0,{message:"Must not be negative"}),wt=S.z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),Ve=S.z.union([S.z.enum(wr),wt]),Ze=t=>S.z.object({mix:S.z.tuple([t,t]),amount:S.z.number().min(0).max(1).refine(ge)}).strict(),At=S.z.union([Ve,Ze(Ve)]),vr=S.z.union([wt,Ze(S.z.union([S.z.enum(["frame","accent","background"]),wt]))]),lt=S.z.union([At,S.z.object({gradient:S.z.object({from:At,to:At,direction:S.z.enum(["horizontal","vertical"]).optional(),steps:S.z.int().min(2).max(O.maxGradientSteps).optional()}).strict()}).strict()]),pe={x:_,y:_,width:k,height:k},_r=S.z.object({type:S.z.literal("rect"),...pe,radius:Vt.optional(),fill:lt,hole:S.z.object({...pe,radius:Vt.optional()}).strict().optional()}).strict(),$r=S.z.object({type:S.z.literal("circle"),cx:_,cy:_,r:k,hole:k.optional(),fill:lt}).strict(),Tr=S.z.object({type:S.z.literal("ellipse"),cx:_,cy:_,rx:k,ry:k,fill:lt}).strict(),Nr=S.z.object({type:S.z.literal("polygon"),points:S.z.array(S.z.tuple([_,_])).min(3).max(O.maxPolygonPoints),fill:lt}).strict(),Or=S.z.object({type:S.z.literal("path"),d:S.z.string().min(2).max(O.maxPathLength),fill:lt,fillRule:S.z.enum(["nonzero","evenodd"]).optional()}).strict(),kr=S.z.object({type:S.z.literal("line"),x1:_,y1:_,x2:_,y2:_,width:k,cap:S.z.enum(["butt","round"]).optional(),dash:S.z.tuple([k,k]).optional(),fill:lt}).strict(),zr=S.z.object({type:S.z.literal("icon"),icon:S.z.enum(Rr),x:_,y:_,size:k,fill:lt}).strict(),Br=S.z.discriminatedUnion("type",[_r,$r,Tr,Nr,Or,kr,zr]),Xe={id:S.z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:S.z.enum(["primary","secondary","fixed"]),text:S.z.string().max(200),maxLength:S.z.int().min(1).max(St).optional(),color:At,weight:S.z.enum(["bold","regular"]).optional(),collapse:S.z.object({y:_,height:k}).strict().optional()},qr=S.z.object({type:S.z.literal("text"),...Xe,box:S.z.object(pe).strict(),align:S.z.enum(["start","middle","end"]).optional(),fontSize:k.optional()}).strict(),Dr=S.z.object({type:S.z.literal("curved"),...Xe,curve:S.z.object({cx:_,cy:_,radius:k,side:S.z.enum(["top","bottom"]),spread:S.z.number().min(20).max(300).refine(ge).optional()}).strict(),fontSize:k}).strict(),Gr=S.z.discriminatedUnion("type",[qr,Dr]),Ye=_.refine(t=>t>=O.minArtboard&&t<=O.maxArtboard,{message:`Artboard sides must be ${O.minArtboard} to ${O.maxArtboard} units`}),Qr=S.z.object({kind:S.z.literal(Cr),version:S.z.literal(Pr),artboard:S.z.object({width:Ye,height:Ye}).strict(),qr:S.z.object({x:_,y:_,size:k,padding:Vt.optional(),radius:Vt.optional(),plate:S.z.enum(["opaque","background"]).optional()}).strict(),colors:S.z.object({frame:wt,text:vr.optional(),accent:wt.optional()}).strict(),shapes:S.z.array(Br).max(O.maxShapes),labels:S.z.array(Gr).max(O.maxLabels),bleed:S.z.union([S.z.literal("none"),At]).optional()}).strict();function ye(t){let e=jt(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 Ur(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 jt(t){return t.qr.padding??t.qr.size*O.defaultPadding}var be=.52,Hr=.35;function Vr(t){let e=t.fontSize??t.box.height*be;return Math.min(e*Mt,t.box.height*Yt)}var de=(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 je(t){let e=ye(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]],o=[];for(let[c,s,i]of r)for(let a=0;a<=8;a++){let l=i+Math.PI/2*(a/8);o.push([c+n*Math.cos(l),s+n*Math.sin(l)])}return o}function Yr([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),i=Math.min(Math.max(e,n.y+c),n.y+n.height-c);return Math.hypot(t-s,e-i)<=c+.01}function jr(t){let e=0;return t.forEach(([n,r],o)=>{let[c,s]=t[(o+1)%t.length];e+=n*s-c*r}),Math.abs(e)/2}function Zr(t,e,n){let r=ye(e);if(t.fill==="background"||!de(n,r))return!1;if(t.type==="rect"&&t.hole){let{hole:o}=t;return!je(e).every(c=>Yr(c,o,o.radius??0))}if(t.type==="circle"&&t.hole){let o=t.hole;return!je(e).every(([c,s])=>Math.hypot(c-t.cx,s-t.cy)<=o+.01)}if(t.type==="polygon"){let o=Ut(t.points,r);return o.length>2&&jr(o)>1e-6}return!0}function xe(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=Rt(t.d,O.maxDecimals);return e?{bounds:Ue(Ht(t.d)),segments:qe(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:Ar}}}function Xr(t,e){let n=(d,C=[])=>e.addIssue({code:"custom",message:d,path:C}),r=O,o=new TextEncoder().encode(JSON.stringify(t)).length;if(o>r.maxBytes){n(`The spec is ${o} bytes; the limit is ${r.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=jt(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=ye(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}=xe(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"&&Zr(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!==he(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*Yt+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=Vr(d)*Hr,w={x0:P.x0,x1:P.x1,y0:E-I,y1:E+I};(de(P,Ur(t))||de(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*Mt*.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 Se=Qr.superRefine(Xr);var Wr=se.extend({style:S.z.literal(fe),spec:Se}),We=S.z.discriminatedUnion("style",[se,Wr]);function q(t){if(t.length===0)return"";let[e,...n]=t;return`M${b(e[0])} ${b(e[1])}${n.map(([r,o])=>`L${b(r)} ${b(o)}`).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,o=0){let c=Math.min(n,r)/2,[s,i,a,l]=(typeof o=="number"?[o,o,o,o]:o).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+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 Zt(t,e,n,r,o=5){return Array.from({length:o*2},(c,s)=>{let i=s%2===0?n:r,a=-Math.PI/2+Math.PI/o*s;return[t+i*Math.cos(a),e+i*Math.sin(a)]})}function Ke(t,e,n){let r=n/2,o=(c,s)=>`${b(t+c*r)} ${b(e+s*r)}`;return`M${o(0,-.52)}C${o(.18,-.92)} ${o(.98,-.94)} ${o(1,-.34)}C${o(1,.12)} ${o(.5,.48)} ${o(0,.92)}C${o(-.5,.48)} ${o(-1,.12)} ${o(-1,-.34)}C${o(-.98,-.94)} ${o(-.18,-.92)} ${o(0,-.52)}Z`}function Me(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 o=r*Math.PI/180;return[t+n*Math.cos(o),e+n*Math.sin(o)]},Xt=([t,e])=>`${b(t)} ${b(e)}`;function Et(t,e,n,r,o,c){let s=c-o>180?1:0;return`M${Xt(rt(t,e,r,o))}A${b(r)} ${b(r)} 0 ${s} 1 ${Xt(rt(t,e,r,c))}L${Xt(rt(t,e,n,c))}A${b(n)} ${b(n)} 0 ${s} 0 ${Xt(rt(t,e,n,o))}Z`}function Lt(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){let e=0;return t.forEach(([n,r],o)=>{let[c,s]=t[(o+1)%t.length];e+=n*s-c*r}),e/2}function tn(t){return q(Kr(t)<0?[...t].reverse():t)}function Wt(t,e,n,r,o){let c=Math.hypot(n-t,r-e)||1,s=-(r-e)/c*(o/2),i=(n-t)/c*(o/2);return tn([[t+s,e+i],[n+s,r+i],[n-s,r-i],[t-s,e-i]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),W=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Jr(){let t=[];for(let e of[0,60,120]){let[n,r]=rt(12,12,10.5,e+180),[o,c]=rt(12,12,10.5,e);t.push(Wt(n,r,o,c,2))}for(let e=0;e<6;e++){let n=e*60,[r,o]=rt(12,12,6.2,n);for(let c of[-45,45]){let[s,i]=rt(r,o,3.6,n+c);t.push(Wt(r,o,s,i,1.7))}}return z(...t)}var to={wifi:()=>z(Et(12,20,4.6,7.2,-135,-45),Et(12,20,9.2,11.8,-135,-45),Et(12,20,13.8,16.4,-135,-45),$(12,20,2.2)),star:()=>z(q(Zt(12,12.8,11.6,4.8))),heart:()=>z(Ke(12,12.4,22)),phone:()=>W(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(Et(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>W(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:()=>W(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),Et(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",Et(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:()=>W(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:()=>W($(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:()=>W($(12,12,10.5),$(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>W(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:()=>W("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(Wt(6,12,18,5,1.8),Wt(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:()=>W($(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:Jr,pumpkin:()=>z(Lt(7.8,14.6,5.8,6.9),Lt(16.2,14.6,5.8,6.9),Lt(12,14.6,4.8,7.4),A(10.9,3.4,2.2,4.6,.8),tn([[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(Zt(9.5,13.5,9,2.4,4)),q(Zt(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),Lt(8.8,4.8,2.9,1.9),Lt(15.2,4.8,2.9,1.9))};function en(t){return to[t]()}var eo={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 nn(t,e){let n=t.trim(),r=Number.parseFloat(n);return Number.isNaN(r)?Number.NaN:n.endsWith("%")?r/100*e:r}function It(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=eo[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let o=e.slice(1);return(o.length===3||o.length===4)&&(o=o.split("").map(c=>c+c).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(o)?{r:Number.parseInt(o.slice(0,2),16),g:Number.parseInt(o.slice(2,4),16),b:Number.parseInt(o.slice(4,6),16),a:o.length===8?Number.parseInt(o.slice(6,8),16)/255:1}:null}let r=/^rgba?\(([^)]*)\)$/.exec(e);if(r){let[o,c]=r[1].split("/"),s=o.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=>nn(f,255)),m=i===void 0?1:nn(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 rn(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Fe(t){let e=0;for(let n of t)e+=rn(n);return Math.max(e,1)}var Ee=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function Kt(t,e,n){let r=It(t)??{r:0,g:0,b:0,a:1},o=It(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${Ee(r.r+(o.r-r.r)*c)}${Ee(r.g+(o.g-r.g)*c)}${Ee(r.b+(o.b-r.b)*c)}`}function on(t,e,n,r,o,c,s,i){let a=[...t],l=o*.08,u=a.map(h=>rn(h)*o),m=u.reduce((h,g)=>h+g,0)+l*Math.max(0,a.length-1),p=c==="top"?r-o*.35:r+o*.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:o,maxWidth:o*2,color:s,rotate:C*180/Math.PI+(c==="top"?90:-90),field:i})}),f}function vt(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 Jt=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},an=new WeakMap;function Ce(t){if(t&&typeof t=="object"){let n=an.get(t);if(n)return n}if(t==null)throw new Jt(['A "custom" frame needs a spec']);let e=Se.safeParse(t);if(!e.success)throw new Jt(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&an.set(t,e.data),e.data}var no=t=>{let e=It(t);return!!(e&&e.a>=1)};function ro(t,e){let n=vt(e,nt);return no(n)?{color:n,plate:!0}:t.qr.plate==="background"?{color:n,plate:!1}:{color:nt,plate:!0}}function ln(t,e,n=nt){let r=e.color||t.colors.frame,o=e.secondaryColor||t.colors.accent||r,c=a=>a==="frame"?r:a==="accent"?o:a==="background"?n:a,s=t.colors.text,i=e.textColor||(s===void 0?r:typeof s=="string"?s:Kt(c(s.mix[0]),c(s.mix[1]),s.amount));return{frame:r,text:i,accent:o}}function oo(t,e,n){let r=ln(e,t,n),o=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"?o(c):Kt(o(c.mix[0]),o(c.mix[1]),c.amount)}function sn(t,e,n=0,r=0){let o=Rt(t);return o?ce(o,e,n,r):""}function io(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 ao(t,e){let[n,r,o,c]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],s=Math.hypot(o-n,c-r),i=t.width*e/2,a=s>0?(o-n)/s:1,l=s>0?(c-r)/s:0,u=-l*i,m=a*i,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*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 so(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:io(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:sn(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return ao(t,e);default:{let n=en(t.icon);return{type:"path",d:sn(n.d,t.size*e/Je,t.x*e,t.y*e),fillRule:n.fillRule}}}}function lo(t){if(t.type==="rect"){let{x:e,y:n,width:r,height:o,radius:c,hole:s}=t;return[...me(e,n,r,o,c,c),...s?me(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"}]:Ht(t.d)}function co(t,e,n){let r=lo(t),o=Ge(r,.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 o)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=o.map(F=>Ut(F,C)).filter(F=>F.length>2);M.length!==0&&h.push({type:"path",d:Qe(M),fill:Kt(m,p,(g+.5)/u),fillRule:c})}return h}function uo(t,e,n){let r=so(t,e);return typeof t.fill=="object"&&"gradient"in t.fill?co(r,t.fill.gradient,n):[{...r,fill:n(t.fill)}]}function mo(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 he(r,n)}function po(t){return t===void 0||!Number.isFinite(t)?1:Math.min(Mt,Math.max(ae,t))}function fo(t,e,n,r,o,c){let s=o(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*r*(C*Math.PI/180),F=Math.min(t.fontSize*r*n,M/(Fe(e)+.08*e.length));return on(e,h*r,g*r,x*r,F,d,s,c).map(P=>({...P,...i}))}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*be)*r,f=Math.min(p*n,m*Yt,u/Fe(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 ho(t){let e=0,n=0,r=0,o=0;return t.map(({command:c,values:s})=>{let i=c.toUpperCase(),a=c!==i;switch(i){case"Z":return e=r,n=o,{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"&&(r=e,o=n),{command:i,values:l}}}})}function go(t,e){let n=Rt(t);return n?ce(ho(n).map(({command:r,values:o})=>r==="V"?{command:r,values:[e(o[0])]}:r==="H"||r==="Z"?{command:r,values:o}:r==="A"?{command:r,values:[...o.slice(0,6),e(o[6])]}:{command:r,values:o.map((c,s)=>s%2===1?e(c):c)})):t}function yo(t,e){let n=(r,o)=>{let c=e(r);return{y:c,height:e(r+o)-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,o])=>[r,e(o)])};case"path":return{...t,d:go(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function bo(t,e){if(e.length===0)return t;let n=o=>{let c=o;for(let s of e)c-=Math.min(Math.max(o-s.y,0),s.height);return c},r=(o,c)=>e.some(s=>o>=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(o=>{let{bounds:c}=xe(o);return!(c&&r(c.y0,c.y1))}).map(o=>yo(o,n)),labels:t.labels.map(o=>{if(o.type==="curved")return{...o,curve:{...o.curve,cy:n(o.curve.cy)}};let c=n(o.box.y);return{...o,box:{...o.box,y:c,height:n(o.box.y+o.box.height)-c}}})}}function Pe(t,e,n,r,o={}){let c=new Map(e.labels.map(g=>[g.id,mo(g,n)])),s=bo(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),i=t/s.qr.size,a=ro(s,r),l=oo(n,s,a.color),u=s.shapes.flatMap(g=>uo(g,i,l));if(a.plate){let g=jt(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=po(n.fontScale),p=s.labels.flatMap(g=>{let x=c.get(g.id);if(!x)return[];let d=(g.slot==="fixed"?void 0:o[g.slot])??g.id;return fo(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 cn(t,e,n){return Pe(t,Ce(e.spec),e,n)}var un={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 Re={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 mn={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 pn={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 dn={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 fn={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 hn={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 gn={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 yn={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 te={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 bn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1460},qr:{x:130,y:260,size:1e3,padding:46,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"frame",hole:{x:22,y:22,width:1216,height:1416,radius:8}},{type:"rect",x:45,y:45,width:1170,height:1370,fill:"frame",hole:{x:53,y:53,width:1154,height:1354}},{type:"rect",x:378,y:181,width:504,height:8,fill:"frame"},{type:"polygon",points:[[630,163],[652,185],[630,207],[608,185]],fill:"frame"}],labels:[{type:"text",id:"title",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:30,width:1e3,height:170},collapse:{y:84,height:130}},{type:"text",id:"footer",slot:"secondary",text:"",color:"text",box:{x:130,y:1270,width:1e3,height:160},collapse:{y:1306,height:70}}]};var xn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1610},qr:{x:130,y:250,size:1e3,padding:75,radius:55},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1610,radius:170,fill:"frame"},{type:"rect",x:50,y:170,width:1160,height:1290,radius:60,fill:"background"},{type:"rect",x:520,y:67,width:220,height:36,radius:18,fill:"background"},{type:"rect",x:480,y:1520,width:300,height:30,radius:15,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1290,width:1e3,height:170},collapse:{y:1330,height:130}}]};var Sn={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 Mn={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 En={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 Fn={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 Cn={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 Pn={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 Rn={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,o)=>({style:t,name:e,tags:o,labelOn:r,spec:n}),An=[T("banner-bottom","Banner",Re,"frame",["bottom","band"]),T("banner-top","Top banner",mn,"frame",["top","band"]),T("banner-top-bottom","Two banners",pn,"frame",["top","bottom","band"]),T("border","Border",dn,"background",["square","outline"]),T("rounded-border","Rounded",Mn,"background",["border","outline"]),T("gradient-border","Gradient",te,"background",["border","colorful"]),T("focus","Focus",yn,"background",["corners","brackets"]),T("speech-bubble","Bubble",En,"frame",["speech"]),T("speech-bubble-top","Bubble top",Fn,"frame",["speech"]),T("chat-bubble","Chat",fn,"frame",["message","bubble"]),T("circle","Circle",hn,"frame",["round","ring","curved"]),T("badge","Ribbon",un,"frame",["badge","banner"]),T("sticker","Sticker",Cn,"frame",["label"]),T("polaroid","Polaroid",Sn,"frame",["photo","picture"]),T("phone","Phone",xn,"background",["mobile","screen"]),T("ticket","Ticket",Rn,"frame",["event","pass"]),T("tag","Tag",Pn,"frame",["price","label"]),T("envelope","Envelope",gn,"frame",["mail","letter"]),T("menu-card","Menu card",bn,"background",["menu","restaurant"])],zo=new Map(An.map(t=>[t.style,t]));function Bo(t){return zo.get(t)}var hs=Object.fromEntries(An.map(t=>[t.style,t.spec])),gs={from:te.colors.frame,to:te.colors.accent};var qo={primary:"text",secondary:"secondaryText"};function wn(t,e,n){let r=Bo(e.style)?.spec??Re;return Pe(t,Ce(r),e,n,qo)}var Do="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function vn(t){return!!(t?.style&&t.style!=="none")}function _n(t,e,n){return e.style===fe?cn(t,e,n):wn(t,e,n)}function Go(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function $n(t,e){let n=({x:r,y:o,width:c,height:s,radius:i})=>{let a=Math.min(i,c/2,s/2);t.moveTo(r+a,o),t.arcTo(r+c,o,r+c,o+s,a),t.arcTo(r+c,o+s,r,o+s,a),t.arcTo(r,o+s,r,o,a),t.arcTo(r,o,r+c,o,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(([o,c],s)=>{s===0?t.moveTo(o,c):t.lineTo(o,c)}),t.closePath(),t.fill()):(n(r),r.hole&&n(r.hole),t.fill("evenodd"))}for(let r of Go(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${Do}`,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 Qo=.22,Uo=.14;function Ho(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 Ae(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)*Qo: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 Tn(t,e){return e?Ho(t,Uo):t}var{QrCode:we}=Q,Vo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function Yo(t){let e=t*4+17,n=new Uint8Array(e*e),r=(s,i)=>{s>=0&&i>=0&&s<e&&i<e&&(n[i*e+s]=1)};for(let s=0;s<e;s++)r(6,s),r(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++)r(s+l,i+a);let o=[];if(t>1){let s=Math.floor(t/7)+2,i=t===32?26:Math.ceil((t*4+4)/(s*2-2))*2;o.push(6);for(let a=e-7;o.length<s;a-=i)o.splice(1,0,a)}let c=o.length-1;for(let[s,i]of o.entries())for(let[a,l]of o.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(i+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 i=e-11+s%3,a=Math.floor(s/3);r(i,a),r(a,i)}return n}function jo(t,e){let n=t*4+17,r=et[e].ordinal,o=we.NUM_ERROR_CORRECTION_BLOCKS[r]?.[t]??0,c=we.ECC_CODEWORDS_PER_BLOCK[r]?.[t]??0,s=Math.floor(we.getNumRawDataModules(t)/8),i=o-s%o,a=Math.floor(s/o),l=Array.from({length:o},(M,F)=>a+(F<i?0:1)),u=[],m=[],p=a-c;for(let M=0;M<=a;M++)for(let F=0;F<o;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=Yo(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=Vo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:o,eccPerBlock:c,blockLengths:l,correctable:Math.floor((c-C)/2),block:y,codeword:h,bit:g}}var Zo=8,ct=new Map;function Nn(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 o=jo(t,e);if(ct.size>=Zo){let c=ct.keys().next().value;c!==void 0&&ct.delete(c)}return ct.set(n,o),o}function On(t,e){let n=new Array(t.blocks).fill(0),r=new Set;for(let o of e){let c=t.block[o]??-1;if(c<0)continue;let s=c*4096+t.codeword[o];r.has(s)||(r.add(s),n[c]=n[c]+1)}return n}var R=require("zod");var Z=require("zod"),Xo=["logo","halftone"],Wo=Z.z.enum(Xo),kn={logo:["blend","badge"],halftone:["color","mono"]},Ko=Z.z.enum([...kn.logo,...kn.halftone]),ee=192,zn=t=>Math.ceil(t/3)*4,Jo=Z.z.object({width:Z.z.number().int().min(1).max(ee),height:Z.z.number().int().min(1).max(ee),data:Z.z.string().max(zn(ee*ee*4))}).refine(t=>t.data.length===zn(t.width*t.height*4),{message:"Art image data does not match its width and height"}),Bn=Z.z.object({mode:Wo,image:Jo,intensity:Z.z.number().min(0).max(1).optional(),variant:Ko.optional(),matchEyes:Z.z.boolean().optional()});var L=require("zod"),vs=L.z.enum(["solid","linear","radial","angular","image"]),ti=L.z.object({type:L.z.literal("solid"),color:L.z.string()}),Le=L.z.object({color:L.z.string(),offset:L.z.number().min(0).max(100)}),ei=L.z.object({type:L.z.literal("linear"),stops:L.z.array(Le).min(2),angle:L.z.number().optional().default(0)}),ni=L.z.object({type:L.z.literal("radial"),stops:L.z.array(Le).min(2)}),ri=L.z.object({type:L.z.literal("angular"),stops:L.z.array(Le).min(2),angle:L.z.number().optional().default(0)}),oi=L.z.enum(["cover","contain","tile"]),ii=L.z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),ai=L.z.object({type:L.z.literal("image"),src:L.z.string().min(1),fit:oi.optional().default("cover"),scale:L.z.number().min(.1).max(4).optional().default(1),position:ii.optional().default("center"),opacity:L.z.number().min(0).max(1).optional().default(1),underlay:L.z.string().optional()}),ut=L.z.union([L.z.string(),ti,ei,ni,ri,ai]);var Ie=require("zod"),qn=["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"],si=["diamond","star","banner"],Dn=Ie.z.enum([...qn,...si]),$s=Ie.z.enum(qn);var ve=require("zod"),Gn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],li=["curly"],Qn=ve.z.enum([...Gn,...li]),Ns=ve.z.enum(Gn);var Un=require("zod"),ci=["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"],Hn=Un.z.enum(ci);var ui=["square","rounded","circle"],Vn=R.z.enum(ui),mi=R.z.object({src:R.z.string(),height:R.z.number(),width:R.z.number(),excavate:R.z.boolean(),x:R.z.number().optional(),y:R.z.number().optional(),padding:R.z.number().min(0).optional(),shape:Vn.optional(),plate:R.z.string().optional()}),pi=.1,di=.3;var fi=2,Us=R.z.object({size:R.z.number().min(pi).max(di).optional(),padding:R.z.number().min(0).max(fi).optional(),x:R.z.number().min(0).max(1).optional(),y:R.z.number().min(0).max(1).optional(),shape:Vn.optional(),plate:R.z.string().optional()}),hi=R.z.enum(["L","M","Q","H"]),gi=.5,yi=1,Yn=.07,bi=["square","circle","heart"],xi=R.z.enum(bi),jn=3,mt=64,_t=8,Zn=.42,Si=R.z.object({type:R.z.literal("silhouette"),width:R.z.number().int().min(_t).max(mt),height:R.z.number().int().min(_t).max(mt),cells:R.z.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"}),Mi=R.z.union([xi,Si]);var _e=R.z.object({outer:ut.optional(),inner:ut.optional()}),Ei=R.z.object({topLeft:_e.optional(),topRight:_e.optional(),bottomLeft:_e.optional()}),Hs=R.z.object({value:R.z.string(),size:R.z.number().optional(),level:hi.optional(),bgColor:ut.optional(),fgColor:ut.optional(),eyeColor:ut.optional(),dotColor:ut.optional(),bodyPattern:Hn.optional(),cornerEyePattern:Qn.optional(),cornerEyeDotPattern:Dn.optional(),margin:R.z.number().optional(),imageSettings:mi.optional(),isOGContext:R.z.boolean().optional(),templateId:R.z.string().optional(),customProps:R.z.record(R.z.string(),R.z.any()).optional(),frame:We.optional(),art:Bn.optional(),eyeColors:Ei.optional(),moduleScale:R.z.number().min(gi).max(yi).optional(),autoLevel:R.z.boolean().optional(),shape:Mi.optional()});var Fi={2:6,3:12};function Xn(t){let e=[t.start],n=t.start;for(let r of t.segments){let o=r.at(-1);if(r.length===1)e.push(o);else{let c=Fi[r.length];for(let s=1;s<=c;s++){let i=s/c,a=1-i;if(r.length===2){let[l]=r;e.push([a*a*n[0]+2*a*i*l[0]+i*i*o[0],a*a*n[1]+2*a*i*l[1]+i*i*o[1]])}else{let[l,u]=r;e.push([a*a*a*n[0]+3*a*a*i*l[0]+3*a*i*i*u[0]+i*i*i*o[0],a*a*a*n[1]+3*a*a*i*l[1]+3*a*i*i*u[1]+i*i*i*o[1]])}}}n=o}return e}function Kn(t,e){let n=[];for(let r of t)for(let o=0;o<r.length;o++){let[c,s]=r[o],[i,a]=r[(o+1)%r.length];s<=e!=a<=e&&n.push(c+(e-s)/(a-s)*(i-c))}return n.sort((r,o)=>r-o)}function Jn(t,e){let n=0;for(let r of t)if(r<e)n++;else break;return n%2===1}function Ci(t,e,n){return Jn(Kn(t,n),e)}function tr(t){let e=new Map;return(n,r)=>{let o=e.get(r);return o||(o=Kn(t,r),e.set(r,o)),Jn(o,n)}}function Pi(t,e,n,r){let o=n[0]-t,c=n[1]-e,s=r[0]-n[0],i=r[1]-n[1],a=u=>Math.max(Math.abs(o+u*s),Math.abs(c+u*i)),l=Math.min(a(0),a(1));for(let[u,m]of[[c-o,s-i],[-(o+c),s+i]])if(m!==0){let p=u/m;p>0&&p<1&&(l=Math.min(l,a(p)))}return l}function Ri(t,e,n){if(!Ci(t,e,n))return 0;let r=Number.POSITIVE_INFINITY;for(let o of t)for(let c=0;c<o.length;c++)r=Math.min(r,Pi(e,n,o[c],o[(c+1)%o.length]));return Number.isFinite(r)?r:0}function Ai(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let c of t)for(let[s,i]of c)e=Math.min(e,s),n=Math.min(n,i),r=Math.max(r,s),o=Math.max(o,i);return{x0:e,y0:n,x1:r,y1:o}}function er(t){let e=t.map(Xn),n=Ai(e),r=n.x1-n.x0,o=n.y1-n.y0;if(!(r>0&&o>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?Ri(e,y,h)/(2*g):0},s={cx:n.x0+r/2,cy:n.y0+o/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+r*h/i,x=n.y0+o*y/i,d=c(g,x);d>s.value&&(s={cx:g,cy:x,value:d})}let a=r/i,l=o/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(Xn),half:s.value}}function nr(t,e){let n=([o,c])=>`${b(o*e)} ${b(c*e)}`,r="";for(let o of t.rings){r+=`M${n(o.start)}`;for(let c of o.segments){let s=c.length===1?"L":c.length===2?"Q":"C";r+=s+c.map(n).join(" ")}r+="Z"}return r}var wi={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]]]},Wn;function rr(){return Wn??=er([wi]),Wn}function Li(t){let{width:e,height:n,cells:r}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=_t&&n>=_t&&e<=mt&&n<=mt&&typeof r=="string"&&r.length===e*n&&/^[01]*$/.test(r)?(o,c)=>o>=0&&c>=0&&o<e&&c<n&&r[c*e+o]==="1":null}var K=([t,e])=>`${t},${e}`;function Ii(t,e,n){let r=(a,l)=>t(a-1,l-1),o=new Map,c=(a,l)=>{for(let[u,m]of[[a,l],[l,a]]){let p=o.get(K(u))??[];p.push(m),o.set(K(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=[],i=new Set;for(let[a,l]of o){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(K(y));){i.add(K(y)),p.push(y);let h=vi(o.get(K(y))??[],f,i);if(!h)break;f=y,y=h}p.length>=3&&s.push(_i(p))}return s}function vi(t,e,n){let r=K(e);return t.find(o=>K(o)!==r&&!n.has(K(o)))??t.find(o=>K(o)!==r)}function _i(t){let e=[];for(let n=0;n<t.length;n++){let r=t[(n-1+t.length)%t.length],o=t[n],c=t[(n+1)%t.length],s=(o[0]-r[0])*(c[1]-o[1])-(o[1]-r[1])*(c[0]-o[0]);Math.abs(s)>1e-9&&e.push(o)}return e.length>=3?e:t}function $i(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]),o=t.map((c,s)=>[c,e(c,t[(s+1)%n])]);return{start:r,segments:o}}var $t=new Map;function or(t){let e=`${t.width}x${t.height}:${t.cells}`,n=$t.get(e);if(n)return n;let r=Li(t),o;if(!r)o={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=Ii(r,t.width,t.height),s=c.length>0?er(c.map($i)):null;o=s&&2*s.half>=Zn?{outline:s,problem:null}:{outline:null,problem:s?"thin":"empty"}}else o={outline:null,problem:"empty"};return $t.size>16&&$t.delete($t.keys().next().value),$t.set(e,o),o}var Ti=1,ir=.5,ar=.5,Ni=.5;function ne(t){return Math.max(t,jn)}function $e(t){return t==="heart"?rr():typeof t=="object"&&t?.type==="silhouette"?or(t).outline:null}function ot(t,e,n){if(n==="circle"){let s=ne(e),i=(t/2+s)*Math.SQRT2+Ti;return Math.ceil(i-t/2)}let r=$e(n);if(!r)return e;let o=ne(e),c=(t+2*(o+Ni))/(2*r.half);return Math.ceil((c-t)/2-1e-9)}function sr(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 Oi(t,e,n){let r=ot(e,n,"circle"),o=ne(n),c=e+2*r,s=c/2,i=s-ir-.5,a=sr(Number.parseInt(Me(t),36)||1),l=r-o,u=r+e+o;return Array.from({length:c},(m,p)=>Array.from({length:c},(f,y)=>{let h=a()<ar;return y>=l&&y<u&&p>=l&&p<u?!1:h&&Math.hypot(y+.5-s,p+.5-s)<=i}))}var ki=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Te(t,e,n,r){if(r==="circle")return Oi(t,e,n);let o=$e(r);if(!o)return null;let c=ot(e,n,r),s=ne(n),i=e+2*c,a=tr(o.polygons),l=.5+ir,u=(y,h)=>{let g=y+.5,x=h+.5;return a(g/i,x/i)?ki.every(([d,C])=>a((g+d*l)/i,(x+C*l)/i)):!1},m=sr(Number.parseInt(Me(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()<ar;return x>=p&&x<f&&h>=p&&h<f?!1:d&&u(x,h)}))}function Ne(t,e){if(t==="circle")return{circle:e/2};let n=$e(t);return n?{path:nr(n,e)}:null}function lr(t,e){return t.slice().map((n,r)=>r<e.y||r>=e.y+e.h?n:n.map((o,c)=>c<e.x||c>=e.x+e.w?o:!1))}function Oe(t,e=0){let n=[];return t.forEach((r,o)=>{let c=null;r.forEach((s,i)=>{if(!s&&c!==null){n.push(Qt`M${c+e} ${o+e}h${i-c}v1H${c+e}z`),c=null;return}if(i===r.length-1){if(!s)return;c===null?n.push(Qt`M${i+e},${o+e} h1v1H${i+e}z`):n.push(Qt`M${c+e},${o+e} h${i+1-c}v1H${c+e}z`);return}s&&c===null&&(c=i)})}),n.join("")}function Tt(t,e,n,r){if(r==null)return null;let o=t.length,c=Math.floor(e*Gt),s=(o+2*n)/e,i=(r.width||c)*s,a=(r.height||c)*s,l=r.x==null?o/2-i/2:r.x*s,u=r.y==null?o/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(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 re(t){let e=t.level??xt,{imageSettings:n}=t,r=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&r!=="H"){let o=Q.QrCode.encodeText(t.value,et[r]).getModules(),c=Tt(o,t.size??Bt,ot(o.length,t.margin??Dt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(o.length*o.length)>Yn&&(r="H")}return r}var ke=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var zi=.6,Bi=["L","M","Q","H"];function qi(t){let e=Q.QrCode.encodeText(t.value,et[t.level]),n=Bi[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:ot(e.size,t.margin,t.shape),map:Nn(e.version,n),level:n,version:e.version}}function Di(t,e){let{cells:n,map:r}=t,o=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(o,s.y+s.h);l++)for(let u=Math.max(0,s.x);u<Math.min(o,s.x+s.w);u++)i.push(l*o+u);let a=On(r,i);return{worst:Math.max(0,...a),correctable:r.correctable,budget:Math.floor(r.correctable*zi),level:t.level,version:t.version}}var Gi=t=>!t||t.worst<=t.budget;function Qi(t,e,n,r){let o=e.map(i=>qi({...t,level:i})),c=i=>{let a=r(i);return o.every(l=>Gi(Di(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 cr(t,e){if(!e)return;let n=Math.floor(t.size*Gt),r=e.width||n,o=e.height||n,c=p=>{if(p===r)return e;let f=o*p/r;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(r-p)/2},...e.y!=null&&{y:e.y+(o-f)/2}}},s=t.level??xt,i={value:t.value,size:t.size,margin:t.margin,shape:t.shape},a=p=>re({...t,level:s,imageSettings:p}),l=p=>{let f=Qi(i,[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)}var dt=require("react/jsx-runtime");function Ui(t){let{value:e,size:n=Bt,level:r=xt,bgColor:o=nt,fgColor:c=qt,margin:s=Dt,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=cr({value:e,size:n,margin:s,level:r,shape:w,autoLevel:I},a),H=re({value:e,size:n,level:r,margin:s,imageSettings:B,autoLevel:I,shape:w}),Y=B?.src,D=vn(d)?_n(n,d,o):null,J=D?.width??n,it=D?.height??n,ft=(0,pt.useRef)(null),G=(0,pt.useRef)(null),[U,V]=(0,pt.useState)(!1);(0,pt.useEffect)(()=>{if(ft.current!=null){let Ft=ft.current,v=Ft.getContext("2d");if(!v)return;let j=Q.QrCode.encodeText(e,et[H]).getModules(),tt=ot(j.length,s,w),oe=Te(e,j.length,s,w),gt=j.length+tt*2,at=Tt(j,n,tt,B),Ot=G.current,ze=at!=null&&Ot?.complete&&Ot.naturalHeight!==0&&Ot.naturalWidth!==0;ze&&at.excavation!=null&&(j=lr(j,at.excavation));let kt=window.devicePixelRatio||1;Ft.width=J*kt,Ft.height=it*kt,v.scale(kt,kt),D&&($n(v,D),v.translate(D.qrX,D.qrY));let Be=n/gt;v.scale(Be,Be),v.fillStyle=vt(o,nt);let Ct=Ne(w,gt);if(Ct&&"circle"in Ct?(v.beginPath(),v.arc(gt/2,gt/2,Ct.circle,0,2*Math.PI),v.fill()):Ct&&ke?v.fill(new Path2D(Ct.path),"evenodd"):v.fillRect(0,0,gt,gt),v.fillStyle=vt(c,qt),ke)v.fill(new Path2D(Oe(j,tt))),oe&&v.fill(new Path2D(Oe(oe,0)));else for(let[zt,yt]of[[j,tt],[oe??[],0]])zt.forEach((Pt,st)=>{Pt.forEach((ur,mr)=>{ur&&v.fillRect(mr+yt,st+yt,1,1)})});if(ze){let zt={x:at.x+tt,y:at.y+tt,w:at.w,h:at.h},yt=B?.shape??"square",Pt=B?.plate,st=Tn(zt,Pt);v.save(),Pt&&(Ae(v,yt,zt),v.fillStyle=Pt,v.fill()),yt!=="square"&&(Ae(v,yt,st),v.clip()),v.drawImage(Ot,st.x,st.y,st.w,st.h),v.restore()}}});let ht={height:it,width:J,...i},Nt=null;return Y!=null&&(Nt=(0,dt.jsx)("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:G,src:Y,style:{display:"none"}},Y)),(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)("canvas",{height:it,ref:ft,style:ht,width:J,...N}),Nt]})}0&&(module.exports={QRCodeCanvas});
1
+ "use strict";"use client";var ae=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var fr=Object.getOwnPropertyNames;var hr=Object.prototype.hasOwnProperty;var gr=(t,e)=>{for(var n in e)ae(t,n,{get:e[n],enumerable:!0})},yr=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of fr(e))!hr.call(t,r)&&r!==n&&ae(t,r,{get:()=>e[r],enumerable:!(o=dr(e,r))||o.enumerable});return t};var br=t=>yr(ae({},"__esModule",{value:!0}),t);var Yi={};gr(Yi,{QRCodeCanvas:()=>Vi});module.exports=br(Yi);var pt=require("react");var bt;(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})(bt||={});(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||={})})(bt||={});(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||={})})(bt||={});var Q=bt;var et={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},qt=128,xt="Q",nt="#FFFFFF",Dt="#000000";var Gt=0;var Qt=.1;var X=require("zod"),xr=["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"],St=24;var se=.5,Mt=1.5,Sr=X.z.enum(xr),le=X.z.object({style:Sr,text:X.z.string().max(St).optional(),color:X.z.string().optional(),textColor:X.z.string().optional(),secondaryText:X.z.string().max(St).optional(),secondaryColor:X.z.string().optional(),fontScale:X.z.number().min(se).max(Mt).optional()});var S=require("zod");function Mr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function b(t,e=3){return String(Mr(t,e))}function Ut(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 Er={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Fr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,ce=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function At(t,e=Number.POSITIVE_INFINITY){if(!Fr.test(t))return null;let n=[],o=0,r=()=>{for(;o<t.length&&/[\s,]/.test(t[o]);)o++},c=()=>{r(),ce.lastIndex=o;let a=ce.exec(t);if(!a)return null;let l=a[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;o=ce.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=Er[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 De(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ue(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 Qe(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 Ht(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(Ge(a,i,u,l)),o.push(i)):u>=0&&o.push(Ge(a,i,u,l))}}return o.length>2?o:[]}function Ge(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 Ue(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,o])=>`${b(n)} ${b(o)}`).join("L")}Z`).join("")}function He(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 me=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Cr(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,ht)=>Math.atan2(G*ht-U*V,G*V+U*ht),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,J=4/3*Math.tan(D/4),it=(G,U)=>[I+l*p*G-u*f*U,w+l*f*G+u*p*U],ft=[];for(let G=0;G<Y;G++){let U=B+G*D,V=U+D,[ht,kt]=it(Math.cos(U)-J*Math.sin(U),Math.sin(U)+J*Math.cos(U)),[Ct,v]=it(Math.cos(V)+J*Math.sin(V),Math.sin(V)-J*Math.cos(V)),[j,tt]=G===Y-1?[i,a]:it(Math.cos(V),Math.sin(V));ft.push({op:"C",x1:ht,y1:kt,x2:Ct,y2:v,x:j,y:tt})}return ft}function Vt(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(),me.lastIndex=n;let y=me.exec(t);return y?(n=me.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(...Cr(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 Ve=.5522847498;function pe(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*Ve,l=i*Ve,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 Pr="qrdx.frame",Rr=1,he="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:St},Ar=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],jt=.95,wr=200,Lr=["frame","text","accent","background"],Ir=/[\t\n\v\f\r\u0085\u2028\u2029]/g,vr=/[\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 ge(t,e=St){let n=t.slice(0,1e3).normalize("NFC").replace(Ir," ").replace(vr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var ye=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,_=S.z.number().min(-k.maxCoordinate).max(k.maxCoordinate).refine(ye,{message:`Numbers may have at most ${k.maxDecimals} decimals`}),O=_.refine(t=>t>0,{message:"Must be greater than 0"}),Yt=_.refine(t=>t>=0,{message:"Must not be negative"}),wt=S.z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),Ye=S.z.union([S.z.enum(Lr),wt]),Xe=t=>S.z.object({mix:S.z.tuple([t,t]),amount:S.z.number().min(0).max(1).refine(ye)}).strict(),Et=S.z.union([Ye,Xe(Ye)]),_r=S.z.union([wt,Xe(S.z.union([S.z.enum(["frame","accent","background"]),wt]))]),lt=S.z.union([Et,S.z.object({gradient:S.z.object({from:Et,to:Et,direction:S.z.enum(["horizontal","vertical"]).optional(),steps:S.z.int().min(2).max(k.maxGradientSteps).optional()}).strict()}).strict()]),de={x:_,y:_,width:O,height:O},Lt=S.z.object({color:Et,width:O}).strict(),Tr=S.z.object({type:S.z.literal("rect"),...de,radius:Yt.optional(),fill:lt,hole:S.z.object({...de,radius:Yt.optional()}).strict().optional(),stroke:Lt.optional()}).strict(),$r=S.z.object({type:S.z.literal("circle"),cx:_,cy:_,r:O,hole:O.optional(),fill:lt,stroke:Lt.optional()}).strict(),Nr=S.z.object({type:S.z.literal("ellipse"),cx:_,cy:_,rx:O,ry:O,fill:lt,stroke:Lt.optional()}).strict(),kr=S.z.object({type:S.z.literal("polygon"),points:S.z.array(S.z.tuple([_,_])).min(3).max(k.maxPolygonPoints),fill:lt,stroke:Lt.optional()}).strict(),Or=S.z.object({type:S.z.literal("path"),d:S.z.string().min(2).max(k.maxPathLength),fill:lt,fillRule:S.z.enum(["nonzero","evenodd"]).optional(),stroke:Lt.optional()}).strict(),zr=S.z.object({type:S.z.literal("line"),x1:_,y1:_,x2:_,y2:_,width:O,cap:S.z.enum(["butt","round"]).optional(),dash:S.z.tuple([O,O]).optional(),fill:lt}).strict(),Br=S.z.object({type:S.z.literal("icon"),icon:S.z.enum(Ar),x:_,y:_,size:O,fill:lt}).strict(),qr=S.z.discriminatedUnion("type",[Tr,$r,Nr,kr,Or,zr,Br]),We={id:S.z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:S.z.enum(["primary","secondary","fixed"]),text:S.z.string().max(200),maxLength:S.z.int().min(1).max(St).optional(),color:Et,weight:S.z.enum(["bold","regular"]).optional(),collapse:S.z.object({y:_,height:O}).strict().optional()},Dr=S.z.object({type:S.z.literal("text"),...We,box:S.z.object(de).strict(),align:S.z.enum(["start","middle","end"]).optional(),fontSize:O.optional()}).strict(),Gr=S.z.object({type:S.z.literal("curved"),...We,curve:S.z.object({cx:_,cy:_,radius:O,side:S.z.enum(["top","bottom"]),spread:S.z.number().min(20).max(300).refine(ye).optional()}).strict(),fontSize:O}).strict(),Qr=S.z.discriminatedUnion("type",[Dr,Gr]),je=_.refine(t=>t>=k.minArtboard&&t<=k.maxArtboard,{message:`Artboard sides must be ${k.minArtboard} to ${k.maxArtboard} units`}),Ur=S.z.object({kind:S.z.literal(Pr),version:S.z.literal(Rr),artboard:S.z.object({width:je,height:je}).strict(),qr:S.z.object({x:_,y:_,size:O,padding:Yt.optional(),radius:Yt.optional(),plate:S.z.enum(["opaque","background","none"]).optional()}).strict(),colors:S.z.object({frame:wt,text:_r.optional(),accent:wt.optional()}).strict(),shapes:S.z.array(qr).max(k.maxShapes),labels:S.z.array(Qr).max(k.maxLabels),bleed:S.z.union([S.z.literal("none"),Et]).optional()}).strict();function be(t){let e=Zt(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 Hr(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 Zt(t){return t.qr.padding??t.qr.size*k.defaultPadding}var xe=.52,Vr=.35;function Yr(t){let e=t.fontSize??t.box.height*xe;return Math.min(e*Mt,t.box.height*jt)}var fe=(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 Ze(t){let e=be(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 jr([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 Zr(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 Xr(t,e,n){let o=be(e);if(!fe(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!Ze(e).every(c=>jr(c,r,r.radius??0))}if(t.type==="circle"&&t.hole){let r=t.hole;return!Ze(e).every(([c,s])=>Math.hypot(c-t.cx,s-t.cy)<=r+.01)}if(t.type==="polygon"){let r=Ht(t.points,o);return r.length>2&&Zr(r)>1e-6}return!0}function Se(t){let e=Wr(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 Wr(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=At(t.d,k.maxDecimals);return e?{bounds:He(Vt(t.d)),segments:De(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:wr}}}function Kr(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=Zt(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=be(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}=Se(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"&&Xr(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!==ge(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*jt+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=Yr(d)*Vr,w={x0:P.x0,x1:P.x1,y0:E-I,y1:E+I};(fe(P,Hr(t))||fe(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*Mt*.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 Me=Ur.superRefine(Kr);var Jr=le.extend({style:S.z.literal(he),spec:Me}),Ke=S.z.discriminatedUnion("style",[le,Jr]);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 Xt(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 Ee(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 tn=24,rt=(t,e,n,o)=>{let r=o*Math.PI/180;return[t+n*Math.cos(r),e+n*Math.sin(r)]},Wt=([t,e])=>`${b(t)} ${b(e)}`;function Ft(t,e,n,o,r,c){let s=c-r>180?1:0;return`M${Wt(rt(t,e,o,r))}A${b(o)} ${b(o)} 0 ${s} 1 ${Wt(rt(t,e,o,c))}L${Wt(rt(t,e,n,c))}A${b(n)} ${b(n)} 0 ${s} 0 ${Wt(rt(t,e,n,r))}Z`}function It(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){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 en(t){return q(to(t)<0?[...t].reverse():t)}function Kt(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 en([[t+s,e+i],[n+s,o+i],[n-s,o-i],[t-s,e-i]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),W=(...t)=>({d:t.join(""),fillRule:"evenodd"});function eo(){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(Kt(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(Kt(o,r,s,i,1.7))}}return z(...t)}var no={wifi:()=>z(Ft(12,20,4.6,7.2,-135,-45),Ft(12,20,9.2,11.8,-135,-45),Ft(12,20,13.8,16.4,-135,-45),T(12,20,2.2)),star:()=>z(q(Xt(12,12.8,11.6,4.8))),heart:()=>z(Je(12,12.4,22)),phone:()=>W(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(Ft(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>W(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:()=>W(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),Ft(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",Ft(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:()=>W(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:()=>W(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:()=>W(T(12,12,10.5),T(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>W(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:()=>W("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(Kt(6,12,18,5,1.8),Kt(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:()=>W(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:eo,pumpkin:()=>z(It(7.8,14.6,5.8,6.9),It(16.2,14.6,5.8,6.9),It(12,14.6,4.8,7.4),A(10.9,3.4,2.2,4.6,.8),en([[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(Xt(9.5,13.5,9,2.4,4)),q(Xt(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),It(8.8,4.8,2.9,1.9),It(15.2,4.8,2.9,1.9))};function nn(t){return no[t]()}var ro={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 rn(t,e){let n=t.trim(),o=Number.parseFloat(n);return Number.isNaN(o)?Number.NaN:n.endsWith("%")?o/100*e:o}function vt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=ro[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=>rn(f,255)),m=i===void 0?1:rn(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 on(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Ce(t){let e=0;for(let n of t)e+=on(n);return Math.max(e,1)}var Fe=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function Jt(t,e,n){let o=vt(t)??{r:0,g:0,b:0,a:1},r=vt(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${Fe(o.r+(r.r-o.r)*c)}${Fe(o.g+(r.g-o.g)*c)}${Fe(o.b+(r.b-o.b)*c)}`}function an(t,e,n,o,r,c,s,i){let a=[...t],l=r*.08,u=a.map(h=>on(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 _t(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 te=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},sn=new WeakMap;function Pe(t){if(t&&typeof t=="object"){let n=sn.get(t);if(n)return n}if(t==null)throw new te(['A "custom" frame needs a spec']);let e=Me.safeParse(t);if(!e.success)throw new te(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&sn.set(t,e.data),e.data}var oo=t=>{let e=vt(t);return!!(e&&e.a>=1)};function io(t,e){let n=_t(e,nt);return t.qr.plate==="none"?{color:n,plate:!1}:oo(n)?{color:n,plate:!0}:t.qr.plate==="background"?{color:n,plate:!1}:{color:nt,plate:!0}}function cn(t,e,n=nt){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:Jt(c(s.mix[0]),c(s.mix[1]),s.amount));return{frame:o,text:i,accent:r}}function ao(t,e,n){let o=cn(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):Jt(r(c.mix[0]),r(c.mix[1]),c.amount)}function ln(t,e,n=0,o=0){let r=At(t);return r?ue(r,e,n,o):""}function so(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 lo(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 co(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:so(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:ln(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return lo(t,e);default:{let n=nn(t.icon);return{type:"path",d:ln(n.d,t.size*e/tn,t.x*e,t.y*e),fillRule:n.fillRule}}}}function uo(t){if(t.type==="rect"){let{x:e,y:n,width:o,height:r,radius:c,hole:s}=t;return[...pe(e,n,o,r,c,c),...s?pe(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"}]:Vt(t.d)}function mo(t,e,n){let o=uo(t),r=Qe(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=>Ht(F,C)).filter(F=>F.length>2);M.length!==0&&h.push({type:"path",d:Ue(M),fill:Jt(m,p,(g+.5)/u),fillRule:c})}return h}function po(t,e,n){let o=co(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=mo(o,t.fill.gradient,n);return r?[...c,{...o,fill:"none",...r}]:c}return[{...o,fill:n(t.fill),...r}]}function fo(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 ge(o,n)}function ho(t){return t===void 0||!Number.isFinite(t)?1:Math.min(Mt,Math.max(se,t))}function go(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/(Ce(e)+.08*e.length));return an(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*xe)*o,f=Math.min(p*n,m*jt,u/Ce(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 yo(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 bo(t,e){let n=At(t);return n?ue(yo(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 xo(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:bo(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function So(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}=Se(r);return!(c&&o(c.y0,c.y1))}).map(r=>xo(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 Re(t,e,n,o,r={}){let c=new Map(e.labels.map(g=>[g.id,fo(g,n)])),s=So(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),i=t/s.qr.size,a=io(s,o),l=ao(n,s,a.color),u=s.shapes.flatMap(g=>po(g,i,l));if(a.plate){let g=Zt(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=ho(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 go(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 un(t,e,n){return Re(t,Pe(e.spec),e,n)}var mn={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 Ae={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 pn={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 dn={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 fn={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 hn={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 gn={kind:"qrdx.frame",version:1,artboard:{width:1978.214,height:1978.214},qr:{x:489.107,y:489.107,size:1e3,padding:50,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"circle",cx:989.107,cy:989.107,r:779.107,fill:"background"},{type:"circle",cx:989.107,cy:989.107,r:989.107,hole:779.107,fill:"frame"},{type:"circle",cx:105,cy:989.107,r:14.7,fill:"text"},{type:"circle",cx:1873.214,cy:989.107,r:14.7,fill:"text"}],labels:[{type:"curved",id:"top",slot:"primary",text:"Scan me",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"top",spread:140},fontSize:105},{type:"curved",id:"bottom",slot:"secondary",text:"",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"bottom",spread:140},fontSize:105}]};var yn={kind:"qrdx.frame",version:1,artboard:{width:1320,height:1558},qr:{x:160,y:130,size:1e3,padding:60},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:370,width:1320,height:1188,fill:{mix:["frame","#FFFFFF"],amount:.45}},{type:"polygon",points:[[0,370],[660,0],[1320,370]],fill:{mix:["frame","#FFFFFF"],amount:.25}},{type:"rect",x:80,y:50,width:1160,height:1268,fill:"background"},{type:"rect",x:68,y:38,width:1184,height:1280,fill:"frame",hole:{x:80,y:50,width:1160,height:1268}},{type:"polygon",points:[[0,1178],[660,1318],[1320,1178],[1320,1558],[0,1558]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:160,y:1318,width:1e3,height:220}}]};var bn={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 ee={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 xn={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 Sn={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 Mn={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 En={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 Fn={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 Cn={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 Pn={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 Rn={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 An={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}),wn=[$("banner-bottom","Banner",Ae,"frame",["bottom","band"]),$("banner-top","Top banner",pn,"frame",["top","band"]),$("banner-top-bottom","Two banners",dn,"frame",["top","bottom","band"]),$("border","Border",fn,"background",["square","outline"]),$("rounded-border","Rounded",En,"background",["border","outline"]),$("gradient-border","Gradient",ee,"background",["border","colorful"]),$("focus","Focus",bn,"background",["corners","brackets"]),$("speech-bubble","Bubble",Fn,"frame",["speech"]),$("speech-bubble-top","Bubble top",Cn,"frame",["speech"]),$("chat-bubble","Chat",hn,"frame",["message","bubble"]),$("circle","Circle",gn,"frame",["round","ring","curved"]),$("badge","Ribbon",mn,"frame",["badge","banner"]),$("sticker","Sticker",Pn,"frame",["label"]),$("polaroid","Polaroid",Mn,"frame",["photo","picture"]),$("phone","Phone",Sn,"background",["mobile","screen"]),$("ticket","Ticket",An,"frame",["event","pass"]),$("tag","Tag",Rn,"frame",["price","label"]),$("envelope","Envelope",yn,"frame",["mail","letter"]),$("menu-card","Menu card",xn,"background",["menu","restaurant"])],qo=new Map(wn.map(t=>[t.style,t]));function Do(t){return qo.get(t)}var ys=Object.fromEntries(wn.map(t=>[t.style,t.spec])),bs={from:ee.colors.frame,to:ee.colors.accent};var Go={primary:"text",secondary:"secondaryText"};function Ln(t,e,n){let o=Do(e.style)?.spec??Ae;return Re(t,Pe(o),e,n,Go)}var Qo="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function _n(t){return!!(t?.style&&t.style!=="none")}function Tn(t,e,n){return e.style===he?un(t,e,n):Ln(t,e,n)}function Uo(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function $n(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 Uo(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${Qo}`,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 Ho=.22,Vo=.14;function Yo(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 we(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)*Ho: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 Nn(t,e){return e?Yo(t,Vo):t}var{QrCode:Le}=Q,jo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function Zo(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 Xo(t,e){let n=t*4+17,o=et[e].ordinal,r=Le.NUM_ERROR_CORRECTION_BLOCKS[o]?.[t]??0,c=Le.ECC_CODEWORDS_PER_BLOCK[o]?.[t]??0,s=Math.floor(Le.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=Zo(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=jo[`${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 Wo=8,ct=new Map;function kn(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=Xo(t,e);if(ct.size>=Wo){let c=ct.keys().next().value;c!==void 0&&ct.delete(c)}return ct.set(n,r),r}function On(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}var R=require("zod");var Z=require("zod"),Ko=["logo","halftone"],Jo=Z.z.enum(Ko),zn={logo:["blend","badge"],halftone:["color","mono"]},ti=Z.z.enum([...zn.logo,...zn.halftone]),ne=192,Bn=t=>Math.ceil(t/3)*4,ei=Z.z.object({width:Z.z.number().int().min(1).max(ne),height:Z.z.number().int().min(1).max(ne),data:Z.z.string().max(Bn(ne*ne*4))}).refine(t=>t.data.length===Bn(t.width*t.height*4),{message:"Art image data does not match its width and height"}),qn=Z.z.object({mode:Jo,image:ei,intensity:Z.z.number().min(0).max(1).optional(),variant:ti.optional(),matchEyes:Z.z.boolean().optional()});var L=require("zod"),Ns=L.z.enum(["solid","linear","radial","angular","image"]),ni=L.z.object({type:L.z.literal("solid"),color:L.z.string()}),Ie=L.z.object({color:L.z.string(),offset:L.z.number().min(0).max(100)}),ri=L.z.object({type:L.z.literal("linear"),stops:L.z.array(Ie).min(2),angle:L.z.number().optional().default(0)}),oi=L.z.object({type:L.z.literal("radial"),stops:L.z.array(Ie).min(2)}),ii=L.z.object({type:L.z.literal("angular"),stops:L.z.array(Ie).min(2),angle:L.z.number().optional().default(0)}),ai=L.z.enum(["cover","contain","tile"]),si=L.z.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),li=L.z.object({type:L.z.literal("image"),src:L.z.string().min(1),fit:ai.optional().default("cover"),scale:L.z.number().min(.1).max(4).optional().default(1),position:si.optional().default("center"),opacity:L.z.number().min(0).max(1).optional().default(1),underlay:L.z.string().optional()}),ut=L.z.union([L.z.string(),ni,ri,oi,ii,li]);var ve=require("zod"),Dn=["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"],ci=["diamond","star","banner"],Gn=ve.z.enum([...Dn,...ci]),Os=ve.z.enum(Dn);var _e=require("zod"),Qn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ui=["curly"],Un=_e.z.enum([...Qn,...ui]),Bs=_e.z.enum(Qn);var Hn=require("zod"),mi=["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"],Vn=Hn.z.enum(mi);var pi=["square","rounded","circle"],Yn=R.z.enum(pi),di=R.z.object({src:R.z.string(),height:R.z.number(),width:R.z.number(),excavate:R.z.boolean(),x:R.z.number().optional(),y:R.z.number().optional(),padding:R.z.number().min(0).optional(),shape:Yn.optional(),plate:R.z.string().optional()}),fi=.1,hi=.3;var gi=2,js=R.z.object({size:R.z.number().min(fi).max(hi).optional(),padding:R.z.number().min(0).max(gi).optional(),x:R.z.number().min(0).max(1).optional(),y:R.z.number().min(0).max(1).optional(),shape:Yn.optional(),plate:R.z.string().optional()}),yi=R.z.enum(["L","M","Q","H"]),bi=.5,xi=1,jn=.07,Si=["square","circle","heart"],Mi=R.z.enum(Si),Zn=3,mt=64,Tt=8,Xn=.42,Ei=R.z.object({type:R.z.literal("silhouette"),width:R.z.number().int().min(Tt).max(mt),height:R.z.number().int().min(Tt).max(mt),cells:R.z.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.z.union([Mi,Ei]);var Te=R.z.object({outer:ut.optional(),inner:ut.optional()}),Ci=R.z.object({topLeft:Te.optional(),topRight:Te.optional(),bottomLeft:Te.optional()}),Zs=R.z.object({value:R.z.string(),size:R.z.number().optional(),level:yi.optional(),bgColor:ut.optional(),fgColor:ut.optional(),eyeColor:ut.optional(),dotColor:ut.optional(),bodyPattern:Vn.optional(),cornerEyePattern:Un.optional(),cornerEyeDotPattern:Gn.optional(),margin:R.z.number().optional(),imageSettings:di.optional(),isOGContext:R.z.boolean().optional(),templateId:R.z.string().optional(),customProps:R.z.record(R.z.string(),R.z.any()).optional(),frame:Ke.optional(),art:qn.optional(),eyeColors:Ci.optional(),moduleScale:R.z.number().min(bi).max(xi).optional(),autoLevel:R.z.boolean().optional(),shape:Fi.optional()});var Pi={2:6,3:12};function Wn(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=Pi[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 Jn(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 tr(t,e){let n=0;for(let o of t)if(o<e)n++;else break;return n%2===1}function Ri(t,e,n){return tr(Jn(t,n),e)}function er(t){let e=new Map;return(n,o)=>{let r=e.get(o);return r||(r=Jn(t,o),e.set(o,r)),tr(r,n)}}function Ai(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 wi(t,e,n){if(!Ri(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,Ai(e,n,r[c],r[(c+1)%r.length]));return Number.isFinite(o)?o:0}function Li(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 nr(t){let e=t.map(Wn),n=Li(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?wi(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(Wn),half:s.value}}function rr(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 Ii={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]]]},Kn;function or(){return Kn??=nr([Ii]),Kn}function vi(t){let{width:e,height:n,cells:o}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=Tt&&n>=Tt&&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 K=([t,e])=>`${t},${e}`;function _i(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(K(u))??[];p.push(m),r.set(K(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(K(y));){i.add(K(y)),p.push(y);let h=Ti(r.get(K(y))??[],f,i);if(!h)break;f=y,y=h}p.length>=3&&s.push($i(p))}return s}function Ti(t,e,n){let o=K(e);return t.find(r=>K(r)!==o&&!n.has(K(r)))??t.find(r=>K(r)!==o)}function $i(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 Ni(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 ir(t){let e=`${t.width}x${t.height}:${t.cells}`,n=$t.get(e);if(n)return n;let o=vi(t),r;if(!o)r={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=_i(o,t.width,t.height),s=c.length>0?nr(c.map(Ni)):null;r=s&&2*s.half>=Xn?{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 ki=1,ar=.5,sr=.5,Oi=.5;function re(t){return Math.max(t,Zn)}function $e(t){return t==="heart"?or():typeof t=="object"&&t?.type==="silhouette"?ir(t).outline:null}function ot(t,e,n){if(n==="circle"){let s=re(e),i=(t/2+s)*Math.SQRT2+ki;return Math.ceil(i-t/2)}let o=$e(n);if(!o)return e;let r=re(e),c=(t+2*(r+Oi))/(2*o.half);return Math.ceil((c-t)/2-1e-9)}function lr(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 zi(t,e,n){let o=ot(e,n,"circle"),r=re(n),c=e+2*o,s=c/2,i=s-ar-.5,a=lr(Number.parseInt(Ee(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()<sr;return y>=l&&y<u&&p>=l&&p<u?!1:h&&Math.hypot(y+.5-s,p+.5-s)<=i}))}var Bi=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Ne(t,e,n,o){if(o==="circle")return zi(t,e,n);let r=$e(o);if(!r)return null;let c=ot(e,n,o),s=re(n),i=e+2*c,a=er(r.polygons),l=.5+ar,u=(y,h)=>{let g=y+.5,x=h+.5;return a(g/i,x/i)?Bi.every(([d,C])=>a((g+d*l)/i,(x+C*l)/i)):!1},m=lr(Number.parseInt(Ee(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()<sr;return x>=p&&x<f&&h>=p&&h<f?!1:d&&u(x,h)}))}function ke(t,e){if(t==="circle")return{circle:e/2};let n=$e(t);return n?{path:rr(n,e)}:null}function cr(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 Oe(t,e=0){let n=[];return t.forEach((o,r)=>{let c=null;o.forEach((s,i)=>{if(!s&&c!==null){n.push(Ut`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(Ut`M${i+e},${r+e} h1v1H${i+e}z`):n.push(Ut`M${c+e},${r+e} h${i+1-c}v1H${c+e}z`);return}s&&c===null&&(c=i)})}),n.join("")}function Nt(t,e,n,o){if(o==null)return null;let r=t.length,c=Math.floor(e*Qt),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 oe(t){let e=t.level??xt,{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,et[o]).getModules(),c=Nt(r,t.size??qt,ot(r.length,t.margin??Gt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(r.length*r.length)>jn&&(o="H")}return o}var ze=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var qi=.6,Di=["L","M","Q","H"];function Gi(t){let e=Q.QrCode.encodeText(t.value,et[t.level]),n=Di[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:ot(e.size,t.margin,t.shape),map:kn(e.version,n),level:n,version:e.version}}function Qi(t,e){let{cells:n,map:o}=t,r=n.length,c=Nt(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=On(o,i);return{worst:Math.max(0,...a),correctable:o.correctable,budget:Math.floor(o.correctable*qi),level:t.level,version:t.version}}var Ui=t=>!t||t.worst<=t.budget;function Hi(t,e,n,o){let r=e.map(i=>Gi({...t,level:i})),c=i=>{let a=o(i);return r.every(l=>Ui(Qi(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 ur(t,e){if(!e)return;let n=Math.floor(t.size*Qt),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??xt,i={value:t.value,size:t.size,margin:t.margin,shape:t.shape},a=p=>oe({...t,level:s,imageSettings:p}),l=p=>{let f=Hi(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)}var dt=require("react/jsx-runtime");function Vi(t){let{value:e,size:n=qt,level:o=xt,bgColor:r=nt,fgColor:c=Dt,margin:s=Gt,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=ur({value:e,size:n,margin:s,level:o,shape:w,autoLevel:I},a),H=oe({value:e,size:n,level:o,margin:s,imageSettings:B,autoLevel:I,shape:w}),Y=B?.src,D=_n(d)?Tn(n,d,r):null,J=D?.width??n,it=D?.height??n,ft=(0,pt.useRef)(null),G=(0,pt.useRef)(null),[U,V]=(0,pt.useState)(!1);(0,pt.useEffect)(()=>{if(ft.current!=null){let Ct=ft.current,v=Ct.getContext("2d");if(!v)return;let j=Q.QrCode.encodeText(e,et[H]).getModules(),tt=ot(j.length,s,w),ie=Ne(e,j.length,s,w),gt=j.length+tt*2,at=Nt(j,n,tt,B),Ot=G.current,Be=at!=null&&Ot?.complete&&Ot.naturalHeight!==0&&Ot.naturalWidth!==0;Be&&at.excavation!=null&&(j=cr(j,at.excavation));let zt=window.devicePixelRatio||1;Ct.width=J*zt,Ct.height=it*zt,v.scale(zt,zt),D&&($n(v,D),v.translate(D.qrX,D.qrY));let qe=n/gt;v.scale(qe,qe),v.fillStyle=_t(r,nt);let Pt=ke(w,gt);if(Pt&&"circle"in Pt?(v.beginPath(),v.arc(gt/2,gt/2,Pt.circle,0,2*Math.PI),v.fill()):Pt&&ze?v.fill(new Path2D(Pt.path),"evenodd"):v.fillRect(0,0,gt,gt),v.fillStyle=_t(c,Dt),ze)v.fill(new Path2D(Oe(j,tt))),ie&&v.fill(new Path2D(Oe(ie,0)));else for(let[Bt,yt]of[[j,tt],[ie??[],0]])Bt.forEach((Rt,st)=>{Rt.forEach((mr,pr)=>{mr&&v.fillRect(pr+yt,st+yt,1,1)})});if(Be){let Bt={x:at.x+tt,y:at.y+tt,w:at.w,h:at.h},yt=B?.shape??"square",Rt=B?.plate,st=Nn(Bt,Rt);v.save(),Rt&&(we(v,yt,Bt),v.fillStyle=Rt,v.fill()),yt!=="square"&&(we(v,yt,st),v.clip()),v.drawImage(Ot,st.x,st.y,st.w,st.h),v.restore()}}});let ht={height:it,width:J,...i},kt=null;return Y!=null&&(kt=(0,dt.jsx)("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:G,src:Y,style:{display:"none"}},Y)),(0,dt.jsxs)(dt.Fragment,{children:[(0,dt.jsx)("canvas",{height:it,ref:ft,style:ht,width:J,...N}),kt]})}0&&(module.exports={QRCodeCanvas});
2
2
  /**
3
3
  * @license QR Code generator library (TypeScript)
4
4
  * Copyright (c) Project Nayuki.