@danidoble/webserial 4.0.4 → 4.0.5

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
@@ -363,40 +363,40 @@ const a = class a {
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;
366
+ var s, c, u, h;
367
367
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
372
+ var s, c, u, h;
373
373
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
378
+ var s, c, u, h;
379
379
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
384
+ var s, c, u, h;
385
385
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
390
+ var s, c, u, h;
391
391
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
396
+ var s, c, u, h;
397
397
  if (!i(s = a, o, _).call(s, r) || !i(c = a, o, C).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;
@@ -426,7 +426,7 @@ const a = class a {
426
426
  static readTubes(r = null) {
427
427
  var b, g, T;
428
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] = [
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
441
  if (!i(n = a, o, _).call(n, r) || !i(s = a, o, C).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)];
444
+ const h = e[Math.floor(Math.random() * 31)];
445
445
  let b = "0", g = "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
+ g = 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
+ g = 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
482
  i(c = a, o, p).call(c, ["2", "D3", b, g, T, I, U, "0"]);
483
483
  } else {
484
- const [d, b, g, T, I, U] = [
484
+ const [h, b, g, 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,7 +489,7 @@ 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, g, T, I, U]);
493
493
  }
494
494
  }
495
495
  static banknoteAccepted(r = null) {
@@ -508,10 +508,10 @@ const a = class a {
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", g = "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;
@@ -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, g, T, I, "0"]);
530
530
  } else {
531
- const [u, d, b, g, T, I] = [
531
+ const [u, h, b, g, 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,7 +536,7 @@ 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, g, T, I]);
540
540
  }
541
541
  }
542
542
  static coinsDispensed(r = null) {
@@ -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,
@@ -830,6 +831,9 @@ class G extends Pe {
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
  }
@@ -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;
@@ -1500,7 +1504,7 @@ K = function(t) {
1500
1504
  }, se = function() {
1501
1505
  x(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;
1507
+ var l, Xe, et, tt, B, ae, nt, it, rt, st, at, ot, lt, ct, dt, ht, 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
1508
  class xn extends G {
1505
1509
  constructor({
1506
1510
  filters: t = 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"));
@@ -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,35 +2132,35 @@ 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(":"), [g, T, I] = u.split("-"), U = new Date(2e3 + parseInt(I), parseInt(T) - 1, parseInt(g), parseInt(h), parseInt(b));
2132
2136
  return e.additional = {
2133
2137
  day: g,
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,
2140
2144
  hex: n
2141
2145
  }, this.dispatch("clock:registers", e.additional), e;
2142
- }, ht = function(t, e) {
2146
+ }, dt = function(t, e) {
2143
2147
  e.no_code = 41, e.name = "Machine activity", e.description = "Events from read machine activity";
2144
2148
  const n = String.fromCharCode(this.hexToDec(t[4]));
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}`), g = {
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
2178
  meaning: g[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)), 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, 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",
@@ -2203,7 +2207,7 @@ l = new WeakSet(), Xe = function() {
2203
2207
  }
2204
2208
  }
2205
2209
  return this.dispatch("machine:activity", e.additional), e;
2206
- }, dt = function(t, e) {
2210
+ }, ht = function(t, e) {
2207
2211
  const n = {
2208
2212
  30: "Spanish",
2209
2213
  31: "English",
@@ -2330,7 +2334,7 @@ l = new WeakSet(), Xe = function() {
2330
2334
  case "43":
2331
2335
  switch (e.request = "check-data", t[3]) {
2332
2336
  case "41":
2333
- e = i(this, l, ht).call(this, t, e);
2337
+ e = i(this, l, dt).call(this, t, e);
2334
2338
  break;
2335
2339
  case "43":
2336
2340
  e.request = "channel-status", e = i(this, l, at).call(this, t, e);
@@ -2351,7 +2355,7 @@ l = new WeakSet(), Xe = function() {
2351
2355
  e.request = "current-temperature", e = i(this, l, Dt).call(this, t, e);
2352
2356
  break;
2353
2357
  case "49":
2354
- e = i(this, l, dt).call(this, t[4], e);
2358
+ e = i(this, l, ht).call(this, t[4], e);
2355
2359
  break;
2356
2360
  case "5a":
2357
2361
  e = i(this, l, ut).call(this, t[4], 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 = [];
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 = [];
2574
2578
  for (let g = 0; g < 14; g++)
2575
- b.push(d.charCodeAt(g).toString(16));
2579
+ b.push(h.charCodeAt(g).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, V, J, d, Nt, At, de, Bt, qt, Rt, Ht, Lt, Ot, Ut, jt, Te, Wt, $t, Qt, Vt, Jt, zt, Gt, Yt, Kt, Zt, Xt, en, tn, nn, q, he, 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
  });
@@ -2639,7 +2643,7 @@ class Tn extends G {
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, Nt).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, $t).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, Qt).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, Vt).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, Jt).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, zt).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, de).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, de).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);
2873
+ const u = this.decToHex(c / 256), h = this.decToHex(c % 256), b = this.decToHex(t + 9);
2870
2874
  let g = "00";
2871
2875
  e && (g = 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, g, 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"]);
2931
+ const g = i(this, d, he).call(this, ["F1", "C7", u, h, b, "00", "00", "00", "00", "00", "F2", "00"]);
2928
2932
  let T = await this.internalDispense(g);
2929
2933
  return !T.dispensed && c && (T = await this.internalDispense(g)), 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), x(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), x(this, V, 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
+ x(this, V, 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, he).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(), V = new WeakMap(), J = new WeakMap(), d = new WeakSet(), Nt = 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
  ];
@@ -2991,7 +2996,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
2991
2996
  this.serialRegisterAvailableListener(e);
2992
2997
  }, At = function() {
2993
2998
  D.add(this);
2994
- }, he = function() {
2999
+ }, de = function() {
2995
3000
  return this.__banknote_purse.isRecycler && this.__banknote_purse.recycler.ict;
2996
3001
  }, Bt = function() {
2997
3002
  return this.hasCoinPurse || this.hasRecycler;
@@ -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,10 +3086,10 @@ 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;
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;
3085
3090
  }, $t = function(t, e) {
3086
3091
  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;
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;
3088
3093
  }, Qt = 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;
@@ -3093,7 +3098,7 @@ ee = new WeakMap(), V = new WeakMap(), J = new WeakMap(), h = new WeakSet(), Nt
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
3099
  }, Jt = 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;
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;
3107
3112
  }, zt = 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,22 +3120,22 @@ 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;
3136
+ ], g = n * 20 + s * 50 + c * 100 + u * 200 + h * 500 + b * 1e3;
3132
3137
  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 },
3138
+ banknotes: { b20: n, b50: s, b100: c, b200: u, b500: h, b1000: b },
3134
3139
  total_dispensed: g
3135
3140
  }, this.dispatch("session:money-dispensed", {
3136
3141
  type_money: 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,8 +3192,8 @@ 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);
3191
- }, de = function(t) {
3195
+ return this.appendToQueue(i(this, d, he).call(this, t), e);
3196
+ }, he = function(t) {
3192
3197
  return t[11] = this.serialBoardroidSumHex(t), t.map((e, n) => {
3193
3198
  t[n] = this.hexMaker(e);
3194
3199
  }), t;
@@ -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] = [
@@ -3236,7 +3241,7 @@ ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
3236
3241
  };
3237
3242
  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;
3238
3243
  }, 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);
3244
+ return i(this, d, de).call(this) ? i(this, d, ln).call(this, t) : i(this, d, cn).call(this, t);
3240
3245
  }, Ie = function(t) {
3241
3246
  const e = {
3242
3247
  coins: { $_50c: 0, $_1: 0, $_2: 0, $_5: 0, $_10: 0 },
@@ -3245,15 +3250,15 @@ ue = function({ dispensed: t = null, limit: e = 80 } = {}) {
3245
3250
  };
3246
3251
  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;
3247
3252
  }, Se = async function(t = null) {
3248
- if (!i(this, h, Bt).call(this)) throw new Error("Change not available");
3253
+ if (!i(this, d, Bt).call(this)) throw new Error("Change not available");
3249
3254
  let e = this.change, n = this.change;
3250
3255
  if (t !== null && (e = t, n = t), n <= 0) return !1;
3251
- const s = i(this, h, Ee).call(this, n);
3256
+ const s = i(this, d, Ee).call(this, n);
3252
3257
  n = s.pending;
3253
- const c = i(this, h, Ie).call(this, n);
3258
+ const c = i(this, d, Ie).call(this, n);
3254
3259
  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
3260
  };
3256
- var z, hn, dn;
3261
+ var z, dn, hn;
3257
3262
  class Dn extends G {
3258
3263
  constructor({
3259
3264
  filters: t = null,
@@ -3263,7 +3268,7 @@ class Dn extends G {
3263
3268
  super({ filters: t, config_port: e, no_device: n });
3264
3269
  S(this, z);
3265
3270
  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);
3271
+ this.__internal__.time.response_connection = 2e3, this.__internal__.time.response_general = 2e3, this.__internal__.serial.delay_first_connection = 1e3, i(this, z, hn).call(this), i(this, z, dn).call(this);
3267
3272
  }
3268
3273
  serialMessage(t) {
3269
3274
  const e = {
@@ -3325,9 +3330,9 @@ class Dn extends G {
3325
3330
  await this.sayCredits(), await this.sayAra(), await this.sayHi();
3326
3331
  }
3327
3332
  }
3328
- z = new WeakSet(), hn = function() {
3333
+ z = new WeakSet(), dn = function() {
3329
3334
  D.addCustom("arduino", this);
3330
- }, dn = function() {
3335
+ }, hn = function() {
3331
3336
  };
3332
3337
  /**
3333
3338
  * @license Webserial