@credenza3/scanner-lib 0.0.1

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,1857 @@
1
+ var dt = Object.defineProperty;
2
+ var pt = (s, r, o) => r in s ? dt(s, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[r] = o;
3
+ var ue = (s, r, o) => (pt(s, typeof r != "symbol" ? r + "" : r, o), o);
4
+ function Z() {
5
+ }
6
+ function Pe(s) {
7
+ return s();
8
+ }
9
+ function Le() {
10
+ return /* @__PURE__ */ Object.create(null);
11
+ }
12
+ function te(s) {
13
+ s.forEach(Pe);
14
+ }
15
+ function Ee(s) {
16
+ return typeof s == "function";
17
+ }
18
+ function Ne(s, r) {
19
+ return s != s ? r == r : s !== r || s && typeof s == "object" || typeof s == "function";
20
+ }
21
+ function yt(s) {
22
+ return Object.keys(s).length === 0;
23
+ }
24
+ function de(s, r) {
25
+ s.appendChild(r);
26
+ }
27
+ function Ve(s, r, o) {
28
+ const h = gt(s);
29
+ if (!h.getElementById(r)) {
30
+ const l = oe("style");
31
+ l.id = r, l.textContent = o, mt(h, l);
32
+ }
33
+ }
34
+ function gt(s) {
35
+ if (!s)
36
+ return document;
37
+ const r = s.getRootNode ? s.getRootNode() : s.ownerDocument;
38
+ return r && /** @type {ShadowRoot} */
39
+ r.host ? (
40
+ /** @type {ShadowRoot} */
41
+ r
42
+ ) : s.ownerDocument;
43
+ }
44
+ function mt(s, r) {
45
+ return de(
46
+ /** @type {Document} */
47
+ s.head || s,
48
+ r
49
+ ), r.sheet;
50
+ }
51
+ function We(s, r, o) {
52
+ s.insertBefore(r, o || null);
53
+ }
54
+ function xe(s) {
55
+ s.parentNode && s.parentNode.removeChild(s);
56
+ }
57
+ function oe(s) {
58
+ return document.createElement(s);
59
+ }
60
+ function wt(s) {
61
+ return document.createTextNode(s);
62
+ }
63
+ function Et() {
64
+ return wt(" ");
65
+ }
66
+ function xt(s, r, o, h) {
67
+ return s.addEventListener(r, o, h), () => s.removeEventListener(r, o, h);
68
+ }
69
+ function M(s, r, o) {
70
+ o == null ? s.removeAttribute(r) : s.getAttribute(r) !== o && s.setAttribute(r, o);
71
+ }
72
+ function _t(s) {
73
+ return Array.from(s.childNodes);
74
+ }
75
+ let ee;
76
+ function J(s) {
77
+ ee = s;
78
+ }
79
+ function Bt() {
80
+ if (!ee)
81
+ throw new Error("Function called outside component initialization");
82
+ return ee;
83
+ }
84
+ function vt(s) {
85
+ Bt().$$.on_destroy.push(s);
86
+ }
87
+ const Q = [], Me = [];
88
+ let Y = [];
89
+ const be = [], It = /* @__PURE__ */ Promise.resolve();
90
+ let pe = !1;
91
+ function Ft() {
92
+ pe || (pe = !0, It.then(je));
93
+ }
94
+ function ye(s) {
95
+ Y.push(s);
96
+ }
97
+ const le = /* @__PURE__ */ new Set();
98
+ let q = 0;
99
+ function je() {
100
+ if (q !== 0)
101
+ return;
102
+ const s = ee;
103
+ do {
104
+ try {
105
+ for (; q < Q.length; ) {
106
+ const r = Q[q];
107
+ q++, J(r), St(r.$$);
108
+ }
109
+ } catch (r) {
110
+ throw Q.length = 0, q = 0, r;
111
+ }
112
+ for (J(null), Q.length = 0, q = 0; Me.length; )
113
+ Me.pop()();
114
+ for (let r = 0; r < Y.length; r += 1) {
115
+ const o = Y[r];
116
+ le.has(o) || (le.add(o), o());
117
+ }
118
+ Y.length = 0;
119
+ } while (Q.length);
120
+ for (; be.length; )
121
+ be.pop()();
122
+ pe = !1, le.clear(), J(s);
123
+ }
124
+ function St(s) {
125
+ if (s.fragment !== null) {
126
+ s.update(), te(s.before_update);
127
+ const r = s.dirty;
128
+ s.dirty = [-1], s.fragment && s.fragment.p(s.ctx, r), s.after_update.forEach(ye);
129
+ }
130
+ }
131
+ function Ct(s) {
132
+ const r = [], o = [];
133
+ Y.forEach((h) => s.indexOf(h) === -1 ? r.push(h) : o.push(h)), o.forEach((h) => h()), Y = r;
134
+ }
135
+ const re = /* @__PURE__ */ new Set();
136
+ let V;
137
+ function Rt() {
138
+ V = {
139
+ r: 0,
140
+ c: [],
141
+ p: V
142
+ // parent group
143
+ };
144
+ }
145
+ function $t() {
146
+ V.r || te(V.c), V = V.p;
147
+ }
148
+ function K(s, r) {
149
+ s && s.i && (re.delete(s), s.i(r));
150
+ }
151
+ function ge(s, r, o, h) {
152
+ if (s && s.o) {
153
+ if (re.has(s))
154
+ return;
155
+ re.add(s), V.c.push(() => {
156
+ re.delete(s), h && (o && s.d(1), h());
157
+ }), s.o(r);
158
+ } else
159
+ h && h();
160
+ }
161
+ function At(s) {
162
+ s && s.c();
163
+ }
164
+ function He(s, r, o) {
165
+ const { fragment: h, after_update: l } = s.$$;
166
+ h && h.m(r, o), ye(() => {
167
+ const d = s.$$.on_mount.map(Pe).filter(Ee);
168
+ s.$$.on_destroy ? s.$$.on_destroy.push(...d) : te(d), s.$$.on_mount = [];
169
+ }), l.forEach(ye);
170
+ }
171
+ function qe(s, r) {
172
+ const o = s.$$;
173
+ o.fragment !== null && (Ct(o.after_update), te(o.on_destroy), o.fragment && o.fragment.d(r), o.on_destroy = o.fragment = null, o.ctx = []);
174
+ }
175
+ function Ut(s, r) {
176
+ s.$$.dirty[0] === -1 && (Q.push(s), Ft(), s.$$.dirty.fill(0)), s.$$.dirty[r / 31 | 0] |= 1 << r % 31;
177
+ }
178
+ function ze(s, r, o, h, l, d, p = null, a = [-1]) {
179
+ const y = ee;
180
+ J(s);
181
+ const g = s.$$ = {
182
+ fragment: null,
183
+ ctx: [],
184
+ // state
185
+ props: d,
186
+ update: Z,
187
+ not_equal: l,
188
+ bound: Le(),
189
+ // lifecycle
190
+ on_mount: [],
191
+ on_destroy: [],
192
+ on_disconnect: [],
193
+ before_update: [],
194
+ after_update: [],
195
+ context: new Map(r.context || (y ? y.$$.context : [])),
196
+ // everything else
197
+ callbacks: Le(),
198
+ dirty: a,
199
+ skip_bound: !1,
200
+ root: r.target || y.$$.root
201
+ };
202
+ p && p(g.root);
203
+ let m = !1;
204
+ if (g.ctx = o ? o(s, r.props || {}, (E, w, ...B) => {
205
+ const R = B.length ? B[0] : w;
206
+ return g.ctx && l(g.ctx[E], g.ctx[E] = R) && (!g.skip_bound && g.bound[E] && g.bound[E](R), m && Ut(s, E)), w;
207
+ }) : [], g.update(), m = !0, te(g.before_update), g.fragment = h ? h(g.ctx) : !1, r.target) {
208
+ if (r.hydrate) {
209
+ const E = _t(r.target);
210
+ g.fragment && g.fragment.l(E), E.forEach(xe);
211
+ } else
212
+ g.fragment && g.fragment.c();
213
+ r.intro && K(s.$$.fragment), He(s, r.target, r.anchor), je();
214
+ }
215
+ J(y);
216
+ }
217
+ class Qe {
218
+ constructor() {
219
+ /**
220
+ * ### PRIVATE API
221
+ *
222
+ * Do not use, may change at any time
223
+ *
224
+ * @type {any}
225
+ */
226
+ ue(this, "$$");
227
+ /**
228
+ * ### PRIVATE API
229
+ *
230
+ * Do not use, may change at any time
231
+ *
232
+ * @type {any}
233
+ */
234
+ ue(this, "$$set");
235
+ }
236
+ /** @returns {void} */
237
+ $destroy() {
238
+ qe(this, 1), this.$destroy = Z;
239
+ }
240
+ /**
241
+ * @template {Extract<keyof Events, string>} K
242
+ * @param {K} type
243
+ * @param {((e: Events[K]) => void) | null | undefined} callback
244
+ * @returns {() => void}
245
+ */
246
+ $on(r, o) {
247
+ if (!Ee(o))
248
+ return Z;
249
+ const h = this.$$.callbacks[r] || (this.$$.callbacks[r] = []);
250
+ return h.push(o), () => {
251
+ const l = h.indexOf(o);
252
+ l !== -1 && h.splice(l, 1);
253
+ };
254
+ }
255
+ /**
256
+ * @param {Partial<Props>} props
257
+ * @returns {void}
258
+ */
259
+ $set(r) {
260
+ this.$$set && !yt(r) && (this.$$.skip_bound = !0, this.$$set(r), this.$$.skip_bound = !1);
261
+ }
262
+ }
263
+ const Ot = "4";
264
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Ot);
265
+ function Tt(s) {
266
+ Ve(s, "svelte-1is2ll8", ".cscanapp-close.svelte-1is2ll8{position:absolute;z-index:10;right:5px;top:5px;width:32px;height:32px;opacity:0.3;cursor:pointer}.cscanapp-close.svelte-1is2ll8:hover{opacity:1}.cscanapp-close.svelte-1is2ll8:before,.cscanapp-close.svelte-1is2ll8:after{position:absolute;left:15px;content:' ';height:33px;width:2px;background-color:#000}.cscanapp-close.svelte-1is2ll8:before{transform:rotate(45deg)}.cscanapp-close.svelte-1is2ll8:after{transform:rotate(-45deg)}");
267
+ }
268
+ function Dt(s) {
269
+ let r, o, h;
270
+ return {
271
+ c() {
272
+ r = oe("div"), M(r, "class", "cscanapp-close svelte-1is2ll8"), M(r, "role", "button"), M(r, "tabindex", "0");
273
+ },
274
+ m(l, d) {
275
+ We(l, r, d), o || (h = xt(r, "click", function() {
276
+ Ee(
277
+ /*close*/
278
+ s[0]
279
+ ) && s[0].apply(this, arguments);
280
+ }), o = !0);
281
+ },
282
+ p(l, [d]) {
283
+ s = l;
284
+ },
285
+ i: Z,
286
+ o: Z,
287
+ d(l) {
288
+ l && xe(r), o = !1, h();
289
+ }
290
+ };
291
+ }
292
+ function Lt(s, r, o) {
293
+ let { close: h } = r;
294
+ return s.$$set = (l) => {
295
+ "close" in l && o(0, h = l.close);
296
+ }, [h];
297
+ }
298
+ class Mt extends Qe {
299
+ constructor(r) {
300
+ super(), ze(this, r, Lt, Dt, Ne, { close: 0 }, Tt);
301
+ }
302
+ }
303
+ function bt(s) {
304
+ Ve(s, "svelte-rajxqa", ".cscanapp.svelte-rajxqa.svelte-rajxqa{position:relative;width:100%;height:100%;border-radius:inherit}.cscanapp.svelte-rajxqa video.svelte-rajxqa{width:100%;height:100%;object-fit:cover;position:absolute;border-radius:inherit;display:block}");
305
+ }
306
+ function ke(s) {
307
+ let r, o;
308
+ return r = new Mt({ props: { close: (
309
+ /*close*/
310
+ s[0]
311
+ ) } }), {
312
+ c() {
313
+ At(r.$$.fragment);
314
+ },
315
+ m(h, l) {
316
+ He(r, h, l), o = !0;
317
+ },
318
+ p(h, l) {
319
+ const d = {};
320
+ l & /*close*/
321
+ 1 && (d.close = /*close*/
322
+ h[0]), r.$set(d);
323
+ },
324
+ i(h) {
325
+ o || (K(r.$$.fragment, h), o = !0);
326
+ },
327
+ o(h) {
328
+ ge(r.$$.fragment, h), o = !1;
329
+ },
330
+ d(h) {
331
+ qe(r, h);
332
+ }
333
+ };
334
+ }
335
+ function kt(s) {
336
+ let r, o, h, l, d, p, a = (
337
+ /*isCloseButton*/
338
+ s[1] && ke(s)
339
+ );
340
+ return {
341
+ c() {
342
+ r = oe("div"), a && a.c(), o = Et(), h = oe("video"), M(h, "id", l = /*scannerElements*/
343
+ s[2].VIDEO), M(h, "class", "svelte-rajxqa"), M(r, "id", d = /*scannerElements*/
344
+ s[2].ROOT), M(r, "class", "cscanapp svelte-rajxqa");
345
+ },
346
+ m(y, g) {
347
+ We(y, r, g), a && a.m(r, null), de(r, o), de(r, h), p = !0;
348
+ },
349
+ p(y, [g]) {
350
+ /*isCloseButton*/
351
+ y[1] ? a ? (a.p(y, g), g & /*isCloseButton*/
352
+ 2 && K(a, 1)) : (a = ke(y), a.c(), K(a, 1), a.m(r, o)) : a && (Rt(), ge(a, 1, 1, () => {
353
+ a = null;
354
+ }), $t()), (!p || g & /*scannerElements*/
355
+ 4 && l !== (l = /*scannerElements*/
356
+ y[2].VIDEO)) && M(h, "id", l), (!p || g & /*scannerElements*/
357
+ 4 && d !== (d = /*scannerElements*/
358
+ y[2].ROOT)) && M(r, "id", d);
359
+ },
360
+ i(y) {
361
+ p || (K(a), p = !0);
362
+ },
363
+ o(y) {
364
+ ge(a), p = !1;
365
+ },
366
+ d(y) {
367
+ y && xe(r), a && a.d();
368
+ }
369
+ };
370
+ }
371
+ function Pt(s, r, o) {
372
+ let { close: h } = r, { isCloseButton: l } = r, { scannerElements: d } = r;
373
+ return vt(h), s.$$set = (p) => {
374
+ "close" in p && o(0, h = p.close), "isCloseButton" in p && o(1, l = p.isCloseButton), "scannerElements" in p && o(2, d = p.scannerElements);
375
+ }, [h, l, d];
376
+ }
377
+ class Nt extends Qe {
378
+ constructor(r) {
379
+ super(), ze(
380
+ this,
381
+ r,
382
+ Pt,
383
+ kt,
384
+ Ne,
385
+ {
386
+ close: 0,
387
+ isCloseButton: 1,
388
+ scannerElements: 2
389
+ },
390
+ bt
391
+ );
392
+ }
393
+ }
394
+ var G = /* @__PURE__ */ ((s) => (s.CAPTURE = "capture", s.ERROR = "error", s.CANCEL = "cancel", s))(G || {}), ne = /* @__PURE__ */ ((s) => (s.ROOT = "cscanapp", s.VIDEO = "cscanappVideo", s))(ne || {}), me = {}, se = {};
395
+ se.byteLength = jt;
396
+ se.toByteArray = qt;
397
+ se.fromByteArray = Gt;
398
+ var L = [], U = [], Vt = typeof Uint8Array < "u" ? Uint8Array : Array, fe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
399
+ for (var z = 0, Wt = fe.length; z < Wt; ++z)
400
+ L[z] = fe[z], U[fe.charCodeAt(z)] = z;
401
+ U[45] = 62;
402
+ U[95] = 63;
403
+ function Ge(s) {
404
+ var r = s.length;
405
+ if (r % 4 > 0)
406
+ throw new Error("Invalid string. Length must be a multiple of 4");
407
+ var o = s.indexOf("=");
408
+ o === -1 && (o = r);
409
+ var h = o === r ? 0 : 4 - o % 4;
410
+ return [o, h];
411
+ }
412
+ function jt(s) {
413
+ var r = Ge(s), o = r[0], h = r[1];
414
+ return (o + h) * 3 / 4 - h;
415
+ }
416
+ function Ht(s, r, o) {
417
+ return (r + o) * 3 / 4 - o;
418
+ }
419
+ function qt(s) {
420
+ var r, o = Ge(s), h = o[0], l = o[1], d = new Vt(Ht(s, h, l)), p = 0, a = l > 0 ? h - 4 : h, y;
421
+ for (y = 0; y < a; y += 4)
422
+ r = U[s.charCodeAt(y)] << 18 | U[s.charCodeAt(y + 1)] << 12 | U[s.charCodeAt(y + 2)] << 6 | U[s.charCodeAt(y + 3)], d[p++] = r >> 16 & 255, d[p++] = r >> 8 & 255, d[p++] = r & 255;
423
+ return l === 2 && (r = U[s.charCodeAt(y)] << 2 | U[s.charCodeAt(y + 1)] >> 4, d[p++] = r & 255), l === 1 && (r = U[s.charCodeAt(y)] << 10 | U[s.charCodeAt(y + 1)] << 4 | U[s.charCodeAt(y + 2)] >> 2, d[p++] = r >> 8 & 255, d[p++] = r & 255), d;
424
+ }
425
+ function zt(s) {
426
+ return L[s >> 18 & 63] + L[s >> 12 & 63] + L[s >> 6 & 63] + L[s & 63];
427
+ }
428
+ function Qt(s, r, o) {
429
+ for (var h, l = [], d = r; d < o; d += 3)
430
+ h = (s[d] << 16 & 16711680) + (s[d + 1] << 8 & 65280) + (s[d + 2] & 255), l.push(zt(h));
431
+ return l.join("");
432
+ }
433
+ function Gt(s) {
434
+ for (var r, o = s.length, h = o % 3, l = [], d = 16383, p = 0, a = o - h; p < a; p += d)
435
+ l.push(Qt(s, p, p + d > a ? a : p + d));
436
+ return h === 1 ? (r = s[o - 1], l.push(
437
+ L[r >> 2] + L[r << 4 & 63] + "=="
438
+ )) : h === 2 && (r = (s[o - 2] << 8) + s[o - 1], l.push(
439
+ L[r >> 10] + L[r >> 4 & 63] + L[r << 2 & 63] + "="
440
+ )), l.join("");
441
+ }
442
+ var _e = {};
443
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
444
+ _e.read = function(s, r, o, h, l) {
445
+ var d, p, a = l * 8 - h - 1, y = (1 << a) - 1, g = y >> 1, m = -7, E = o ? l - 1 : 0, w = o ? -1 : 1, B = s[r + E];
446
+ for (E += w, d = B & (1 << -m) - 1, B >>= -m, m += a; m > 0; d = d * 256 + s[r + E], E += w, m -= 8)
447
+ ;
448
+ for (p = d & (1 << -m) - 1, d >>= -m, m += h; m > 0; p = p * 256 + s[r + E], E += w, m -= 8)
449
+ ;
450
+ if (d === 0)
451
+ d = 1 - g;
452
+ else {
453
+ if (d === y)
454
+ return p ? NaN : (B ? -1 : 1) * (1 / 0);
455
+ p = p + Math.pow(2, h), d = d - g;
456
+ }
457
+ return (B ? -1 : 1) * p * Math.pow(2, d - h);
458
+ };
459
+ _e.write = function(s, r, o, h, l, d) {
460
+ var p, a, y, g = d * 8 - l - 1, m = (1 << g) - 1, E = m >> 1, w = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, B = h ? 0 : d - 1, R = h ? 1 : -1, O = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
461
+ for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, p = m) : (p = Math.floor(Math.log(r) / Math.LN2), r * (y = Math.pow(2, -p)) < 1 && (p--, y *= 2), p + E >= 1 ? r += w / y : r += w * Math.pow(2, 1 - E), r * y >= 2 && (p++, y /= 2), p + E >= m ? (a = 0, p = m) : p + E >= 1 ? (a = (r * y - 1) * Math.pow(2, l), p = p + E) : (a = r * Math.pow(2, E - 1) * Math.pow(2, l), p = 0)); l >= 8; s[o + B] = a & 255, B += R, a /= 256, l -= 8)
462
+ ;
463
+ for (p = p << l | a, g += l; g > 0; s[o + B] = p & 255, B += R, p /= 256, g -= 8)
464
+ ;
465
+ s[o + B - R] |= O * 128;
466
+ };
467
+ /*!
468
+ * The buffer module from node.js, for the browser.
469
+ *
470
+ * @author Feross Aboukhadijeh <https://feross.org>
471
+ * @license MIT
472
+ */
473
+ (function(s) {
474
+ const r = se, o = _e, h = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
475
+ s.Buffer = a, s.SlowBuffer = W, s.INSPECT_MAX_BYTES = 50;
476
+ const l = 2147483647;
477
+ s.kMaxLength = l, a.TYPED_ARRAY_SUPPORT = d(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
478
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
479
+ );
480
+ function d() {
481
+ try {
482
+ const i = new Uint8Array(1), e = { foo: function() {
483
+ return 42;
484
+ } };
485
+ return Object.setPrototypeOf(e, Uint8Array.prototype), Object.setPrototypeOf(i, e), i.foo() === 42;
486
+ } catch {
487
+ return !1;
488
+ }
489
+ }
490
+ Object.defineProperty(a.prototype, "parent", {
491
+ enumerable: !0,
492
+ get: function() {
493
+ if (a.isBuffer(this))
494
+ return this.buffer;
495
+ }
496
+ }), Object.defineProperty(a.prototype, "offset", {
497
+ enumerable: !0,
498
+ get: function() {
499
+ if (a.isBuffer(this))
500
+ return this.byteOffset;
501
+ }
502
+ });
503
+ function p(i) {
504
+ if (i > l)
505
+ throw new RangeError('The value "' + i + '" is invalid for option "size"');
506
+ const e = new Uint8Array(i);
507
+ return Object.setPrototypeOf(e, a.prototype), e;
508
+ }
509
+ function a(i, e, t) {
510
+ if (typeof i == "number") {
511
+ if (typeof e == "string")
512
+ throw new TypeError(
513
+ 'The "string" argument must be of type string. Received type number'
514
+ );
515
+ return E(i);
516
+ }
517
+ return y(i, e, t);
518
+ }
519
+ a.poolSize = 8192;
520
+ function y(i, e, t) {
521
+ if (typeof i == "string")
522
+ return w(i, e);
523
+ if (ArrayBuffer.isView(i))
524
+ return R(i);
525
+ if (i == null)
526
+ throw new TypeError(
527
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
528
+ );
529
+ if (D(i, ArrayBuffer) || i && D(i.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (D(i, SharedArrayBuffer) || i && D(i.buffer, SharedArrayBuffer)))
530
+ return O(i, e, t);
531
+ if (typeof i == "number")
532
+ throw new TypeError(
533
+ 'The "value" argument must not be of type number. Received type number'
534
+ );
535
+ const n = i.valueOf && i.valueOf();
536
+ if (n != null && n !== i)
537
+ return a.from(n, e, t);
538
+ const c = b(i);
539
+ if (c)
540
+ return c;
541
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof i[Symbol.toPrimitive] == "function")
542
+ return a.from(i[Symbol.toPrimitive]("string"), e, t);
543
+ throw new TypeError(
544
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
545
+ );
546
+ }
547
+ a.from = function(i, e, t) {
548
+ return y(i, e, t);
549
+ }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
550
+ function g(i) {
551
+ if (typeof i != "number")
552
+ throw new TypeError('"size" argument must be of type number');
553
+ if (i < 0)
554
+ throw new RangeError('The value "' + i + '" is invalid for option "size"');
555
+ }
556
+ function m(i, e, t) {
557
+ return g(i), i <= 0 ? p(i) : e !== void 0 ? typeof t == "string" ? p(i).fill(e, t) : p(i).fill(e) : p(i);
558
+ }
559
+ a.alloc = function(i, e, t) {
560
+ return m(i, e, t);
561
+ };
562
+ function E(i) {
563
+ return g(i), p(i < 0 ? 0 : A(i) | 0);
564
+ }
565
+ a.allocUnsafe = function(i) {
566
+ return E(i);
567
+ }, a.allocUnsafeSlow = function(i) {
568
+ return E(i);
569
+ };
570
+ function w(i, e) {
571
+ if ((typeof e != "string" || e === "") && (e = "utf8"), !a.isEncoding(e))
572
+ throw new TypeError("Unknown encoding: " + e);
573
+ const t = k(i, e) | 0;
574
+ let n = p(t);
575
+ const c = n.write(i, e);
576
+ return c !== t && (n = n.slice(0, c)), n;
577
+ }
578
+ function B(i) {
579
+ const e = i.length < 0 ? 0 : A(i.length) | 0, t = p(e);
580
+ for (let n = 0; n < e; n += 1)
581
+ t[n] = i[n] & 255;
582
+ return t;
583
+ }
584
+ function R(i) {
585
+ if (D(i, Uint8Array)) {
586
+ const e = new Uint8Array(i);
587
+ return O(e.buffer, e.byteOffset, e.byteLength);
588
+ }
589
+ return B(i);
590
+ }
591
+ function O(i, e, t) {
592
+ if (e < 0 || i.byteLength < e)
593
+ throw new RangeError('"offset" is outside of buffer bounds');
594
+ if (i.byteLength < e + (t || 0))
595
+ throw new RangeError('"length" is outside of buffer bounds');
596
+ let n;
597
+ return e === void 0 && t === void 0 ? n = new Uint8Array(i) : t === void 0 ? n = new Uint8Array(i, e) : n = new Uint8Array(i, e, t), Object.setPrototypeOf(n, a.prototype), n;
598
+ }
599
+ function b(i) {
600
+ if (a.isBuffer(i)) {
601
+ const e = A(i.length) | 0, t = p(e);
602
+ return t.length === 0 || i.copy(t, 0, 0, e), t;
603
+ }
604
+ if (i.length !== void 0)
605
+ return typeof i.length != "number" || he(i.length) ? p(0) : B(i);
606
+ if (i.type === "Buffer" && Array.isArray(i.data))
607
+ return B(i.data);
608
+ }
609
+ function A(i) {
610
+ if (i >= l)
611
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
612
+ return i | 0;
613
+ }
614
+ function W(i) {
615
+ return +i != i && (i = 0), a.alloc(+i);
616
+ }
617
+ a.isBuffer = function(e) {
618
+ return e != null && e._isBuffer === !0 && e !== a.prototype;
619
+ }, a.compare = function(e, t) {
620
+ if (D(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), D(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(e) || !a.isBuffer(t))
621
+ throw new TypeError(
622
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
623
+ );
624
+ if (e === t)
625
+ return 0;
626
+ let n = e.length, c = t.length;
627
+ for (let u = 0, f = Math.min(n, c); u < f; ++u)
628
+ if (e[u] !== t[u]) {
629
+ n = e[u], c = t[u];
630
+ break;
631
+ }
632
+ return n < c ? -1 : c < n ? 1 : 0;
633
+ }, a.isEncoding = function(e) {
634
+ switch (String(e).toLowerCase()) {
635
+ case "hex":
636
+ case "utf8":
637
+ case "utf-8":
638
+ case "ascii":
639
+ case "latin1":
640
+ case "binary":
641
+ case "base64":
642
+ case "ucs2":
643
+ case "ucs-2":
644
+ case "utf16le":
645
+ case "utf-16le":
646
+ return !0;
647
+ default:
648
+ return !1;
649
+ }
650
+ }, a.concat = function(e, t) {
651
+ if (!Array.isArray(e))
652
+ throw new TypeError('"list" argument must be an Array of Buffers');
653
+ if (e.length === 0)
654
+ return a.alloc(0);
655
+ let n;
656
+ if (t === void 0)
657
+ for (t = 0, n = 0; n < e.length; ++n)
658
+ t += e[n].length;
659
+ const c = a.allocUnsafe(t);
660
+ let u = 0;
661
+ for (n = 0; n < e.length; ++n) {
662
+ let f = e[n];
663
+ if (D(f, Uint8Array))
664
+ u + f.length > c.length ? (a.isBuffer(f) || (f = a.from(f)), f.copy(c, u)) : Uint8Array.prototype.set.call(
665
+ c,
666
+ f,
667
+ u
668
+ );
669
+ else if (a.isBuffer(f))
670
+ f.copy(c, u);
671
+ else
672
+ throw new TypeError('"list" argument must be an Array of Buffers');
673
+ u += f.length;
674
+ }
675
+ return c;
676
+ };
677
+ function k(i, e) {
678
+ if (a.isBuffer(i))
679
+ return i.length;
680
+ if (ArrayBuffer.isView(i) || D(i, ArrayBuffer))
681
+ return i.byteLength;
682
+ if (typeof i != "string")
683
+ throw new TypeError(
684
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof i
685
+ );
686
+ const t = i.length, n = arguments.length > 2 && arguments[2] === !0;
687
+ if (!n && t === 0)
688
+ return 0;
689
+ let c = !1;
690
+ for (; ; )
691
+ switch (e) {
692
+ case "ascii":
693
+ case "latin1":
694
+ case "binary":
695
+ return t;
696
+ case "utf8":
697
+ case "utf-8":
698
+ return ce(i).length;
699
+ case "ucs2":
700
+ case "ucs-2":
701
+ case "utf16le":
702
+ case "utf-16le":
703
+ return t * 2;
704
+ case "hex":
705
+ return t >>> 1;
706
+ case "base64":
707
+ return De(i).length;
708
+ default:
709
+ if (c)
710
+ return n ? -1 : ce(i).length;
711
+ e = ("" + e).toLowerCase(), c = !0;
712
+ }
713
+ }
714
+ a.byteLength = k;
715
+ function T(i, e, t) {
716
+ let n = !1;
717
+ if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((t === void 0 || t > this.length) && (t = this.length), t <= 0) || (t >>>= 0, e >>>= 0, t <= e))
718
+ return "";
719
+ for (i || (i = "utf8"); ; )
720
+ switch (i) {
721
+ case "hex":
722
+ return nt(this, e, t);
723
+ case "utf8":
724
+ case "utf-8":
725
+ return Fe(this, e, t);
726
+ case "ascii":
727
+ return it(this, e, t);
728
+ case "latin1":
729
+ case "binary":
730
+ return rt(this, e, t);
731
+ case "base64":
732
+ return et(this, e, t);
733
+ case "ucs2":
734
+ case "ucs-2":
735
+ case "utf16le":
736
+ case "utf-16le":
737
+ return ot(this, e, t);
738
+ default:
739
+ if (n)
740
+ throw new TypeError("Unknown encoding: " + i);
741
+ i = (i + "").toLowerCase(), n = !0;
742
+ }
743
+ }
744
+ a.prototype._isBuffer = !0;
745
+ function N(i, e, t) {
746
+ const n = i[e];
747
+ i[e] = i[t], i[t] = n;
748
+ }
749
+ a.prototype.swap16 = function() {
750
+ const e = this.length;
751
+ if (e % 2 !== 0)
752
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
753
+ for (let t = 0; t < e; t += 2)
754
+ N(this, t, t + 1);
755
+ return this;
756
+ }, a.prototype.swap32 = function() {
757
+ const e = this.length;
758
+ if (e % 4 !== 0)
759
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
760
+ for (let t = 0; t < e; t += 4)
761
+ N(this, t, t + 3), N(this, t + 1, t + 2);
762
+ return this;
763
+ }, a.prototype.swap64 = function() {
764
+ const e = this.length;
765
+ if (e % 8 !== 0)
766
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
767
+ for (let t = 0; t < e; t += 8)
768
+ N(this, t, t + 7), N(this, t + 1, t + 6), N(this, t + 2, t + 5), N(this, t + 3, t + 4);
769
+ return this;
770
+ }, a.prototype.toString = function() {
771
+ const e = this.length;
772
+ return e === 0 ? "" : arguments.length === 0 ? Fe(this, 0, e) : T.apply(this, arguments);
773
+ }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(e) {
774
+ if (!a.isBuffer(e))
775
+ throw new TypeError("Argument must be a Buffer");
776
+ return this === e ? !0 : a.compare(this, e) === 0;
777
+ }, a.prototype.inspect = function() {
778
+ let e = "";
779
+ const t = s.INSPECT_MAX_BYTES;
780
+ return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), "<Buffer " + e + ">";
781
+ }, h && (a.prototype[h] = a.prototype.inspect), a.prototype.compare = function(e, t, n, c, u) {
782
+ if (D(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(e))
783
+ throw new TypeError(
784
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e
785
+ );
786
+ if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), c === void 0 && (c = 0), u === void 0 && (u = this.length), t < 0 || n > e.length || c < 0 || u > this.length)
787
+ throw new RangeError("out of range index");
788
+ if (c >= u && t >= n)
789
+ return 0;
790
+ if (c >= u)
791
+ return -1;
792
+ if (t >= n)
793
+ return 1;
794
+ if (t >>>= 0, n >>>= 0, c >>>= 0, u >>>= 0, this === e)
795
+ return 0;
796
+ let f = u - c, _ = n - t;
797
+ const F = Math.min(f, _), I = this.slice(c, u), S = e.slice(t, n);
798
+ for (let v = 0; v < F; ++v)
799
+ if (I[v] !== S[v]) {
800
+ f = I[v], _ = S[v];
801
+ break;
802
+ }
803
+ return f < _ ? -1 : _ < f ? 1 : 0;
804
+ };
805
+ function ve(i, e, t, n, c) {
806
+ if (i.length === 0)
807
+ return -1;
808
+ if (typeof t == "string" ? (n = t, t = 0) : t > 2147483647 ? t = 2147483647 : t < -2147483648 && (t = -2147483648), t = +t, he(t) && (t = c ? 0 : i.length - 1), t < 0 && (t = i.length + t), t >= i.length) {
809
+ if (c)
810
+ return -1;
811
+ t = i.length - 1;
812
+ } else if (t < 0)
813
+ if (c)
814
+ t = 0;
815
+ else
816
+ return -1;
817
+ if (typeof e == "string" && (e = a.from(e, n)), a.isBuffer(e))
818
+ return e.length === 0 ? -1 : Ie(i, e, t, n, c);
819
+ if (typeof e == "number")
820
+ return e = e & 255, typeof Uint8Array.prototype.indexOf == "function" ? c ? Uint8Array.prototype.indexOf.call(i, e, t) : Uint8Array.prototype.lastIndexOf.call(i, e, t) : Ie(i, [e], t, n, c);
821
+ throw new TypeError("val must be string, number or Buffer");
822
+ }
823
+ function Ie(i, e, t, n, c) {
824
+ let u = 1, f = i.length, _ = e.length;
825
+ if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
826
+ if (i.length < 2 || e.length < 2)
827
+ return -1;
828
+ u = 2, f /= 2, _ /= 2, t /= 2;
829
+ }
830
+ function F(S, v) {
831
+ return u === 1 ? S[v] : S.readUInt16BE(v * u);
832
+ }
833
+ let I;
834
+ if (c) {
835
+ let S = -1;
836
+ for (I = t; I < f; I++)
837
+ if (F(i, I) === F(e, S === -1 ? 0 : I - S)) {
838
+ if (S === -1 && (S = I), I - S + 1 === _)
839
+ return S * u;
840
+ } else
841
+ S !== -1 && (I -= I - S), S = -1;
842
+ } else
843
+ for (t + _ > f && (t = f - _), I = t; I >= 0; I--) {
844
+ let S = !0;
845
+ for (let v = 0; v < _; v++)
846
+ if (F(i, I + v) !== F(e, v)) {
847
+ S = !1;
848
+ break;
849
+ }
850
+ if (S)
851
+ return I;
852
+ }
853
+ return -1;
854
+ }
855
+ a.prototype.includes = function(e, t, n) {
856
+ return this.indexOf(e, t, n) !== -1;
857
+ }, a.prototype.indexOf = function(e, t, n) {
858
+ return ve(this, e, t, n, !0);
859
+ }, a.prototype.lastIndexOf = function(e, t, n) {
860
+ return ve(this, e, t, n, !1);
861
+ };
862
+ function Ye(i, e, t, n) {
863
+ t = Number(t) || 0;
864
+ const c = i.length - t;
865
+ n ? (n = Number(n), n > c && (n = c)) : n = c;
866
+ const u = e.length;
867
+ n > u / 2 && (n = u / 2);
868
+ let f;
869
+ for (f = 0; f < n; ++f) {
870
+ const _ = parseInt(e.substr(f * 2, 2), 16);
871
+ if (he(_))
872
+ return f;
873
+ i[t + f] = _;
874
+ }
875
+ return f;
876
+ }
877
+ function Xe(i, e, t, n) {
878
+ return ie(ce(e, i.length - t), i, t, n);
879
+ }
880
+ function Je(i, e, t, n) {
881
+ return ie(ht(e), i, t, n);
882
+ }
883
+ function Ke(i, e, t, n) {
884
+ return ie(De(e), i, t, n);
885
+ }
886
+ function Ze(i, e, t, n) {
887
+ return ie(ut(e, i.length - t), i, t, n);
888
+ }
889
+ a.prototype.write = function(e, t, n, c) {
890
+ if (t === void 0)
891
+ c = "utf8", n = this.length, t = 0;
892
+ else if (n === void 0 && typeof t == "string")
893
+ c = t, n = this.length, t = 0;
894
+ else if (isFinite(t))
895
+ t = t >>> 0, isFinite(n) ? (n = n >>> 0, c === void 0 && (c = "utf8")) : (c = n, n = void 0);
896
+ else
897
+ throw new Error(
898
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
899
+ );
900
+ const u = this.length - t;
901
+ if ((n === void 0 || n > u) && (n = u), e.length > 0 && (n < 0 || t < 0) || t > this.length)
902
+ throw new RangeError("Attempt to write outside buffer bounds");
903
+ c || (c = "utf8");
904
+ let f = !1;
905
+ for (; ; )
906
+ switch (c) {
907
+ case "hex":
908
+ return Ye(this, e, t, n);
909
+ case "utf8":
910
+ case "utf-8":
911
+ return Xe(this, e, t, n);
912
+ case "ascii":
913
+ case "latin1":
914
+ case "binary":
915
+ return Je(this, e, t, n);
916
+ case "base64":
917
+ return Ke(this, e, t, n);
918
+ case "ucs2":
919
+ case "ucs-2":
920
+ case "utf16le":
921
+ case "utf-16le":
922
+ return Ze(this, e, t, n);
923
+ default:
924
+ if (f)
925
+ throw new TypeError("Unknown encoding: " + c);
926
+ c = ("" + c).toLowerCase(), f = !0;
927
+ }
928
+ }, a.prototype.toJSON = function() {
929
+ return {
930
+ type: "Buffer",
931
+ data: Array.prototype.slice.call(this._arr || this, 0)
932
+ };
933
+ };
934
+ function et(i, e, t) {
935
+ return e === 0 && t === i.length ? r.fromByteArray(i) : r.fromByteArray(i.slice(e, t));
936
+ }
937
+ function Fe(i, e, t) {
938
+ t = Math.min(i.length, t);
939
+ const n = [];
940
+ let c = e;
941
+ for (; c < t; ) {
942
+ const u = i[c];
943
+ let f = null, _ = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
944
+ if (c + _ <= t) {
945
+ let F, I, S, v;
946
+ switch (_) {
947
+ case 1:
948
+ u < 128 && (f = u);
949
+ break;
950
+ case 2:
951
+ F = i[c + 1], (F & 192) === 128 && (v = (u & 31) << 6 | F & 63, v > 127 && (f = v));
952
+ break;
953
+ case 3:
954
+ F = i[c + 1], I = i[c + 2], (F & 192) === 128 && (I & 192) === 128 && (v = (u & 15) << 12 | (F & 63) << 6 | I & 63, v > 2047 && (v < 55296 || v > 57343) && (f = v));
955
+ break;
956
+ case 4:
957
+ F = i[c + 1], I = i[c + 2], S = i[c + 3], (F & 192) === 128 && (I & 192) === 128 && (S & 192) === 128 && (v = (u & 15) << 18 | (F & 63) << 12 | (I & 63) << 6 | S & 63, v > 65535 && v < 1114112 && (f = v));
958
+ }
959
+ }
960
+ f === null ? (f = 65533, _ = 1) : f > 65535 && (f -= 65536, n.push(f >>> 10 & 1023 | 55296), f = 56320 | f & 1023), n.push(f), c += _;
961
+ }
962
+ return tt(n);
963
+ }
964
+ const Se = 4096;
965
+ function tt(i) {
966
+ const e = i.length;
967
+ if (e <= Se)
968
+ return String.fromCharCode.apply(String, i);
969
+ let t = "", n = 0;
970
+ for (; n < e; )
971
+ t += String.fromCharCode.apply(
972
+ String,
973
+ i.slice(n, n += Se)
974
+ );
975
+ return t;
976
+ }
977
+ function it(i, e, t) {
978
+ let n = "";
979
+ t = Math.min(i.length, t);
980
+ for (let c = e; c < t; ++c)
981
+ n += String.fromCharCode(i[c] & 127);
982
+ return n;
983
+ }
984
+ function rt(i, e, t) {
985
+ let n = "";
986
+ t = Math.min(i.length, t);
987
+ for (let c = e; c < t; ++c)
988
+ n += String.fromCharCode(i[c]);
989
+ return n;
990
+ }
991
+ function nt(i, e, t) {
992
+ const n = i.length;
993
+ (!e || e < 0) && (e = 0), (!t || t < 0 || t > n) && (t = n);
994
+ let c = "";
995
+ for (let u = e; u < t; ++u)
996
+ c += lt[i[u]];
997
+ return c;
998
+ }
999
+ function ot(i, e, t) {
1000
+ const n = i.slice(e, t);
1001
+ let c = "";
1002
+ for (let u = 0; u < n.length - 1; u += 2)
1003
+ c += String.fromCharCode(n[u] + n[u + 1] * 256);
1004
+ return c;
1005
+ }
1006
+ a.prototype.slice = function(e, t) {
1007
+ const n = this.length;
1008
+ e = ~~e, t = t === void 0 ? n : ~~t, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), t < e && (t = e);
1009
+ const c = this.subarray(e, t);
1010
+ return Object.setPrototypeOf(c, a.prototype), c;
1011
+ };
1012
+ function C(i, e, t) {
1013
+ if (i % 1 !== 0 || i < 0)
1014
+ throw new RangeError("offset is not uint");
1015
+ if (i + e > t)
1016
+ throw new RangeError("Trying to access beyond buffer length");
1017
+ }
1018
+ a.prototype.readUintLE = a.prototype.readUIntLE = function(e, t, n) {
1019
+ e = e >>> 0, t = t >>> 0, n || C(e, t, this.length);
1020
+ let c = this[e], u = 1, f = 0;
1021
+ for (; ++f < t && (u *= 256); )
1022
+ c += this[e + f] * u;
1023
+ return c;
1024
+ }, a.prototype.readUintBE = a.prototype.readUIntBE = function(e, t, n) {
1025
+ e = e >>> 0, t = t >>> 0, n || C(e, t, this.length);
1026
+ let c = this[e + --t], u = 1;
1027
+ for (; t > 0 && (u *= 256); )
1028
+ c += this[e + --t] * u;
1029
+ return c;
1030
+ }, a.prototype.readUint8 = a.prototype.readUInt8 = function(e, t) {
1031
+ return e = e >>> 0, t || C(e, 1, this.length), this[e];
1032
+ }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(e, t) {
1033
+ return e = e >>> 0, t || C(e, 2, this.length), this[e] | this[e + 1] << 8;
1034
+ }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(e, t) {
1035
+ return e = e >>> 0, t || C(e, 2, this.length), this[e] << 8 | this[e + 1];
1036
+ }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(e, t) {
1037
+ return e = e >>> 0, t || C(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
1038
+ }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(e, t) {
1039
+ return e = e >>> 0, t || C(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
1040
+ }, a.prototype.readBigUInt64LE = P(function(e) {
1041
+ e = e >>> 0, H(e, "offset");
1042
+ const t = this[e], n = this[e + 7];
1043
+ (t === void 0 || n === void 0) && X(e, this.length - 8);
1044
+ const c = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, u = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
1045
+ return BigInt(c) + (BigInt(u) << BigInt(32));
1046
+ }), a.prototype.readBigUInt64BE = P(function(e) {
1047
+ e = e >>> 0, H(e, "offset");
1048
+ const t = this[e], n = this[e + 7];
1049
+ (t === void 0 || n === void 0) && X(e, this.length - 8);
1050
+ const c = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], u = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
1051
+ return (BigInt(c) << BigInt(32)) + BigInt(u);
1052
+ }), a.prototype.readIntLE = function(e, t, n) {
1053
+ e = e >>> 0, t = t >>> 0, n || C(e, t, this.length);
1054
+ let c = this[e], u = 1, f = 0;
1055
+ for (; ++f < t && (u *= 256); )
1056
+ c += this[e + f] * u;
1057
+ return u *= 128, c >= u && (c -= Math.pow(2, 8 * t)), c;
1058
+ }, a.prototype.readIntBE = function(e, t, n) {
1059
+ e = e >>> 0, t = t >>> 0, n || C(e, t, this.length);
1060
+ let c = t, u = 1, f = this[e + --c];
1061
+ for (; c > 0 && (u *= 256); )
1062
+ f += this[e + --c] * u;
1063
+ return u *= 128, f >= u && (f -= Math.pow(2, 8 * t)), f;
1064
+ }, a.prototype.readInt8 = function(e, t) {
1065
+ return e = e >>> 0, t || C(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
1066
+ }, a.prototype.readInt16LE = function(e, t) {
1067
+ e = e >>> 0, t || C(e, 2, this.length);
1068
+ const n = this[e] | this[e + 1] << 8;
1069
+ return n & 32768 ? n | 4294901760 : n;
1070
+ }, a.prototype.readInt16BE = function(e, t) {
1071
+ e = e >>> 0, t || C(e, 2, this.length);
1072
+ const n = this[e + 1] | this[e] << 8;
1073
+ return n & 32768 ? n | 4294901760 : n;
1074
+ }, a.prototype.readInt32LE = function(e, t) {
1075
+ return e = e >>> 0, t || C(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
1076
+ }, a.prototype.readInt32BE = function(e, t) {
1077
+ return e = e >>> 0, t || C(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
1078
+ }, a.prototype.readBigInt64LE = P(function(e) {
1079
+ e = e >>> 0, H(e, "offset");
1080
+ const t = this[e], n = this[e + 7];
1081
+ (t === void 0 || n === void 0) && X(e, this.length - 8);
1082
+ const c = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
1083
+ return (BigInt(c) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
1084
+ }), a.prototype.readBigInt64BE = P(function(e) {
1085
+ e = e >>> 0, H(e, "offset");
1086
+ const t = this[e], n = this[e + 7];
1087
+ (t === void 0 || n === void 0) && X(e, this.length - 8);
1088
+ const c = (t << 24) + // Overflow
1089
+ this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
1090
+ return (BigInt(c) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
1091
+ }), a.prototype.readFloatLE = function(e, t) {
1092
+ return e = e >>> 0, t || C(e, 4, this.length), o.read(this, e, !0, 23, 4);
1093
+ }, a.prototype.readFloatBE = function(e, t) {
1094
+ return e = e >>> 0, t || C(e, 4, this.length), o.read(this, e, !1, 23, 4);
1095
+ }, a.prototype.readDoubleLE = function(e, t) {
1096
+ return e = e >>> 0, t || C(e, 8, this.length), o.read(this, e, !0, 52, 8);
1097
+ }, a.prototype.readDoubleBE = function(e, t) {
1098
+ return e = e >>> 0, t || C(e, 8, this.length), o.read(this, e, !1, 52, 8);
1099
+ };
1100
+ function $(i, e, t, n, c, u) {
1101
+ if (!a.isBuffer(i))
1102
+ throw new TypeError('"buffer" argument must be a Buffer instance');
1103
+ if (e > c || e < u)
1104
+ throw new RangeError('"value" argument is out of bounds');
1105
+ if (t + n > i.length)
1106
+ throw new RangeError("Index out of range");
1107
+ }
1108
+ a.prototype.writeUintLE = a.prototype.writeUIntLE = function(e, t, n, c) {
1109
+ if (e = +e, t = t >>> 0, n = n >>> 0, !c) {
1110
+ const _ = Math.pow(2, 8 * n) - 1;
1111
+ $(this, e, t, n, _, 0);
1112
+ }
1113
+ let u = 1, f = 0;
1114
+ for (this[t] = e & 255; ++f < n && (u *= 256); )
1115
+ this[t + f] = e / u & 255;
1116
+ return t + n;
1117
+ }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(e, t, n, c) {
1118
+ if (e = +e, t = t >>> 0, n = n >>> 0, !c) {
1119
+ const _ = Math.pow(2, 8 * n) - 1;
1120
+ $(this, e, t, n, _, 0);
1121
+ }
1122
+ let u = n - 1, f = 1;
1123
+ for (this[t + u] = e & 255; --u >= 0 && (f *= 256); )
1124
+ this[t + u] = e / f & 255;
1125
+ return t + n;
1126
+ }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(e, t, n) {
1127
+ return e = +e, t = t >>> 0, n || $(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
1128
+ }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(e, t, n) {
1129
+ return e = +e, t = t >>> 0, n || $(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
1130
+ }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(e, t, n) {
1131
+ return e = +e, t = t >>> 0, n || $(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
1132
+ }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(e, t, n) {
1133
+ return e = +e, t = t >>> 0, n || $(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
1134
+ }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(e, t, n) {
1135
+ return e = +e, t = t >>> 0, n || $(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
1136
+ };
1137
+ function Ce(i, e, t, n, c) {
1138
+ Te(e, n, c, i, t, 7);
1139
+ let u = Number(e & BigInt(4294967295));
1140
+ i[t++] = u, u = u >> 8, i[t++] = u, u = u >> 8, i[t++] = u, u = u >> 8, i[t++] = u;
1141
+ let f = Number(e >> BigInt(32) & BigInt(4294967295));
1142
+ return i[t++] = f, f = f >> 8, i[t++] = f, f = f >> 8, i[t++] = f, f = f >> 8, i[t++] = f, t;
1143
+ }
1144
+ function Re(i, e, t, n, c) {
1145
+ Te(e, n, c, i, t, 7);
1146
+ let u = Number(e & BigInt(4294967295));
1147
+ i[t + 7] = u, u = u >> 8, i[t + 6] = u, u = u >> 8, i[t + 5] = u, u = u >> 8, i[t + 4] = u;
1148
+ let f = Number(e >> BigInt(32) & BigInt(4294967295));
1149
+ return i[t + 3] = f, f = f >> 8, i[t + 2] = f, f = f >> 8, i[t + 1] = f, f = f >> 8, i[t] = f, t + 8;
1150
+ }
1151
+ a.prototype.writeBigUInt64LE = P(function(e, t = 0) {
1152
+ return Ce(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
1153
+ }), a.prototype.writeBigUInt64BE = P(function(e, t = 0) {
1154
+ return Re(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
1155
+ }), a.prototype.writeIntLE = function(e, t, n, c) {
1156
+ if (e = +e, t = t >>> 0, !c) {
1157
+ const F = Math.pow(2, 8 * n - 1);
1158
+ $(this, e, t, n, F - 1, -F);
1159
+ }
1160
+ let u = 0, f = 1, _ = 0;
1161
+ for (this[t] = e & 255; ++u < n && (f *= 256); )
1162
+ e < 0 && _ === 0 && this[t + u - 1] !== 0 && (_ = 1), this[t + u] = (e / f >> 0) - _ & 255;
1163
+ return t + n;
1164
+ }, a.prototype.writeIntBE = function(e, t, n, c) {
1165
+ if (e = +e, t = t >>> 0, !c) {
1166
+ const F = Math.pow(2, 8 * n - 1);
1167
+ $(this, e, t, n, F - 1, -F);
1168
+ }
1169
+ let u = n - 1, f = 1, _ = 0;
1170
+ for (this[t + u] = e & 255; --u >= 0 && (f *= 256); )
1171
+ e < 0 && _ === 0 && this[t + u + 1] !== 0 && (_ = 1), this[t + u] = (e / f >> 0) - _ & 255;
1172
+ return t + n;
1173
+ }, a.prototype.writeInt8 = function(e, t, n) {
1174
+ return e = +e, t = t >>> 0, n || $(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
1175
+ }, a.prototype.writeInt16LE = function(e, t, n) {
1176
+ return e = +e, t = t >>> 0, n || $(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
1177
+ }, a.prototype.writeInt16BE = function(e, t, n) {
1178
+ return e = +e, t = t >>> 0, n || $(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
1179
+ }, a.prototype.writeInt32LE = function(e, t, n) {
1180
+ return e = +e, t = t >>> 0, n || $(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
1181
+ }, a.prototype.writeInt32BE = function(e, t, n) {
1182
+ return e = +e, t = t >>> 0, n || $(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
1183
+ }, a.prototype.writeBigInt64LE = P(function(e, t = 0) {
1184
+ return Ce(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1185
+ }), a.prototype.writeBigInt64BE = P(function(e, t = 0) {
1186
+ return Re(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1187
+ });
1188
+ function $e(i, e, t, n, c, u) {
1189
+ if (t + n > i.length)
1190
+ throw new RangeError("Index out of range");
1191
+ if (t < 0)
1192
+ throw new RangeError("Index out of range");
1193
+ }
1194
+ function Ae(i, e, t, n, c) {
1195
+ return e = +e, t = t >>> 0, c || $e(i, e, t, 4), o.write(i, e, t, n, 23, 4), t + 4;
1196
+ }
1197
+ a.prototype.writeFloatLE = function(e, t, n) {
1198
+ return Ae(this, e, t, !0, n);
1199
+ }, a.prototype.writeFloatBE = function(e, t, n) {
1200
+ return Ae(this, e, t, !1, n);
1201
+ };
1202
+ function Ue(i, e, t, n, c) {
1203
+ return e = +e, t = t >>> 0, c || $e(i, e, t, 8), o.write(i, e, t, n, 52, 8), t + 8;
1204
+ }
1205
+ a.prototype.writeDoubleLE = function(e, t, n) {
1206
+ return Ue(this, e, t, !0, n);
1207
+ }, a.prototype.writeDoubleBE = function(e, t, n) {
1208
+ return Ue(this, e, t, !1, n);
1209
+ }, a.prototype.copy = function(e, t, n, c) {
1210
+ if (!a.isBuffer(e))
1211
+ throw new TypeError("argument should be a Buffer");
1212
+ if (n || (n = 0), !c && c !== 0 && (c = this.length), t >= e.length && (t = e.length), t || (t = 0), c > 0 && c < n && (c = n), c === n || e.length === 0 || this.length === 0)
1213
+ return 0;
1214
+ if (t < 0)
1215
+ throw new RangeError("targetStart out of bounds");
1216
+ if (n < 0 || n >= this.length)
1217
+ throw new RangeError("Index out of range");
1218
+ if (c < 0)
1219
+ throw new RangeError("sourceEnd out of bounds");
1220
+ c > this.length && (c = this.length), e.length - t < c - n && (c = e.length - t + n);
1221
+ const u = c - n;
1222
+ return this === e && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(t, n, c) : Uint8Array.prototype.set.call(
1223
+ e,
1224
+ this.subarray(n, c),
1225
+ t
1226
+ ), u;
1227
+ }, a.prototype.fill = function(e, t, n, c) {
1228
+ if (typeof e == "string") {
1229
+ if (typeof t == "string" ? (c = t, t = 0, n = this.length) : typeof n == "string" && (c = n, n = this.length), c !== void 0 && typeof c != "string")
1230
+ throw new TypeError("encoding must be a string");
1231
+ if (typeof c == "string" && !a.isEncoding(c))
1232
+ throw new TypeError("Unknown encoding: " + c);
1233
+ if (e.length === 1) {
1234
+ const f = e.charCodeAt(0);
1235
+ (c === "utf8" && f < 128 || c === "latin1") && (e = f);
1236
+ }
1237
+ } else
1238
+ typeof e == "number" ? e = e & 255 : typeof e == "boolean" && (e = Number(e));
1239
+ if (t < 0 || this.length < t || this.length < n)
1240
+ throw new RangeError("Out of range index");
1241
+ if (n <= t)
1242
+ return this;
1243
+ t = t >>> 0, n = n === void 0 ? this.length : n >>> 0, e || (e = 0);
1244
+ let u;
1245
+ if (typeof e == "number")
1246
+ for (u = t; u < n; ++u)
1247
+ this[u] = e;
1248
+ else {
1249
+ const f = a.isBuffer(e) ? e : a.from(e, c), _ = f.length;
1250
+ if (_ === 0)
1251
+ throw new TypeError('The value "' + e + '" is invalid for argument "value"');
1252
+ for (u = 0; u < n - t; ++u)
1253
+ this[u + t] = f[u % _];
1254
+ }
1255
+ return this;
1256
+ };
1257
+ const j = {};
1258
+ function ae(i, e, t) {
1259
+ j[i] = class extends t {
1260
+ constructor() {
1261
+ super(), Object.defineProperty(this, "message", {
1262
+ value: e.apply(this, arguments),
1263
+ writable: !0,
1264
+ configurable: !0
1265
+ }), this.name = `${this.name} [${i}]`, this.stack, delete this.name;
1266
+ }
1267
+ get code() {
1268
+ return i;
1269
+ }
1270
+ set code(c) {
1271
+ Object.defineProperty(this, "code", {
1272
+ configurable: !0,
1273
+ enumerable: !0,
1274
+ value: c,
1275
+ writable: !0
1276
+ });
1277
+ }
1278
+ toString() {
1279
+ return `${this.name} [${i}]: ${this.message}`;
1280
+ }
1281
+ };
1282
+ }
1283
+ ae(
1284
+ "ERR_BUFFER_OUT_OF_BOUNDS",
1285
+ function(i) {
1286
+ return i ? `${i} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
1287
+ },
1288
+ RangeError
1289
+ ), ae(
1290
+ "ERR_INVALID_ARG_TYPE",
1291
+ function(i, e) {
1292
+ return `The "${i}" argument must be of type number. Received type ${typeof e}`;
1293
+ },
1294
+ TypeError
1295
+ ), ae(
1296
+ "ERR_OUT_OF_RANGE",
1297
+ function(i, e, t) {
1298
+ let n = `The value of "${i}" is out of range.`, c = t;
1299
+ return Number.isInteger(t) && Math.abs(t) > 2 ** 32 ? c = Oe(String(t)) : typeof t == "bigint" && (c = String(t), (t > BigInt(2) ** BigInt(32) || t < -(BigInt(2) ** BigInt(32))) && (c = Oe(c)), c += "n"), n += ` It must be ${e}. Received ${c}`, n;
1300
+ },
1301
+ RangeError
1302
+ );
1303
+ function Oe(i) {
1304
+ let e = "", t = i.length;
1305
+ const n = i[0] === "-" ? 1 : 0;
1306
+ for (; t >= n + 4; t -= 3)
1307
+ e = `_${i.slice(t - 3, t)}${e}`;
1308
+ return `${i.slice(0, t)}${e}`;
1309
+ }
1310
+ function st(i, e, t) {
1311
+ H(e, "offset"), (i[e] === void 0 || i[e + t] === void 0) && X(e, i.length - (t + 1));
1312
+ }
1313
+ function Te(i, e, t, n, c, u) {
1314
+ if (i > t || i < e) {
1315
+ const f = typeof e == "bigint" ? "n" : "";
1316
+ let _;
1317
+ throw e === 0 || e === BigInt(0) ? _ = `>= 0${f} and < 2${f} ** ${(u + 1) * 8}${f}` : _ = `>= -(2${f} ** ${(u + 1) * 8 - 1}${f}) and < 2 ** ${(u + 1) * 8 - 1}${f}`, new j.ERR_OUT_OF_RANGE("value", _, i);
1318
+ }
1319
+ st(n, c, u);
1320
+ }
1321
+ function H(i, e) {
1322
+ if (typeof i != "number")
1323
+ throw new j.ERR_INVALID_ARG_TYPE(e, "number", i);
1324
+ }
1325
+ function X(i, e, t) {
1326
+ throw Math.floor(i) !== i ? (H(i, t), new j.ERR_OUT_OF_RANGE("offset", "an integer", i)) : e < 0 ? new j.ERR_BUFFER_OUT_OF_BOUNDS() : new j.ERR_OUT_OF_RANGE(
1327
+ "offset",
1328
+ `>= 0 and <= ${e}`,
1329
+ i
1330
+ );
1331
+ }
1332
+ const at = /[^+/0-9A-Za-z-_]/g;
1333
+ function ct(i) {
1334
+ if (i = i.split("=")[0], i = i.trim().replace(at, ""), i.length < 2)
1335
+ return "";
1336
+ for (; i.length % 4 !== 0; )
1337
+ i = i + "=";
1338
+ return i;
1339
+ }
1340
+ function ce(i, e) {
1341
+ e = e || 1 / 0;
1342
+ let t;
1343
+ const n = i.length;
1344
+ let c = null;
1345
+ const u = [];
1346
+ for (let f = 0; f < n; ++f) {
1347
+ if (t = i.charCodeAt(f), t > 55295 && t < 57344) {
1348
+ if (!c) {
1349
+ if (t > 56319) {
1350
+ (e -= 3) > -1 && u.push(239, 191, 189);
1351
+ continue;
1352
+ } else if (f + 1 === n) {
1353
+ (e -= 3) > -1 && u.push(239, 191, 189);
1354
+ continue;
1355
+ }
1356
+ c = t;
1357
+ continue;
1358
+ }
1359
+ if (t < 56320) {
1360
+ (e -= 3) > -1 && u.push(239, 191, 189), c = t;
1361
+ continue;
1362
+ }
1363
+ t = (c - 55296 << 10 | t - 56320) + 65536;
1364
+ } else
1365
+ c && (e -= 3) > -1 && u.push(239, 191, 189);
1366
+ if (c = null, t < 128) {
1367
+ if ((e -= 1) < 0)
1368
+ break;
1369
+ u.push(t);
1370
+ } else if (t < 2048) {
1371
+ if ((e -= 2) < 0)
1372
+ break;
1373
+ u.push(
1374
+ t >> 6 | 192,
1375
+ t & 63 | 128
1376
+ );
1377
+ } else if (t < 65536) {
1378
+ if ((e -= 3) < 0)
1379
+ break;
1380
+ u.push(
1381
+ t >> 12 | 224,
1382
+ t >> 6 & 63 | 128,
1383
+ t & 63 | 128
1384
+ );
1385
+ } else if (t < 1114112) {
1386
+ if ((e -= 4) < 0)
1387
+ break;
1388
+ u.push(
1389
+ t >> 18 | 240,
1390
+ t >> 12 & 63 | 128,
1391
+ t >> 6 & 63 | 128,
1392
+ t & 63 | 128
1393
+ );
1394
+ } else
1395
+ throw new Error("Invalid code point");
1396
+ }
1397
+ return u;
1398
+ }
1399
+ function ht(i) {
1400
+ const e = [];
1401
+ for (let t = 0; t < i.length; ++t)
1402
+ e.push(i.charCodeAt(t) & 255);
1403
+ return e;
1404
+ }
1405
+ function ut(i, e) {
1406
+ let t, n, c;
1407
+ const u = [];
1408
+ for (let f = 0; f < i.length && !((e -= 2) < 0); ++f)
1409
+ t = i.charCodeAt(f), n = t >> 8, c = t % 256, u.push(c), u.push(n);
1410
+ return u;
1411
+ }
1412
+ function De(i) {
1413
+ return r.toByteArray(ct(i));
1414
+ }
1415
+ function ie(i, e, t, n) {
1416
+ let c;
1417
+ for (c = 0; c < n && !(c + t >= e.length || c >= i.length); ++c)
1418
+ e[c + t] = i[c];
1419
+ return c;
1420
+ }
1421
+ function D(i, e) {
1422
+ return i instanceof e || i != null && i.constructor != null && i.constructor.name != null && i.constructor.name === e.name;
1423
+ }
1424
+ function he(i) {
1425
+ return i !== i;
1426
+ }
1427
+ const lt = function() {
1428
+ const i = "0123456789abcdef", e = new Array(256);
1429
+ for (let t = 0; t < 16; ++t) {
1430
+ const n = t * 16;
1431
+ for (let c = 0; c < 16; ++c)
1432
+ e[n + c] = i[t] + i[c];
1433
+ }
1434
+ return e;
1435
+ }();
1436
+ function P(i) {
1437
+ return typeof BigInt > "u" ? ft : i;
1438
+ }
1439
+ function ft() {
1440
+ throw new Error("BigInt not supported");
1441
+ }
1442
+ })(me);
1443
+ const Yt = (s) => {
1444
+ const r = me.Buffer.from(s, "base64").toString("utf8"), o = me.Buffer.from(r, "binary").toString("base64");
1445
+ return s === o ? r : s;
1446
+ }, Xt = async (s) => {
1447
+ const r = Yt(s), o = JSON.parse(r);
1448
+ return {
1449
+ message: r,
1450
+ ...o
1451
+ };
1452
+ };
1453
+ class x {
1454
+ constructor(r, o, h, l, d) {
1455
+ this._legacyCanvasSize = x.DEFAULT_CANVAS_SIZE, this._preferredCamera = "environment", this._maxScansPerSecond = 25, this._lastScanTimestamp = -1, this._destroyed = this._flashOn = this._paused = this._active = !1, this.$video = r, this.$canvas = document.createElement("canvas"), h && typeof h == "object" ? this._onDecode = o : (console.warn(h || l || d ? "You're using a deprecated version of the QrScanner constructor which will be removed in the future" : "Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."), this._legacyOnDecode = o), o = typeof h == "object" ? h : {}, this._onDecodeError = o.onDecodeError || (typeof h == "function" ? h : this._onDecodeError), this._calculateScanRegion = o.calculateScanRegion || (typeof l == "function" ? l : this._calculateScanRegion), this._preferredCamera = o.preferredCamera || d || this._preferredCamera, this._legacyCanvasSize = typeof h == "number" ? h : typeof l == "number" ? l : this._legacyCanvasSize, this._maxScansPerSecond = o.maxScansPerSecond || this._maxScansPerSecond, this._onPlay = this._onPlay.bind(this), this._onLoadedMetaData = this._onLoadedMetaData.bind(this), this._onVisibilityChange = this._onVisibilityChange.bind(this), this._updateOverlay = this._updateOverlay.bind(this), r.disablePictureInPicture = !0, r.playsInline = !0, r.muted = !0;
1456
+ let p = !1;
1457
+ if (r.hidden && (r.hidden = !1, p = !0), document.body.contains(r) || (document.body.appendChild(r), p = !0), h = r.parentElement, o.highlightScanRegion || o.highlightCodeOutline) {
1458
+ if (l = !!o.overlay, this.$overlay = o.overlay || document.createElement("div"), d = this.$overlay.style, d.position = "absolute", d.display = "none", d.pointerEvents = "none", this.$overlay.classList.add("scan-region-highlight"), !l && o.highlightScanRegion) {
1459
+ this.$overlay.innerHTML = '<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';
1460
+ try {
1461
+ this.$overlay.firstElementChild.animate({ transform: [
1462
+ "scale(.98)",
1463
+ "scale(1.01)"
1464
+ ] }, { duration: 400, iterations: 1 / 0, direction: "alternate", easing: "ease-in-out" });
1465
+ } catch {
1466
+ }
1467
+ h.insertBefore(this.$overlay, this.$video.nextSibling);
1468
+ }
1469
+ o.highlightCodeOutline && (this.$overlay.insertAdjacentHTML("beforeend", '<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'), this.$codeOutlineHighlight = this.$overlay.lastElementChild);
1470
+ }
1471
+ this._scanRegion = this._calculateScanRegion(r), requestAnimationFrame(() => {
1472
+ let a = window.getComputedStyle(r);
1473
+ a.display === "none" && (r.style.setProperty("display", "block", "important"), p = !0), a.visibility !== "visible" && (r.style.setProperty("visibility", "visible", "important"), p = !0), p && (console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."), r.style.opacity = "0", r.style.width = "0", r.style.height = "0", this.$overlay && this.$overlay.parentElement && this.$overlay.parentElement.removeChild(this.$overlay), delete this.$overlay, delete this.$codeOutlineHighlight), this.$overlay && this._updateOverlay();
1474
+ }), r.addEventListener("play", this._onPlay), r.addEventListener("loadedmetadata", this._onLoadedMetaData), document.addEventListener("visibilitychange", this._onVisibilityChange), window.addEventListener("resize", this._updateOverlay), this._qrEnginePromise = x.createQrEngine();
1475
+ }
1476
+ static set WORKER_PATH(r) {
1477
+ console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.");
1478
+ }
1479
+ static async hasCamera() {
1480
+ try {
1481
+ return !!(await x.listCameras(!1)).length;
1482
+ } catch {
1483
+ return !1;
1484
+ }
1485
+ }
1486
+ static async listCameras(r = !1) {
1487
+ if (!navigator.mediaDevices)
1488
+ return [];
1489
+ let o = async () => (await navigator.mediaDevices.enumerateDevices()).filter((l) => l.kind === "videoinput"), h;
1490
+ try {
1491
+ r && (await o()).every((l) => !l.label) && (h = await navigator.mediaDevices.getUserMedia({ audio: !1, video: !0 }));
1492
+ } catch {
1493
+ }
1494
+ try {
1495
+ return (await o()).map((l, d) => ({ id: l.deviceId, label: l.label || (d === 0 ? "Default Camera" : `Camera ${d + 1}`) }));
1496
+ } finally {
1497
+ h && (console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"), x._stopVideoStream(h));
1498
+ }
1499
+ }
1500
+ async hasFlash() {
1501
+ let r;
1502
+ try {
1503
+ if (this.$video.srcObject) {
1504
+ if (!(this.$video.srcObject instanceof MediaStream))
1505
+ return !1;
1506
+ r = this.$video.srcObject;
1507
+ } else
1508
+ r = (await this._getCameraStream()).stream;
1509
+ return "torch" in r.getVideoTracks()[0].getSettings();
1510
+ } catch {
1511
+ return !1;
1512
+ } finally {
1513
+ r && r !== this.$video.srcObject && (console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"), x._stopVideoStream(r));
1514
+ }
1515
+ }
1516
+ isFlashOn() {
1517
+ return this._flashOn;
1518
+ }
1519
+ async toggleFlash() {
1520
+ this._flashOn ? await this.turnFlashOff() : await this.turnFlashOn();
1521
+ }
1522
+ async turnFlashOn() {
1523
+ if (!this._flashOn && !this._destroyed && (this._flashOn = !0, this._active && !this._paused))
1524
+ try {
1525
+ if (!await this.hasFlash())
1526
+ throw "No flash available";
1527
+ await this.$video.srcObject.getVideoTracks()[0].applyConstraints({ advanced: [{ torch: !0 }] });
1528
+ } catch (r) {
1529
+ throw this._flashOn = !1, r;
1530
+ }
1531
+ }
1532
+ async turnFlashOff() {
1533
+ this._flashOn && (this._flashOn = !1, await this._restartVideoStream());
1534
+ }
1535
+ destroy() {
1536
+ this.$video.removeEventListener("loadedmetadata", this._onLoadedMetaData), this.$video.removeEventListener("play", this._onPlay), document.removeEventListener(
1537
+ "visibilitychange",
1538
+ this._onVisibilityChange
1539
+ ), window.removeEventListener("resize", this._updateOverlay), this._destroyed = !0, this._flashOn = !1, this.stop(), x._postWorkerMessage(this._qrEnginePromise, "close");
1540
+ }
1541
+ async start() {
1542
+ if (this._destroyed)
1543
+ throw Error("The QR scanner can not be started as it had been destroyed.");
1544
+ if ((!this._active || this._paused) && (window.location.protocol !== "https:" && console.warn("The camera stream is only accessible if the page is transferred via https."), this._active = !0, !document.hidden))
1545
+ if (this._paused = !1, this.$video.srcObject)
1546
+ await this.$video.play();
1547
+ else
1548
+ try {
1549
+ let { stream: r, facingMode: o } = await this._getCameraStream();
1550
+ !this._active || this._paused ? x._stopVideoStream(r) : (this._setVideoMirror(o), this.$video.srcObject = r, await this.$video.play(), this._flashOn && (this._flashOn = !1, this.turnFlashOn().catch(() => {
1551
+ })));
1552
+ } catch (r) {
1553
+ if (!this._paused)
1554
+ throw this._active = !1, r;
1555
+ }
1556
+ }
1557
+ stop() {
1558
+ this.pause(), this._active = !1;
1559
+ }
1560
+ async pause(r = !1) {
1561
+ if (this._paused = !0, !this._active)
1562
+ return !0;
1563
+ this.$video.pause(), this.$overlay && (this.$overlay.style.display = "none");
1564
+ let o = () => {
1565
+ this.$video.srcObject instanceof MediaStream && (x._stopVideoStream(this.$video.srcObject), this.$video.srcObject = null);
1566
+ };
1567
+ return r ? (o(), !0) : (await new Promise((h) => setTimeout(h, 300)), this._paused ? (o(), !0) : !1);
1568
+ }
1569
+ async setCamera(r) {
1570
+ r !== this._preferredCamera && (this._preferredCamera = r, await this._restartVideoStream());
1571
+ }
1572
+ static async scanImage(r, o, h, l, d = !1, p = !1) {
1573
+ let a, y = !1;
1574
+ o && ("scanRegion" in o || "qrEngine" in o || "canvas" in o || "disallowCanvasResizing" in o || "alsoTryWithoutScanRegion" in o || "returnDetailedScanResult" in o) ? (a = o.scanRegion, h = o.qrEngine, l = o.canvas, d = o.disallowCanvasResizing || !1, p = o.alsoTryWithoutScanRegion || !1, y = !0) : console.warn(o || h || l || d || p ? "You're using a deprecated api for scanImage which will be removed in the future." : "Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."), o = !!h;
1575
+ try {
1576
+ let g, m;
1577
+ [h, g] = await Promise.all([h || x.createQrEngine(), x._loadImage(r)]), [l, m] = x._drawToCanvas(g, a, l, d);
1578
+ let E;
1579
+ if (h instanceof Worker) {
1580
+ let w = h;
1581
+ o || x._postWorkerMessageSync(w, "inversionMode", "both"), E = await new Promise((B, R) => {
1582
+ let O, b, A, W = -1;
1583
+ b = (T) => {
1584
+ T.data.id === W && (w.removeEventListener("message", b), w.removeEventListener("error", A), clearTimeout(O), T.data.data !== null ? B({ data: T.data.data, cornerPoints: x._convertPoints(T.data.cornerPoints, a) }) : R(x.NO_QR_CODE_FOUND));
1585
+ }, A = (T) => {
1586
+ w.removeEventListener("message", b), w.removeEventListener("error", A), clearTimeout(O), R("Scanner error: " + (T ? T.message || T : "Unknown Error"));
1587
+ }, w.addEventListener("message", b), w.addEventListener("error", A), O = setTimeout(() => A("timeout"), 1e4);
1588
+ let k = m.getImageData(0, 0, l.width, l.height);
1589
+ W = x._postWorkerMessageSync(w, "decode", k, [k.data.buffer]);
1590
+ });
1591
+ } else
1592
+ E = await Promise.race([new Promise((w, B) => window.setTimeout(() => B("Scanner error: timeout"), 1e4)), (async () => {
1593
+ try {
1594
+ var [w] = await h.detect(l);
1595
+ if (!w)
1596
+ throw x.NO_QR_CODE_FOUND;
1597
+ return { data: w.rawValue, cornerPoints: x._convertPoints(w.cornerPoints, a) };
1598
+ } catch (B) {
1599
+ if (w = B.message || B, /not implemented|service unavailable/.test(w))
1600
+ return x._disableBarcodeDetector = !0, x.scanImage(r, { scanRegion: a, canvas: l, disallowCanvasResizing: d, alsoTryWithoutScanRegion: p });
1601
+ throw `Scanner error: ${w}`;
1602
+ }
1603
+ })()]);
1604
+ return y ? E : E.data;
1605
+ } catch (g) {
1606
+ if (!a || !p)
1607
+ throw g;
1608
+ let m = await x.scanImage(r, { qrEngine: h, canvas: l, disallowCanvasResizing: d });
1609
+ return y ? m : m.data;
1610
+ } finally {
1611
+ o || x._postWorkerMessage(h, "close");
1612
+ }
1613
+ }
1614
+ setGrayscaleWeights(r, o, h, l = !0) {
1615
+ x._postWorkerMessage(this._qrEnginePromise, "grayscaleWeights", {
1616
+ red: r,
1617
+ green: o,
1618
+ blue: h,
1619
+ useIntegerApproximation: l
1620
+ });
1621
+ }
1622
+ setInversionMode(r) {
1623
+ x._postWorkerMessage(this._qrEnginePromise, "inversionMode", r);
1624
+ }
1625
+ static async createQrEngine(r) {
1626
+ if (r && console.warn("Specifying a worker path is not required and not supported anymore."), r = () => import("./qr-scanner-worker.min-DpjUkzFK.js").then((h) => h.createWorker()), !(!x._disableBarcodeDetector && "BarcodeDetector" in window && BarcodeDetector.getSupportedFormats && (await BarcodeDetector.getSupportedFormats()).includes("qr_code")))
1627
+ return r();
1628
+ let o = navigator.userAgentData;
1629
+ return o && o.brands.some(({ brand: h }) => /Chromium/i.test(h)) && /mac ?OS/i.test(o.platform) && await o.getHighEntropyValues(["architecture", "platformVersion"]).then(({ architecture: h, platformVersion: l }) => /arm/i.test(h || "arm") && 13 <= parseInt(l || "13")).catch(() => !0) ? r() : new BarcodeDetector({ formats: ["qr_code"] });
1630
+ }
1631
+ _onPlay() {
1632
+ this._scanRegion = this._calculateScanRegion(this.$video), this._updateOverlay(), this.$overlay && (this.$overlay.style.display = ""), this._scanFrame();
1633
+ }
1634
+ _onLoadedMetaData() {
1635
+ this._scanRegion = this._calculateScanRegion(this.$video), this._updateOverlay();
1636
+ }
1637
+ _onVisibilityChange() {
1638
+ document.hidden ? this.pause() : this._active && this.start();
1639
+ }
1640
+ _calculateScanRegion(r) {
1641
+ let o = Math.round(0.6666666666666666 * Math.min(r.videoWidth, r.videoHeight));
1642
+ return { x: Math.round((r.videoWidth - o) / 2), y: Math.round((r.videoHeight - o) / 2), width: o, height: o, downScaledWidth: this._legacyCanvasSize, downScaledHeight: this._legacyCanvasSize };
1643
+ }
1644
+ _updateOverlay() {
1645
+ requestAnimationFrame(() => {
1646
+ if (this.$overlay) {
1647
+ var r = this.$video, o = r.videoWidth, h = r.videoHeight, l = r.offsetWidth, d = r.offsetHeight, p = r.offsetLeft, a = r.offsetTop, y = window.getComputedStyle(r), g = y.objectFit, m = o / h, E = l / d;
1648
+ switch (g) {
1649
+ case "none":
1650
+ var w = o, B = h;
1651
+ break;
1652
+ case "fill":
1653
+ w = l, B = d;
1654
+ break;
1655
+ default:
1656
+ (g === "cover" ? m > E : m < E) ? (B = d, w = B * m) : (w = l, B = w / m), g === "scale-down" && (w = Math.min(w, o), B = Math.min(B, h));
1657
+ }
1658
+ var [R, O] = y.objectPosition.split(" ").map((A, W) => {
1659
+ const k = parseFloat(A);
1660
+ return A.endsWith("%") ? (W ? d - B : l - w) * k / 100 : k;
1661
+ });
1662
+ y = this._scanRegion.width || o, E = this._scanRegion.height || h, g = this._scanRegion.x || 0;
1663
+ var b = this._scanRegion.y || 0;
1664
+ m = this.$overlay.style, m.width = `${y / o * w}px`, m.height = `${E / h * B}px`, m.top = `${a + O + b / h * B}px`, h = /scaleX\(-1\)/.test(r.style.transform), m.left = `${p + (h ? l - R - w : R) + (h ? o - g - y : g) / o * w}px`, m.transform = r.style.transform;
1665
+ }
1666
+ });
1667
+ }
1668
+ static _convertPoints(r, o) {
1669
+ if (!o)
1670
+ return r;
1671
+ let h = o.x || 0, l = o.y || 0, d = o.width && o.downScaledWidth ? o.width / o.downScaledWidth : 1;
1672
+ o = o.height && o.downScaledHeight ? o.height / o.downScaledHeight : 1;
1673
+ for (let p of r)
1674
+ p.x = p.x * d + h, p.y = p.y * o + l;
1675
+ return r;
1676
+ }
1677
+ _scanFrame() {
1678
+ !this._active || this.$video.paused || this.$video.ended || ("requestVideoFrameCallback" in this.$video ? this.$video.requestVideoFrameCallback.bind(this.$video) : requestAnimationFrame)(async () => {
1679
+ if (!(1 >= this.$video.readyState)) {
1680
+ var r = Date.now() - this._lastScanTimestamp, o = 1e3 / this._maxScansPerSecond;
1681
+ r < o && await new Promise((l) => setTimeout(l, o - r)), this._lastScanTimestamp = Date.now();
1682
+ try {
1683
+ var h = await x.scanImage(this.$video, { scanRegion: this._scanRegion, qrEngine: this._qrEnginePromise, canvas: this.$canvas });
1684
+ } catch (l) {
1685
+ if (!this._active)
1686
+ return;
1687
+ this._onDecodeError(l);
1688
+ }
1689
+ !x._disableBarcodeDetector || await this._qrEnginePromise instanceof Worker || (this._qrEnginePromise = x.createQrEngine()), h ? (this._onDecode ? this._onDecode(h) : this._legacyOnDecode && this._legacyOnDecode(h.data), this.$codeOutlineHighlight && (clearTimeout(this._codeOutlineHighlightRemovalTimeout), this._codeOutlineHighlightRemovalTimeout = void 0, this.$codeOutlineHighlight.setAttribute("viewBox", `${this._scanRegion.x || 0} ${this._scanRegion.y || 0} ${this._scanRegion.width || this.$video.videoWidth} ${this._scanRegion.height || this.$video.videoHeight}`), this.$codeOutlineHighlight.firstElementChild.setAttribute(
1690
+ "points",
1691
+ h.cornerPoints.map(({ x: l, y: d }) => `${l},${d}`).join(" ")
1692
+ ), this.$codeOutlineHighlight.style.display = "")) : this.$codeOutlineHighlight && !this._codeOutlineHighlightRemovalTimeout && (this._codeOutlineHighlightRemovalTimeout = setTimeout(() => this.$codeOutlineHighlight.style.display = "none", 100));
1693
+ }
1694
+ this._scanFrame();
1695
+ });
1696
+ }
1697
+ _onDecodeError(r) {
1698
+ r !== x.NO_QR_CODE_FOUND && console.log(r);
1699
+ }
1700
+ async _getCameraStream() {
1701
+ if (!navigator.mediaDevices)
1702
+ throw "Camera not found.";
1703
+ let r = /^(environment|user)$/.test(this._preferredCamera) ? "facingMode" : "deviceId", o = [{ width: { min: 1024 } }, { width: { min: 768 } }, {}], h = o.map((l) => Object.assign({}, l, { [r]: { exact: this._preferredCamera } }));
1704
+ for (let l of [...h, ...o])
1705
+ try {
1706
+ let d = await navigator.mediaDevices.getUserMedia({ video: l, audio: !1 }), p = this._getFacingMode(d) || (l.facingMode ? this._preferredCamera : this._preferredCamera === "environment" ? "user" : "environment");
1707
+ return { stream: d, facingMode: p };
1708
+ } catch {
1709
+ }
1710
+ throw "Camera not found.";
1711
+ }
1712
+ async _restartVideoStream() {
1713
+ let r = this._paused;
1714
+ await this.pause(!0) && !r && this._active && await this.start();
1715
+ }
1716
+ static _stopVideoStream(r) {
1717
+ for (let o of r.getTracks())
1718
+ o.stop(), r.removeTrack(o);
1719
+ }
1720
+ _setVideoMirror(r) {
1721
+ this.$video.style.transform = "scaleX(" + (r === "user" ? -1 : 1) + ")";
1722
+ }
1723
+ _getFacingMode(r) {
1724
+ return (r = r.getVideoTracks()[0]) ? /rear|back|environment/i.test(r.label) ? "environment" : /front|user|face/i.test(r.label) ? "user" : null : null;
1725
+ }
1726
+ static _drawToCanvas(r, o, h, l = !1) {
1727
+ h = h || document.createElement("canvas");
1728
+ let d = o && o.x ? o.x : 0, p = o && o.y ? o.y : 0, a = o && o.width ? o.width : r.videoWidth || r.width, y = o && o.height ? o.height : r.videoHeight || r.height;
1729
+ return l || (l = o && o.downScaledWidth ? o.downScaledWidth : a, o = o && o.downScaledHeight ? o.downScaledHeight : y, h.width !== l && (h.width = l), h.height !== o && (h.height = o)), o = h.getContext("2d", { alpha: !1 }), o.imageSmoothingEnabled = !1, o.drawImage(r, d, p, a, y, 0, 0, h.width, h.height), [h, o];
1730
+ }
1731
+ static async _loadImage(r) {
1732
+ if (r instanceof Image)
1733
+ return await x._awaitImageLoad(r), r;
1734
+ if (r instanceof HTMLVideoElement || r instanceof HTMLCanvasElement || r instanceof SVGImageElement || "OffscreenCanvas" in window && r instanceof OffscreenCanvas || "ImageBitmap" in window && r instanceof ImageBitmap)
1735
+ return r;
1736
+ if (r instanceof File || r instanceof Blob || r instanceof URL || typeof r == "string") {
1737
+ let o = new Image();
1738
+ o.src = r instanceof File || r instanceof Blob ? URL.createObjectURL(r) : r.toString();
1739
+ try {
1740
+ return await x._awaitImageLoad(o), o;
1741
+ } finally {
1742
+ (r instanceof File || r instanceof Blob) && URL.revokeObjectURL(o.src);
1743
+ }
1744
+ } else
1745
+ throw "Unsupported image type.";
1746
+ }
1747
+ static async _awaitImageLoad(r) {
1748
+ r.complete && r.naturalWidth !== 0 || await new Promise((o, h) => {
1749
+ let l = (d) => {
1750
+ r.removeEventListener("load", l), r.removeEventListener("error", l), d instanceof ErrorEvent ? h("Image load error") : o();
1751
+ };
1752
+ r.addEventListener("load", l), r.addEventListener("error", l);
1753
+ });
1754
+ }
1755
+ static async _postWorkerMessage(r, o, h, l) {
1756
+ return x._postWorkerMessageSync(await r, o, h, l);
1757
+ }
1758
+ static _postWorkerMessageSync(r, o, h, l) {
1759
+ if (!(r instanceof Worker))
1760
+ return -1;
1761
+ let d = x._workerMessageId++;
1762
+ return r.postMessage({ id: d, type: o, data: h }, l), d;
1763
+ }
1764
+ }
1765
+ x.DEFAULT_CANVAS_SIZE = 400;
1766
+ x.NO_QR_CODE_FOUND = "No QR code found";
1767
+ x._disableBarcodeDetector = !1;
1768
+ x._workerMessageId = 0;
1769
+ const Be = class Be {
1770
+ constructor(r, o, h) {
1771
+ this.events = {};
1772
+ const l = document.querySelector(r.target);
1773
+ if (!l)
1774
+ throw new Error(`Target element '${r.target}' is not found`);
1775
+ this.targetElement = l, this.decode = o, this.scannerElements = h;
1776
+ }
1777
+ async _initializeScanner(r, o = 25) {
1778
+ var h, l, d, p;
1779
+ try {
1780
+ if (!r) {
1781
+ const a = await this.listVideoInputDevices();
1782
+ r = this._getMainCameraDeviceId(a);
1783
+ }
1784
+ this.qrScanner = new x(
1785
+ document.getElementById(
1786
+ `${this.scannerElements.VIDEO}`
1787
+ ),
1788
+ async (a) => {
1789
+ var y, g, m, E;
1790
+ if (this.previousScanText !== a.data)
1791
+ try {
1792
+ this.previousScanText = a.data, (g = (y = this.events) == null ? void 0 : y[G.CAPTURE]) == null || g.call(
1793
+ y,
1794
+ await this.decode(a.data)
1795
+ );
1796
+ } catch (w) {
1797
+ (E = (m = this.events) == null ? void 0 : m[G.ERROR]) == null || E.call(m, w);
1798
+ }
1799
+ },
1800
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1801
+ // @ts-ignore
1802
+ {
1803
+ returnDetailedScanResult: !0,
1804
+ maxScansPerSecond: o,
1805
+ preferredCamera: r,
1806
+ highlightScanRegion: !0,
1807
+ highlightCodeOutline: !0,
1808
+ onDecodeError: () => {
1809
+ }
1810
+ }
1811
+ ), await this.qrScanner.start();
1812
+ } catch (a) {
1813
+ (l = (h = this.events) == null ? void 0 : h[G.ERROR]) == null || l.call(h, a), (d = this.qrScanner) == null || d.stop(), (p = this.rootElement) == null || p.remove();
1814
+ }
1815
+ }
1816
+ async listVideoInputDevices() {
1817
+ return x.listCameras(!0);
1818
+ }
1819
+ _getMainCameraDeviceId(r) {
1820
+ var l, d;
1821
+ if (!(r != null && r.length))
1822
+ throw new Error("No video input devices available");
1823
+ const o = ["back", "задня"], h = r.find((p) => {
1824
+ const a = p.label.toLowerCase();
1825
+ return a.includes(o[0]) || a.includes(o[1]);
1826
+ });
1827
+ return (h == null ? void 0 : h.id) || ((l = r[1]) == null ? void 0 : l.id) || ((d = r[0]) == null ? void 0 : d.id);
1828
+ }
1829
+ close() {
1830
+ var r, o, h, l;
1831
+ this.previousScanText = null, (o = (r = this.events) == null ? void 0 : r[G.CANCEL]) == null || o.call(r), (h = this.qrScanner) == null || h.stop(), (l = this.rootElement) == null || l.remove();
1832
+ }
1833
+ on(r, o) {
1834
+ this.events[r] = o;
1835
+ }
1836
+ off(r) {
1837
+ this.events[r] = void 0;
1838
+ }
1839
+ };
1840
+ Be.events = G;
1841
+ let we = Be;
1842
+ class Jt extends we {
1843
+ constructor(r) {
1844
+ super(r, Xt, ne);
1845
+ }
1846
+ async scan({ deviceId: r, maxScansPerSecond: o, isCloseButton: h } = {}) {
1847
+ var l, d;
1848
+ h === void 0 && (h = !0), (l = this.qrScanner) == null || l.stop(), (d = this.rootElement) == null || d.remove(), new Nt({
1849
+ target: this.targetElement,
1850
+ props: { close: this.close.bind(this), isCloseButton: h, scannerElements: ne }
1851
+ }), this.rootElement = document.getElementById(ne.ROOT), await this._initializeScanner(r, o);
1852
+ }
1853
+ }
1854
+ typeof window < "u" && (window.CredenzaScanner = Jt);
1855
+ export {
1856
+ Jt as Scanner
1857
+ };