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