qrdx 0.0.53 → 0.0.55

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/core.js +7 -7
  3. package/dist/core.js.map +1 -1
  4. package/dist/core.mjs +7 -7
  5. package/dist/core.mjs.map +1 -1
  6. package/dist/element.browser.mjs +6 -67
  7. package/dist/element.browser.mjs.map +1 -1
  8. package/dist/index.js +7 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +7 -7
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/qr-code-canvas.js +1 -1
  13. package/dist/qr-code-canvas.js.map +1 -1
  14. package/dist/qr-code-canvas.mjs +1 -1
  15. package/dist/qr-code-canvas.mjs.map +1 -1
  16. package/dist/schemas.js +2 -0
  17. package/dist/schemas.js.map +1 -0
  18. package/dist/schemas.mjs +2 -0
  19. package/dist/schemas.mjs.map +1 -0
  20. package/dist/src/art.d.ts +1 -1
  21. package/dist/src/art.d.ts.map +1 -1
  22. package/dist/src/engine.d.ts +2 -1
  23. package/dist/src/engine.d.ts.map +1 -1
  24. package/dist/src/eps.d.ts.map +1 -1
  25. package/dist/src/frame-import.d.ts +1 -1
  26. package/dist/src/frame-import.d.ts.map +1 -1
  27. package/dist/src/frame-spec.d.ts +5 -4
  28. package/dist/src/frame-spec.d.ts.map +1 -1
  29. package/dist/src/frame.d.ts +1 -1
  30. package/dist/src/frame.d.ts.map +1 -1
  31. package/dist/src/frames/builtin.d.ts +1 -1
  32. package/dist/src/frames/builtin.d.ts.map +1 -1
  33. package/dist/src/qr-outline.d.ts +1 -2
  34. package/dist/src/qr-outline.d.ts.map +1 -1
  35. package/dist/src/qr-shape.d.ts +1 -1
  36. package/dist/src/qr-shape.d.ts.map +1 -1
  37. package/dist/src/silhouette.d.ts +1 -2
  38. package/dist/src/silhouette.d.ts.map +1 -1
  39. package/dist/src/template/dot-ring-layout.d.ts +26 -3
  40. package/dist/src/template/dot-ring-layout.d.ts.map +1 -1
  41. package/dist/src/template/dot-ring.d.ts +22 -4
  42. package/dist/src/template/dot-ring.d.ts.map +1 -1
  43. package/dist/src/utils.d.ts +1 -1
  44. package/dist/src/utils.d.ts.map +1 -1
  45. package/dist/types/art.d.ts +1 -18
  46. package/dist/types/art.d.ts.map +1 -1
  47. package/dist/types/color-helpers.d.ts +26 -0
  48. package/dist/types/color-helpers.d.ts.map +1 -0
  49. package/dist/types/color.d.ts +1 -24
  50. package/dist/types/color.d.ts.map +1 -1
  51. package/dist/types/constants.d.ts +97 -0
  52. package/dist/types/constants.d.ts.map +1 -0
  53. package/dist/types/corner-dot.d.ts +2 -12
  54. package/dist/types/corner-dot.d.ts.map +1 -1
  55. package/dist/types/corner-eye.d.ts +2 -11
  56. package/dist/types/corner-eye.d.ts.map +1 -1
  57. package/dist/types/frame-spec-parse.d.ts +21 -0
  58. package/dist/types/frame-spec-parse.d.ts.map +1 -0
  59. package/dist/types/frame-spec-rules.d.ts +95 -0
  60. package/dist/types/frame-spec-rules.d.ts.map +1 -0
  61. package/dist/types/frame-spec.d.ts +2 -83
  62. package/dist/types/frame-spec.d.ts.map +1 -1
  63. package/dist/types/frame.d.ts +1 -8
  64. package/dist/types/frame.d.ts.map +1 -1
  65. package/dist/types/image-pattern.d.ts +1 -1
  66. package/dist/types/image-pattern.d.ts.map +1 -1
  67. package/dist/types/index.d.ts +3 -22
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/types/index.js +2 -2
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/types/index.mjs +2 -2
  72. package/dist/types/index.mjs.map +1 -1
  73. package/dist/types/plain.d.ts +17 -0
  74. package/dist/types/plain.d.ts.map +1 -0
  75. package/dist/types/qr.d.ts +2 -46
  76. package/dist/types/qr.d.ts.map +1 -1
  77. package/dist/types/schemas.d.ts +12 -0
  78. package/dist/types/schemas.d.ts.map +1 -0
  79. package/dist/vanilla.browser.mjs +28 -28
  80. package/dist/vanilla.browser.mjs.map +1 -1
  81. package/package.json +3 -3
  82. package/src/art.tsx +3 -6
  83. package/src/body-patterns.tsx +1 -1
  84. package/src/engine.ts +53 -1
  85. package/src/eps.ts +6 -1
  86. package/src/frame-import.ts +7 -6
  87. package/src/frame-spec.ts +17 -23
  88. package/src/frame.tsx +3 -2
  89. package/src/frames/builtin.ts +2 -5
  90. package/src/helpers.ts +1 -1
  91. package/src/qr-outline.ts +2 -2
  92. package/src/qr-shape.ts +2 -5
  93. package/src/rasterize.ts +1 -1
  94. package/src/scan-score.ts +2 -2
  95. package/src/silhouette.ts +2 -2
  96. package/src/template/dot-ring-layout.ts +281 -15
  97. package/src/template/dot-ring.tsx +27 -8
  98. package/src/utils/print-shared.ts +1 -1
  99. package/src/utils.tsx +6 -5
  100. package/types/art.ts +10 -20
  101. package/types/color-helpers.ts +132 -0
  102. package/types/color.ts +9 -122
  103. package/types/constants.ts +222 -0
  104. package/types/corner-dot.ts +8 -40
  105. package/types/corner-eye.ts +2 -31
  106. package/types/frame-spec-parse.ts +683 -0
  107. package/types/frame-spec-rules.ts +645 -0
  108. package/types/frame-spec.ts +38 -635
  109. package/types/frame.ts +14 -34
  110. package/types/image-pattern.ts +2 -26
  111. package/types/index.ts +6 -162
  112. package/types/plain.ts +117 -0
  113. package/types/qr.ts +29 -51
  114. package/types/schemas.ts +62 -0
@@ -1,4 +1,4 @@
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});
1
+ "use strict";"use client";var fe=Object.defineProperty;var Fr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var wr=Object.prototype.hasOwnProperty;var Rr=(t,e)=>{for(var n in e)fe(t,n,{get:e[n],enumerable:!0})},Pr=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ar(e))!wr.call(t,r)&&r!==n&&fe(t,r,{get:()=>e[r],enumerable:!(o=Fr(e,r))||o.enumerable});return t};var Cr=t=>Pr(fe({},"__esModule",{value:!0}),t);var Mi={};Rr(Mi,{QRCodeCanvas:()=>xi});module.exports=Cr(Mi);var dt=require("react");var xt;(c=>{class t{constructor(i,s,l,u){this.version=i;this.errorCorrectionLevel=s;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 h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let d=this.addEccAndInterleave(l);if(this.drawCodewords(d),u==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);let p=this.getPenaltyScore();p<h&&(u=b,h=p),this.applyMask(b)}}o(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(i,s){let l=c.QrSegment.makeSegments(i);return t.encodeSegments(l,s)}static encodeBinary(i,s){let l=c.QrSegment.makeBytes(i);return t.encodeSegments([l],s)}static encodeSegments(i,s,l=1,u=40,m=-1,d=!0){if(!(t.MIN_VERSION<=l&&l<=u&&u<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,b;for(h=l;;h++){let x=t.getNumDataCodewords(h,s)*8,M=r.getTotalBits(i,h);if(M<=x){b=M;break}if(h>=u)throw new RangeError("Data too long")}for(let x of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])d&&b<=t.getNumDataCodewords(h,x)*8&&(s=x);let p=[];for(let x of i){e(x.mode.modeBits,4,p),e(x.numChars,x.mode.numCharCountBits(h),p);for(let M of x.getData())p.push(M)}o(p.length==b);let g=t.getNumDataCodewords(h,s)*8;o(p.length<=g),e(0,Math.min(4,g-p.length),p),e(0,(8-p.length%8)%8,p),o(p.length%8==0);for(let x=236;p.length<g;x^=253)e(x,8,p);let f=[];for(;f.length*8<p.length;)f.push(0);return p.forEach((x,M)=>f[M>>>3]|=x<<7-(M&7)),new t(h,s,f,m)}size;mask;modules=[];isFunction=[];getModule(i,s){return 0<=i&&i<this.size&&0<=s&&s<this.size&&this.modules[s][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let 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(),s=i.length;for(let l=0;l<s;l++)for(let u=0;u<s;u++)l==0&&u==0||l==0&&u==s-1||l==s-1&&u==0||this.drawAlignmentPattern(i[l],i[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){let s=this.errorCorrectionLevel.formatBits<<3|i,l=s;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;let u=(s<<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 s=this.version<<12|i;o(s>>>18==0);for(let l=0;l<18;l++){let u=n(s,l),m=this.size-11+l%3,d=Math.floor(l/3);this.setFunctionModule(m,d,u),this.setFunctionModule(d,m,u)}}drawFinderPattern(i,s){for(let l=-4;l<=4;l++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(l)),d=i+u,h=s+l;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,m!=2&&m!=4)}}drawAlignmentPattern(i,s){for(let l=-2;l<=2;l++)for(let u=-2;u<=2;u++)this.setFunctionModule(i+u,s+l,Math.max(Math.abs(u),Math.abs(l))!=1)}setFunctionModule(i,s,l){this.modules[s][i]=l,this.isFunction[s][i]=!0}addEccAndInterleave(i){let s=this.version,l=this.errorCorrectionLevel;if(i.length!=t.getNumDataCodewords(s,l))throw new RangeError("Invalid argument");let u=t.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][s],m=t.ECC_CODEWORDS_PER_BLOCK[l.ordinal][s],d=Math.floor(t.getNumRawDataModules(s)/8),h=u-d%u,b=Math.floor(d/u),p=[],g=t.reedSolomonComputeDivisor(m);for(let x=0,M=0;x<u;x++){let F=i.slice(M,M+b-m+(x<h?0:1));M+=F.length;let E=t.reedSolomonComputeRemainder(F,g);x<h&&F.push(0),p.push(F.concat(E))}let f=[];for(let x=0;x<p[0].length;x++)p.forEach((M,F)=>{(x!=b-m||F>=h)&&f.push(M[x])});return o(f.length==d),f}drawCodewords(i){if(i.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=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 d=l-m,b=(l+1&2)==0?this.size-1-u:u;!this.isFunction[b][d]&&s<i.length*8&&(this.modules[b][d]=n(i[s>>>3],7-(s&7)),s++)}}o(s==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let l=0;l<this.size;l++){let u;switch(i){case 0:u=(l+s)%2==0;break;case 1:u=s%2==0;break;case 2:u=l%3==0;break;case 3:u=(l+s)%3==0;break;case 4:u=(Math.floor(l/3)+Math.floor(s/2))%2==0;break;case 5:u=l*s%2+l*s%3==0;break;case 6:u=(l*s%2+l*s%3)%2==0;break;case 7:u=((l+s)%2+l*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][l]&&u&&(this.modules[s][l]=!this.modules[s][l])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[m][p]==d?(h++,h==5?i+=t.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*t.PENALTY_N3),d=this.modules[m][p],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][m]==d?(h++,h==5?i+=t.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,b),d||(i+=this.finderPenaltyCountPatterns(b)*t.PENALTY_N3),d=this.modules[p][m],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,b)*t.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let d=0;d<this.size-1;d++){let h=this.modules[m][d];h==this.modules[m][d+1]&&h==this.modules[m+1][d]&&h==this.modules[m+1][d+1]&&(i+=t.PENALTY_N2)}let s=0;for(let m of this.modules)s=m.reduce((d,h)=>d+(h?1:0),s);let l=this.size*this.size,u=Math.ceil(Math.abs(s*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,s=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-=s)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 s=(16*i+128)*i+64;if(i>=2){let l=Math.floor(i/7)+2;s-=(25*l-10)*l-55,i>=7&&(s-=36)}return o(208<=s&&s<=29648),s}static getNumDataCodewords(i,s){return Math.floor(t.getNumRawDataModules(i)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let s=[];for(let u=0;u<i-1;u++)s.push(0);s.push(1);let l=1;for(let u=0;u<i;u++){for(let m=0;m<s.length;m++)s[m]=t.reedSolomonMultiply(s[m],l),m+1<s.length&&(s[m]^=s[m+1]);l=t.reedSolomonMultiply(l,2)}return s}static reedSolomonComputeRemainder(i,s){let l=s.map(u=>0);for(let u of i){let m=u^l.shift();l.push(0),s.forEach((d,h)=>l[h]^=t.reedSolomonMultiply(d,m))}return l}static reedSolomonMultiply(i,s){if(i>>>8||s>>>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^=(s>>>u&1)*i;return o(l>>>8==0),l}finderPenaltyCountPatterns(i){let s=i[1];o(s<=this.size*3);let l=s>0&&i[2]==s&&i[3]==s*3&&i[4]==s&&i[5]==s;return(l&&i[0]>=s*4&&i[6]>=s?1:0)+(l&&i[6]>=s*4&&i[0]>=s?1:0)}finderPenaltyTerminateAndCount(i,s,l){return i&&(this.finderPenaltyAddHistory(s,l),s=0),s+=this.size,this.finderPenaltyAddHistory(s,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(i,s){s[0]==0&&(i+=this.size),s.pop(),s.unshift(i)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}c.QrCode=t;function e(a,i,s){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let l=i-1;l>=0;l--)s.push(a>>>l&1)}function n(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}class r{constructor(i,s,l){this.mode=i;this.numChars=s;this.bitData=l;if(s<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}mode;numChars;bitData;static makeBytes(i){let s=[];for(let l of i)e(l,8,s);return new r(r.Mode.BYTE,i.length,s)}static makeNumeric(i){if(!r.isNumeric(i))throw new RangeError("String contains non-numeric characters");let s=[];for(let l=0;l<i.length;){let u=Math.min(i.length-l,3);e(parseInt(i.substr(l,u),10),u*3+1,s),l+=u}return new r(r.Mode.NUMERIC,i.length,s)}static makeAlphanumeric(i){if(!r.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],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,s)}return l<i.length&&e(r.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l)),6,s),new r(r.Mode.ALPHANUMERIC,i.length,s)}static makeSegments(i){return i==""?[]:r.isNumeric(i)?[r.makeNumeric(i)]:r.isAlphanumeric(i)?[r.makeAlphanumeric(i)]:[r.makeBytes(r.toUtf8ByteArray(i))]}static makeEci(i){let s=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)e(i,8,s);else if(i<16384)e(2,2,s),e(i,14,s);else if(i<1e6)e(6,3,s),e(i,21,s);else throw new RangeError("ECI assignment value out of range");return new r(r.Mode.ECI,0,s)}static isNumeric(i){return r.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return r.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,s){let l=0;for(let u of i){let m=u.mode.numCharCountBits(s);if(u.numChars>=1<<m)return 1/0;l+=4+m+u.bitData.length}return l}static toUtf8ByteArray(i){i=encodeURI(i);let s=[];for(let l=0;l<i.length;l++)i.charAt(l)!="%"?s.push(i.charCodeAt(l)):(s.push(parseInt(i.substr(l+1,2),16)),l+=2);return s}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}c.QrSegment=r})(xt||={});(e=>{let t;(o=>{class n{constructor(c,a){this.ordinal=c;this.formatBits=a}ordinal;formatBits;static LOW=new n(0,1);static MEDIUM=new n(1,0);static QUARTILE=new n(2,3);static HIGH=new n(3,2)}o.Ecc=n})(t=e.QrCode||={})})(xt||={});(e=>{let t;(o=>{class n{constructor(c,a){this.modeBits=c;this.numBitsCharCount=a}modeBits;numBitsCharCount;static NUMERIC=new n(1,[10,12,14]);static ALPHANUMERIC=new n(2,[9,11,13]);static BYTE=new n(4,[8,16,16]);static KANJI=new n(8,[8,10,12]);static ECI=new n(7,[0,0,0]);numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}o.Mode=n})(t=e.QrSegment||={})})(xt||={});var U=xt;var et={L:U.QrCode.Ecc.LOW,M:U.QrCode.Ecc.MEDIUM,Q:U.QrCode.Ecc.QUARTILE,H:U.QrCode.Ecc.HIGH},Qt=128,Mt="Q",nt="#FFFFFF",Ht="#000000";var Vt=0;var Yt=.1;var Ct=24;var Ve=.5,Lt=1.5;var Ye=.07;var Xe=3,de=64,he=8,Ze=.42;function Lr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function y(t,e=3){return String(Lr(t,e))}function Xt(t,...e){let n=t[0]??"";for(let o=0;o<e.length;o++){let r=e[o];n+=(typeof r=="number"?y(r):r)+(t[o+1]??"")}return n}var Ir={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},vr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,pe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function It(t,e=Number.POSITIVE_INFINITY){if(!vr.test(t))return null;let n=[],o=0,r=()=>{for(;o<t.length&&/[\s,]/.test(t[o]);)o++},c=()=>{r(),pe.lastIndex=o;let s=pe.exec(t);if(!s)return null;let l=s[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;o=pe.lastIndex;let m=Number(l);return Number.isFinite(m)?m:null},a=()=>{r();let s=t[o];return s==="0"||s==="1"?(o++,s==="1"?1:0):null},i=()=>(r(),o<t.length&&/[0-9.+-]/.test(t[o]));for(r();o<t.length;){let s=t[o],l=s.toUpperCase(),u=Ir[l];if(u===void 0||n.length===0&&l!=="M")return null;if(o++,u===0){n.push({command:s,values:[]}),r();continue}let m=s,d=!0;for(;d||i();){let h=[];for(let b=0;b<u;b++){let p=l==="A"&&(b===3||b===4)?a():c();if(p===null)return null;h.push(p)}n.push({command:m,values:h}),l==="M"&&(m=s==="M"?"L":"l"),d=!1}r()}return n}function We(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ge(t,e=1,n=0,o=0){let r="";for(let{command:c,values:a}of t){let i=c.toUpperCase(),s=c===i,l=s?n:0,u=s?o:0,m;switch(i){case"Z":m=[];break;case"H":m=[y(a[0]*e+l)];break;case"V":m=[y(a[0]*e+u)];break;case"A":m=[y(Math.abs(a[0])*e),y(Math.abs(a[1])*e),y(a[2]),String(a[3]),String(a[4]),y(a[5]*e+l),y(a[6]*e+u)];break;default:m=a.map((d,h)=>y(d*e+(h%2===0?l:u)))}r+=c+m.join(" ")}return r}function Ke(t,e=.25){let n=[],o=[],r=[0,0],c=[0,0],a=()=>{o.length>2&&n.push(o),o=[]};for(let i of t)if(i.op==="M")a(),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 s=c,l=[i.x1,i.y1],u=[i.x2,i.y2],m=[i.x,i.y],d=Math.hypot(l[0]-s[0],l[1]-s[1])+Math.hypot(u[0]-l[0],u[1]-l[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),h=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(d/(4*e)))));for(let b=1;b<=h;b++){let p=b/h,g=1-p;o.push([g*g*g*s[0]+3*g*g*p*l[0]+3*g*p*p*u[0]+p*p*p*m[0],g*g*g*s[1]+3*g*g*p*l[1]+3*g*p*p*u[1]+p*p*p*m[1]])}c=m}else a(),c=r;return a(),n}function Zt(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 a=0;a<c.length;a++){let i=c[a],s=c[(a+c.length-1)%c.length],l=r(i),u=r(s);l>=0?(u<0&&o.push(je(s,i,u,l)),o.push(i)):u>=0&&o.push(je(s,i,u,l))}}return o.length>2?o:[]}function je(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 Je(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,o])=>`${y(n)} ${y(o)}`).join("L")}Z`).join("")}function tn(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY,c=(a,i)=>{e=Math.min(e,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i)};for(let a of t)a.op==="C"?(c(a.x1,a.y1),c(a.x2,a.y2),c(a.x,a.y)):a.op!=="Z"&&c(a.x,a.y);return Number.isFinite(e)?{x0:e,y0:n,x1:o,y1:r}:null}var be=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function _r(t,e,n,o,r,c,a,i,s){if(t===i&&e===s)return[];let l=Math.abs(n),u=Math.abs(o);if(l===0||u===0)return[{op:"L",x:i,y:s}];let m=r*Math.PI/180,d=Math.cos(m),h=Math.sin(m),b=(t-i)/2,p=(e-s)/2,g=d*b+h*p,f=-h*b+d*p,x=g*g/(l*l)+f*f/(u*u);x>1&&(l*=Math.sqrt(x),u*=Math.sqrt(x));let M=l*l*u*u-l*l*f*f-u*u*g*g,F=l*l*f*f+u*u*g*g,E=(c===a?-1:1)*Math.sqrt(Math.max(0,M/F)),S=E*l*f/u,A=-E*u*g/l,R=d*S-h*A+(t+i)/2,L=h*S+d*A+(e+s)/2,B=(z,G,V,gt)=>Math.atan2(z*gt-G*V,z*V+G*gt),q=B(1,0,(g-S)/l,(f-A)/u),Y=B((g-S)/l,(f-A)/u,(-g-S)/l,(-f-A)/u);!a&&Y>0?Y-=2*Math.PI:a&&Y<0&&(Y+=2*Math.PI);let X=Math.max(1,Math.ceil(Math.abs(Y)/(Math.PI/2)-1e-9)),D=Y/X,J=4/3*Math.tan(D/4),st=(z,G)=>[R+l*d*z-u*h*G,L+l*h*z+u*d*G],pt=[];for(let z=0;z<X;z++){let G=q+z*D,V=G+D,[gt,Dt]=st(Math.cos(G)-J*Math.sin(G),Math.sin(G)+J*Math.cos(G)),[wt,C]=st(Math.cos(V)+J*Math.sin(V),Math.sin(V)-J*Math.cos(V)),[Z,tt]=z===X-1?[i,s]:st(Math.cos(V),Math.sin(V));pt.push({op:"C",x1:gt,y1:Dt,x2:wt,y2:C,x:Z,y:tt})}return pt}function Wt(t){let e=[],n=0,o=0,r=0,c=0,a=0,i="",s=null,l=null,u=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{u(),be.lastIndex=n;let b=be.exec(t);return b?(n=be.lastIndex,Number(b[0])):null},d=()=>{u();let b=t[n];return b==="0"||b==="1"?(n++,b==="1"):null},h=b=>{let p=[];for(let g=0;g<b;g++){let f=m();if(f===null)return null;p.push(f)}return p};for(;u(),!(n>=t.length);){let b=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(b))i=b,n++;else if(!i||i==="Z"||i==="z")break;let p=i===i.toLowerCase(),g=p?o:0,f=p?r:0,x=i.toUpperCase();if(x==="Z"){e.push({op:"Z"}),o=c,r=a,s=null,l=null;continue}if(x==="A"){let S=h(3),A=d(),R=d(),L=h(2);if(!(S&&L)||A===null||R===null)break;let[B,q,Y]=S,X=L[0]+g,D=L[1]+f;e.push(..._r(o,r,B,q,Y,A,R,X,D)),o=X,r=D,s=null,l=null;continue}let M={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[x]??0,F=h(M);if(!F)break;let E=F;switch(x){case"M":o=E[0]+g,r=E[1]+f,c=o,a=r,e.push({op:"M",x:o,y:r}),i=p?"l":"L",s=null,l=null;break;case"L":case"H":case"V":x!=="V"&&(o=E[0]+g),x==="V"?r=E[0]+f:x==="L"&&(r=E[1]+f),e.push({op:"L",x:o,y:r}),s=null,l=null;break;case"C":case"S":{let S,A;x==="C"?(S=[E[0]+g,E[1]+f],A=E.slice(2)):(S=s?[2*o-s[0],2*r-s[1]]:[o,r],A=E);let R=[A[0]+g,A[1]+f],L=[A[2]+g,A[3]+f];e.push({op:"C",x1:S[0],y1:S[1],x2:R[0],y2:R[1],x:L[0],y:L[1]}),[o,r]=L,s=R,l=null;break}case"Q":case"T":{let S,A;x==="Q"?(S=[E[0]+g,E[1]+f],A=[E[2]+g,E[3]+f]):(S=l?[2*o-l[0],2*r-l[1]]:[o,r],A=[E[0]+g,E[1]+f]),e.push({op:"C",x1:o+2/3*(S[0]-o),y1:r+2/3*(S[1]-r),x2:A[0]+2/3*(S[0]-A[0]),y2:A[1]+2/3*(S[1]-A[1]),x:A[0],y:A[1]}),[o,r]=A,l=S,s=null;break}default:break}}return e}var en=.5522847498;function ye(t,e,n,o,r=0,c=0){if(n<=0||o<=0)return[];let a=Math.min(Math.max(r,0),n/2),i=Math.min(Math.max(c,0),o/2);if(a===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 s=a*en,l=i*en,u=t+n,m=e+o;return[{op:"M",x:t+a,y:e},{op:"L",x:u-a,y:e},{op:"C",x1:u-a+s,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-a+s,y2:m,x:u-a,y:m},{op:"L",x:t+a,y:m},{op:"C",x1:t+a-s,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+a-s,y2:e,x:t+a,y:e},{op:"Z"}]}var rn="qrdx.frame",on=1,sn="custom",_={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:Ct},an=["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,$r=200,cn=["frame","text","accent","background"],Tr=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Nr=/[\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 Me(t,e=Ct){let n=t.slice(0,1e3).normalize("NFC").replace(Tr," ").replace(Nr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var Kt=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6;function Se(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 kr(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*_.defaultPadding}var Ee=.52,Or=.35;function Br(t){let e=t.fontSize??t.box.height*Ee;return Math.min(e*Lt,t.box.height*jt)}var xe=(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 nn(t){let e=Se(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,a,i]of o)for(let s=0;s<=8;s++){let l=i+Math.PI/2*(s/8);r.push([c+n*Math.cos(l),a+n*Math.sin(l)])}return r}function qr([t,e],n,o){if(t<n.x-.01||e<n.y-.01||t>n.x+n.width+.01||e>n.y+n.height+.01)return!1;let c=Math.min(o,n.width/2,n.height/2),a=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-a,e-i)<=c+.01}function Dr(t){let e=0;return t.forEach(([n,o],r)=>{let[c,a]=t[(r+1)%t.length];e+=n*a-c*o}),Math.abs(e)/2}function zr(t,e,n){let o=Se(e);if(!xe(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!nn(e).every(c=>qr(c,r,r.radius??0))}if(t.type==="circle"&&t.hole){let r=t.hole;return!nn(e).every(([c,a])=>Math.hypot(c-t.cx,a-t.cy)<=r+.01)}if(t.type==="polygon"){let r=Zt(t.points,o);return r.length>2&&Dr(r)>1e-6}return!0}function Fe(t){let e=Ur(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:a,y1:i}=e.bounds;return{bounds:{x0:r-o,y0:c-o,x1:a+o,y1:i+o},segments:e.segments*2}}function Ur(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=It(t.d,_.maxDecimals);return e?{bounds:tn(Wt(t.d)),segments:We(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:$r}}}function ln(t,e){let n=_,o=new TextEncoder().encode(JSON.stringify(t)).length;if(o>n.maxBytes){e(`The spec is ${o} bytes; the limit is ${n.maxBytes}`);return}let{width:r,height:c}=t.artboard,a=Math.max(r,c)*.005,i={x0:-a,y0:-a,x1:r+a,y1:c+a},s=f=>f.x0>=i.x0&&f.y0>=i.y0&&f.x1<=i.x1&&f.y1<=i.y1,{qr:l}=t,u=Jt(t);l.plate!=="none"&&u<l.size*n.minPadding-1e-9&&e(`qr.padding must be at least ${n.minPadding*100}% of qr.size`,["qr","padding"]),l.size<Math.min(r,c)*n.minQrShare-1e-9&&e(`qr.size must be at least ${n.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let m=Se(t);(m.x0<-1e-9||m.y0<-1e-9||m.x1>r+1e-9||m.y1>c+1e-9)&&e("The code and its padding must sit inside the artboard",["qr"]),(l.radius??0)>(l.size+2*u)/2&&e("qr.radius is larger than half the plate",["qr","radius"]);let d=0,h=0;t.shapes.forEach((f,x)=>{let M=["shapes",x],{bounds:F,segments:E}=Fe(f);if(!F){e("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(s(F)||e("The shape extends outside the artboard",M),f.type==="rect"&&f.hole){let{hole:S}=f;(S.x<f.x||S.y<f.y||S.x+S.width>f.x+f.width+1e-9||S.y+S.height>f.y+f.height+1e-9)&&e("The hole must sit inside its rect",[...M,"hole"])}f.type==="circle"&&f.hole&&f.hole>=f.r&&e("The hole must be smaller than the circle",[...M,"hole"]),"stroke"in f&&f.stroke&&f.stroke.width>Math.min(r,c)*.1+1e-9&&e("A stroke may be at most 10% of the artboard's shorter side",[...M,"stroke","width"]),l.plate==="background"&&zr(f,t,F)&&e('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',M),d+=E,typeof f.fill=="object"&&"gradient"in f.fill&&(h+=(f.fill.gradient.steps??32)*E)}),d>n.maxSegments&&e(`The shapes have ${d} segments; the limit is ${n.maxSegments}`,["shapes"]),h>n.maxGradientWork&&e("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let b=[],p=new Set,g=new Set;t.labels.forEach((f,x)=>{let M=["labels",x];p.has(f.id)&&e(`Label id "${f.id}" is used twice`,[...M,"id"]),p.add(f.id),f.slot!=="fixed"&&(g.has(f.slot)&&e(`Only one label may use the ${f.slot} slot`,[...M,"slot"]),g.add(f.slot));let F=f.maxLength??n.maxTextLength;f.text!==Me(f.text,F)&&e(`Label text must be at most ${F} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...M,"text"]);let E;if(f.type==="text"){E={x0:f.box.x,y0:f.box.y,x1:f.box.x+f.box.width,y1:f.box.y+f.box.height},f.fontSize!==void 0&&f.fontSize>f.box.height*jt+1e-9&&e("fontSize may be at most 95% of the label's row height",[...M,"fontSize"]);let S=f.box.y+f.box.height/2,A=Br(f)*Or,R={x0:E.x0,x1:E.x1,y0:S-A,y1:S+A};(xe(E,kr(t))||xe(R,m))&&e("The label overlaps the code or its padding",[...M,"box"])}else{let{cx:S,cy:A,radius:R}=f.curve,L=f.fontSize*Lt*.6;E={x0:S-R-L,y0:A-R-L,x1:S+R+L,y1:A+R+L};let B=Math.hypot(Math.max(m.x0-S,0,S-m.x1),Math.max(m.y0-A,0,A-m.y1));Math.hypot(Math.max(Math.abs(m.x0-S),Math.abs(m.x1-S)),Math.max(Math.abs(m.y0-A),Math.abs(m.y1-A)))<=R-L||B>=R+L||e("The curved label crosses the code or its padding",[...M,"curve"])}if(s(E)||e("The label extends outside the artboard",M),f.collapse){let S=f.collapse,A=S.y+S.height;(S.y<-1e-9||A>c+1e-9)&&e("The collapse band must sit inside the artboard",[...M,"collapse"]),A>m.y0+1e-6&&S.y<m.y1-1e-6&&e("The collapse band crosses the code or its padding",[...M,"collapse"]);for(let R of b)A>R.y+1e-6&&S.y<R.y+R.height-1e-6&&e("Collapse bands may not overlap",[...M,"collapse"]);b.push(S)}})}var Ae=(t,e=0)=>{for(let n=e;n<t.length;n++)if(t[n]?.continue!==!0)return!0;return!1};function rt(t,e=[],n={}){return{...n,run(o){let r=t({value:o,issues:[]}),c=Ae(r.issues);for(let a of e){if(a.hasLength){let s=r.value;if(r.issues.some(l=>l.continue===!1)||s===null||s===void 0||s.length===void 0)continue}else if(c)continue;let i=r.issues.length;a.run(r),!c&&r.issues.length>i&&(c=Ae(r.issues,i))}return r}}}function Gr(t){if(typeof t=="number")return Number.isNaN(t)?"NaN":Number.isFinite(t)?"number":String(t);if(t===null)return"null";if(Array.isArray(t))return"array";if(typeof t=="object"){let e=t.constructor;if(Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&e)return e.name}return typeof t}var ut=(t,e)=>({path:[],message:`Invalid input: expected ${t}, received ${Gr(e)}`}),Qr={string:"characters",array:"items"};function W(t,e,n,o){let r=Qr[e],c=t?"Too big":"Too small",a=`${t?"<=":">="}${n}`;return{path:[],message:r?`${c}: expected ${e} to have ${a} ${r}`:`${c}: expected ${e} to be ${a}`,continue:o}}var we=t=>typeof t=="string"?`"${t}"`:`${t}`,dn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function Le(t,e,n){for(let o of n)o.path.unshift(e),t.push(o)}var Hr=t=>t>=55296&&t<=56319,Vr=t=>t>=56320&&t<=57343;function Yr(t){let e=t.length;for(let n=0;n<t.length-1;n++)Hr(t.charCodeAt(n))&&Vr(t.charCodeAt(n+1))&&(e--,n++);return e}var hn=t=>Array.isArray(t)?"array":typeof t=="string"?"string":"unknown",$t=t=>({run(e){e.value<t&&e.issues.push(W(!1,"number",t,!0))}}),Tt=t=>({run(e){e.value>t&&e.issues.push(W(!0,"number",t,!0))}}),Ft=(t,e="Invalid input")=>({run(n){t(n.value)||n.issues.push({path:[],message:e,continue:!0})}}),pn=t=>typeof t=="string"?Yr(t):t.length,gn=t=>({hasLength:!0,run(e){let n=e.value;pn(n)<t&&e.issues.push(W(!1,hn(n),t,!0))}}),Ie=t=>({hasLength:!0,run(e){let n=e.value;pn(n)>t&&e.issues.push(W(!0,hn(n),t,!0))}}),bn=(t,e)=>({run(n){t.lastIndex=0,t.test(n.value)||n.issues.push({path:[],message:e??`Invalid string: must match pattern ${t}`,continue:!0})}}),Xr={run(t){let e=t.value;Number.isInteger(e)?Number.isSafeInteger(e)||t.issues.push(e>0?W(!0,"int",Number.MAX_SAFE_INTEGER,!0):W(!1,"int",Number.MIN_SAFE_INTEGER,!0)):t.issues.push({...ut("int",e),continue:!1})}},mt=(...t)=>rt(e=>{let n=e.value;return typeof n=="number"&&Number.isFinite(n)||e.issues.push(ut("number",n)),e},t),yn=(...t)=>mt(Xr,...t),te=(...t)=>rt(e=>(typeof e.value!="string"&&e.issues.push(ut("string",e.value)),e),t);function H(t){let e=t.length===1?`Invalid input: expected ${we(t[0])}`:`Invalid option: expected one of ${t.map(we).join("|")}`;return rt(n=>(t.includes(n.value)||n.issues.push({path:[],message:e}),n),[],{values:t})}var Q=t=>H([t]),P=t=>({optional:!0,run:e=>e===void 0?{value:e,issues:[]}:t.run(e)});function I(t,e=[]){let n=Object.keys(t),o=new Set(n);return rt(r=>{let c=r.value;if(!dn(c))return r.issues.push(ut("object",c)),r;let a={};for(let s of n){let l=t[s],u=l.run(c[s]),m=s in c;Le(r.issues,s,u.issues),m||l.optional||u.issues.length>0||r.issues.push({path:[s],message:"Invalid input: expected nonoptional, received undefined"}),m&&(a[s]=u.value)}r.value=a;let i=[];for(let s in c)o.has(s)||i.push(s);return i.length>0&&r.issues.push({path:[],message:`Unrecognized key${i.length>1?"s":""}: ${i.map(we).join(", ")}`,continue:!0}),r},e,{shape:t})}function Re(t,e,n){let o=[];return e!==void 0&&o.push(gn(e)),n!==void 0&&o.push(Ie(n)),rt(r=>{let c=r.value;if(Array.isArray(c)&&n!==void 0&&c.length>n)return r.issues.push(W(!0,"array",n,!1)),r;if(!Array.isArray(c))return r.issues.push(ut("array",c)),r;let a=new Array(c.length);for(let i=0;i<c.length;i++){let s=t.run(c[i]);Le(r.issues,i,s.issues),a[i]=s.value}return r.value=a,r},o)}function Pe(t){return rt(e=>{let n=e.value;if(!Array.isArray(n))return e.issues.push(ut("tuple",n)),e;if(n.length<t.length)return e.issues.push(W(!1,"array",t.length,void 0)),e;n.length>t.length&&e.issues.push(W(!0,"array",t.length,void 0));let o=[];return t.forEach((r,c)=>{let a=r.run(n[c]);Le(e.issues,c,a.issues),o[c]=a.value}),e.value=o,e})}function Et(t){return rt(e=>{let n=[];for(let r of t){let c=r.run(e.value);if(c.issues.length===0)return c;n.push(c)}let o=n.filter(r=>!Ae(r.issues));return o.length===1?o[0]:(e.issues.push({path:[],message:"Invalid input"}),e)})}function xn(t,e){let n=new Map;for(let r of e)for(let c of r.shape?.[t]?.values??[])n.set(c,r);let o=`Invalid discriminator value. Expected ${[...n.keys()].map(r=>`'${r}'`).join(" | ")}`;return rt(r=>{let c=r.value;if(!dn(c))return r.issues.push(ut("object",c)),r;let a=n.get(c[t]);return a?a.run(c):(r.issues.push({path:[t],message:o}),r)})}var Zr=Ft(Kt,`Numbers may have at most ${_.maxDecimals} decimals`),ne=[$t(-_.maxCoordinate),Tt(_.maxCoordinate),Zr],$=mt(...ne),N=mt(...ne,Ft(t=>t>0,"Must be greater than 0")),ee=mt(...ne,Ft(t=>t>=0,"Must not be negative")),_t=te(bn(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color")),un=Et([H(cn),_t]),Mn=t=>I({mix:Pe([t,t]),amount:mt($t(0),Tt(1),Ft(Kt))}),St=Et([un,Mn(un)]),Wr=Et([_t,Mn(Et([H(["frame","accent","background"]),_t]))]),lt=Et([St,I({gradient:I({from:St,to:St,direction:P(H(["horizontal","vertical"])),steps:P(yn($t(2),Tt(_.maxGradientSteps)))})})]),Ce=()=>({x:$,y:$,width:N,height:N}),vt=I({color:St,width:N}),jr=xn("type",[I({type:Q("rect"),...Ce(),radius:P(ee),fill:lt,hole:P(I({...Ce(),radius:P(ee)})),stroke:P(vt)}),I({type:Q("circle"),cx:$,cy:$,r:N,hole:P(N),fill:lt,stroke:P(vt)}),I({type:Q("ellipse"),cx:$,cy:$,rx:N,ry:N,fill:lt,stroke:P(vt)}),I({type:Q("polygon"),points:Re(Pe([$,$]),3,_.maxPolygonPoints),fill:lt,stroke:P(vt)}),I({type:Q("path"),d:te(gn(2),Ie(_.maxPathLength)),fill:lt,fillRule:P(H(["nonzero","evenodd"])),stroke:P(vt)}),I({type:Q("line"),x1:$,y1:$,x2:$,y2:$,width:N,cap:P(H(["butt","round"])),dash:P(Pe([N,N])),fill:lt}),I({type:Q("icon"),icon:H(an),x:$,y:$,size:N,fill:lt})]),mn=()=>({id:te(bn(/^[a-z][a-z0-9-]{0,31}$/)),slot:H(["primary","secondary","fixed"]),text:te(Ie(200)),maxLength:P(yn($t(1),Tt(Ct))),color:St,weight:P(H(["bold","regular"])),collapse:P(I({y:$,height:N}))}),Kr=xn("type",[I({type:Q("text"),...mn(),box:I(Ce()),align:P(H(["start","middle","end"])),fontSize:P(N)}),I({type:Q("curved"),...mn(),curve:I({cx:$,cy:$,radius:N,side:H(["top","bottom"]),spread:P(mt($t(20),Tt(300),Ft(Kt)))}),fontSize:N})]),fn=mt(...ne,Ft(t=>t>=_.minArtboard&&t<=_.maxArtboard,`Artboard sides must be ${_.minArtboard} to ${_.maxArtboard} units`)),Jr=I({kind:Q(rn),version:Q(on),artboard:I({width:fn,height:fn}),qr:I({x:$,y:$,size:N,padding:P(ee),radius:P(ee),plate:P(H(["opaque","background","none"]))}),colors:I({frame:_t,text:P(Wr),accent:P(_t)}),shapes:Re(jr,void 0,_.maxShapes),labels:Re(Kr,void 0,_.maxLabels),bleed:P(Et([Q("none"),St]))},[{run(t){ln(t.value,(e,n=[])=>{t.issues.push({path:[...n],message:e,continue:!0})})}}]);function Sn(t){let e=Jr.run(t);return e.issues.length===0?{success:!0,data:e.value}:{success:!1,issues:e.issues.map(({path:n,message:o})=>({path:n,message:o}))}}var En=({path:t,message:e})=>t.length>0?`${t.join(".")}: ${e}`:e;function O(t){if(t.length===0)return"";let[e,...n]=t;return`M${y(e[0])} ${y(e[1])}${n.map(([o,r])=>`L${y(o)} ${y(r)}`).join("")}Z`}function v(t,e,n){return`M${y(t-n)} ${y(e)}A${y(n)} ${y(n)} 0 1 1 ${y(t+n)} ${y(e)}A${y(n)} ${y(n)} 0 1 1 ${y(t-n)} ${y(e)}Z`}function w(t,e,n,o,r=0){let c=Math.min(n,o)/2,[a,i,s,l]=(typeof r=="number"?[r,r,r,r]:r).map(m=>Math.max(0,Math.min(m,c))),u=(m,d,h)=>m>0?`A${y(m)} ${y(m)} 0 0 1 ${y(d)} ${y(h)}`:"";return`M${y(t+a)} ${y(e)}H${y(t+n-i)}${u(i,t+n,e+i)}V${y(e+o-s)}${u(s,t+n-s,e+o)}H${y(t+l)}${u(l,t,e+o-l)}V${y(e+a)}${u(a,t+a,e)}Z`}function re(t,e,n,o,r=5){return Array.from({length:r*2},(c,a)=>{let i=a%2===0?n:o,s=-Math.PI/2+Math.PI/r*a;return[t+i*Math.cos(s),e+i*Math.sin(s)]})}function Fn(t,e,n){let o=n/2,r=(c,a)=>`${y(t+c*o)} ${y(e+a*o)}`;return`M${r(0,-.52)}C${r(.18,-.92)} ${r(.98,-.94)} ${r(1,-.34)}C${r(1,.12)} ${r(.5,.48)} ${r(0,.92)}C${r(-.5,.48)} ${r(-1,.12)} ${r(-1,-.34)}C${r(-.98,-.94)} ${r(-.18,-.92)} ${r(0,-.52)}Z`}function ve(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 An=24,ot=(t,e,n,o)=>{let r=o*Math.PI/180;return[t+n*Math.cos(r),e+n*Math.sin(r)]},oe=([t,e])=>`${y(t)} ${y(e)}`;function At(t,e,n,o,r,c){let a=c-r>180?1:0;return`M${oe(ot(t,e,o,r))}A${y(o)} ${y(o)} 0 ${a} 1 ${oe(ot(t,e,o,c))}L${oe(ot(t,e,n,c))}A${y(n)} ${y(n)} 0 ${a} 0 ${oe(ot(t,e,n,r))}Z`}function Nt(t,e,n,o){return`M${y(t-n)} ${y(e)}A${y(n)} ${y(o)} 0 1 1 ${y(t+n)} ${y(e)}A${y(n)} ${y(o)} 0 1 1 ${y(t-n)} ${y(e)}Z`}function to(t){let e=0;return t.forEach(([n,o],r)=>{let[c,a]=t[(r+1)%t.length];e+=n*a-c*o}),e/2}function wn(t){return O(to(t)<0?[...t].reverse():t)}function ie(t,e,n,o,r){let c=Math.hypot(n-t,o-e)||1,a=-(o-e)/c*(r/2),i=(n-t)/c*(r/2);return wn([[t+a,e+i],[n+a,o+i],[n-a,o-i],[t-a,e-i]])}var k=(...t)=>({d:t.join(""),fillRule:"nonzero"}),j=(...t)=>({d:t.join(""),fillRule:"evenodd"});function eo(){let t=[];for(let e of[0,60,120]){let[n,o]=ot(12,12,10.5,e+180),[r,c]=ot(12,12,10.5,e);t.push(ie(n,o,r,c,2))}for(let e=0;e<6;e++){let n=e*60,[o,r]=ot(12,12,6.2,n);for(let c of[-45,45]){let[a,i]=ot(o,r,3.6,n+c);t.push(ie(o,r,a,i,1.7))}}return k(...t)}var no={wifi:()=>k(At(12,20,4.6,7.2,-135,-45),At(12,20,9.2,11.8,-135,-45),At(12,20,13.8,16.4,-135,-45),v(12,20,2.2)),star:()=>k(O(re(12,12.8,11.6,4.8))),heart:()=>k(Fn(12,12.4,22)),phone:()=>j(w(6,1.5,12,21,2.6),w(7.8,4.2,8.4,13.4,.6),v(12,19.8,1.1)),headphones:()=>k(At(12,13,7.6,9.8,-180,0),w(2,12,5,9.5,2),w(17,12,5,9.5,2)),calendar:()=>j(w(2.5,4,19,17.5,2.5),w(4.6,9,14.8,10.6,.8),w(7,11.4,2.6,2.6,.4),w(10.7,11.4,2.6,2.6,.4),w(14.4,11.4,2.6,2.6,.4),w(7,15.1,2.6,2.6,.4),w(10.7,15.1,2.6,2.6,.4),w(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),w(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>k(v(12,7.5,4.6),"M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"),chat:()=>j(w(2,3,20,14,4),O([[6.5,17],[11.5,17],[5.8,21.8]]),v(7.5,10,1.5),v(12,10,1.5),v(16.5,10,1.5)),bag:()=>k(w(3.5,7.5,17,14.5,2),At(12,7.5,3.1,4.8,-180,0)),bell:()=>k("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",w(1.5,18.2,21,2.6,1.3),w(11.2,6.6,1.6,2.6,0),w(9.8,4.6,4.4,2.4,1.2)),cup:()=>k("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",At(17,10.2,1.7,3.6,-90,90),w(2,20.6,17,2,1),w(7,1.6,1.6,3.4,.8),w(11.6,1.6,1.6,3.4,.8)),card:()=>j(w(1.5,4.5,21,15,2.5),w(1.5,8,21,3,0),w(4.5,13.6,4.6,3.2,.6)),check:()=>j(v(12,12,10.5),O([[6.6,12.4],[8.4,10.6],[10.6,12.8],[15.8,7.6],[17.6,9.4],[10.6,16.4]])),info:()=>j(v(12,12,10.5),v(12,7.2,1.6),w(10.6,10,2.8,8,.8)),home:()=>j(O([[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]]),w(10,14.5,4,7,[.6,.6,0,0])),pin:()=>j("M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",v(12,9.5,3)),share:()=>k(ie(6,12,18,5,1.8),ie(6,12,18,19,1.8),v(18,5,3.2),v(6,12,3.2),v(18,19,3.2)),download:()=>k(w(10.6,2,2.8,9.5,0),O([[6,10],[18,10],[12,16.5]]),O([[2.5,15],[5.3,15],[5.3,19],[18.7,19],[18.7,15],[21.5,15],[21.5,21.8],[2.5,21.8]])),clock:()=>j(v(12,12,10.5),v(12,12,8.4),O([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:eo,pumpkin:()=>k(Nt(7.8,14.6,5.8,6.9),Nt(16.2,14.6,5.8,6.9),Nt(12,14.6,4.8,7.4),w(10.9,3.4,2.2,4.6,.8),wn([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>k(O([[12,1.5],[16.8,8.2],[7.2,8.2]]),O([[12,5.2],[19,13.6],[5,13.6]]),O([[12,9.4],[21.2,19.2],[2.8,19.2]]),w(10.4,18.6,3.2,3.9,.4)),sparkle:()=>k(O(re(9.5,13.5,9,2.4,4)),O(re(19,5,4,1.1,4))),gift:()=>k(w(3,11.2,7.8,10.6,1),w(13.2,11.2,7.8,10.6,1),w(2,7.4,8.8,3.2,1),w(13.2,7.4,8.8,3.2,1),Nt(8.8,4.8,2.9,1.9),Nt(15.2,4.8,2.9,1.9))};function Rn(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 Pn(t,e){let n=t.trim(),o=Number.parseFloat(n);return Number.isNaN(o)?Number.NaN:n.endsWith("%")?o/100*e:o}function kt(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("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length!==(c===void 0&&a.length===4?4:3))return null;let i=c??a[3],[s,l,u]=a.slice(0,3).map(h=>Pn(h,255)),m=i===void 0?1:Pn(i,1);if([s,l,u,m].some(h=>Number.isNaN(h)))return null;let d=(h,b)=>Math.min(Math.max(h,0),b);return{r:d(s,255),g:d(l,255),b:d(u,255),a:d(m,1)}}return null}function Cn(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function $e(t){let e=0;for(let n of t)e+=Cn(n);return Math.max(e,1)}var _e=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function se(t,e,n){let o=kt(t)??{r:0,g:0,b:0,a:1},r=kt(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${_e(o.r+(r.r-o.r)*c)}${_e(o.g+(r.g-o.g)*c)}${_e(o.b+(r.b-o.b)*c)}`}function Ln(t,e,n,o,r,c,a,i){let s=[...t],l=r*.08,u=s.map(p=>Cn(p)*r),m=u.reduce((p,g)=>p+g,0)+l*Math.max(0,s.length-1),d=c==="top"?o-r*.35:o+r*.35,h=[],b=0;return s.forEach((p,g)=>{let f=u[g],x=(b+f/2)/d;if(b+=f+l,p.trim()==="")return;let M=c==="top"?-Math.PI/2-m/2/d+x:Math.PI/2+m/2/d-x;h.push({text:p,x:e+d*Math.cos(M),y:n+d*Math.sin(M),fontSize:r,maxWidth:r*2,color:a,rotate:M*180/Math.PI+(c==="top"?90:-90),field:i})}),h}function Ot(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 ae=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},In=new WeakMap;function Te(t){if(t&&typeof t=="object"){let n=In.get(t);if(n)return n}if(t==null)throw new ae(['A "custom" frame needs a spec']);let e=Sn(t);if(!e.success)throw new ae(e.issues.map(En));return typeof t=="object"&&In.set(t,e.data),e.data}var oo=t=>{let e=kt(t);return!!(e&&e.a>=1)};function io(t,e){let n=Ot(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 _n(t,e,n=nt){let o=e.color||t.colors.frame,r=e.secondaryColor||t.colors.accent||o,c=s=>s==="frame"?o:s==="accent"?r:s==="background"?n:s,a=t.colors.text,i=e.textColor||(a===void 0?o:typeof a=="string"?a:se(c(a.mix[0]),c(a.mix[1]),a.amount));return{frame:o,text:i,accent:r}}function so(t,e,n){let o=_n(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):se(r(c.mix[0]),r(c.mix[1]),c.amount)}function vn(t,e,n=0,o=0){let r=It(t);return r?ge(r,e,n,o):""}function ao(t,e,n,o){return`M${y(t-n)} ${y(e)}A${y(n)} ${y(o)} 0 1 1 ${y(t+n)} ${y(e)}A${y(n)} ${y(o)} 0 1 1 ${y(t-n)} ${y(e)}Z`}function co(t,e){let[n,o,r,c]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],a=Math.hypot(r-n,c-o),i=t.width*e/2,s=a>0?(r-n)/a:1,l=a>0?(c-o)/a:0,u=-l*i,m=s*i,d=(g,f)=>{let x=[n+s*g,o+l*g],M=[n+s*f,o+l*f];if(t.cap==="round"&&f-g>2*i){let F=[x[0]+s*i,x[1]+l*i],E=[M[0]-s*i,M[1]-l*i];return`M${y(F[0]-u)} ${y(F[1]-m)}L${y(E[0]-u)} ${y(E[1]-m)}A${y(i)} ${y(i)} 0 0 1 ${y(E[0]+u)} ${y(E[1]+m)}L${y(F[0]+u)} ${y(F[1]+m)}A${y(i)} ${y(i)} 0 0 1 ${y(F[0]-u)} ${y(F[1]-m)}Z`}return`M${y(x[0]-u)} ${y(x[1]-m)}L${y(M[0]-u)} ${y(M[1]-m)}L${y(M[0]+u)} ${y(M[1]+m)}L${y(x[0]+u)} ${y(x[1]+m)}Z`};if(!t.dash)return{type:"path",d:d(0,a),fillRule:"nonzero"};let h=t.dash[0]*e,b=h+t.dash[1]*e,p=[];for(let g=0;g+h<=a+1e-6;g+=b)p.push(d(g,g+h));return{type:"path",d:p.join(""),fillRule:"nonzero"}}function lo(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:v(t.cx*e,t.cy*e,t.r*e)+(t.hole?v(t.cx*e,t.cy*e,t.hole*e):""),fillRule:t.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:ao(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:vn(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return co(t,e);default:{let n=Rn(t.icon);return{type:"path",d:vn(n.d,t.size*e/An,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:a}=t;return[...ye(e,n,o,r,c,c),...a?ye(a.x,a.y,a.width,a.height,a.radius,a.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"}]:Wt(t.d)}function mo(t,e,n){let o=uo(t),r=Ke(o,.2),c=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",a=e.direction==="vertical",i=g=>a?g[1]:g[0],s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let g of r)for(let f of g)s=Math.min(s,i(f)),l=Math.max(l,i(f));if(!(l>s))return[];let u=e.steps??32,m=n(e.from),d=n(e.to),h=l-s,b=h*.002,p=[];for(let g=0;g<u;g++){let f=s+h*g/u,x=Math.min(l,s+h*(g+1)/u+(g+1<u?b:0)),M=a?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:f,y1:x}:{x0:f,x1:x,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},F=r.map(E=>Zt(E,M)).filter(E=>E.length>2);F.length!==0&&p.push({type:"path",d:Je(F),fill:se(m,d,(g+.5)/u),fillRule:c})}return p}function fo(t,e,n){let o=lo(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 ho(t,e){let n=Math.min(t.maxLength??_.maxTextLength,_.maxTextLength),o=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return Me(o,n)}function po(t){return t===void 0||!Number.isFinite(t)?1:Math.min(Lt,Math.max(Ve,t))}function go(t,e,n,o,r,c){let a=r(t.color),i=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:p,cy:g,radius:f,side:x,spread:M=140}=t.curve,F=f*o*(M*Math.PI/180),E=Math.min(t.fontSize*o*n,F/($e(e)+.08*e.length));return Ln(e,p*o,g*o,f*o,E,x,a,c).map(S=>({...S,...i}))}let s=t.box.x*o,l=t.box.y*o,u=t.box.width*o,m=t.box.height*o;if(!(m>0))return[];let d=(t.fontSize??t.box.height*Ee)*o,h=Math.min(d*n,m*jt,u/$e(e)),b=t.align??"middle";return[{text:e,x:b==="start"?s:b==="end"?s+u:s+u/2,y:l+m/2+h*.35,fontSize:h,maxWidth:u,color:a,...b!=="middle"&&{align:b},...i,field:c}]}function bo(t){let e=0,n=0,o=0,r=0;return t.map(({command:c,values:a})=>{let i=c.toUpperCase(),s=c!==i;switch(i){case"Z":return e=o,n=r,{command:"Z",values:[]};case"H":return e=(s?e:0)+a[0],{command:"H",values:[e]};case"V":return n=(s?n:0)+a[0],{command:"V",values:[n]};case"A":return e=(s?e:0)+a[5],n=(s?n:0)+a[6],{command:"A",values:[...a.slice(0,5),e,n]};default:{let l=a.map((u,m)=>s?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 yo(t,e){let n=It(t);return n?ge(bo(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,a)=>a%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:yo(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function Mo(t,e){if(e.length===0)return t;let n=r=>{let c=r;for(let a of e)c-=Math.min(Math.max(r-a.y,0),a.height);return c},o=(r,c)=>e.some(a=>r>=a.y-1e-6&&c<=a.y+a.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}=Fe(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 Ne(t,e,n,o,r={}){let c=new Map(e.labels.map(g=>[g.id,ho(g,n)])),a=Mo(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),i=t/a.qr.size,s=io(a,o),l=so(n,a,s.color),u=a.shapes.flatMap(g=>fo(g,i,l));if(s.plate){let g=Jt(a)*i;u.push({type:"rect",x:a.qr.x*i-g,y:a.qr.y*i-g,width:t+2*g,height:t+2*g,radius:(a.qr.radius??0)*i,fill:s.color})}let m=po(n.fontScale),d=a.labels.flatMap(g=>{let f=c.get(g.id);if(!f)return[];let x=(g.slot==="fixed"?void 0:r[g.slot])??g.id;return go(g,f,m,i,l,x)}),h=d[0],b=h&&h.rotate===void 0?h:null,p=a.bleed??"none";return{width:a.artboard.width*i,height:a.artboard.height*i,qrX:a.qr.x*i,qrY:a.qr.y*i,qrSize:t,shapes:u,label:b,extraLabels:b?d.slice(1):d,squareEdges:p!=="none",color:l(p==="none"?"frame":p)}}function $n(t,e,n){return Ne(t,Te(e.spec),e,n)}var Tn={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 ke={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 Nn={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 kn={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 On={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 Bn={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 qn={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 Dn={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 zn={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 ce={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 Un={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 Gn={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 Qn={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 Hn={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 Vn={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 Yn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:445,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:220,radius:110,fill:"frame"},{type:"polygon",points:[[540,180],[700,180],[620,300]],fill:"frame"},{type:"rect",x:40,y:365,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:325,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:365,width:1160,height:1160,radius:30}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}]};var Xn={kind:"qrdx.frame",version:1,artboard:{width:1420,height:1590},qr:{x:195,y:195,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:30,y:30,width:1390,height:1560,radius:155,fill:{mix:["frame","#FFFFFF"],amount:.7}},{type:"rect",x:0,y:0,width:1390,height:1560,radius:155,fill:"#FFFFFF"},{type:"rect",x:25,y:25,width:1340,height:1510,radius:130,fill:"frame"},{type:"rect",x:95,y:95,width:1200,height:1200,radius:40,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:175,y:1295,width:1040,height:240},collapse:{y:1365,height:170}}]};var Zn={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 Wn={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,o,r)=>({style:t,name:e,tags:r,labelOn:o,spec:n}),jn=[T("banner-bottom","Banner",ke,"frame",["bottom","band"]),T("banner-top","Top banner",Nn,"frame",["top","band"]),T("banner-top-bottom","Two banners",kn,"frame",["top","bottom","band"]),T("border","Border",On,"background",["square","outline"]),T("rounded-border","Rounded",Hn,"background",["border","outline"]),T("gradient-border","Gradient",ce,"background",["border","colorful"]),T("focus","Focus",zn,"background",["corners","brackets"]),T("speech-bubble","Bubble",Vn,"frame",["speech"]),T("speech-bubble-top","Bubble top",Yn,"frame",["speech"]),T("chat-bubble","Chat",Bn,"frame",["message","bubble"]),T("circle","Circle",qn,"frame",["round","ring","curved"]),T("badge","Ribbon",Tn,"frame",["badge","banner"]),T("sticker","Sticker",Xn,"frame",["label"]),T("polaroid","Polaroid",Qn,"frame",["photo","picture"]),T("phone","Phone",Gn,"background",["mobile","screen"]),T("ticket","Ticket",Wn,"frame",["event","pass"]),T("tag","Tag",Zn,"frame",["price","label"]),T("envelope","Envelope",Dn,"frame",["mail","letter"]),T("menu-card","Menu card",Un,"background",["menu","restaurant"])],Do=new Map(jn.map(t=>[t.style,t]));function zo(t){return Do.get(t)}var Xs=Object.fromEntries(jn.map(t=>[t.style,t.spec])),Zs={from:ce.colors.frame,to:ce.colors.accent};var Uo={primary:"text",secondary:"secondaryText"};function Kn(t,e,n){let o=zo(e.style)?.spec??ke;return Ne(t,Te(o),e,n,Uo)}var Go="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function er(t){return!!(t?.style&&t.style!=="none")}function nr(t,e,n){return e.style===sn?$n(t,e,n):Kn(t,e,n)}function Qo(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function rr(t,e){let n=({x:r,y:c,width:a,height:i,radius:s})=>{let l=Math.min(s,a/2,i/2);t.moveTo(r+l,c),t.arcTo(r+a,c,r+a,c+i,l),t.arcTo(r+a,c+i,r,c+i,l),t.arcTo(r,c+i,r,c,l),t.arcTo(r,c,r+a,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 a=new Path2D(r.d);c&&t.fill(a,r.fillRule??"nonzero"),o(r,a)}continue}t.beginPath(),r.type==="polygon"?(r.points.forEach(([a,i],s)=>{s===0?t.moveTo(a,i):t.lineTo(a,i)}),t.closePath(),c&&t.fill()):(n(r),r.hole&&n(r.hole),c&&t.fill("evenodd")),o(r)}}for(let r of Qo(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${Go}`,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 Oe(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 or(t,e){return e?Yo(t,Vo):t}var{QrCode:Be}=U,Xo={"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=(a,i)=>{a>=0&&i>=0&&a<e&&i<e&&(n[i*e+a]=1)};for(let a=0;a<e;a++)o(6,a),o(a,6);for(let[a,i]of[[3,3],[e-4,3],[3,e-4]])for(let s=-4;s<=4;s++)for(let l=-4;l<=4;l++)o(a+l,i+s);let r=[];if(t>1){let a=Math.floor(t/7)+2,i=t===32?26:Math.ceil((t*4+4)/(a*2-2))*2;r.push(6);for(let s=e-7;r.length<a;s-=i)r.splice(1,0,s)}let c=r.length-1;for(let[a,i]of r.entries())for(let[s,l]of r.entries())if(!(a===0&&s===0||a===0&&s===c||a===c&&s===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)o(i+m,l+u);for(let a=0;a<=8;a++)o(8,a),o(a,8);for(let a=0;a<8;a++)o(e-1-a,8),o(8,e-1-a);if(t>=7)for(let a=0;a<18;a++){let i=e-11+a%3,s=Math.floor(a/3);o(i,s),o(s,i)}return n}function Wo(t,e){let n=t*4+17,o=et[e].ordinal,r=Be.NUM_ERROR_CORRECTION_BLOCKS[o]?.[t]??0,c=Be.ECC_CODEWORDS_PER_BLOCK[o]?.[t]??0,a=Math.floor(Be.getNumRawDataModules(t)/8),i=r-a%r,s=Math.floor(a/r),l=Array.from({length:r},(F,E)=>s+(E<i?0:1)),u=[],m=[],d=s-c;for(let F=0;F<=s;F++)for(let E=0;E<r;E++)if(E<i){if(F===d)continue;u.push(E),m.push(F<d?F:F-1)}else u.push(E),m.push(F);if(u.length!==a)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let h=Zo(t),b=new Int16Array(n*n).fill(-1),p=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),f=a*8,x=0;for(let F=n-1;F>=1;F-=2){F===6&&(F=5);let E=(F+1&2)===0;for(let S=0;S<n;S++)for(let A=0;A<2;A++){let R=F-A,B=(E?n-1-S:S)*n+R;if(!h[B]&&x<f){let q=x>>>3;b[B]=u[q],p[B]=m[q],g[B]=7-(x&7),x++}}}if(x!==f)throw new Error(`Codeword map: placement mismatch at version ${t}`);let M=Xo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:r,eccPerBlock:c,blockLengths:l,correctable:Math.floor((c-M)/2),block:b,codeword:p,bit:g}}var jo=8,ft=new Map;function ir(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=ft.get(n);if(o)return ft.delete(n),ft.set(n,o),o;let r=Wo(t,e);if(ft.size>=jo){let c=ft.keys().next().value;c!==void 0&&ft.delete(c)}return ft.set(n,r),r}function sr(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 a=c*4096+t.codeword[r];o.has(a)||(o.add(a),n[c]=n[c]+1)}return n}var Ko={2:6,3:12};function ar(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=Ko[o.length];for(let a=1;a<=c;a++){let i=a/c,s=1-i;if(o.length===2){let[l]=o;e.push([s*s*n[0]+2*s*i*l[0]+i*i*r[0],s*s*n[1]+2*s*i*l[1]+i*i*r[1]])}else{let[l,u]=o;e.push([s*s*s*n[0]+3*s*s*i*l[0]+3*s*i*i*u[0]+i*i*i*r[0],s*s*s*n[1]+3*s*s*i*l[1]+3*s*i*i*u[1]+i*i*i*r[1]])}}}n=r}return e}function lr(t,e){let n=[];for(let o of t)for(let r=0;r<o.length;r++){let[c,a]=o[r],[i,s]=o[(r+1)%o.length];a<=e!=s<=e&&n.push(c+(e-a)/(s-a)*(i-c))}return n.sort((o,r)=>o-r)}function ur(t,e){let n=0;for(let o of t)if(o<e)n++;else break;return n%2===1}function Jo(t,e,n){return ur(lr(t,n),e)}function mr(t){let e=new Map;return(n,o)=>{let r=e.get(o);return r||(r=lr(t,o),e.set(o,r)),ur(r,n)}}function ti(t,e,n,o){let r=n[0]-t,c=n[1]-e,a=o[0]-n[0],i=o[1]-n[1],s=u=>Math.max(Math.abs(r+u*a),Math.abs(c+u*i)),l=Math.min(s(0),s(1));for(let[u,m]of[[c-r,a-i],[-(r+c),a+i]])if(m!==0){let d=u/m;d>0&&d<1&&(l=Math.min(l,s(d)))}return l}function ei(t,e,n){if(!Jo(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,ti(e,n,r[c],r[(c+1)%r.length]));return Number.isFinite(o)?o:0}function ni(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[a,i]of c)e=Math.min(e,a),n=Math.min(n,i),o=Math.max(o,a),r=Math.max(r,i);return{x0:e,y0:n,x1:o,y1:r}}function fr(t){let e=t.map(ar),n=ni(e),o=n.x1-n.x0,r=n.y1-n.y0;if(!(o>0&&r>0))return null;let c=(b,p)=>{let g=Math.max(b-n.x0,n.x1-b,p-n.y0,n.y1-p);return g>0?ei(e,b,p)/(2*g):0},a={cx:n.x0+o/2,cy:n.y0+r/2,value:0};a.value=c(a.cx,a.cy);let i=32;for(let b=1;b<i;b++)for(let p=1;p<i;p++){let g=n.x0+o*p/i,f=n.y0+r*b/i,x=c(g,f);x>a.value&&(a={cx:g,cy:f,value:x})}let s=o/i,l=r/i;for(let b=0;b<6;b++){let p=a;for(let g=-2;g<=2;g++)for(let f=-2;f<=2;f++){let x=p.cx+s*f/2,M=p.cy+l*g/2,F=c(x,M);F>a.value&&(a={cx:x,cy:M,value:F})}s/=2,l/=2}if(a.value<=0)return null;let m=.5/Math.max(a.cx-n.x0,n.x1-a.cx,a.cy-n.y0,n.y1-a.cy),d=([b,p])=>[.5+(b-a.cx)*m,.5+(p-a.cy)*m],h=t.map(b=>({start:d(b.start),segments:b.segments.map(p=>p.map(d))}));return{rings:h,polygons:h.map(ar),half:a.value}}function dr(t,e){let n=([r,c])=>`${y(r*e)} ${y(c*e)}`,o="";for(let r of t.rings){o+=`M${n(r.start)}`;for(let c of r.segments){let a=c.length===1?"L":c.length===2?"Q":"C";o+=a+c.map(n).join(" ")}o+="Z"}return o}var ri={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]]]},cr;function hr(){return cr??=fr([ri]),cr}function oi(t){let{width:e,height:n,cells:o}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=he&&n>=he&&e<=de&&n<=de&&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 ii(t,e,n){let o=(s,l)=>t(s-1,l-1),r=new Map,c=(s,l)=>{for(let[u,m]of[[s,l],[l,s]]){let d=r.get(K(u))??[];d.push(m),r.set(K(u),d)}};for(let s=0;s<=n;s++)for(let l=0;l<=e;l++){let u=o(l,s),m=o(l+1,s),d=o(l+1,s+1),h=o(l,s+1),b=[l,s-.5],p=[l+.5,s],g=[l,s+.5],f=[l-.5,s];switch((u?8:0)+(m?4:0)+(d?2:0)+(h?1:0)){case 1:case 14:c(f,g);break;case 2:case 13:c(g,p);break;case 3:case 12:c(f,p);break;case 4:case 11:c(b,p);break;case 6:case 9:c(b,g);break;case 7:case 8:c(f,b);break;case 5:c(b,p),c(f,g);break;case 10:c(f,b),c(g,p);break;default:break}}let a=[],i=new Set;for(let[s,l]of r){if(i.has(s)||l.length===0)continue;let[u,m]=s.split(",").map(Number),d=[[u,m]];i.add(s);let h=[u,m],b=l[0];for(;!i.has(K(b));){i.add(K(b)),d.push(b);let p=si(r.get(K(b))??[],h,i);if(!p)break;h=b,b=p}d.length>=3&&a.push(ai(d))}return a}function si(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 ai(t){let e=[];for(let n=0;n<t.length;n++){let o=t[(n-1+t.length)%t.length],r=t[n],c=t[(n+1)%t.length],a=(r[0]-o[0])*(c[1]-r[1])-(r[1]-o[1])*(c[0]-r[0]);Math.abs(a)>1e-9&&e.push(r)}return e.length>=3?e:t}function ci(t){let e=(c,a)=>[(c[0]+a[0])/2,(c[1]+a[1])/2],n=t.length,o=e(t[n-1],t[0]),r=t.map((c,a)=>[c,e(c,t[(a+1)%n])]);return{start:o,segments:r}}var Bt=new Map;function pr(t){let e=`${t.width}x${t.height}:${t.cells}`,n=Bt.get(e);if(n)return n;let o=oi(t),r;if(!o)r={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=ii(o,t.width,t.height),a=c.length>0?fr(c.map(ci)):null;r=a&&2*a.half>=Ze?{outline:a,problem:null}:{outline:null,problem:a?"thin":"empty"}}else r={outline:null,problem:"empty"};return Bt.size>16&&Bt.delete(Bt.keys().next().value),Bt.set(e,r),r}var li=1,gr=.5,br=.5,ui=.5;function le(t){return Math.max(t,Xe)}function qe(t){return t==="heart"?hr():typeof t=="object"&&t?.type==="silhouette"?pr(t).outline:null}function it(t,e,n){if(n==="circle"){let a=le(e),i=(t/2+a)*Math.SQRT2+li;return Math.ceil(i-t/2)}let o=qe(n);if(!o)return e;let r=le(e),c=(t+2*(r+ui))/(2*o.half);return Math.ceil((c-t)/2-1e-9)}function yr(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 mi(t,e,n){let o=it(e,n,"circle"),r=le(n),c=e+2*o,a=c/2,i=a-gr-.5,s=yr(Number.parseInt(ve(t),36)||1),l=o-r,u=o+e+r;return Array.from({length:c},(m,d)=>Array.from({length:c},(h,b)=>{let p=s()<br;return b>=l&&b<u&&d>=l&&d<u?!1:p&&Math.hypot(b+.5-a,d+.5-a)<=i}))}var fi=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function De(t,e,n,o){if(o==="circle")return mi(t,e,n);let r=qe(o);if(!r)return null;let c=it(e,n,o),a=le(n),i=e+2*c,s=mr(r.polygons),l=.5+gr,u=(b,p)=>{let g=b+.5,f=p+.5;return s(g/i,f/i)?fi.every(([x,M])=>s((g+x*l)/i,(f+M*l)/i)):!1},m=yr(Number.parseInt(ve(t),36)||1),d=c-a,h=c+e+a;return Array.from({length:i},(b,p)=>Array.from({length:i},(g,f)=>{let x=m()<br;return f>=d&&f<h&&p>=d&&p<h?!1:x&&u(f,p)}))}function ze(t,e){if(t==="circle")return{circle:e/2};let n=qe(t);return n?{path:dr(n,e)}:null}function xr(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 Ue(t,e=0){let n=[];return t.forEach((o,r)=>{let c=null;o.forEach((a,i)=>{if(!a&&c!==null){n.push(Xt`M${c+e} ${r+e}h${i-c}v1H${c+e}z`),c=null;return}if(i===o.length-1){if(!a)return;c===null?n.push(Xt`M${i+e},${r+e} h1v1H${i+e}z`):n.push(Xt`M${c+e},${r+e} h${i+1-c}v1H${c+e}z`);return}a&&c===null&&(c=i)})}),n.join("")}function qt(t,e,n,o){if(o==null)return null;let r=t.length,c=Math.floor(e*Yt),a=(r+2*n)/e,i=(o.width||c)*a,s=(o.height||c)*a,l=o.x==null?r/2-i/2:o.x*a,u=o.y==null?r/2-s/2:o.y*a,m=null;if(o.excavate){let d=Math.max(0,o.padding??0)*a,h=Math.floor(l-d),b=Math.floor(u-d),p=Math.ceil(i+l+d-h),g=Math.ceil(s+u+d-b);m={x:h,y:b,w:p,h:g}}return{x:l,y:u,h:s,w:i,excavation:m}}function ue(t){let e=t.level??Mt,{imageSettings:n}=t,o=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&o!=="H"){let r=U.QrCode.encodeText(t.value,et[o]).getModules(),c=qt(r,t.size??Qt,it(r.length,t.margin??Vt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(r.length*r.length)>Ye&&(o="H")}return o}var Ge=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var di=.6,hi=["L","M","Q","H"];function pi(t){let e=U.QrCode.encodeText(t.value,et[t.level]),n=hi[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:it(e.size,t.margin,t.shape),map:ir(e.version,n),level:n,version:e.version}}function gi(t,e){let{cells:n,map:o}=t,r=n.length,c=qt(n,t.code.size,t.layoutMargin,e);if(!c)return null;let a=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,a.y);l<Math.min(r,a.y+a.h);l++)for(let u=Math.max(0,a.x);u<Math.min(r,a.x+a.w);u++)i.push(l*r+u);let s=sr(o,i);return{worst:Math.max(0,...s),correctable:o.correctable,budget:Math.floor(o.correctable*di),level:t.level,version:t.version}}var bi=t=>!t||t.worst<=t.budget;function yi(t,e,n,o){let r=e.map(i=>pi({...t,level:i})),c=i=>{let s=o(i);return r.every(l=>bi(gi(l,s)))};if(c(n))return n;let a=t.size*.005;for(let i=n-a;i>0;i-=a)if(c(i))return i;return 0}function Mr(t,e){if(!e)return;let n=Math.floor(t.size*Yt),o=e.width||n,r=e.height||n,c=d=>{if(d===o)return e;let h=r*d/o;return{...e,width:d,height:h,...e.x!=null&&{x:e.x+(o-d)/2},...e.y!=null&&{y:e.y+(r-h)/2}}},a=t.level??Mt,i={value:t.value,size:t.size,margin:t.margin,shape:t.shape},s=d=>ue({...t,level:a,imageSettings:d}),l=d=>{let h=yi(i,[d],o,c);return h>0?c(h):void 0},u=s(e);if(u===a)return l(a);let m=l(u);return m&&s(m)===u?m:l(a)}var ht=require("react/jsx-runtime");function xi(t){let{value:e,size:n=Qt,level:o=Mt,bgColor:r=nt,fgColor:c=Ht,margin:a=Vt,style:i,imageSettings:s,eyeColor:l,dotColor:u,bodyPattern:m,cornerEyePattern:d,cornerEyeDotPattern:h,isOGContext:b,templateId:p,customTemplate:g,customProps:f,frame:x,art:M,eyeColors:F,moduleScale:E,frameLabelMarkers:S,partMarkers:A,autoLevel:R,shape:L,...B}=t,q=Mr({value:e,size:n,margin:a,level:o,shape:L,autoLevel:R},s),Y=ue({value:e,size:n,level:o,margin:a,imageSettings:q,autoLevel:R,shape:L}),X=q?.src,D=er(x)?nr(n,x,r):null,J=D?.width??n,st=D?.height??n,pt=(0,dt.useRef)(null),z=(0,dt.useRef)(null),[G,V]=(0,dt.useState)(!1);(0,dt.useEffect)(()=>{if(pt.current!=null){let wt=pt.current,C=wt.getContext("2d");if(!C)return;let Z=U.QrCode.encodeText(e,et[Y]).getModules(),tt=it(Z.length,a,L),me=De(e,Z.length,a,L),bt=Z.length+tt*2,at=qt(Z,n,tt,q),zt=z.current,Qe=at!=null&&zt?.complete&&zt.naturalHeight!==0&&zt.naturalWidth!==0;Qe&&at.excavation!=null&&(Z=xr(Z,at.excavation));let Ut=window.devicePixelRatio||1;wt.width=J*Ut,wt.height=st*Ut,C.scale(Ut,Ut),D&&(rr(C,D),C.translate(D.qrX,D.qrY));let He=n/bt;C.scale(He,He),C.fillStyle=Ot(r,nt);let Rt=ze(L,bt);if(Rt&&"circle"in Rt?(C.beginPath(),C.arc(bt/2,bt/2,Rt.circle,0,2*Math.PI),C.fill()):Rt&&Ge?C.fill(new Path2D(Rt.path),"evenodd"):C.fillRect(0,0,bt,bt),C.fillStyle=Ot(c,Ht),Ge)C.fill(new Path2D(Ue(Z,tt))),me&&C.fill(new Path2D(Ue(me,0)));else for(let[Gt,yt]of[[Z,tt],[me??[],0]])Gt.forEach((Pt,ct)=>{Pt.forEach((Sr,Er)=>{Sr&&C.fillRect(Er+yt,ct+yt,1,1)})});if(Qe){let Gt={x:at.x+tt,y:at.y+tt,w:at.w,h:at.h},yt=q?.shape??"square",Pt=q?.plate,ct=or(Gt,Pt);C.save(),Pt&&(Oe(C,yt,Gt),C.fillStyle=Pt,C.fill()),yt!=="square"&&(Oe(C,yt,ct),C.clip()),C.drawImage(zt,ct.x,ct.y,ct.w,ct.h),C.restore()}}});let gt={height:st,width:J,...i},Dt=null;return X!=null&&(Dt=(0,ht.jsx)("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:z,src:X,style:{display:"none"}},X)),(0,ht.jsxs)(ht.Fragment,{children:[(0,ht.jsx)("canvas",{height:st,ref:pt,style:gt,width:J,...B}),Dt]})}0&&(module.exports={QRCodeCanvas});
2
2
  /**
3
3
  * @license QR Code generator library (TypeScript)
4
4
  * Copyright (c) Project Nayuki.