@tapple.io/qr-code-generator 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,8 @@ A lightweight QR code generator with full TypeScript support. Generate QR codes
5
5
  [![npm version](https://img.shields.io/npm/v/@tapple.io/qr-code-generator.svg)](https://www.npmjs.com/package/@tapple.io/qr-code-generator)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
7
 
8
+ **[🎨 Try the Interactive Demo →](https://tappleinc.github.io/qr-code-generator/demo/)**
9
+
8
10
  ## Features
9
11
 
10
12
  - 🚀 **Platform-optimized architecture** - Zero browser dependencies (native Canvas API) + one Node.js dependency (`@resvg/resvg-js`)
@@ -26,7 +28,7 @@ That's it! The package automatically provides platform-optimized bundles:
26
28
  - **Browser**: Zero dependencies - uses native Canvas API
27
29
  - **Node.js**: One dependency (`@resvg/resvg-js`) - installed automatically
28
30
 
29
- **Why this matters:** Most QR libraries bundle heavy dependencies (~2.5MB) that work everywhere but bloat browser bundles. We use environment-specific implementations - Canvas API in browsers (built-in) and `@resvg/resvg-js` in Node.js (acceptable for server environments) - automatically delivering the optimal bundle for your platform.
31
+ **Why this matters:** Many QR libraries bundle heavy dependencies (2MB+) that work everywhere but bloat browser bundles. We use environment-specific implementations - Canvas API in browsers (built-in) and `@resvg/resvg-js` in Node.js - automatically delivering the optimal solution for your platform.
30
32
 
31
33
  ## Quick Start
32
34
 
@@ -67,13 +69,13 @@ import { genQrImage } from '@tapple.io/qr-code-generator';
67
69
  import fs from 'fs';
68
70
 
69
71
  // Save PNG to file
70
- const buffer = await genQrImage('https://tapple.io', {
72
+ const buffer = await genQrImage('https://www.qrcode.com/en/history/', {
71
73
  output: { format: 'png', type: 'buffer' }
72
74
  });
73
75
  fs.writeFileSync('qrcode.png', buffer);
74
76
 
75
77
  // Save SVG to file
76
- const svg = await genQrImage('https://tapple.io', {
78
+ const svg = await genQrImage('https://www.qrcode.com/en/history/', {
77
79
  output: { format: 'svg', type: 'string' }
78
80
  });
79
81
  fs.writeFileSync('qrcode.svg', svg);
@@ -86,12 +88,12 @@ import { genQrImage } from '@tapple.io/qr-code-generator';
86
88
 
87
89
  // Display PNG as image (returns dataURL string)
88
90
  const img = document.getElementById('qr-image');
89
- img.src = await genQrImage('https://tapple.io', {
91
+ img.src = await genQrImage('https://www.qrcode.com/en/history/', {
90
92
  output: { format: 'png', type: 'dataURL' }
91
93
  });
92
94
 
93
95
  // Or use SVG data URL
94
- img.src = await genQrImage('https://tapple.io', {
96
+ img.src = await genQrImage('https://www.qrcode.com/en/history/', {
95
97
  output: { format: 'svg', type: 'dataURL' }
96
98
  });
97
99
  ```
@@ -112,21 +114,21 @@ Generates a QR code image. Returns a Promise that resolves to the output format
112
114
 
113
115
  ```typescript
114
116
  // Default: PNG buffer
115
- const buffer = await genQrImage('https://tapple.io');
117
+ const buffer = await genQrImage('https://en.wikipedia.org/wiki/QR_code');
116
118
 
117
119
  // PNG data URL
118
- const dataURL = await genQrImage('https://tapple.io', {
120
+ const dataURL = await genQrImage('https://en.wikipedia.org/wiki/QR_code', {
119
121
  size: 400,
120
122
  output: { format: 'png', type: 'dataURL' }
121
123
  });
122
124
 
123
125
  // SVG string
124
- const svg = await genQrImage('https://tapple.io', {
126
+ const svg = await genQrImage('https://en.wikipedia.org/wiki/QR_code', {
125
127
  output: { format: 'svg', type: 'string' }
126
128
  });
127
129
 
128
130
  // SVG data URL
129
- const svgDataURL = await genQrImage('https://tapple.io', {
131
+ const svgDataURL = await genQrImage('https://en.wikipedia.org/wiki/QR_code', {
130
132
  output: { format: 'svg', type: 'dataURL' }
131
133
  });
132
134
  ```
@@ -194,7 +196,7 @@ const options = {
194
196
  }
195
197
  };
196
198
 
197
- const qr = await genQrImage('https://tapple.io', options);
199
+ const qr = await genQrImage('https://en.wikipedia.org/wiki/QR_code', options);
198
200
  ```
199
201
 
200
202
  ### ImageOptions Reference
@@ -323,11 +325,11 @@ const phoneQR = await genQrImage({
323
325
  ```typescript
324
326
  const qr = await genQrImage({
325
327
  type: 'url',
326
- url: 'https://tapple.io'
328
+ url: 'https://en.wikipedia.org/wiki/Denso'
327
329
  });
328
330
 
329
331
  // Or just pass the URL directly:
330
- const qr = await genQrImage('https://tapple.io');
332
+ const qr = await genQrImage('https://en.wikipedia.org/wiki/Denso');
331
333
  ```
332
334
 
333
335
  ## Shape Enums
@@ -364,7 +366,7 @@ BorderStyle.DASHED
364
366
  ```typescript
365
367
  import { genQrImage, EyeFrameShape, DotShape, BorderShape } from '@tapple.io/qr-code-generator';
366
368
 
367
- const styledQR = await genQrImage('https://tapple.io', {
369
+ const styledQR = await genQrImage('https://en.wikipedia.org/wiki/Denso', {
368
370
  size: 500,
369
371
  margin: 30,
370
372
  backgroundColor: '#f8f9fa',
@@ -400,7 +402,7 @@ import fs from 'fs';
400
402
  const logoBuffer = fs.readFileSync('logo.png');
401
403
  const logoDataURL = `data:image/png;base64,${logoBuffer.toString('base64')}`;
402
404
 
403
- const qr = await genQrImage('https://tapple.io', {
405
+ const qr = await genQrImage('https://en.wikipedia.org/wiki/QR_code', {
404
406
  size: 400,
405
407
  logo: {
406
408
  src: logoDataURL,
@@ -417,7 +419,7 @@ const qr = await genQrImage('https://tapple.io', {
417
419
  ```typescript
418
420
  import { genQrImage } from '@tapple.io/qr-code-generator';
419
421
 
420
- const qr = await genQrImage('https://tapple.io', {
422
+ const qr = await genQrImage('https://en.wikipedia.org/wiki/QR_code', {
421
423
  output: { format: 'png', type: 'dataURL' }
422
424
  });
423
425
  document.querySelector('#qr-image').src = qr;
@@ -473,15 +475,6 @@ const input: QRInput = {
473
475
  - **No DOM dependency** - Works in Node.js, browsers, and Web Workers
474
476
  - **Fast execution** - Optimized algorithms for matrix generation and mask selection
475
477
 
476
- ## Contributing
477
-
478
- Contributions are welcome! Please feel free to submit a Pull Request.
479
-
480
- 1. Fork the repository
481
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
482
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
483
- 4. Push to the branch (`git push origin feature/amazing-feature`)
484
- 5. Open a Pull Request
485
478
 
486
479
  ## Development
487
480
 
@@ -544,7 +537,7 @@ The library includes comprehensive test coverage:
544
537
  The demo showcases real-time QR code generation with all available options including colors, shapes, borders, logos, and more.
545
538
 
546
539
  **Try it locally:**
547
-
540
+ va
548
541
  ```bash
549
542
  # Clone the repository
550
543
  git clone https://github.com/tappleinc/qr-code-generator.git
@@ -573,4 +566,4 @@ MIT © [Tapple Inc.](https://github.com/tappleinc)
573
566
 
574
567
  ---
575
568
 
576
- Made with ❤️ by [Tapple Inc.](https://tappleinc.com)
569
+ Made with ❤️ by [Tapple.io](https://tapple.io)
package/dist/browser.mjs CHANGED
@@ -1,29 +1,29 @@
1
- var j={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},M={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},Y={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Le={1:[10,12,14],2:[9,11,13],4:[8,16,16]},B={L:1,M:0,Q:3,H:2},v=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],X=[31892,34236,39577,42195],Z=[0,7,7,7,7,7,0,0,0,0];function R(e){return e*4+17}function P(e,r){let t=r<10?0:r<27?1:2;return Le[e][t]}var K=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(K||{}),J=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(J||{}),ee=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(ee||{}),te=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(te||{});function y(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function F(e,r,t=.01){return y(r-e,t)}function ke(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function Te(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),m=l/2;return{dashArray:`${u} ${l}`,offset:m}}function V(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function N(e,r,t,o,n){return n==="circle"?De(e,r,t,o):n==="squircle"?Be(e,r,t,o):Fe(e,r,t,o)}function De(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),m=l%2===0?l:l-1,f=Math.max(4,m);return s*f%1<.6}function Be(e,r,t,o){let s=t/2-o/2,a=t*z,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,m=4*u+4*l,f=Ne(e,r,c,i,u,l,m),{dashArray:d}=V(m,o),[h,g]=d.split(" ").map(Number),b=h+g;return(f+h/2)%b<h}function Ne(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function Fe(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,m=o*(u+l),f=Math.max(1,Math.round(c/m)),d=c/f,h=d*(u/(u+l)),b=(d-h)/2;return(i+b)%d<h}var z=.12,Ve={EYE_FRAME:.90909},E={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return y(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*Ve.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
1
+ var X={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},R={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},Z={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},I="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ve={1:[10,12,14],2:[9,11,13],4:[8,16,16]},B={L:1,M:0,Q:3,H:2},P=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],K=[31892,34236,39577,42195],J=[0,7,7,7,7,7,0,0,0,0];function v(e){return e*4+17}function D(e,r){let t=r<10?0:r<27?1:2;return Ve[e][t]}var ee=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(ee||{}),te=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(te||{}),re=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(re||{}),ne=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(ne||{});function x(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function N(e,r,t=.01){return x(r-e,t)}function Ne(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function Qe(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),d=l/2;return{dashArray:`${u} ${l}`,offset:d}}function Q(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function V(e,r,t,o,n){return n==="circle"?Fe(e,r,t,o):n==="squircle"?qe(e,r,t,o):ze(e,r,t,o)}function Fe(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),d=l%2===0?l:l-1,f=Math.max(4,d);return s*f%1<.6}function qe(e,r,t,o){let s=t/2-o/2,a=t*F,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,d=4*u+4*l,f=Ue(e,r,c,i,u,l,d),{dashArray:m}=Q(d,o),[h,g]=m.split(" ").map(Number),p=h+g;return(f+h/2)%p<h}function Ue(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function ze(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,d=o*(u+l),f=Math.max(1,Math.round(c/d)),m=c/f,h=m*(u/(u+l)),p=(m-h)/2;return(i+p)%m<h}var F=.09,_e={EYE_FRAME:.90909},S={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*_e.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
2
2
  C${a+s},${i-n} ${a+n},${i-s} ${a+n},${i}
3
3
  S${a+s},${i+n} ${a},${i+n}
4
4
  S${a-n},${i+s} ${a-n},${i}
5
- S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let m=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),d=(1-m)/f;return y(d,s)}}},I={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,m=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],d=c>0&&i[c-1][u],h=c<l-1&&i[c+1][u],g=m?1/0:n+e,b=f?1/0:n-e,$=d?1/0:n+r,C=h?1/0:n-r,D=Math.min(Math.min(g,b),Math.min($,C));return y(D,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return y(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return F(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return y(i,a)}}},L={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,d=t-s,{dashArray:h,offset:g}=Te(d,s);return`<rect x="${e+f}" y="${r+f}" width="${d}" height="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${-g}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,m=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${m}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),m=c-Math.abs(e),f=c-Math.abs(r),d=Math.min(u,l),h=Math.min(m,f);if(d>=0&&h<=0){if(s==="dashed"&&!N(e,r,t,n,"square"))return 0;let g=y(d,a),b=255-y(h,a);return Math.min(g,b)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,m=t*z,f=Math.max(0,m-s/2),d=l-f,h=`M${c},${u-l}
6
- H${c+d}
7
- A${f},${f} 0 0 1 ${c+l},${u-d}
8
- V${u+d}
9
- A${f},${f} 0 0 1 ${c+d},${u+l}
10
- H${c-d}
11
- A${f},${f} 0 0 1 ${c-l},${u+d}
12
- V${u-d}
13
- A${f},${f} 0 0 1 ${c-d},${u-l}
14
- Z`;if(a==="dashed"){let g=2*d,b=.5*Math.PI*f,$=4*g+4*b,{dashArray:C,offset:D}=V($,s);return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${C}" stroke-dashoffset="${D}"/>`}return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*z,l=Math.max(0,u-n/2),m=Math.abs(ke(e,r,c,l)),f=n/2-m;return f>-a?s==="dashed"&&!N(e,r,t,n,"squircle")?0:y(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let d=u-s/2,h=2*Math.PI*d,{dashArray:g,offset:b}=V(h,s);return`<circle cx="${i}" cy="${c}" r="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${b}"/>`}let l=u-s,m=`M${i},${c-u}
5
+ S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let d=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),m=(1-d)/f;return x(m,s)}}},E={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,d=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],m=c>0&&i[c-1][u],h=c<l-1&&i[c+1][u],g=d?1/0:n+e,p=f?1/0:n-e,y=m?1/0:n+r,$=h?1/0:n-r,T=Math.min(Math.min(g,p),Math.min(y,$));return x(T,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return N(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return x(i,a)}}},L={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,m=t-s,{dashArray:h,offset:g}=Qe(m,s);return`<rect x="${e+f}" y="${r+f}" width="${m}" height="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${-g}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,d=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${d}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),d=c-Math.abs(e),f=c-Math.abs(r),m=Math.min(u,l),h=Math.min(d,f);if(m>=0&&h<=0){if(s==="dashed"&&!V(e,r,t,n,"square"))return 0;let g=x(m,a),p=255-x(h,a);return Math.min(g,p)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,d=t*F,f=Math.max(0,d-s/2),m=l-f,h=`M${c},${u-l}
6
+ H${c+m}
7
+ A${f},${f} 0 0 1 ${c+l},${u-m}
8
+ V${u+m}
9
+ A${f},${f} 0 0 1 ${c+m},${u+l}
10
+ H${c-m}
11
+ A${f},${f} 0 0 1 ${c-l},${u+m}
12
+ V${u-m}
13
+ A${f},${f} 0 0 1 ${c-m},${u-l}
14
+ Z`;if(a==="dashed"){let g=2*m,p=.5*Math.PI*f,y=4*g+4*p,{dashArray:$,offset:T}=Q(y,s);return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${$}" stroke-dashoffset="${T}"/>`}return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*F,l=Math.max(0,u-n/2),d=Math.abs(Ne(e,r,c,l)),f=n/2-d;return f>-a?s==="dashed"&&!V(e,r,t,n,"squircle")?0:x(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let m=u-s/2,h=2*Math.PI*m,{dashArray:g,offset:p}=Q(h,s);return`<circle cx="${i}" cy="${c}" r="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${p}"/>`}let l=u-s,d=`M${i},${c-u}
15
15
  A${u},${u} 0 1,1 ${i},${c+u}
16
16
  A${u},${u} 0 1,1 ${i},${c-u}Z`,f=`M${i},${c-l}
17
17
  A${l},${l} 0 1,0 ${i},${c+l}
18
- A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${m} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!N(e,r,t,n,"circle"))return 0;let l=F(u,i,a),m=255-F(u,c,a);return Math.min(l,m)}return 0}}};var w=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
18
+ A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${d} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!V(e,r,t,n,"circle"))return 0;let l=N(u,i,a),d=255-N(u,c,a);return Math.min(l,d)}return 0}}};var C=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
19
19
  `);super(`QR Code validation failed:
20
- ${t}`),this.name="QRValidationError",this.errors=r}};function x(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function O(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function _(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function re(e){let r=[];if(e.size!==void 0){let t=x(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=O(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=_(e.eyes.shape,"eyes.shape",E);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=O(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=O(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=_(e.dots.shape,"dots.shape",I);t&&r.push(t)}if(e.dots?.color!==void 0){let t=O(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=x(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=_(e.border.shape,"border.shape",L);t&&r.push(t)}if(e.border?.width!==void 0){let t=x(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=O(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo&&((!e.logo.src||typeof e.logo.src!="string")&&r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"}),e.logo.scale!==void 0)){let t=x(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}if(r.length>0)throw new w(r)}function ne(e){let r=[];if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new w(r)}var p={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},k={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function oe(e){if(!e){let{logo:t,...o}=p;return o}return re(e),{size:e.size??p.size,margin:e.margin??p.margin,backgroundColor:e.backgroundColor??p.backgroundColor,eyes:{shape:e.eyes?.shape??p.eyes.shape,color:e.eyes?.color??p.eyes.color},pupils:{color:e.pupils?.color??p.pupils.color},dots:{shape:e.dots?.shape??p.dots.shape,color:e.dots?.color??p.dots.color,scale:e.dots?.scale??p.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??p.logo.scale}:void 0,border:{shape:e.border?.shape??p.border.shape,width:e.border?.width??p.border.width,color:e.border?.color??p.border.color,style:e.border?.style??p.border.style},output:e.output??p.output}}function se(e){return e?(ne(e),{margin:e.margin??k.margin,darkChar:e.darkChar??k.darkChar,lightChar:e.lightChar??k.lightChar}):{...k}}function ae(e){return/^\d+$/.test(e)?1:[...e].every(r=>S.includes(r))?2:4}function ze(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function _e(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=S.indexOf(e[t])*45+S.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=S.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function qe(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function Qe(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=P(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function Ue(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function Ge(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function ie(e,r,t){let o=ae(e),n,s;o===1?(n=ze(e),s=e.length):o===2?(n=_e(e),s=e.length):(n=qe(e),s=new TextEncoder().encode(e).length);let a=Qe(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=Ue(a);return Ge(c,t)}function T(e,r){let t=ae(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=P(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,m=4+u+l;if(Math.ceil(m/8)<=r[c-1])return c}let n=P(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function ce(e,r){if(r)try{if(T(e,M.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(T(e,M[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var A=new Array(256),q=new Array(256);function We(){let e=1;for(let r=0;r<255;r++)A[r]=e,q[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)A[r]=A[r-255]}We();function le(e,r){return e===0||r===0?0:A[q[e]+q[r]]}function He(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=le(r[s],A[t]);r=n}return r}function ue(e,r){let t=He(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=le(t[a],s)}return o.slice(e.length)}function fe(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let m=e.slice(u,u+a);o.push(m);let f=ue(m,r);n.push(f),u+=a}for(let l=0;l<i;l++){let m=e.slice(u,u+c);o.push(m);let f=ue(m,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function me(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function de(e){let r=R(e);return Array.from({length:r},()=>Array(r).fill(!1))}function he(e){let r=R(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=v[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function Q(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function je(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function ge(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function be(e){Q(e,0,0),Q(e,0,e.length-7),Q(e,e.length-7,0)}function pe(e,r){let t=e.length,o=v[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||je(e,n,s)}function $e(e,r){e[4*r+9][8]=!0}function Ce(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function U(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function Ye(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let m=1;m<r;m++)e[a][m]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][m],u=1),e[m][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[m][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function ye(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);U(i,r,a),o(i,t,a);let c=Ye(i);c<s&&(s=c,n=a)}return n}function G(e,r,t){let o=e.length,n=B[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function Me(e,r){if(r<7)return;let t=e.length,o=X[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function xe(e,r){return B[e]<<3|r}function Se(e,r,t,o,n){let s=de(e),a=he(e);be(s),ge(s),pe(s,e),$e(s,e),Ce(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??ye(s,a,r,G);return U(s,a,c),G(s,r,c),Me(s,e),{matrix:s,mask:c,formatInfo:n?xe(r,c):void 0,unmaskedMatrix:i}}function W(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function Re(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function Ee(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function Xe(e,r,t,o,n,s,a){let i=E[t]||E.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function Ze(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let d=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(d)try{i=decodeURIComponent(d[1])}catch{return""}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([^>]*)>/i),m="";if(l){let d=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);d&&(m=" "+d.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[^>]*>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
- <svg width="${o}" height="${o}" viewBox="${u}"${m}>
20
+ ${t}`),this.name="QRValidationError",this.errors=r}};function M(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function w(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function q(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function We(e,r){let t=/^data:image\/(png|jpeg|jpg|gif|svg\+xml|webp);base64,/i,o=e.trim().startsWith("<svg");if(!t.test(e)&&!o)return{field:r,value:"[truncated]",message:"must be a data URL (data:image/...;base64,...) or SVG string (<svg...)"};if(e.startsWith("data:")){let n=e.split(",");if(n.length!==2)return{field:r,value:"[truncated]",message:"data URL format is invalid (missing comma separator)"};let s=n[1];if(!s||!Ge(s))return{field:r,value:"[truncated]",message:"data URL contains invalid base64 encoding"}}return o&&!e.includes("</svg>")?{field:r,value:"[truncated]",message:"SVG string is incomplete (missing closing </svg> tag)"}:null}function Ge(e){try{return/^[A-Za-z0-9+/]*={0,2}$/.test(e)&&e.length%4===0}catch{return!1}}function se(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function U(e){return/^[\d\s\-+()]+$/.test(e)&&e.replace(/\D/g,"").length>=7}function ae(e){try{return new URL(e.startsWith("http")?e:`https://${e}`),!0}catch{return!1}}function ie(e){let r=[];if(e.size!==void 0){let t=M(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=M(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=w(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=q(e.eyes.shape,"eyes.shape",S);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=w(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=w(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=q(e.dots.shape,"dots.shape",E);t&&r.push(t)}if(e.dots?.color!==void 0){let t=w(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=M(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=q(e.border.shape,"border.shape",L);t&&r.push(t)}if(e.border?.width!==void 0){let t=M(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=w(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo){if(!e.logo.src||typeof e.logo.src!="string")r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"});else{let t=We(e.logo.src,"logo.src");t&&r.push(t)}if(e.logo.scale!==void 0){let t=M(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}}if(r.length>0)throw new C(r)}function ce(e){let r=[];if(e.margin!==void 0){let t=M(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new C(r)}function z(e){let r=[];if(typeof e=="string"){if(e||r.push({field:"input",value:e,message:"string input cannot be empty"}),r.length>0)throw new C(r);return}if(!e||typeof e!="object"||!("type"in e))throw r.push({field:"input",value:e,message:"must be a string or structured content object with a type property"}),new C(r);let t=e;switch(t.type){case"wifi":{je(e.data,r);break}case"vcard":{He(e.data,r);break}case"calendar":{Ye(e.data,r);break}case"email":{Xe(e,r);break}case"sms":{Ze(e,r);break}case"phone":{Ke(e,r);break}case"url":{Je(e,r);break}default:r.push({field:"input.type",value:t.type,message:"must be one of: url, vcard, wifi, calendar, email, sms, phone"})}if(r.length>0)throw new C(r)}function je(e,r){if(!e||typeof e!="object"){r.push({field:"wifi.data",value:e,message:"must be an object"});return}let t=e;if((!t.ssid||typeof t.ssid!="string"||!t.ssid.trim())&&r.push({field:"wifi.ssid",value:t.ssid,message:"is required and must be non-empty"}),(!t.password||typeof t.password!="string")&&r.push({field:"wifi.password",value:t.password,message:"is required and must be a string"}),t.encryption!==void 0){let o=["WPA","WPA2","WEP","nopass"];o.includes(t.encryption)||r.push({field:"wifi.encryption",value:t.encryption,message:`must be one of: ${o.join(", ")}`})}t.hidden!==void 0&&typeof t.hidden!="boolean"&&r.push({field:"wifi.hidden",value:t.hidden,message:"must be a boolean"})}function He(e,r){if(!e||typeof e!="object"){r.push({field:"vcard.data",value:e,message:"must be an object"});return}let t=e;(!t.name||typeof t.name!="string"||!t.name.trim())&&r.push({field:"vcard.name",value:t.name,message:"is required and must be non-empty"}),t.email!==void 0&&(typeof t.email!="string"||!se(t.email))&&r.push({field:"vcard.email",value:t.email,message:"must be a valid email address"}),t.phone!==void 0&&(typeof t.phone!="string"||!U(t.phone))&&r.push({field:"vcard.phone",value:t.phone,message:"must be a valid phone number (e.g., +1-555-123-4567)"}),t.url!==void 0&&(typeof t.url!="string"||!ae(t.url))&&r.push({field:"vcard.url",value:t.url,message:"must be a valid URL"}),t.address!==void 0&&typeof t.address!="object"&&r.push({field:"vcard.address",value:t.address,message:"must be an object"})}function Ye(e,r){if(!e||typeof e!="object"){r.push({field:"calendar.data",value:e,message:"must be an object"});return}let t=e;(!t.title||typeof t.title!="string"||!t.title.trim())&&r.push({field:"calendar.title",value:t.title,message:"is required and must be non-empty"});let o=oe(t.startDate);if(o||r.push({field:"calendar.startDate",value:t.startDate,message:"is required and must be a valid Date object or ISO string"}),t.endDate!==void 0){let n=oe(t.endDate);n?o&&n<o&&r.push({field:"calendar.endDate",value:t.endDate,message:"must be after startDate"}):r.push({field:"calendar.endDate",value:t.endDate,message:"must be a valid Date object or ISO string"})}}function Xe(e,r){let t=e;(!t.email||typeof t.email!="string"||!se(t.email))&&r.push({field:"email.email",value:t.email,message:"is required and must be a valid email address"}),t.subject!==void 0&&typeof t.subject!="string"&&r.push({field:"email.subject",value:t.subject,message:"must be a string"}),t.body!==void 0&&typeof t.body!="string"&&r.push({field:"email.body",value:t.body,message:"must be a string"})}function Ze(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!U(t.phone))&&r.push({field:"sms.phone",value:t.phone,message:"is required and must be a valid phone number"}),t.message!==void 0&&typeof t.message!="string"&&r.push({field:"sms.message",value:t.message,message:"must be a string"})}function Ke(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!U(t.phone))&&r.push({field:"phone.phone",value:t.phone,message:"is required and must be a valid phone number"})}function Je(e,r){let t=e;(!t.url||typeof t.url!="string"||!ae(t.url))&&r.push({field:"url.url",value:t.url,message:"is required and must be a valid URL"})}function oe(e){if(e instanceof Date)return isNaN(e.getTime())?null:e;if(typeof e=="string"){let r=new Date(e);return isNaN(r.getTime())?null:r}return null}var b={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},A={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function ue(e){if(!e){let{logo:t,...o}=b;return o}return ie(e),{size:e.size??b.size,margin:e.margin??b.margin,backgroundColor:e.backgroundColor??b.backgroundColor,eyes:{shape:e.eyes?.shape??b.eyes.shape,color:e.eyes?.color??b.eyes.color},pupils:{color:e.pupils?.color??b.pupils.color},dots:{shape:e.dots?.shape??b.dots.shape,color:e.dots?.color??b.dots.color,scale:e.dots?.scale??b.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??b.logo.scale}:void 0,border:{shape:e.border?.shape??b.border.shape,width:e.border?.width??b.border.width,color:e.border?.color??b.border.color,style:e.border?.style??b.border.style},output:e.output??b.output}}function le(e){return e?(ce(e),{margin:e.margin??A.margin,darkChar:e.darkChar??A.darkChar,lightChar:e.lightChar??A.lightChar}):{...A}}function fe(e){return/^\d+$/.test(e)?1:[...e].every(r=>I.includes(r))?2:4}function et(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function tt(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=I.indexOf(e[t])*45+I.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=I.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function rt(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function nt(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=D(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function ot(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function st(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function de(e,r,t){let o=fe(e),n,s;o===1?(n=et(e),s=e.length):o===2?(n=tt(e),s=e.length):(n=rt(e),s=new TextEncoder().encode(e).length);let a=nt(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=ot(a);return st(c,t)}function k(e,r){let t=fe(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=D(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,d=4+u+l;if(Math.ceil(d/8)<=r[c-1])return c}let n=D(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function me(e,r){if(r)try{if(k(e,R.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(k(e,R[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var O=new Array(256),_=new Array(256);function at(){let e=1;for(let r=0;r<255;r++)O[r]=e,_[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)O[r]=O[r-255]}at();function ge(e,r){return e===0||r===0?0:O[_[e]+_[r]]}function it(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=ge(r[s],O[t]);r=n}return r}function he(e,r){let t=it(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=ge(t[a],s)}return o.slice(e.length)}function pe(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let d=e.slice(u,u+a);o.push(d);let f=he(d,r);n.push(f),u+=a}for(let l=0;l<i;l++){let d=e.slice(u,u+c);o.push(d);let f=he(d,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function be(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function ye(e){let r=v(e);return Array.from({length:r},()=>Array(r).fill(!1))}function $e(e){let r=v(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=P[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function W(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function ct(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function xe(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function Ce(e){W(e,0,0),W(e,0,e.length-7),W(e,e.length-7,0)}function Re(e,r){let t=e.length,o=P[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||ct(e,n,s)}function Me(e,r){e[4*r+9][8]=!0}function Ie(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function G(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function ut(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let d=1;d<r;d++)e[a][d]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][d],u=1),e[d][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[d][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function ve(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);G(i,r,a),o(i,t,a);let c=ut(i);c<s&&(s=c,n=a)}return n}function j(e,r,t){let o=e.length,n=B[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function Se(e,r){if(r<7)return;let t=e.length,o=K[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function Ee(e,r){return B[e]<<3|r}function we(e,r,t,o,n){let s=ye(e),a=$e(e);Ce(s),xe(s),Re(s,e),Me(s,e),Ie(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??ve(s,a,r,j);return G(s,a,c),j(s,r,c),Se(s,e),{matrix:s,mask:c,formatInfo:n?Ee(r,c):void 0,unmaskedMatrix:i}}function H(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function Oe(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function Pe(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function lt(e,r,t,o,n,s,a){let i=S[t]||S.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function ft(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let m=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(m){let h=m[1];if(e.includes("base64"))try{if(typeof atob<"u")i=atob(h);else if(typeof Buffer<"u")i=Buffer.from(h,"base64").toString("utf-8");else return""}catch{return""}else try{i=decodeURIComponent(h)}catch{return""}}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([\s\S]*?)>/i),d="";if(l){let m=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);m&&(d=" "+m.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[\s\S]*?>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
+ <svg width="${o}" height="${o}" viewBox="${u}"${d}>
22
22
  ${f}
23
23
  </svg>
24
- </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function Ke(e,r,t,o,n){let s=e.matrixSize,a="",i=I[t]||I.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!W(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d;a+=`M${h},${g}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!W(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d,b={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(h,g,f,o,b)}return a}function Ie(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,m=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let $=L[r.border.shape];if($){let C={borderWidth:u,borderStyle:r.border.style};f+=$.renderSVG(0,0,l,r.border.color,C)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${m}" y="${m}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${m}, ${m})">`;let d=Re(e.matrixSize),h="";for(let $ of d)h+=Xe($.x*c,$.y*c,s.shape,s.color,a.color,n,c);let g=Ke(e,c,i.shape,i.color,i.scale);f+=h+g+"</g>";let b="";if(r.logo){let $=Ee(e.matrixSize,r.logo.scale)*c,C=l/2;b=Ze(r.logo.src,C,C,$)}return f+=b+"</svg>",f}function Oe(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
24
+ </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function dt(e,r,t,o,n){let s=e.matrixSize,a="",i=E[t]||E.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!H(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,h=l+m,g=d+m;a+=`M${h},${g}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!H(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,h=l+m,g=d+m,p={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(h,g,f,o,p)}return a}function De(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,d=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let y=L[r.border.shape];if(y){let $={borderWidth:u,borderStyle:r.border.style};f+=y.renderSVG(0,0,l,r.border.color,$)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${d}" y="${d}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${d}, ${d})">`;let m=Oe(e.matrixSize),h="";for(let y of m)h+=lt(y.x*c,y.y*c,s.shape,s.color,a.color,n,c);let g=dt(e,c,i.shape,i.color,i.scale);f+=h+g+"</g>";let p="";if(r.logo){let y=Pe(e.matrixSize,r.logo.scale)*c,$=l/2;p=ft(r.logo.src,$,$,y)}return f+=p+"</svg>",f}function Le(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
25
25
  `;for(let i=0;i<e.matrixSize;i++){s+=o.repeat(t);for(let c=0;c<e.matrixSize;c++)s+=e.modules[i][c]?n:o;s+=o.repeat(t)+`
26
26
  `}for(let i=0;i<t;i++)s+=o.repeat(a)+`
27
- `;return s}async function we(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a;return new Promise((c,u)=>{let l=document.createElement("canvas");l.width=i,l.height=i;let m=l.getContext("2d");if(!m){u(new Error("Failed to get canvas context"));return}let f=new Image,d=null;try{let h=new Blob([e],{type:"image/svg+xml;charset=utf-8"});d=URL.createObjectURL(h)}catch{u(new Error("Failed to create SVG blob for rasterization"));return}f.onload=()=>{if(d&&URL.revokeObjectURL(d),m.drawImage(f,0,0,i,i),t.type==="dataURL"){let h=l.toDataURL("image/png");c(h)}else l.toBlob(h=>{if(!h){u(new Error("Failed to convert PNG to blob"));return}h.arrayBuffer().then(g=>{c(new Uint8Array(g))})},"image/png")},f.onerror=()=>{d&&URL.revokeObjectURL(d),u(new Error("Failed to load SVG for rasterization"))},f.src=d})}async function Ae(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await we(e,r)}function H(e){if(typeof e=="string")return e;switch(e.type){case"url":return Je(e.url);case"vcard":return et(e.data);case"wifi":return tt(e.data);case"calendar":return rt(e.data);case"email":return nt(e.email,e.subject,e.body);case"sms":return ot(e.phone,e.message);case"phone":return st(e.phone)}}function Je(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function et(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
- `)}function tt(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=ve(e.ssid),n=ve(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function ve(e){return e.replace(/([\\;,":])/g,"\\$1")}function rt(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
- `)}function nt(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function ot(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function st(e){return`tel:${e}`}function at(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=Z[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function Pe(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=ce(e,r),o=M[t],n=T(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${M[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=ie(e,n,o[n-1]),a=j[t][n-1],i=Y[t][n-1],{dataBlocks:c,ecBlocks:u}=fe(s,a,i),l=me(c,u),m=at(l,n),{matrix:f,mask:d}=Se(n,t,m);return{version:n,matrixSize:R(n),modules:f,mask:d,errorCorrectionLevel:t}}async function it(e,r){let t=H(e),o=oe(r),n=Pe(t,!!o.logo),s=Ie(n,o);return await Ae(s,o)}function ct(e,r){let t=H(e),o=se(r),n=Pe(t,!1);return Oe(n,o)}export{ee as BorderShape,te as BorderStyle,J as DotShape,K as EyeFrameShape,w as QRValidationError,it as genQrImage,ct as genQrText};
27
+ `;return s}async function Ae(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a;return new Promise((c,u)=>{let l=document.createElement("canvas");l.width=i,l.height=i;let d=l.getContext("2d");if(!d){u(new Error("Failed to get canvas context"));return}let f=new Image,m=null;try{let h=new Blob([e],{type:"image/svg+xml;charset=utf-8"});m=URL.createObjectURL(h)}catch{u(new Error("Failed to create SVG blob for rasterization"));return}f.onload=()=>{if(m&&URL.revokeObjectURL(m),d.drawImage(f,0,0,i,i),t.type==="dataURL"){let h=l.toDataURL("image/png");c(h)}else l.toBlob(h=>{if(!h){u(new Error("Failed to convert PNG to blob"));return}h.arrayBuffer().then(g=>{c(new Uint8Array(g))})},"image/png")},f.onerror=()=>{m&&URL.revokeObjectURL(m),u(new Error("Failed to load SVG for rasterization"))},f.src=m})}async function ke(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await Ae(e,r)}function Y(e){if(typeof e=="string")return e;switch(e.type){case"url":return mt(e.url);case"vcard":return ht(e.data);case"wifi":return gt(e.data);case"calendar":return pt(e.data);case"email":return bt(e.email,e.subject,e.body);case"sms":return yt(e.phone,e.message);case"phone":return $t(e.phone)}}function mt(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function ht(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
+ `)}function gt(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=Te(e.ssid),n=Te(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function Te(e){return e.replace(/([\\;,":])/g,"\\$1")}function pt(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
+ `)}function bt(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function yt(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function $t(e){return`tel:${e}`}function xt(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=J[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function Be(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=me(e,r),o=R[t],n=k(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${R[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=de(e,n,o[n-1]),a=X[t][n-1],i=Z[t][n-1],{dataBlocks:c,ecBlocks:u}=pe(s,a,i),l=be(c,u),d=xt(l,n),{matrix:f,mask:m}=we(n,t,d);return{version:n,matrixSize:v(n),modules:f,mask:m,errorCorrectionLevel:t}}async function Ct(e,r){z(e);let t=Y(e),o=ue(r),n=Be(t,!!o.logo),s=De(n,o);return await ke(s,o)}function Rt(e,r){z(e);let t=Y(e),o=le(r),n=Be(t,!1);return Le(n,o)}export{re as BorderShape,ne as BorderStyle,te as DotShape,ee as EyeFrameShape,C as QRValidationError,Ct as genQrImage,Rt as genQrText};
package/dist/node.cjs CHANGED
@@ -1,29 +1,29 @@
1
- "use strict";var Ve=Object.create;var P=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var qe=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty;var Qe=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},ee=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Fe(r))!_e.call(e,n)&&n!==t&&P(e,n,{get:()=>r[n],enumerable:!(o=ze(r,n))||o.enumerable});return e};var Ge=(e,r,t)=>(t=e!=null?Ve(qe(e)):{},ee(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),Ue=e=>ee(P({},"__esModule",{value:!0}),e);var xt={};Qe(xt,{BorderShape:()=>q,BorderStyle:()=>_,DotShape:()=>F,EyeFrameShape:()=>z,QRValidationError:()=>S,genQrImage:()=>Be,genQrText:()=>Ne});module.exports=Ue(xt);var te={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},y={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},re={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},R="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",We={1:[10,12,14],2:[9,11,13],4:[8,16,16]},V={L:1,M:0,Q:3,H:2},A=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],ne=[31892,34236,39577,42195],oe=[0,7,7,7,7,7,0,0,0,0];function I(e){return e*4+17}function L(e,r){let t=r<10?0:r<27?1:2;return We[e][t]}var z=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(z||{}),F=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(F||{}),q=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(q||{}),_=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(_||{});function M(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function G(e,r,t=.01){return M(r-e,t)}function je(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function He(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),m=l/2;return{dashArray:`${u} ${l}`,offset:m}}function U(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function Q(e,r,t,o,n){return n==="circle"?Ye(e,r,t,o):n==="squircle"?Xe(e,r,t,o):Ke(e,r,t,o)}function Ye(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),m=l%2===0?l:l-1,f=Math.max(4,m);return s*f%1<.6}function Xe(e,r,t,o){let s=t/2-o/2,a=t*W,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,m=4*u+4*l,f=Ze(e,r,c,i,u,l,m),{dashArray:d}=U(m,o),[h,g]=d.split(" ").map(Number),b=h+g;return(f+h/2)%b<h}function Ze(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function Ke(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,m=o*(u+l),f=Math.max(1,Math.round(c/m)),d=c/f,h=d*(u/(u+l)),b=(d-h)/2;return(i+b)%d<h}var W=.12,Je={EYE_FRAME:.90909},E={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return M(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*Je.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
1
+ "use strict";var je=Object.create;var P=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var Ue=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var He=(e,r)=>{for(var t in r)P(e,t,{get:r[t],enumerable:!0})},re=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Ue(r))!Ge.call(e,n)&&n!==t&&P(e,n,{get:()=>r[n],enumerable:!(o=_e(r,n))||o.enumerable});return e};var Ye=(e,r,t)=>(t=e!=null?je(We(e)):{},re(r||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),Xe=e=>re(P({},"__esModule",{value:!0}),e);var Bt={};He(Bt,{BorderShape:()=>F,BorderStyle:()=>z,DotShape:()=>q,EyeFrameShape:()=>Q,QRValidationError:()=>v,genQrImage:()=>Fe,genQrText:()=>ze});module.exports=Xe(Bt);var ne={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},C={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},oe={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},M="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ze={1:[10,12,14],2:[9,11,13],4:[8,16,16]},N={L:1,M:0,Q:3,H:2},D=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],se=[31892,34236,39577,42195],ae=[0,7,7,7,7,7,0,0,0,0];function I(e){return e*4+17}function A(e,r){let t=r<10?0:r<27?1:2;return Ze[e][t]}var Q=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(Q||{}),q=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(q||{}),F=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(F||{}),z=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(z||{});function x(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function _(e,r,t=.01){return x(r-e,t)}function Ke(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function Je(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),d=l/2;return{dashArray:`${u} ${l}`,offset:d}}function U(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function j(e,r,t,o,n){return n==="circle"?et(e,r,t,o):n==="squircle"?tt(e,r,t,o):nt(e,r,t,o)}function et(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),d=l%2===0?l:l-1,f=Math.max(4,d);return s*f%1<.6}function tt(e,r,t,o){let s=t/2-o/2,a=t*W,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,d=4*u+4*l,f=rt(e,r,c,i,u,l,d),{dashArray:m}=U(d,o),[g,h]=m.split(" ").map(Number),p=g+h;return(f+g/2)%p<g}function rt(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function nt(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,d=o*(u+l),f=Math.max(1,Math.round(c/d)),m=c/f,g=m*(u/(u+l)),p=(m-g)/2;return(i+p)%m<g}var W=.09,ot={EYE_FRAME:.90909},S={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*ot.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
2
2
  C${a+s},${i-n} ${a+n},${i-s} ${a+n},${i}
3
3
  S${a+s},${i+n} ${a},${i+n}
4
4
  S${a-n},${i+s} ${a-n},${i}
5
- S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let m=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),d=(1-m)/f;return M(d,s)}}},v={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,m=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],d=c>0&&i[c-1][u],h=c<l-1&&i[c+1][u],g=m?1/0:n+e,b=f?1/0:n-e,$=d?1/0:n+r,C=h?1/0:n-r,N=Math.min(Math.min(g,b),Math.min($,C));return M(N,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return M(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return G(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return M(i,a)}}},T={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,d=t-s,{dashArray:h,offset:g}=He(d,s);return`<rect x="${e+f}" y="${r+f}" width="${d}" height="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${-g}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,m=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${m}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),m=c-Math.abs(e),f=c-Math.abs(r),d=Math.min(u,l),h=Math.min(m,f);if(d>=0&&h<=0){if(s==="dashed"&&!Q(e,r,t,n,"square"))return 0;let g=M(d,a),b=255-M(h,a);return Math.min(g,b)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,m=t*W,f=Math.max(0,m-s/2),d=l-f,h=`M${c},${u-l}
6
- H${c+d}
7
- A${f},${f} 0 0 1 ${c+l},${u-d}
8
- V${u+d}
9
- A${f},${f} 0 0 1 ${c+d},${u+l}
10
- H${c-d}
11
- A${f},${f} 0 0 1 ${c-l},${u+d}
12
- V${u-d}
13
- A${f},${f} 0 0 1 ${c-d},${u-l}
14
- Z`;if(a==="dashed"){let g=2*d,b=.5*Math.PI*f,$=4*g+4*b,{dashArray:C,offset:N}=U($,s);return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${C}" stroke-dashoffset="${N}"/>`}return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*W,l=Math.max(0,u-n/2),m=Math.abs(je(e,r,c,l)),f=n/2-m;return f>-a?s==="dashed"&&!Q(e,r,t,n,"squircle")?0:M(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let d=u-s/2,h=2*Math.PI*d,{dashArray:g,offset:b}=U(h,s);return`<circle cx="${i}" cy="${c}" r="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${b}"/>`}let l=u-s,m=`M${i},${c-u}
5
+ S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let d=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),m=(1-d)/f;return x(m,s)}}},E={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,d=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],m=c>0&&i[c-1][u],g=c<l-1&&i[c+1][u],h=d?1/0:n+e,p=f?1/0:n-e,y=m?1/0:n+r,$=g?1/0:n-r,V=Math.min(Math.min(h,p),Math.min(y,$));return x(V,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return _(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return x(i,a)}}},L={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,m=t-s,{dashArray:g,offset:h}=Je(m,s);return`<rect x="${e+f}" y="${r+f}" width="${m}" height="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${-h}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,d=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${d}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),d=c-Math.abs(e),f=c-Math.abs(r),m=Math.min(u,l),g=Math.min(d,f);if(m>=0&&g<=0){if(s==="dashed"&&!j(e,r,t,n,"square"))return 0;let h=x(m,a),p=255-x(g,a);return Math.min(h,p)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,d=t*W,f=Math.max(0,d-s/2),m=l-f,g=`M${c},${u-l}
6
+ H${c+m}
7
+ A${f},${f} 0 0 1 ${c+l},${u-m}
8
+ V${u+m}
9
+ A${f},${f} 0 0 1 ${c+m},${u+l}
10
+ H${c-m}
11
+ A${f},${f} 0 0 1 ${c-l},${u+m}
12
+ V${u-m}
13
+ A${f},${f} 0 0 1 ${c-m},${u-l}
14
+ Z`;if(a==="dashed"){let h=2*m,p=.5*Math.PI*f,y=4*h+4*p,{dashArray:$,offset:V}=U(y,s);return`<path d="${g}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${$}" stroke-dashoffset="${V}"/>`}return`<path d="${g}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*W,l=Math.max(0,u-n/2),d=Math.abs(Ke(e,r,c,l)),f=n/2-d;return f>-a?s==="dashed"&&!j(e,r,t,n,"squircle")?0:x(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let m=u-s/2,g=2*Math.PI*m,{dashArray:h,offset:p}=U(g,s);return`<circle cx="${i}" cy="${c}" r="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${p}"/>`}let l=u-s,d=`M${i},${c-u}
15
15
  A${u},${u} 0 1,1 ${i},${c+u}
16
16
  A${u},${u} 0 1,1 ${i},${c-u}Z`,f=`M${i},${c-l}
17
17
  A${l},${l} 0 1,0 ${i},${c+l}
18
- A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${m} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!Q(e,r,t,n,"circle"))return 0;let l=G(u,i,a),m=255-G(u,c,a);return Math.min(l,m)}return 0}}};var S=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
18
+ A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${d} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!j(e,r,t,n,"circle"))return 0;let l=_(u,i,a),d=255-_(u,c,a);return Math.min(l,d)}return 0}}};var v=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
19
19
  `);super(`QR Code validation failed:
20
- ${t}`),this.name="QRValidationError",this.errors=r}};function x(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function O(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function j(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function se(e){let r=[];if(e.size!==void 0){let t=x(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=O(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=j(e.eyes.shape,"eyes.shape",E);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=O(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=O(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=j(e.dots.shape,"dots.shape",v);t&&r.push(t)}if(e.dots?.color!==void 0){let t=O(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=x(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=j(e.border.shape,"border.shape",T);t&&r.push(t)}if(e.border?.width!==void 0){let t=x(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=O(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo&&((!e.logo.src||typeof e.logo.src!="string")&&r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"}),e.logo.scale!==void 0)){let t=x(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}if(r.length>0)throw new S(r)}function ae(e){let r=[];if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new S(r)}var p={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},k={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function ie(e){if(!e){let{logo:t,...o}=p;return o}return se(e),{size:e.size??p.size,margin:e.margin??p.margin,backgroundColor:e.backgroundColor??p.backgroundColor,eyes:{shape:e.eyes?.shape??p.eyes.shape,color:e.eyes?.color??p.eyes.color},pupils:{color:e.pupils?.color??p.pupils.color},dots:{shape:e.dots?.shape??p.dots.shape,color:e.dots?.color??p.dots.color,scale:e.dots?.scale??p.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??p.logo.scale}:void 0,border:{shape:e.border?.shape??p.border.shape,width:e.border?.width??p.border.width,color:e.border?.color??p.border.color,style:e.border?.style??p.border.style},output:e.output??p.output}}function ce(e){return e?(ae(e),{margin:e.margin??k.margin,darkChar:e.darkChar??k.darkChar,lightChar:e.lightChar??k.lightChar}):{...k}}function ue(e){return/^\d+$/.test(e)?1:[...e].every(r=>R.includes(r))?2:4}function et(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function tt(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=R.indexOf(e[t])*45+R.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=R.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function rt(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function nt(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=L(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function ot(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function st(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function le(e,r,t){let o=ue(e),n,s;o===1?(n=et(e),s=e.length):o===2?(n=tt(e),s=e.length):(n=rt(e),s=new TextEncoder().encode(e).length);let a=nt(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=ot(a);return st(c,t)}function D(e,r){let t=ue(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=L(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,m=4+u+l;if(Math.ceil(m/8)<=r[c-1])return c}let n=L(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function fe(e,r){if(r)try{if(D(e,y.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(D(e,y[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var w=new Array(256),H=new Array(256);function at(){let e=1;for(let r=0;r<255;r++)w[r]=e,H[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)w[r]=w[r-255]}at();function de(e,r){return e===0||r===0?0:w[H[e]+H[r]]}function it(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=de(r[s],w[t]);r=n}return r}function me(e,r){let t=it(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=de(t[a],s)}return o.slice(e.length)}function he(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let m=e.slice(u,u+a);o.push(m);let f=me(m,r);n.push(f),u+=a}for(let l=0;l<i;l++){let m=e.slice(u,u+c);o.push(m);let f=me(m,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function ge(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function be(e){let r=I(e);return Array.from({length:r},()=>Array(r).fill(!1))}function pe(e){let r=I(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=A[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function Y(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function ct(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function $e(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function Ce(e){Y(e,0,0),Y(e,0,e.length-7),Y(e,e.length-7,0)}function Me(e,r){let t=e.length,o=A[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||ct(e,n,s)}function ye(e,r){e[4*r+9][8]=!0}function xe(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function X(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function ut(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let m=1;m<r;m++)e[a][m]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][m],u=1),e[m][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[m][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function Se(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);X(i,r,a),o(i,t,a);let c=ut(i);c<s&&(s=c,n=a)}return n}function Z(e,r,t){let o=e.length,n=V[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function Re(e,r){if(r<7)return;let t=e.length,o=ne[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function Ie(e,r){return V[e]<<3|r}function Ee(e,r,t,o,n){let s=be(e),a=pe(e);Ce(s),$e(s),Me(s,e),ye(s,e),xe(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??Se(s,a,r,Z);return X(s,a,c),Z(s,r,c),Re(s,e),{matrix:s,mask:c,formatInfo:n?Ie(r,c):void 0,unmaskedMatrix:i}}function K(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function ve(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function Oe(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function lt(e,r,t,o,n,s,a){let i=E[t]||E.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function ft(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let d=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(d)try{i=decodeURIComponent(d[1])}catch{return""}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([^>]*)>/i),m="";if(l){let d=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);d&&(m=" "+d.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[^>]*>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
- <svg width="${o}" height="${o}" viewBox="${u}"${m}>
20
+ ${t}`),this.name="QRValidationError",this.errors=r}};function R(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function w(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function G(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function st(e,r){let t=/^data:image\/(png|jpeg|jpg|gif|svg\+xml|webp);base64,/i,o=e.trim().startsWith("<svg");if(!t.test(e)&&!o)return{field:r,value:"[truncated]",message:"must be a data URL (data:image/...;base64,...) or SVG string (<svg...)"};if(e.startsWith("data:")){let n=e.split(",");if(n.length!==2)return{field:r,value:"[truncated]",message:"data URL format is invalid (missing comma separator)"};let s=n[1];if(!s||!at(s))return{field:r,value:"[truncated]",message:"data URL contains invalid base64 encoding"}}return o&&!e.includes("</svg>")?{field:r,value:"[truncated]",message:"SVG string is incomplete (missing closing </svg> tag)"}:null}function at(e){try{return/^[A-Za-z0-9+/]*={0,2}$/.test(e)&&e.length%4===0}catch{return!1}}function ce(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function H(e){return/^[\d\s\-+()]+$/.test(e)&&e.replace(/\D/g,"").length>=7}function ue(e){try{return new URL(e.startsWith("http")?e:`https://${e}`),!0}catch{return!1}}function le(e){let r=[];if(e.size!==void 0){let t=R(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=R(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=w(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=G(e.eyes.shape,"eyes.shape",S);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=w(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=w(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=G(e.dots.shape,"dots.shape",E);t&&r.push(t)}if(e.dots?.color!==void 0){let t=w(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=R(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=G(e.border.shape,"border.shape",L);t&&r.push(t)}if(e.border?.width!==void 0){let t=R(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=w(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo){if(!e.logo.src||typeof e.logo.src!="string")r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"});else{let t=st(e.logo.src,"logo.src");t&&r.push(t)}if(e.logo.scale!==void 0){let t=R(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}}if(r.length>0)throw new v(r)}function fe(e){let r=[];if(e.margin!==void 0){let t=R(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new v(r)}function Y(e){let r=[];if(typeof e=="string"){if(e||r.push({field:"input",value:e,message:"string input cannot be empty"}),r.length>0)throw new v(r);return}if(!e||typeof e!="object"||!("type"in e))throw r.push({field:"input",value:e,message:"must be a string or structured content object with a type property"}),new v(r);let t=e;switch(t.type){case"wifi":{it(e.data,r);break}case"vcard":{ct(e.data,r);break}case"calendar":{ut(e.data,r);break}case"email":{lt(e,r);break}case"sms":{ft(e,r);break}case"phone":{dt(e,r);break}case"url":{mt(e,r);break}default:r.push({field:"input.type",value:t.type,message:"must be one of: url, vcard, wifi, calendar, email, sms, phone"})}if(r.length>0)throw new v(r)}function it(e,r){if(!e||typeof e!="object"){r.push({field:"wifi.data",value:e,message:"must be an object"});return}let t=e;if((!t.ssid||typeof t.ssid!="string"||!t.ssid.trim())&&r.push({field:"wifi.ssid",value:t.ssid,message:"is required and must be non-empty"}),(!t.password||typeof t.password!="string")&&r.push({field:"wifi.password",value:t.password,message:"is required and must be a string"}),t.encryption!==void 0){let o=["WPA","WPA2","WEP","nopass"];o.includes(t.encryption)||r.push({field:"wifi.encryption",value:t.encryption,message:`must be one of: ${o.join(", ")}`})}t.hidden!==void 0&&typeof t.hidden!="boolean"&&r.push({field:"wifi.hidden",value:t.hidden,message:"must be a boolean"})}function ct(e,r){if(!e||typeof e!="object"){r.push({field:"vcard.data",value:e,message:"must be an object"});return}let t=e;(!t.name||typeof t.name!="string"||!t.name.trim())&&r.push({field:"vcard.name",value:t.name,message:"is required and must be non-empty"}),t.email!==void 0&&(typeof t.email!="string"||!ce(t.email))&&r.push({field:"vcard.email",value:t.email,message:"must be a valid email address"}),t.phone!==void 0&&(typeof t.phone!="string"||!H(t.phone))&&r.push({field:"vcard.phone",value:t.phone,message:"must be a valid phone number (e.g., +1-555-123-4567)"}),t.url!==void 0&&(typeof t.url!="string"||!ue(t.url))&&r.push({field:"vcard.url",value:t.url,message:"must be a valid URL"}),t.address!==void 0&&typeof t.address!="object"&&r.push({field:"vcard.address",value:t.address,message:"must be an object"})}function ut(e,r){if(!e||typeof e!="object"){r.push({field:"calendar.data",value:e,message:"must be an object"});return}let t=e;(!t.title||typeof t.title!="string"||!t.title.trim())&&r.push({field:"calendar.title",value:t.title,message:"is required and must be non-empty"});let o=ie(t.startDate);if(o||r.push({field:"calendar.startDate",value:t.startDate,message:"is required and must be a valid Date object or ISO string"}),t.endDate!==void 0){let n=ie(t.endDate);n?o&&n<o&&r.push({field:"calendar.endDate",value:t.endDate,message:"must be after startDate"}):r.push({field:"calendar.endDate",value:t.endDate,message:"must be a valid Date object or ISO string"})}}function lt(e,r){let t=e;(!t.email||typeof t.email!="string"||!ce(t.email))&&r.push({field:"email.email",value:t.email,message:"is required and must be a valid email address"}),t.subject!==void 0&&typeof t.subject!="string"&&r.push({field:"email.subject",value:t.subject,message:"must be a string"}),t.body!==void 0&&typeof t.body!="string"&&r.push({field:"email.body",value:t.body,message:"must be a string"})}function ft(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!H(t.phone))&&r.push({field:"sms.phone",value:t.phone,message:"is required and must be a valid phone number"}),t.message!==void 0&&typeof t.message!="string"&&r.push({field:"sms.message",value:t.message,message:"must be a string"})}function dt(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!H(t.phone))&&r.push({field:"phone.phone",value:t.phone,message:"is required and must be a valid phone number"})}function mt(e,r){let t=e;(!t.url||typeof t.url!="string"||!ue(t.url))&&r.push({field:"url.url",value:t.url,message:"is required and must be a valid URL"})}function ie(e){if(e instanceof Date)return isNaN(e.getTime())?null:e;if(typeof e=="string"){let r=new Date(e);return isNaN(r.getTime())?null:r}return null}var b={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},k={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function de(e){if(!e){let{logo:t,...o}=b;return o}return le(e),{size:e.size??b.size,margin:e.margin??b.margin,backgroundColor:e.backgroundColor??b.backgroundColor,eyes:{shape:e.eyes?.shape??b.eyes.shape,color:e.eyes?.color??b.eyes.color},pupils:{color:e.pupils?.color??b.pupils.color},dots:{shape:e.dots?.shape??b.dots.shape,color:e.dots?.color??b.dots.color,scale:e.dots?.scale??b.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??b.logo.scale}:void 0,border:{shape:e.border?.shape??b.border.shape,width:e.border?.width??b.border.width,color:e.border?.color??b.border.color,style:e.border?.style??b.border.style},output:e.output??b.output}}function me(e){return e?(fe(e),{margin:e.margin??k.margin,darkChar:e.darkChar??k.darkChar,lightChar:e.lightChar??k.lightChar}):{...k}}function ge(e){return/^\d+$/.test(e)?1:[...e].every(r=>M.includes(r))?2:4}function gt(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function ht(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=M.indexOf(e[t])*45+M.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=M.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function pt(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function bt(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=A(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function yt(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function $t(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function he(e,r,t){let o=ge(e),n,s;o===1?(n=gt(e),s=e.length):o===2?(n=ht(e),s=e.length):(n=pt(e),s=new TextEncoder().encode(e).length);let a=bt(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=yt(a);return $t(c,t)}function T(e,r){let t=ge(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=A(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,d=4+u+l;if(Math.ceil(d/8)<=r[c-1])return c}let n=A(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function pe(e,r){if(r)try{if(T(e,C.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(T(e,C[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var O=new Array(256),X=new Array(256);function xt(){let e=1;for(let r=0;r<255;r++)O[r]=e,X[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)O[r]=O[r-255]}xt();function ye(e,r){return e===0||r===0?0:O[X[e]+X[r]]}function vt(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=ye(r[s],O[t]);r=n}return r}function be(e,r){let t=vt(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=ye(t[a],s)}return o.slice(e.length)}function $e(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let d=e.slice(u,u+a);o.push(d);let f=be(d,r);n.push(f),u+=a}for(let l=0;l<i;l++){let d=e.slice(u,u+c);o.push(d);let f=be(d,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function xe(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function ve(e){let r=I(e);return Array.from({length:r},()=>Array(r).fill(!1))}function Ce(e){let r=I(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=D[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function Z(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function Ct(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function Re(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function Me(e){Z(e,0,0),Z(e,0,e.length-7),Z(e,e.length-7,0)}function Ie(e,r){let t=e.length,o=D[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||Ct(e,n,s)}function Se(e,r){e[4*r+9][8]=!0}function Ee(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function K(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function Rt(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let d=1;d<r;d++)e[a][d]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][d],u=1),e[d][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[d][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function we(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);K(i,r,a),o(i,t,a);let c=Rt(i);c<s&&(s=c,n=a)}return n}function J(e,r,t){let o=e.length,n=N[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function Oe(e,r){if(r<7)return;let t=e.length,o=se[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function Pe(e,r){return N[e]<<3|r}function De(e,r,t,o,n){let s=ve(e),a=Ce(e);Me(s),Re(s),Ie(s,e),Se(s,e),Ee(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??we(s,a,r,J);return K(s,a,c),J(s,r,c),Oe(s,e),{matrix:s,mask:c,formatInfo:n?Pe(r,c):void 0,unmaskedMatrix:i}}function ee(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function Ae(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function Le(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function Mt(e,r,t,o,n,s,a){let i=S[t]||S.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function It(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let m=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(m){let g=m[1];if(e.includes("base64"))try{if(typeof atob<"u")i=atob(g);else if(typeof Buffer<"u")i=Buffer.from(g,"base64").toString("utf-8");else return""}catch{return""}else try{i=decodeURIComponent(g)}catch{return""}}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([\s\S]*?)>/i),d="";if(l){let m=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);m&&(d=" "+m.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[\s\S]*?>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
+ <svg width="${o}" height="${o}" viewBox="${u}"${d}>
22
22
  ${f}
23
23
  </svg>
24
- </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function mt(e,r,t,o,n){let s=e.matrixSize,a="",i=v[t]||v.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!K(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d;a+=`M${h},${g}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!K(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d,b={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(h,g,f,o,b)}return a}function we(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,m=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let $=T[r.border.shape];if($){let C={borderWidth:u,borderStyle:r.border.style};f+=$.renderSVG(0,0,l,r.border.color,C)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${m}" y="${m}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${m}, ${m})">`;let d=ve(e.matrixSize),h="";for(let $ of d)h+=lt($.x*c,$.y*c,s.shape,s.color,a.color,n,c);let g=mt(e,c,i.shape,i.color,i.scale);f+=h+g+"</g>";let b="";if(r.logo){let $=Oe(e.matrixSize,r.logo.scale)*c,C=l/2;b=ft(r.logo.src,C,C,$)}return f+=b+"</svg>",f}function Pe(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
24
+ </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function St(e,r,t,o,n){let s=e.matrixSize,a="",i=E[t]||E.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!ee(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,g=l+m,h=d+m;a+=`M${g},${h}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!ee(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,g=l+m,h=d+m,p={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(g,h,f,o,p)}return a}function ke(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,d=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let y=L[r.border.shape];if(y){let $={borderWidth:u,borderStyle:r.border.style};f+=y.renderSVG(0,0,l,r.border.color,$)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${d}" y="${d}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${d}, ${d})">`;let m=Ae(e.matrixSize),g="";for(let y of m)g+=Mt(y.x*c,y.y*c,s.shape,s.color,a.color,n,c);let h=St(e,c,i.shape,i.color,i.scale);f+=g+h+"</g>";let p="";if(r.logo){let y=Le(e.matrixSize,r.logo.scale)*c,$=l/2;p=It(r.logo.src,$,$,y)}return f+=p+"</svg>",f}function Te(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
25
25
  `;for(let i=0;i<e.matrixSize;i++){s+=o.repeat(t);for(let c=0;c<e.matrixSize;c++)s+=e.modules[i][c]?n:o;s+=o.repeat(t)+`
26
26
  `}for(let i=0;i<t;i++)s+=o.repeat(a)+`
27
- `;return s}var B=null,Ae=!1;async function dt(){if(B)return B;if(Ae)throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js");Ae=!0;try{return B=(await import("@resvg/resvg-js")).Resvg,B}catch{throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js")}}async function Le(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a,c=await dt(),m=new c(e,{fitTo:{mode:"width",value:i}}).render().asPng(),f=Buffer.from(m);return t.type==="dataURL"?`data:image/png;base64,${f.toString("base64")}`:f}async function Te(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await Le(e,r)}function J(e){if(typeof e=="string")return e;switch(e.type){case"url":return ht(e.url);case"vcard":return gt(e.data);case"wifi":return bt(e.data);case"calendar":return pt(e.data);case"email":return $t(e.email,e.subject,e.body);case"sms":return Ct(e.phone,e.message);case"phone":return Mt(e.phone)}}function ht(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function gt(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
- `)}function bt(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=ke(e.ssid),n=ke(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function ke(e){return e.replace(/([\\;,":])/g,"\\$1")}function pt(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
- `)}function $t(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function Ct(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function Mt(e){return`tel:${e}`}function yt(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=oe[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function De(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=fe(e,r),o=y[t],n=D(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${y[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=le(e,n,o[n-1]),a=te[t][n-1],i=re[t][n-1],{dataBlocks:c,ecBlocks:u}=he(s,a,i),l=ge(c,u),m=yt(l,n),{matrix:f,mask:d}=Ee(n,t,m);return{version:n,matrixSize:I(n),modules:f,mask:d,errorCorrectionLevel:t}}async function Be(e,r){let t=J(e),o=ie(r),n=De(t,!!o.logo),s=we(n,o);return await Te(s,o)}function Ne(e,r){let t=J(e),o=ce(r),n=De(t,!1);return Pe(n,o)}0&&(module.exports={BorderShape,BorderStyle,DotShape,EyeFrameShape,QRValidationError,genQrImage,genQrText});
27
+ `;return s}var B=null,Be=!1;async function Et(){if(B)return B;if(Be)throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js");Be=!0;try{return B=(await import("@resvg/resvg-js")).Resvg,B}catch{throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js")}}async function Ve(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a,c=await Et(),d=new c(e,{fitTo:{mode:"width",value:i}}).render().asPng(),f=Buffer.from(d);return t.type==="dataURL"?`data:image/png;base64,${f.toString("base64")}`:f}async function Ne(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await Ve(e,r)}function te(e){if(typeof e=="string")return e;switch(e.type){case"url":return wt(e.url);case"vcard":return Ot(e.data);case"wifi":return Pt(e.data);case"calendar":return Dt(e.data);case"email":return At(e.email,e.subject,e.body);case"sms":return Lt(e.phone,e.message);case"phone":return kt(e.phone)}}function wt(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function Ot(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
+ `)}function Pt(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=Qe(e.ssid),n=Qe(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function Qe(e){return e.replace(/([\\;,":])/g,"\\$1")}function Dt(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
+ `)}function At(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function Lt(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function kt(e){return`tel:${e}`}function Tt(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=ae[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function qe(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=pe(e,r),o=C[t],n=T(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${C[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=he(e,n,o[n-1]),a=ne[t][n-1],i=oe[t][n-1],{dataBlocks:c,ecBlocks:u}=$e(s,a,i),l=xe(c,u),d=Tt(l,n),{matrix:f,mask:m}=De(n,t,d);return{version:n,matrixSize:I(n),modules:f,mask:m,errorCorrectionLevel:t}}async function Fe(e,r){Y(e);let t=te(e),o=de(r),n=qe(t,!!o.logo),s=ke(n,o);return await Ne(s,o)}function ze(e,r){Y(e);let t=te(e),o=me(r),n=qe(t,!1);return Te(n,o)}0&&(module.exports={BorderShape,BorderStyle,DotShape,EyeFrameShape,QRValidationError,genQrImage,genQrText});
package/dist/node.mjs CHANGED
@@ -1,29 +1,29 @@
1
- var Y={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},y={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},X={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",ke={1:[10,12,14],2:[9,11,13],4:[8,16,16]},N={L:1,M:0,Q:3,H:2},P=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],Z=[31892,34236,39577,42195],K=[0,7,7,7,7,7,0,0,0,0];function R(e){return e*4+17}function A(e,r){let t=r<10?0:r<27?1:2;return ke[e][t]}var J=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(J||{}),ee=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(ee||{}),te=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(te||{}),re=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(re||{});function M(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function z(e,r,t=.01){return M(r-e,t)}function De(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function Be(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),m=l/2;return{dashArray:`${u} ${l}`,offset:m}}function F(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function V(e,r,t,o,n){return n==="circle"?Ne(e,r,t,o):n==="squircle"?Ve(e,r,t,o):Fe(e,r,t,o)}function Ne(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),m=l%2===0?l:l-1,f=Math.max(4,m);return s*f%1<.6}function Ve(e,r,t,o){let s=t/2-o/2,a=t*q,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,m=4*u+4*l,f=ze(e,r,c,i,u,l,m),{dashArray:d}=F(m,o),[h,g]=d.split(" ").map(Number),b=h+g;return(f+h/2)%b<h}function ze(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function Fe(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,m=o*(u+l),f=Math.max(1,Math.round(c/m)),d=c/f,h=d*(u/(u+l)),b=(d-h)/2;return(i+b)%d<h}var q=.12,qe={EYE_FRAME:.90909},I={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return M(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*qe.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
1
+ var Z={L:[7,10,15,20,26,18,20,24,30,18],M:[10,16,26,18,24,16,18,22,22,26],Q:[13,22,18,26,18,24,18,22,20,24],H:[17,28,22,16,22,28,26,26,24,28]},C={L:[19,34,55,80,108,136,156,194,232,274],M:[16,28,44,64,86,108,124,154,182,216],Q:[13,22,34,48,62,76,88,110,132,154],H:[9,16,26,36,46,60,66,86,100,122]},K={L:[[1,19,0,0],[1,34,0,0],[1,55,0,0],[1,80,0,0],[1,108,0,0],[2,68,0,0],[2,78,0,0],[2,97,0,0],[2,116,0,0],[2,68,2,69]],M:[[1,16,0,0],[1,28,0,0],[1,44,0,0],[2,32,0,0],[2,43,0,0],[4,27,0,0],[4,31,0,0],[2,38,2,39],[3,36,2,37],[4,43,1,44]],Q:[[1,13,0,0],[1,22,0,0],[2,17,0,0],[2,24,0,0],[2,15,2,16],[4,19,0,0],[2,14,4,15],[4,18,2,19],[4,16,4,17],[6,19,2,20]],H:[[1,9,0,0],[1,16,0,0],[2,13,0,0],[4,9,0,0],[2,11,2,12],[4,15,0,0],[4,13,1,14],[4,14,2,15],[4,12,4,13],[6,15,2,16]]},M="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Qe={1:[10,12,14],2:[9,11,13],4:[8,16,16]},V={L:1,M:0,Q:3,H:2},P=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],J=[31892,34236,39577,42195],ee=[0,7,7,7,7,7,0,0,0,0];function I(e){return e*4+17}function D(e,r){let t=r<10?0:r<27?1:2;return Qe[e][t]}var te=(t=>(t.SQUARE="square",t.SQUIRCLE="squircle",t))(te||{}),re=(o=>(o.CLASSIC="classic",o.DOTS="dots",o.SQUARE="square",o))(re||{}),ne=(n=>(n.NONE="none",n.SQUARE="square",n.SQUIRCLE="squircle",n.CIRCLE="circle",n))(ne||{}),oe=(t=>(t.SOLID="solid",t.DASHED="dashed",t))(oe||{});function x(e,r){let t=r/2;return e<=-t?0:e>=t?255:Math.round((e+t)/r*255)}function Q(e,r,t=.01){return x(r-e,t)}function qe(e,r,t,o){let n=Math.abs(e)-t+o,s=Math.abs(r)-t+o,a=Math.sqrt(Math.max(n,0)**2+Math.max(s,0)**2),i=Math.min(Math.max(n,s),0);return a+i-o}function Fe(e,r){let n=r*3,s=r*2,a=n+s,i=Math.max(1,Math.round(e/a)),c=e/i,u=c*(3/5),l=c*(2/5),d=l/2;return{dashArray:`${u} ${l}`,offset:d}}function q(e,r){let t=r*3,o=r*2,n=t+o,s=Math.round(e/n);s=Math.round(s/4)*4,s=Math.max(4,s);let a=e/s,i=a*.6,c=a*.4,u=i/2;return{dashArray:`${i} ${c}`,offset:u}}function N(e,r,t,o,n){return n==="circle"?ze(e,r,t,o):n==="squircle"?je(e,r,t,o):Ue(e,r,t,o)}function ze(e,r,t,o){let s=(Math.atan2(r,e)+Math.PI)/(2*Math.PI),a=t/2-o/2,i=2*Math.PI*a,c=o*3,u=o*2,l=Math.floor(i/(c+u)),d=l%2===0?l:l-1,f=Math.max(4,d);return s*f%1<.6}function je(e,r,t,o){let s=t/2-o/2,a=t*F,i=Math.max(0,a-o/2),c=s-i,u=2*c,l=.5*Math.PI*i,d=4*u+4*l,f=_e(e,r,c,i,u,l,d),{dashArray:m}=q(d,o),[g,h]=m.split(" ").map(Number),p=g+h;return(f+g/2)%p<g}function _e(e,r,t,o,n,s,a){if(r<-t)if(e>t){let i=Math.atan2(r- -t,e-t)+Math.PI/2;return t+i*o}else if(e<-t){let i=Math.atan2(r- -t,e- -t)+Math.PI;return t+3*s+3*n+i*o}else return e>=0?e:a+e;else if(r>t)if(e>t){let i=Math.atan2(r-t,e-t);return t+s+n+i*o}else if(e<-t){let i=Math.atan2(r-t,e- -t)-Math.PI/2;return t+2*s+2*n+i*o}else return t+2*s+n+(t-e);else return e>t?t+s+(r- -t):e<-t?t+3*s+2*n+(t-r):e>=0?e:a+e}function Ue(e,r,t,o){let n=t/2,s=Math.abs(e),i=Math.abs(r)>=s?n+e:n+r,c=t-o,u=3,l=2,d=o*(u+l),f=Math.max(1,Math.round(c/d)),m=c/f,g=m*(u/(u+l)),p=(m-g)/2;return(i+p)%m<g}var F=.09,We={EYE_FRAME:.90909},S={square:{renderSVG(e,r,t,o){return`<rect x="${e}" y="${r}" width="${t}" height="${t}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},squircle:{renderSVG(e,r,t,o){let n=t/2,s=n*We.EYE_FRAME,a=e+n,i=r+n;return`<path d="${`M${a},${i-n}
2
2
  C${a+s},${i-n} ${a+n},${i-s} ${a+n},${i}
3
3
  S${a+s},${i+n} ${a},${i+n}
4
4
  S${a-n},${i+s} ${a-n},${i}
5
- S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let m=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),d=(1-m)/f;return M(d,s)}}},E={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,m=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],d=c>0&&i[c-1][u],h=c<l-1&&i[c+1][u],g=m?1/0:n+e,b=f?1/0:n-e,$=d?1/0:n+r,C=h?1/0:n-r,B=Math.min(Math.min(g,b),Math.min($,C));return M(B,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return M(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return z(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return M(i,a)}}},L={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,d=t-s,{dashArray:h,offset:g}=Be(d,s);return`<rect x="${e+f}" y="${r+f}" width="${d}" height="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${-g}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,m=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${m}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),m=c-Math.abs(e),f=c-Math.abs(r),d=Math.min(u,l),h=Math.min(m,f);if(d>=0&&h<=0){if(s==="dashed"&&!V(e,r,t,n,"square"))return 0;let g=M(d,a),b=255-M(h,a);return Math.min(g,b)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,m=t*q,f=Math.max(0,m-s/2),d=l-f,h=`M${c},${u-l}
6
- H${c+d}
7
- A${f},${f} 0 0 1 ${c+l},${u-d}
8
- V${u+d}
9
- A${f},${f} 0 0 1 ${c+d},${u+l}
10
- H${c-d}
11
- A${f},${f} 0 0 1 ${c-l},${u+d}
12
- V${u-d}
13
- A${f},${f} 0 0 1 ${c-d},${u-l}
14
- Z`;if(a==="dashed"){let g=2*d,b=.5*Math.PI*f,$=4*g+4*b,{dashArray:C,offset:B}=F($,s);return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${C}" stroke-dashoffset="${B}"/>`}return`<path d="${h}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*q,l=Math.max(0,u-n/2),m=Math.abs(De(e,r,c,l)),f=n/2-m;return f>-a?s==="dashed"&&!V(e,r,t,n,"squircle")?0:M(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let d=u-s/2,h=2*Math.PI*d,{dashArray:g,offset:b}=F(h,s);return`<circle cx="${i}" cy="${c}" r="${d}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${b}"/>`}let l=u-s,m=`M${i},${c-u}
5
+ S${a-s},${i-n} ${a},${i-n}Z`}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01,a=4,i=Math.abs(e),c=Math.abs(r),u=i/n,l=c/n;if(i<.001&&c<.001)return 255;let d=Math.pow(u,a)+Math.pow(l,a),f=a/n*Math.sqrt(Math.pow(u,2*a-2)+Math.pow(l,2*a-2)),m=(1-d)/f;return x(m,s)}}},E={classic:{renderSVG(){return""},renderPixel(e,r,t,o){let n=t/2,s=o?.pixelSize??.01;if(t>=.99&&o&&o.qrcode&&o.row!==void 0&&o.col!==void 0){let{qrcode:i,row:c,col:u}=o,l=o.qrSize||i.length,d=u>0&&i[c][u-1],f=u<l-1&&i[c][u+1],m=c>0&&i[c-1][u],g=c<l-1&&i[c+1][u],h=d?1/0:n+e,p=f?1/0:n-e,y=m?1/0:n+r,$=g?1/0:n-r,B=Math.min(Math.min(h,p),Math.min(y,$));return x(B,s)}let a=Math.min(n-Math.abs(e),n-Math.abs(r));return x(a,s)}},dots:{renderSVG(e,r,t,o){let n=e+t/2,s=r+t/2,a=t*.35;return`<circle cx="${n}" cy="${s}" r="${a}" fill="${o}"/>`},renderPixel(e,r,t,o){let n=t*.35,s=o?.pixelSize??.01,a=Math.sqrt(e*e+r*r);return Q(a,n,s)}},square:{renderSVG(e,r,t,o){let n=t*.7,s=(t-n)/2,a=e+s,i=r+s;return`<rect x="${a}" y="${i}" width="${n}" height="${n}" fill="${o}"/>`},renderPixel(e,r,t,o){let s=t*.7/2,a=o?.pixelSize??.01,i=Math.min(s-Math.abs(e),s-Math.abs(r));return x(i,a)}}},A={square:{getDiagonalFactor(){return Math.sqrt(2)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1;if((n?.borderStyle??"solid")==="dashed"){let f=s/2,m=t-s,{dashArray:g,offset:h}=Fe(m,s);return`<rect x="${e+f}" y="${r+f}" width="${m}" height="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${g}" stroke-dashoffset="${-h}"/>`}let i=`M${e},${r}h${t}v${t}h${-t}z`,c=e+s,u=r+s,l=t-s*2,d=`M${c},${u}h${l}v${l}h${-l}z`;return`<path d="${i} ${d}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=i-Math.abs(e),l=i-Math.abs(r),d=c-Math.abs(e),f=c-Math.abs(r),m=Math.min(u,l),g=Math.min(d,f);if(m>=0&&g<=0){if(s==="dashed"&&!N(e,r,t,n,"square"))return 0;let h=x(m,a),p=255-x(g,a);return Math.min(h,p)}return 0}},squircle:{getDiagonalFactor(){return Math.pow(2,.25)},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=t/2,c=e+i,u=r+i,l=i-s/2,d=t*F,f=Math.max(0,d-s/2),m=l-f,g=`M${c},${u-l}
6
+ H${c+m}
7
+ A${f},${f} 0 0 1 ${c+l},${u-m}
8
+ V${u+m}
9
+ A${f},${f} 0 0 1 ${c+m},${u+l}
10
+ H${c-m}
11
+ A${f},${f} 0 0 1 ${c-l},${u+m}
12
+ V${u-m}
13
+ A${f},${f} 0 0 1 ${c-m},${u-l}
14
+ Z`;if(a==="dashed"){let h=2*m,p=.5*Math.PI*f,y=4*h+4*p,{dashArray:$,offset:B}=q(y,s);return`<path d="${g}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${$}" stroke-dashoffset="${B}"/>`}return`<path d="${g}" fill="none" stroke="${o}" stroke-width="${s}"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,c=t/2-n/2,u=t*F,l=Math.max(0,u-n/2),d=Math.abs(qe(e,r,c,l)),f=n/2-d;return f>-a?s==="dashed"&&!N(e,r,t,n,"squircle")?0:x(f,a):0}},circle:{getDiagonalFactor(){return 1},renderSVG(e,r,t,o,n){let s=n?.borderWidth??1,a=n?.borderStyle??"solid",i=e+t/2,c=r+t/2,u=t/2;if(a==="dashed"){let m=u-s/2,g=2*Math.PI*m,{dashArray:h,offset:p}=q(g,s);return`<circle cx="${i}" cy="${c}" r="${m}" fill="none" stroke="${o}" stroke-width="${s}" stroke-dasharray="${h}" stroke-dashoffset="${p}"/>`}let l=u-s,d=`M${i},${c-u}
15
15
  A${u},${u} 0 1,1 ${i},${c+u}
16
16
  A${u},${u} 0 1,1 ${i},${c-u}Z`,f=`M${i},${c-l}
17
17
  A${l},${l} 0 1,0 ${i},${c+l}
18
- A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${m} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!V(e,r,t,n,"circle"))return 0;let l=z(u,i,a),m=255-z(u,c,a);return Math.min(l,m)}return 0}}};var O=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
18
+ A${l},${l} 0 1,0 ${i},${c-l}Z`;return`<path d="${d} ${f}" fill="${o}" fill-rule="evenodd"/>`},renderPixel(e,r,t,o){let n=o?.borderWidth??1,s=o?.borderStyle??"solid",a=o?.pixelSize??.01,i=t/2,c=i-n,u=Math.sqrt(e*e+r*r);if(u<=i&&u>=c){if(s==="dashed"&&!N(e,r,t,n,"circle"))return 0;let l=Q(u,i,a),d=255-Q(u,c,a);return Math.min(l,d)}return 0}}};var v=class extends Error{constructor(r){let t=r.map(o=>` - ${o.field}: ${o.message}`).join(`
19
19
  `);super(`QR Code validation failed:
20
- ${t}`),this.name="QRValidationError",this.errors=r}};function x(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function v(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function _(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function ne(e){let r=[];if(e.size!==void 0){let t=x(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=v(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=_(e.eyes.shape,"eyes.shape",I);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=v(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=v(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=_(e.dots.shape,"dots.shape",E);t&&r.push(t)}if(e.dots?.color!==void 0){let t=v(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=x(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=_(e.border.shape,"border.shape",L);t&&r.push(t)}if(e.border?.width!==void 0){let t=x(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=v(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo&&((!e.logo.src||typeof e.logo.src!="string")&&r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"}),e.logo.scale!==void 0)){let t=x(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}if(r.length>0)throw new O(r)}function oe(e){let r=[];if(e.margin!==void 0){let t=x(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new O(r)}var p={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},T={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function se(e){if(!e){let{logo:t,...o}=p;return o}return ne(e),{size:e.size??p.size,margin:e.margin??p.margin,backgroundColor:e.backgroundColor??p.backgroundColor,eyes:{shape:e.eyes?.shape??p.eyes.shape,color:e.eyes?.color??p.eyes.color},pupils:{color:e.pupils?.color??p.pupils.color},dots:{shape:e.dots?.shape??p.dots.shape,color:e.dots?.color??p.dots.color,scale:e.dots?.scale??p.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??p.logo.scale}:void 0,border:{shape:e.border?.shape??p.border.shape,width:e.border?.width??p.border.width,color:e.border?.color??p.border.color,style:e.border?.style??p.border.style},output:e.output??p.output}}function ae(e){return e?(oe(e),{margin:e.margin??T.margin,darkChar:e.darkChar??T.darkChar,lightChar:e.lightChar??T.lightChar}):{...T}}function ie(e){return/^\d+$/.test(e)?1:[...e].every(r=>S.includes(r))?2:4}function _e(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function Qe(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=S.indexOf(e[t])*45+S.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=S.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function Ge(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function Ue(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=A(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function We(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function je(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function ce(e,r,t){let o=ie(e),n,s;o===1?(n=_e(e),s=e.length):o===2?(n=Qe(e),s=e.length):(n=Ge(e),s=new TextEncoder().encode(e).length);let a=Ue(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=We(a);return je(c,t)}function k(e,r){let t=ie(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=A(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,m=4+u+l;if(Math.ceil(m/8)<=r[c-1])return c}let n=A(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function ue(e,r){if(r)try{if(k(e,y.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(k(e,y[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var w=new Array(256),Q=new Array(256);function He(){let e=1;for(let r=0;r<255;r++)w[r]=e,Q[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)w[r]=w[r-255]}He();function fe(e,r){return e===0||r===0?0:w[Q[e]+Q[r]]}function Ye(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=fe(r[s],w[t]);r=n}return r}function le(e,r){let t=Ye(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=fe(t[a],s)}return o.slice(e.length)}function me(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let m=e.slice(u,u+a);o.push(m);let f=le(m,r);n.push(f),u+=a}for(let l=0;l<i;l++){let m=e.slice(u,u+c);o.push(m);let f=le(m,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function de(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function he(e){let r=R(e);return Array.from({length:r},()=>Array(r).fill(!1))}function ge(e){let r=R(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=P[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function G(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function Xe(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function be(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function pe(e){G(e,0,0),G(e,0,e.length-7),G(e,e.length-7,0)}function $e(e,r){let t=e.length,o=P[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||Xe(e,n,s)}function Ce(e,r){e[4*r+9][8]=!0}function Me(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function U(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function Ze(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let m=1;m<r;m++)e[a][m]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][m],u=1),e[m][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[m][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function ye(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);U(i,r,a),o(i,t,a);let c=Ze(i);c<s&&(s=c,n=a)}return n}function W(e,r,t){let o=e.length,n=N[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function xe(e,r){if(r<7)return;let t=e.length,o=Z[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function Se(e,r){return N[e]<<3|r}function Re(e,r,t,o,n){let s=he(e),a=ge(e);pe(s),be(s),$e(s,e),Ce(s,e),Me(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??ye(s,a,r,W);return U(s,a,c),W(s,r,c),xe(s,e),{matrix:s,mask:c,formatInfo:n?Se(r,c):void 0,unmaskedMatrix:i}}function j(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function Ie(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function Ee(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function Ke(e,r,t,o,n,s,a){let i=I[t]||I.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function Je(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let d=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(d)try{i=decodeURIComponent(d[1])}catch{return""}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([^>]*)>/i),m="";if(l){let d=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);d&&(m=" "+d.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[^>]*>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
- <svg width="${o}" height="${o}" viewBox="${u}"${m}>
20
+ ${t}`),this.name="QRValidationError",this.errors=r}};function R(e,r,t,o,n=!1){return typeof e!="number"||!isFinite(e)?{field:r,value:e,message:"must be a finite number"}:n&&!Number.isInteger(e)?{field:r,value:e,message:"must be an integer"}:e<t?{field:r,value:e,message:`must be at least ${t}`}:o!==null&&e>o?{field:r,value:e,message:`must be at most ${o}`}:null}function w(e,r){return typeof e!="string"?{field:r,value:e,message:"must be a string"}:/^#[0-9A-Fa-f]{6}$/.test(e)?null:{field:r,value:e,message:"must be a valid hex color (e.g., #000000)"}}function z(e,r,t){if(typeof e!="string")return{field:r,value:e,message:"must be a string"};if(!(e in t)){let o=Object.keys(t).join(", ");return{field:r,value:e,message:`must be one of: ${o}`}}return null}function Ge(e,r){let t=/^data:image\/(png|jpeg|jpg|gif|svg\+xml|webp);base64,/i,o=e.trim().startsWith("<svg");if(!t.test(e)&&!o)return{field:r,value:"[truncated]",message:"must be a data URL (data:image/...;base64,...) or SVG string (<svg...)"};if(e.startsWith("data:")){let n=e.split(",");if(n.length!==2)return{field:r,value:"[truncated]",message:"data URL format is invalid (missing comma separator)"};let s=n[1];if(!s||!He(s))return{field:r,value:"[truncated]",message:"data URL contains invalid base64 encoding"}}return o&&!e.includes("</svg>")?{field:r,value:"[truncated]",message:"SVG string is incomplete (missing closing </svg> tag)"}:null}function He(e){try{return/^[A-Za-z0-9+/]*={0,2}$/.test(e)&&e.length%4===0}catch{return!1}}function ae(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function j(e){return/^[\d\s\-+()]+$/.test(e)&&e.replace(/\D/g,"").length>=7}function ie(e){try{return new URL(e.startsWith("http")?e:`https://${e}`),!0}catch{return!1}}function ce(e){let r=[];if(e.size!==void 0){let t=R(e.size,"size",21,null,!0);t&&r.push(t)}if(e.margin!==void 0){let t=R(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.backgroundColor!==void 0){let t=w(e.backgroundColor,"backgroundColor");t&&r.push(t)}if(e.eyes?.shape!==void 0){let t=z(e.eyes.shape,"eyes.shape",S);t&&r.push(t)}if(e.eyes?.color!==void 0){let t=w(e.eyes.color,"eyes.color");t&&r.push(t)}if(e.pupils?.color!==void 0){let t=w(e.pupils.color,"pupils.color");t&&r.push(t)}if(e.dots?.shape!==void 0){let t=z(e.dots.shape,"dots.shape",E);t&&r.push(t)}if(e.dots?.color!==void 0){let t=w(e.dots.color,"dots.color");t&&r.push(t)}if(e.dots?.scale!==void 0){let t=R(e.dots.scale,"dots.scale",.75,1.25,!1);t&&r.push(t)}if(e.border?.shape!==void 0&&e.border.shape!=="none"){let t=z(e.border.shape,"border.shape",A);t&&r.push(t)}if(e.border?.width!==void 0){let t=R(e.border.width,"border.width",0,null,!0);t&&r.push(t)}if(e.border?.color!==void 0){let t=w(e.border.color,"border.color");t&&r.push(t)}if(e.border?.style!==void 0&&(typeof e.border.style!="string"||e.border.style!=="solid"&&e.border.style!=="dashed")&&r.push({field:"border.style",value:e.border.style,message:'must be either "solid" or "dashed"'}),e.logo){if(!e.logo.src||typeof e.logo.src!="string")r.push({field:"logo.src",value:e.logo.src,message:"must be a non-empty string"});else{let t=Ge(e.logo.src,"logo.src");t&&r.push(t)}if(e.logo.scale!==void 0){let t=R(e.logo.scale,"logo.scale",.1,.3,!1);t&&r.push(t)}}if(r.length>0)throw new v(r)}function ue(e){let r=[];if(e.margin!==void 0){let t=R(e.margin,"margin",0,null,!0);t&&r.push(t)}if(e.darkChar!==void 0&&typeof e.darkChar!="string"&&r.push({field:"darkChar",value:e.darkChar,message:"must be a string"}),e.lightChar!==void 0&&typeof e.lightChar!="string"&&r.push({field:"lightChar",value:e.lightChar,message:"must be a string"}),r.length>0)throw new v(r)}function _(e){let r=[];if(typeof e=="string"){if(e||r.push({field:"input",value:e,message:"string input cannot be empty"}),r.length>0)throw new v(r);return}if(!e||typeof e!="object"||!("type"in e))throw r.push({field:"input",value:e,message:"must be a string or structured content object with a type property"}),new v(r);let t=e;switch(t.type){case"wifi":{Ye(e.data,r);break}case"vcard":{Xe(e.data,r);break}case"calendar":{Ze(e.data,r);break}case"email":{Ke(e,r);break}case"sms":{Je(e,r);break}case"phone":{et(e,r);break}case"url":{tt(e,r);break}default:r.push({field:"input.type",value:t.type,message:"must be one of: url, vcard, wifi, calendar, email, sms, phone"})}if(r.length>0)throw new v(r)}function Ye(e,r){if(!e||typeof e!="object"){r.push({field:"wifi.data",value:e,message:"must be an object"});return}let t=e;if((!t.ssid||typeof t.ssid!="string"||!t.ssid.trim())&&r.push({field:"wifi.ssid",value:t.ssid,message:"is required and must be non-empty"}),(!t.password||typeof t.password!="string")&&r.push({field:"wifi.password",value:t.password,message:"is required and must be a string"}),t.encryption!==void 0){let o=["WPA","WPA2","WEP","nopass"];o.includes(t.encryption)||r.push({field:"wifi.encryption",value:t.encryption,message:`must be one of: ${o.join(", ")}`})}t.hidden!==void 0&&typeof t.hidden!="boolean"&&r.push({field:"wifi.hidden",value:t.hidden,message:"must be a boolean"})}function Xe(e,r){if(!e||typeof e!="object"){r.push({field:"vcard.data",value:e,message:"must be an object"});return}let t=e;(!t.name||typeof t.name!="string"||!t.name.trim())&&r.push({field:"vcard.name",value:t.name,message:"is required and must be non-empty"}),t.email!==void 0&&(typeof t.email!="string"||!ae(t.email))&&r.push({field:"vcard.email",value:t.email,message:"must be a valid email address"}),t.phone!==void 0&&(typeof t.phone!="string"||!j(t.phone))&&r.push({field:"vcard.phone",value:t.phone,message:"must be a valid phone number (e.g., +1-555-123-4567)"}),t.url!==void 0&&(typeof t.url!="string"||!ie(t.url))&&r.push({field:"vcard.url",value:t.url,message:"must be a valid URL"}),t.address!==void 0&&typeof t.address!="object"&&r.push({field:"vcard.address",value:t.address,message:"must be an object"})}function Ze(e,r){if(!e||typeof e!="object"){r.push({field:"calendar.data",value:e,message:"must be an object"});return}let t=e;(!t.title||typeof t.title!="string"||!t.title.trim())&&r.push({field:"calendar.title",value:t.title,message:"is required and must be non-empty"});let o=se(t.startDate);if(o||r.push({field:"calendar.startDate",value:t.startDate,message:"is required and must be a valid Date object or ISO string"}),t.endDate!==void 0){let n=se(t.endDate);n?o&&n<o&&r.push({field:"calendar.endDate",value:t.endDate,message:"must be after startDate"}):r.push({field:"calendar.endDate",value:t.endDate,message:"must be a valid Date object or ISO string"})}}function Ke(e,r){let t=e;(!t.email||typeof t.email!="string"||!ae(t.email))&&r.push({field:"email.email",value:t.email,message:"is required and must be a valid email address"}),t.subject!==void 0&&typeof t.subject!="string"&&r.push({field:"email.subject",value:t.subject,message:"must be a string"}),t.body!==void 0&&typeof t.body!="string"&&r.push({field:"email.body",value:t.body,message:"must be a string"})}function Je(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!j(t.phone))&&r.push({field:"sms.phone",value:t.phone,message:"is required and must be a valid phone number"}),t.message!==void 0&&typeof t.message!="string"&&r.push({field:"sms.message",value:t.message,message:"must be a string"})}function et(e,r){let t=e;(!t.phone||typeof t.phone!="string"||!j(t.phone))&&r.push({field:"phone.phone",value:t.phone,message:"is required and must be a valid phone number"})}function tt(e,r){let t=e;(!t.url||typeof t.url!="string"||!ie(t.url))&&r.push({field:"url.url",value:t.url,message:"is required and must be a valid URL"})}function se(e){if(e instanceof Date)return isNaN(e.getTime())?null:e;if(typeof e=="string"){let r=new Date(e);return isNaN(r.getTime())?null:r}return null}var b={size:300,margin:24,backgroundColor:"#ffffff",eyes:{shape:"square",color:"#000000"},pupils:{color:"#000000"},dots:{shape:"classic",color:"#000000",scale:1},logo:{scale:.2},border:{shape:"none",width:10,color:"#000000",style:"solid"},output:{format:"png",type:"buffer"}},L={margin:2,darkChar:"\u2588\u2588",lightChar:" "};function le(e){if(!e){let{logo:t,...o}=b;return o}return ce(e),{size:e.size??b.size,margin:e.margin??b.margin,backgroundColor:e.backgroundColor??b.backgroundColor,eyes:{shape:e.eyes?.shape??b.eyes.shape,color:e.eyes?.color??b.eyes.color},pupils:{color:e.pupils?.color??b.pupils.color},dots:{shape:e.dots?.shape??b.dots.shape,color:e.dots?.color??b.dots.color,scale:e.dots?.scale??b.dots.scale},logo:e.logo?{src:e.logo.src,scale:e.logo.scale??b.logo.scale}:void 0,border:{shape:e.border?.shape??b.border.shape,width:e.border?.width??b.border.width,color:e.border?.color??b.border.color,style:e.border?.style??b.border.style},output:e.output??b.output}}function fe(e){return e?(ue(e),{margin:e.margin??L.margin,darkChar:e.darkChar??L.darkChar,lightChar:e.lightChar??L.lightChar}):{...L}}function de(e){return/^\d+$/.test(e)?1:[...e].every(r=>M.includes(r))?2:4}function rt(e){let r=[];for(let t=0;t<e.length;t+=3){let o=e.substring(t,Math.min(t+3,e.length)),n=parseInt(o,10),s=o.length===3?10:o.length===2?7:4;for(let a=s-1;a>=0;a--)r.push(n>>a&1)}return r}function nt(e){let r=[];for(let t=0;t<e.length;t+=2)if(t+1<e.length){let o=M.indexOf(e[t])*45+M.indexOf(e[t+1]);for(let n=10;n>=0;n--)r.push(o>>n&1)}else{let o=M.indexOf(e[t]);for(let n=5;n>=0;n--)r.push(o>>n&1)}return r}function ot(e){let r=[],t=new TextEncoder().encode(e);for(let o of t)for(let n=7;n>=0;n--)r.push(o>>n&1);return r}function st(e,r,t,o){let n=[];for(let a=3;a>=0;a--)n.push(r>>a&1);let s=D(r,o);for(let a=s-1;a>=0;a--)n.push(t>>a&1);return[...n,...e]}function at(e){let r=[];for(let t=0;t<e.length;t+=8){let o=0;for(let n=0;n<8&&t+n<e.length;n++)o=o<<1|e[t+n];t+8>e.length&&(o<<=8-e.length%8),r.push(o)}return r}function it(e,r){let t=[...e],o=[236,17],n=0;for(;t.length<r;)t.push(o[n]),n=1-n;return t}function me(e,r,t){let o=de(e),n,s;o===1?(n=rt(e),s=e.length):o===2?(n=nt(e),s=e.length):(n=ot(e),s=new TextEncoder().encode(e).length);let a=st(n,o,s,r),i=Math.min(4,t*8-a.length);for(let u=0;u<i;u++)a.push(0);for(;a.length%8!==0;)a.push(0);let c=at(a);return it(c,t)}function k(e,r){let t=de(e),o=t===4?new TextEncoder().encode(e).length:e.length;for(let c=1;c<=10;c++){let u=D(t,c),l=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,d=4+u+l;if(Math.ceil(d/8)<=r[c-1])return c}let n=D(t,10),s=t===1?Math.ceil(o/3)*10-(o%3===1?6:o%3===2?3:0):t===2?Math.floor(o/2)*11+o%2*6:o*8,a=4+n+s,i=Math.ceil(a/8);throw new Error(`Input too long for QR code version 10. Required capacity: ${i} bytes, Maximum available: ${r[9]} bytes. Current data length: ${e.length} characters (${o} bytes encoded).`)}function ge(e,r){if(r)try{if(k(e,C.H)<=10)return"H"}catch{throw new Error(`Data too large for QR code with logo. Data length: ${e.length} characters. Maximum capacity with logo (EC level H): ~122 bytes (version 10). Logos require high error correction (H) which reduces data capacity. Consider: reducing data length, removing logo, or using multiple QR codes.`)}let t=["H","Q","M","L"];for(let o of t)try{if(k(e,C[o])<=10)return o}catch{continue}throw new Error(`Data too large for QR code version 10 at any error correction level. Data length: ${e.length} characters. Maximum capacity: ~274 bytes (version 10, EC level L). Please reduce input length or split into multiple QR codes.`)}var O=new Array(256),U=new Array(256);function ct(){let e=1;for(let r=0;r<255;r++)O[r]=e,U[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)O[r]=O[r-255]}ct();function pe(e,r){return e===0||r===0?0:O[U[e]+U[r]]}function ut(e){let r=[1];for(let t=0;t<e;t++){let o=r.length+1,n=new Array(o).fill(0);for(let s=0;s<r.length;s++)n[s]^=r[s],n[s+1]^=pe(r[s],O[t]);r=n}return r}function he(e,r){let t=ut(r),o=[...e,...new Array(r).fill(0)];for(let n=0;n<e.length;n++){let s=o[n];if(s!==0)for(let a=0;a<t.length;a++)o[n+a]^=pe(t[a],s)}return o.slice(e.length)}function be(e,r,t){let o=[],n=[],[s,a,i,c]=t,u=0;for(let l=0;l<s;l++){let d=e.slice(u,u+a);o.push(d);let f=he(d,r);n.push(f),u+=a}for(let l=0;l<i;l++){let d=e.slice(u,u+c);o.push(d);let f=he(d,r);n.push(f),u+=c}return{dataBlocks:o,ecBlocks:n}}function ye(e,r){let t=[],o=Math.max(...e.map(s=>s.length));for(let s=0;s<o;s++)for(let a of e)s<a.length&&t.push(a[s]);let n=Math.max(...r.map(s=>s.length));for(let s=0;s<n;s++)for(let a of r)s<a.length&&t.push(a[s]);return t}function $e(e){let r=I(e);return Array.from({length:r},()=>Array(r).fill(!1))}function xe(e){let r=I(e),t=Array.from({length:r},()=>Array(r).fill(!1));for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[n][r-8+s]=!0;for(let n=0;n<=7;n++)for(let s=0;s<=7;s++)t[r-8+n][s]=!0;for(let n=8;n<r-8;n++)t[6][n]=!0,t[n][6]=!0;t[4*e+9][8]=!0;for(let n=0;n<6;n++)t[n][8]=!0;t[7][8]=!0,t[8][8]=!0;for(let n=r-8;n<r;n++)t[n][8]=!0;for(let n=0;n<9;n++)t[8][n]=!0;for(let n=r-8;n<r;n++)t[8][n]=!0;let o=P[e-1]||[];for(let n of o)for(let s of o)if(!(n<9&&s<9||n<9&&s>r-9||n>r-9&&s<9))for(let i=-2;i<=2;i++)for(let c=-2;c<=2;c++)t[n+i][s+c]=!0;if(e>=7){for(let n=0;n<6;n++)for(let s=r-11;s<r-8;s++)t[n][s]=!0;for(let n=r-11;n<r-8;n++)for(let s=0;s<6;s++)t[n][s]=!0}return t}function W(e,r,t){for(let o=-1;o<=7;o++)for(let n=-1;n<=7;n++){let s=r+o,a=t+n;if(s<0||s>=e.length||a<0||a>=e.length)continue;let i=o>=0&&o<=6&&n>=0&&n<=6&&(o===0||o===6||n===0||n===6),c=o>=2&&o<=4&&n>=2&&n<=4;e[s][a]=i||c}}function lt(e,r,t){for(let o=-2;o<=2;o++)for(let n=-2;n<=2;n++){let s=o===-2||o===2||n===-2||n===2,a=o===0&&n===0;e[r+o][t+n]=s||a}}function ve(e){let r=e.length;for(let t=8;t<r-8;t++)e[6][t]=t%2===0,e[t][6]=t%2===0}function Ce(e){W(e,0,0),W(e,0,e.length-7),W(e,e.length-7,0)}function Re(e,r){let t=e.length,o=P[r-1]||[];for(let n of o)for(let s of o)n<9&&s<9||n<9&&s>t-9||n>t-9&&s<9||lt(e,n,s)}function Me(e,r){e[4*r+9][8]=!0}function Ie(e,r,t){let o=e.length,n=0,s=-1,a=o-1;for(let i=o-1;i>0;i-=2)for(i===6&&i--;;){for(let c=0;c<2;c++)if(!r[a][i-c]){let u=n<t.length?t[n]:!1;e[a][i-c]=u,n++}if(a+=s,a<0||o<=a){a-=s,s=-s;break}}}function G(e,r,t){let o=e.length;for(let n=0;n<o;n++)for(let s=0;s<o;s++){if(r[n][s])continue;let a=!1;switch(t){case 0:a=(n+s)%2===0;break;case 1:a=n%2===0;break;case 2:a=s%3===0;break;case 3:a=(n+s)%3===0;break;case 4:a=(Math.floor(n/2)+Math.floor(s/3))%2===0;break;case 5:a=n*s%2+n*s%3===0;break;case 6:a=(n*s%2+n*s%3)%2===0;break;case 7:a=((n+s)%2+n*s%3)%2===0;break}a&&(e[n][s]=!e[n][s])}}function ft(e){let r=e.length,t=0;for(let a=0;a<r;a++){let i=e[a][0],c=e[0][a],u=1,l=1;for(let d=1;d<r;d++)e[a][d]===i?u++:(u>=5&&(t+=3+(u-5)),i=e[a][d],u=1),e[d][a]===c?l++:(l>=5&&(t+=3+(l-5)),c=e[d][a],l=1);u>=5&&(t+=3+(u-5)),l>=5&&(t+=3+(l-5))}for(let a=0;a<r-1;a++)for(let i=0;i<r-1;i++){let c=e[a][i];e[a][i+1]===c&&e[a+1][i]===c&&e[a+1][i+1]===c&&(t+=3)}for(let a=0;a<r;a++){let i=0,c=0;for(let u=0;u<r;u++)i=i<<1&2047|(e[a][u]?1:0),u>=10&&(i===1488||i===93)&&(t+=40),c=c<<1&2047|(e[u][a]?1:0),u>=10&&(c===1488||c===93)&&(t+=40)}let o=0,n=r*r;for(let a=0;a<r;a++)for(let i=0;i<r;i++)e[a][i]&&o++;let s=Math.abs(Math.ceil(o*100/n/5)-10);return t+=s*10,t}function Se(e,r,t,o){let n=0,s=1/0;for(let a=0;a<8;a++){let i=e.map(u=>[...u]);G(i,r,a),o(i,t,a);let c=ft(i);c<s&&(s=c,n=a)}return n}function H(e,r,t){let o=e.length,n=V[r]<<3|t,s=n<<10;for(let i=0;i<5;i++)s&1<<14-i&&(s^=1335<<4-i);let a=(n<<10|s)^21522;for(let i=0;i<15;i++){let c=(a>>14-i&1)===1;i<=5?e[8][i]=c:i===6?e[8][7]=c:i===7?e[8][8]=c:i===8?e[7][8]=c:e[5-(i-9)][8]=c,i<=6?e[o-1-i][8]=c:e[8][o-8+(i-7)]=c}}function Ee(e,r){if(r<7)return;let t=e.length,o=J[r-7];for(let n=0;n<18;n++){let s=(o>>n&1)===1,a=Math.floor(n/3),i=t-11+n%3;e[a][i]=s;let c=t-11+n%3,u=Math.floor(n/3);e[c][u]=s}}function we(e,r){return V[e]<<3|r}function Oe(e,r,t,o,n){let s=$e(e),a=xe(e);Ce(s),ve(s),Re(s,e),Me(s,e),Ie(s,a,t);let i=n?s.map(u=>[...u]):void 0,c=o??Se(s,a,r,H);return G(s,a,c),H(s,r,c),Ee(s,e),{matrix:s,mask:c,formatInfo:n?we(r,c):void 0,unmaskedMatrix:i}}function Y(e,r,t){return e<7&&r<7||e<7&&r>=t-7||e>=t-7&&r<7}function Pe(e){return[{x:0,y:0},{x:e-7,y:0},{x:0,y:e-7}]}function De(e,r){let o=Math.max(.1,Math.min(.3,r));return e*o}function dt(e,r,t,o,n,s,a){let i=S[t]||S.square,c=i.renderSVG(e,r,7*a,o),u=i.renderSVG(e+a,r+a,5*a,s),l=i.renderSVG(e+2*a,r+2*a,3*a,n);return c+u+l}function mt(e,r,t,o){let n=o/2,s=e.trim();if(e.includes("data:image/svg")||s.startsWith("<svg")||s.startsWith("<?xml")){let i=e;if(e.includes("data:image/svg")){let m=e.match(/data:image\/svg\+xml[^,]*,(.+)/);if(m){let g=m[1];if(e.includes("base64"))try{if(typeof atob<"u")i=atob(g);else if(typeof Buffer<"u")i=Buffer.from(g,"base64").toString("utf-8");else return""}catch{return""}else try{i=decodeURIComponent(g)}catch{return""}}}let c=i.match(/viewBox=["']([^"']+)["']/),u=c?c[1]:"0 0 100 100",l=i.match(/<svg([\s\S]*?)>/i),d="";if(l){let m=l[1].match(/xmlns[^=]*=["'][^"']*["']/gi);m&&(d=" "+m.join(" "))}let f=i.replace(/<\?xml[^>]*>|<svg[\s\S]*?>|<\/svg>/gi,"");return`<g transform="translate(${r-n}, ${t-n})">
21
+ <svg width="${o}" height="${o}" viewBox="${u}"${d}>
22
22
  ${f}
23
23
  </svg>
24
- </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function et(e,r,t,o,n){let s=e.matrixSize,a="",i=E[t]||E.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!j(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d;a+=`M${h},${g}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!j(c,u,s)){let l=u*r,m=c*r,f=n*r,d=(1-n)*r/2,h=l+d,g=m+d,b={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(h,g,f,o,b)}return a}function ve(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,m=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let $=L[r.border.shape];if($){let C={borderWidth:u,borderStyle:r.border.style};f+=$.renderSVG(0,0,l,r.border.color,C)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${m}" y="${m}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${m}, ${m})">`;let d=Ie(e.matrixSize),h="";for(let $ of d)h+=Ke($.x*c,$.y*c,s.shape,s.color,a.color,n,c);let g=et(e,c,i.shape,i.color,i.scale);f+=h+g+"</g>";let b="";if(r.logo){let $=Ee(e.matrixSize,r.logo.scale)*c,C=l/2;b=Je(r.logo.src,C,C,$)}return f+=b+"</svg>",f}function Oe(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
24
+ </g>`}else return`<image x="${r-n}" y="${t-n}" width="${o}" height="${o}" href="${e}" preserveAspectRatio="xMidYMid meet"/>`}function gt(e,r,t,o,n){let s=e.matrixSize,a="",i=E[t]||E.classic;if(t==="classic"){a=`<path fill="${o}" d="`;for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!Y(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,g=l+m,h=d+m;a+=`M${g},${h}h${f}v${f}h${-f}z`}return a+='"/>',a}for(let c=0;c<s;c++)for(let u=0;u<s;u++)if(e.modules[c][u]&&!Y(c,u,s)){let l=u*r,d=c*r,f=n*r,m=(1-n)*r/2,g=l+m,h=d+m,p={qrcode:e.modules,qrSize:s,row:c,col:u};a+=i.renderSVG(g,h,f,o,p)}return a}function Ae(e,r){let{size:t,margin:o,backgroundColor:n,eyes:s,pupils:a,dots:i}=r,c=t/e.matrixSize,u=r.border.shape==="none"?0:r.border.width,l=t+2*o+2*u,d=o+u,f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${l}" width="${l}" height="${l}">`;if(f+=`<rect width="${l}" height="${l}" fill="${n}"/>`,r.border.shape!=="none"&&u>0){let y=A[r.border.shape];if(y){let $={borderWidth:u,borderStyle:r.border.style};f+=y.renderSVG(0,0,l,r.border.color,$)}}r.border.shape!=="none"&&u>0&&(f+=`<rect x="${d}" y="${d}" width="${t}" height="${t}" fill="${n}"/>`),f+=`<g transform="translate(${d}, ${d})">`;let m=Pe(e.matrixSize),g="";for(let y of m)g+=dt(y.x*c,y.y*c,s.shape,s.color,a.color,n,c);let h=gt(e,c,i.shape,i.color,i.scale);f+=g+h+"</g>";let p="";if(r.logo){let y=De(e.matrixSize,r.logo.scale)*c,$=l/2;p=mt(r.logo.src,$,$,y)}return f+=p+"</svg>",f}function Le(e,r){let{margin:t,lightChar:o,darkChar:n}=r,s="",a=e.matrixSize+t*2;for(let i=0;i<t;i++)s+=o.repeat(a)+`
25
25
  `;for(let i=0;i<e.matrixSize;i++){s+=o.repeat(t);for(let c=0;c<e.matrixSize;c++)s+=e.modules[i][c]?n:o;s+=o.repeat(t)+`
26
26
  `}for(let i=0;i<t;i++)s+=o.repeat(a)+`
27
- `;return s}var D=null,we=!1;async function tt(){if(D)return D;if(we)throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js");we=!0;try{return D=(await import("@resvg/resvg-js")).Resvg,D}catch{throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js")}}async function Pe(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a,c=await tt(),m=new c(e,{fitTo:{mode:"width",value:i}}).render().asPng(),f=Buffer.from(m);return t.type==="dataURL"?`data:image/png;base64,${f.toString("base64")}`:f}async function Ae(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await Pe(e,r)}function H(e){if(typeof e=="string")return e;switch(e.type){case"url":return rt(e.url);case"vcard":return nt(e.data);case"wifi":return ot(e.data);case"calendar":return st(e.data);case"email":return at(e.email,e.subject,e.body);case"sms":return it(e.phone,e.message);case"phone":return ct(e.phone)}}function rt(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function nt(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
- `)}function ot(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=Le(e.ssid),n=Le(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function Le(e){return e.replace(/([\\;,":])/g,"\\$1")}function st(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
- `)}function at(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function it(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function ct(e){return`tel:${e}`}function ut(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=K[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function Te(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=ue(e,r),o=y[t],n=k(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${y[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=ce(e,n,o[n-1]),a=Y[t][n-1],i=X[t][n-1],{dataBlocks:c,ecBlocks:u}=me(s,a,i),l=de(c,u),m=ut(l,n),{matrix:f,mask:d}=Re(n,t,m);return{version:n,matrixSize:R(n),modules:f,mask:d,errorCorrectionLevel:t}}async function lt(e,r){let t=H(e),o=se(r),n=Te(t,!!o.logo),s=ve(n,o);return await Ae(s,o)}function ft(e,r){let t=H(e),o=ae(r),n=Te(t,!1);return Oe(n,o)}export{te as BorderShape,re as BorderStyle,ee as DotShape,J as EyeFrameShape,O as QRValidationError,lt as genQrImage,ft as genQrText};
27
+ `;return s}var T=null,ke=!1;async function ht(){if(T)return T;if(ke)throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js");ke=!0;try{return T=(await import("@resvg/resvg-js")).Resvg,T}catch{throw new Error("PNG generation in Node.js requires @resvg/resvg-js. Install with: npm install @resvg/resvg-js")}}async function Te(e,r){let{output:t,size:o,margin:n,border:s}=r,a=s.shape==="none"?0:s.width,i=o+2*n+2*a,c=await ht(),d=new c(e,{fitTo:{mode:"width",value:i}}).render().asPng(),f=Buffer.from(d);return t.type==="dataURL"?`data:image/png;base64,${f.toString("base64")}`:f}async function Be(e,r){let{format:t,type:o}=r.output;return t==="svg"?o==="string"?e:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`:await Te(e,r)}function X(e){if(typeof e=="string")return e;switch(e.type){case"url":return pt(e.url);case"vcard":return bt(e.data);case"wifi":return yt(e.data);case"calendar":return $t(e.data);case"email":return xt(e.email,e.subject,e.body);case"sms":return vt(e.phone,e.message);case"phone":return Ct(e.phone)}}function pt(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}function bt(e){let r=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`];if(e.phone&&r.push(`TEL:${e.phone}`),e.email&&r.push(`EMAIL:${e.email}`),e.organization&&r.push(`ORG:${e.organization}`),e.url&&r.push(`URL:${e.url}`),e.title&&r.push(`TITLE:${e.title}`),e.note&&r.push(`NOTE:${e.note}`),e.address){let{street:t,city:o,state:n,zip:s,country:a}=e.address,i=["","",t||"",o||"",n||"",s||"",a||""];r.push(`ADR:${i.join(";")}`)}return r.push("END:VCARD"),r.join(`
28
+ `)}function yt(e){let r=e.encryption||"WPA",t=e.hidden?"H:true;":"",o=Ve(e.ssid),n=Ve(e.password);return`WIFI:T:${r};S:${o};P:${n};${t};`}function Ve(e){return e.replace(/([\\;,":])/g,"\\$1")}function $t(e){let r=o=>(typeof o=="string"?new Date(o):o).toISOString().replace(/[-:]/g,"").split(".")[0]+"Z",t=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`SUMMARY:${e.title}`,`DTSTART:${r(e.startDate)}`,`DTEND:${r(e.endDate)}`];return e.location&&t.push(`LOCATION:${e.location}`),e.description&&t.push(`DESCRIPTION:${e.description}`),t.push("END:VEVENT","END:VCALENDAR"),t.join(`
29
+ `)}function xt(e,r,t){let o=`mailto:${e}`,n=[];return r&&n.push(`subject=${encodeURIComponent(r)}`),t&&n.push(`body=${encodeURIComponent(t)}`),n.length>0&&(o+=`?${n.join("&")}`),o}function vt(e,r){return r?`sms:${e}:${r}`:`sms:${e}`}function Ct(e){return`tel:${e}`}function Rt(e,r){let t=[];for(let n of e)for(let s=7;s>=0;s--)t.push((n>>s&1)===1);let o=ee[r-1];for(let n=0;n<o;n++)t.push(!1);return t}function Ne(e,r){if(!e)throw new Error("QR Code input cannot be empty. Please provide text or structured content to encode.");let t=ge(e,r),o=C[t],n=k(e,o);if(n<1||n>10)throw new Error(`Input data is too large for QR code version 10. Data length: ${e.length} characters. Maximum capacity at EC level ${t}: ~${C[t][9]} bytes. Try reducing input length or removing logo for higher capacity.`);let s=me(e,n,o[n-1]),a=Z[t][n-1],i=K[t][n-1],{dataBlocks:c,ecBlocks:u}=be(s,a,i),l=ye(c,u),d=Rt(l,n),{matrix:f,mask:m}=Oe(n,t,d);return{version:n,matrixSize:I(n),modules:f,mask:m,errorCorrectionLevel:t}}async function Mt(e,r){_(e);let t=X(e),o=le(r),n=Ne(t,!!o.logo),s=Ae(n,o);return await Be(s,o)}function It(e,r){_(e);let t=X(e),o=fe(r),n=Ne(t,!1);return Le(n,o)}export{ne as BorderShape,oe as BorderStyle,re as DotShape,te as EyeFrameShape,v as QRValidationError,Mt as genQrImage,It as genQrText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapple.io/qr-code-generator",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Lightweight QR code generator with ESM and CommonJS support",
5
5
  "files": [
6
6
  "dist",