@danidoble/webserial 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/webserial.js CHANGED
@@ -4,7 +4,7 @@ var Me = (f) => {
4
4
  };
5
5
  var _n = (f, r, t) => r in f ? pn(f, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[r] = t;
6
6
  var A = (f, r, t) => _n(f, typeof r != "symbol" ? r + "" : r, t), be = (f, r, t) => r.has(f) || Me("Cannot " + t);
7
- var y = (f, r, t) => (be(f, r, "read from private field"), t ? t.call(f) : r.get(f)), S = (f, r, t) => r.has(f) ? Me("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(f) : r.set(f, t), x = (f, r, t, e) => (be(f, r, "write to private field"), e ? e.call(f, t) : r.set(f, t), t), i = (f, r, t) => (be(f, r, "access private method"), t);
7
+ var y = (f, r, t) => (be(f, r, "read from private field"), t ? t.call(f) : r.get(f)), S = (f, r, t) => r.has(f) ? Me("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(f) : r.set(f, t), g = (f, r, t, e) => (be(f, r, "write to private field"), e ? e.call(f, t) : r.set(f, t), t), i = (f, r, t) => (be(f, r, "access private method"), t);
8
8
  var M = [];
9
9
  for (var ye = 0; ye < 256; ++ye)
10
10
  M.push((ye + 256).toString(16).slice(1));
@@ -67,13 +67,13 @@ class vn extends CustomEvent {
67
67
  function W(f = 100) {
68
68
  return new Promise((r) => setTimeout(() => r(), f));
69
69
  }
70
- function Ne() {
70
+ function Be() {
71
71
  return "serial" in navigator;
72
72
  }
73
73
  function we(f = 1) {
74
74
  return f * 1e3;
75
75
  }
76
- var R, H, o, Ae, Be, _, ke, C, m, ne, p, ve, Y;
76
+ var R, H, o, Ae, Ne, _, ke, x, m, ne, p, ve, Y;
77
77
  const a = class a {
78
78
  static status(r = null) {
79
79
  var e, n;
@@ -354,79 +354,79 @@ const a = class a {
354
354
  }
355
355
  static rejectLever(r = null) {
356
356
  var t, e, n;
357
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
357
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
358
358
  i(n = a, o, p).call(n, ["2", "A0", "1"]);
359
359
  }
360
360
  static resetCoinPurse(r = null) {
361
361
  var t, e, n;
362
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
362
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
363
363
  i(n = a, o, p).call(n, ["2", "A0", "2"]);
364
364
  }
365
365
  static coinInsertedBox(r = null, t = null) {
366
- var s, c, u, d;
367
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
366
+ var s, c, u, h;
367
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
368
368
  const e = ["40", "41", "42", "43", "44", "45"], n = i(u = a, o, ve).call(u, e, t);
369
- i(d = a, o, p).call(d, ["2", "A0", n]);
369
+ i(h = a, o, p).call(h, ["2", "A0", n]);
370
370
  }
371
371
  static coinInsertedTube(r = null, t = null) {
372
- var s, c, u, d;
373
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
372
+ var s, c, u, h;
373
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
374
374
  const e = ["50", "51", "52", "53", "54", "55"], n = i(u = a, o, ve).call(u, e, t);
375
- i(d = a, o, p).call(d, ["2", "A0", n]);
375
+ i(h = a, o, p).call(h, ["2", "A0", n]);
376
376
  }
377
377
  static banknoteInsertedStacker(r = null, t = null) {
378
- var s, c, u, d;
379
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
378
+ var s, c, u, h;
379
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
380
380
  const e = ["80", "81", "82", "83", "84"], n = i(u = a, o, Y).call(u, e, t);
381
- i(d = a, o, p).call(d, ["2", "B0", n]);
381
+ i(h = a, o, p).call(h, ["2", "B0", n]);
382
382
  }
383
383
  static banknoteInsertedEscrow(r = null, t = null) {
384
- var s, c, u, d;
385
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
384
+ var s, c, u, h;
385
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
386
386
  const e = ["90", "91", "92", "93", "94"], n = i(u = a, o, Y).call(u, e, t);
387
- i(d = a, o, p).call(d, ["2", "B0", n]);
387
+ i(h = a, o, p).call(h, ["2", "B0", n]);
388
388
  }
389
389
  static banknoteEjected(r = null, t = null) {
390
- var s, c, u, d;
391
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
390
+ var s, c, u, h;
391
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
392
392
  const e = ["A0", "A1", "A2", "A3", "A4"], n = i(u = a, o, Y).call(u, e, t);
393
- i(d = a, o, p).call(d, ["2", "B0", n]);
393
+ i(h = a, o, p).call(h, ["2", "B0", n]);
394
394
  }
395
395
  static banknoteInsertedRecycler(r = null, t = null) {
396
- var s, c, u, d;
397
- if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).call(c)) return !1;
396
+ var s, c, u, h;
397
+ if (!i(s = a, o, _).call(s, r) || !i(c = a, o, x).call(c)) return !1;
398
398
  const e = ["B0", "B1", "B2", "B3", "B4"], n = i(u = a, o, Y).call(u, e, t);
399
- i(d = a, o, p).call(d, ["2", "B0", n]);
399
+ i(h = a, o, p).call(h, ["2", "B0", n]);
400
400
  }
401
401
  static banknoteTaken(r = null) {
402
402
  var t, e, n;
403
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
403
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
404
404
  i(n = a, o, p).call(n, ["2", "B0", "2a"]);
405
405
  }
406
406
  static coinPurseEnabled(r = null) {
407
407
  var t, e, n;
408
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
408
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
409
409
  i(n = a, o, p).call(n, ["2", "D0", "1"]);
410
410
  }
411
411
  static coinPurseDisabled(r = null) {
412
412
  var t, e, n;
413
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
413
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
414
414
  i(n = a, o, p).call(n, ["2", "D0", "0"]);
415
415
  }
416
416
  static billPurseDisabled(r = null) {
417
417
  var t, e, n;
418
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
418
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
419
419
  i(n = a, o, p).call(n, ["2", "D1", "0", "0"]);
420
420
  }
421
421
  static billPurseEnabled(r = null) {
422
422
  var t, e, n;
423
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
423
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
424
424
  i(n = a, o, p).call(n, ["2", "D1", "1", "1"]);
425
425
  }
426
426
  static readTubes(r = null) {
427
- var b, g, T;
428
- if (!i(b = a, o, _).call(b, r) || !i(g = a, o, C).call(g)) return !1;
429
- const t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f"], [e, n, s, c, u, d] = [
427
+ var b, C, T;
428
+ if (!i(b = a, o, _).call(b, r) || !i(C = a, o, x).call(C)) return !1;
429
+ const t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f"], [e, n, s, c, u, h] = [
430
430
  t[Math.floor(Math.random() * 30)],
431
431
  t[Math.floor(Math.random() * 30)],
432
432
  t[Math.floor(Math.random() * 30)],
@@ -434,54 +434,54 @@ const a = class a {
434
434
  t[Math.floor(Math.random() * 30)],
435
435
  t[Math.floor(Math.random() * 30)]
436
436
  ];
437
- i(T = a, o, p).call(T, ["2", "D2", e, n, s, c, u, d]);
437
+ i(T = a, o, p).call(T, ["2", "D2", e, n, s, c, u, h]);
438
438
  }
439
439
  static readBillPurse(r = null, t = null) {
440
440
  var n, s, c, u;
441
- if (!i(n = a, o, _).call(n, r) || !i(s = a, o, C).call(s)) return !1;
441
+ if (!i(n = a, o, _).call(n, r) || !i(s = a, o, x).call(s)) return !1;
442
442
  let e = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c"];
443
443
  if (r._recycler.ict) {
444
- const d = e[Math.floor(Math.random() * 31)];
445
- let b = "0", g = "0", T = "0", I = "0", U = "0";
444
+ const h = e[Math.floor(Math.random() * 31)];
445
+ let b = "0", C = "0", T = "0", I = "0", U = "0";
446
446
  if (t !== null && !isNaN(parseInt(t)))
447
447
  switch (t.toString()) {
448
448
  case "20":
449
- b = d;
449
+ b = h;
450
450
  break;
451
451
  case "50":
452
- g = d;
452
+ C = h;
453
453
  break;
454
454
  case "100":
455
- T = d;
455
+ T = h;
456
456
  break;
457
457
  case "200":
458
- I = d;
458
+ I = h;
459
459
  break;
460
460
  case "500":
461
- U = d;
461
+ U = h;
462
462
  break;
463
463
  }
464
464
  else
465
465
  switch (r._recycler.bill) {
466
466
  case 0:
467
- b = d;
467
+ b = h;
468
468
  break;
469
469
  case 1:
470
- g = d;
470
+ C = h;
471
471
  break;
472
472
  case 2:
473
- T = d;
473
+ T = h;
474
474
  break;
475
475
  case 3:
476
- I = d;
476
+ I = h;
477
477
  break;
478
478
  case 4:
479
- U = d;
479
+ U = h;
480
480
  break;
481
481
  }
482
- i(c = a, o, p).call(c, ["2", "D3", b, g, T, I, U, "0"]);
482
+ i(c = a, o, p).call(c, ["2", "D3", b, C, T, I, U, "0"]);
483
483
  } else {
484
- const [d, b, g, T, I, U] = [
484
+ const [h, b, C, T, I, U] = [
485
485
  e[Math.floor(Math.random() * 30)],
486
486
  e[Math.floor(Math.random() * 30)],
487
487
  e[Math.floor(Math.random() * 30)],
@@ -489,35 +489,35 @@ const a = class a {
489
489
  e[Math.floor(Math.random())],
490
490
  e[Math.floor(Math.random())]
491
491
  ];
492
- i(u = a, o, p).call(u, ["2", "D3", d, b, g, T, I, U]);
492
+ i(u = a, o, p).call(u, ["2", "D3", h, b, C, T, I, U]);
493
493
  }
494
494
  }
495
495
  static banknoteAccepted(r = null) {
496
496
  var t, e, n;
497
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
497
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
498
498
  i(n = a, o, p).call(n, ["2", "D4", "1"]);
499
499
  }
500
500
  static banknoteRejected(r = null) {
501
501
  var t, e, n;
502
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
502
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
503
503
  i(n = a, o, p).call(n, ["2", "D4", "0"]);
504
504
  }
505
505
  static banknotesDispensed(r = null) {
506
506
  var e, n, s, c;
507
- if (!i(e = a, o, _).call(e, r) || !i(n = a, o, C).call(n)) return !1;
507
+ if (!i(e = a, o, _).call(e, r) || !i(n = a, o, x).call(n)) return !1;
508
508
  let t = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c"];
509
509
  if (r._recycler.ict) {
510
510
  const u = t[Math.floor(Math.random() * 30)];
511
- let d = "0", b = "0", g = "0", T = "0", I = "0";
511
+ let h = "0", b = "0", C = "0", T = "0", I = "0";
512
512
  switch (r._recycler.bill) {
513
513
  case 0:
514
- d = u;
514
+ h = u;
515
515
  break;
516
516
  case 1:
517
517
  b = u;
518
518
  break;
519
519
  case 2:
520
- g = u;
520
+ C = u;
521
521
  break;
522
522
  case 3:
523
523
  T = u;
@@ -526,9 +526,9 @@ const a = class a {
526
526
  I = u;
527
527
  break;
528
528
  }
529
- i(s = a, o, p).call(s, ["2", "D5", d, b, g, T, I, "0"]);
529
+ i(s = a, o, p).call(s, ["2", "D5", h, b, C, T, I, "0"]);
530
530
  } else {
531
- const [u, d, b, g, T, I] = [
531
+ const [u, h, b, C, T, I] = [
532
532
  t[Math.floor(Math.random() * 30)],
533
533
  t[Math.floor(Math.random() * 30)],
534
534
  t[Math.floor(Math.random() * 30)],
@@ -536,72 +536,72 @@ const a = class a {
536
536
  t[Math.floor(Math.random())],
537
537
  t[Math.floor(Math.random())]
538
538
  ];
539
- i(c = a, o, p).call(c, ["2", "D5", u, d, b, g, T, I]);
539
+ i(c = a, o, p).call(c, ["2", "D5", u, h, b, C, T, I]);
540
540
  }
541
541
  }
542
542
  static coinsDispensed(r = null) {
543
543
  var t, e, n;
544
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
544
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
545
545
  i(n = a, o, p).call(n, ["2", "D6"]);
546
546
  }
547
547
  static relayOn(r = null) {
548
548
  var t, e, n;
549
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
549
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
550
550
  i(n = a, o, p).call(n, ["2", "DA", "1"]);
551
551
  }
552
552
  static relayOff(r = null) {
553
553
  var t, e, n;
554
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
554
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
555
555
  i(n = a, o, p).call(n, ["2", "DA", "0"]);
556
556
  }
557
557
  static nayaxEnabled(r = null) {
558
558
  var t, e, n;
559
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
559
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
560
560
  i(n = a, o, p).call(n, ["2", "DD", "1"]);
561
561
  }
562
562
  static nayaxDisabled(r = null) {
563
563
  var t, e, n;
564
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
564
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
565
565
  i(n = a, o, p).call(n, ["2", "DD", "0"]);
566
566
  }
567
567
  static nayaxPreCreditAuthorized(r = null) {
568
568
  var t, e, n;
569
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
569
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
570
570
  i(n = a, o, p).call(n, ["2", "DD", "3"]);
571
571
  }
572
572
  static nayaxCancelRequest(r = null) {
573
573
  var t, e, n;
574
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
574
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
575
575
  i(n = a, o, p).call(n, ["2", "DD", "4"]);
576
576
  }
577
577
  static nayaxSellApproved(r = null) {
578
578
  var t, e, n;
579
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
579
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
580
580
  i(n = a, o, p).call(n, ["2", "DD", "5"]);
581
581
  }
582
582
  static nayaxSellDenied(r = null) {
583
583
  var t, e, n;
584
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
584
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
585
585
  i(n = a, o, p).call(n, ["2", "DD", "6"]);
586
586
  }
587
587
  static nayaxEndSession(r = null) {
588
588
  var t, e, n;
589
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
589
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
590
590
  i(n = a, o, p).call(n, ["2", "DD", "7"]);
591
591
  }
592
592
  static nayaxCancelled(r = null) {
593
593
  var t, e, n;
594
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
594
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
595
595
  i(n = a, o, p).call(n, ["2", "DD", "8"]);
596
596
  }
597
597
  static nayaxDispensed(r = null) {
598
598
  var t, e, n;
599
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
599
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
600
600
  i(n = a, o, p).call(n, ["2", "DD", "A", "0"]);
601
601
  }
602
602
  static nayaxNotDispensed(r = null) {
603
603
  var t, e, n;
604
- if (!i(t = a, o, _).call(t, r) || !i(e = a, o, C).call(e)) return !1;
604
+ if (!i(t = a, o, _).call(t, r) || !i(e = a, o, x).call(e)) return !1;
605
605
  i(n = a, o, p).call(n, ["2", "DD", "A", "1"]);
606
606
  }
607
607
  static fullTray(r = null) {
@@ -618,16 +618,16 @@ const a = class a {
618
618
  R = new WeakMap(), H = new WeakMap(), o = new WeakSet(), Ae = function() {
619
619
  if (a.enable === !1) throw new Error("Emulator is disabled");
620
620
  return a.enable;
621
- }, Be = function(r) {
621
+ }, Ne = function(r) {
622
622
  if (typeof r != "object" || !(r instanceof G)) throw new Error(`Type ${r.typeDevice} is not supported`);
623
- return a.instance = r, x(a, R, r.typeDevice), x(a, H, r.deviceNumber), !0;
623
+ return a.instance = r, g(a, R, r.typeDevice), g(a, H, r.deviceNumber), !0;
624
624
  }, _ = function(r = null) {
625
625
  var t, e;
626
- return !i(t = a, o, Ae).call(t) || r === null && a.instance === null ? !1 : (a.instance === null && i(e = a, o, Be).call(e, r), !0);
626
+ return !i(t = a, o, Ae).call(t) || r === null && a.instance === null ? !1 : (a.instance === null && i(e = a, o, Ne).call(e, r), !0);
627
627
  }, ke = function() {
628
628
  if (y(a, R) !== "locker") throw new Error("This function is only available for Locker devices");
629
629
  return !0;
630
- }, C = function() {
630
+ }, x = function() {
631
631
  if (y(a, R) !== "boardroid") throw new Error("This function is only available for Boardroid devices");
632
632
  return !0;
633
633
  }, m = function() {
@@ -748,7 +748,7 @@ A(k, "instance", null), A(k, "devices", {
748
748
  });
749
749
  let D = k;
750
750
  D.instance || (D.instance = new D());
751
- var w, qe, me, $, Re, He, Le, Oe, Ue, je, We, $e, Qe, Ve, Je, ze;
751
+ var w, qe, me, Q, Re, He, Le, Oe, Ue, je, We, Qe, Ve, Je, ze, $e;
752
752
  class G extends Pe {
753
753
  /**
754
754
  *
@@ -799,7 +799,8 @@ class G extends Pe {
799
799
  device: {
800
800
  type: "unknown",
801
801
  id: kn(),
802
- listen_on_port: null
802
+ listen_on_port: null,
803
+ door_open: !1
803
804
  },
804
805
  time: {
805
806
  response_connection: 500,
@@ -824,12 +825,15 @@ class G extends Pe {
824
825
  backup_dispense: {}
825
826
  }
826
827
  });
827
- t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w, Je).call(this, n), s && (typeof s == "number" || typeof s == "string") && (this.listenOnPort = s), i(this, w, We).call(this), i(this, w, $e).call(this);
828
+ t && (this.serialFilters = t), e && (this.serialConfigPort = e), n && i(this, w, ze).call(this, n), s && (typeof s == "number" || typeof s == "string") && (this.listenOnPort = s), i(this, w, We).call(this), i(this, w, Qe).call(this);
828
829
  }
829
830
  set listenOnPort(t) {
830
831
  if (t = parseInt(t), isNaN(t) || t < 1 || t > 255) throw new Error("Invalid port number");
831
832
  this.__internal__.device.listen_on_port = t, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(t);
832
833
  }
834
+ get isDoorOpen() {
835
+ return this.__internal__.device.door_open;
836
+ }
833
837
  get listenOnPort() {
834
838
  return this.__internal__.device.listen_on_port ?? 1;
835
839
  }
@@ -878,7 +882,7 @@ class G extends Pe {
878
882
  }
879
883
  async connect() {
880
884
  return new Promise((t, e) => {
881
- Ne() || e("Web Serial not supported"), setTimeout(async () => {
885
+ Be() || e("Web Serial not supported"), setTimeout(async () => {
882
886
  await W(499), await this.serialConnect(), this.isConnected ? t(`${this.typeDevice} device ${this.deviceNumber} connected`) : e(`${this.typeDevice} device ${this.deviceNumber} not connected`);
883
887
  }, 1);
884
888
  });
@@ -967,7 +971,7 @@ class G extends Pe {
967
971
  }, this.__internal__.time.response_connection), await i(this, w, me).call(this, this.__internal__.serial.bytes_connection), this.dispatch("serial:sent", {
968
972
  action: "connect",
969
973
  bytes: this.__internal__.serial.bytes_connection
970
- }), this.typeDevice === "relay" && i(this, w, $).call(this, ["DD", "DD"], null), await i(this, w, Ue).call(this);
974
+ }), this.typeDevice === "relay" && i(this, w, Q).call(this, ["DD", "DD"], null), await i(this, w, Ue).call(this);
971
975
  } catch (t) {
972
976
  this.serialErrors(t);
973
977
  }
@@ -1108,7 +1112,7 @@ class G extends Pe {
1108
1112
  });
1109
1113
  }
1110
1114
  softReload() {
1111
- i(this, w, ze).call(this), this.dispatch("serial:soft-reload", {});
1115
+ i(this, w, $e).call(this), this.dispatch("serial:soft-reload", {});
1112
1116
  }
1113
1117
  async sendConnect() {
1114
1118
  await this.appendToQueue(this.__internal__.serial.bytes_connection, "connect");
@@ -1131,7 +1135,7 @@ w = new WeakSet(), qe = function(t) {
1131
1135
  }, // #bytesToLowerCase(code = []) {
1132
1136
  // return code.map((item) => item.toString().toLowerCase());
1133
1137
  // }
1134
- $ = function(t = [], e = null) {
1138
+ Q = function(t = [], e = null) {
1135
1139
  if (t && t.length > 0) {
1136
1140
  this.__internal__.serial.connected || (this.dispatch("serial:connected"), D.instance.dispatch("change")), this.__internal__.serial.connected = !0, this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
1137
1141
  const n = [];
@@ -1158,14 +1162,14 @@ $ = function(t = [], e = null) {
1158
1162
  let t = [];
1159
1163
  for (const e in this.__internal__.serial.response.buffer)
1160
1164
  t.push(this.__internal__.serial.response.buffer[e].toString(16));
1161
- this.__internal__.serial.response.buffer && i(this, w, $).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
1165
+ this.__internal__.serial.response.buffer && i(this, w, Q).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
1162
1166
  }, 400);
1163
1167
  }, Oe = async function() {
1164
1168
  if (this.__internal__.serial.response.length === this.__internal__.serial.response.buffer.length) {
1165
1169
  const t = [];
1166
1170
  for (const e in this.__internal__.serial.response.buffer)
1167
1171
  t.push(this.__internal__.serial.response.buffer[e].toString(16));
1168
- await i(this, w, $).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
1172
+ await i(this, w, Q).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
1169
1173
  } else if (this.__internal__.serial.response.length < this.__internal__.serial.response.buffer.length) {
1170
1174
  let t = [];
1171
1175
  for (let n = 0; n < this.__internal__.serial.response.length; n++)
@@ -1174,7 +1178,7 @@ $ = function(t = [], e = null) {
1174
1178
  const n = [];
1175
1179
  for (const s in t)
1176
1180
  n.push(t[s].toString(16));
1177
- await i(this, w, $).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
1181
+ await i(this, w, Q).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
1178
1182
  return;
1179
1183
  }
1180
1184
  t = [];
@@ -1186,7 +1190,7 @@ $ = function(t = [], e = null) {
1186
1190
  const n = [];
1187
1191
  for (const s in t)
1188
1192
  n.push(t[s].toString(16));
1189
- await i(this, w, $).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
1193
+ await i(this, w, Q).call(this, n), this.__internal__.serial.response.buffer = new Uint8Array(0);
1190
1194
  }
1191
1195
  }
1192
1196
  }
@@ -1235,19 +1239,19 @@ $ = function(t = [], e = null) {
1235
1239
  ].forEach((e) => {
1236
1240
  this.serialRegisterAvailableListener(e);
1237
1241
  });
1238
- }, $e = function() {
1242
+ }, Qe = function() {
1239
1243
  const t = this;
1240
1244
  this.on("internal:queue", async () => {
1241
1245
  var e;
1242
- await i(e = t, w, Ve).call(e);
1243
- }), i(this, w, Qe).call(this);
1244
- }, Qe = function() {
1246
+ await i(e = t, w, Je).call(e);
1247
+ }), i(this, w, Ve).call(this);
1248
+ }, Ve = function() {
1245
1249
  const t = this;
1246
1250
  navigator.serial.addEventListener("connect", async () => {
1247
1251
  t.isDisconnected && await t.serialConnect().catch(() => {
1248
1252
  });
1249
1253
  });
1250
- }, Ve = async function() {
1254
+ }, Je = async function() {
1251
1255
  if (!this.__internal__.serial.connected) {
1252
1256
  await this.serialConnect();
1253
1257
  return;
@@ -1260,16 +1264,16 @@ $ = function(t = [], e = null) {
1260
1264
  }, e), await i(this, w, me).call(this, t.bytes), this.dispatch("serial:sent", {
1261
1265
  action: t.action,
1262
1266
  bytes: t.bytes
1263
- }), this.typeDevice === "relay" && i(this, w, $).call(this, ["DD", "DD"], null);
1267
+ }), this.typeDevice === "relay" && i(this, w, Q).call(this, ["DD", "DD"], null);
1264
1268
  const n = [...this.__internal__.serial.queue];
1265
1269
  this.__internal__.serial.queue = n.splice(1);
1266
- }, Je = function(t = 1) {
1270
+ }, ze = function(t = 1) {
1267
1271
  this.__internal__.device_number = t, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(t);
1268
- }, ze = function() {
1272
+ }, $e = function() {
1269
1273
  this.__internal__.last_error = { message: null, action: null, code: null, no_code: 0 };
1270
1274
  };
1271
1275
  var X, _e, Ge;
1272
- class gn extends G {
1276
+ class Cn extends G {
1273
1277
  constructor({
1274
1278
  filters: t = null,
1275
1279
  config_port: e = null,
@@ -1330,8 +1334,8 @@ class gn extends G {
1330
1334
  X = new WeakMap(), _e = new WeakSet(), Ge = function() {
1331
1335
  D.add(this);
1332
1336
  };
1333
- var N, E, j, v, Ye, Ke, Ze, ge, K, Q, ie, re, se;
1334
- class Cn extends G {
1337
+ var B, E, j, v, Ye, Ke, Ze, Ce, K, V, ie, re, se;
1338
+ class xn extends G {
1335
1339
  constructor({
1336
1340
  filters: t = null,
1337
1341
  config_port: e = null,
@@ -1340,7 +1344,7 @@ class Cn extends G {
1340
1344
  } = {}) {
1341
1345
  super({ filters: t, config_port: e, no_device: n, device_listen_on_port: s });
1342
1346
  S(this, v);
1343
- S(this, N, !1);
1347
+ S(this, B, !1);
1344
1348
  S(this, E, 0);
1345
1349
  S(this, j, 0);
1346
1350
  if (this.__internal__.device.type = "locker", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
@@ -1361,14 +1365,14 @@ class Cn extends G {
1361
1365
  case "07":
1362
1366
  switch (t[4]) {
1363
1367
  case "00":
1364
- e.name = "Cell closed.", e.description = "The selected cell is closed.", e.request = "dispense", e.no_code = 1102, this.__internal__.dispense.status = !1, this.dispatch("dispensed", {}), y(this, N) && y(this, E) >= 89 ? (e.finished_test = !0, x(this, N, !1), x(this, E, 0)) : y(this, N) && (e.finished_test = !1);
1368
+ e.name = "Cell closed.", e.description = "The selected cell is closed.", e.request = "dispense", e.no_code = 1102, this.__internal__.dispense.status = !1, this.dispatch("dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
1365
1369
  break;
1366
1370
  case "01":
1367
1371
  case "04":
1368
- e.name = "Cell open.", e.description = "The selected cell was open successfully.", e.request = "dispense", e.no_code = 102, this.__internal__.dispense.status = !0, this.dispatch("dispensed", {}), y(this, N) && y(this, E) >= 89 ? (e.finished_test = !0, x(this, N, !1), x(this, E, 0)) : y(this, N) && (e.finished_test = !1);
1372
+ e.name = "Cell open.", e.description = "The selected cell was open successfully.", e.request = "dispense", e.no_code = 102, this.__internal__.dispense.status = !0, this.dispatch("dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
1369
1373
  break;
1370
1374
  case "05":
1371
- e.name = "Cell inactive.", e.description = "The selected cell is inactive or doesn't exist.", e.request = "dispense", e.no_code = 101, this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", {}), y(this, N) && y(this, E) >= 89 ? (e.finished_test = !0, x(this, N, !1), x(this, E, 0)) : y(this, N) && (e.finished_test = !1);
1375
+ e.name = "Cell inactive.", e.description = "The selected cell is inactive or doesn't exist.", e.request = "dispense", e.no_code = 101, this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", {}), y(this, B) && y(this, E) >= 89 ? (e.finished_test = !0, g(this, B, !1), g(this, E, 0)) : y(this, B) && (e.finished_test = !1);
1372
1376
  break;
1373
1377
  }
1374
1378
  break;
@@ -1390,16 +1394,16 @@ class Cn extends G {
1390
1394
  try {
1391
1395
  n = new Uint8Array(t.length + 8), n.set(t, 2), n[0] = 2, n[1] = t.length + 4, n[n.length - 2] = 3;
1392
1396
  let s = 0;
1393
- for (let d = 1; d < t.length; d++)
1394
- s += t[d], s *= parseInt(Math.pow(2, d - 1).toString());
1397
+ for (let h = 1; h < t.length; h++)
1398
+ s += t[h], s *= parseInt(Math.pow(2, h - 1).toString());
1395
1399
  n[t.length + 2] = s % 256, n[t.length + 3] = e * 3 % 256, n[t.length + 4] = e * 8 % 256;
1396
1400
  let c = 0;
1397
- for (let d = 3; d < t.length + 5; d++)
1398
- c += n[d];
1401
+ for (let h = 3; h < t.length + 5; h++)
1402
+ c += n[h];
1399
1403
  n[t.length + 5] = c % 256;
1400
1404
  let u = 0;
1401
- for (let d = 0; d < n.length - 1; d++)
1402
- u ^= n[d];
1405
+ for (let h = 0; h < n.length - 1; h++)
1406
+ u ^= n[h];
1403
1407
  n[n.length - 1] = u;
1404
1408
  } catch (s) {
1405
1409
  this.serialErrors(`Error generating command: ${s.message}`), n = null;
@@ -1431,38 +1435,38 @@ class Cn extends G {
1431
1435
  }
1432
1436
  async enable({ cell: t = 1 } = {}) {
1433
1437
  t = i(this, v, K).call(this, t);
1434
- const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, ge).call(this, { enable: !0, column: e, row: n });
1438
+ const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, Ce).call(this, { enable: !0, column: e, row: n });
1435
1439
  await this.appendToQueue(s, "activate");
1436
1440
  }
1437
1441
  async disable({ cell: t = 1 } = {}) {
1438
1442
  t = i(this, v, K).call(this, t);
1439
- const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, ge).call(this, { enable: !1, column: e, row: n });
1443
+ const [e, n] = this.parseCellToColumnRow(t), s = i(this, v, Ce).call(this, { enable: !1, column: e, row: n });
1440
1444
  await this.appendToQueue(s, "disable");
1441
1445
  }
1442
1446
  async openAll() {
1443
1447
  if (this.isDispensing) throw new Error("Another dispensing process is running");
1444
- i(this, v, Q).call(this), x(this, N, !0), i(this, v, ie).call(this);
1448
+ i(this, v, V).call(this), g(this, B, !0), i(this, v, ie).call(this);
1445
1449
  const t = [];
1446
1450
  for (let e = 1; e <= 90; e++) {
1447
1451
  const n = await this.dispense(e);
1448
- t.push(n), x(this, E, e), i(this, v, ie).call(this);
1452
+ t.push(n), g(this, E, e), i(this, v, ie).call(this);
1449
1453
  }
1450
- x(this, E, 90), i(this, v, ie).call(this, t), i(this, v, Q).call(this);
1454
+ g(this, E, 90), i(this, v, ie).call(this, t), i(this, v, V).call(this);
1451
1455
  }
1452
1456
  async enableAll() {
1453
- i(this, v, Q).call(this), x(this, N, !0), i(this, v, re).call(this);
1457
+ i(this, v, V).call(this), g(this, B, !0), i(this, v, re).call(this);
1454
1458
  for (let t = 1; t <= 90; t++)
1455
- await this.enable(t), x(this, E, t), i(this, v, re).call(this);
1456
- x(this, E, 90), i(this, v, re).call(this), i(this, v, Q).call(this);
1459
+ await this.enable(t), g(this, E, t), i(this, v, re).call(this);
1460
+ g(this, E, 90), i(this, v, re).call(this), i(this, v, V).call(this);
1457
1461
  }
1458
1462
  async disableAll() {
1459
- i(this, v, Q).call(this), x(this, N, !0), i(this, v, se).call(this);
1463
+ i(this, v, V).call(this), g(this, B, !0), i(this, v, se).call(this);
1460
1464
  for (let t = 1; t <= 90; t++)
1461
- await this.enable(t), x(this, E, t), i(this, v, se).call(this);
1462
- x(this, E, 90), i(this, v, se).call(this), i(this, v, Q).call(this);
1465
+ await this.enable(t), g(this, E, t), i(this, v, se).call(this);
1466
+ g(this, E, 90), i(this, v, se).call(this), i(this, v, V).call(this);
1463
1467
  }
1464
1468
  }
1465
- N = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye = function() {
1469
+ B = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye = function() {
1466
1470
  const t = [
1467
1471
  "percentage:disable",
1468
1472
  "percentage:enable",
@@ -1474,7 +1478,7 @@ N = new WeakMap(), E = new WeakMap(), j = new WeakMap(), v = new WeakSet(), Ye =
1474
1478
  D.add(this);
1475
1479
  }, Ze = function(t = 1) {
1476
1480
  return t = i(this, v, K).call(this, t), this.serialLockerHexCmd(new Uint8Array([16, this.__internal__.device.listen_on_port, t]));
1477
- }, ge = function({ enable: t = !0, column: e = 0, row: n = 10 } = {}) {
1481
+ }, Ce = function({ enable: t = !0, column: e = 0, row: n = 10 } = {}) {
1478
1482
  if (e < 0 || e > 8) throw new Error("Invalid column number");
1479
1483
  if (n < 0 || n > 10) throw new Error("Invalid row number");
1480
1484
  let s = 1;
@@ -1491,17 +1495,17 @@ K = function(t) {
1491
1495
  const e = parseInt(t);
1492
1496
  if (isNaN(e) || e < 1 || e > 90) throw new Error("Invalid cell number");
1493
1497
  return e;
1494
- }, Q = function() {
1495
- x(this, N, !1), x(this, E, 0), x(this, j, 0);
1498
+ }, V = function() {
1499
+ g(this, B, !1), g(this, E, 0), g(this, j, 0);
1496
1500
  }, ie = function(t = null) {
1497
- x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:open", { percentage: y(this, j), dispensed: t });
1501
+ g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:open", { percentage: y(this, j), dispensed: t });
1498
1502
  }, re = function() {
1499
- x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:enable", { percentage: y(this, j) });
1503
+ g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:enable", { percentage: y(this, j) });
1500
1504
  }, se = function() {
1501
- x(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:disable", { percentage: y(this, j) });
1505
+ g(this, j, Math.round(y(this, E) * 100 / 90)), this.dispatch("percentage:disable", { percentage: y(this, j) });
1502
1506
  };
1503
- var l, Xe, et, tt, B, ae, nt, it, rt, st, at, ot, lt, ct, ht, dt, ut, pt, _t, ft, bt, yt, wt, kt, vt, mt, gt, Ct, xt, Tt, Dt, Et, L, F, oe, P, O, It, St, Mt, Ft, Z, Ce, xe, le, ce, Pt;
1504
- class xn extends G {
1507
+ var l, Xe, et, tt, N, ae, nt, it, rt, st, at, ot, lt, ct, ht, dt, ut, pt, _t, ft, bt, yt, wt, kt, vt, mt, Ct, xt, gt, Tt, Dt, Et, L, F, oe, P, O, It, St, Mt, Ft, Z, xe, ge, le, ce, Pt;
1508
+ class gn extends G {
1505
1509
  constructor({
1506
1510
  filters: t = null,
1507
1511
  config_port: e = null,
@@ -1538,7 +1542,7 @@ class xn extends G {
1538
1542
  }
1539
1543
  });
1540
1544
  if (this.__internal__.device.type = "jofemar", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
1541
- this.__internal__.dispense.must_response = !0, this.__internal__.time.response_general = 800, this.__internal__.time.response_engines = 800, this.__internal__.dispense.limit_counter = 40, this.__internal__.dispense.timeout = 0, this.__internal__.dispense.timeout_time = 4e3, this.__internal__.dispense.interval = 0, this.__internal__.dispense.interval_time = 1e3, this.__internal__.device.hex_number = (128 + this.listenOnPort).toString(16), this.__internal__.dispense.elevator = {
1545
+ this.__internal__.dispense.must_response = !0, this.__internal__.time.response_general = 800, this.__internal__.time.response_engines = 800, this.__internal__.dispense.limit_counter = 40, this.__internal__.dispense.timeout = 0, this.__internal__.dispense.timeout_time = 4e3, this.__internal__.dispense.interval = 0, this.__internal__.dispense.interval_time = 1e3, this.__internal__.device.hex_number = (128 + this.listenOnPort).toString(16), this.__internal__.device.door_open = !1, this.__internal__.dispense.elevator = {
1542
1546
  locking_time: 60,
1543
1547
  locking_interval: 0,
1544
1548
  need_reset: !1
@@ -1641,11 +1645,11 @@ class xn extends G {
1641
1645
  };
1642
1646
  let u = ["02", "30", "30", this.__internal__.device.hex_number, "56", s, n];
1643
1647
  e && (u[4] = "4D"), u = i(this, l, ae).call(this, u);
1644
- let d;
1648
+ let h;
1645
1649
  do
1646
- d = await this.internalDispense(u), i(this, l, Mt).call(this), d.error === "elevator-locked" ? await i(this, l, nt).call(this) : d.error === "no-response" && await W(1e3);
1647
- while (["elevator-locked", "no-response"].includes(d.error));
1648
- return this.__internal__.dispense.backup_dispense = {}, d;
1650
+ h = await this.internalDispense(u), i(this, l, Mt).call(this), h.error === "elevator-locked" ? await i(this, l, nt).call(this) : h.error === "no-response" && await W(1e3);
1651
+ while (["elevator-locked", "no-response"].includes(h.error));
1652
+ return this.__internal__.dispense.backup_dispense = {}, h;
1649
1653
  }
1650
1654
  internalClearSensing() {
1651
1655
  super.internalClearSensing(), this.__internal__.dispense.timeout && clearTimeout(this.__internal__.dispense.timeout), this.__internal__.dispense.interval && clearInterval(this.__internal__.dispense.interval), this.__internal__.serial.queue.length > 0 && (this.__internal__.serial.queue = this.__internal__.serial.queue.filter((t) => t.type !== "status"));
@@ -1656,7 +1660,7 @@ class xn extends G {
1656
1660
  }
1657
1661
  async collect() {
1658
1662
  const t = ["02", "30", "30", "81", "4E", "FF", "FF"];
1659
- return await i(this, l, B).call(this, t, "collect");
1663
+ return await i(this, l, N).call(this, t, "collect");
1660
1664
  }
1661
1665
  async resetSoldOutErrors() {
1662
1666
  return await i(this, l, Z).call(this, "80");
@@ -1665,9 +1669,9 @@ class xn extends G {
1665
1669
  return await i(this, l, Z).call(this, "81");
1666
1670
  }
1667
1671
  async resetMachineErrors() {
1668
- return this.__internal__.serial.queue.length === 0 ? (i(this, l, Ce).call(this), await i(this, l, Z).call(this, "FF")) : new Promise((t) => {
1672
+ return this.__internal__.serial.queue.length === 0 ? (i(this, l, xe).call(this), await i(this, l, Z).call(this, "FF")) : new Promise((t) => {
1669
1673
  const e = setInterval(async () => {
1670
- this.__internal__.serial.queue.length > 0 || (clearInterval(e), await i(this, l, Z).call(this, "FF"), i(this, l, Ce).call(this), t(!0));
1674
+ this.__internal__.serial.queue.length > 0 || (clearInterval(e), await i(this, l, Z).call(this, "FF"), i(this, l, xe).call(this), t(!0));
1671
1675
  }, 100);
1672
1676
  });
1673
1677
  }
@@ -1676,17 +1680,17 @@ class xn extends G {
1676
1680
  }
1677
1681
  async status() {
1678
1682
  const t = ["02", "30", "30", "81", "53", "FF", "FF"];
1679
- return await i(this, l, B).call(this, t, "status");
1683
+ return await i(this, l, N).call(this, t, "status");
1680
1684
  }
1681
1685
  async lightsOn() {
1682
- return await i(this, l, xe).call(this, "81");
1686
+ return await i(this, l, ge).call(this, "81");
1683
1687
  }
1684
1688
  async lightsOff() {
1685
- return await i(this, l, xe).call(this, "80");
1689
+ return await i(this, l, ge).call(this, "80");
1686
1690
  }
1687
1691
  async program(t, e) {
1688
1692
  const n = ["02", "30", "30", "81", "50", t, e];
1689
- return await i(this, l, B).call(this, n, "program");
1693
+ return await i(this, l, N).call(this, n, "program");
1690
1694
  }
1691
1695
  async programDisplayLanguage({ language: t = "spanish" } = {}) {
1692
1696
  const e = { spanish: "30", english: "31", french: "32" };
@@ -1799,7 +1803,7 @@ class xn extends G {
1799
1803
  if (e = parseFloat(e), t = parseInt(t), isNaN(t) || t < 1 || t > this.__device.channels.verification.end) throw new Error(`Invalid selection, valid range is 1 to ${this.__device.channels.verification.end}`);
1800
1804
  if (isNaN(e) || e < 5 || e > 9.5 || e % 0.5 !== 0) throw new Error("Invalid voltage, valid range is 5 to 9.5");
1801
1805
  const n = 109 + t, c = (128 + (e - 5) * 2).toString(16), u = ["02", "30", "30", "81", "47", n, c];
1802
- return await i(this, l, B).call(this, u, "voltage-engine");
1806
+ return await i(this, l, N).call(this, u, "voltage-engine");
1803
1807
  }
1804
1808
  /**
1805
1809
  * @param {number|string} selection
@@ -1809,7 +1813,7 @@ class xn extends G {
1809
1813
  async programPushOverProducts({ selection: t = 1, enable: e = !0 } = {}) {
1810
1814
  if (t = parseInt(t), isNaN(t) || t < 1 || t > this.__device.channels.verification.end) throw new Error(`Invalid selection, valid range is 1 to ${this.__device.channels.verification.end}`);
1811
1815
  const c = ["02", "30", "30", "81", "4F", 109 + t, e ? "31" : "30"];
1812
- return await i(this, l, B).call(this, c, "push-over-products");
1816
+ return await i(this, l, N).call(this, c, "push-over-products");
1813
1817
  }
1814
1818
  /**
1815
1819
  * @param {number|string} selection
@@ -1822,11 +1826,11 @@ class xn extends G {
1822
1826
  const n = 109 + t;
1823
1827
  e = e.toFixed(1);
1824
1828
  const s = 128 + e * 10, c = ["02", "30", "30", "81", "45", n, s];
1825
- return await i(this, l, B).call(this, c, "channel-running-after-dispense");
1829
+ return await i(this, l, N).call(this, c, "channel-running-after-dispense");
1826
1830
  }
1827
1831
  async checkData(t, e = "FF") {
1828
1832
  const n = ["02", "30", "30", "81", "43", t, e];
1829
- return await i(this, l, B).call(this, n, "check-data");
1833
+ return await i(this, l, N).call(this, n, "check-data");
1830
1834
  }
1831
1835
  async getDisplayLanguage() {
1832
1836
  return await this.checkData("49");
@@ -1942,7 +1946,7 @@ class xn extends G {
1942
1946
  async programClock({ date: t = /* @__PURE__ */ new Date() } = {}) {
1943
1947
  if (!(t instanceof Date)) throw new Error("Invalid date, must be an instance of Date");
1944
1948
  const e = ["02", "30", "30", "81", "72", ...i(this, l, Pt).call(this, t)];
1945
- return await i(this, l, B).call(this, e, "clock");
1949
+ return await i(this, l, N).call(this, e, "clock");
1946
1950
  }
1947
1951
  /**
1948
1952
  * @param {null|string} event
@@ -1952,7 +1956,7 @@ class xn extends G {
1952
1956
  async eventsConfig({ event: t = null, enable: e = !0 } = {}) {
1953
1957
  if (t === null) throw new Error("Invalid event");
1954
1958
  const s = ["02", "30", "30", "81", "41", t, e ? "31" : "30"];
1955
- return await i(this, l, B).call(this, s, "events-config");
1959
+ return await i(this, l, N).call(this, s, "events-config");
1956
1960
  }
1957
1961
  async eventEnable({ event: t = null } = {}) {
1958
1962
  if (t === null) throw new Error("Invalid event");
@@ -1968,7 +1972,7 @@ class xn extends G {
1968
1972
  }
1969
1973
  async sendCustomCode({ code: t = [] } = {}) {
1970
1974
  if (t.length < 5) throw new Error("Invalid code, minimum length is 5");
1971
- return await i(this, l, B).call(this, t, "custom");
1975
+ return await i(this, l, N).call(this, t, "custom");
1972
1976
  }
1973
1977
  async assignChannels() {
1974
1978
  const t = this.__device.channels.verification.start, e = this.__device.channels.verification.end;
@@ -2023,7 +2027,7 @@ l = new WeakSet(), Xe = function() {
2023
2027
  this.on("internal:dispense:running", i(this, l, Ft).bind(this));
2024
2028
  }, tt = function() {
2025
2029
  D.add(this);
2026
- }, B = function(t, e) {
2030
+ }, N = function(t, e) {
2027
2031
  return t[3] = this.__internal__.device.hex_number, this.appendToQueue(i(this, l, ae).call(this, t), e);
2028
2032
  }, ae = function(t) {
2029
2033
  let e = this.hexToDec(this.sumHex(t)), n = this.calcCheckSums(e.toString());
@@ -2071,7 +2075,7 @@ l = new WeakSet(), Xe = function() {
2071
2075
  };
2072
2076
  return e.additional.ascii = n[t] ?? null, e.name = "Key pressed", e.description = `The key ${e.additional.ascii} was pressed`, e.no_code = 2, this.dispatch("keyboard:pressed", e.additional), e;
2073
2077
  }, st = function(t, e) {
2074
- return e.additional = { open: !1 }, e.no_code = 3, t === "4f" ? (e.name = "door open", e.description = "The door was opened", e.additional.open = !0, this.dispatch("door:event", e.additional)) : t === "43" ? (e.name = "door close", e.description = "The door was closed", e.additional.open = !1, this.dispatch("door:event", e.additional)) : (e.name = "door event", e.description = "The door event received is unknown", this.dispatch("door:event", { open: e.additional.open, message: e })), e;
2078
+ return e.additional = { open: !1 }, e.no_code = 3, t === "4f" ? (e.name = "door open", e.description = "The door was opened", e.additional.open = !0, this.__internal__.device.door_open = !0, this.dispatch("door:event", e.additional)) : t === "43" ? (e.name = "door close", e.description = "The door was closed", e.additional.open = !1, this.__internal__.device.door_open = !1, this.dispatch("door:event", e.additional)) : (e.name = "door event", e.description = "The door event received is unknown", this.dispatch("door:event", { open: e.additional.open, message: e })), e;
2075
2079
  }, at = function(t, e) {
2076
2080
  e.no_code = 404;
2077
2081
  let n = t[5] ?? null;
@@ -2128,12 +2132,12 @@ l = new WeakSet(), Xe = function() {
2128
2132
  return this.dispatch("machine:faults", e.additional), e;
2129
2133
  }, ct = function(t, e) {
2130
2134
  e.no_code = 40, e.name = "Clock registers", e.description = "Clock registers";
2131
- const n = t.slice(4, -3), s = n.map((fe) => String.fromCharCode(this.hexToDec(fe))).join(""), [c, u] = s.split(" "), [d, b] = c.split(":"), [g, T, I] = u.split("-"), U = new Date(2e3 + parseInt(I), parseInt(T) - 1, parseInt(g), parseInt(d), parseInt(b));
2135
+ const n = t.slice(4, -3), s = n.map((fe) => String.fromCharCode(this.hexToDec(fe))).join(""), [c, u] = s.split(" "), [h, b] = c.split(":"), [C, T, I] = u.split("-"), U = new Date(2e3 + parseInt(I), parseInt(T) - 1, parseInt(C), parseInt(h), parseInt(b));
2132
2136
  return e.additional = {
2133
- day: g,
2137
+ day: C,
2134
2138
  month: T,
2135
2139
  year: I,
2136
- hours: d,
2140
+ hours: h,
2137
2141
  minutes: b,
2138
2142
  formatted: s,
2139
2143
  date: U,
@@ -2145,18 +2149,18 @@ l = new WeakSet(), Xe = function() {
2145
2149
  if (n !== "0") {
2146
2150
  const s = t.slice(5, -3);
2147
2151
  if (n === "T" && s.length === 4) {
2148
- const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), d = String.fromCharCode(this.hexToDec(s[3]));
2152
+ const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), h = String.fromCharCode(this.hexToDec(s[3]));
2149
2153
  e.additional = {
2150
2154
  ascii: n,
2151
2155
  type: "DU.d",
2152
2156
  dozens: c,
2153
2157
  units: u,
2154
- decimals: d,
2155
- time: parseFloat(`${c}${u}.${d}`),
2158
+ decimals: h,
2159
+ time: parseFloat(`${c}${u}.${h}`),
2156
2160
  meaning: "Extraction time (in seconds)"
2157
2161
  };
2158
2162
  } else if (["B", "D", "E", "F", "G"].includes(n) && s.length === 3) {
2159
- const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), d = String.fromCharCode(this.hexToDec(s[2])), b = parseInt(`${c}${u}${d}`), g = {
2163
+ const c = String.fromCharCode(this.hexToDec(s[0])), u = String.fromCharCode(this.hexToDec(s[1])), h = String.fromCharCode(this.hexToDec(s[2])), b = parseInt(`${c}${u}${h}`), C = {
2160
2164
  B: "Error on going to tray channel",
2161
2165
  D: "Error on product detector",
2162
2166
  E: "Extraction of channel ok",
@@ -2167,14 +2171,14 @@ l = new WeakSet(), Xe = function() {
2167
2171
  type: "HDU",
2168
2172
  hundreds: c,
2169
2173
  dozens: u,
2170
- decimals: d,
2174
+ decimals: h,
2171
2175
  channel: b,
2172
2176
  selection: b - 109,
2173
2177
  ascii: n,
2174
- meaning: g[n] ?? "Unknown"
2178
+ meaning: C[n] ?? "Unknown"
2175
2179
  };
2176
2180
  } else if (s.length === 13) {
2177
- const c = s.map((un) => String.fromCharCode(this.hexToDec(un))).join(""), u = parseInt(c.slice(0, 2)), d = parseInt(c.slice(2, 4)), b = parseInt(c.slice(4, 6)), g = parseInt(c.slice(7, 9)), T = parseInt(c.slice(9, 11)) - 1, I = 2e3 + parseInt(c.slice(11, 13)), U = new Date(I, T, g, u, d, b), fe = {
2181
+ const c = s.map((un) => String.fromCharCode(this.hexToDec(un))).join(""), u = parseInt(c.slice(0, 2)), h = parseInt(c.slice(2, 4)), b = parseInt(c.slice(4, 6)), C = parseInt(c.slice(7, 9)), T = parseInt(c.slice(9, 11)) - 1, I = 2e3 + parseInt(c.slice(11, 13)), U = new Date(I, T, C, u, h, b), fe = {
2178
2182
  A: "Attempt to close product exit door",
2179
2183
  C: "Closing of exterior door",
2180
2184
  H: "Error on opening of product exit door",
@@ -2281,21 +2285,21 @@ l = new WeakSet(), Xe = function() {
2281
2285
  hex: t,
2282
2286
  temperature: n
2283
2287
  }, this.dispatch("check:temperature-before-expiration", e.additional), e;
2284
- }, gt = function(t, e) {
2288
+ }, Ct = function(t, e) {
2285
2289
  e.no_code = 53, e.name = "Time before expiration", e.description = "Time before expiration";
2286
2290
  const n = this.hexToDec(t) - 128;
2287
2291
  return e.additional = {
2288
2292
  hex: t,
2289
2293
  minutes: n
2290
2294
  }, this.dispatch("check:expiration-after", e.additional), e;
2291
- }, Ct = function(t, e) {
2295
+ }, xt = function(t, e) {
2292
2296
  e.no_code = 54, e.name = "Temperature scale", e.description = "Temperature scale";
2293
2297
  const n = t === "43" ? "Celsius" : "Fahrenheit";
2294
2298
  return e.additional = {
2295
2299
  hex: t,
2296
2300
  scale: n
2297
2301
  }, this.dispatch("check:temperature-scale", e.additional), e;
2298
- }, xt = function(t, e) {
2302
+ }, gt = function(t, e) {
2299
2303
  return e.no_code = 54, e.name = "Machine ID", e.description = "Machine ID", e.additional = { hex: t[4], full_hex: t }, this.dispatch("check:machine-id", e.additional), e;
2300
2304
  }, Tt = function(t, e) {
2301
2305
  return e.no_code = 7, e.name = "working temperature", e.description = `The working temperature is ${t}`, e.additional = {
@@ -2363,7 +2367,7 @@ l = new WeakSet(), Xe = function() {
2363
2367
  e = i(this, l, _t).call(this, t[4], e);
2364
2368
  break;
2365
2369
  case "4e":
2366
- e = i(this, l, xt).call(this, t, e);
2370
+ e = i(this, l, gt).call(this, t, e);
2367
2371
  break;
2368
2372
  case "4f":
2369
2373
  e = i(this, l, ft).call(this, t[4], e);
@@ -2387,10 +2391,10 @@ l = new WeakSet(), Xe = function() {
2387
2391
  e = i(this, l, mt).call(this, t[4], e);
2388
2392
  break;
2389
2393
  case "66":
2390
- e = i(this, l, gt).call(this, t[4], e);
2394
+ e = i(this, l, Ct).call(this, t[4], e);
2391
2395
  break;
2392
2396
  case "67":
2393
- e = i(this, l, Ct).call(this, t[4], e);
2397
+ e = i(this, l, xt).call(this, t[4], e);
2394
2398
  break;
2395
2399
  }
2396
2400
  break;
@@ -2547,8 +2551,8 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
2547
2551
  }, t.__internal__.dispense.timeout_time);
2548
2552
  }, Z = async function(t) {
2549
2553
  const e = ["02", "30", "30", "81", "52", t, "FF"];
2550
- return await i(this, l, B).call(this, e, "reset");
2551
- }, Ce = function() {
2554
+ return await i(this, l, N).call(this, e, "reset");
2555
+ }, xe = function() {
2552
2556
  const t = this.__device.type === "iceplus" ? we(40) : we(25), e = /* @__PURE__ */ new Date(), n = 1e3 * t + e.getTime(), s = new Date(n);
2553
2557
  this.dispatch("reset:errors", {
2554
2558
  description: "Resetting machine errors",
@@ -2556,12 +2560,12 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
2556
2560
  started_at: e,
2557
2561
  finished_at: s
2558
2562
  });
2559
- }, xe = async function(t) {
2563
+ }, ge = async function(t) {
2560
2564
  const e = ["02", "30", "30", "81", "4C", t, "FF"];
2561
- return await i(this, l, B).call(this, e, "lights");
2565
+ return await i(this, l, N).call(this, e, "lights");
2562
2566
  }, le = async function(t = "80", e = []) {
2563
2567
  const n = ["02", "30", "30", "81", "44", t, ...e];
2564
- return await i(this, l, B).call(this, n, "display");
2568
+ return await i(this, l, N).call(this, n, "display");
2565
2569
  }, ce = function(t = "") {
2566
2570
  t = t.padEnd(32, " ");
2567
2571
  const e = [];
@@ -2570,12 +2574,12 @@ O = function({ type: t = null, severity: e = "high" } = {}) {
2570
2574
  return e;
2571
2575
  }, Pt = function(t) {
2572
2576
  if (!(t instanceof Date)) throw new Error("Invalid date, must be an instance of Date");
2573
- const e = t.getHours().toString().padStart(2, "0"), n = t.getMinutes().toString().padStart(2, "0"), s = t.getDate().toString().padStart(2, "0"), c = (t.getMonth() + 1).toString().padStart(2, "0"), u = t.getFullYear().toString().substring(2, 4), d = `${e}:${n} ${s}-${c}-${u}`, b = [];
2574
- for (let g = 0; g < 14; g++)
2575
- b.push(d.charCodeAt(g).toString(16));
2577
+ const e = t.getHours().toString().padStart(2, "0"), n = t.getMinutes().toString().padStart(2, "0"), s = t.getDate().toString().padStart(2, "0"), c = (t.getMonth() + 1).toString().padStart(2, "0"), u = t.getFullYear().toString().substring(2, 4), h = `${e}:${n} ${s}-${c}-${u}`, b = [];
2578
+ for (let C = 0; C < 14; C++)
2579
+ b.push(h.charCodeAt(C).toString(16));
2576
2580
  return b;
2577
2581
  };
2578
- var ee, V, J, h, Nt, At, he, Bt, qt, Rt, Ht, Lt, Ot, Ut, jt, Te, Wt, $t, Qt, Vt, Jt, zt, Gt, Yt, Kt, Zt, Xt, en, tn, nn, q, de, rn, sn, an, on, De, ue, ln, cn, Ee, Ie, Se;
2582
+ var ee, J, z, d, Bt, At, he, Nt, qt, Rt, Ht, Lt, Ot, Ut, jt, Te, Wt, Qt, Vt, Jt, zt, $t, Gt, Yt, Kt, Zt, Xt, en, tn, nn, q, de, rn, sn, an, on, De, ue, ln, cn, Ee, Ie, Se;
2579
2583
  class Tn extends G {
2580
2584
  constructor({
2581
2585
  filters: t = null,
@@ -2583,7 +2587,7 @@ class Tn extends G {
2583
2587
  no_device: n = 1
2584
2588
  } = {}) {
2585
2589
  super({ filters: t, config_port: e, no_device: n });
2586
- S(this, h);
2590
+ S(this, d);
2587
2591
  A(this, "__coin_purse", {
2588
2592
  available: !0
2589
2593
  });
@@ -2631,15 +2635,15 @@ class Tn extends G {
2631
2635
  max_pre_credit: 0
2632
2636
  });
2633
2637
  S(this, ee, !1);
2634
- S(this, V, 0);
2635
2638
  S(this, J, 0);
2639
+ S(this, z, 0);
2636
2640
  if (this.__internal__.device.type = "boardroid", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
2637
2641
  this.__internal__.serial.config_port.baudRate = 115200, this.__internal__.serial.response.length = 14, this.__internal__.time.response_connection = 600, this.__internal__.time.response_general = 4e3, this.__internal__.time.response_engines = 15e3, this.__internal__.dispense.limit_counter = 15, this.__internal__.dispense.custom_limit_counter = null, this.__internal__.dispense.backup_dispense = {
2638
2642
  channel: 1,
2639
2643
  second_channel: null,
2640
2644
  sensor: !0,
2641
2645
  seconds: null
2642
- }, i(this, h, Nt).call(this), i(this, h, At).call(this);
2646
+ }, i(this, d, Bt).call(this), i(this, d, At).call(this);
2643
2647
  }
2644
2648
  get totalInTubes() {
2645
2649
  return this.coins.tubes.g50 * 0.5 + this.coins.tubes.c50 * 0.5 + this.coins.tubes.p1 + this.coins.tubes.p2 * 2 + this.coins.tubes.p5 * 5 + this.coins.tubes.p10 * 10;
@@ -2699,46 +2703,46 @@ class Tn extends G {
2699
2703
  const n = (5 + this.deviceNumber).toString(16).padStart(2, "0").toLowerCase();
2700
2704
  switch (t[1]) {
2701
2705
  case n:
2702
- e.request = "connect", e = i(this, h, qt).call(this, e);
2706
+ e.request = "connect", e = i(this, d, qt).call(this, e);
2703
2707
  break;
2704
2708
  case "a0":
2705
- e.request = "--automatic", e = i(this, h, Wt).call(this, t, e);
2709
+ e.request = "--automatic", e = i(this, d, Wt).call(this, t, e);
2706
2710
  break;
2707
2711
  case "b0":
2708
- e.request = "--automatic", e = i(this, h, $t).call(this, t, e);
2712
+ e.request = "--automatic", e = i(this, d, Qt).call(this, t, e);
2709
2713
  break;
2710
2714
  case "d0":
2711
- e.request = "coin-purse:config", e = i(this, h, Qt).call(this, t[2], e);
2715
+ e.request = "coin-purse:config", e = i(this, d, Vt).call(this, t[2], e);
2712
2716
  break;
2713
2717
  case "d1":
2714
- e.request = "banknote-purse:config", e.additional = { scrow: null }, e = i(this, h, Vt).call(this, t, e);
2718
+ e.request = "banknote-purse:config", e.additional = { scrow: null }, e = i(this, d, Jt).call(this, t, e);
2715
2719
  break;
2716
2720
  case "d2":
2717
- e.request = "coin-purse:read-tubes", e = i(this, h, Jt).call(this, t, e);
2721
+ e.request = "coin-purse:read-tubes", e = i(this, d, zt).call(this, t, e);
2718
2722
  break;
2719
2723
  case "d3":
2720
- e.request = "banknote-purse:read-recycler", e = i(this, h, zt).call(this, t, e);
2724
+ e.request = "banknote-purse:read-recycler", e = i(this, d, $t).call(this, t, e);
2721
2725
  break;
2722
2726
  case "d4":
2723
- e.request = "banknote-purse:banknote-scrow-status", e = i(this, h, Gt).call(this, t[2], e);
2727
+ e.request = "banknote-purse:banknote-scrow-status", e = i(this, d, Gt).call(this, t[2], e);
2724
2728
  break;
2725
2729
  case "d5":
2726
- e.request = "banknote-purse:dispense", e = i(this, h, Yt).call(this, t, e);
2730
+ e.request = "banknote-purse:dispense", e = i(this, d, Yt).call(this, t, e);
2727
2731
  break;
2728
2732
  case "d6":
2729
- e.request = "coin-purse:dispense", e = i(this, h, Kt).call(this, t, e);
2733
+ e.request = "coin-purse:dispense", e = i(this, d, Kt).call(this, t, e);
2730
2734
  break;
2731
2735
  case "d7":
2732
- e.request = "dispense", e = i(this, h, Zt).call(this, t[5], e);
2736
+ e.request = "dispense", e = i(this, d, Zt).call(this, t[5], e);
2733
2737
  break;
2734
2738
  case "d8":
2735
- e.request = "--automatic", e = i(this, h, Xt).call(this, t[13], e);
2739
+ e.request = "--automatic", e = i(this, d, Xt).call(this, t[13], e);
2736
2740
  break;
2737
2741
  case "d9":
2738
- e.request = "status:temperature", e = i(this, h, en).call(this, t, e);
2742
+ e.request = "status:temperature", e = i(this, d, en).call(this, t, e);
2739
2743
  break;
2740
2744
  case "da":
2741
- e.request = "status:relay", e = i(this, h, tn).call(this, t[2], e);
2745
+ e.request = "status:relay", e = i(this, d, tn).call(this, t[2], e);
2742
2746
  break;
2743
2747
  case "db":
2744
2748
  e.request = "banknote-purse:save-memory", e.no_code = 18, e.name = "Bill purse memory saved?", e.description = "The memory of bill purse was saved successfully?", this.dispatch("banknote-purse:save-memory", { message: e });
@@ -2747,7 +2751,7 @@ class Tn extends G {
2747
2751
  e.request = "coin-purse:read-memory", e.no_code = 19, e.name = "Coin purse memory read?", e.description = "The memory of coin purse was read successfully?", this.dispatch("banknote-purse:read-memory", { message: e });
2748
2752
  break;
2749
2753
  case "dd":
2750
- e.request = "card-reader", i(this, h, nn).call(this, t, e);
2754
+ e.request = "card-reader", i(this, d, nn).call(this, t, e);
2751
2755
  break;
2752
2756
  default:
2753
2757
  e.request = "--unknown", e.name = "Response unrecognized", e.description = "The response of application was received, but dont identify with any of current parameters", e.no_code = 400, this.dispatch("unknown", e);
@@ -2762,7 +2766,7 @@ class Tn extends G {
2762
2766
  async coinPurseConfigure({ enable: t = !1, high: e = "FF", low: n = "FF" } = {}) {
2763
2767
  if (!this.__coin_purse.available) throw new Error("Coin purse not available");
2764
2768
  const c = ["F1", "C1", t ? "01" : "00", e, n, "00", "00", "00", "00", "00", "F2", "00"];
2765
- await i(this, h, q).call(this, c, "coin-purse:config");
2769
+ await i(this, d, q).call(this, c, "coin-purse:config");
2766
2770
  }
2767
2771
  async coinPurseEnable() {
2768
2772
  await this.coinPurseConfigure({ enable: !0 });
@@ -2772,7 +2776,7 @@ class Tn extends G {
2772
2776
  }
2773
2777
  async coinPurseDispense({ $_50c: t = 0, $_1: e = 0, $_2: n = 0, $_5: s = 0, $_10: c = 0 } = {}) {
2774
2778
  if (!this.__coin_purse.available) throw new Error("Coin purse not available");
2775
- if ([t, e, n, s, c].some((d) => isNaN(d) || typeof d == "string"))
2779
+ if ([t, e, n, s, c].some((h) => isNaN(h) || typeof h == "string"))
2776
2780
  throw new Error("One of the values is not a number");
2777
2781
  if (t < 1 && e < 1 && n < 1 && s < 1 && c < 1) throw new Error("No coins to dispense");
2778
2782
  [t, e, n, s, c] = [
@@ -2783,27 +2787,27 @@ class Tn extends G {
2783
2787
  this.decToHex(c)
2784
2788
  ];
2785
2789
  let u = ["F1", "C6", t, e, n, s, c, "00", "00", "00", "F2", "00"];
2786
- await i(this, h, q).call(this, u, "coin-purse:dispense");
2790
+ await i(this, d, q).call(this, u, "coin-purse:dispense");
2787
2791
  }
2788
2792
  async coinPurseReadTubes() {
2789
2793
  const t = ["F1", "C2", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2790
- await i(this, h, q).call(this, t, "coin-purse:read-tubes");
2794
+ await i(this, d, q).call(this, t, "coin-purse:read-tubes");
2791
2795
  }
2792
2796
  async banknotePurseConfigure({ enable: t = !1, scrow: e = !1 } = {}) {
2793
2797
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2794
2798
  let n;
2795
- return i(this, h, he).call(this) ? n = i(this, h, rn).call(this, { enable: t, scrow: e }) : n = i(this, h, sn).call(this, { enable: t, scrow: e }), await i(this, h, q).call(this, n, "banknote-purse:config");
2799
+ return i(this, d, he).call(this) ? n = i(this, d, rn).call(this, { enable: t, scrow: e }) : n = i(this, d, sn).call(this, { enable: t, scrow: e }), await i(this, d, q).call(this, n, "banknote-purse:config");
2796
2800
  }
2797
2801
  async banknotePurseDispense({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200: s = 0, $_500: c = 0, $_1000: u = 0 } = {}) {
2798
2802
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2799
2803
  if (!this.__banknote_purse.isRecycler) throw new Error("Banknote purse is not recycler");
2800
- let d;
2801
- if (i(this, h, he).call(this)) {
2804
+ let h;
2805
+ if (i(this, d, he).call(this)) {
2802
2806
  const b = [t, e, n, s, c];
2803
- d = i(this, h, an).call(this, b[this.__banknote_purse.recycler.banknote]);
2807
+ h = i(this, d, an).call(this, b[this.__banknote_purse.recycler.banknote]);
2804
2808
  } else
2805
- d = i(this, h, on).call(this, { $_20: t, $_50: e, $_100: n, $_200: s, $_500: c, $_1000: u });
2806
- await i(this, h, q).call(this, d, "banknote-purse:dispense");
2809
+ h = i(this, d, on).call(this, { $_20: t, $_50: e, $_100: n, $_200: s, $_500: c, $_1000: u });
2810
+ await i(this, d, q).call(this, h, "banknote-purse:dispense");
2807
2811
  }
2808
2812
  async banknotePurseEnable({ scrow: t = !1 }) {
2809
2813
  return await this.banknotePurseConfigure({ enable: !0, scrow: t });
@@ -2814,12 +2818,12 @@ class Tn extends G {
2814
2818
  async banknotePurseAcceptInScrow() {
2815
2819
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2816
2820
  const t = ["F1", "C4", "01", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2817
- await i(this, h, q).call(this, t, "banknote-purse:banknote-scrow-status");
2821
+ await i(this, d, q).call(this, t, "banknote-purse:banknote-scrow-status");
2818
2822
  }
2819
2823
  async banknotePurseRejectInScrow() {
2820
2824
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2821
2825
  const t = ["F1", "C4", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2822
- await i(this, h, q).call(this, t, "banknote-purse:banknote-scrow-status");
2826
+ await i(this, d, q).call(this, t, "banknote-purse:banknote-scrow-status");
2823
2827
  }
2824
2828
  async banknotePurseSaveMemory({
2825
2829
  channel: t = null,
@@ -2828,10 +2832,10 @@ class Tn extends G {
2828
2832
  $_100: s = null,
2829
2833
  $_200: c = null,
2830
2834
  $_500: u = null,
2831
- $_1000: d = null
2835
+ $_1000: h = null
2832
2836
  } = {}) {
2833
2837
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2834
- if (t === null || e === null || n === null || s === null || c === null || u === null || d === null)
2838
+ if (t === null || e === null || n === null || s === null || c === null || u === null || h === null)
2835
2839
  throw new Error("One of the values is not defined");
2836
2840
  const b = [
2837
2841
  "F1",
@@ -2843,22 +2847,22 @@ class Tn extends G {
2843
2847
  this.decToHex(s),
2844
2848
  this.decToHex(c),
2845
2849
  this.decToHex(u),
2846
- this.decToHex(d),
2850
+ this.decToHex(h),
2847
2851
  "F2",
2848
2852
  "00"
2849
2853
  ];
2850
- await i(this, h, q).call(this, b, "banknote-purse:save-memory");
2854
+ await i(this, d, q).call(this, b, "banknote-purse:save-memory");
2851
2855
  }
2852
2856
  async banknotePurseReadRecycler() {
2853
2857
  if (!this.__banknote_purse.available) throw new Error("Banknote purse not available");
2854
2858
  if (!this.__banknote_purse.isRecycler) throw new Error("Banknote purse is not recycler");
2855
2859
  const t = ["F1", "C3", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "B5"];
2856
- return await i(this, h, q).call(this, t, "banknote-purse:read-recycler");
2860
+ return await i(this, d, q).call(this, t, "banknote-purse:read-recycler");
2857
2861
  }
2858
2862
  async cardReaderDisable() {
2859
2863
  if (!this.card_reader.available) throw new Error("Card reader not available");
2860
2864
  const t = ["F1", "CD", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2861
- return await i(this, h, q).call(this, t, "card-reader:disable");
2865
+ return await i(this, d, q).call(this, t, "card-reader:disable");
2862
2866
  }
2863
2867
  async cardReaderDispense({ channel: t = 1, second_channel: e = null, sensor: n = !0, seconds: s = null, price: c = 0 } = {}) {
2864
2868
  if (!this.card_reader.available) throw new Error("Card reader not available");
@@ -2866,13 +2870,13 @@ class Tn extends G {
2866
2870
  if (isNaN(c) || c <= 0) throw new Error("Price must be greater than 0");
2867
2871
  if (c > this.card_reader.max_pre_credit) throw new Error("Price is greater than pre-credit configured");
2868
2872
  if (!n && (s === null || s <= 0 || s > 40)) throw new Error("Invalid time to dispense without sensor, must be between 0.1 and 40.0 seconds");
2869
- const u = this.decToHex(c / 256), d = this.decToHex(c % 256), b = this.decToHex(t + 9);
2870
- let g = "00";
2871
- e && (g = this.decToHex(e + 9));
2873
+ const u = this.decToHex(c / 256), h = this.decToHex(c % 256), b = this.decToHex(t + 9);
2874
+ let C = "00";
2875
+ e && (C = this.decToHex(e + 9));
2872
2876
  let T = "00";
2873
2877
  n || (T = this.decToHex(s * 10));
2874
- const I = ["F1", "CD", "01", b, g, T, u, d, "00", "00", "F2", "00"];
2875
- await i(this, h, q).call(this, I, "card-reader:dispense");
2878
+ const I = ["F1", "CD", "01", b, C, T, u, h, "00", "00", "F2", "00"];
2879
+ await i(this, d, q).call(this, I, "card-reader:dispense");
2876
2880
  }
2877
2881
  async paymentPursesDisable({ coin: t = !0, banknote: e = !0, cardReader: n = !1 } = {}) {
2878
2882
  t && await this.coinPurseDisable(), e && await this.banknotePurseDisable(), n && await this.cardReaderDisable();
@@ -2882,7 +2886,7 @@ class Tn extends G {
2882
2886
  }
2883
2887
  async coolingRelayConfigure({ enable: t = !1 } = {}) {
2884
2888
  const n = ["F1", "CC", t ? "01" : "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2885
- return await i(this, h, q).call(this, n, "status:relay");
2889
+ return await i(this, d, q).call(this, n, "status:relay");
2886
2890
  }
2887
2891
  async coolingRelayEnable() {
2888
2892
  return await this.coolingRelayConfigure({ enable: !0 });
@@ -2892,7 +2896,7 @@ class Tn extends G {
2892
2896
  }
2893
2897
  async readTemperature() {
2894
2898
  const t = ["F1", "CB", "00", "00", "00", "00", "00", "00", "00", "00", "F2", "00"];
2895
- return await i(this, h, q).call(this, t, "status:temperature");
2899
+ return await i(this, d, q).call(this, t, "status:temperature");
2896
2900
  }
2897
2901
  /**
2898
2902
  * Dispense a product from the machine
@@ -2920,19 +2924,19 @@ class Tn extends G {
2920
2924
  seconds: s
2921
2925
  }), t += 9;
2922
2926
  const u = this.decToHex(t);
2923
- let d = "00";
2924
- e && (e += 9, d = this.decToHex(e));
2927
+ let h = "00";
2928
+ e && (e += 9, h = this.decToHex(e));
2925
2929
  let b = "00";
2926
2930
  n || (b = this.decToHex(Math.round(s * 6.2)), this.__internal__.dispense.custom_limit_counter = s);
2927
- const g = i(this, h, de).call(this, ["F1", "C7", u, d, b, "00", "00", "00", "00", "00", "F2", "00"]);
2928
- let T = await this.internalDispense(g);
2929
- return !T.dispensed && c && (T = await this.internalDispense(g)), this.__internal__.dispense.custom_limit_counter = null, T;
2931
+ const C = i(this, d, de).call(this, ["F1", "C7", u, h, b, "00", "00", "00", "00", "00", "F2", "00"]);
2932
+ let T = await this.internalDispense(C);
2933
+ return !T.dispensed && c && (T = await this.internalDispense(C)), this.__internal__.dispense.custom_limit_counter = null, T;
2930
2934
  }
2931
2935
  async testEngines({ singleEngine: t = !1 } = {}) {
2932
2936
  if (this.isDispensing) throw new Error("Another dispensing process is running");
2933
- i(this, h, De).call(this), x(this, ee, !0);
2937
+ i(this, d, De).call(this), g(this, ee, !0);
2934
2938
  const e = [];
2935
- i(this, h, ue).call(this);
2939
+ i(this, d, ue).call(this);
2936
2940
  for (let n = 1; n <= 80; n++) {
2937
2941
  const s = await this.dispense({
2938
2942
  selection: n,
@@ -2941,30 +2945,30 @@ class Tn extends G {
2941
2945
  seconds: 0.4,
2942
2946
  retry: !1
2943
2947
  });
2944
- e.push(s), x(this, V, n), i(this, h, ue).call(this), t || n++;
2948
+ e.push(s), g(this, J, n), i(this, d, ue).call(this), t || n++;
2945
2949
  }
2946
- x(this, V, 80), i(this, h, ue).call(this, { dispensed: e }), i(this, h, De).call(this);
2950
+ g(this, J, 80), i(this, d, ue).call(this, { dispensed: e }), i(this, d, De).call(this);
2947
2951
  }
2948
2952
  async sendCustomCode({ code: t = [] } = {}) {
2949
2953
  if (t.length === 0) throw new Error("Invalid code");
2950
- const e = i(this, h, de).call(this, t);
2954
+ const e = i(this, d, de).call(this, t);
2951
2955
  await this.appendToQueue(e, "custom");
2952
2956
  }
2953
2957
  hasToReturnChange(t = 0) {
2954
2958
  let e = t;
2955
- return e <= 0 ? !0 : (e = i(this, h, Ee).call(this, e).pending, e = i(this, h, Ie).call(this, e).pending, !(e > 0));
2959
+ return e <= 0 ? !0 : (e = i(this, d, Ee).call(this, e).pending, e = i(this, d, Ie).call(this, e).pending, !(e > 0));
2956
2960
  }
2957
2961
  async returnChange() {
2958
- return await i(this, h, Se).call(this);
2962
+ return await i(this, d, Se).call(this);
2959
2963
  }
2960
2964
  async returnInsertedMoney() {
2961
- return this.__money_session.inserted <= 0 ? !1 : await i(this, h, Se).call(this, this.__money_session.inserted);
2965
+ return this.__money_session.inserted <= 0 ? !1 : await i(this, d, Se).call(this, this.__money_session.inserted);
2962
2966
  }
2963
2967
  async serialCorruptMessage(t, e) {
2964
2968
  this.dispatch("corrupt:message", { data: t, message: e });
2965
2969
  }
2966
2970
  }
2967
- ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt = function() {
2971
+ ee = new WeakMap(), J = new WeakMap(), z = new WeakMap(), d = new WeakSet(), Bt = function() {
2968
2972
  const t = [
2969
2973
  "banknote-purse:banknote-scrow-status",
2970
2974
  "banknote-purse:config",
@@ -2984,6 +2988,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
2984
2988
  "session:money-dispensed",
2985
2989
  "session:money-request",
2986
2990
  "event:door",
2991
+ "door:event",
2987
2992
  "status:relay",
2988
2993
  "status:temperature"
2989
2994
  ];
@@ -2993,7 +2998,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
2993
2998
  D.add(this);
2994
2999
  }, he = function() {
2995
3000
  return this.__banknote_purse.isRecycler && this.__banknote_purse.recycler.ict;
2996
- }, Bt = function() {
3001
+ }, Nt = function() {
2997
3002
  return this.hasCoinPurse || this.hasRecycler;
2998
3003
  }, qt = function(t) {
2999
3004
  return t.name = "Connection with the serial device completed.", t.description = "Your connection with the serial device was successfully completed.", t.no_code = 1, this.dispatch("run:default-load", {}), t;
@@ -3062,17 +3067,17 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3062
3067
  }, Te = function(t, e) {
3063
3068
  if (!t) return;
3064
3069
  let n = !0;
3065
- if (i(this, h, Ht).call(this, t)) {
3070
+ if (i(this, d, Ht).call(this, t)) {
3066
3071
  if (typeof this.coins.tubes[t] > "u") return;
3067
3072
  e === "tube" ? this.coins.tubes[t] += 1 : e === "box" && (this.coins.box[t] += 1);
3068
3073
  let s = 0;
3069
3074
  ["g50", "c50"].includes(t) ? s = 0.5 : s += parseInt(t.slice(1)), this.coins.totals[t] += s, this.__money_session.inserted += s, this.coins.total += s;
3070
- } else if (i(this, h, Ot).call(this, t)) {
3075
+ } else if (i(this, d, Ot).call(this, t)) {
3071
3076
  if (typeof this.banknotes.tubes[t] > "u") return;
3072
3077
  e === "recycler" ? this.banknotes.recycler[t] += 1 : e === "stacker" && (this.banknotes.stacker[t] += 1);
3073
3078
  let s = parseInt(t.slice(1));
3074
3079
  this.banknotes.totals[t] += s, this.__money_session.inserted += s, this.banknotes.total += s;
3075
- } else if (i(this, h, Ut).call(this, t) && e === "out") {
3080
+ } else if (i(this, d, Ut).call(this, t) && e === "out") {
3076
3081
  if (typeof this.banknotes.out[t] > "u") return;
3077
3082
  this.banknotes.out[t] += 1;
3078
3083
  let s = parseInt(t.slice(1));
@@ -3081,19 +3086,19 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3081
3086
  n && this.dispatch("session:money-request", {});
3082
3087
  }, Wt = function(t, e) {
3083
3088
  const n = parseInt(t[2], 16);
3084
- return e.name = "Coin Inserted", e.no_code = 2, e.additional = { where: null, coin: null }, n === 1 ? (e.name = "Lever pressed", e.description = "Reject lever", e.no_code = 100, this.dispatch("coin-purse:reject-lever", {})) : n === 2 ? (e.name = "Reset coin purse", e.description = "The configuration of coin purse was reset", e.no_code = 101, this.dispatch("coin-purse:reset", {})) : n >= 64 && n <= 79 ? (e.name = "Coin inserted in profit box", e.additional.where = "box") : n >= 80 && n <= 95 ? (e.name = "Coin inserted in tube", e.additional.where = "tube") : n >= 96 && n <= 111 ? (e.name = "Unused coin", e.description = "Something come from coin changer but in MDB Docs is unused", e.additional.where = "unused") : n >= 112 && n <= 127 ? (e.name = "Coin rejected", e.additional.where = "rejected") : n >= 144 && n <= 159 ? (e.name = "Coin dispensed", e.additional.where = "out", e.description = `Undefined value: ¿${t[2]}?`) : (e.name = "Coin inserted", e.description = "Undefined status. Without information of this", e.no_code = 400), n === 1 || n === 2 || n >= 160 || n >= 128 && n <= 143 || ([e.description, e.additional.coin] = i(this, h, Rt).call(this, t[2]), e.no_code = 38 + n, i(this, h, Te).call(this, e.additional.coin, e.additional.where), ["tube", "out"].includes(e.additional.where) && this.dispatch("coin-purse:tubes", this.coins.tubes), this.dispatch("coin-purse:coin-event", this.coins)), e;
3085
- }, $t = function(t, e) {
3086
- const n = parseInt(t[2], 16);
3087
- return e.name = "Banknote Inserted", e.no_code = 2, e.additional = { where: null, banknote: null }, n === 42 ? (e.name = "Banknote dispensed", e.description = "Banknote dispensed by request.", e.additional.banknote = i(this, h, jt).call(this), e.additional.where = "out", e.no_code = 200) : n >= 128 && n <= 143 ? (e.name = "Banknote inserted", e.additional.where = "stacker") : n >= 144 && n <= 159 ? (e.name = "Banknote inserted in pre stacker", e.additional.where = "tmp") : n >= 160 && n <= 175 ? (e.name = "Banknote rejected", e.additional.where = "nothing") : n >= 176 && n <= 191 && (e.name = "Banknote inserted", e.additional.where = "recycler"), n >= 128 && n <= 191 && ([e.description, e.additional.banknote] = i(this, h, Lt).call(this, t[2]), e.no_code = 74 + n), i(this, h, Te).call(this, e.additional.banknote, e.additional.where), this.dispatch("banknote-purse:event-banknote", this.banknotes), e;
3089
+ return e.name = "Coin Inserted", e.no_code = 2, e.additional = { where: null, coin: null }, n === 1 ? (e.name = "Lever pressed", e.description = "Reject lever", e.no_code = 100, this.dispatch("coin-purse:reject-lever", {})) : n === 2 ? (e.name = "Reset coin purse", e.description = "The configuration of coin purse was reset", e.no_code = 101, this.dispatch("coin-purse:reset", {})) : n >= 64 && n <= 79 ? (e.name = "Coin inserted in profit box", e.additional.where = "box") : n >= 80 && n <= 95 ? (e.name = "Coin inserted in tube", e.additional.where = "tube") : n >= 96 && n <= 111 ? (e.name = "Unused coin", e.description = "Something come from coin changer but in MDB Docs is unused", e.additional.where = "unused") : n >= 112 && n <= 127 ? (e.name = "Coin rejected", e.additional.where = "rejected") : n >= 144 && n <= 159 ? (e.name = "Coin dispensed", e.additional.where = "out", e.description = `Undefined value: ¿${t[2]}?`) : (e.name = "Coin inserted", e.description = "Undefined status. Without information of this", e.no_code = 400), n === 1 || n === 2 || n >= 160 || n >= 128 && n <= 143 || ([e.description, e.additional.coin] = i(this, d, Rt).call(this, t[2]), e.no_code = 38 + n, i(this, d, Te).call(this, e.additional.coin, e.additional.where), ["tube", "out"].includes(e.additional.where) && this.dispatch("coin-purse:tubes", this.coins.tubes), this.dispatch("coin-purse:coin-event", this.coins)), e;
3088
3090
  }, Qt = function(t, e) {
3091
+ const n = parseInt(t[2], 16);
3092
+ return e.name = "Banknote Inserted", e.no_code = 2, e.additional = { where: null, banknote: null }, n === 42 ? (e.name = "Banknote dispensed", e.description = "Banknote dispensed by request.", e.additional.banknote = i(this, d, jt).call(this), e.additional.where = "out", e.no_code = 200) : n >= 128 && n <= 143 ? (e.name = "Banknote inserted", e.additional.where = "stacker") : n >= 144 && n <= 159 ? (e.name = "Banknote inserted in pre stacker", e.additional.where = "tmp") : n >= 160 && n <= 175 ? (e.name = "Banknote rejected", e.additional.where = "nothing") : n >= 176 && n <= 191 && (e.name = "Banknote inserted", e.additional.where = "recycler"), n >= 128 && n <= 191 && ([e.description, e.additional.banknote] = i(this, d, Lt).call(this, t[2]), e.no_code = 74 + n), i(this, d, Te).call(this, e.additional.banknote, e.additional.where), this.dispatch("banknote-purse:event-banknote", this.banknotes), e;
3093
+ }, Vt = function(t, e) {
3089
3094
  const n = parseInt(t, 16);
3090
3095
  return n === 1 ? (e.name = "Coin purse enabled", e.description = "Configuration complete, enabled", e.no_code = 3) : n === 0 ? (e.name = "Coin purse disabled", e.description = "Disabled by system request", e.no_code = 4) : (e.name = "Status unknown", e.description = "The response of coin purse doesn't identify successfully", e.no_code = 400), this.dispatch("coin-purse:config", { enabled: n === 1 }), e;
3091
- }, Vt = function(t, e) {
3096
+ }, Jt = function(t, e) {
3092
3097
  const n = parseInt(t[2], 16), s = parseInt(t[3], 16);
3093
3098
  return n === 0 ? (e.name = "Bill purse disabled", e.description = "Configuration complete, disabled") : n === 1 && (e.name = "Bill purse enabled", e.description = "Configuration complete, enabled"), s === 0 ? e.additional.scrow = "Scrow disabled, banknote received automatic" : s === 1 && (e.additional.scrow = "Scrow enabled, require manual action"), e.no_code = 5, this.dispatch("banknote-purse:config", { enabled: n === 1, scrow: s === 1 }), e;
3094
- }, Jt = function(t, e) {
3099
+ }, zt = function(t, e) {
3095
3100
  e.no_code = 6;
3096
- const [n, s, c, u, d, b] = [
3101
+ const [n, s, c, u, h, b] = [
3097
3102
  parseInt(t[2], 16),
3098
3103
  parseInt(t[3], 16),
3099
3104
  parseInt(t[4], 16),
@@ -3102,11 +3107,11 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3102
3107
  parseInt(t[7], 16)
3103
3108
  ];
3104
3109
  return e.additional = {
3105
- coins: { g50: n, c50: s, p1: c, p2: u, p5: d, p10: b }
3106
- }, this.coins.tubes.g50 = n, this.coins.tubes.c50 = s, this.coins.tubes.p1 = c, this.coins.tubes.p2 = u, this.coins.tubes.p5 = d, this.coins.tubes.p10 = b, this.coins.totals.g50 = (this.coins.box.g50 + n) * 0.5, this.coins.totals.c50 = (this.coins.box.c50 + s) * 0.5, this.coins.totals.p1 = this.coins.box.p1 + c, this.coins.totals.p2 = (this.coins.box.p2 + u) * 2, this.coins.totals.p5 = (this.coins.box.p5 + d) * 5, this.coins.totals.p10 = (this.coins.box.p10 + b) * 10, this.coins.total = this.coins.totals.g50 + this.coins.totals.c50 + this.coins.totals.p1 + this.coins.totals.p2 + this.coins.totals.p5 + this.coins.totals.p10, e.name = "Read tubes", e.description = "Quantity of coins approximated", this.dispatch("coin-purse:tubes", this.coins.tubes), e;
3107
- }, zt = function(t, e) {
3110
+ coins: { g50: n, c50: s, p1: c, p2: u, p5: h, p10: b }
3111
+ }, this.coins.tubes.g50 = n, this.coins.tubes.c50 = s, this.coins.tubes.p1 = c, this.coins.tubes.p2 = u, this.coins.tubes.p5 = h, this.coins.tubes.p10 = b, this.coins.totals.g50 = (this.coins.box.g50 + n) * 0.5, this.coins.totals.c50 = (this.coins.box.c50 + s) * 0.5, this.coins.totals.p1 = this.coins.box.p1 + c, this.coins.totals.p2 = (this.coins.box.p2 + u) * 2, this.coins.totals.p5 = (this.coins.box.p5 + h) * 5, this.coins.totals.p10 = (this.coins.box.p10 + b) * 10, this.coins.total = this.coins.totals.g50 + this.coins.totals.c50 + this.coins.totals.p1 + this.coins.totals.p2 + this.coins.totals.p5 + this.coins.totals.p10, e.name = "Read tubes", e.description = "Quantity of coins approximated", this.dispatch("coin-purse:tubes", this.coins.tubes), e;
3112
+ }, $t = function(t, e) {
3108
3113
  e.no_code = 7;
3109
- const [n, s, c, u, d, b] = [
3114
+ const [n, s, c, u, h, b] = [
3110
3115
  parseInt(t[2], 16),
3111
3116
  parseInt(t[3], 16),
3112
3117
  parseInt(t[4], 16),
@@ -3115,23 +3120,23 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3115
3120
  parseInt(t[7], 16)
3116
3121
  ];
3117
3122
  return e.additional = {
3118
- banknotes: { b20: n, b50: s, b100: c, b200: u, b500: d, b1000: b }
3119
- }, this.banknotes.recycler.p20 = n, this.banknotes.recycler.p50 = s, this.banknotes.recycler.p100 = c, this.banknotes.recycler.p200 = u, this.banknotes.recycler.p500 = d, this.banknotes.recycler.p1000 = b, this.banknotes.totals.p20 = (this.banknotes.stacker.p20 + n) * 20, this.banknotes.totals.p50 = (this.banknotes.stacker.p50 + s) * 50, this.banknotes.totals.p100 = (this.banknotes.stacker.p100 + c) * 100, this.banknotes.totals.p200 = (this.banknotes.stacker.p200 + u) * 200, this.banknotes.totals.p500 = (this.banknotes.stacker.p500 + d) * 500, this.banknotes.totals.p1000 = (this.banknotes.stacker.p1000 + b) * 1e3, this.banknotes.total = this.banknotes.totals.p20 + this.banknotes.totals.p50 + this.banknotes.totals.p100 + this.banknotes.totals.p200 + this.banknotes.totals.p500 + this.banknotes.totals.p1000, e.name = "Read recycler", e.description = "Quantity of banknotes approximated", this.dispatch("banknote-purse:recycler", this.banknotes.recycler), e;
3123
+ banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b }
3124
+ }, this.banknotes.recycler.p20 = n, this.banknotes.recycler.p50 = s, this.banknotes.recycler.p100 = c, this.banknotes.recycler.p200 = u, this.banknotes.recycler.p500 = h, this.banknotes.recycler.p1000 = b, this.banknotes.totals.p20 = (this.banknotes.stacker.p20 + n) * 20, this.banknotes.totals.p50 = (this.banknotes.stacker.p50 + s) * 50, this.banknotes.totals.p100 = (this.banknotes.stacker.p100 + c) * 100, this.banknotes.totals.p200 = (this.banknotes.stacker.p200 + u) * 200, this.banknotes.totals.p500 = (this.banknotes.stacker.p500 + h) * 500, this.banknotes.totals.p1000 = (this.banknotes.stacker.p1000 + b) * 1e3, this.banknotes.total = this.banknotes.totals.p20 + this.banknotes.totals.p50 + this.banknotes.totals.p100 + this.banknotes.totals.p200 + this.banknotes.totals.p500 + this.banknotes.totals.p1000, e.name = "Read recycler", e.description = "Quantity of banknotes approximated", this.dispatch("banknote-purse:recycler", this.banknotes.recycler), e;
3120
3125
  }, Gt = function(t, e) {
3121
3126
  const n = parseInt(t, 16);
3122
3127
  return n === 1 ? e.name = "Banknote accepted" : n === 0 ? e.name = "Banknote rejected" : e.name = "Unknown status banknote", e.no_code = 8, this.dispatch("banknote-purse:banknote-scrow-status", { status: n === 1 }), e;
3123
3128
  }, Yt = function(t, e) {
3124
- const [n, s, c, u, d, b] = [
3129
+ const [n, s, c, u, h, b] = [
3125
3130
  parseInt(t[2], 16),
3126
3131
  parseInt(t[3], 16),
3127
3132
  parseInt(t[4], 16),
3128
3133
  parseInt(t[5], 16),
3129
3134
  parseInt(t[6], 16),
3130
3135
  parseInt(t[7], 16)
3131
- ], g = n * 20 + s * 50 + c * 100 + u * 200 + d * 500 + b * 1e3;
3132
- return e.name = "Banknotes dispensed", e.description = g > 0 ? "Banknotes dispensed by request" : "No banknotes dispensed, recycler empty", e.no_code = 9, e.additional = {
3133
- banknotes: { b20: n, b50: s, b100: c, b200: u, b500: d, b1000: b },
3134
- total_dispensed: g
3136
+ ], C = n * 20 + s * 50 + c * 100 + u * 200 + h * 500 + b * 1e3;
3137
+ return e.name = "Banknotes dispensed", e.description = C > 0 ? "Banknotes dispensed by request" : "No banknotes dispensed, recycler empty", e.no_code = 9, e.additional = {
3138
+ banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b },
3139
+ total_dispensed: C
3135
3140
  }, this.dispatch("session:money-dispensed", {
3136
3141
  type_money: null,
3137
3142
  retired: null,
@@ -3151,7 +3156,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3151
3156
  return n === 1 ? (e.name = "Product not delivered", e.description = "The product requested wasn't delivered", e.no_code = 11, this.__internal__.dispense.status = !1) : n === 0 ? (e.name = "Product delivered", e.description = "The product requested was delivered", e.no_code = 12, this.__internal__.dispense.status = !0) : (e.name = "Unknown status product", e.description = "The response of product doesn't identify successfully", e.no_code = 400, this.__internal__.dispense.status = !1), this.dispatch("dispensed", {}), e;
3152
3157
  }, Xt = function(t, e) {
3153
3158
  let n = "closed";
3154
- return t === "db" ? (e.name = "Door closed", e.no_code = 13) : t === "dc" ? (e.name = "Door open", e.no_code = 14, n = "open") : (e.name = "Unknown status door", e.description = "The response of door doesn't identify successfully", e.no_code = 400, n = "unknown"), this.dispatch("event:door", { open: n === "open" }), e;
3159
+ return t === "db" ? (e.name = "Door closed", e.no_code = 13) : t === "dc" ? (e.name = "Door open", e.no_code = 14, n = "open") : (e.name = "Unknown status door", e.description = "The response of door doesn't identify successfully", e.no_code = 400, n = "unknown"), this.__internal__.device.door_open = n === "open", this.dispatch("event:door", { open: n === "open" }), this.dispatch("door:event", { open: n === "open" }), e;
3155
3160
  }, en = function(t, e) {
3156
3161
  const n = parseInt(t[2], 16) * 255, s = parseInt(t[3], 16), c = (n + s) * 0.1;
3157
3162
  return e.no_code = 15, e.name = "Temperature status", e.description = `Temperature: ${c}`, e.additional = {
@@ -3187,7 +3192,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3187
3192
  }
3188
3193
  return this.dispatch("card-reader:event", e), e;
3189
3194
  }, q = function(t, e) {
3190
- return this.appendToQueue(i(this, h, de).call(this, t), e);
3195
+ return this.appendToQueue(i(this, d, de).call(this, t), e);
3191
3196
  }, de = function(t) {
3192
3197
  return t[11] = this.serialBoardroidSumHex(t), t.map((e, n) => {
3193
3198
  t[n] = this.hexMaker(e);
@@ -3201,7 +3206,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3201
3206
  if (t < 1) throw new Error("No banknotes to dispense");
3202
3207
  return t = this.decToHex(t), ["F1", "C5", this.decToHex(this.__banknote_purse.recycler.banknote.toString()), t, "00", "00", "00", "00", "00", "00", "F2", "00"];
3203
3208
  }, on = function({ $_20: t = 0, $_50: e = 0, $_100: n = 0, $_200: s = 0, $_500: c = 0, $_1000: u = 0 } = {}) {
3204
- if ([t, e, n, s, c, u].some((d) => isNaN(d) || typeof d == "string"))
3209
+ if ([t, e, n, s, c, u].some((h) => isNaN(h) || typeof h == "string"))
3205
3210
  throw new Error("One of the values is not a number");
3206
3211
  if (t < 1 && e < 1 && n < 1 && s < 1 && c < 1 && u < 1) throw new Error("No banknotes to dispense");
3207
3212
  return [t, e, n, s, c, u] = [
@@ -3213,47 +3218,65 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
3213
3218
  this.decToHex(u)
3214
3219
  ], ["F1", "C5", t, e, n, s, c, u, "00", "00", "F2", "00"];
3215
3220
  }, De = function() {
3216
- x(this, ee, !1), x(this, V, 0), x(this, J, 0);
3221
+ g(this, ee, !1), g(this, J, 0), g(this, z, 0);
3217
3222
  }, /**
3218
3223
  *
3219
3224
  * @param {null|object} dispensed
3220
3225
  * @param {number} limit
3221
3226
  */
3222
3227
  ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
3223
- x(this, J, Math.round(y(this, V) * 100 / e)), this.dispatch("percentage:test", { percentage: y(this, J), dispensed: t });
3228
+ g(this, z, Math.round(y(this, J) * 100 / e)), this.dispatch("percentage:test", { percentage: y(this, z), dispensed: t });
3224
3229
  }, ln = function(t) {
3225
- const e = ["20", "50", "100", "200", "500"], n = "$_" + e[this.__banknote_purse.recycler.banknote], s = parseInt(e[this.__banknote_purse.recycler.banknote]), c = parseInt((t / s).toString()), u = {
3230
+ const e = ["20", "50", "100", "200", "500"], n = this.__banknote_purse.recycler.banknote, s = "$_" + e[n], c = parseInt(e[n]), u = this.banknotes.recycler[`p${e[n]}`], h = Math.min(
3231
+ Math.floor(t / c),
3232
+ u
3233
+ ), b = {
3226
3234
  banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
3227
3235
  pending: t,
3228
- will_dispense: c > 0
3236
+ will_dispense: h > 0
3229
3237
  };
3230
- return this.totalInRecycler === 0 || c < 1 || t === 0 || (u.banknotes[n] = c, u.pending = t % s), u;
3238
+ return this.totalInRecycler === 0 || h < 1 || t === 0 || (b.banknotes[s] = h, b.pending = parseFloat((t - h * c).toFixed(2))), b;
3231
3239
  }, cn = function(t) {
3232
3240
  const e = {
3233
3241
  banknotes: { $_20: 0, $_50: 0, $_100: 0, $_200: 0, $_500: 0, $_1000: 0 },
3234
3242
  pending: t,
3235
3243
  will_dispense: !1
3236
3244
  };
3237
- return this.totalInRecycler === 0 || t === 0 || (e.banknotes.$_1000 = parseInt((t / 1e3).toString()), e.pending = t % 1e3, e.banknotes.$_500 = parseInt((e.pending / 500).toString()), e.pending = e.pending % 500, e.banknotes.$_200 = parseInt((e.pending / 200).toString()), e.pending = e.pending % 200, e.banknotes.$_100 = parseInt((e.pending / 100).toString()), e.pending = e.pending % 100, e.banknotes.$_50 = parseInt((e.pending / 50).toString()), e.pending = e.pending % 50, e.banknotes.$_20 = parseInt((e.pending / 20).toString()), e.pending = e.pending % 20, e.will_dispense = e.banknotes.$_1000 > 0 || e.banknotes.$_500 > 0 || e.banknotes.$_200 > 0 || e.banknotes.$_100 > 0 || e.banknotes.$_50 > 0 || e.banknotes.$_20 > 0), e;
3245
+ if (this.totalInRecycler === 0 || t === 0) return e;
3246
+ const n = (s, c) => {
3247
+ if (this.banknotes.recycler[c] > 0) {
3248
+ const u = Math.floor(e.pending / s), h = Math.min(u, this.banknotes.recycler[c]);
3249
+ e.banknotes[`$_${s}`] = h, e.pending = parseFloat((e.pending - h * s).toFixed(2));
3250
+ }
3251
+ };
3252
+ return n(1e3, "p1000"), n(500, "p500"), n(200, "p200"), n(100, "p100"), n(50, "p50"), n(20, "p20"), e.will_dispense = Object.values(e.banknotes).some((s) => s > 0), e;
3238
3253
  }, Ee = function(t) {
3239
- return i(this, h, he).call(this) ? i(this, h, ln).call(this, t) : i(this, h, cn).call(this, t);
3254
+ return i(this, d, he).call(this) ? i(this, d, ln).call(this, t) : i(this, d, cn).call(this, t);
3240
3255
  }, Ie = function(t) {
3241
3256
  const e = {
3242
3257
  coins: { $_50c: 0, $_1: 0, $_2: 0, $_5: 0, $_10: 0 },
3243
3258
  pending: t,
3244
3259
  will_dispense: !1
3245
3260
  };
3246
- return t <= 0 || this.totalInTubes === 0 || (e.coins.$_10 = parseInt((t / 10).toString()), e.pending = t % 10, e.coins.$_5 = parseInt((e.pending / 5).toString()), e.pending = e.pending % 5, e.coins.$_2 = parseInt((e.pending / 2).toString()), e.pending = e.pending % 2, e.coins.$_1 = parseInt(e.pending), e.pending = e.pending % 1, e.coins.$_50c = parseInt((e.pending / 0.5).toString()), e.pending = e.pending % 0.5, e.will_dispense = e.coins.$_10 > 0 || e.coins.$_5 > 0 || e.coins.$_2 > 0 || e.coins.$_1 > 0 || e.coins.$_50c > 0), e;
3261
+ if (t <= 0 || this.totalInTubes === 0) return e;
3262
+ const n = (s, c, u = null) => {
3263
+ if (this.coins.tubes[c] > 0) {
3264
+ u === null && (u = "$_" + s);
3265
+ const h = Math.floor(e.pending / s), b = Math.min(h, this.coins.tubes[c]);
3266
+ e.coins[u] = b, e.pending = parseFloat((e.pending - b * s).toFixed(2));
3267
+ }
3268
+ };
3269
+ return n(10, "p10"), n(5, "p5"), n(2, "p2"), n(1, "p1"), n(0.5, "g50", "$_50c"), e.will_dispense = Object.values(e.coins).some((s) => s > 0), e;
3247
3270
  }, Se = async function(t = null) {
3248
- if (!i(this, h, Bt).call(this)) throw new Error("Change not available");
3271
+ if (!i(this, d, Nt).call(this)) throw new Error("Change not available");
3249
3272
  let e = this.change, n = this.change;
3250
3273
  if (t !== null && (e = t, n = t), n <= 0) return !1;
3251
- const s = i(this, h, Ee).call(this, n);
3274
+ const s = i(this, d, Ee).call(this, n);
3252
3275
  n = s.pending;
3253
- const c = i(this, h, Ie).call(this, n);
3276
+ const c = i(this, d, Ie).call(this, n);
3254
3277
  return n = c.pending, n > 0 && this.dispatch("change:pending", { pending: n }), n === e ? !1 : (s.will_dispense && await this.banknotePurseDispense(s.banknotes), c.will_dispense && await this.coinPurseDispense(c.coins), !0);
3255
3278
  };
3256
- var z, hn, dn;
3279
+ var $, hn, dn;
3257
3280
  class Dn extends G {
3258
3281
  constructor({
3259
3282
  filters: t = null,
@@ -3261,9 +3284,9 @@ class Dn extends G {
3261
3284
  no_device: n = 1
3262
3285
  } = {}) {
3263
3286
  super({ filters: t, config_port: e, no_device: n });
3264
- S(this, z);
3287
+ S(this, $);
3265
3288
  if (this.__internal__.device.type = "arduino", D.getCustom(this.typeDevice, n)) throw new Error(`Device ${this.typeDevice} ${n} already exists`);
3266
- this.__internal__.time.response_connection = 2e3, this.__internal__.time.response_general = 2e3, this.__internal__.serial.delay_first_connection = 1e3, i(this, z, dn).call(this), i(this, z, hn).call(this);
3289
+ this.__internal__.time.response_connection = 2e3, this.__internal__.time.response_general = 2e3, this.__internal__.serial.delay_first_connection = 1e3, i(this, $, dn).call(this), i(this, $, hn).call(this);
3267
3290
  }
3268
3291
  serialMessage(t) {
3269
3292
  const e = {
@@ -3325,7 +3348,7 @@ class Dn extends G {
3325
3348
  await this.sayCredits(), await this.sayAra(), await this.sayHi();
3326
3349
  }
3327
3350
  }
3328
- z = new WeakSet(), hn = function() {
3351
+ $ = new WeakSet(), hn = function() {
3329
3352
  D.addCustom("arduino", this);
3330
3353
  }, dn = function() {
3331
3354
  };
@@ -3341,17 +3364,17 @@ z = new WeakSet(), hn = function() {
3341
3364
  const En = {
3342
3365
  wait: W,
3343
3366
  getSeconds: we,
3344
- supportWebSerial: Ne
3345
- }, In = "3.0.0";
3367
+ supportWebSerial: Be
3368
+ }, In = "4.0.6";
3346
3369
  export {
3347
3370
  Dn as Arduino,
3348
3371
  Tn as Boardroid,
3349
3372
  D as Devices,
3350
3373
  pe as Emulator,
3351
- xn as Jofemar,
3374
+ gn as Jofemar,
3352
3375
  G as Kernel,
3353
- Cn as Locker,
3354
- gn as Relay,
3376
+ xn as Locker,
3377
+ Cn as Relay,
3355
3378
  En as utils,
3356
3379
  In as version
3357
3380
  };