nexabase-report 0.1.0

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.
@@ -0,0 +1,1473 @@
1
+ function St(e, t) {
2
+ for (var i = 0; i < t.length; i++) {
3
+ const r = t[i];
4
+ if (typeof r != "string" && !Array.isArray(r)) {
5
+ for (const n in r)
6
+ if (n !== "default" && !(n in e)) {
7
+ const o = Object.getOwnPropertyDescriptor(r, n);
8
+ o && Object.defineProperty(e, n, o.get ? o : {
9
+ enumerable: !0,
10
+ get: () => r[n]
11
+ });
12
+ }
13
+ }
14
+ }
15
+ return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
16
+ }
17
+ var _ = {}, Rt = function() {
18
+ return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
19
+ }, dt = {}, I = {};
20
+ let it;
21
+ const Lt = [
22
+ 0,
23
+ // Not used
24
+ 26,
25
+ 44,
26
+ 70,
27
+ 100,
28
+ 134,
29
+ 172,
30
+ 196,
31
+ 242,
32
+ 292,
33
+ 346,
34
+ 404,
35
+ 466,
36
+ 532,
37
+ 581,
38
+ 655,
39
+ 733,
40
+ 815,
41
+ 901,
42
+ 991,
43
+ 1085,
44
+ 1156,
45
+ 1258,
46
+ 1364,
47
+ 1474,
48
+ 1588,
49
+ 1706,
50
+ 1828,
51
+ 1921,
52
+ 2051,
53
+ 2185,
54
+ 2323,
55
+ 2465,
56
+ 2611,
57
+ 2761,
58
+ 2876,
59
+ 3034,
60
+ 3196,
61
+ 3362,
62
+ 3532,
63
+ 3706
64
+ ];
65
+ I.getSymbolSize = function(t) {
66
+ if (!t) throw new Error('"version" cannot be null or undefined');
67
+ if (t < 1 || t > 40) throw new Error('"version" should be in range from 1 to 40');
68
+ return t * 4 + 17;
69
+ };
70
+ I.getSymbolTotalCodewords = function(t) {
71
+ return Lt[t];
72
+ };
73
+ I.getBCHDigit = function(e) {
74
+ let t = 0;
75
+ for (; e !== 0; )
76
+ t++, e >>>= 1;
77
+ return t;
78
+ };
79
+ I.setToSJISFunction = function(t) {
80
+ if (typeof t != "function")
81
+ throw new Error('"toSJISFunc" is not a valid function.');
82
+ it = t;
83
+ };
84
+ I.isKanjiModeEnabled = function() {
85
+ return typeof it < "u";
86
+ };
87
+ I.toSJIS = function(t) {
88
+ return it(t);
89
+ };
90
+ var j = {};
91
+ (function(e) {
92
+ e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
93
+ function t(i) {
94
+ if (typeof i != "string")
95
+ throw new Error("Param is not a string");
96
+ switch (i.toLowerCase()) {
97
+ case "l":
98
+ case "low":
99
+ return e.L;
100
+ case "m":
101
+ case "medium":
102
+ return e.M;
103
+ case "q":
104
+ case "quartile":
105
+ return e.Q;
106
+ case "h":
107
+ case "high":
108
+ return e.H;
109
+ default:
110
+ throw new Error("Unknown EC Level: " + i);
111
+ }
112
+ }
113
+ e.isValid = function(r) {
114
+ return r && typeof r.bit < "u" && r.bit >= 0 && r.bit < 4;
115
+ }, e.from = function(r, n) {
116
+ if (e.isValid(r))
117
+ return r;
118
+ try {
119
+ return t(r);
120
+ } catch {
121
+ return n;
122
+ }
123
+ };
124
+ })(j);
125
+ function ht() {
126
+ this.buffer = [], this.length = 0;
127
+ }
128
+ ht.prototype = {
129
+ get: function(e) {
130
+ const t = Math.floor(e / 8);
131
+ return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
132
+ },
133
+ put: function(e, t) {
134
+ for (let i = 0; i < t; i++)
135
+ this.putBit((e >>> t - i - 1 & 1) === 1);
136
+ },
137
+ getLengthInBits: function() {
138
+ return this.length;
139
+ },
140
+ putBit: function(e) {
141
+ const t = Math.floor(this.length / 8);
142
+ this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
143
+ }
144
+ };
145
+ var _t = ht;
146
+ function H(e) {
147
+ if (!e || e < 1)
148
+ throw new Error("BitMatrix size must be defined and greater than 0");
149
+ this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
150
+ }
151
+ H.prototype.set = function(e, t, i, r) {
152
+ const n = e * this.size + t;
153
+ this.data[n] = i, r && (this.reservedBit[n] = !0);
154
+ };
155
+ H.prototype.get = function(e, t) {
156
+ return this.data[e * this.size + t];
157
+ };
158
+ H.prototype.xor = function(e, t, i) {
159
+ this.data[e * this.size + t] ^= i;
160
+ };
161
+ H.prototype.isReserved = function(e, t) {
162
+ return this.reservedBit[e * this.size + t];
163
+ };
164
+ var Dt = H, wt = {};
165
+ (function(e) {
166
+ const t = I.getSymbolSize;
167
+ e.getRowColCoords = function(r) {
168
+ if (r === 1) return [];
169
+ const n = Math.floor(r / 7) + 2, o = t(r), s = o === 145 ? 26 : Math.ceil((o - 13) / (2 * n - 2)) * 2, c = [o - 7];
170
+ for (let u = 1; u < n - 1; u++)
171
+ c[u] = c[u - 1] - s;
172
+ return c.push(6), c.reverse();
173
+ }, e.getPositions = function(r) {
174
+ const n = [], o = e.getRowColCoords(r), s = o.length;
175
+ for (let c = 0; c < s; c++)
176
+ for (let u = 0; u < s; u++)
177
+ c === 0 && u === 0 || // top-left
178
+ c === 0 && u === s - 1 || // bottom-left
179
+ c === s - 1 && u === 0 || n.push([o[c], o[u]]);
180
+ return n;
181
+ };
182
+ })(wt);
183
+ var mt = {};
184
+ const Ut = I.getSymbolSize, lt = 7;
185
+ mt.getPositions = function(t) {
186
+ const i = Ut(t);
187
+ return [
188
+ // top-left
189
+ [0, 0],
190
+ // top-right
191
+ [i - lt, 0],
192
+ // bottom-left
193
+ [0, i - lt]
194
+ ];
195
+ };
196
+ var yt = {};
197
+ (function(e) {
198
+ e.Patterns = {
199
+ PATTERN000: 0,
200
+ PATTERN001: 1,
201
+ PATTERN010: 2,
202
+ PATTERN011: 3,
203
+ PATTERN100: 4,
204
+ PATTERN101: 5,
205
+ PATTERN110: 6,
206
+ PATTERN111: 7
207
+ };
208
+ const t = {
209
+ N1: 3,
210
+ N2: 3,
211
+ N3: 40,
212
+ N4: 10
213
+ };
214
+ e.isValid = function(n) {
215
+ return n != null && n !== "" && !isNaN(n) && n >= 0 && n <= 7;
216
+ }, e.from = function(n) {
217
+ return e.isValid(n) ? parseInt(n, 10) : void 0;
218
+ }, e.getPenaltyN1 = function(n) {
219
+ const o = n.size;
220
+ let s = 0, c = 0, u = 0, a = null, l = null;
221
+ for (let p = 0; p < o; p++) {
222
+ c = u = 0, a = l = null;
223
+ for (let w = 0; w < o; w++) {
224
+ let f = n.get(p, w);
225
+ f === a ? c++ : (c >= 5 && (s += t.N1 + (c - 5)), a = f, c = 1), f = n.get(w, p), f === l ? u++ : (u >= 5 && (s += t.N1 + (u - 5)), l = f, u = 1);
226
+ }
227
+ c >= 5 && (s += t.N1 + (c - 5)), u >= 5 && (s += t.N1 + (u - 5));
228
+ }
229
+ return s;
230
+ }, e.getPenaltyN2 = function(n) {
231
+ const o = n.size;
232
+ let s = 0;
233
+ for (let c = 0; c < o - 1; c++)
234
+ for (let u = 0; u < o - 1; u++) {
235
+ const a = n.get(c, u) + n.get(c, u + 1) + n.get(c + 1, u) + n.get(c + 1, u + 1);
236
+ (a === 4 || a === 0) && s++;
237
+ }
238
+ return s * t.N2;
239
+ }, e.getPenaltyN3 = function(n) {
240
+ const o = n.size;
241
+ let s = 0, c = 0, u = 0;
242
+ for (let a = 0; a < o; a++) {
243
+ c = u = 0;
244
+ for (let l = 0; l < o; l++)
245
+ c = c << 1 & 2047 | n.get(a, l), l >= 10 && (c === 1488 || c === 93) && s++, u = u << 1 & 2047 | n.get(l, a), l >= 10 && (u === 1488 || u === 93) && s++;
246
+ }
247
+ return s * t.N3;
248
+ }, e.getPenaltyN4 = function(n) {
249
+ let o = 0;
250
+ const s = n.data.length;
251
+ for (let u = 0; u < s; u++) o += n.data[u];
252
+ return Math.abs(Math.ceil(o * 100 / s / 5) - 10) * t.N4;
253
+ };
254
+ function i(r, n, o) {
255
+ switch (r) {
256
+ case e.Patterns.PATTERN000:
257
+ return (n + o) % 2 === 0;
258
+ case e.Patterns.PATTERN001:
259
+ return n % 2 === 0;
260
+ case e.Patterns.PATTERN010:
261
+ return o % 3 === 0;
262
+ case e.Patterns.PATTERN011:
263
+ return (n + o) % 3 === 0;
264
+ case e.Patterns.PATTERN100:
265
+ return (Math.floor(n / 2) + Math.floor(o / 3)) % 2 === 0;
266
+ case e.Patterns.PATTERN101:
267
+ return n * o % 2 + n * o % 3 === 0;
268
+ case e.Patterns.PATTERN110:
269
+ return (n * o % 2 + n * o % 3) % 2 === 0;
270
+ case e.Patterns.PATTERN111:
271
+ return (n * o % 3 + (n + o) % 2) % 2 === 0;
272
+ default:
273
+ throw new Error("bad maskPattern:" + r);
274
+ }
275
+ }
276
+ e.applyMask = function(n, o) {
277
+ const s = o.size;
278
+ for (let c = 0; c < s; c++)
279
+ for (let u = 0; u < s; u++)
280
+ o.isReserved(u, c) || o.xor(u, c, i(n, u, c));
281
+ }, e.getBestMask = function(n, o) {
282
+ const s = Object.keys(e.Patterns).length;
283
+ let c = 0, u = 1 / 0;
284
+ for (let a = 0; a < s; a++) {
285
+ o(a), e.applyMask(a, n);
286
+ const l = e.getPenaltyN1(n) + e.getPenaltyN2(n) + e.getPenaltyN3(n) + e.getPenaltyN4(n);
287
+ e.applyMask(a, n), l < u && (u = l, c = a);
288
+ }
289
+ return c;
290
+ };
291
+ })(yt);
292
+ var G = {};
293
+ const R = j, K = [
294
+ // L M Q H
295
+ 1,
296
+ 1,
297
+ 1,
298
+ 1,
299
+ 1,
300
+ 1,
301
+ 1,
302
+ 1,
303
+ 1,
304
+ 1,
305
+ 2,
306
+ 2,
307
+ 1,
308
+ 2,
309
+ 2,
310
+ 4,
311
+ 1,
312
+ 2,
313
+ 4,
314
+ 4,
315
+ 2,
316
+ 4,
317
+ 4,
318
+ 4,
319
+ 2,
320
+ 4,
321
+ 6,
322
+ 5,
323
+ 2,
324
+ 4,
325
+ 6,
326
+ 6,
327
+ 2,
328
+ 5,
329
+ 8,
330
+ 8,
331
+ 4,
332
+ 5,
333
+ 8,
334
+ 8,
335
+ 4,
336
+ 5,
337
+ 8,
338
+ 11,
339
+ 4,
340
+ 8,
341
+ 10,
342
+ 11,
343
+ 4,
344
+ 9,
345
+ 12,
346
+ 16,
347
+ 4,
348
+ 9,
349
+ 16,
350
+ 16,
351
+ 6,
352
+ 10,
353
+ 12,
354
+ 18,
355
+ 6,
356
+ 10,
357
+ 17,
358
+ 16,
359
+ 6,
360
+ 11,
361
+ 16,
362
+ 19,
363
+ 6,
364
+ 13,
365
+ 18,
366
+ 21,
367
+ 7,
368
+ 14,
369
+ 21,
370
+ 25,
371
+ 8,
372
+ 16,
373
+ 20,
374
+ 25,
375
+ 8,
376
+ 17,
377
+ 23,
378
+ 25,
379
+ 9,
380
+ 17,
381
+ 23,
382
+ 34,
383
+ 9,
384
+ 18,
385
+ 25,
386
+ 30,
387
+ 10,
388
+ 20,
389
+ 27,
390
+ 32,
391
+ 12,
392
+ 21,
393
+ 29,
394
+ 35,
395
+ 12,
396
+ 23,
397
+ 34,
398
+ 37,
399
+ 12,
400
+ 25,
401
+ 34,
402
+ 40,
403
+ 13,
404
+ 26,
405
+ 35,
406
+ 42,
407
+ 14,
408
+ 28,
409
+ 38,
410
+ 45,
411
+ 15,
412
+ 29,
413
+ 40,
414
+ 48,
415
+ 16,
416
+ 31,
417
+ 43,
418
+ 51,
419
+ 17,
420
+ 33,
421
+ 45,
422
+ 54,
423
+ 18,
424
+ 35,
425
+ 48,
426
+ 57,
427
+ 19,
428
+ 37,
429
+ 51,
430
+ 60,
431
+ 19,
432
+ 38,
433
+ 53,
434
+ 63,
435
+ 20,
436
+ 40,
437
+ 56,
438
+ 66,
439
+ 21,
440
+ 43,
441
+ 59,
442
+ 70,
443
+ 22,
444
+ 45,
445
+ 62,
446
+ 74,
447
+ 24,
448
+ 47,
449
+ 65,
450
+ 77,
451
+ 25,
452
+ 49,
453
+ 68,
454
+ 81
455
+ ], J = [
456
+ // L M Q H
457
+ 7,
458
+ 10,
459
+ 13,
460
+ 17,
461
+ 10,
462
+ 16,
463
+ 22,
464
+ 28,
465
+ 15,
466
+ 26,
467
+ 36,
468
+ 44,
469
+ 20,
470
+ 36,
471
+ 52,
472
+ 64,
473
+ 26,
474
+ 48,
475
+ 72,
476
+ 88,
477
+ 36,
478
+ 64,
479
+ 96,
480
+ 112,
481
+ 40,
482
+ 72,
483
+ 108,
484
+ 130,
485
+ 48,
486
+ 88,
487
+ 132,
488
+ 156,
489
+ 60,
490
+ 110,
491
+ 160,
492
+ 192,
493
+ 72,
494
+ 130,
495
+ 192,
496
+ 224,
497
+ 80,
498
+ 150,
499
+ 224,
500
+ 264,
501
+ 96,
502
+ 176,
503
+ 260,
504
+ 308,
505
+ 104,
506
+ 198,
507
+ 288,
508
+ 352,
509
+ 120,
510
+ 216,
511
+ 320,
512
+ 384,
513
+ 132,
514
+ 240,
515
+ 360,
516
+ 432,
517
+ 144,
518
+ 280,
519
+ 408,
520
+ 480,
521
+ 168,
522
+ 308,
523
+ 448,
524
+ 532,
525
+ 180,
526
+ 338,
527
+ 504,
528
+ 588,
529
+ 196,
530
+ 364,
531
+ 546,
532
+ 650,
533
+ 224,
534
+ 416,
535
+ 600,
536
+ 700,
537
+ 224,
538
+ 442,
539
+ 644,
540
+ 750,
541
+ 252,
542
+ 476,
543
+ 690,
544
+ 816,
545
+ 270,
546
+ 504,
547
+ 750,
548
+ 900,
549
+ 300,
550
+ 560,
551
+ 810,
552
+ 960,
553
+ 312,
554
+ 588,
555
+ 870,
556
+ 1050,
557
+ 336,
558
+ 644,
559
+ 952,
560
+ 1110,
561
+ 360,
562
+ 700,
563
+ 1020,
564
+ 1200,
565
+ 390,
566
+ 728,
567
+ 1050,
568
+ 1260,
569
+ 420,
570
+ 784,
571
+ 1140,
572
+ 1350,
573
+ 450,
574
+ 812,
575
+ 1200,
576
+ 1440,
577
+ 480,
578
+ 868,
579
+ 1290,
580
+ 1530,
581
+ 510,
582
+ 924,
583
+ 1350,
584
+ 1620,
585
+ 540,
586
+ 980,
587
+ 1440,
588
+ 1710,
589
+ 570,
590
+ 1036,
591
+ 1530,
592
+ 1800,
593
+ 570,
594
+ 1064,
595
+ 1590,
596
+ 1890,
597
+ 600,
598
+ 1120,
599
+ 1680,
600
+ 1980,
601
+ 630,
602
+ 1204,
603
+ 1770,
604
+ 2100,
605
+ 660,
606
+ 1260,
607
+ 1860,
608
+ 2220,
609
+ 720,
610
+ 1316,
611
+ 1950,
612
+ 2310,
613
+ 750,
614
+ 1372,
615
+ 2040,
616
+ 2430
617
+ ];
618
+ G.getBlocksCount = function(t, i) {
619
+ switch (i) {
620
+ case R.L:
621
+ return K[(t - 1) * 4 + 0];
622
+ case R.M:
623
+ return K[(t - 1) * 4 + 1];
624
+ case R.Q:
625
+ return K[(t - 1) * 4 + 2];
626
+ case R.H:
627
+ return K[(t - 1) * 4 + 3];
628
+ default:
629
+ return;
630
+ }
631
+ };
632
+ G.getTotalCodewordsCount = function(t, i) {
633
+ switch (i) {
634
+ case R.L:
635
+ return J[(t - 1) * 4 + 0];
636
+ case R.M:
637
+ return J[(t - 1) * 4 + 1];
638
+ case R.Q:
639
+ return J[(t - 1) * 4 + 2];
640
+ case R.H:
641
+ return J[(t - 1) * 4 + 3];
642
+ default:
643
+ return;
644
+ }
645
+ };
646
+ var Et = {}, Q = {};
647
+ const z = new Uint8Array(512), O = new Uint8Array(256);
648
+ (function() {
649
+ let t = 1;
650
+ for (let i = 0; i < 255; i++)
651
+ z[i] = t, O[t] = i, t <<= 1, t & 256 && (t ^= 285);
652
+ for (let i = 255; i < 512; i++)
653
+ z[i] = z[i - 255];
654
+ })();
655
+ Q.log = function(t) {
656
+ if (t < 1) throw new Error("log(" + t + ")");
657
+ return O[t];
658
+ };
659
+ Q.exp = function(t) {
660
+ return z[t];
661
+ };
662
+ Q.mul = function(t, i) {
663
+ return t === 0 || i === 0 ? 0 : z[O[t] + O[i]];
664
+ };
665
+ (function(e) {
666
+ const t = Q;
667
+ e.mul = function(r, n) {
668
+ const o = new Uint8Array(r.length + n.length - 1);
669
+ for (let s = 0; s < r.length; s++)
670
+ for (let c = 0; c < n.length; c++)
671
+ o[s + c] ^= t.mul(r[s], n[c]);
672
+ return o;
673
+ }, e.mod = function(r, n) {
674
+ let o = new Uint8Array(r);
675
+ for (; o.length - n.length >= 0; ) {
676
+ const s = o[0];
677
+ for (let u = 0; u < n.length; u++)
678
+ o[u] ^= t.mul(n[u], s);
679
+ let c = 0;
680
+ for (; c < o.length && o[c] === 0; ) c++;
681
+ o = o.slice(c);
682
+ }
683
+ return o;
684
+ }, e.generateECPolynomial = function(r) {
685
+ let n = new Uint8Array([1]);
686
+ for (let o = 0; o < r; o++)
687
+ n = e.mul(n, new Uint8Array([1, t.exp(o)]));
688
+ return n;
689
+ };
690
+ })(Et);
691
+ const Ct = Et;
692
+ function st(e) {
693
+ this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
694
+ }
695
+ st.prototype.initialize = function(t) {
696
+ this.degree = t, this.genPoly = Ct.generateECPolynomial(this.degree);
697
+ };
698
+ st.prototype.encode = function(t) {
699
+ if (!this.genPoly)
700
+ throw new Error("Encoder not initialized");
701
+ const i = new Uint8Array(t.length + this.degree);
702
+ i.set(t);
703
+ const r = Ct.mod(i, this.genPoly), n = this.degree - r.length;
704
+ if (n > 0) {
705
+ const o = new Uint8Array(this.degree);
706
+ return o.set(r, n), o;
707
+ }
708
+ return r;
709
+ };
710
+ var Ft = st, pt = {}, L = {}, ut = {};
711
+ ut.isValid = function(t) {
712
+ return !isNaN(t) && t >= 1 && t <= 40;
713
+ };
714
+ var M = {};
715
+ const Bt = "[0-9]+", kt = "[A-Z $%*+\\-./:]+";
716
+ let V = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
717
+ V = V.replace(/u/g, "\\u");
718
+ const vt = "(?:(?![A-Z0-9 $%*+\\-./:]|" + V + `)(?:.|[\r
719
+ ]))+`;
720
+ M.KANJI = new RegExp(V, "g");
721
+ M.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
722
+ M.BYTE = new RegExp(vt, "g");
723
+ M.NUMERIC = new RegExp(Bt, "g");
724
+ M.ALPHANUMERIC = new RegExp(kt, "g");
725
+ const zt = new RegExp("^" + V + "$"), Vt = new RegExp("^" + Bt + "$"), Ht = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
726
+ M.testKanji = function(t) {
727
+ return zt.test(t);
728
+ };
729
+ M.testNumeric = function(t) {
730
+ return Vt.test(t);
731
+ };
732
+ M.testAlphanumeric = function(t) {
733
+ return Ht.test(t);
734
+ };
735
+ (function(e) {
736
+ const t = ut, i = M;
737
+ e.NUMERIC = {
738
+ id: "Numeric",
739
+ bit: 1,
740
+ ccBits: [10, 12, 14]
741
+ }, e.ALPHANUMERIC = {
742
+ id: "Alphanumeric",
743
+ bit: 2,
744
+ ccBits: [9, 11, 13]
745
+ }, e.BYTE = {
746
+ id: "Byte",
747
+ bit: 4,
748
+ ccBits: [8, 16, 16]
749
+ }, e.KANJI = {
750
+ id: "Kanji",
751
+ bit: 8,
752
+ ccBits: [8, 10, 12]
753
+ }, e.MIXED = {
754
+ bit: -1
755
+ }, e.getCharCountIndicator = function(o, s) {
756
+ if (!o.ccBits) throw new Error("Invalid mode: " + o);
757
+ if (!t.isValid(s))
758
+ throw new Error("Invalid version: " + s);
759
+ return s >= 1 && s < 10 ? o.ccBits[0] : s < 27 ? o.ccBits[1] : o.ccBits[2];
760
+ }, e.getBestModeForData = function(o) {
761
+ return i.testNumeric(o) ? e.NUMERIC : i.testAlphanumeric(o) ? e.ALPHANUMERIC : i.testKanji(o) ? e.KANJI : e.BYTE;
762
+ }, e.toString = function(o) {
763
+ if (o && o.id) return o.id;
764
+ throw new Error("Invalid mode");
765
+ }, e.isValid = function(o) {
766
+ return o && o.bit && o.ccBits;
767
+ };
768
+ function r(n) {
769
+ if (typeof n != "string")
770
+ throw new Error("Param is not a string");
771
+ switch (n.toLowerCase()) {
772
+ case "numeric":
773
+ return e.NUMERIC;
774
+ case "alphanumeric":
775
+ return e.ALPHANUMERIC;
776
+ case "kanji":
777
+ return e.KANJI;
778
+ case "byte":
779
+ return e.BYTE;
780
+ default:
781
+ throw new Error("Unknown mode: " + n);
782
+ }
783
+ }
784
+ e.from = function(o, s) {
785
+ if (e.isValid(o))
786
+ return o;
787
+ try {
788
+ return r(o);
789
+ } catch {
790
+ return s;
791
+ }
792
+ };
793
+ })(L);
794
+ (function(e) {
795
+ const t = I, i = G, r = j, n = L, o = ut, s = 7973, c = t.getBCHDigit(s);
796
+ function u(w, f, m) {
797
+ for (let y = 1; y <= 40; y++)
798
+ if (f <= e.getCapacity(y, m, w))
799
+ return y;
800
+ }
801
+ function a(w, f) {
802
+ return n.getCharCountIndicator(w, f) + 4;
803
+ }
804
+ function l(w, f) {
805
+ let m = 0;
806
+ return w.forEach(function(y) {
807
+ const T = a(y.mode, f);
808
+ m += T + y.getBitsLength();
809
+ }), m;
810
+ }
811
+ function p(w, f) {
812
+ for (let m = 1; m <= 40; m++)
813
+ if (l(w, m) <= e.getCapacity(m, f, n.MIXED))
814
+ return m;
815
+ }
816
+ e.from = function(f, m) {
817
+ return o.isValid(f) ? parseInt(f, 10) : m;
818
+ }, e.getCapacity = function(f, m, y) {
819
+ if (!o.isValid(f))
820
+ throw new Error("Invalid QR Code version");
821
+ typeof y > "u" && (y = n.BYTE);
822
+ const T = t.getSymbolTotalCodewords(f), h = i.getTotalCodewordsCount(f, m), E = (T - h) * 8;
823
+ if (y === n.MIXED) return E;
824
+ const d = E - a(y, f);
825
+ switch (y) {
826
+ case n.NUMERIC:
827
+ return Math.floor(d / 10 * 3);
828
+ case n.ALPHANUMERIC:
829
+ return Math.floor(d / 11 * 2);
830
+ case n.KANJI:
831
+ return Math.floor(d / 13);
832
+ case n.BYTE:
833
+ default:
834
+ return Math.floor(d / 8);
835
+ }
836
+ }, e.getBestVersionForData = function(f, m) {
837
+ let y;
838
+ const T = r.from(m, r.M);
839
+ if (Array.isArray(f)) {
840
+ if (f.length > 1)
841
+ return p(f, T);
842
+ if (f.length === 0)
843
+ return 1;
844
+ y = f[0];
845
+ } else
846
+ y = f;
847
+ return u(y.mode, y.getLength(), T);
848
+ }, e.getEncodedBits = function(f) {
849
+ if (!o.isValid(f) || f < 7)
850
+ throw new Error("Invalid QR Code version");
851
+ let m = f << 12;
852
+ for (; t.getBCHDigit(m) - c >= 0; )
853
+ m ^= s << t.getBCHDigit(m) - c;
854
+ return f << 12 | m;
855
+ };
856
+ })(pt);
857
+ var At = {};
858
+ const et = I, Tt = 1335, Kt = 21522, ft = et.getBCHDigit(Tt);
859
+ At.getEncodedBits = function(t, i) {
860
+ const r = t.bit << 3 | i;
861
+ let n = r << 10;
862
+ for (; et.getBCHDigit(n) - ft >= 0; )
863
+ n ^= Tt << et.getBCHDigit(n) - ft;
864
+ return (r << 10 | n) ^ Kt;
865
+ };
866
+ var It = {};
867
+ const Jt = L;
868
+ function D(e) {
869
+ this.mode = Jt.NUMERIC, this.data = e.toString();
870
+ }
871
+ D.getBitsLength = function(t) {
872
+ return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
873
+ };
874
+ D.prototype.getLength = function() {
875
+ return this.data.length;
876
+ };
877
+ D.prototype.getBitsLength = function() {
878
+ return D.getBitsLength(this.data.length);
879
+ };
880
+ D.prototype.write = function(t) {
881
+ let i, r, n;
882
+ for (i = 0; i + 3 <= this.data.length; i += 3)
883
+ r = this.data.substr(i, 3), n = parseInt(r, 10), t.put(n, 10);
884
+ const o = this.data.length - i;
885
+ o > 0 && (r = this.data.substr(i), n = parseInt(r, 10), t.put(n, o * 3 + 1));
886
+ };
887
+ var Ot = D;
888
+ const Yt = L, Z = [
889
+ "0",
890
+ "1",
891
+ "2",
892
+ "3",
893
+ "4",
894
+ "5",
895
+ "6",
896
+ "7",
897
+ "8",
898
+ "9",
899
+ "A",
900
+ "B",
901
+ "C",
902
+ "D",
903
+ "E",
904
+ "F",
905
+ "G",
906
+ "H",
907
+ "I",
908
+ "J",
909
+ "K",
910
+ "L",
911
+ "M",
912
+ "N",
913
+ "O",
914
+ "P",
915
+ "Q",
916
+ "R",
917
+ "S",
918
+ "T",
919
+ "U",
920
+ "V",
921
+ "W",
922
+ "X",
923
+ "Y",
924
+ "Z",
925
+ " ",
926
+ "$",
927
+ "%",
928
+ "*",
929
+ "+",
930
+ "-",
931
+ ".",
932
+ "/",
933
+ ":"
934
+ ];
935
+ function U(e) {
936
+ this.mode = Yt.ALPHANUMERIC, this.data = e;
937
+ }
938
+ U.getBitsLength = function(t) {
939
+ return 11 * Math.floor(t / 2) + 6 * (t % 2);
940
+ };
941
+ U.prototype.getLength = function() {
942
+ return this.data.length;
943
+ };
944
+ U.prototype.getBitsLength = function() {
945
+ return U.getBitsLength(this.data.length);
946
+ };
947
+ U.prototype.write = function(t) {
948
+ let i;
949
+ for (i = 0; i + 2 <= this.data.length; i += 2) {
950
+ let r = Z.indexOf(this.data[i]) * 45;
951
+ r += Z.indexOf(this.data[i + 1]), t.put(r, 11);
952
+ }
953
+ this.data.length % 2 && t.put(Z.indexOf(this.data[i]), 6);
954
+ };
955
+ var jt = U;
956
+ const Gt = L;
957
+ function F(e) {
958
+ this.mode = Gt.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
959
+ }
960
+ F.getBitsLength = function(t) {
961
+ return t * 8;
962
+ };
963
+ F.prototype.getLength = function() {
964
+ return this.data.length;
965
+ };
966
+ F.prototype.getBitsLength = function() {
967
+ return F.getBitsLength(this.data.length);
968
+ };
969
+ F.prototype.write = function(e) {
970
+ for (let t = 0, i = this.data.length; t < i; t++)
971
+ e.put(this.data[t], 8);
972
+ };
973
+ var Qt = F;
974
+ const qt = L, Wt = I;
975
+ function k(e) {
976
+ this.mode = qt.KANJI, this.data = e;
977
+ }
978
+ k.getBitsLength = function(t) {
979
+ return t * 13;
980
+ };
981
+ k.prototype.getLength = function() {
982
+ return this.data.length;
983
+ };
984
+ k.prototype.getBitsLength = function() {
985
+ return k.getBitsLength(this.data.length);
986
+ };
987
+ k.prototype.write = function(e) {
988
+ let t;
989
+ for (t = 0; t < this.data.length; t++) {
990
+ let i = Wt.toSJIS(this.data[t]);
991
+ if (i >= 33088 && i <= 40956)
992
+ i -= 33088;
993
+ else if (i >= 57408 && i <= 60351)
994
+ i -= 49472;
995
+ else
996
+ throw new Error(
997
+ "Invalid SJIS character: " + this.data[t] + `
998
+ Make sure your charset is UTF-8`
999
+ );
1000
+ i = (i >>> 8 & 255) * 192 + (i & 255), e.put(i, 13);
1001
+ }
1002
+ };
1003
+ var Zt = k, Nt = { exports: {} };
1004
+ (function(e) {
1005
+ var t = {
1006
+ single_source_shortest_paths: function(i, r, n) {
1007
+ var o = {}, s = {};
1008
+ s[r] = 0;
1009
+ var c = t.PriorityQueue.make();
1010
+ c.push(r, 0);
1011
+ for (var u, a, l, p, w, f, m, y, T; !c.empty(); ) {
1012
+ u = c.pop(), a = u.value, p = u.cost, w = i[a] || {};
1013
+ for (l in w)
1014
+ w.hasOwnProperty(l) && (f = w[l], m = p + f, y = s[l], T = typeof s[l] > "u", (T || y > m) && (s[l] = m, c.push(l, m), o[l] = a));
1015
+ }
1016
+ if (typeof n < "u" && typeof s[n] > "u") {
1017
+ var h = ["Could not find a path from ", r, " to ", n, "."].join("");
1018
+ throw new Error(h);
1019
+ }
1020
+ return o;
1021
+ },
1022
+ extract_shortest_path_from_predecessor_list: function(i, r) {
1023
+ for (var n = [], o = r; o; )
1024
+ n.push(o), i[o], o = i[o];
1025
+ return n.reverse(), n;
1026
+ },
1027
+ find_path: function(i, r, n) {
1028
+ var o = t.single_source_shortest_paths(i, r, n);
1029
+ return t.extract_shortest_path_from_predecessor_list(
1030
+ o,
1031
+ n
1032
+ );
1033
+ },
1034
+ /**
1035
+ * A very naive priority queue implementation.
1036
+ */
1037
+ PriorityQueue: {
1038
+ make: function(i) {
1039
+ var r = t.PriorityQueue, n = {}, o;
1040
+ i = i || {};
1041
+ for (o in r)
1042
+ r.hasOwnProperty(o) && (n[o] = r[o]);
1043
+ return n.queue = [], n.sorter = i.sorter || r.default_sorter, n;
1044
+ },
1045
+ default_sorter: function(i, r) {
1046
+ return i.cost - r.cost;
1047
+ },
1048
+ /**
1049
+ * Add a new item to the queue and ensure the highest priority element
1050
+ * is at the front of the queue.
1051
+ */
1052
+ push: function(i, r) {
1053
+ var n = { value: i, cost: r };
1054
+ this.queue.push(n), this.queue.sort(this.sorter);
1055
+ },
1056
+ /**
1057
+ * Return the highest priority element in the queue.
1058
+ */
1059
+ pop: function() {
1060
+ return this.queue.shift();
1061
+ },
1062
+ empty: function() {
1063
+ return this.queue.length === 0;
1064
+ }
1065
+ }
1066
+ };
1067
+ e.exports = t;
1068
+ })(Nt);
1069
+ var Xt = Nt.exports;
1070
+ (function(e) {
1071
+ const t = L, i = Ot, r = jt, n = Qt, o = Zt, s = M, c = I, u = Xt;
1072
+ function a(h) {
1073
+ return unescape(encodeURIComponent(h)).length;
1074
+ }
1075
+ function l(h, E, d) {
1076
+ const g = [];
1077
+ let C;
1078
+ for (; (C = h.exec(d)) !== null; )
1079
+ g.push({
1080
+ data: C[0],
1081
+ index: C.index,
1082
+ mode: E,
1083
+ length: C[0].length
1084
+ });
1085
+ return g;
1086
+ }
1087
+ function p(h) {
1088
+ const E = l(s.NUMERIC, t.NUMERIC, h), d = l(s.ALPHANUMERIC, t.ALPHANUMERIC, h);
1089
+ let g, C;
1090
+ return c.isKanjiModeEnabled() ? (g = l(s.BYTE, t.BYTE, h), C = l(s.KANJI, t.KANJI, h)) : (g = l(s.BYTE_KANJI, t.BYTE, h), C = []), E.concat(d, g, C).sort(function(A, N) {
1091
+ return A.index - N.index;
1092
+ }).map(function(A) {
1093
+ return {
1094
+ data: A.data,
1095
+ mode: A.mode,
1096
+ length: A.length
1097
+ };
1098
+ });
1099
+ }
1100
+ function w(h, E) {
1101
+ switch (E) {
1102
+ case t.NUMERIC:
1103
+ return i.getBitsLength(h);
1104
+ case t.ALPHANUMERIC:
1105
+ return r.getBitsLength(h);
1106
+ case t.KANJI:
1107
+ return o.getBitsLength(h);
1108
+ case t.BYTE:
1109
+ return n.getBitsLength(h);
1110
+ }
1111
+ }
1112
+ function f(h) {
1113
+ return h.reduce(function(E, d) {
1114
+ const g = E.length - 1 >= 0 ? E[E.length - 1] : null;
1115
+ return g && g.mode === d.mode ? (E[E.length - 1].data += d.data, E) : (E.push(d), E);
1116
+ }, []);
1117
+ }
1118
+ function m(h) {
1119
+ const E = [];
1120
+ for (let d = 0; d < h.length; d++) {
1121
+ const g = h[d];
1122
+ switch (g.mode) {
1123
+ case t.NUMERIC:
1124
+ E.push([
1125
+ g,
1126
+ { data: g.data, mode: t.ALPHANUMERIC, length: g.length },
1127
+ { data: g.data, mode: t.BYTE, length: g.length }
1128
+ ]);
1129
+ break;
1130
+ case t.ALPHANUMERIC:
1131
+ E.push([
1132
+ g,
1133
+ { data: g.data, mode: t.BYTE, length: g.length }
1134
+ ]);
1135
+ break;
1136
+ case t.KANJI:
1137
+ E.push([
1138
+ g,
1139
+ { data: g.data, mode: t.BYTE, length: a(g.data) }
1140
+ ]);
1141
+ break;
1142
+ case t.BYTE:
1143
+ E.push([
1144
+ { data: g.data, mode: t.BYTE, length: a(g.data) }
1145
+ ]);
1146
+ }
1147
+ }
1148
+ return E;
1149
+ }
1150
+ function y(h, E) {
1151
+ const d = {}, g = { start: {} };
1152
+ let C = ["start"];
1153
+ for (let B = 0; B < h.length; B++) {
1154
+ const A = h[B], N = [];
1155
+ for (let S = 0; S < A.length; S++) {
1156
+ const b = A[S], v = "" + B + S;
1157
+ N.push(v), d[v] = { node: b, lastCount: 0 }, g[v] = {};
1158
+ for (let W = 0; W < C.length; W++) {
1159
+ const P = C[W];
1160
+ d[P] && d[P].node.mode === b.mode ? (g[P][v] = w(d[P].lastCount + b.length, b.mode) - w(d[P].lastCount, b.mode), d[P].lastCount += b.length) : (d[P] && (d[P].lastCount = b.length), g[P][v] = w(b.length, b.mode) + 4 + t.getCharCountIndicator(b.mode, E));
1161
+ }
1162
+ }
1163
+ C = N;
1164
+ }
1165
+ for (let B = 0; B < C.length; B++)
1166
+ g[C[B]].end = 0;
1167
+ return { map: g, table: d };
1168
+ }
1169
+ function T(h, E) {
1170
+ let d;
1171
+ const g = t.getBestModeForData(h);
1172
+ if (d = t.from(E, g), d !== t.BYTE && d.bit < g.bit)
1173
+ throw new Error('"' + h + '" cannot be encoded with mode ' + t.toString(d) + `.
1174
+ Suggested mode is: ` + t.toString(g));
1175
+ switch (d === t.KANJI && !c.isKanjiModeEnabled() && (d = t.BYTE), d) {
1176
+ case t.NUMERIC:
1177
+ return new i(h);
1178
+ case t.ALPHANUMERIC:
1179
+ return new r(h);
1180
+ case t.KANJI:
1181
+ return new o(h);
1182
+ case t.BYTE:
1183
+ return new n(h);
1184
+ }
1185
+ }
1186
+ e.fromArray = function(E) {
1187
+ return E.reduce(function(d, g) {
1188
+ return typeof g == "string" ? d.push(T(g, null)) : g.data && d.push(T(g.data, g.mode)), d;
1189
+ }, []);
1190
+ }, e.fromString = function(E, d) {
1191
+ const g = p(E, c.isKanjiModeEnabled()), C = m(g), B = y(C, d), A = u.find_path(B.map, "start", "end"), N = [];
1192
+ for (let S = 1; S < A.length - 1; S++)
1193
+ N.push(B.table[A[S]].node);
1194
+ return e.fromArray(f(N));
1195
+ }, e.rawSplit = function(E) {
1196
+ return e.fromArray(
1197
+ p(E, c.isKanjiModeEnabled())
1198
+ );
1199
+ };
1200
+ })(It);
1201
+ const q = I, X = j, xt = _t, $t = Dt, te = wt, ee = mt, nt = yt, rt = G, ne = Ft, Y = pt, re = At, oe = L, x = It;
1202
+ function ie(e, t) {
1203
+ const i = e.size, r = ee.getPositions(t);
1204
+ for (let n = 0; n < r.length; n++) {
1205
+ const o = r[n][0], s = r[n][1];
1206
+ for (let c = -1; c <= 7; c++)
1207
+ if (!(o + c <= -1 || i <= o + c))
1208
+ for (let u = -1; u <= 7; u++)
1209
+ s + u <= -1 || i <= s + u || (c >= 0 && c <= 6 && (u === 0 || u === 6) || u >= 0 && u <= 6 && (c === 0 || c === 6) || c >= 2 && c <= 4 && u >= 2 && u <= 4 ? e.set(o + c, s + u, !0, !0) : e.set(o + c, s + u, !1, !0));
1210
+ }
1211
+ }
1212
+ function se(e) {
1213
+ const t = e.size;
1214
+ for (let i = 8; i < t - 8; i++) {
1215
+ const r = i % 2 === 0;
1216
+ e.set(i, 6, r, !0), e.set(6, i, r, !0);
1217
+ }
1218
+ }
1219
+ function ue(e, t) {
1220
+ const i = te.getPositions(t);
1221
+ for (let r = 0; r < i.length; r++) {
1222
+ const n = i[r][0], o = i[r][1];
1223
+ for (let s = -2; s <= 2; s++)
1224
+ for (let c = -2; c <= 2; c++)
1225
+ s === -2 || s === 2 || c === -2 || c === 2 || s === 0 && c === 0 ? e.set(n + s, o + c, !0, !0) : e.set(n + s, o + c, !1, !0);
1226
+ }
1227
+ }
1228
+ function ce(e, t) {
1229
+ const i = e.size, r = Y.getEncodedBits(t);
1230
+ let n, o, s;
1231
+ for (let c = 0; c < 18; c++)
1232
+ n = Math.floor(c / 3), o = c % 3 + i - 8 - 3, s = (r >> c & 1) === 1, e.set(n, o, s, !0), e.set(o, n, s, !0);
1233
+ }
1234
+ function $(e, t, i) {
1235
+ const r = e.size, n = re.getEncodedBits(t, i);
1236
+ let o, s;
1237
+ for (o = 0; o < 15; o++)
1238
+ s = (n >> o & 1) === 1, o < 6 ? e.set(o, 8, s, !0) : o < 8 ? e.set(o + 1, 8, s, !0) : e.set(r - 15 + o, 8, s, !0), o < 8 ? e.set(8, r - o - 1, s, !0) : o < 9 ? e.set(8, 15 - o - 1 + 1, s, !0) : e.set(8, 15 - o - 1, s, !0);
1239
+ e.set(r - 8, 8, 1, !0);
1240
+ }
1241
+ function ae(e, t) {
1242
+ const i = e.size;
1243
+ let r = -1, n = i - 1, o = 7, s = 0;
1244
+ for (let c = i - 1; c > 0; c -= 2)
1245
+ for (c === 6 && c--; ; ) {
1246
+ for (let u = 0; u < 2; u++)
1247
+ if (!e.isReserved(n, c - u)) {
1248
+ let a = !1;
1249
+ s < t.length && (a = (t[s] >>> o & 1) === 1), e.set(n, c - u, a), o--, o === -1 && (s++, o = 7);
1250
+ }
1251
+ if (n += r, n < 0 || i <= n) {
1252
+ n -= r, r = -r;
1253
+ break;
1254
+ }
1255
+ }
1256
+ }
1257
+ function le(e, t, i) {
1258
+ const r = new xt();
1259
+ i.forEach(function(u) {
1260
+ r.put(u.mode.bit, 4), r.put(u.getLength(), oe.getCharCountIndicator(u.mode, e)), u.write(r);
1261
+ });
1262
+ const n = q.getSymbolTotalCodewords(e), o = rt.getTotalCodewordsCount(e, t), s = (n - o) * 8;
1263
+ for (r.getLengthInBits() + 4 <= s && r.put(0, 4); r.getLengthInBits() % 8 !== 0; )
1264
+ r.putBit(0);
1265
+ const c = (s - r.getLengthInBits()) / 8;
1266
+ for (let u = 0; u < c; u++)
1267
+ r.put(u % 2 ? 17 : 236, 8);
1268
+ return fe(r, e, t);
1269
+ }
1270
+ function fe(e, t, i) {
1271
+ const r = q.getSymbolTotalCodewords(t), n = rt.getTotalCodewordsCount(t, i), o = r - n, s = rt.getBlocksCount(t, i), c = r % s, u = s - c, a = Math.floor(r / s), l = Math.floor(o / s), p = l + 1, w = a - l, f = new ne(w);
1272
+ let m = 0;
1273
+ const y = new Array(s), T = new Array(s);
1274
+ let h = 0;
1275
+ const E = new Uint8Array(e.buffer);
1276
+ for (let A = 0; A < s; A++) {
1277
+ const N = A < u ? l : p;
1278
+ y[A] = E.slice(m, m + N), T[A] = f.encode(y[A]), m += N, h = Math.max(h, N);
1279
+ }
1280
+ const d = new Uint8Array(r);
1281
+ let g = 0, C, B;
1282
+ for (C = 0; C < h; C++)
1283
+ for (B = 0; B < s; B++)
1284
+ C < y[B].length && (d[g++] = y[B][C]);
1285
+ for (C = 0; C < w; C++)
1286
+ for (B = 0; B < s; B++)
1287
+ d[g++] = T[B][C];
1288
+ return d;
1289
+ }
1290
+ function ge(e, t, i, r) {
1291
+ let n;
1292
+ if (Array.isArray(e))
1293
+ n = x.fromArray(e);
1294
+ else if (typeof e == "string") {
1295
+ let a = t;
1296
+ if (!a) {
1297
+ const l = x.rawSplit(e);
1298
+ a = Y.getBestVersionForData(l, i);
1299
+ }
1300
+ n = x.fromString(e, a || 40);
1301
+ } else
1302
+ throw new Error("Invalid data");
1303
+ const o = Y.getBestVersionForData(n, i);
1304
+ if (!o)
1305
+ throw new Error("The amount of data is too big to be stored in a QR Code");
1306
+ if (!t)
1307
+ t = o;
1308
+ else if (t < o)
1309
+ throw new Error(
1310
+ `
1311
+ The chosen QR Code version cannot contain this amount of data.
1312
+ Minimum version required to store current data is: ` + o + `.
1313
+ `
1314
+ );
1315
+ const s = le(t, i, n), c = q.getSymbolSize(t), u = new $t(c);
1316
+ return ie(u, t), se(u), ue(u, t), $(u, i, 0), t >= 7 && ce(u, t), ae(u, s), isNaN(r) && (r = nt.getBestMask(
1317
+ u,
1318
+ $.bind(null, u, i)
1319
+ )), nt.applyMask(r, u), $(u, i, r), {
1320
+ modules: u,
1321
+ version: t,
1322
+ errorCorrectionLevel: i,
1323
+ maskPattern: r,
1324
+ segments: n
1325
+ };
1326
+ }
1327
+ dt.create = function(t, i) {
1328
+ if (typeof t > "u" || t === "")
1329
+ throw new Error("No input text");
1330
+ let r = X.M, n, o;
1331
+ return typeof i < "u" && (r = X.from(i.errorCorrectionLevel, X.M), n = Y.from(i.version), o = nt.from(i.maskPattern), i.toSJISFunc && q.setToSJISFunction(i.toSJISFunc)), ge(t, n, r, o);
1332
+ };
1333
+ var bt = {}, ct = {};
1334
+ (function(e) {
1335
+ function t(i) {
1336
+ if (typeof i == "number" && (i = i.toString()), typeof i != "string")
1337
+ throw new Error("Color should be defined as hex string");
1338
+ let r = i.slice().replace("#", "").split("");
1339
+ if (r.length < 3 || r.length === 5 || r.length > 8)
1340
+ throw new Error("Invalid hex color: " + i);
1341
+ (r.length === 3 || r.length === 4) && (r = Array.prototype.concat.apply([], r.map(function(o) {
1342
+ return [o, o];
1343
+ }))), r.length === 6 && r.push("F", "F");
1344
+ const n = parseInt(r.join(""), 16);
1345
+ return {
1346
+ r: n >> 24 & 255,
1347
+ g: n >> 16 & 255,
1348
+ b: n >> 8 & 255,
1349
+ a: n & 255,
1350
+ hex: "#" + r.slice(0, 6).join("")
1351
+ };
1352
+ }
1353
+ e.getOptions = function(r) {
1354
+ r || (r = {}), r.color || (r.color = {});
1355
+ const n = typeof r.margin > "u" || r.margin === null || r.margin < 0 ? 4 : r.margin, o = r.width && r.width >= 21 ? r.width : void 0, s = r.scale || 4;
1356
+ return {
1357
+ width: o,
1358
+ scale: o ? 4 : s,
1359
+ margin: n,
1360
+ color: {
1361
+ dark: t(r.color.dark || "#000000ff"),
1362
+ light: t(r.color.light || "#ffffffff")
1363
+ },
1364
+ type: r.type,
1365
+ rendererOpts: r.rendererOpts || {}
1366
+ };
1367
+ }, e.getScale = function(r, n) {
1368
+ return n.width && n.width >= r + n.margin * 2 ? n.width / (r + n.margin * 2) : n.scale;
1369
+ }, e.getImageWidth = function(r, n) {
1370
+ const o = e.getScale(r, n);
1371
+ return Math.floor((r + n.margin * 2) * o);
1372
+ }, e.qrToImageData = function(r, n, o) {
1373
+ const s = n.modules.size, c = n.modules.data, u = e.getScale(s, o), a = Math.floor((s + o.margin * 2) * u), l = o.margin * u, p = [o.color.light, o.color.dark];
1374
+ for (let w = 0; w < a; w++)
1375
+ for (let f = 0; f < a; f++) {
1376
+ let m = (w * a + f) * 4, y = o.color.light;
1377
+ if (w >= l && f >= l && w < a - l && f < a - l) {
1378
+ const T = Math.floor((w - l) / u), h = Math.floor((f - l) / u);
1379
+ y = p[c[T * s + h] ? 1 : 0];
1380
+ }
1381
+ r[m++] = y.r, r[m++] = y.g, r[m++] = y.b, r[m] = y.a;
1382
+ }
1383
+ };
1384
+ })(ct);
1385
+ (function(e) {
1386
+ const t = ct;
1387
+ function i(n, o, s) {
1388
+ n.clearRect(0, 0, o.width, o.height), o.style || (o.style = {}), o.height = s, o.width = s, o.style.height = s + "px", o.style.width = s + "px";
1389
+ }
1390
+ function r() {
1391
+ try {
1392
+ return document.createElement("canvas");
1393
+ } catch {
1394
+ throw new Error("You need to specify a canvas element");
1395
+ }
1396
+ }
1397
+ e.render = function(o, s, c) {
1398
+ let u = c, a = s;
1399
+ typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), s || (a = r()), u = t.getOptions(u);
1400
+ const l = t.getImageWidth(o.modules.size, u), p = a.getContext("2d"), w = p.createImageData(l, l);
1401
+ return t.qrToImageData(w.data, o, u), i(p, a, l), p.putImageData(w, 0, 0), a;
1402
+ }, e.renderToDataURL = function(o, s, c) {
1403
+ let u = c;
1404
+ typeof u > "u" && (!s || !s.getContext) && (u = s, s = void 0), u || (u = {});
1405
+ const a = e.render(o, s, u), l = u.type || "image/png", p = u.rendererOpts || {};
1406
+ return a.toDataURL(l, p.quality);
1407
+ };
1408
+ })(bt);
1409
+ var Mt = {};
1410
+ const de = ct;
1411
+ function gt(e, t) {
1412
+ const i = e.a / 255, r = t + '="' + e.hex + '"';
1413
+ return i < 1 ? r + " " + t + '-opacity="' + i.toFixed(2).slice(1) + '"' : r;
1414
+ }
1415
+ function tt(e, t, i) {
1416
+ let r = e + t;
1417
+ return typeof i < "u" && (r += " " + i), r;
1418
+ }
1419
+ function he(e, t, i) {
1420
+ let r = "", n = 0, o = !1, s = 0;
1421
+ for (let c = 0; c < e.length; c++) {
1422
+ const u = Math.floor(c % t), a = Math.floor(c / t);
1423
+ !u && !o && (o = !0), e[c] ? (s++, c > 0 && u > 0 && e[c - 1] || (r += o ? tt("M", u + i, 0.5 + a + i) : tt("m", n, 0), n = 0, o = !1), u + 1 < t && e[c + 1] || (r += tt("h", s), s = 0)) : n++;
1424
+ }
1425
+ return r;
1426
+ }
1427
+ Mt.render = function(t, i, r) {
1428
+ const n = de.getOptions(i), o = t.modules.size, s = t.modules.data, c = o + n.margin * 2, u = n.color.light.a ? "<path " + gt(n.color.light, "fill") + ' d="M0 0h' + c + "v" + c + 'H0z"/>' : "", a = "<path " + gt(n.color.dark, "stroke") + ' d="' + he(s, o, n.margin) + '"/>', l = 'viewBox="0 0 ' + c + " " + c + '"', w = '<svg xmlns="http://www.w3.org/2000/svg" ' + (n.width ? 'width="' + n.width + '" height="' + n.width + '" ' : "") + l + ' shape-rendering="crispEdges">' + u + a + `</svg>
1429
+ `;
1430
+ return typeof r == "function" && r(null, w), w;
1431
+ };
1432
+ const we = Rt, ot = dt, Pt = bt, me = Mt;
1433
+ function at(e, t, i, r, n) {
1434
+ const o = [].slice.call(arguments, 1), s = o.length, c = typeof o[s - 1] == "function";
1435
+ if (!c && !we())
1436
+ throw new Error("Callback required as last argument");
1437
+ if (c) {
1438
+ if (s < 2)
1439
+ throw new Error("Too few arguments provided");
1440
+ s === 2 ? (n = i, i = t, t = r = void 0) : s === 3 && (t.getContext && typeof n > "u" ? (n = r, r = void 0) : (n = r, r = i, i = t, t = void 0));
1441
+ } else {
1442
+ if (s < 1)
1443
+ throw new Error("Too few arguments provided");
1444
+ return s === 1 ? (i = t, t = r = void 0) : s === 2 && !t.getContext && (r = i, i = t, t = void 0), new Promise(function(u, a) {
1445
+ try {
1446
+ const l = ot.create(i, r);
1447
+ u(e(l, t, r));
1448
+ } catch (l) {
1449
+ a(l);
1450
+ }
1451
+ });
1452
+ }
1453
+ try {
1454
+ const u = ot.create(i, r);
1455
+ n(null, e(u, t, r));
1456
+ } catch (u) {
1457
+ n(u);
1458
+ }
1459
+ }
1460
+ var ye = _.create = ot.create, Ee = _.toCanvas = at.bind(null, Pt.render), Ce = _.toDataURL = at.bind(null, Pt.renderToDataURL), pe = _.toString = at.bind(null, function(e, t, i) {
1461
+ return me.render(e, i);
1462
+ });
1463
+ const Be = /* @__PURE__ */ St({
1464
+ __proto__: null,
1465
+ create: ye,
1466
+ default: _,
1467
+ toCanvas: Ee,
1468
+ toDataURL: Ce,
1469
+ toString: pe
1470
+ }, [_]);
1471
+ export {
1472
+ Be as b
1473
+ };