@credenza3/scanner-lib 0.0.1 → 0.0.2

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.
@@ -1,1461 +1,2823 @@
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() {
1
+ typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
2
+ let Le = !1, Kr = !1;
3
+ function Jr() {
4
+ Le = !0;
5
5
  }
6
- function Pe(s) {
7
- return s();
6
+ Jr();
7
+ const Xr = 2, Zr = 4, en = 8, tn = 1, rn = 2, N = Symbol(), nn = "http://www.w3.org/1999/xhtml", tr = !1;
8
+ var on = Array.isArray, sn = Array.prototype.indexOf, an = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, rr = Object.getOwnPropertyDescriptors, ln = Object.prototype, un = Array.prototype, _t = Object.getPrototypeOf;
9
+ function fn(n) {
10
+ return n();
8
11
  }
9
- function Le() {
10
- return /* @__PURE__ */ Object.create(null);
12
+ function ot(n) {
13
+ for (var t = 0; t < n.length; t++)
14
+ n[t]();
11
15
  }
12
- function te(s) {
13
- s.forEach(Pe);
16
+ function nr() {
17
+ var n, t, i = new Promise((s, l) => {
18
+ n = s, t = l;
19
+ });
20
+ return { promise: i, resolve: n, reject: t };
14
21
  }
15
- function Ee(s) {
16
- return typeof s == "function";
22
+ const W = 2, yt = 4, vt = 8, oe = 16, se = 32, Ae = 64, gt = 128, q = 1024, z = 2048, ae = 4096, ee = 8192, ne = 16384, wt = 32768, Oe = 65536, $t = 1 << 17, cn = 1 << 18, Ze = 1 << 19, ir = 1 << 20, Q = 256, Ye = 512, Ge = 32768, st = 1 << 21, mt = 1 << 22, ve = 1 << 23, Re = Symbol("$state"), hn = Symbol("legacy props"), Ie = new class extends Error {
23
+ name = "StaleReactionError";
24
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
25
+ }();
26
+ function or(n) {
27
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
17
28
  }
18
- function Ne(s, r) {
19
- return s != s ? r == r : s !== r || s && typeof s == "object" || typeof s == "function";
29
+ function dn() {
30
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
20
31
  }
21
- function yt(s) {
22
- return Object.keys(s).length === 0;
32
+ function pn(n) {
33
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
23
34
  }
24
- function de(s, r) {
25
- s.appendChild(r);
35
+ function _n() {
36
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
26
37
  }
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
- }
38
+ function yn(n) {
39
+ throw new Error("https://svelte.dev/e/effect_orphan");
40
+ }
41
+ function vn() {
42
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
43
+ }
44
+ function gn() {
45
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
46
+ }
47
+ function wn() {
48
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
49
+ }
50
+ function mn() {
51
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
33
52
  }
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;
53
+ function sr(n) {
54
+ return n === this.v;
43
55
  }
44
- function mt(s, r) {
45
- return de(
46
- /** @type {Document} */
47
- s.head || s,
48
- r
49
- ), r.sheet;
56
+ function En(n, t) {
57
+ return n != n ? t == t : n !== t || n !== null && typeof n == "object" || typeof n == "function";
50
58
  }
51
- function We(s, r, o) {
52
- s.insertBefore(r, o || null);
59
+ function xn(n) {
60
+ return !En(n, this.v);
53
61
  }
54
- function xe(s) {
55
- s.parentNode && s.parentNode.removeChild(s);
62
+ let $ = null;
63
+ function Qe(n) {
64
+ $ = n;
56
65
  }
57
- function oe(s) {
58
- return document.createElement(s);
66
+ function Bn(n, t = !1, i) {
67
+ $ = {
68
+ p: $,
69
+ i: !1,
70
+ c: null,
71
+ e: null,
72
+ s: n,
73
+ x: null,
74
+ l: Le && !t ? { s: null, u: null, $: [] } : null
75
+ };
76
+ }
77
+ function In(n) {
78
+ var t = (
79
+ /** @type {ComponentContext} */
80
+ $
81
+ ), i = t.e;
82
+ if (i !== null) {
83
+ t.e = null;
84
+ for (var s of i)
85
+ gr(s);
86
+ }
87
+ return t.i = !0, $ = t.p, /** @type {T} */
88
+ {};
89
+ }
90
+ function Pe() {
91
+ return !Le || $ !== null && $.l === null;
59
92
  }
60
- function wt(s) {
61
- return document.createTextNode(s);
93
+ let Se = [];
94
+ function Sn() {
95
+ var n = Se;
96
+ Se = [], ot(n);
62
97
  }
63
- function Et() {
64
- return wt(" ");
98
+ function ar(n) {
99
+ if (Se.length === 0) {
100
+ var t = Se;
101
+ queueMicrotask(() => {
102
+ t === Se && Sn();
103
+ });
104
+ }
105
+ Se.push(n);
65
106
  }
66
- function xt(s, r, o, h) {
67
- return s.addEventListener(r, o, h), () => s.removeEventListener(r, o, h);
107
+ function Fn(n) {
108
+ var t = b;
109
+ if (t === null)
110
+ return R.f |= ve, n;
111
+ if ((t.f & wt) === 0) {
112
+ if ((t.f & gt) === 0)
113
+ throw n;
114
+ t.b.error(n);
115
+ } else
116
+ Ke(n, t);
68
117
  }
69
- function M(s, r, o) {
70
- o == null ? s.removeAttribute(r) : s.getAttribute(r) !== o && s.setAttribute(r, o);
118
+ function Ke(n, t) {
119
+ for (; t !== null; ) {
120
+ if ((t.f & gt) !== 0)
121
+ try {
122
+ t.b.error(n);
123
+ return;
124
+ } catch (i) {
125
+ n = i;
126
+ }
127
+ t = t.parent;
128
+ }
129
+ throw n;
130
+ }
131
+ const qe = /* @__PURE__ */ new Set();
132
+ let P = null, K = null, ce = [], Et = null, at = !1;
133
+ class Ue {
134
+ committed = !1;
135
+ /**
136
+ * The current values of any sources that are updated in this batch
137
+ * They keys of this map are identical to `this.#previous`
138
+ * @type {Map<Source, any>}
139
+ */
140
+ current = /* @__PURE__ */ new Map();
141
+ /**
142
+ * The values of any sources that are updated in this batch _before_ those updates took place.
143
+ * They keys of this map are identical to `this.#current`
144
+ * @type {Map<Source, any>}
145
+ */
146
+ previous = /* @__PURE__ */ new Map();
147
+ /**
148
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
149
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
150
+ * @type {Set<() => void>}
151
+ */
152
+ #t = /* @__PURE__ */ new Set();
153
+ /**
154
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
155
+ * @type {Set<(batch: Batch) => void>}
156
+ */
157
+ #r = /* @__PURE__ */ new Set();
158
+ /**
159
+ * The number of async effects that are currently in flight
160
+ */
161
+ #e = 0;
162
+ /**
163
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
164
+ */
165
+ #n = 0;
166
+ /**
167
+ * A deferred that resolves when the batch is committed, used with `settled()`
168
+ * TODO replace with Promise.withResolvers once supported widely enough
169
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
170
+ */
171
+ #o = null;
172
+ /**
173
+ * Deferred effects (which run after async work has completed) that are DIRTY
174
+ * @type {Effect[]}
175
+ */
176
+ #s = [];
177
+ /**
178
+ * Deferred effects that are MAYBE_DIRTY
179
+ * @type {Effect[]}
180
+ */
181
+ #a = [];
182
+ /**
183
+ * A set of branches that still exist, but will be destroyed when this batch
184
+ * is committed — we skip over these during `process`
185
+ * @type {Set<Effect>}
186
+ */
187
+ skipped_effects = /* @__PURE__ */ new Set();
188
+ is_fork = !1;
189
+ /**
190
+ *
191
+ * @param {Effect[]} root_effects
192
+ */
193
+ process(t) {
194
+ ce = [], this.apply();
195
+ var i = {
196
+ parent: null,
197
+ effect: null,
198
+ effects: [],
199
+ render_effects: [],
200
+ block_effects: []
201
+ };
202
+ for (const s of t)
203
+ this.#l(s, i);
204
+ this.is_fork || this.#u(), this.#n > 0 || this.is_fork ? (this.#i(i.effects), this.#i(i.render_effects), this.#i(i.block_effects)) : (P = null, Nt(i.render_effects), Nt(i.effects), this.#o?.resolve()), K = null;
205
+ }
206
+ /**
207
+ * Traverse the effect tree, executing effects or stashing
208
+ * them for later execution as appropriate
209
+ * @param {Effect} root
210
+ * @param {EffectTarget} target
211
+ */
212
+ #l(t, i) {
213
+ t.f ^= q;
214
+ for (var s = t.first; s !== null; ) {
215
+ var l = s.f, c = (l & (se | Ae)) !== 0, h = c && (l & q) !== 0, u = h || (l & ee) !== 0 || this.skipped_effects.has(s);
216
+ if ((s.f & gt) !== 0 && s.b?.is_pending() && (i = {
217
+ parent: i,
218
+ effect: s,
219
+ effects: [],
220
+ render_effects: [],
221
+ block_effects: []
222
+ }), !u && s.fn !== null) {
223
+ c ? s.f ^= q : (l & yt) !== 0 ? i.effects.push(s) : $e(s) && ((s.f & oe) !== 0 && i.block_effects.push(s), ke(s));
224
+ var p = s.first;
225
+ if (p !== null) {
226
+ s = p;
227
+ continue;
228
+ }
229
+ }
230
+ var _ = s.parent;
231
+ for (s = s.next; s === null && _ !== null; )
232
+ _ === i.effect && (this.#i(i.effects), this.#i(i.render_effects), this.#i(i.block_effects), i = /** @type {EffectTarget} */
233
+ i.parent), s = _.next, _ = _.parent;
234
+ }
235
+ }
236
+ /**
237
+ * @param {Effect[]} effects
238
+ */
239
+ #i(t) {
240
+ for (const i of t)
241
+ ((i.f & z) !== 0 ? this.#s : this.#a).push(i), j(i, q);
242
+ }
243
+ /**
244
+ * Associate a change to a given source with the current
245
+ * batch, noting its previous and current values
246
+ * @param {Source} source
247
+ * @param {any} value
248
+ */
249
+ capture(t, i) {
250
+ this.previous.has(t) || this.previous.set(t, i), this.current.set(t, t.v), K?.set(t, t.v);
251
+ }
252
+ activate() {
253
+ P = this;
254
+ }
255
+ deactivate() {
256
+ P = null, K = null;
257
+ }
258
+ flush() {
259
+ if (this.activate(), ce.length > 0) {
260
+ if (Rn(), P !== null && P !== this)
261
+ return;
262
+ } else this.#e === 0 && this.process([]);
263
+ this.deactivate();
264
+ }
265
+ discard() {
266
+ for (const t of this.#r) t(this);
267
+ this.#r.clear();
268
+ }
269
+ #u() {
270
+ if (this.#n === 0) {
271
+ for (const t of this.#t) t();
272
+ this.#t.clear();
273
+ }
274
+ this.#e === 0 && this.#f();
275
+ }
276
+ #f() {
277
+ if (qe.size > 1) {
278
+ this.previous.clear();
279
+ var t = K, i = !0, s = {
280
+ parent: null,
281
+ effect: null,
282
+ effects: [],
283
+ render_effects: [],
284
+ block_effects: []
285
+ };
286
+ for (const l of qe) {
287
+ if (l === this) {
288
+ i = !1;
289
+ continue;
290
+ }
291
+ const c = [];
292
+ for (const [u, p] of this.current) {
293
+ if (l.current.has(u))
294
+ if (i && p !== l.current.get(u))
295
+ l.current.set(u, p);
296
+ else
297
+ continue;
298
+ c.push(u);
299
+ }
300
+ if (c.length === 0)
301
+ continue;
302
+ const h = [...l.current.keys()].filter((u) => !this.current.has(u));
303
+ if (h.length > 0) {
304
+ const u = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map();
305
+ for (const _ of c)
306
+ lr(_, h, u, p);
307
+ if (ce.length > 0) {
308
+ P = l, l.apply();
309
+ for (const _ of ce)
310
+ l.#l(_, s);
311
+ ce = [], l.deactivate();
312
+ }
313
+ }
314
+ }
315
+ P = null, K = t;
316
+ }
317
+ this.committed = !0, qe.delete(this);
318
+ }
319
+ /**
320
+ *
321
+ * @param {boolean} blocking
322
+ */
323
+ increment(t) {
324
+ this.#e += 1, t && (this.#n += 1);
325
+ }
326
+ /**
327
+ *
328
+ * @param {boolean} blocking
329
+ */
330
+ decrement(t) {
331
+ this.#e -= 1, t && (this.#n -= 1), this.revive();
332
+ }
333
+ revive() {
334
+ for (const t of this.#s)
335
+ j(t, z), we(t);
336
+ for (const t of this.#a)
337
+ j(t, ae), we(t);
338
+ this.#s = [], this.#a = [], this.flush();
339
+ }
340
+ /** @param {() => void} fn */
341
+ oncommit(t) {
342
+ this.#t.add(t);
343
+ }
344
+ /** @param {(batch: Batch) => void} fn */
345
+ ondiscard(t) {
346
+ this.#r.add(t);
347
+ }
348
+ settled() {
349
+ return (this.#o ??= nr()).promise;
350
+ }
351
+ static ensure() {
352
+ if (P === null) {
353
+ const t = P = new Ue();
354
+ qe.add(P), Ue.enqueue(() => {
355
+ P === t && t.flush();
356
+ });
357
+ }
358
+ return P;
359
+ }
360
+ /** @param {() => void} task */
361
+ static enqueue(t) {
362
+ ar(t);
363
+ }
364
+ apply() {
365
+ }
71
366
  }
72
- function _t(s) {
73
- return Array.from(s.childNodes);
367
+ function Rn() {
368
+ var n = be;
369
+ at = !0;
370
+ try {
371
+ var t = 0;
372
+ for (Wt(!0); ce.length > 0; ) {
373
+ var i = Ue.ensure();
374
+ if (t++ > 1e3) {
375
+ var s, l;
376
+ bn();
377
+ }
378
+ i.process(ce), de.clear();
379
+ }
380
+ } finally {
381
+ at = !1, Wt(n), Et = null;
382
+ }
74
383
  }
75
- let ee;
76
- function J(s) {
77
- ee = s;
384
+ function bn() {
385
+ try {
386
+ vn();
387
+ } catch (n) {
388
+ Ke(n, Et);
389
+ }
78
390
  }
79
- function Bt() {
80
- if (!ee)
81
- throw new Error("Function called outside component initialization");
82
- return ee;
391
+ let re = null;
392
+ function Nt(n) {
393
+ var t = n.length;
394
+ if (t !== 0) {
395
+ for (var i = 0; i < t; ) {
396
+ var s = n[i++];
397
+ if ((s.f & (ne | ee)) === 0 && $e(s) && (re = /* @__PURE__ */ new Set(), ke(s), s.deps === null && s.first === null && s.nodes_start === null && (s.teardown === null && s.ac === null ? Er(s) : s.fn = null), re?.size > 0)) {
398
+ de.clear();
399
+ for (const l of re) {
400
+ if ((l.f & (ne | ee)) !== 0) continue;
401
+ const c = [l];
402
+ let h = l.parent;
403
+ for (; h !== null; )
404
+ re.has(h) && (re.delete(h), c.push(h)), h = h.parent;
405
+ for (let u = c.length - 1; u >= 0; u--) {
406
+ const p = c[u];
407
+ (p.f & (ne | ee)) === 0 && ke(p);
408
+ }
409
+ }
410
+ re.clear();
411
+ }
412
+ }
413
+ re = null;
414
+ }
83
415
  }
84
- function vt(s) {
85
- Bt().$$.on_destroy.push(s);
416
+ function lr(n, t, i, s) {
417
+ if (!i.has(n) && (i.add(n), n.reactions !== null))
418
+ for (const l of n.reactions) {
419
+ const c = l.f;
420
+ (c & W) !== 0 ? lr(
421
+ /** @type {Derived} */
422
+ l,
423
+ t,
424
+ i,
425
+ s
426
+ ) : (c & (mt | oe)) !== 0 && (c & z) === 0 && // we may have scheduled this one already
427
+ ur(l, t, s) && (j(l, z), we(
428
+ /** @type {Effect} */
429
+ l
430
+ ));
431
+ }
86
432
  }
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));
433
+ function ur(n, t, i) {
434
+ const s = i.get(n);
435
+ if (s !== void 0) return s;
436
+ if (n.deps !== null)
437
+ for (const l of n.deps) {
438
+ if (t.includes(l))
439
+ return !0;
440
+ if ((l.f & W) !== 0 && ur(
441
+ /** @type {Derived} */
442
+ l,
443
+ t,
444
+ i
445
+ ))
446
+ return i.set(
447
+ /** @type {Derived} */
448
+ l,
449
+ !0
450
+ ), !0;
451
+ }
452
+ return i.set(n, !1), !1;
93
453
  }
94
- function ye(s) {
95
- Y.push(s);
454
+ function we(n) {
455
+ for (var t = Et = n; t.parent !== null; ) {
456
+ t = t.parent;
457
+ var i = t.f;
458
+ if (at && t === b && (i & oe) !== 0)
459
+ return;
460
+ if ((i & (Ae | se)) !== 0) {
461
+ if ((i & q) === 0) return;
462
+ t.f ^= q;
463
+ }
464
+ }
465
+ ce.push(t);
96
466
  }
97
- const le = /* @__PURE__ */ new Set();
98
- let q = 0;
99
- function je() {
100
- if (q !== 0)
467
+ function An(n, t, i, s) {
468
+ const l = Pe() ? xt : fr;
469
+ if (i.length === 0 && n.length === 0) {
470
+ s(t.map(l));
101
471
  return;
102
- const s = ee;
103
- do {
472
+ }
473
+ var c = P, h = (
474
+ /** @type {Effect} */
475
+ b
476
+ ), u = Cn();
477
+ function p() {
478
+ Promise.all(i.map((_) => /* @__PURE__ */ Tn(_))).then((_) => {
479
+ u();
480
+ try {
481
+ s([...t.map(l), ..._]);
482
+ } catch (g) {
483
+ (h.f & ne) === 0 && Ke(g, h);
484
+ }
485
+ c?.deactivate(), Je();
486
+ }).catch((_) => {
487
+ Ke(_, h);
488
+ });
489
+ }
490
+ n.length > 0 ? Promise.all(n).then(() => {
491
+ u();
492
+ try {
493
+ return p();
494
+ } finally {
495
+ c?.deactivate(), Je();
496
+ }
497
+ }) : p();
498
+ }
499
+ function Cn() {
500
+ var n = b, t = R, i = $, s = P;
501
+ return function(c = !0) {
502
+ _e(n), te(t), Qe(i), c && s?.activate();
503
+ };
504
+ }
505
+ function Je() {
506
+ _e(null), te(null), Qe(null);
507
+ }
508
+ // @__NO_SIDE_EFFECTS__
509
+ function xt(n) {
510
+ var t = W | z, i = R !== null && (R.f & W) !== 0 ? (
511
+ /** @type {Derived} */
512
+ R
513
+ ) : null;
514
+ return b === null || i !== null && (i.f & Q) !== 0 ? t |= Q : b.f |= Ze, {
515
+ ctx: $,
516
+ deps: null,
517
+ effects: null,
518
+ equals: sr,
519
+ f: t,
520
+ fn: n,
521
+ reactions: null,
522
+ rv: 0,
523
+ v: (
524
+ /** @type {V} */
525
+ N
526
+ ),
527
+ wv: 0,
528
+ parent: i ?? b,
529
+ ac: null
530
+ };
531
+ }
532
+ // @__NO_SIDE_EFFECTS__
533
+ function Tn(n, t) {
534
+ let i = (
535
+ /** @type {Effect | null} */
536
+ b
537
+ );
538
+ i === null && dn();
539
+ var s = (
540
+ /** @type {Boundary} */
541
+ i.b
542
+ ), l = (
543
+ /** @type {Promise<V>} */
544
+ /** @type {unknown} */
545
+ void 0
546
+ ), c = pr(
547
+ /** @type {V} */
548
+ N
549
+ ), h = !R, u = /* @__PURE__ */ new Map();
550
+ return Wn(() => {
551
+ var p = nr();
552
+ l = p.promise;
104
553
  try {
105
- for (; q < Q.length; ) {
106
- const r = Q[q];
107
- q++, J(r), St(r.$$);
554
+ Promise.resolve(n()).then(p.resolve, p.reject).then(() => {
555
+ _ === P && _.committed && _.deactivate(), Je();
556
+ });
557
+ } catch (m) {
558
+ p.reject(m), Je();
559
+ }
560
+ var _ = (
561
+ /** @type {Batch} */
562
+ P
563
+ );
564
+ if (h) {
565
+ var g = !s.is_pending();
566
+ s.update_pending_count(1), _.increment(g), u.get(_)?.reject(Ie), u.delete(_), u.set(_, p);
567
+ }
568
+ const E = (m, v = void 0) => {
569
+ if (_.activate(), v)
570
+ v !== Ie && (c.f |= ve, ut(c, v));
571
+ else {
572
+ (c.f & ve) !== 0 && (c.f ^= ve), ut(c, m);
573
+ for (const [w, x] of u) {
574
+ if (u.delete(w), w === _) break;
575
+ x.reject(Ie);
576
+ }
577
+ }
578
+ h && (s.update_pending_count(-1), _.decrement(g));
579
+ };
580
+ p.promise.then(E, (m) => E(null, m || "unknown"));
581
+ }), vr(() => {
582
+ for (const p of u.values())
583
+ p.reject(Ie);
584
+ }), new Promise((p) => {
585
+ function _(g) {
586
+ function E() {
587
+ g === l ? p(c) : _(l);
108
588
  }
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
589
+ g.then(E, E);
590
+ }
591
+ _(l);
592
+ });
593
+ }
594
+ // @__NO_SIDE_EFFECTS__
595
+ function fr(n) {
596
+ const t = /* @__PURE__ */ xt(n);
597
+ return t.equals = xn, t;
598
+ }
599
+ function cr(n) {
600
+ var t = n.effects;
601
+ if (t !== null) {
602
+ n.effects = null;
603
+ for (var i = 0; i < t.length; i += 1)
604
+ pe(
605
+ /** @type {Effect} */
606
+ t[i]
607
+ );
608
+ }
609
+ }
610
+ function On(n) {
611
+ for (var t = n.parent; t !== null; ) {
612
+ if ((t.f & W) === 0)
613
+ return (
614
+ /** @type {Effect} */
615
+ t
616
+ );
617
+ t = t.parent;
618
+ }
619
+ return null;
620
+ }
621
+ function Bt(n) {
622
+ var t, i = b;
623
+ _e(On(n));
624
+ try {
625
+ n.f &= ~Ge, cr(n), t = Rr(n);
626
+ } finally {
627
+ _e(i);
628
+ }
629
+ return t;
630
+ }
631
+ function hr(n) {
632
+ var t = Bt(n);
633
+ if (n.equals(t) || (n.v = t, n.wv = Sr()), !me)
634
+ if (K !== null)
635
+ K.set(n, n.v);
636
+ else {
637
+ var i = (he || (n.f & Q) !== 0) && n.deps !== null ? ae : q;
638
+ j(n, i);
639
+ }
640
+ }
641
+ let lt = /* @__PURE__ */ new Set();
642
+ const de = /* @__PURE__ */ new Map();
643
+ let dr = !1;
644
+ function pr(n, t) {
645
+ var i = {
646
+ f: 0,
647
+ // TODO ideally we could skip this altogether, but it causes type errors
648
+ v: n,
649
+ reactions: null,
650
+ equals: sr,
651
+ rv: 0,
652
+ wv: 0
143
653
  };
654
+ return i;
144
655
  }
145
- function $t() {
146
- V.r || te(V.c), V = V.p;
656
+ // @__NO_SIDE_EFFECTS__
657
+ function ue(n, t) {
658
+ const i = pr(n);
659
+ return Xn(i), i;
147
660
  }
148
- function K(s, r) {
149
- s && s.i && (re.delete(s), s.i(r));
661
+ function fe(n, t, i = !1) {
662
+ R !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
663
+ // to ensure we error if state is set inside an inspect effect
664
+ (!X || (R.f & $t) !== 0) && Pe() && (R.f & (W | oe | mt | $t)) !== 0 && !ie?.includes(n) && mn();
665
+ let s = i ? Fe(t) : t;
666
+ return ut(n, s);
150
667
  }
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
668
+ function ut(n, t) {
669
+ if (!n.equals(t)) {
670
+ var i = n.v;
671
+ me ? de.set(n, t) : de.set(n, i), n.v = t;
672
+ var s = Ue.ensure();
673
+ s.capture(n, i), (n.f & W) !== 0 && ((n.f & z) !== 0 && Bt(
674
+ /** @type {Derived} */
675
+ n
676
+ ), j(n, (n.f & Q) === 0 ? q : ae)), n.wv = Sr(), _r(n, z), Pe() && b !== null && (b.f & q) !== 0 && (b.f & (se | Ae)) === 0 && (G === null ? Zn([n]) : G.push(n)), !s.is_fork && lt.size > 0 && !dr && Un();
677
+ }
678
+ return t;
679
+ }
680
+ function Un() {
681
+ dr = !1;
682
+ const n = Array.from(lt);
683
+ for (const t of n)
684
+ (t.f & q) !== 0 && j(t, ae), $e(t) && ke(t);
685
+ lt.clear();
686
+ }
687
+ function nt(n) {
688
+ fe(n, n.v + 1);
689
+ }
690
+ function _r(n, t) {
691
+ var i = n.reactions;
692
+ if (i !== null)
693
+ for (var s = Pe(), l = i.length, c = 0; c < l; c++) {
694
+ var h = i[c], u = h.f;
695
+ if (!(!s && h === b)) {
696
+ var p = (u & z) === 0;
697
+ p && j(h, t), (u & W) !== 0 ? (u & Ge) === 0 && (h.f |= Ge, _r(
698
+ /** @type {Derived} */
699
+ h,
700
+ ae
701
+ )) : p && ((u & oe) !== 0 && re !== null && re.add(
702
+ /** @type {Effect} */
703
+ h
704
+ ), we(
705
+ /** @type {Effect} */
706
+ h
707
+ ));
708
+ }
709
+ }
710
+ }
711
+ function Fe(n) {
712
+ if (typeof n != "object" || n === null || Re in n)
713
+ return n;
714
+ const t = _t(n);
715
+ if (t !== ln && t !== un)
716
+ return n;
717
+ var i = /* @__PURE__ */ new Map(), s = on(n), l = /* @__PURE__ */ ue(0), c = ge, h = (u) => {
718
+ if (ge === c)
719
+ return u();
720
+ var p = R, _ = ge;
721
+ te(null), Ht(c);
722
+ var g = u();
723
+ return te(p), Ht(_), g;
201
724
  };
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;
725
+ return s && i.set("length", /* @__PURE__ */ ue(
726
+ /** @type {any[]} */
727
+ n.length
728
+ )), new Proxy(
729
+ /** @type {any} */
730
+ n,
731
+ {
732
+ defineProperty(u, p, _) {
733
+ (!("value" in _) || _.configurable === !1 || _.enumerable === !1 || _.writable === !1) && gn();
734
+ var g = i.get(p);
735
+ return g === void 0 ? g = h(() => {
736
+ var E = /* @__PURE__ */ ue(_.value);
737
+ return i.set(p, E), E;
738
+ }) : fe(g, _.value, !0), !0;
739
+ },
740
+ deleteProperty(u, p) {
741
+ var _ = i.get(p);
742
+ if (_ === void 0) {
743
+ if (p in u) {
744
+ const g = h(() => /* @__PURE__ */ ue(N));
745
+ i.set(p, g), nt(l);
746
+ }
747
+ } else
748
+ fe(_, N), nt(l);
749
+ return !0;
750
+ },
751
+ get(u, p, _) {
752
+ if (p === Re)
753
+ return n;
754
+ var g = i.get(p), E = p in u;
755
+ if (g === void 0 && (!E || Ve(u, p)?.writable) && (g = h(() => {
756
+ var v = Fe(E ? u[p] : N), w = /* @__PURE__ */ ue(v);
757
+ return w;
758
+ }), i.set(p, g)), g !== void 0) {
759
+ var m = Z(g);
760
+ return m === N ? void 0 : m;
761
+ }
762
+ return Reflect.get(u, p, _);
763
+ },
764
+ getOwnPropertyDescriptor(u, p) {
765
+ var _ = Reflect.getOwnPropertyDescriptor(u, p);
766
+ if (_ && "value" in _) {
767
+ var g = i.get(p);
768
+ g && (_.value = Z(g));
769
+ } else if (_ === void 0) {
770
+ var E = i.get(p), m = E?.v;
771
+ if (E !== void 0 && m !== N)
772
+ return {
773
+ enumerable: !0,
774
+ configurable: !0,
775
+ value: m,
776
+ writable: !0
777
+ };
778
+ }
779
+ return _;
780
+ },
781
+ has(u, p) {
782
+ if (p === Re)
783
+ return !0;
784
+ var _ = i.get(p), g = _ !== void 0 && _.v !== N || Reflect.has(u, p);
785
+ if (_ !== void 0 || b !== null && (!g || Ve(u, p)?.writable)) {
786
+ _ === void 0 && (_ = h(() => {
787
+ var m = g ? Fe(u[p]) : N, v = /* @__PURE__ */ ue(m);
788
+ return v;
789
+ }), i.set(p, _));
790
+ var E = Z(_);
791
+ if (E === N)
792
+ return !1;
793
+ }
794
+ return g;
795
+ },
796
+ set(u, p, _, g) {
797
+ var E = i.get(p), m = p in u;
798
+ if (s && p === "length")
799
+ for (var v = _; v < /** @type {Source<number>} */
800
+ E.v; v += 1) {
801
+ var w = i.get(v + "");
802
+ w !== void 0 ? fe(w, N) : v in u && (w = h(() => /* @__PURE__ */ ue(N)), i.set(v + "", w));
803
+ }
804
+ if (E === void 0)
805
+ (!m || Ve(u, p)?.writable) && (E = h(() => /* @__PURE__ */ ue(void 0)), fe(E, Fe(_)), i.set(p, E));
806
+ else {
807
+ m = E.v !== N;
808
+ var x = h(() => Fe(_));
809
+ fe(E, x);
810
+ }
811
+ var S = Reflect.getOwnPropertyDescriptor(u, p);
812
+ if (S?.set && S.set.call(g, _), !m) {
813
+ if (s && typeof p == "string") {
814
+ var A = (
815
+ /** @type {Source<number>} */
816
+ i.get("length")
817
+ ), B = Number(p);
818
+ Number.isInteger(B) && B >= A.v && fe(A, B + 1);
819
+ }
820
+ nt(l);
821
+ }
822
+ return !0;
823
+ },
824
+ ownKeys(u) {
825
+ Z(l);
826
+ var p = Reflect.ownKeys(u).filter((E) => {
827
+ var m = i.get(E);
828
+ return m === void 0 || m.v !== N;
829
+ });
830
+ for (var [_, g] of i)
831
+ g.v !== N && !(_ in u) && p.push(_);
832
+ return p;
833
+ },
834
+ setPrototypeOf() {
835
+ wn();
836
+ }
837
+ }
838
+ );
839
+ }
840
+ var Dn, kn, Mn;
841
+ function qt(n = "") {
842
+ return document.createTextNode(n);
843
+ }
844
+ // @__NO_SIDE_EFFECTS__
845
+ function ft(n) {
846
+ return kn.call(n);
847
+ }
848
+ // @__NO_SIDE_EFFECTS__
849
+ function It(n) {
850
+ return Mn.call(n);
851
+ }
852
+ function Ln(n, t) {
853
+ return /* @__PURE__ */ ft(n);
854
+ }
855
+ function Pn(n, t = 1, i = !1) {
856
+ let s = n;
857
+ for (; t--; )
858
+ s = /** @type {TemplateNode} */
859
+ /* @__PURE__ */ It(s);
860
+ return s;
861
+ }
862
+ function $n() {
863
+ return !1;
864
+ }
865
+ function St(n) {
866
+ var t = R, i = b;
867
+ te(null), _e(null);
868
+ try {
869
+ return n();
870
+ } finally {
871
+ te(t), _e(i);
239
872
  }
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
- };
873
+ }
874
+ function yr(n) {
875
+ b === null && R === null && yn(), R !== null && (R.f & Q) !== 0 && b === null && _n(), me && pn();
876
+ }
877
+ function Nn(n, t) {
878
+ var i = t.last;
879
+ i === null ? t.last = t.first = n : (i.next = n, n.prev = i, t.last = n);
880
+ }
881
+ function ye(n, t, i, s = !0) {
882
+ var l = b;
883
+ l !== null && (l.f & ee) !== 0 && (n |= ee);
884
+ var c = {
885
+ ctx: $,
886
+ deps: null,
887
+ nodes_start: null,
888
+ nodes_end: null,
889
+ f: n | z,
890
+ first: null,
891
+ fn: t,
892
+ last: null,
893
+ next: null,
894
+ parent: l,
895
+ b: l && l.b,
896
+ prev: null,
897
+ teardown: null,
898
+ transitions: null,
899
+ wv: 0,
900
+ ac: null
901
+ };
902
+ if (i)
903
+ try {
904
+ ke(c), c.f |= wt;
905
+ } catch (p) {
906
+ throw pe(c), p;
907
+ }
908
+ else t !== null && we(c);
909
+ if (s) {
910
+ var h = c;
911
+ if (i && h.deps === null && h.teardown === null && h.nodes_start === null && h.first === h.last && // either `null`, or a singular child
912
+ (h.f & Ze) === 0 && (h = h.first, (n & oe) !== 0 && (n & Oe) !== 0 && h !== null && (h.f |= Oe)), h !== null && (h.parent = l, l !== null && Nn(h, l), R !== null && (R.f & W) !== 0 && (n & Ae) === 0)) {
913
+ var u = (
914
+ /** @type {Derived} */
915
+ R
916
+ );
917
+ (u.effects ??= []).push(h);
918
+ }
254
919
  }
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);
920
+ return c;
921
+ }
922
+ function vr(n) {
923
+ const t = ye(vt, null, !1);
924
+ return j(t, q), t.teardown = n, t;
925
+ }
926
+ function ct(n) {
927
+ yr();
928
+ var t = (
929
+ /** @type {Effect} */
930
+ b.f
931
+ ), i = !R && (t & se) !== 0 && (t & wt) === 0;
932
+ if (i) {
933
+ var s = (
934
+ /** @type {ComponentContext} */
935
+ $
936
+ );
937
+ (s.e ??= []).push(n);
938
+ } else
939
+ return gr(n);
940
+ }
941
+ function gr(n) {
942
+ return ye(yt | ir, n, !1);
943
+ }
944
+ function qn(n) {
945
+ return yr(), ye(vt | ir, n, !0);
946
+ }
947
+ function jn(n) {
948
+ return ye(yt, n, !1);
949
+ }
950
+ function Wn(n) {
951
+ return ye(mt | Ze, n, !0);
952
+ }
953
+ function Vn(n, t = [], i = [], s = []) {
954
+ An(s, t, i, (l) => {
955
+ ye(vt, () => n(...l.map(Z)), !0);
956
+ });
957
+ }
958
+ function Hn(n, t = 0) {
959
+ var i = ye(oe | t, n, !0);
960
+ return i;
961
+ }
962
+ function jt(n, t = !0) {
963
+ return ye(se | Ze, n, !0, t);
964
+ }
965
+ function wr(n) {
966
+ var t = n.teardown;
967
+ if (t !== null) {
968
+ const i = me, s = R;
969
+ Vt(!0), te(null);
970
+ try {
971
+ t.call(null);
972
+ } finally {
973
+ Vt(i), te(s);
974
+ }
261
975
  }
262
976
  }
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)}");
977
+ function mr(n, t = !1) {
978
+ var i = n.first;
979
+ for (n.first = n.last = null; i !== null; ) {
980
+ const l = i.ac;
981
+ l !== null && St(() => {
982
+ l.abort(Ie);
983
+ });
984
+ var s = i.next;
985
+ (i.f & Ae) !== 0 ? i.parent = null : pe(i, t), i = s;
986
+ }
267
987
  }
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();
988
+ function zn(n) {
989
+ for (var t = n.first; t !== null; ) {
990
+ var i = t.next;
991
+ (t.f & se) === 0 && pe(t), t = i;
992
+ }
993
+ }
994
+ function pe(n, t = !0) {
995
+ var i = !1;
996
+ (t || (n.f & cn) !== 0) && n.nodes_start !== null && n.nodes_end !== null && (Yn(
997
+ n.nodes_start,
998
+ /** @type {TemplateNode} */
999
+ n.nodes_end
1000
+ ), i = !0), mr(n, t && !i), Xe(n, 0), j(n, ne);
1001
+ var s = n.transitions;
1002
+ if (s !== null)
1003
+ for (const c of s)
1004
+ c.stop();
1005
+ wr(n);
1006
+ var l = n.parent;
1007
+ l !== null && l.first !== null && Er(n), n.next = n.prev = n.teardown = n.ctx = n.deps = n.fn = n.nodes_start = n.nodes_end = n.ac = null;
1008
+ }
1009
+ function Yn(n, t) {
1010
+ for (; n !== null; ) {
1011
+ var i = n === t ? null : (
1012
+ /** @type {TemplateNode} */
1013
+ /* @__PURE__ */ It(n)
1014
+ );
1015
+ n.remove(), n = i;
1016
+ }
1017
+ }
1018
+ function Er(n) {
1019
+ var t = n.parent, i = n.prev, s = n.next;
1020
+ i !== null && (i.next = s), s !== null && (s.prev = i), t !== null && (t.first === n && (t.first = s), t.last === n && (t.last = i));
1021
+ }
1022
+ function Gn(n, t, i = !0) {
1023
+ var s = [];
1024
+ xr(n, s, !0), Qn(s, () => {
1025
+ i && pe(n), t && t();
1026
+ });
1027
+ }
1028
+ function Qn(n, t) {
1029
+ var i = n.length;
1030
+ if (i > 0) {
1031
+ var s = () => --i || t();
1032
+ for (var l of n)
1033
+ l.out(s);
1034
+ } else
1035
+ t();
1036
+ }
1037
+ function xr(n, t, i) {
1038
+ if ((n.f & ee) === 0) {
1039
+ if (n.f ^= ee, n.transitions !== null)
1040
+ for (const h of n.transitions)
1041
+ (h.is_global || i) && t.push(h);
1042
+ for (var s = n.first; s !== null; ) {
1043
+ var l = s.next, c = (s.f & Oe) !== 0 || // If this is a branch effect without a block effect parent,
1044
+ // it means the parent block effect was pruned. In that case,
1045
+ // transparency information was transferred to the branch effect.
1046
+ (s.f & se) !== 0 && (n.f & oe) !== 0;
1047
+ xr(s, t, c ? i : !1), s = l;
289
1048
  }
290
- };
1049
+ }
1050
+ }
1051
+ function Kn(n) {
1052
+ Br(n, !0);
1053
+ }
1054
+ function Br(n, t) {
1055
+ if ((n.f & ee) !== 0) {
1056
+ n.f ^= ee, (n.f & q) === 0 && (j(n, z), we(n));
1057
+ for (var i = n.first; i !== null; ) {
1058
+ var s = i.next, l = (i.f & Oe) !== 0 || (i.f & se) !== 0;
1059
+ Br(i, l ? t : !1), i = s;
1060
+ }
1061
+ if (n.transitions !== null)
1062
+ for (const c of n.transitions)
1063
+ (c.is_global || t) && c.in();
1064
+ }
1065
+ }
1066
+ function Jn(n, t) {
1067
+ for (var i = n.nodes_start, s = n.nodes_end; i !== null; ) {
1068
+ var l = i === s ? null : (
1069
+ /** @type {TemplateNode} */
1070
+ /* @__PURE__ */ It(i)
1071
+ );
1072
+ t.append(i), i = l;
1073
+ }
1074
+ }
1075
+ let be = !1;
1076
+ function Wt(n) {
1077
+ be = n;
1078
+ }
1079
+ let me = !1;
1080
+ function Vt(n) {
1081
+ me = n;
1082
+ }
1083
+ let R = null, X = !1;
1084
+ function te(n) {
1085
+ R = n;
1086
+ }
1087
+ let b = null;
1088
+ function _e(n) {
1089
+ b = n;
1090
+ }
1091
+ let ie = null;
1092
+ function Xn(n) {
1093
+ R !== null && (ie === null ? ie = [n] : ie.push(n));
291
1094
  }
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);
1095
+ let V = null, Y = 0, G = null;
1096
+ function Zn(n) {
1097
+ G = n;
1098
+ }
1099
+ let Ir = 1, De = 0, ge = De;
1100
+ function Ht(n) {
1101
+ ge = n;
1102
+ }
1103
+ let he = !1;
1104
+ function Sr() {
1105
+ return ++Ir;
1106
+ }
1107
+ function $e(n) {
1108
+ var t = n.f;
1109
+ if ((t & z) !== 0)
1110
+ return !0;
1111
+ if ((t & ae) !== 0) {
1112
+ var i = n.deps, s = (t & Q) !== 0;
1113
+ if (t & W && (n.f &= ~Ge), i !== null) {
1114
+ var l, c, h = (t & Ye) !== 0, u = s && b !== null && !he, p = i.length;
1115
+ if ((h || u) && (b === null || (b.f & ne) === 0)) {
1116
+ var _ = (
1117
+ /** @type {Derived} */
1118
+ n
1119
+ ), g = _.parent;
1120
+ for (l = 0; l < p; l++)
1121
+ c = i[l], (h || !c?.reactions?.includes(_)) && (c.reactions ??= []).push(_);
1122
+ h && (_.f ^= Ye), u && g !== null && (g.f & Q) === 0 && (_.f ^= Q);
1123
+ }
1124
+ for (l = 0; l < p; l++)
1125
+ if (c = i[l], $e(
1126
+ /** @type {Derived} */
1127
+ c
1128
+ ) && hr(
1129
+ /** @type {Derived} */
1130
+ c
1131
+ ), c.wv > n.wv)
1132
+ return !0;
1133
+ }
1134
+ (!s || b !== null && !he) && j(n, q);
1135
+ }
1136
+ return !1;
1137
+ }
1138
+ function Fr(n, t, i = !0) {
1139
+ var s = n.reactions;
1140
+ if (s !== null && !ie?.includes(n))
1141
+ for (var l = 0; l < s.length; l++) {
1142
+ var c = s[l];
1143
+ (c.f & W) !== 0 ? Fr(
1144
+ /** @type {Derived} */
1145
+ c,
1146
+ t,
1147
+ !1
1148
+ ) : t === c && (i ? j(c, z) : (c.f & q) !== 0 && j(c, ae), we(
1149
+ /** @type {Effect} */
1150
+ c
1151
+ ));
1152
+ }
1153
+ }
1154
+ function Rr(n) {
1155
+ var t = V, i = Y, s = G, l = R, c = he, h = ie, u = $, p = X, _ = ge, g = n.f;
1156
+ V = /** @type {null | Value[]} */
1157
+ null, Y = 0, G = null, he = (g & Q) !== 0 && (X || !be || R === null), R = (g & (se | Ae)) === 0 ? n : null, ie = null, Qe(n.ctx), X = !1, ge = ++De, n.ac !== null && (St(() => {
1158
+ n.ac.abort(Ie);
1159
+ }), n.ac = null);
1160
+ try {
1161
+ n.f |= st;
1162
+ var E = (
1163
+ /** @type {Function} */
1164
+ n.fn
1165
+ ), m = E(), v = n.deps;
1166
+ if (V !== null) {
1167
+ var w;
1168
+ if (Xe(n, Y), v !== null && Y > 0)
1169
+ for (v.length = Y + V.length, w = 0; w < V.length; w++)
1170
+ v[Y + w] = V[w];
1171
+ else
1172
+ n.deps = v = V;
1173
+ if (!he || // Deriveds that already have reactions can cleanup, so we still add them as reactions
1174
+ (g & W) !== 0 && /** @type {import('#client').Derived} */
1175
+ n.reactions !== null)
1176
+ for (w = Y; w < v.length; w++)
1177
+ (v[w].reactions ??= []).push(n);
1178
+ } else v !== null && Y < v.length && (Xe(n, Y), v.length = Y);
1179
+ if (Pe() && G !== null && !X && v !== null && (n.f & (W | ae | z)) === 0)
1180
+ for (w = 0; w < /** @type {Source[]} */
1181
+ G.length; w++)
1182
+ Fr(
1183
+ G[w],
1184
+ /** @type {Effect} */
1185
+ n
1186
+ );
1187
+ return l !== null && l !== n && (De++, G !== null && (s === null ? s = G : s.push(.../** @type {Source[]} */
1188
+ G))), (n.f & ve) !== 0 && (n.f ^= ve), m;
1189
+ } catch (x) {
1190
+ return Fn(x);
1191
+ } finally {
1192
+ n.f ^= st, V = t, Y = i, G = s, R = l, he = c, ie = h, Qe(u), X = p, ge = _;
1193
+ }
1194
+ }
1195
+ function ei(n, t) {
1196
+ let i = t.reactions;
1197
+ if (i !== null) {
1198
+ var s = sn.call(i, n);
1199
+ if (s !== -1) {
1200
+ var l = i.length - 1;
1201
+ l === 0 ? i = t.reactions = null : (i[s] = i[l], i.pop());
1202
+ }
1203
+ }
1204
+ i === null && (t.f & W) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1205
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1206
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1207
+ (V === null || !V.includes(t)) && (j(t, ae), (t.f & (Q | Ye)) === 0 && (t.f ^= Ye), cr(
1208
+ /** @type {Derived} **/
1209
+ t
1210
+ ), Xe(
1211
+ /** @type {Derived} **/
1212
+ t,
1213
+ 0
1214
+ ));
1215
+ }
1216
+ function Xe(n, t) {
1217
+ var i = n.deps;
1218
+ if (i !== null)
1219
+ for (var s = t; s < i.length; s++)
1220
+ ei(n, i[s]);
1221
+ }
1222
+ function ke(n) {
1223
+ var t = n.f;
1224
+ if ((t & ne) === 0) {
1225
+ j(n, q);
1226
+ var i = b, s = be;
1227
+ b = n, be = !0;
1228
+ try {
1229
+ (t & oe) !== 0 ? zn(n) : mr(n), wr(n);
1230
+ var l = Rr(n);
1231
+ n.teardown = typeof l == "function" ? l : null, n.wv = Ir;
1232
+ var c;
1233
+ tr && Kr && (n.f & z) !== 0 && n.deps;
1234
+ } finally {
1235
+ be = s, b = i;
1236
+ }
1237
+ }
1238
+ }
1239
+ function Z(n) {
1240
+ var t = n.f, i = (t & W) !== 0;
1241
+ if (R !== null && !X) {
1242
+ var s = b !== null && (b.f & ne) !== 0;
1243
+ if (!s && !ie?.includes(n)) {
1244
+ var l = R.deps;
1245
+ if ((R.f & st) !== 0)
1246
+ n.rv < De && (n.rv = De, V === null && l !== null && l[Y] === n ? Y++ : V === null ? V = [n] : (!he || !V.includes(n)) && V.push(n));
1247
+ else {
1248
+ (R.deps ??= []).push(n);
1249
+ var c = n.reactions;
1250
+ c === null ? n.reactions = [R] : c.includes(R) || c.push(R);
1251
+ }
1252
+ }
1253
+ } else if (i && /** @type {Derived} */
1254
+ n.deps === null && /** @type {Derived} */
1255
+ n.effects === null) {
1256
+ var h = (
1257
+ /** @type {Derived} */
1258
+ n
1259
+ ), u = h.parent;
1260
+ u !== null && (u.f & Q) === 0 && (h.f ^= Q);
1261
+ }
1262
+ if (me) {
1263
+ if (de.has(n))
1264
+ return de.get(n);
1265
+ if (i) {
1266
+ h = /** @type {Derived} */
1267
+ n;
1268
+ var p = h.v;
1269
+ return ((h.f & q) === 0 && h.reactions !== null || br(h)) && (p = Bt(h)), de.set(h, p), p;
1270
+ }
1271
+ } else if (i) {
1272
+ if (h = /** @type {Derived} */
1273
+ n, K?.has(h))
1274
+ return K.get(h);
1275
+ $e(h) && hr(h);
1276
+ }
1277
+ if (K?.has(n))
1278
+ return K.get(n);
1279
+ if ((n.f & ve) !== 0)
1280
+ throw n.v;
1281
+ return n.v;
1282
+ }
1283
+ function br(n) {
1284
+ if (n.v === N) return !0;
1285
+ if (n.deps === null) return !1;
1286
+ for (const t of n.deps)
1287
+ if (de.has(t) || (t.f & W) !== 0 && br(
1288
+ /** @type {Derived} */
1289
+ t
1290
+ ))
1291
+ return !0;
1292
+ return !1;
1293
+ }
1294
+ function Me(n) {
1295
+ var t = X;
1296
+ try {
1297
+ return X = !0, n();
1298
+ } finally {
1299
+ X = t;
1300
+ }
1301
+ }
1302
+ const ti = -7169;
1303
+ function j(n, t) {
1304
+ n.f = n.f & ti | t;
1305
+ }
1306
+ function ht(n) {
1307
+ if (!(typeof n != "object" || !n || n instanceof EventTarget)) {
1308
+ if (Re in n)
1309
+ dt(n);
1310
+ else if (!Array.isArray(n))
1311
+ for (let t in n) {
1312
+ const i = n[t];
1313
+ typeof i == "object" && i && Re in i && dt(i);
1314
+ }
1315
+ }
1316
+ }
1317
+ function dt(n, t = /* @__PURE__ */ new Set()) {
1318
+ if (typeof n == "object" && n !== null && // We don't want to traverse DOM elements
1319
+ !(n instanceof EventTarget) && !t.has(n)) {
1320
+ t.add(n), n instanceof Date && n.getTime();
1321
+ for (let s in n)
1322
+ try {
1323
+ dt(n[s], t);
1324
+ } catch {
1325
+ }
1326
+ const i = _t(n);
1327
+ if (i !== Object.prototype && i !== Array.prototype && i !== Map.prototype && i !== Set.prototype && i !== Date.prototype) {
1328
+ const s = rr(i);
1329
+ for (let l in s) {
1330
+ const c = s[l].get;
1331
+ if (c)
1332
+ try {
1333
+ c.call(n);
1334
+ } catch {
1335
+ }
1336
+ }
1337
+ }
1338
+ }
1339
+ }
1340
+ function ri(n, t, i, s = {}) {
1341
+ function l(c) {
1342
+ if (s.capture || ii.call(t, c), !c.cancelBubble)
1343
+ return St(() => i?.call(this, c));
1344
+ }
1345
+ return n.startsWith("pointer") || n.startsWith("touch") || n === "wheel" ? ar(() => {
1346
+ t.addEventListener(n, l, s);
1347
+ }) : t.addEventListener(n, l, s), l;
1348
+ }
1349
+ function ni(n, t, i, s, l) {
1350
+ var c = { capture: s, passive: l }, h = ri(n, t, i, c);
1351
+ (t === document.body || // @ts-ignore
1352
+ t === window || // @ts-ignore
1353
+ t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
1354
+ t instanceof HTMLMediaElement) && vr(() => {
1355
+ t.removeEventListener(n, h, c);
1356
+ });
1357
+ }
1358
+ let zt = null;
1359
+ function ii(n) {
1360
+ var t = this, i = (
1361
+ /** @type {Node} */
1362
+ t.ownerDocument
1363
+ ), s = n.type, l = n.composedPath?.() || [], c = (
1364
+ /** @type {null | Element} */
1365
+ l[0] || n.target
1366
+ );
1367
+ zt = n;
1368
+ var h = 0, u = zt === n && n.__root;
1369
+ if (u) {
1370
+ var p = l.indexOf(u);
1371
+ if (p !== -1 && (t === document || t === /** @type {any} */
1372
+ window)) {
1373
+ n.__root = t;
1374
+ return;
332
1375
  }
1376
+ var _ = l.indexOf(t);
1377
+ if (_ === -1)
1378
+ return;
1379
+ p <= _ && (h = p);
1380
+ }
1381
+ if (c = /** @type {Element} */
1382
+ l[h] || n.target, c !== t) {
1383
+ an(n, "currentTarget", {
1384
+ configurable: !0,
1385
+ get() {
1386
+ return c || i;
1387
+ }
1388
+ });
1389
+ var g = R, E = b;
1390
+ te(null), _e(null);
1391
+ try {
1392
+ for (var m, v = []; c !== null; ) {
1393
+ var w = c.assignedSlot || c.parentNode || /** @type {any} */
1394
+ c.host || null;
1395
+ try {
1396
+ var x = c["__" + s];
1397
+ x != null && (!/** @type {any} */
1398
+ c.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1399
+ // -> the target could not have been disabled because it emits the event in the first place
1400
+ n.target === c) && x.call(c, n);
1401
+ } catch (S) {
1402
+ m ? v.push(S) : m = S;
1403
+ }
1404
+ if (n.cancelBubble || w === t || w === null)
1405
+ break;
1406
+ c = w;
1407
+ }
1408
+ if (m) {
1409
+ for (let S of v)
1410
+ queueMicrotask(() => {
1411
+ throw S;
1412
+ });
1413
+ throw m;
1414
+ }
1415
+ } finally {
1416
+ n.__root = t, delete n.currentTarget, te(g), _e(E);
1417
+ }
1418
+ }
1419
+ }
1420
+ function oi(n) {
1421
+ var t = document.createElement("template");
1422
+ return t.innerHTML = n.replaceAll("<!>", "<!---->"), t.content;
1423
+ }
1424
+ function Yt(n, t) {
1425
+ var i = (
1426
+ /** @type {Effect} */
1427
+ b
1428
+ );
1429
+ i.nodes_start === null && (i.nodes_start = n, i.nodes_end = t);
1430
+ }
1431
+ // @__NO_SIDE_EFFECTS__
1432
+ function Ar(n, t) {
1433
+ var i = (t & tn) !== 0, s = (t & rn) !== 0, l, c = !n.startsWith("<!>");
1434
+ return () => {
1435
+ l === void 0 && (l = oi(c ? n : "<!>" + n), i || (l = /** @type {Node} */
1436
+ /* @__PURE__ */ ft(l)));
1437
+ var h = (
1438
+ /** @type {TemplateNode} */
1439
+ s || Dn ? document.importNode(l, !0) : l.cloneNode(!0)
1440
+ );
1441
+ if (i) {
1442
+ var u = (
1443
+ /** @type {TemplateNode} */
1444
+ /* @__PURE__ */ ft(h)
1445
+ ), p = (
1446
+ /** @type {TemplateNode} */
1447
+ h.lastChild
1448
+ );
1449
+ Yt(u, p);
1450
+ } else
1451
+ Yt(h, h);
1452
+ return h;
333
1453
  };
334
1454
  }
335
- function kt(s) {
336
- let r, o, h, l, d, p, a = (
337
- /*isCloseButton*/
338
- s[1] && ke(s)
1455
+ function Cr(n, t) {
1456
+ n !== null && n.before(
1457
+ /** @type {Node} */
1458
+ t
339
1459
  );
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();
1460
+ }
1461
+ class si {
1462
+ /** @type {TemplateNode} */
1463
+ anchor;
1464
+ /** @type {Map<Batch, Key>} */
1465
+ #t = /* @__PURE__ */ new Map();
1466
+ /** @type {Map<Key, Effect>} */
1467
+ #r = /* @__PURE__ */ new Map();
1468
+ /** @type {Map<Key, Branch>} */
1469
+ #e = /* @__PURE__ */ new Map();
1470
+ /**
1471
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
1472
+ * This is necessary for `<svelte:element>`
1473
+ */
1474
+ #n = !0;
1475
+ /**
1476
+ * @param {TemplateNode} anchor
1477
+ * @param {boolean} transition
1478
+ */
1479
+ constructor(t, i = !0) {
1480
+ this.anchor = t, this.#n = i;
1481
+ }
1482
+ #o = () => {
1483
+ var t = (
1484
+ /** @type {Batch} */
1485
+ P
1486
+ );
1487
+ if (this.#t.has(t)) {
1488
+ var i = (
1489
+ /** @type {Key} */
1490
+ this.#t.get(t)
1491
+ ), s = this.#r.get(i);
1492
+ if (s)
1493
+ Kn(s);
1494
+ else {
1495
+ var l = this.#e.get(i);
1496
+ l && (this.#r.set(i, l.effect), this.#e.delete(i), l.fragment.lastChild.remove(), this.anchor.before(l.fragment), s = l.effect);
1497
+ }
1498
+ for (const [c, h] of this.#t) {
1499
+ if (this.#t.delete(c), c === t)
1500
+ break;
1501
+ const u = this.#e.get(h);
1502
+ u && (pe(u.effect), this.#e.delete(h));
1503
+ }
1504
+ for (const [c, h] of this.#r) {
1505
+ if (c === i) continue;
1506
+ const u = () => {
1507
+ if (Array.from(this.#t.values()).includes(c)) {
1508
+ var _ = document.createDocumentFragment();
1509
+ Jn(h, _), _.append(qt()), this.#e.set(c, { effect: h, fragment: _ });
1510
+ } else
1511
+ pe(h);
1512
+ this.#r.delete(c);
1513
+ };
1514
+ this.#n || !s ? Gn(h, u, !1) : u();
1515
+ }
368
1516
  }
369
1517
  };
1518
+ /**
1519
+ * @param {Batch} batch
1520
+ */
1521
+ #s = (t) => {
1522
+ this.#t.delete(t);
1523
+ const i = Array.from(this.#t.values());
1524
+ for (const [s, l] of this.#e)
1525
+ i.includes(s) || (pe(l.effect), this.#e.delete(s));
1526
+ };
1527
+ /**
1528
+ *
1529
+ * @param {any} key
1530
+ * @param {null | ((target: TemplateNode) => void)} fn
1531
+ */
1532
+ ensure(t, i) {
1533
+ var s = (
1534
+ /** @type {Batch} */
1535
+ P
1536
+ ), l = $n();
1537
+ if (i && !this.#r.has(t) && !this.#e.has(t))
1538
+ if (l) {
1539
+ var c = document.createDocumentFragment(), h = qt();
1540
+ c.append(h), this.#e.set(t, {
1541
+ effect: jt(() => i(h)),
1542
+ fragment: c
1543
+ });
1544
+ } else
1545
+ this.#r.set(
1546
+ t,
1547
+ jt(() => i(this.anchor))
1548
+ );
1549
+ if (this.#t.set(s, t), l) {
1550
+ for (const [u, p] of this.#r)
1551
+ u === t ? s.skipped_effects.delete(p) : s.skipped_effects.add(p);
1552
+ for (const [u, p] of this.#e)
1553
+ u === t ? s.skipped_effects.delete(p.effect) : s.skipped_effects.add(p.effect);
1554
+ s.oncommit(this.#o), s.ondiscard(this.#s);
1555
+ } else
1556
+ this.#o();
1557
+ }
370
1558
  }
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
1559
+ function ai(n) {
1560
+ $ === null && or(), Le && $.l !== null ? ui($).m.push(n) : ct(() => {
1561
+ const t = Me(n);
1562
+ if (typeof t == "function") return (
1563
+ /** @type {() => void} */
1564
+ t
391
1565
  );
1566
+ });
1567
+ }
1568
+ function li(n) {
1569
+ $ === null && or(), ai(() => () => Me(n));
1570
+ }
1571
+ function ui(n) {
1572
+ var t = (
1573
+ /** @type {ComponentContextLegacy} */
1574
+ n.l
1575
+ );
1576
+ return t.u ??= { a: [], b: [], m: [] };
1577
+ }
1578
+ function fi(n, t, i = !1) {
1579
+ var s = new si(n), l = i ? Oe : 0;
1580
+ function c(h, u) {
1581
+ s.ensure(h, u);
1582
+ }
1583
+ Hn(() => {
1584
+ var h = !1;
1585
+ t((u, p = !0) => {
1586
+ h = !0, c(p, u);
1587
+ }), h || c(!1, null);
1588
+ }, l);
1589
+ }
1590
+ function Tr(n, t) {
1591
+ jn(() => {
1592
+ var i = n.getRootNode(), s = (
1593
+ /** @type {ShadowRoot} */
1594
+ i.host ? (
1595
+ /** @type {ShadowRoot} */
1596
+ i
1597
+ ) : (
1598
+ /** @type {Document} */
1599
+ i.head ?? /** @type {Document} */
1600
+ i.ownerDocument.head
1601
+ )
1602
+ );
1603
+ if (!s.querySelector("#" + t.hash)) {
1604
+ const l = document.createElement("style");
1605
+ l.id = t.hash, l.textContent = t.code, s.appendChild(l);
1606
+ }
1607
+ });
1608
+ }
1609
+ const ci = Symbol("is custom element"), hi = Symbol("is html");
1610
+ function Gt(n, t, i, s) {
1611
+ var l = di(n);
1612
+ l[t] !== (l[t] = i) && (i == null ? n.removeAttribute(t) : typeof i != "string" && pi(n).includes(t) ? n[t] = i : n.setAttribute(t, i));
1613
+ }
1614
+ function di(n) {
1615
+ return (
1616
+ /** @type {Record<string | symbol, unknown>} **/
1617
+ // @ts-expect-error
1618
+ n.__attributes ??= {
1619
+ [ci]: n.nodeName.includes("-"),
1620
+ [hi]: n.namespaceURI === nn
1621
+ }
1622
+ );
1623
+ }
1624
+ var Qt = /* @__PURE__ */ new Map();
1625
+ function pi(n) {
1626
+ var t = n.getAttribute("is") || n.nodeName, i = Qt.get(t);
1627
+ if (i) return i;
1628
+ Qt.set(t, i = []);
1629
+ for (var s, l = n, c = Element.prototype; c !== l; ) {
1630
+ s = rr(l);
1631
+ for (var h in s)
1632
+ s[h].set && i.push(h);
1633
+ l = _t(l);
1634
+ }
1635
+ return i;
1636
+ }
1637
+ function _i(n = !1) {
1638
+ const t = (
1639
+ /** @type {ComponentContextLegacy} */
1640
+ $
1641
+ ), i = t.l.u;
1642
+ if (!i) return;
1643
+ let s = () => ht(t.s);
1644
+ if (n) {
1645
+ let l = 0, c = (
1646
+ /** @type {Record<string, any>} */
1647
+ {}
1648
+ );
1649
+ const h = /* @__PURE__ */ xt(() => {
1650
+ let u = !1;
1651
+ const p = t.s;
1652
+ for (const _ in p)
1653
+ p[_] !== c[_] && (c[_] = p[_], u = !0);
1654
+ return u && l++, l;
1655
+ });
1656
+ s = () => Z(h);
1657
+ }
1658
+ i.b.length && qn(() => {
1659
+ Kt(t, s), ot(i.b);
1660
+ }), ct(() => {
1661
+ const l = Me(() => i.m.map(fn));
1662
+ return () => {
1663
+ for (const c of l)
1664
+ typeof c == "function" && c();
1665
+ };
1666
+ }), i.a.length && ct(() => {
1667
+ Kt(t, s), ot(i.a);
1668
+ });
1669
+ }
1670
+ function Kt(n, t) {
1671
+ if (n.l.s)
1672
+ for (const i of n.l.s) Z(i);
1673
+ t();
1674
+ }
1675
+ let je = !1;
1676
+ function yi(n) {
1677
+ var t = je;
1678
+ try {
1679
+ return je = !1, [n(), je];
1680
+ } finally {
1681
+ je = t;
392
1682
  }
393
1683
  }
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);
1684
+ function He(n, t, i, s) {
1685
+ var l = !Le || (i & Xr) !== 0, c = (i & en) !== 0, h = (
1686
+ /** @type {V} */
1687
+ s
1688
+ ), u = !0, p = () => (u && (u = !1, h = /** @type {V} */
1689
+ s), h), _;
1690
+ {
1691
+ var g = Re in n || hn in n;
1692
+ _ = Ve(n, t)?.set ?? (g && t in n ? (B) => n[t] = B : void 0);
1693
+ }
1694
+ var E, m = !1;
1695
+ [E, m] = yi(() => (
1696
+ /** @type {V} */
1697
+ n[t]
1698
+ ));
1699
+ var v;
1700
+ if (l ? v = () => {
1701
+ var B = (
1702
+ /** @type {V} */
1703
+ n[t]
1704
+ );
1705
+ return B === void 0 ? p() : (u = !0, B);
1706
+ } : v = () => {
1707
+ var B = (
1708
+ /** @type {V} */
1709
+ n[t]
1710
+ );
1711
+ return B !== void 0 && (h = /** @type {V} */
1712
+ void 0), B === void 0 ? h : B;
1713
+ }, l && (i & Zr) === 0)
1714
+ return v;
1715
+ if (_) {
1716
+ var w = n.$$legacy;
1717
+ return (
1718
+ /** @type {() => V} */
1719
+ (function(B, T) {
1720
+ return arguments.length > 0 ? ((!l || !T || w || m) && _(T ? v() : B), B) : v();
1721
+ })
1722
+ );
1723
+ }
1724
+ var x = !1, S = /* @__PURE__ */ fr(() => (x = !1, v()));
1725
+ Z(S);
1726
+ var A = (
1727
+ /** @type {Effect} */
1728
+ b
1729
+ );
1730
+ return (
1731
+ /** @type {() => V} */
1732
+ (function(B, T) {
1733
+ if (arguments.length > 0) {
1734
+ const M = T ? Z(S) : l && c ? Fe(B) : B;
1735
+ return fe(S, M), x = !0, h !== void 0 && (h = M), B;
1736
+ }
1737
+ return me && x || (A.f & ne) !== 0 ? S.v : Z(S);
1738
+ })
1739
+ );
1740
+ }
1741
+ var vi = /* @__PURE__ */ Ar('<div class="cscanapp-close svelte-degygl" role="button" tabindex="0"></div>');
1742
+ const gi = {
1743
+ hash: "svelte-degygl",
1744
+ code: `.cscanapp-close.svelte-degygl {position:absolute;z-index:10;right:5px;top:5px;width:32px;height:32px;opacity:0.3;cursor:pointer;}.cscanapp-close.svelte-degygl:hover {opacity:1;}.cscanapp-close.svelte-degygl:before,
1745
+ .cscanapp-close.svelte-degygl:after {position:absolute;left:15px;content:' ';height:33px;width:2px;background-color:#000;}.cscanapp-close.svelte-degygl:before {transform:rotate(45deg);}.cscanapp-close.svelte-degygl:after {transform:rotate(-45deg);}`
458
1746
  };
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;
1747
+ function wi(n, t) {
1748
+ Tr(n, gi);
1749
+ let i = He(t, "close", 8);
1750
+ var s = vi();
1751
+ ni("click", s, function(...l) {
1752
+ i()?.apply(this, l);
1753
+ }), Cr(n, s);
1754
+ }
1755
+ var mi = /* @__PURE__ */ Ar('<div class="cscanapp svelte-168e0l4"><!> <video class="svelte-168e0l4"></video></div>', 2);
1756
+ const Ei = {
1757
+ hash: "svelte-168e0l4",
1758
+ code: ".cscanapp.svelte-168e0l4 {position:relative;width:100%;height:100%;border-radius:inherit;}.cscanapp.svelte-168e0l4 video:where(.svelte-168e0l4) {width:100%;height:100%;object-fit:cover;position:absolute;border-radius:inherit;display:block;}"
466
1759
  };
1760
+ function xi(n, t) {
1761
+ Bn(t, !1), Tr(n, Ei);
1762
+ let i = He(t, "close", 8), s = He(t, "isCloseButton", 8), l = He(t, "scannerElements", 8);
1763
+ li(i()), _i();
1764
+ var c = mi(), h = Ln(c);
1765
+ {
1766
+ var u = (_) => {
1767
+ wi(_, {
1768
+ get close() {
1769
+ return i();
1770
+ }
1771
+ });
1772
+ };
1773
+ fi(h, (_) => {
1774
+ s() && _(u);
1775
+ });
1776
+ }
1777
+ var p = Pn(h, 2);
1778
+ Vn(() => {
1779
+ Gt(c, "id", (ht(l()), Me(() => l().ROOT))), Gt(p, "id", (ht(l()), Me(() => l().VIDEO)));
1780
+ }), Cr(n, c), In();
1781
+ }
1782
+ var Be = /* @__PURE__ */ ((n) => (n.CAPTURE = "capture", n.ERROR = "error", n.CANCEL = "cancel", n))(Be || {}), ze = /* @__PURE__ */ ((n) => (n.ROOT = "cscanapp", n.VIDEO = "cscanappVideo", n))(ze || {}), it = {}, Te = {}, Jt;
1783
+ function Bi() {
1784
+ if (Jt) return Te;
1785
+ Jt = 1, Te.byteLength = u, Te.toByteArray = _, Te.fromByteArray = m;
1786
+ for (var n = [], t = [], i = typeof Uint8Array < "u" ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = 0, c = s.length; l < c; ++l)
1787
+ n[l] = s[l], t[s.charCodeAt(l)] = l;
1788
+ t[45] = 62, t[95] = 63;
1789
+ function h(v) {
1790
+ var w = v.length;
1791
+ if (w % 4 > 0)
1792
+ throw new Error("Invalid string. Length must be a multiple of 4");
1793
+ var x = v.indexOf("=");
1794
+ x === -1 && (x = w);
1795
+ var S = x === w ? 0 : 4 - x % 4;
1796
+ return [x, S];
1797
+ }
1798
+ function u(v) {
1799
+ var w = h(v), x = w[0], S = w[1];
1800
+ return (x + S) * 3 / 4 - S;
1801
+ }
1802
+ function p(v, w, x) {
1803
+ return (w + x) * 3 / 4 - x;
1804
+ }
1805
+ function _(v) {
1806
+ var w, x = h(v), S = x[0], A = x[1], B = new i(p(v, S, A)), T = 0, M = A > 0 ? S - 4 : S, k;
1807
+ for (k = 0; k < M; k += 4)
1808
+ w = t[v.charCodeAt(k)] << 18 | t[v.charCodeAt(k + 1)] << 12 | t[v.charCodeAt(k + 2)] << 6 | t[v.charCodeAt(k + 3)], B[T++] = w >> 16 & 255, B[T++] = w >> 8 & 255, B[T++] = w & 255;
1809
+ return A === 2 && (w = t[v.charCodeAt(k)] << 2 | t[v.charCodeAt(k + 1)] >> 4, B[T++] = w & 255), A === 1 && (w = t[v.charCodeAt(k)] << 10 | t[v.charCodeAt(k + 1)] << 4 | t[v.charCodeAt(k + 2)] >> 2, B[T++] = w >> 8 & 255, B[T++] = w & 255), B;
1810
+ }
1811
+ function g(v) {
1812
+ return n[v >> 18 & 63] + n[v >> 12 & 63] + n[v >> 6 & 63] + n[v & 63];
1813
+ }
1814
+ function E(v, w, x) {
1815
+ for (var S, A = [], B = w; B < x; B += 3)
1816
+ S = (v[B] << 16 & 16711680) + (v[B + 1] << 8 & 65280) + (v[B + 2] & 255), A.push(g(S));
1817
+ return A.join("");
1818
+ }
1819
+ function m(v) {
1820
+ for (var w, x = v.length, S = x % 3, A = [], B = 16383, T = 0, M = x - S; T < M; T += B)
1821
+ A.push(E(v, T, T + B > M ? M : T + B));
1822
+ return S === 1 ? (w = v[x - 1], A.push(
1823
+ n[w >> 2] + n[w << 4 & 63] + "=="
1824
+ )) : S === 2 && (w = (v[x - 2] << 8) + v[x - 1], A.push(
1825
+ n[w >> 10] + n[w >> 4 & 63] + n[w << 2 & 63] + "="
1826
+ )), A.join("");
1827
+ }
1828
+ return Te;
1829
+ }
1830
+ var We = {};
1831
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
1832
+ var Xt;
1833
+ function Ii() {
1834
+ return Xt || (Xt = 1, We.read = function(n, t, i, s, l) {
1835
+ var c, h, u = l * 8 - s - 1, p = (1 << u) - 1, _ = p >> 1, g = -7, E = i ? l - 1 : 0, m = i ? -1 : 1, v = n[t + E];
1836
+ for (E += m, c = v & (1 << -g) - 1, v >>= -g, g += u; g > 0; c = c * 256 + n[t + E], E += m, g -= 8)
1837
+ ;
1838
+ for (h = c & (1 << -g) - 1, c >>= -g, g += s; g > 0; h = h * 256 + n[t + E], E += m, g -= 8)
1839
+ ;
1840
+ if (c === 0)
1841
+ c = 1 - _;
1842
+ else {
1843
+ if (c === p)
1844
+ return h ? NaN : (v ? -1 : 1) * (1 / 0);
1845
+ h = h + Math.pow(2, s), c = c - _;
1846
+ }
1847
+ return (v ? -1 : 1) * h * Math.pow(2, c - s);
1848
+ }, We.write = function(n, t, i, s, l, c) {
1849
+ var h, u, p, _ = c * 8 - l - 1, g = (1 << _) - 1, E = g >> 1, m = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, v = s ? 0 : c - 1, w = s ? 1 : -1, x = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
1850
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, h = g) : (h = Math.floor(Math.log(t) / Math.LN2), t * (p = Math.pow(2, -h)) < 1 && (h--, p *= 2), h + E >= 1 ? t += m / p : t += m * Math.pow(2, 1 - E), t * p >= 2 && (h++, p /= 2), h + E >= g ? (u = 0, h = g) : h + E >= 1 ? (u = (t * p - 1) * Math.pow(2, l), h = h + E) : (u = t * Math.pow(2, E - 1) * Math.pow(2, l), h = 0)); l >= 8; n[i + v] = u & 255, v += w, u /= 256, l -= 8)
1851
+ ;
1852
+ for (h = h << l | u, _ += l; _ > 0; n[i + v] = h & 255, v += w, h /= 256, _ -= 8)
1853
+ ;
1854
+ n[i + v - w] |= x * 128;
1855
+ }), We;
1856
+ }
467
1857
  /*!
468
1858
  * The buffer module from node.js, for the browser.
469
1859
  *
470
1860
  * @author Feross Aboukhadijeh <https://feross.org>
471
1861
  * @license MIT
472
1862
  */
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;
1863
+ var Zt;
1864
+ function Si() {
1865
+ return Zt || (Zt = 1, (function(n) {
1866
+ const t = Bi(), i = Ii(), s = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
1867
+ n.Buffer = u, n.SlowBuffer = B, n.INSPECT_MAX_BYTES = 50;
1868
+ const l = 2147483647;
1869
+ n.kMaxLength = l, u.TYPED_ARRAY_SUPPORT = c(), !u.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
1870
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
1871
+ );
1872
+ function c() {
1873
+ try {
1874
+ const o = new Uint8Array(1), e = { foo: function() {
1875
+ return 42;
1876
+ } };
1877
+ return Object.setPrototypeOf(e, Uint8Array.prototype), Object.setPrototypeOf(o, e), o.foo() === 42;
1878
+ } catch {
1879
+ return !1;
1880
+ }
488
1881
  }
489
- }
490
- Object.defineProperty(a.prototype, "parent", {
491
- enumerable: !0,
492
- get: function() {
493
- if (a.isBuffer(this))
494
- return this.buffer;
1882
+ Object.defineProperty(u.prototype, "parent", {
1883
+ enumerable: !0,
1884
+ get: function() {
1885
+ if (u.isBuffer(this))
1886
+ return this.buffer;
1887
+ }
1888
+ }), Object.defineProperty(u.prototype, "offset", {
1889
+ enumerable: !0,
1890
+ get: function() {
1891
+ if (u.isBuffer(this))
1892
+ return this.byteOffset;
1893
+ }
1894
+ });
1895
+ function h(o) {
1896
+ if (o > l)
1897
+ throw new RangeError('The value "' + o + '" is invalid for option "size"');
1898
+ const e = new Uint8Array(o);
1899
+ return Object.setPrototypeOf(e, u.prototype), e;
495
1900
  }
496
- }), Object.defineProperty(a.prototype, "offset", {
497
- enumerable: !0,
498
- get: function() {
499
- if (a.isBuffer(this))
500
- return this.byteOffset;
1901
+ function u(o, e, r) {
1902
+ if (typeof o == "number") {
1903
+ if (typeof e == "string")
1904
+ throw new TypeError(
1905
+ 'The "string" argument must be of type string. Received type number'
1906
+ );
1907
+ return E(o);
1908
+ }
1909
+ return p(o, e, r);
501
1910
  }
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")
1911
+ u.poolSize = 8192;
1912
+ function p(o, e, r) {
1913
+ if (typeof o == "string")
1914
+ return m(o, e);
1915
+ if (ArrayBuffer.isView(o))
1916
+ return w(o);
1917
+ if (o == null)
512
1918
  throw new TypeError(
513
- 'The "string" argument must be of type string. Received type number'
1919
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof o
514
1920
  );
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))
1921
+ if (J(o, ArrayBuffer) || o && J(o.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (J(o, SharedArrayBuffer) || o && J(o.buffer, SharedArrayBuffer)))
1922
+ return x(o, e, r);
1923
+ if (typeof o == "number")
1924
+ throw new TypeError(
1925
+ 'The "value" argument must not be of type number. Received type number'
1926
+ );
1927
+ const a = o.valueOf && o.valueOf();
1928
+ if (a != null && a !== o)
1929
+ return u.from(a, e, r);
1930
+ const f = S(o);
1931
+ if (f) return f;
1932
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof o[Symbol.toPrimitive] == "function")
1933
+ return u.from(o[Symbol.toPrimitive]("string"), e, r);
621
1934
  throw new TypeError(
622
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
1935
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof o
623
1936
  );
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;
1937
+ }
1938
+ u.from = function(o, e, r) {
1939
+ return p(o, e, r);
1940
+ }, Object.setPrototypeOf(u.prototype, Uint8Array.prototype), Object.setPrototypeOf(u, Uint8Array);
1941
+ function _(o) {
1942
+ if (typeof o != "number")
1943
+ throw new TypeError('"size" argument must be of type number');
1944
+ if (o < 0)
1945
+ throw new RangeError('The value "' + o + '" is invalid for option "size"');
1946
+ }
1947
+ function g(o, e, r) {
1948
+ return _(o), o <= 0 ? h(o) : e !== void 0 ? typeof r == "string" ? h(o).fill(e, r) : h(o).fill(e) : h(o);
1949
+ }
1950
+ u.alloc = function(o, e, r) {
1951
+ return g(o, e, r);
1952
+ };
1953
+ function E(o) {
1954
+ return _(o), h(o < 0 ? 0 : A(o) | 0);
1955
+ }
1956
+ u.allocUnsafe = function(o) {
1957
+ return E(o);
1958
+ }, u.allocUnsafeSlow = function(o) {
1959
+ return E(o);
1960
+ };
1961
+ function m(o, e) {
1962
+ if ((typeof e != "string" || e === "") && (e = "utf8"), !u.isEncoding(e))
1963
+ throw new TypeError("Unknown encoding: " + e);
1964
+ const r = T(o, e) | 0;
1965
+ let a = h(r);
1966
+ const f = a.write(o, e);
1967
+ return f !== r && (a = a.slice(0, f)), a;
1968
+ }
1969
+ function v(o) {
1970
+ const e = o.length < 0 ? 0 : A(o.length) | 0, r = h(e);
1971
+ for (let a = 0; a < e; a += 1)
1972
+ r[a] = o[a] & 255;
1973
+ return r;
1974
+ }
1975
+ function w(o) {
1976
+ if (J(o, Uint8Array)) {
1977
+ const e = new Uint8Array(o);
1978
+ return x(e.buffer, e.byteOffset, e.byteLength);
631
1979
  }
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;
1980
+ return v(o);
649
1981
  }
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;
1982
+ function x(o, e, r) {
1983
+ if (e < 0 || o.byteLength < e)
1984
+ throw new RangeError('"offset" is outside of buffer bounds');
1985
+ if (o.byteLength < e + (r || 0))
1986
+ throw new RangeError('"length" is outside of buffer bounds');
1987
+ let a;
1988
+ return e === void 0 && r === void 0 ? a = new Uint8Array(o) : r === void 0 ? a = new Uint8Array(o, e) : a = new Uint8Array(o, e, r), Object.setPrototypeOf(a, u.prototype), a;
674
1989
  }
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;
1990
+ function S(o) {
1991
+ if (u.isBuffer(o)) {
1992
+ const e = A(o.length) | 0, r = h(e);
1993
+ return r.length === 0 || o.copy(r, 0, 0, e), r;
712
1994
  }
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) {
1995
+ if (o.length !== void 0)
1996
+ return typeof o.length != "number" || rt(o.length) ? h(0) : v(o);
1997
+ if (o.type === "Buffer" && Array.isArray(o.data))
1998
+ return v(o.data);
1999
+ }
2000
+ function A(o) {
2001
+ if (o >= l)
2002
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
2003
+ return o | 0;
2004
+ }
2005
+ function B(o) {
2006
+ return +o != o && (o = 0), u.alloc(+o);
2007
+ }
2008
+ u.isBuffer = function(e) {
2009
+ return e != null && e._isBuffer === !0 && e !== u.prototype;
2010
+ }, u.compare = function(e, r) {
2011
+ if (J(e, Uint8Array) && (e = u.from(e, e.offset, e.byteLength)), J(r, Uint8Array) && (r = u.from(r, r.offset, r.byteLength)), !u.isBuffer(e) || !u.isBuffer(r))
2012
+ throw new TypeError(
2013
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
2014
+ );
2015
+ if (e === r) return 0;
2016
+ let a = e.length, f = r.length;
2017
+ for (let d = 0, y = Math.min(a, f); d < y; ++d)
2018
+ if (e[d] !== r[d]) {
2019
+ a = e[d], f = r[d];
2020
+ break;
2021
+ }
2022
+ return a < f ? -1 : f < a ? 1 : 0;
2023
+ }, u.isEncoding = function(e) {
2024
+ switch (String(e).toLowerCase()) {
721
2025
  case "hex":
722
- return nt(this, e, t);
723
2026
  case "utf8":
724
2027
  case "utf-8":
725
- return Fe(this, e, t);
726
2028
  case "ascii":
727
- return it(this, e, t);
728
2029
  case "latin1":
729
2030
  case "binary":
730
- return rt(this, e, t);
731
2031
  case "base64":
732
- return et(this, e, t);
733
2032
  case "ucs2":
734
2033
  case "ucs-2":
735
2034
  case "utf16le":
736
2035
  case "utf-16le":
737
- return ot(this, e, t);
2036
+ return !0;
738
2037
  default:
739
- if (n)
740
- throw new TypeError("Unknown encoding: " + i);
741
- i = (i + "").toLowerCase(), n = !0;
2038
+ return !1;
742
2039
  }
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;
2040
+ }, u.concat = function(e, r) {
2041
+ if (!Array.isArray(e))
2042
+ throw new TypeError('"list" argument must be an Array of Buffers');
2043
+ if (e.length === 0)
2044
+ return u.alloc(0);
2045
+ let a;
2046
+ if (r === void 0)
2047
+ for (r = 0, a = 0; a < e.length; ++a)
2048
+ r += e[a].length;
2049
+ const f = u.allocUnsafe(r);
2050
+ let d = 0;
2051
+ for (a = 0; a < e.length; ++a) {
2052
+ let y = e[a];
2053
+ if (J(y, Uint8Array))
2054
+ d + y.length > f.length ? (u.isBuffer(y) || (y = u.from(y)), y.copy(f, d)) : Uint8Array.prototype.set.call(
2055
+ f,
2056
+ y,
2057
+ d
2058
+ );
2059
+ else if (u.isBuffer(y))
2060
+ y.copy(f, d);
2061
+ else
2062
+ throw new TypeError('"list" argument must be an Array of Buffers');
2063
+ d += y.length;
802
2064
  }
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)
2065
+ return f;
2066
+ };
2067
+ function T(o, e) {
2068
+ if (u.isBuffer(o))
2069
+ return o.length;
2070
+ if (ArrayBuffer.isView(o) || J(o, ArrayBuffer))
2071
+ return o.byteLength;
2072
+ if (typeof o != "string")
2073
+ throw new TypeError(
2074
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof o
2075
+ );
2076
+ const r = o.length, a = arguments.length > 2 && arguments[2] === !0;
2077
+ if (!a && r === 0) return 0;
2078
+ let f = !1;
2079
+ for (; ; )
2080
+ switch (e) {
2081
+ case "ascii":
2082
+ case "latin1":
2083
+ case "binary":
2084
+ return r;
2085
+ case "utf8":
2086
+ case "utf-8":
2087
+ return tt(o).length;
2088
+ case "ucs2":
2089
+ case "ucs-2":
2090
+ case "utf16le":
2091
+ case "utf-16le":
2092
+ return r * 2;
2093
+ case "hex":
2094
+ return r >>> 1;
2095
+ case "base64":
2096
+ return Pt(o).length;
2097
+ default:
2098
+ if (f)
2099
+ return a ? -1 : tt(o).length;
2100
+ e = ("" + e).toLowerCase(), f = !0;
2101
+ }
2102
+ }
2103
+ u.byteLength = T;
2104
+ function M(o, e, r) {
2105
+ let a = !1;
2106
+ if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, e >>>= 0, r <= e))
2107
+ return "";
2108
+ for (o || (o = "utf8"); ; )
2109
+ switch (o) {
2110
+ case "hex":
2111
+ return qr(this, e, r);
2112
+ case "utf8":
2113
+ case "utf-8":
2114
+ return At(this, e, r);
2115
+ case "ascii":
2116
+ return $r(this, e, r);
2117
+ case "latin1":
2118
+ case "binary":
2119
+ return Nr(this, e, r);
2120
+ case "base64":
2121
+ return Lr(this, e, r);
2122
+ case "ucs2":
2123
+ case "ucs-2":
2124
+ case "utf16le":
2125
+ case "utf-16le":
2126
+ return jr(this, e, r);
2127
+ default:
2128
+ if (a) throw new TypeError("Unknown encoding: " + o);
2129
+ o = (o + "").toLowerCase(), a = !0;
2130
+ }
2131
+ }
2132
+ u.prototype._isBuffer = !0;
2133
+ function k(o, e, r) {
2134
+ const a = o[e];
2135
+ o[e] = o[r], o[r] = a;
2136
+ }
2137
+ u.prototype.swap16 = function() {
2138
+ const e = this.length;
2139
+ if (e % 2 !== 0)
2140
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
2141
+ for (let r = 0; r < e; r += 2)
2142
+ k(this, r, r + 1);
2143
+ return this;
2144
+ }, u.prototype.swap32 = function() {
2145
+ const e = this.length;
2146
+ if (e % 4 !== 0)
2147
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
2148
+ for (let r = 0; r < e; r += 4)
2149
+ k(this, r, r + 3), k(this, r + 1, r + 2);
2150
+ return this;
2151
+ }, u.prototype.swap64 = function() {
2152
+ const e = this.length;
2153
+ if (e % 8 !== 0)
2154
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
2155
+ for (let r = 0; r < e; r += 8)
2156
+ k(this, r, r + 7), k(this, r + 1, r + 6), k(this, r + 2, r + 5), k(this, r + 3, r + 4);
2157
+ return this;
2158
+ }, u.prototype.toString = function() {
2159
+ const e = this.length;
2160
+ return e === 0 ? "" : arguments.length === 0 ? At(this, 0, e) : M.apply(this, arguments);
2161
+ }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(e) {
2162
+ if (!u.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
2163
+ return this === e ? !0 : u.compare(this, e) === 0;
2164
+ }, u.prototype.inspect = function() {
2165
+ let e = "";
2166
+ const r = n.INSPECT_MAX_BYTES;
2167
+ return e = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (e += " ... "), "<Buffer " + e + ">";
2168
+ }, s && (u.prototype[s] = u.prototype.inspect), u.prototype.compare = function(e, r, a, f, d) {
2169
+ if (J(e, Uint8Array) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e))
2170
+ throw new TypeError(
2171
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e
2172
+ );
2173
+ if (r === void 0 && (r = 0), a === void 0 && (a = e ? e.length : 0), f === void 0 && (f = 0), d === void 0 && (d = this.length), r < 0 || a > e.length || f < 0 || d > this.length)
2174
+ throw new RangeError("out of range index");
2175
+ if (f >= d && r >= a)
2176
+ return 0;
2177
+ if (f >= d)
827
2178
  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;
2179
+ if (r >= a)
2180
+ return 1;
2181
+ if (r >>>= 0, a >>>= 0, f >>>= 0, d >>>= 0, this === e) return 0;
2182
+ let y = d - f, F = a - r;
2183
+ const U = Math.min(y, F), O = this.slice(f, d), D = e.slice(r, a);
2184
+ for (let C = 0; C < U; ++C)
2185
+ if (O[C] !== D[C]) {
2186
+ y = O[C], F = D[C];
2187
+ break;
2188
+ }
2189
+ return y < F ? -1 : F < y ? 1 : 0;
2190
+ };
2191
+ function Rt(o, e, r, a, f) {
2192
+ if (o.length === 0) return -1;
2193
+ if (typeof r == "string" ? (a = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, rt(r) && (r = f ? 0 : o.length - 1), r < 0 && (r = o.length + r), r >= o.length) {
2194
+ if (f) return -1;
2195
+ r = o.length - 1;
2196
+ } else if (r < 0)
2197
+ if (f) r = 0;
2198
+ else return -1;
2199
+ if (typeof e == "string" && (e = u.from(e, a)), u.isBuffer(e))
2200
+ return e.length === 0 ? -1 : bt(o, e, r, a, f);
2201
+ if (typeof e == "number")
2202
+ return e = e & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(o, e, r) : Uint8Array.prototype.lastIndexOf.call(o, e, r) : bt(o, [e], r, a, f);
2203
+ throw new TypeError("val must be string, number or Buffer");
2204
+ }
2205
+ function bt(o, e, r, a, f) {
2206
+ let d = 1, y = o.length, F = e.length;
2207
+ if (a !== void 0 && (a = String(a).toLowerCase(), a === "ucs2" || a === "ucs-2" || a === "utf16le" || a === "utf-16le")) {
2208
+ if (o.length < 2 || e.length < 2)
2209
+ return -1;
2210
+ d = 2, y /= 2, F /= 2, r /= 2;
852
2211
  }
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;
2212
+ function U(D, C) {
2213
+ return d === 1 ? D[C] : D.readUInt16BE(C * d);
927
2214
  }
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));
2215
+ let O;
2216
+ if (f) {
2217
+ let D = -1;
2218
+ for (O = r; O < y; O++)
2219
+ if (U(o, O) === U(e, D === -1 ? 0 : O - D)) {
2220
+ if (D === -1 && (D = O), O - D + 1 === F) return D * d;
2221
+ } else
2222
+ D !== -1 && (O -= O - D), D = -1;
2223
+ } else
2224
+ for (r + F > y && (r = y - F), O = r; O >= 0; O--) {
2225
+ let D = !0;
2226
+ for (let C = 0; C < F; C++)
2227
+ if (U(o, O + C) !== U(e, C)) {
2228
+ D = !1;
2229
+ break;
2230
+ }
2231
+ if (D) return O;
958
2232
  }
2233
+ return -1;
2234
+ }
2235
+ u.prototype.includes = function(e, r, a) {
2236
+ return this.indexOf(e, r, a) !== -1;
2237
+ }, u.prototype.indexOf = function(e, r, a) {
2238
+ return Rt(this, e, r, a, !0);
2239
+ }, u.prototype.lastIndexOf = function(e, r, a) {
2240
+ return Rt(this, e, r, a, !1);
2241
+ };
2242
+ function Or(o, e, r, a) {
2243
+ r = Number(r) || 0;
2244
+ const f = o.length - r;
2245
+ a ? (a = Number(a), a > f && (a = f)) : a = f;
2246
+ const d = e.length;
2247
+ a > d / 2 && (a = d / 2);
2248
+ let y;
2249
+ for (y = 0; y < a; ++y) {
2250
+ const F = parseInt(e.substr(y * 2, 2), 16);
2251
+ if (rt(F)) return y;
2252
+ o[r + y] = F;
959
2253
  }
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);
2254
+ return y;
2255
+ }
2256
+ function Ur(o, e, r, a) {
2257
+ return Ne(tt(e, o.length - r), o, r, a);
2258
+ }
2259
+ function Dr(o, e, r, a) {
2260
+ return Ne(zr(e), o, r, a);
2261
+ }
2262
+ function kr(o, e, r, a) {
2263
+ return Ne(Pt(e), o, r, a);
2264
+ }
2265
+ function Mr(o, e, r, a) {
2266
+ return Ne(Yr(e, o.length - r), o, r, a);
2267
+ }
2268
+ u.prototype.write = function(e, r, a, f) {
2269
+ if (r === void 0)
2270
+ f = "utf8", a = this.length, r = 0;
2271
+ else if (a === void 0 && typeof r == "string")
2272
+ f = r, a = this.length, r = 0;
2273
+ else if (isFinite(r))
2274
+ r = r >>> 0, isFinite(a) ? (a = a >>> 0, f === void 0 && (f = "utf8")) : (f = a, a = void 0);
2275
+ else
2276
+ throw new Error(
2277
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
2278
+ );
2279
+ const d = this.length - r;
2280
+ if ((a === void 0 || a > d) && (a = d), e.length > 0 && (a < 0 || r < 0) || r > this.length)
2281
+ throw new RangeError("Attempt to write outside buffer bounds");
2282
+ f || (f = "utf8");
2283
+ let y = !1;
2284
+ for (; ; )
2285
+ switch (f) {
2286
+ case "hex":
2287
+ return Or(this, e, r, a);
2288
+ case "utf8":
2289
+ case "utf-8":
2290
+ return Ur(this, e, r, a);
2291
+ case "ascii":
2292
+ case "latin1":
2293
+ case "binary":
2294
+ return Dr(this, e, r, a);
2295
+ case "base64":
2296
+ return kr(this, e, r, a);
2297
+ case "ucs2":
2298
+ case "ucs-2":
2299
+ case "utf16le":
2300
+ case "utf-16le":
2301
+ return Mr(this, e, r, a);
2302
+ default:
2303
+ if (y) throw new TypeError("Unknown encoding: " + f);
2304
+ f = ("" + f).toLowerCase(), y = !0;
2305
+ }
2306
+ }, u.prototype.toJSON = function() {
2307
+ return {
2308
+ type: "Buffer",
2309
+ data: Array.prototype.slice.call(this._arr || this, 0)
2310
+ };
2311
+ };
2312
+ function Lr(o, e, r) {
2313
+ return e === 0 && r === o.length ? t.fromByteArray(o) : t.fromByteArray(o.slice(e, r));
2314
+ }
2315
+ function At(o, e, r) {
2316
+ r = Math.min(o.length, r);
2317
+ const a = [];
2318
+ let f = e;
2319
+ for (; f < r; ) {
2320
+ const d = o[f];
2321
+ let y = null, F = d > 239 ? 4 : d > 223 ? 3 : d > 191 ? 2 : 1;
2322
+ if (f + F <= r) {
2323
+ let U, O, D, C;
2324
+ switch (F) {
2325
+ case 1:
2326
+ d < 128 && (y = d);
2327
+ break;
2328
+ case 2:
2329
+ U = o[f + 1], (U & 192) === 128 && (C = (d & 31) << 6 | U & 63, C > 127 && (y = C));
2330
+ break;
2331
+ case 3:
2332
+ U = o[f + 1], O = o[f + 2], (U & 192) === 128 && (O & 192) === 128 && (C = (d & 15) << 12 | (U & 63) << 6 | O & 63, C > 2047 && (C < 55296 || C > 57343) && (y = C));
2333
+ break;
2334
+ case 4:
2335
+ U = o[f + 1], O = o[f + 2], D = o[f + 3], (U & 192) === 128 && (O & 192) === 128 && (D & 192) === 128 && (C = (d & 15) << 18 | (U & 63) << 12 | (O & 63) << 6 | D & 63, C > 65535 && C < 1114112 && (y = C));
2336
+ }
2337
+ }
2338
+ y === null ? (y = 65533, F = 1) : y > 65535 && (y -= 65536, a.push(y >>> 10 & 1023 | 55296), y = 56320 | y & 1023), a.push(y), f += F;
1236
2339
  }
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 % _];
2340
+ return Pr(a);
1254
2341
  }
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;
2342
+ const Ct = 4096;
2343
+ function Pr(o) {
2344
+ const e = o.length;
2345
+ if (e <= Ct)
2346
+ return String.fromCharCode.apply(String, o);
2347
+ let r = "", a = 0;
2348
+ for (; a < e; )
2349
+ r += String.fromCharCode.apply(
2350
+ String,
2351
+ o.slice(a, a += Ct)
2352
+ );
2353
+ return r;
2354
+ }
2355
+ function $r(o, e, r) {
2356
+ let a = "";
2357
+ r = Math.min(o.length, r);
2358
+ for (let f = e; f < r; ++f)
2359
+ a += String.fromCharCode(o[f] & 127);
2360
+ return a;
2361
+ }
2362
+ function Nr(o, e, r) {
2363
+ let a = "";
2364
+ r = Math.min(o.length, r);
2365
+ for (let f = e; f < r; ++f)
2366
+ a += String.fromCharCode(o[f]);
2367
+ return a;
2368
+ }
2369
+ function qr(o, e, r) {
2370
+ const a = o.length;
2371
+ (!e || e < 0) && (e = 0), (!r || r < 0 || r > a) && (r = a);
2372
+ let f = "";
2373
+ for (let d = e; d < r; ++d)
2374
+ f += Gr[o[d]];
2375
+ return f;
2376
+ }
2377
+ function jr(o, e, r) {
2378
+ const a = o.slice(e, r);
2379
+ let f = "";
2380
+ for (let d = 0; d < a.length - 1; d += 2)
2381
+ f += String.fromCharCode(a[d] + a[d + 1] * 256);
2382
+ return f;
2383
+ }
2384
+ u.prototype.slice = function(e, r) {
2385
+ const a = this.length;
2386
+ e = ~~e, r = r === void 0 ? a : ~~r, e < 0 ? (e += a, e < 0 && (e = 0)) : e > a && (e = a), r < 0 ? (r += a, r < 0 && (r = 0)) : r > a && (r = a), r < e && (r = e);
2387
+ const f = this.subarray(e, r);
2388
+ return Object.setPrototypeOf(f, u.prototype), f;
2389
+ };
2390
+ function L(o, e, r) {
2391
+ if (o % 1 !== 0 || o < 0) throw new RangeError("offset is not uint");
2392
+ if (o + e > r) throw new RangeError("Trying to access beyond buffer length");
2393
+ }
2394
+ u.prototype.readUintLE = u.prototype.readUIntLE = function(e, r, a) {
2395
+ e = e >>> 0, r = r >>> 0, a || L(e, r, this.length);
2396
+ let f = this[e], d = 1, y = 0;
2397
+ for (; ++y < r && (d *= 256); )
2398
+ f += this[e + y] * d;
2399
+ return f;
2400
+ }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, r, a) {
2401
+ e = e >>> 0, r = r >>> 0, a || L(e, r, this.length);
2402
+ let f = this[e + --r], d = 1;
2403
+ for (; r > 0 && (d *= 256); )
2404
+ f += this[e + --r] * d;
2405
+ return f;
2406
+ }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, r) {
2407
+ return e = e >>> 0, r || L(e, 1, this.length), this[e];
2408
+ }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, r) {
2409
+ return e = e >>> 0, r || L(e, 2, this.length), this[e] | this[e + 1] << 8;
2410
+ }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, r) {
2411
+ return e = e >>> 0, r || L(e, 2, this.length), this[e] << 8 | this[e + 1];
2412
+ }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, r) {
2413
+ return e = e >>> 0, r || L(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
2414
+ }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, r) {
2415
+ return e = e >>> 0, r || L(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
2416
+ }, u.prototype.readBigUInt64LE = le(function(e) {
2417
+ e = e >>> 0, xe(e, "offset");
2418
+ const r = this[e], a = this[e + 7];
2419
+ (r === void 0 || a === void 0) && Ce(e, this.length - 8);
2420
+ const f = r + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, d = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + a * 2 ** 24;
2421
+ return BigInt(f) + (BigInt(d) << BigInt(32));
2422
+ }), u.prototype.readBigUInt64BE = le(function(e) {
2423
+ e = e >>> 0, xe(e, "offset");
2424
+ const r = this[e], a = this[e + 7];
2425
+ (r === void 0 || a === void 0) && Ce(e, this.length - 8);
2426
+ const f = r * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], d = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + a;
2427
+ return (BigInt(f) << BigInt(32)) + BigInt(d);
2428
+ }), u.prototype.readIntLE = function(e, r, a) {
2429
+ e = e >>> 0, r = r >>> 0, a || L(e, r, this.length);
2430
+ let f = this[e], d = 1, y = 0;
2431
+ for (; ++y < r && (d *= 256); )
2432
+ f += this[e + y] * d;
2433
+ return d *= 128, f >= d && (f -= Math.pow(2, 8 * r)), f;
2434
+ }, u.prototype.readIntBE = function(e, r, a) {
2435
+ e = e >>> 0, r = r >>> 0, a || L(e, r, this.length);
2436
+ let f = r, d = 1, y = this[e + --f];
2437
+ for (; f > 0 && (d *= 256); )
2438
+ y += this[e + --f] * d;
2439
+ return d *= 128, y >= d && (y -= Math.pow(2, 8 * r)), y;
2440
+ }, u.prototype.readInt8 = function(e, r) {
2441
+ return e = e >>> 0, r || L(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
2442
+ }, u.prototype.readInt16LE = function(e, r) {
2443
+ e = e >>> 0, r || L(e, 2, this.length);
2444
+ const a = this[e] | this[e + 1] << 8;
2445
+ return a & 32768 ? a | 4294901760 : a;
2446
+ }, u.prototype.readInt16BE = function(e, r) {
2447
+ e = e >>> 0, r || L(e, 2, this.length);
2448
+ const a = this[e + 1] | this[e] << 8;
2449
+ return a & 32768 ? a | 4294901760 : a;
2450
+ }, u.prototype.readInt32LE = function(e, r) {
2451
+ return e = e >>> 0, r || L(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
2452
+ }, u.prototype.readInt32BE = function(e, r) {
2453
+ return e = e >>> 0, r || L(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
2454
+ }, u.prototype.readBigInt64LE = le(function(e) {
2455
+ e = e >>> 0, xe(e, "offset");
2456
+ const r = this[e], a = this[e + 7];
2457
+ (r === void 0 || a === void 0) && Ce(e, this.length - 8);
2458
+ const f = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (a << 24);
2459
+ return (BigInt(f) << BigInt(32)) + BigInt(r + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
2460
+ }), u.prototype.readBigInt64BE = le(function(e) {
2461
+ e = e >>> 0, xe(e, "offset");
2462
+ const r = this[e], a = this[e + 7];
2463
+ (r === void 0 || a === void 0) && Ce(e, this.length - 8);
2464
+ const f = (r << 24) + // Overflow
2465
+ this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
2466
+ return (BigInt(f) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + a);
2467
+ }), u.prototype.readFloatLE = function(e, r) {
2468
+ return e = e >>> 0, r || L(e, 4, this.length), i.read(this, e, !0, 23, 4);
2469
+ }, u.prototype.readFloatBE = function(e, r) {
2470
+ return e = e >>> 0, r || L(e, 4, this.length), i.read(this, e, !1, 23, 4);
2471
+ }, u.prototype.readDoubleLE = function(e, r) {
2472
+ return e = e >>> 0, r || L(e, 8, this.length), i.read(this, e, !0, 52, 8);
2473
+ }, u.prototype.readDoubleBE = function(e, r) {
2474
+ return e = e >>> 0, r || L(e, 8, this.length), i.read(this, e, !1, 52, 8);
2475
+ };
2476
+ function H(o, e, r, a, f, d) {
2477
+ if (!u.isBuffer(o)) throw new TypeError('"buffer" argument must be a Buffer instance');
2478
+ if (e > f || e < d) throw new RangeError('"value" argument is out of bounds');
2479
+ if (r + a > o.length) throw new RangeError("Index out of range");
2480
+ }
2481
+ u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, r, a, f) {
2482
+ if (e = +e, r = r >>> 0, a = a >>> 0, !f) {
2483
+ const F = Math.pow(2, 8 * a) - 1;
2484
+ H(this, e, r, a, F, 0);
1266
2485
  }
1267
- get code() {
1268
- return i;
2486
+ let d = 1, y = 0;
2487
+ for (this[r] = e & 255; ++y < a && (d *= 256); )
2488
+ this[r + y] = e / d & 255;
2489
+ return r + a;
2490
+ }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, r, a, f) {
2491
+ if (e = +e, r = r >>> 0, a = a >>> 0, !f) {
2492
+ const F = Math.pow(2, 8 * a) - 1;
2493
+ H(this, e, r, a, F, 0);
1269
2494
  }
1270
- set code(c) {
1271
- Object.defineProperty(this, "code", {
1272
- configurable: !0,
1273
- enumerable: !0,
1274
- value: c,
1275
- writable: !0
1276
- });
2495
+ let d = a - 1, y = 1;
2496
+ for (this[r + d] = e & 255; --d >= 0 && (y *= 256); )
2497
+ this[r + d] = e / y & 255;
2498
+ return r + a;
2499
+ }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, r, a) {
2500
+ return e = +e, r = r >>> 0, a || H(this, e, r, 1, 255, 0), this[r] = e & 255, r + 1;
2501
+ }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, r, a) {
2502
+ return e = +e, r = r >>> 0, a || H(this, e, r, 2, 65535, 0), this[r] = e & 255, this[r + 1] = e >>> 8, r + 2;
2503
+ }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, r, a) {
2504
+ return e = +e, r = r >>> 0, a || H(this, e, r, 2, 65535, 0), this[r] = e >>> 8, this[r + 1] = e & 255, r + 2;
2505
+ }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, r, a) {
2506
+ return e = +e, r = r >>> 0, a || H(this, e, r, 4, 4294967295, 0), this[r + 3] = e >>> 24, this[r + 2] = e >>> 16, this[r + 1] = e >>> 8, this[r] = e & 255, r + 4;
2507
+ }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, r, a) {
2508
+ return e = +e, r = r >>> 0, a || H(this, e, r, 4, 4294967295, 0), this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255, r + 4;
2509
+ };
2510
+ function Tt(o, e, r, a, f) {
2511
+ Lt(e, a, f, o, r, 7);
2512
+ let d = Number(e & BigInt(4294967295));
2513
+ o[r++] = d, d = d >> 8, o[r++] = d, d = d >> 8, o[r++] = d, d = d >> 8, o[r++] = d;
2514
+ let y = Number(e >> BigInt(32) & BigInt(4294967295));
2515
+ return o[r++] = y, y = y >> 8, o[r++] = y, y = y >> 8, o[r++] = y, y = y >> 8, o[r++] = y, r;
2516
+ }
2517
+ function Ot(o, e, r, a, f) {
2518
+ Lt(e, a, f, o, r, 7);
2519
+ let d = Number(e & BigInt(4294967295));
2520
+ o[r + 7] = d, d = d >> 8, o[r + 6] = d, d = d >> 8, o[r + 5] = d, d = d >> 8, o[r + 4] = d;
2521
+ let y = Number(e >> BigInt(32) & BigInt(4294967295));
2522
+ return o[r + 3] = y, y = y >> 8, o[r + 2] = y, y = y >> 8, o[r + 1] = y, y = y >> 8, o[r] = y, r + 8;
2523
+ }
2524
+ u.prototype.writeBigUInt64LE = le(function(e, r = 0) {
2525
+ return Tt(this, e, r, BigInt(0), BigInt("0xffffffffffffffff"));
2526
+ }), u.prototype.writeBigUInt64BE = le(function(e, r = 0) {
2527
+ return Ot(this, e, r, BigInt(0), BigInt("0xffffffffffffffff"));
2528
+ }), u.prototype.writeIntLE = function(e, r, a, f) {
2529
+ if (e = +e, r = r >>> 0, !f) {
2530
+ const U = Math.pow(2, 8 * a - 1);
2531
+ H(this, e, r, a, U - 1, -U);
1277
2532
  }
1278
- toString() {
1279
- return `${this.name} [${i}]: ${this.message}`;
2533
+ let d = 0, y = 1, F = 0;
2534
+ for (this[r] = e & 255; ++d < a && (y *= 256); )
2535
+ e < 0 && F === 0 && this[r + d - 1] !== 0 && (F = 1), this[r + d] = (e / y >> 0) - F & 255;
2536
+ return r + a;
2537
+ }, u.prototype.writeIntBE = function(e, r, a, f) {
2538
+ if (e = +e, r = r >>> 0, !f) {
2539
+ const U = Math.pow(2, 8 * a - 1);
2540
+ H(this, e, r, a, U - 1, -U);
1280
2541
  }
2542
+ let d = a - 1, y = 1, F = 0;
2543
+ for (this[r + d] = e & 255; --d >= 0 && (y *= 256); )
2544
+ e < 0 && F === 0 && this[r + d + 1] !== 0 && (F = 1), this[r + d] = (e / y >> 0) - F & 255;
2545
+ return r + a;
2546
+ }, u.prototype.writeInt8 = function(e, r, a) {
2547
+ return e = +e, r = r >>> 0, a || H(this, e, r, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[r] = e & 255, r + 1;
2548
+ }, u.prototype.writeInt16LE = function(e, r, a) {
2549
+ return e = +e, r = r >>> 0, a || H(this, e, r, 2, 32767, -32768), this[r] = e & 255, this[r + 1] = e >>> 8, r + 2;
2550
+ }, u.prototype.writeInt16BE = function(e, r, a) {
2551
+ return e = +e, r = r >>> 0, a || H(this, e, r, 2, 32767, -32768), this[r] = e >>> 8, this[r + 1] = e & 255, r + 2;
2552
+ }, u.prototype.writeInt32LE = function(e, r, a) {
2553
+ return e = +e, r = r >>> 0, a || H(this, e, r, 4, 2147483647, -2147483648), this[r] = e & 255, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24, r + 4;
2554
+ }, u.prototype.writeInt32BE = function(e, r, a) {
2555
+ return e = +e, r = r >>> 0, a || H(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255, r + 4;
2556
+ }, u.prototype.writeBigInt64LE = le(function(e, r = 0) {
2557
+ return Tt(this, e, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2558
+ }), u.prototype.writeBigInt64BE = le(function(e, r = 0) {
2559
+ return Ot(this, e, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
2560
+ });
2561
+ function Ut(o, e, r, a, f, d) {
2562
+ if (r + a > o.length) throw new RangeError("Index out of range");
2563
+ if (r < 0) throw new RangeError("Index out of range");
2564
+ }
2565
+ function Dt(o, e, r, a, f) {
2566
+ return e = +e, r = r >>> 0, f || Ut(o, e, r, 4), i.write(o, e, r, a, 23, 4), r + 4;
2567
+ }
2568
+ u.prototype.writeFloatLE = function(e, r, a) {
2569
+ return Dt(this, e, r, !0, a);
2570
+ }, u.prototype.writeFloatBE = function(e, r, a) {
2571
+ return Dt(this, e, r, !1, a);
1281
2572
  };
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
2573
+ function kt(o, e, r, a, f) {
2574
+ return e = +e, r = r >>> 0, f || Ut(o, e, r, 8), i.write(o, e, r, a, 52, 8), r + 8;
2575
+ }
2576
+ u.prototype.writeDoubleLE = function(e, r, a) {
2577
+ return kt(this, e, r, !0, a);
2578
+ }, u.prototype.writeDoubleBE = function(e, r, a) {
2579
+ return kt(this, e, r, !1, a);
2580
+ }, u.prototype.copy = function(e, r, a, f) {
2581
+ if (!u.isBuffer(e)) throw new TypeError("argument should be a Buffer");
2582
+ if (a || (a = 0), !f && f !== 0 && (f = this.length), r >= e.length && (r = e.length), r || (r = 0), f > 0 && f < a && (f = a), f === a || e.length === 0 || this.length === 0) return 0;
2583
+ if (r < 0)
2584
+ throw new RangeError("targetStart out of bounds");
2585
+ if (a < 0 || a >= this.length) throw new RangeError("Index out of range");
2586
+ if (f < 0) throw new RangeError("sourceEnd out of bounds");
2587
+ f > this.length && (f = this.length), e.length - r < f - a && (f = e.length - r + a);
2588
+ const d = f - a;
2589
+ return this === e && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, a, f) : Uint8Array.prototype.set.call(
2590
+ e,
2591
+ this.subarray(a, f),
2592
+ r
2593
+ ), d;
2594
+ }, u.prototype.fill = function(e, r, a, f) {
2595
+ if (typeof e == "string") {
2596
+ if (typeof r == "string" ? (f = r, r = 0, a = this.length) : typeof a == "string" && (f = a, a = this.length), f !== void 0 && typeof f != "string")
2597
+ throw new TypeError("encoding must be a string");
2598
+ if (typeof f == "string" && !u.isEncoding(f))
2599
+ throw new TypeError("Unknown encoding: " + f);
2600
+ if (e.length === 1) {
2601
+ const y = e.charCodeAt(0);
2602
+ (f === "utf8" && y < 128 || f === "latin1") && (e = y);
2603
+ }
2604
+ } else typeof e == "number" ? e = e & 255 : typeof e == "boolean" && (e = Number(e));
2605
+ if (r < 0 || this.length < r || this.length < a)
2606
+ throw new RangeError("Out of range index");
2607
+ if (a <= r)
2608
+ return this;
2609
+ r = r >>> 0, a = a === void 0 ? this.length : a >>> 0, e || (e = 0);
2610
+ let d;
2611
+ if (typeof e == "number")
2612
+ for (d = r; d < a; ++d)
2613
+ this[d] = e;
2614
+ else {
2615
+ const y = u.isBuffer(e) ? e : u.from(e, f), F = y.length;
2616
+ if (F === 0)
2617
+ throw new TypeError('The value "' + e + '" is invalid for argument "value"');
2618
+ for (d = 0; d < a - r; ++d)
2619
+ this[d + r] = y[d % F];
2620
+ }
2621
+ return this;
2622
+ };
2623
+ const Ee = {};
2624
+ function et(o, e, r) {
2625
+ Ee[o] = class extends r {
2626
+ constructor() {
2627
+ super(), Object.defineProperty(this, "message", {
2628
+ value: e.apply(this, arguments),
2629
+ writable: !0,
2630
+ configurable: !0
2631
+ }), this.name = `${this.name} [${o}]`, this.stack, delete this.name;
2632
+ }
2633
+ get code() {
2634
+ return o;
2635
+ }
2636
+ set code(f) {
2637
+ Object.defineProperty(this, "code", {
2638
+ configurable: !0,
2639
+ enumerable: !0,
2640
+ value: f,
2641
+ writable: !0
2642
+ });
2643
+ }
2644
+ toString() {
2645
+ return `${this.name} [${o}]: ${this.message}`;
2646
+ }
2647
+ };
2648
+ }
2649
+ et(
2650
+ "ERR_BUFFER_OUT_OF_BOUNDS",
2651
+ function(o) {
2652
+ return o ? `${o} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
2653
+ },
2654
+ RangeError
2655
+ ), et(
2656
+ "ERR_INVALID_ARG_TYPE",
2657
+ function(o, e) {
2658
+ return `The "${o}" argument must be of type number. Received type ${typeof e}`;
2659
+ },
2660
+ TypeError
2661
+ ), et(
2662
+ "ERR_OUT_OF_RANGE",
2663
+ function(o, e, r) {
2664
+ let a = `The value of "${o}" is out of range.`, f = r;
2665
+ return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? f = Mt(String(r)) : typeof r == "bigint" && (f = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (f = Mt(f)), f += "n"), a += ` It must be ${e}. Received ${f}`, a;
2666
+ },
2667
+ RangeError
1330
2668
  );
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);
2669
+ function Mt(o) {
2670
+ let e = "", r = o.length;
2671
+ const a = o[0] === "-" ? 1 : 0;
2672
+ for (; r >= a + 4; r -= 3)
2673
+ e = `_${o.slice(r - 3, r)}${e}`;
2674
+ return `${o.slice(0, r)}${e}`;
2675
+ }
2676
+ function Wr(o, e, r) {
2677
+ xe(e, "offset"), (o[e] === void 0 || o[e + r] === void 0) && Ce(e, o.length - (r + 1));
2678
+ }
2679
+ function Lt(o, e, r, a, f, d) {
2680
+ if (o > r || o < e) {
2681
+ const y = typeof e == "bigint" ? "n" : "";
2682
+ let F;
2683
+ throw e === 0 || e === BigInt(0) ? F = `>= 0${y} and < 2${y} ** ${(d + 1) * 8}${y}` : F = `>= -(2${y} ** ${(d + 1) * 8 - 1}${y}) and < 2 ** ${(d + 1) * 8 - 1}${y}`, new Ee.ERR_OUT_OF_RANGE("value", F, o);
2684
+ }
2685
+ Wr(a, f, d);
2686
+ }
2687
+ function xe(o, e) {
2688
+ if (typeof o != "number")
2689
+ throw new Ee.ERR_INVALID_ARG_TYPE(e, "number", o);
2690
+ }
2691
+ function Ce(o, e, r) {
2692
+ throw Math.floor(o) !== o ? (xe(o, r), new Ee.ERR_OUT_OF_RANGE("offset", "an integer", o)) : e < 0 ? new Ee.ERR_BUFFER_OUT_OF_BOUNDS() : new Ee.ERR_OUT_OF_RANGE(
2693
+ "offset",
2694
+ `>= 0 and <= ${e}`,
2695
+ o
2696
+ );
2697
+ }
2698
+ const Vr = /[^+/0-9A-Za-z-_]/g;
2699
+ function Hr(o) {
2700
+ if (o = o.split("=")[0], o = o.trim().replace(Vr, ""), o.length < 2) return "";
2701
+ for (; o.length % 4 !== 0; )
2702
+ o = o + "=";
2703
+ return o;
2704
+ }
2705
+ function tt(o, e) {
2706
+ e = e || 1 / 0;
2707
+ let r;
2708
+ const a = o.length;
2709
+ let f = null;
2710
+ const d = [];
2711
+ for (let y = 0; y < a; ++y) {
2712
+ if (r = o.charCodeAt(y), r > 55295 && r < 57344) {
2713
+ if (!f) {
2714
+ if (r > 56319) {
2715
+ (e -= 3) > -1 && d.push(239, 191, 189);
2716
+ continue;
2717
+ } else if (y + 1 === a) {
2718
+ (e -= 3) > -1 && d.push(239, 191, 189);
2719
+ continue;
2720
+ }
2721
+ f = r;
1351
2722
  continue;
1352
- } else if (f + 1 === n) {
1353
- (e -= 3) > -1 && u.push(239, 191, 189);
2723
+ }
2724
+ if (r < 56320) {
2725
+ (e -= 3) > -1 && d.push(239, 191, 189), f = r;
1354
2726
  continue;
1355
2727
  }
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);
2728
+ r = (f - 55296 << 10 | r - 56320) + 65536;
2729
+ } else f && (e -= 3) > -1 && d.push(239, 191, 189);
2730
+ if (f = null, r < 128) {
2731
+ if ((e -= 1) < 0) break;
2732
+ d.push(r);
2733
+ } else if (r < 2048) {
2734
+ if ((e -= 2) < 0) break;
2735
+ d.push(
2736
+ r >> 6 | 192,
2737
+ r & 63 | 128
2738
+ );
2739
+ } else if (r < 65536) {
2740
+ if ((e -= 3) < 0) break;
2741
+ d.push(
2742
+ r >> 12 | 224,
2743
+ r >> 6 & 63 | 128,
2744
+ r & 63 | 128
2745
+ );
2746
+ } else if (r < 1114112) {
2747
+ if ((e -= 4) < 0) break;
2748
+ d.push(
2749
+ r >> 18 | 240,
2750
+ r >> 12 & 63 | 128,
2751
+ r >> 6 & 63 | 128,
2752
+ r & 63 | 128
2753
+ );
2754
+ } else
2755
+ throw new Error("Invalid code point");
2756
+ }
2757
+ return d;
2758
+ }
2759
+ function zr(o) {
2760
+ const e = [];
2761
+ for (let r = 0; r < o.length; ++r)
2762
+ e.push(o.charCodeAt(r) & 255);
2763
+ return e;
2764
+ }
2765
+ function Yr(o, e) {
2766
+ let r, a, f;
2767
+ const d = [];
2768
+ for (let y = 0; y < o.length && !((e -= 2) < 0); ++y)
2769
+ r = o.charCodeAt(y), a = r >> 8, f = r % 256, d.push(f), d.push(a);
2770
+ return d;
2771
+ }
2772
+ function Pt(o) {
2773
+ return t.toByteArray(Hr(o));
2774
+ }
2775
+ function Ne(o, e, r, a) {
2776
+ let f;
2777
+ for (f = 0; f < a && !(f + r >= e.length || f >= o.length); ++f)
2778
+ e[f + r] = o[f];
2779
+ return f;
2780
+ }
2781
+ function J(o, e) {
2782
+ return o instanceof e || o != null && o.constructor != null && o.constructor.name != null && o.constructor.name === e.name;
2783
+ }
2784
+ function rt(o) {
2785
+ return o !== o;
2786
+ }
2787
+ const Gr = (function() {
2788
+ const o = "0123456789abcdef", e = new Array(256);
2789
+ for (let r = 0; r < 16; ++r) {
2790
+ const a = r * 16;
2791
+ for (let f = 0; f < 16; ++f)
2792
+ e[a + f] = o[r] + o[f];
2793
+ }
2794
+ return e;
2795
+ })();
2796
+ function le(o) {
2797
+ return typeof BigInt > "u" ? Qr : o;
2798
+ }
2799
+ function Qr() {
2800
+ throw new Error("BigInt not supported");
2801
+ }
2802
+ })(it)), it;
2803
+ }
2804
+ var er = Si();
2805
+ const Fi = (n) => {
2806
+ const t = er.Buffer.from(n, "base64").toString("utf8"), i = er.Buffer.from(t, "binary").toString("base64");
2807
+ return n === i ? t : n;
2808
+ }, Ri = async (n) => {
2809
+ const t = Fi(n), i = JSON.parse(t);
1448
2810
  return {
1449
- message: r,
1450
- ...o
2811
+ message: t,
2812
+ ...i
1451
2813
  };
1452
2814
  };
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) {
2815
+ class I {
2816
+ constructor(t, i, s, l, c) {
2817
+ this._legacyCanvasSize = I.DEFAULT_CANVAS_SIZE, this._preferredCamera = "environment", this._maxScansPerSecond = 25, this._lastScanTimestamp = -1, this._destroyed = this._flashOn = this._paused = this._active = !1, this.$video = t, this.$canvas = document.createElement("canvas"), s && typeof s == "object" ? this._onDecode = i : (console.warn(s || l || c ? "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 = i), i = typeof s == "object" ? s : {}, this._onDecodeError = i.onDecodeError || (typeof s == "function" ? s : this._onDecodeError), this._calculateScanRegion = i.calculateScanRegion || (typeof l == "function" ? l : this._calculateScanRegion), this._preferredCamera = i.preferredCamera || c || this._preferredCamera, this._legacyCanvasSize = typeof s == "number" ? s : typeof l == "number" ? l : this._legacyCanvasSize, this._maxScansPerSecond = i.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), t.disablePictureInPicture = !0, t.playsInline = !0, t.muted = !0;
2818
+ let h = !1;
2819
+ if (t.hidden && (t.hidden = !1, h = !0), document.body.contains(t) || (document.body.appendChild(t), h = !0), s = t.parentElement, i.highlightScanRegion || i.highlightCodeOutline) {
2820
+ if (l = !!i.overlay, this.$overlay = i.overlay || document.createElement("div"), c = this.$overlay.style, c.position = "absolute", c.display = "none", c.pointerEvents = "none", this.$overlay.classList.add("scan-region-highlight"), !l && i.highlightScanRegion) {
1459
2821
  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
2822
  try {
1461
2823
  this.$overlay.firstElementChild.animate({ transform: [
@@ -1464,53 +2826,50 @@ class x {
1464
2826
  ] }, { duration: 400, iterations: 1 / 0, direction: "alternate", easing: "ease-in-out" });
1465
2827
  } catch {
1466
2828
  }
1467
- h.insertBefore(this.$overlay, this.$video.nextSibling);
2829
+ s.insertBefore(this.$overlay, this.$video.nextSibling);
1468
2830
  }
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);
2831
+ i.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
2832
  }
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();
2833
+ this._scanRegion = this._calculateScanRegion(t), requestAnimationFrame(() => {
2834
+ let u = window.getComputedStyle(t);
2835
+ u.display === "none" && (t.style.setProperty("display", "block", "important"), h = !0), u.visibility !== "visible" && (t.style.setProperty("visibility", "visible", "important"), h = !0), h && (console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."), t.style.opacity = "0", t.style.width = "0", t.style.height = "0", this.$overlay && this.$overlay.parentElement && this.$overlay.parentElement.removeChild(this.$overlay), delete this.$overlay, delete this.$codeOutlineHighlight), this.$overlay && this._updateOverlay();
2836
+ }), t.addEventListener("play", this._onPlay), t.addEventListener("loadedmetadata", this._onLoadedMetaData), document.addEventListener("visibilitychange", this._onVisibilityChange), window.addEventListener("resize", this._updateOverlay), this._qrEnginePromise = I.createQrEngine();
1475
2837
  }
1476
- static set WORKER_PATH(r) {
2838
+ static set WORKER_PATH(t) {
1477
2839
  console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.");
1478
2840
  }
1479
2841
  static async hasCamera() {
1480
2842
  try {
1481
- return !!(await x.listCameras(!1)).length;
2843
+ return !!(await I.listCameras(!1)).length;
1482
2844
  } catch {
1483
2845
  return !1;
1484
2846
  }
1485
2847
  }
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;
2848
+ static async listCameras(t = !1) {
2849
+ if (!navigator.mediaDevices) return [];
2850
+ let i = async () => (await navigator.mediaDevices.enumerateDevices()).filter((l) => l.kind === "videoinput"), s;
1490
2851
  try {
1491
- r && (await o()).every((l) => !l.label) && (h = await navigator.mediaDevices.getUserMedia({ audio: !1, video: !0 }));
2852
+ t && (await i()).every((l) => !l.label) && (s = await navigator.mediaDevices.getUserMedia({ audio: !1, video: !0 }));
1492
2853
  } catch {
1493
2854
  }
1494
2855
  try {
1495
- return (await o()).map((l, d) => ({ id: l.deviceId, label: l.label || (d === 0 ? "Default Camera" : `Camera ${d + 1}`) }));
2856
+ return (await i()).map((l, c) => ({ id: l.deviceId, label: l.label || (c === 0 ? "Default Camera" : `Camera ${c + 1}`) }));
1496
2857
  } finally {
1497
- h && (console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"), x._stopVideoStream(h));
2858
+ s && (console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"), I._stopVideoStream(s));
1498
2859
  }
1499
2860
  }
1500
2861
  async hasFlash() {
1501
- let r;
2862
+ let t;
1502
2863
  try {
1503
2864
  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();
2865
+ if (!(this.$video.srcObject instanceof MediaStream)) return !1;
2866
+ t = this.$video.srcObject;
2867
+ } else t = (await this._getCameraStream()).stream;
2868
+ return "torch" in t.getVideoTracks()[0].getSettings();
1510
2869
  } catch {
1511
2870
  return !1;
1512
2871
  } 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));
2872
+ t && t !== this.$video.srcObject && (console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"), I._stopVideoStream(t));
1514
2873
  }
1515
2874
  }
1516
2875
  isFlashOn() {
@@ -1520,14 +2879,12 @@ class x {
1520
2879
  this._flashOn ? await this.turnFlashOff() : await this.turnFlashOn();
1521
2880
  }
1522
2881
  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
- }
2882
+ if (!this._flashOn && !this._destroyed && (this._flashOn = !0, this._active && !this._paused)) try {
2883
+ if (!await this.hasFlash()) throw "No flash available";
2884
+ await this.$video.srcObject.getVideoTracks()[0].applyConstraints({ advanced: [{ torch: !0 }] });
2885
+ } catch (t) {
2886
+ throw this._flashOn = !1, t;
2887
+ }
1531
2888
  }
1532
2889
  async turnFlashOff() {
1533
2890
  this._flashOn && (this._flashOn = !1, await this._restartVideoStream());
@@ -1536,97 +2893,86 @@ class x {
1536
2893
  this.$video.removeEventListener("loadedmetadata", this._onLoadedMetaData), this.$video.removeEventListener("play", this._onPlay), document.removeEventListener(
1537
2894
  "visibilitychange",
1538
2895
  this._onVisibilityChange
1539
- ), window.removeEventListener("resize", this._updateOverlay), this._destroyed = !0, this._flashOn = !1, this.stop(), x._postWorkerMessage(this._qrEnginePromise, "close");
2896
+ ), window.removeEventListener("resize", this._updateOverlay), this._destroyed = !0, this._flashOn = !1, this.stop(), I._postWorkerMessage(this._qrEnginePromise, "close");
1540
2897
  }
1541
2898
  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
- }
2899
+ if (this._destroyed) throw Error("The QR scanner can not be started as it had been destroyed.");
2900
+ 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)) if (this._paused = !1, this.$video.srcObject) await this.$video.play();
2901
+ else try {
2902
+ let { stream: t, facingMode: i } = await this._getCameraStream();
2903
+ !this._active || this._paused ? I._stopVideoStream(t) : (this._setVideoMirror(i), this.$video.srcObject = t, await this.$video.play(), this._flashOn && (this._flashOn = !1, this.turnFlashOn().catch(() => {
2904
+ })));
2905
+ } catch (t) {
2906
+ if (!this._paused) throw this._active = !1, t;
2907
+ }
1556
2908
  }
1557
2909
  stop() {
1558
2910
  this.pause(), this._active = !1;
1559
2911
  }
1560
- async pause(r = !1) {
1561
- if (this._paused = !0, !this._active)
1562
- return !0;
2912
+ async pause(t = !1) {
2913
+ if (this._paused = !0, !this._active) return !0;
1563
2914
  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);
2915
+ let i = () => {
2916
+ this.$video.srcObject instanceof MediaStream && (I._stopVideoStream(this.$video.srcObject), this.$video.srcObject = null);
1566
2917
  };
1567
- return r ? (o(), !0) : (await new Promise((h) => setTimeout(h, 300)), this._paused ? (o(), !0) : !1);
2918
+ return t ? (i(), !0) : (await new Promise((s) => setTimeout(s, 300)), this._paused ? (i(), !0) : !1);
1568
2919
  }
1569
- async setCamera(r) {
1570
- r !== this._preferredCamera && (this._preferredCamera = r, await this._restartVideoStream());
2920
+ async setCamera(t) {
2921
+ t !== this._preferredCamera && (this._preferredCamera = t, await this._restartVideoStream());
1571
2922
  }
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;
2923
+ static async scanImage(t, i, s, l, c = !1, h = !1) {
2924
+ let u, p = !1;
2925
+ i && ("scanRegion" in i || "qrEngine" in i || "canvas" in i || "disallowCanvasResizing" in i || "alsoTryWithoutScanRegion" in i || "returnDetailedScanResult" in i) ? (u = i.scanRegion, s = i.qrEngine, l = i.canvas, c = i.disallowCanvasResizing || !1, h = i.alsoTryWithoutScanRegion || !1, p = !0) : console.warn(i || s || l || c || h ? "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."), i = !!s;
1575
2926
  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);
2927
+ let _, g;
2928
+ [s, _] = await Promise.all([s || I.createQrEngine(), I._loadImage(t)]), [l, g] = I._drawToCanvas(_, u, l, c);
1578
2929
  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]);
2930
+ if (s instanceof Worker) {
2931
+ let m = s;
2932
+ i || I._postWorkerMessageSync(m, "inversionMode", "both"), E = await new Promise((v, w) => {
2933
+ let x, S, A, B = -1;
2934
+ S = (M) => {
2935
+ M.data.id === B && (m.removeEventListener("message", S), m.removeEventListener("error", A), clearTimeout(x), M.data.data !== null ? v({ data: M.data.data, cornerPoints: I._convertPoints(M.data.cornerPoints, u) }) : w(I.NO_QR_CODE_FOUND));
2936
+ }, A = (M) => {
2937
+ m.removeEventListener("message", S), m.removeEventListener("error", A), clearTimeout(x), w("Scanner error: " + (M ? M.message || M : "Unknown Error"));
2938
+ }, m.addEventListener("message", S), m.addEventListener("error", A), x = setTimeout(() => A("timeout"), 1e4);
2939
+ let T = g.getImageData(0, 0, l.width, l.height);
2940
+ B = I._postWorkerMessageSync(m, "decode", T, [T.data.buffer]);
1590
2941
  });
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;
2942
+ } else E = await Promise.race([new Promise((m, v) => window.setTimeout(() => v("Scanner error: timeout"), 1e4)), (async () => {
2943
+ try {
2944
+ var [m] = await s.detect(l);
2945
+ if (!m) throw I.NO_QR_CODE_FOUND;
2946
+ return { data: m.rawValue, cornerPoints: I._convertPoints(m.cornerPoints, u) };
2947
+ } catch (v) {
2948
+ if (m = v.message || v, /not implemented|service unavailable/.test(m)) return I._disableBarcodeDetector = !0, I.scanImage(t, { scanRegion: u, canvas: l, disallowCanvasResizing: c, alsoTryWithoutScanRegion: h });
2949
+ throw `Scanner error: ${m}`;
2950
+ }
2951
+ })()]);
2952
+ return p ? E : E.data;
2953
+ } catch (_) {
2954
+ if (!u || !h) throw _;
2955
+ let g = await I.scanImage(t, { qrEngine: s, canvas: l, disallowCanvasResizing: c });
2956
+ return p ? g : g.data;
1610
2957
  } finally {
1611
- o || x._postWorkerMessage(h, "close");
2958
+ i || I._postWorkerMessage(s, "close");
1612
2959
  }
1613
2960
  }
1614
- setGrayscaleWeights(r, o, h, l = !0) {
1615
- x._postWorkerMessage(this._qrEnginePromise, "grayscaleWeights", {
1616
- red: r,
1617
- green: o,
1618
- blue: h,
2961
+ setGrayscaleWeights(t, i, s, l = !0) {
2962
+ I._postWorkerMessage(this._qrEnginePromise, "grayscaleWeights", {
2963
+ red: t,
2964
+ green: i,
2965
+ blue: s,
1619
2966
  useIntegerApproximation: l
1620
2967
  });
1621
2968
  }
1622
- setInversionMode(r) {
1623
- x._postWorkerMessage(this._qrEnginePromise, "inversionMode", r);
2969
+ setInversionMode(t) {
2970
+ I._postWorkerMessage(this._qrEnginePromise, "inversionMode", t);
1624
2971
  }
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"] });
2972
+ static async createQrEngine(t) {
2973
+ if (t && console.warn("Specifying a worker path is not required and not supported anymore."), t = () => import("./qr-scanner-worker.min-DpjUkzFK.js").then((s) => s.createWorker()), !(!I._disableBarcodeDetector && "BarcodeDetector" in window && BarcodeDetector.getSupportedFormats && (await BarcodeDetector.getSupportedFormats()).includes("qr_code"))) return t();
2974
+ let i = navigator.userAgentData;
2975
+ return i && i.brands.some(({ brand: s }) => /Chromium/i.test(s)) && /mac ?OS/i.test(i.platform) && await i.getHighEntropyValues(["architecture", "platformVersion"]).then(({ architecture: s, platformVersion: l }) => /arm/i.test(s || "arm") && 13 <= parseInt(l || "13")).catch(() => !0) ? t() : new BarcodeDetector({ formats: ["qr_code"] });
1630
2976
  }
1631
2977
  _onPlay() {
1632
2978
  this._scanRegion = this._calculateScanRegion(this.$video), this._updateOverlay(), this.$overlay && (this.$overlay.style.display = ""), this._scanFrame();
@@ -1637,221 +2983,204 @@ class x {
1637
2983
  _onVisibilityChange() {
1638
2984
  document.hidden ? this.pause() : this._active && this.start();
1639
2985
  }
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 };
2986
+ _calculateScanRegion(t) {
2987
+ let i = Math.round(0.6666666666666666 * Math.min(t.videoWidth, t.videoHeight));
2988
+ return { x: Math.round((t.videoWidth - i) / 2), y: Math.round((t.videoHeight - i) / 2), width: i, height: i, downScaledWidth: this._legacyCanvasSize, downScaledHeight: this._legacyCanvasSize };
1643
2989
  }
1644
2990
  _updateOverlay() {
1645
2991
  requestAnimationFrame(() => {
1646
2992
  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) {
2993
+ var t = this.$video, i = t.videoWidth, s = t.videoHeight, l = t.offsetWidth, c = t.offsetHeight, h = t.offsetLeft, u = t.offsetTop, p = window.getComputedStyle(t), _ = p.objectFit, g = i / s, E = l / c;
2994
+ switch (_) {
1649
2995
  case "none":
1650
- var w = o, B = h;
2996
+ var m = i, v = s;
1651
2997
  break;
1652
2998
  case "fill":
1653
- w = l, B = d;
2999
+ m = l, v = c;
1654
3000
  break;
1655
3001
  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));
3002
+ (_ === "cover" ? g > E : g < E) ? (v = c, m = v * g) : (m = l, v = m / g), _ === "scale-down" && (m = Math.min(m, i), v = Math.min(v, s));
1657
3003
  }
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;
3004
+ var [w, x] = p.objectPosition.split(" ").map((A, B) => {
3005
+ const T = parseFloat(A);
3006
+ return A.endsWith("%") ? (B ? c - v : l - m) * T / 100 : T;
1661
3007
  });
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;
3008
+ p = this._scanRegion.width || i, E = this._scanRegion.height || s, _ = this._scanRegion.x || 0;
3009
+ var S = this._scanRegion.y || 0;
3010
+ g = this.$overlay.style, g.width = `${p / i * m}px`, g.height = `${E / s * v}px`, g.top = `${u + x + S / s * v}px`, s = /scaleX\(-1\)/.test(t.style.transform), g.left = `${h + (s ? l - w - m : w) + (s ? i - _ - p : _) / i * m}px`, g.transform = t.style.transform;
1665
3011
  }
1666
3012
  });
1667
3013
  }
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;
3014
+ static _convertPoints(t, i) {
3015
+ if (!i) return t;
3016
+ let s = i.x || 0, l = i.y || 0, c = i.width && i.downScaledWidth ? i.width / i.downScaledWidth : 1;
3017
+ i = i.height && i.downScaledHeight ? i.height / i.downScaledHeight : 1;
3018
+ for (let h of t) h.x = h.x * c + s, h.y = h.y * i + l;
3019
+ return t;
1676
3020
  }
1677
3021
  _scanFrame() {
1678
3022
  !this._active || this.$video.paused || this.$video.ended || ("requestVideoFrameCallback" in this.$video ? this.$video.requestVideoFrameCallback.bind(this.$video) : requestAnimationFrame)(async () => {
1679
3023
  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();
3024
+ var t = Date.now() - this._lastScanTimestamp, i = 1e3 / this._maxScansPerSecond;
3025
+ t < i && await new Promise((l) => setTimeout(l, i - t)), this._lastScanTimestamp = Date.now();
1682
3026
  try {
1683
- var h = await x.scanImage(this.$video, { scanRegion: this._scanRegion, qrEngine: this._qrEnginePromise, canvas: this.$canvas });
3027
+ var s = await I.scanImage(this.$video, { scanRegion: this._scanRegion, qrEngine: this._qrEnginePromise, canvas: this.$canvas });
1684
3028
  } catch (l) {
1685
- if (!this._active)
1686
- return;
3029
+ if (!this._active) return;
1687
3030
  this._onDecodeError(l);
1688
3031
  }
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(
3032
+ !I._disableBarcodeDetector || await this._qrEnginePromise instanceof Worker || (this._qrEnginePromise = I.createQrEngine()), s ? (this._onDecode ? this._onDecode(s) : this._legacyOnDecode && this._legacyOnDecode(s.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
3033
  "points",
1691
- h.cornerPoints.map(({ x: l, y: d }) => `${l},${d}`).join(" ")
3034
+ s.cornerPoints.map(({ x: l, y: c }) => `${l},${c}`).join(" ")
1692
3035
  ), this.$codeOutlineHighlight.style.display = "")) : this.$codeOutlineHighlight && !this._codeOutlineHighlightRemovalTimeout && (this._codeOutlineHighlightRemovalTimeout = setTimeout(() => this.$codeOutlineHighlight.style.display = "none", 100));
1693
3036
  }
1694
3037
  this._scanFrame();
1695
3038
  });
1696
3039
  }
1697
- _onDecodeError(r) {
1698
- r !== x.NO_QR_CODE_FOUND && console.log(r);
3040
+ _onDecodeError(t) {
3041
+ t !== I.NO_QR_CODE_FOUND && console.log(t);
1699
3042
  }
1700
3043
  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
- }
3044
+ if (!navigator.mediaDevices) throw "Camera not found.";
3045
+ let t = /^(environment|user)$/.test(this._preferredCamera) ? "facingMode" : "deviceId", i = [{ width: { min: 1024 } }, { width: { min: 768 } }, {}], s = i.map((l) => Object.assign({}, l, { [t]: { exact: this._preferredCamera } }));
3046
+ for (let l of [...s, ...i]) try {
3047
+ let c = await navigator.mediaDevices.getUserMedia({ video: l, audio: !1 }), h = this._getFacingMode(c) || (l.facingMode ? this._preferredCamera : this._preferredCamera === "environment" ? "user" : "environment");
3048
+ return { stream: c, facingMode: h };
3049
+ } catch {
3050
+ }
1710
3051
  throw "Camera not found.";
1711
3052
  }
1712
3053
  async _restartVideoStream() {
1713
- let r = this._paused;
1714
- await this.pause(!0) && !r && this._active && await this.start();
3054
+ let t = this._paused;
3055
+ await this.pause(!0) && !t && this._active && await this.start();
1715
3056
  }
1716
- static _stopVideoStream(r) {
1717
- for (let o of r.getTracks())
1718
- o.stop(), r.removeTrack(o);
3057
+ static _stopVideoStream(t) {
3058
+ for (let i of t.getTracks()) i.stop(), t.removeTrack(i);
1719
3059
  }
1720
- _setVideoMirror(r) {
1721
- this.$video.style.transform = "scaleX(" + (r === "user" ? -1 : 1) + ")";
3060
+ _setVideoMirror(t) {
3061
+ this.$video.style.transform = "scaleX(" + (t === "user" ? -1 : 1) + ")";
1722
3062
  }
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;
3063
+ _getFacingMode(t) {
3064
+ return (t = t.getVideoTracks()[0]) ? /rear|back|environment/i.test(t.label) ? "environment" : /front|user|face/i.test(t.label) ? "user" : null : null;
1725
3065
  }
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];
3066
+ static _drawToCanvas(t, i, s, l = !1) {
3067
+ s = s || document.createElement("canvas");
3068
+ let c = i && i.x ? i.x : 0, h = i && i.y ? i.y : 0, u = i && i.width ? i.width : t.videoWidth || t.width, p = i && i.height ? i.height : t.videoHeight || t.height;
3069
+ return l || (l = i && i.downScaledWidth ? i.downScaledWidth : u, i = i && i.downScaledHeight ? i.downScaledHeight : p, s.width !== l && (s.width = l), s.height !== i && (s.height = i)), i = s.getContext("2d", { alpha: !1 }), i.imageSmoothingEnabled = !1, i.drawImage(t, c, h, u, p, 0, 0, s.width, s.height), [s, i];
1730
3070
  }
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();
3071
+ static async _loadImage(t) {
3072
+ if (t instanceof Image) return await I._awaitImageLoad(t), t;
3073
+ if (t instanceof HTMLVideoElement || t instanceof HTMLCanvasElement || t instanceof SVGImageElement || "OffscreenCanvas" in window && t instanceof OffscreenCanvas || "ImageBitmap" in window && t instanceof ImageBitmap) return t;
3074
+ if (t instanceof File || t instanceof Blob || t instanceof URL || typeof t == "string") {
3075
+ let i = new Image();
3076
+ i.src = t instanceof File || t instanceof Blob ? URL.createObjectURL(t) : t.toString();
1739
3077
  try {
1740
- return await x._awaitImageLoad(o), o;
3078
+ return await I._awaitImageLoad(i), i;
1741
3079
  } finally {
1742
- (r instanceof File || r instanceof Blob) && URL.revokeObjectURL(o.src);
3080
+ (t instanceof File || t instanceof Blob) && URL.revokeObjectURL(i.src);
1743
3081
  }
1744
- } else
1745
- throw "Unsupported image type.";
3082
+ } else throw "Unsupported image type.";
1746
3083
  }
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();
3084
+ static async _awaitImageLoad(t) {
3085
+ t.complete && t.naturalWidth !== 0 || await new Promise((i, s) => {
3086
+ let l = (c) => {
3087
+ t.removeEventListener("load", l), t.removeEventListener("error", l), c instanceof ErrorEvent ? s("Image load error") : i();
1751
3088
  };
1752
- r.addEventListener("load", l), r.addEventListener("error", l);
3089
+ t.addEventListener("load", l), t.addEventListener("error", l);
1753
3090
  });
1754
3091
  }
1755
- static async _postWorkerMessage(r, o, h, l) {
1756
- return x._postWorkerMessageSync(await r, o, h, l);
3092
+ static async _postWorkerMessage(t, i, s, l) {
3093
+ return I._postWorkerMessageSync(await t, i, s, l);
1757
3094
  }
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;
3095
+ static _postWorkerMessageSync(t, i, s, l) {
3096
+ if (!(t instanceof Worker)) return -1;
3097
+ let c = I._workerMessageId++;
3098
+ return t.postMessage({ id: c, type: i, data: s }, l), c;
1763
3099
  }
1764
3100
  }
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) {
3101
+ I.DEFAULT_CANVAS_SIZE = 400;
3102
+ I.NO_QR_CODE_FOUND = "No QR code found";
3103
+ I._disableBarcodeDetector = !1;
3104
+ I._workerMessageId = 0;
3105
+ const Ft = class Ft {
3106
+ constructor(t, i, s) {
1771
3107
  this.events = {};
1772
- const l = document.querySelector(r.target);
3108
+ const l = document.querySelector(t.target);
1773
3109
  if (!l)
1774
- throw new Error(`Target element '${r.target}' is not found`);
1775
- this.targetElement = l, this.decode = o, this.scannerElements = h;
3110
+ throw new Error(`Target element '${t.target}' is not found`);
3111
+ this.targetElement = l, this.decode = i, this.scannerElements = s;
1776
3112
  }
1777
- async _initializeScanner(r, o = 25) {
1778
- var h, l, d, p;
3113
+ async _initializeScanner(t, i = 25) {
1779
3114
  try {
1780
- if (!r) {
1781
- const a = await this.listVideoInputDevices();
1782
- r = this._getMainCameraDeviceId(a);
3115
+ if (!t) {
3116
+ const s = await this.listVideoInputDevices();
3117
+ t = this._getMainCameraDeviceId(s);
1783
3118
  }
1784
- this.qrScanner = new x(
3119
+ this.qrScanner = new I(
1785
3120
  document.getElementById(
1786
3121
  `${this.scannerElements.VIDEO}`
1787
3122
  ),
1788
- async (a) => {
1789
- var y, g, m, E;
1790
- if (this.previousScanText !== a.data)
3123
+ async (s) => {
3124
+ if (this.previousScanText !== s.data)
1791
3125
  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)
3126
+ this.previousScanText = s.data, this.events?.[Be.CAPTURE]?.(
3127
+ await this.decode(s.data)
1795
3128
  );
1796
- } catch (w) {
1797
- (E = (m = this.events) == null ? void 0 : m[G.ERROR]) == null || E.call(m, w);
3129
+ } catch (l) {
3130
+ this.events?.[Be.ERROR]?.(l);
1798
3131
  }
1799
3132
  },
1800
3133
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1801
3134
  // @ts-ignore
1802
3135
  {
1803
3136
  returnDetailedScanResult: !0,
1804
- maxScansPerSecond: o,
1805
- preferredCamera: r,
3137
+ maxScansPerSecond: i,
3138
+ preferredCamera: t,
1806
3139
  highlightScanRegion: !0,
1807
3140
  highlightCodeOutline: !0,
1808
3141
  onDecodeError: () => {
1809
3142
  }
1810
3143
  }
1811
3144
  ), 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();
3145
+ } catch (s) {
3146
+ this.events?.[Be.ERROR]?.(s), this.qrScanner?.stop(), this.rootElement?.remove();
1814
3147
  }
1815
3148
  }
1816
3149
  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);
3150
+ return I.listCameras(!0);
3151
+ }
3152
+ _getMainCameraDeviceId(t) {
3153
+ if (!t?.length) throw new Error("No video input devices available");
3154
+ const i = ["back", "задня"];
3155
+ return t.find((l) => {
3156
+ const c = l.label.toLowerCase();
3157
+ return c.includes(i[0]) || c.includes(i[1]);
3158
+ })?.id || t[1]?.id || t[0]?.id;
1828
3159
  }
1829
3160
  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();
3161
+ this.previousScanText = null, this.events?.[Be.CANCEL]?.(), this.qrScanner?.stop(), this.rootElement?.remove();
1832
3162
  }
1833
- on(r, o) {
1834
- this.events[r] = o;
3163
+ on(t, i) {
3164
+ this.events[t] = i;
1835
3165
  }
1836
- off(r) {
1837
- this.events[r] = void 0;
3166
+ off(t) {
3167
+ this.events[t] = void 0;
1838
3168
  }
1839
3169
  };
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({
3170
+ Ft.events = Be;
3171
+ let pt = Ft;
3172
+ class bi extends pt {
3173
+ constructor(t) {
3174
+ super(t, Ri, ze);
3175
+ }
3176
+ async scan({ deviceId: t, maxScansPerSecond: i, isCloseButton: s } = {}) {
3177
+ s === void 0 && (s = !0), this.qrScanner?.stop(), this.rootElement?.remove(), new xi({
1849
3178
  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);
3179
+ props: { close: this.close.bind(this), isCloseButton: s, scannerElements: ze }
3180
+ }), this.rootElement = document.getElementById(ze.ROOT), await this._initializeScanner(t, i);
1852
3181
  }
1853
3182
  }
1854
- typeof window < "u" && (window.CredenzaScanner = Jt);
3183
+ typeof window < "u" && (window.CredenzaScanner = bi);
1855
3184
  export {
1856
- Jt as Scanner
3185
+ bi as Scanner
1857
3186
  };