@danidoble/webserial 4.4.6 → 4.4.7

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.
@@ -17,28 +17,28 @@ const q = { type: "error", data: "parser error" }, te = typeof Blob == "function
17
17
  e("b" + (s || ""));
18
18
  }, t.readAsDataURL(n);
19
19
  };
20
- function Q(n) {
20
+ function j(n) {
21
21
  return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
22
22
  }
23
23
  let P;
24
- function pe(n, e) {
24
+ function de(n, e) {
25
25
  if (te && n.data instanceof Blob)
26
- return n.data.arrayBuffer().then(Q).then(e);
26
+ return n.data.arrayBuffer().then(j).then(e);
27
27
  if (se && (n.data instanceof ArrayBuffer || ne(n.data)))
28
- return e(Q(n.data));
28
+ return e(j(n.data));
29
29
  H(n, !1, (t) => {
30
30
  P || (P = new TextEncoder()), e(P.encode(t));
31
31
  });
32
32
  }
33
- const X = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", C = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
34
- for (let n = 0; n < X.length; n++)
35
- C[X.charCodeAt(n)] = n;
33
+ const Q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", C = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
34
+ for (let n = 0; n < Q.length; n++)
35
+ C[Q.charCodeAt(n)] = n;
36
36
  const ye = (n) => {
37
- let e = n.length * 0.75, t = n.length, s, i = 0, r, o, l, c;
37
+ let e = n.length * 0.75, t = n.length, s, i = 0, r, o, c, l;
38
38
  n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
39
39
  const f = new ArrayBuffer(e), _ = new Uint8Array(f);
40
40
  for (s = 0; s < t; s += 4)
41
- r = C[n.charCodeAt(s)], o = C[n.charCodeAt(s + 1)], l = C[n.charCodeAt(s + 2)], c = C[n.charCodeAt(s + 3)], _[i++] = r << 2 | o >> 4, _[i++] = (o & 15) << 4 | l >> 2, _[i++] = (l & 3) << 6 | c & 63;
41
+ r = C[n.charCodeAt(s)], o = C[n.charCodeAt(s + 1)], c = C[n.charCodeAt(s + 2)], l = C[n.charCodeAt(s + 3)], _[i++] = r << 2 | o >> 4, _[i++] = (o & 15) << 4 | c >> 2, _[i++] = (c & 3) << 6 | l & 63;
42
42
  return f;
43
43
  }, ge = typeof ArrayBuffer == "function", W = (n, e) => {
44
44
  if (typeof n != "string")
@@ -62,15 +62,15 @@ const ye = (n) => {
62
62
  return ie(t, e);
63
63
  } else
64
64
  return { base64: !0, data: n };
65
- }, ie = (n, e) => e === "blob" ? n instanceof Blob ? n : new Blob([n]) : n instanceof ArrayBuffer ? n : n.buffer, re = "", be = (n, e) => {
65
+ }, ie = (n, e) => e === "blob" ? n instanceof Blob ? n : new Blob([n]) : n instanceof ArrayBuffer ? n : n.buffer, re = "", we = (n, e) => {
66
66
  const t = n.length, s = new Array(t);
67
67
  let i = 0;
68
68
  n.forEach((r, o) => {
69
- H(r, !1, (l) => {
70
- s[o] = l, ++i === t && e(s.join(re));
69
+ H(r, !1, (c) => {
70
+ s[o] = c, ++i === t && e(s.join(re));
71
71
  });
72
72
  });
73
- }, we = (n, e) => {
73
+ }, be = (n, e) => {
74
74
  const t = n.split(re), s = [];
75
75
  for (let i = 0; i < t.length; i++) {
76
76
  const r = W(t[i], e);
@@ -82,7 +82,7 @@ const ye = (n) => {
82
82
  function ve() {
83
83
  return new TransformStream({
84
84
  transform(n, e) {
85
- pe(n, (t) => {
85
+ de(n, (t) => {
86
86
  const s = t.length;
87
87
  let i;
88
88
  if (s < 126)
@@ -119,35 +119,35 @@ function Ee(n, e) {
119
119
  const t = [];
120
120
  let s = 0, i = -1, r = !1;
121
121
  return new TransformStream({
122
- transform(o, l) {
122
+ transform(o, c) {
123
123
  for (t.push(o); ; ) {
124
124
  if (s === 0) {
125
125
  if (T(t) < 1)
126
126
  break;
127
- const c = A(t, 1);
128
- r = (c[0] & 128) === 128, i = c[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
127
+ const l = A(t, 1);
128
+ r = (l[0] & 128) === 128, i = l[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
129
129
  } else if (s === 1) {
130
130
  if (T(t) < 2)
131
131
  break;
132
- const c = A(t, 2);
133
- i = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), s = 3;
132
+ const l = A(t, 2);
133
+ i = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
134
134
  } else if (s === 2) {
135
135
  if (T(t) < 8)
136
136
  break;
137
- const c = A(t, 8), f = new DataView(c.buffer, c.byteOffset, c.length), _ = f.getUint32(0);
137
+ const l = A(t, 8), f = new DataView(l.buffer, l.byteOffset, l.length), _ = f.getUint32(0);
138
138
  if (_ > Math.pow(2, 21) - 1) {
139
- l.enqueue(q);
139
+ c.enqueue(q);
140
140
  break;
141
141
  }
142
142
  i = _ * Math.pow(2, 32) + f.getUint32(4), s = 3;
143
143
  } else {
144
144
  if (T(t) < i)
145
145
  break;
146
- const c = A(t, i);
147
- l.enqueue(W(r ? c : N.decode(c), e)), s = 0;
146
+ const l = A(t, i);
147
+ c.enqueue(W(r ? l : N.decode(l), e)), s = 0;
148
148
  }
149
149
  if (i === 0 || i > n) {
150
- l.enqueue(q);
150
+ c.enqueue(q);
151
151
  break;
152
152
  }
153
153
  }
@@ -204,13 +204,13 @@ u.prototype.listeners = function(n) {
204
204
  u.prototype.hasListeners = function(n) {
205
205
  return !!this.listeners(n).length;
206
206
  };
207
- const O = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), p = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ce = "arraybuffer";
207
+ const O = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), d = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ce = "arraybuffer";
208
208
  function ae(n, ...e) {
209
209
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
210
210
  }
211
- const Te = p.setTimeout, Ae = p.clearTimeout;
211
+ const Te = d.setTimeout, Ae = d.clearTimeout;
212
212
  function L(n, e) {
213
- e.useNativeTimers ? (n.setTimeoutFn = Te.bind(p), n.clearTimeoutFn = Ae.bind(p)) : (n.setTimeoutFn = p.setTimeout.bind(p), n.clearTimeoutFn = p.clearTimeout.bind(p));
213
+ e.useNativeTimers ? (n.setTimeoutFn = Te.bind(d), n.clearTimeoutFn = Ae.bind(d)) : (n.setTimeoutFn = d.setTimeout.bind(d), n.clearTimeoutFn = d.clearTimeout.bind(d));
214
214
  }
215
215
  const Se = 1.33;
216
216
  function xe(n) {
@@ -335,7 +335,7 @@ class K extends u {
335
335
  return e.indexOf(":") === -1 ? e : "[" + e + "]";
336
336
  }
337
337
  _port() {
338
- return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
338
+ return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
339
339
  }
340
340
  _query(e) {
341
341
  const t = Be(e);
@@ -398,7 +398,7 @@ class Pe extends K {
398
398
  return this.onClose({ description: "transport closed by the server" }), !1;
399
399
  this.onPacket(s);
400
400
  };
401
- we(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
401
+ be(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
402
402
  }
403
403
  /**
404
404
  * For polling, send a close packet.
@@ -418,7 +418,7 @@ class Pe extends K {
418
418
  * @protected
419
419
  */
420
420
  write(e) {
421
- this.writable = !1, be(e, (t) => {
421
+ this.writable = !1, we(e, (t) => {
422
422
  this.doWrite(t, () => {
423
423
  this.writable = !0, this.emitReserved("drain");
424
424
  });
@@ -585,13 +585,13 @@ g.requestsCount = 0;
585
585
  g.requests = {};
586
586
  if (typeof document < "u") {
587
587
  if (typeof attachEvent == "function")
588
- attachEvent("onunload", j);
588
+ attachEvent("onunload", X);
589
589
  else if (typeof addEventListener == "function") {
590
- const n = "onpagehide" in p ? "pagehide" : "unload";
591
- addEventListener(n, j, !1);
590
+ const n = "onpagehide" in d ? "pagehide" : "unload";
591
+ addEventListener(n, X, !1);
592
592
  }
593
593
  }
594
- function j() {
594
+ function X() {
595
595
  for (let n in g.requests)
596
596
  g.requests.hasOwnProperty(n) && g.requests[n].abort();
597
597
  }
@@ -620,7 +620,7 @@ function he(n) {
620
620
  }
621
621
  if (!e)
622
622
  try {
623
- return new p[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
623
+ return new d[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
624
624
  } catch {
625
625
  }
626
626
  }
@@ -681,7 +681,7 @@ class Me extends K {
681
681
  return this.opts.timestampRequests && (t[this.opts.timestampParam] = ce()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
682
682
  }
683
683
  }
684
- const I = p.WebSocket || p.MozWebSocket;
684
+ const I = d.WebSocket || d.MozWebSocket;
685
685
  class Fe extends Me {
686
686
  createSocket(e, t, s) {
687
687
  return _e ? new I(e, t, s) : t ? new I(e, t) : new I(e);
@@ -709,9 +709,9 @@ class $e extends K {
709
709
  const t = Ee(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), i = ve();
710
710
  i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
711
711
  const r = () => {
712
- s.read().then(({ done: l, value: c }) => {
713
- l || (this.onPacket(c), r());
714
- }).catch((l) => {
712
+ s.read().then(({ done: c, value: l }) => {
713
+ c || (this.onPacket(l), r());
714
+ }).catch((c) => {
715
715
  });
716
716
  };
717
717
  r();
@@ -780,7 +780,7 @@ const M = typeof addEventListener == "function" && typeof removeEventListener ==
780
780
  M && addEventListener("offline", () => {
781
781
  x.forEach((n) => n());
782
782
  }, !1);
783
- class w extends u {
783
+ class b extends u {
784
784
  /**
785
785
  * Socket constructor.
786
786
  *
@@ -848,7 +848,7 @@ class w extends u {
848
848
  }, 0);
849
849
  return;
850
850
  }
851
- const e = this.opts.rememberUpgrade && w.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
851
+ const e = this.opts.rememberUpgrade && b.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
852
852
  this.readyState = "opening";
853
853
  const t = this.createTransport(e);
854
854
  t.open(), this.setTransport(t);
@@ -867,7 +867,7 @@ class w extends u {
867
867
  * @private
868
868
  */
869
869
  onOpen() {
870
- this.readyState = "open", w.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
870
+ this.readyState = "open", b.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
871
871
  }
872
872
  /**
873
873
  * Handles a packet.
@@ -1031,7 +1031,7 @@ class w extends u {
1031
1031
  * @private
1032
1032
  */
1033
1033
  _onError(e) {
1034
- if (w.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1034
+ if (b.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1035
1035
  return this.transports.shift(), this._open();
1036
1036
  this.emitReserved("error", e), this._onClose("transport error", e);
1037
1037
  }
@@ -1050,8 +1050,8 @@ class w extends u {
1050
1050
  }
1051
1051
  }
1052
1052
  }
1053
- w.protocol = oe;
1054
- class Ye extends w {
1053
+ b.protocol = oe;
1054
+ class Ye extends b {
1055
1055
  constructor() {
1056
1056
  super(...arguments), this._upgrades = [];
1057
1057
  }
@@ -1068,14 +1068,14 @@ class Ye extends w {
1068
1068
  */
1069
1069
  _probe(e) {
1070
1070
  let t = this.createTransport(e), s = !1;
1071
- w.priorWebsocketSuccess = !1;
1071
+ b.priorWebsocketSuccess = !1;
1072
1072
  const i = () => {
1073
- s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (d) => {
1073
+ s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (p) => {
1074
1074
  if (!s)
1075
- if (d.type === "pong" && d.data === "probe") {
1075
+ if (p.type === "pong" && p.data === "probe") {
1076
1076
  if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
1077
1077
  return;
1078
- w.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1078
+ b.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1079
1079
  s || this.readyState !== "closed" && (_(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1080
1080
  });
1081
1081
  } else {
@@ -1087,23 +1087,23 @@ class Ye extends w {
1087
1087
  function r() {
1088
1088
  s || (s = !0, _(), t.close(), t = null);
1089
1089
  }
1090
- const o = (d) => {
1091
- const E = new Error("probe error: " + d);
1090
+ const o = (p) => {
1091
+ const E = new Error("probe error: " + p);
1092
1092
  E.transport = t.name, r(), this.emitReserved("upgradeError", E);
1093
1093
  };
1094
- function l() {
1094
+ function c() {
1095
1095
  o("transport closed");
1096
1096
  }
1097
- function c() {
1097
+ function l() {
1098
1098
  o("socket closed");
1099
1099
  }
1100
- function f(d) {
1101
- t && d.name !== t.name && r();
1100
+ function f(p) {
1101
+ t && p.name !== t.name && r();
1102
1102
  }
1103
1103
  const _ = () => {
1104
- t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", l), this.off("close", c), this.off("upgrading", f);
1104
+ t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", c), this.off("close", l), this.off("upgrading", f);
1105
1105
  };
1106
- t.once("open", i), t.once("error", o), t.once("close", l), this.once("close", c), this.once("upgrading", f), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1106
+ t.once("open", i), t.once("error", o), t.once("close", c), this.once("close", l), this.once("upgrading", f), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1107
1107
  s || t.open();
1108
1108
  }, 200) : t.open();
1109
1109
  }
@@ -1129,15 +1129,15 @@ let Je = class extends Ye {
1129
1129
  (!s.transports || s.transports && typeof s.transports[0] == "string") && (s.transports = (s.transports || ["polling", "websocket", "webtransport"]).map((i) => Ve[i]).filter((i) => !!i)), super(e, s);
1130
1130
  }
1131
1131
  };
1132
- function Qe(n, e = "", t) {
1132
+ function je(n, e = "", t) {
1133
1133
  let s = n;
1134
1134
  t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = U(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1135
1135
  const r = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1136
1136
  return s.id = s.protocol + "://" + r + ":" + s.port + e, s.href = s.protocol + "://" + r + (t && t.port === s.port ? "" : ":" + s.port), s;
1137
1137
  }
1138
- const Xe = typeof ArrayBuffer == "function", je = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, ue = Object.prototype.toString, Ge = typeof Blob == "function" || typeof Blob < "u" && ue.call(Blob) === "[object BlobConstructor]", Ze = typeof File == "function" || typeof File < "u" && ue.call(File) === "[object FileConstructor]";
1138
+ const Qe = typeof ArrayBuffer == "function", Xe = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, ue = Object.prototype.toString, Ge = typeof Blob == "function" || typeof Blob < "u" && ue.call(Blob) === "[object BlobConstructor]", Ze = typeof File == "function" || typeof File < "u" && ue.call(File) === "[object FileConstructor]";
1139
1139
  function z(n) {
1140
- return Xe && (n instanceof ArrayBuffer || je(n)) || Ge && n instanceof Blob || Ze && n instanceof File;
1140
+ return Qe && (n instanceof ArrayBuffer || Xe(n)) || Ge && n instanceof Blob || Ze && n instanceof File;
1141
1141
  }
1142
1142
  function R(n, e) {
1143
1143
  if (!n || typeof n != "object")
@@ -1200,18 +1200,23 @@ function $(n, e) {
1200
1200
  }
1201
1201
  const st = [
1202
1202
  "connect",
1203
+ // used on the client side
1203
1204
  "connect_error",
1205
+ // used on the client side
1204
1206
  "disconnect",
1207
+ // used on both sides
1205
1208
  "disconnecting",
1209
+ // used on the server side
1206
1210
  "newListener",
1211
+ // used by the Node.js EventEmitter
1207
1212
  "removeListener"
1208
1213
  // used by the Node.js EventEmitter
1209
- ], nt = 5;
1214
+ ];
1210
1215
  var h;
1211
1216
  (function(n) {
1212
1217
  n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
1213
1218
  })(h || (h = {}));
1214
- class it {
1219
+ class nt {
1215
1220
  /**
1216
1221
  * Encoder constructor
1217
1222
  *
@@ -1251,17 +1256,15 @@ class it {
1251
1256
  return i.unshift(s), i;
1252
1257
  }
1253
1258
  }
1254
- function G(n) {
1255
- return Object.prototype.toString.call(n) === "[object Object]";
1256
- }
1257
1259
  class Y extends u {
1258
1260
  /**
1259
1261
  * Decoder constructor
1260
- *
1261
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
1262
1262
  */
1263
1263
  constructor(e) {
1264
- super(), this.reviver = e;
1264
+ super(), this.opts = Object.assign({
1265
+ reviver: void 0,
1266
+ maxAttachments: 10
1267
+ }, typeof e == "function" ? { reviver: e } : e);
1265
1268
  }
1266
1269
  /**
1267
1270
  * Decodes an encoded packet string into packet JSON.
@@ -1275,7 +1278,7 @@ class Y extends u {
1275
1278
  throw new Error("got plaintext data when reconstructing a packet");
1276
1279
  t = this.decodeString(e);
1277
1280
  const s = t.type === h.BINARY_EVENT;
1278
- s || t.type === h.BINARY_ACK ? (t.type = s ? h.EVENT : h.ACK, this.reconstructor = new rt(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1281
+ s || t.type === h.BINARY_ACK ? (t.type = s ? h.EVENT : h.ACK, this.reconstructor = new it(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1279
1282
  } else if (z(e) || e.base64)
1280
1283
  if (this.reconstructor)
1281
1284
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
@@ -1304,7 +1307,12 @@ class Y extends u {
1304
1307
  const o = e.substring(r, t);
1305
1308
  if (o != Number(o) || e.charAt(t) !== "-")
1306
1309
  throw new Error("Illegal attachments");
1307
- s.attachments = Number(o);
1310
+ const c = Number(o);
1311
+ if (!rt(c) || c < 0)
1312
+ throw new Error("Illegal attachments");
1313
+ if (c > this.opts.maxAttachments)
1314
+ throw new Error("too many attachments");
1315
+ s.attachments = c;
1308
1316
  }
1309
1317
  if (e.charAt(t + 1) === "/") {
1310
1318
  const r = t + 1;
@@ -1338,7 +1346,7 @@ class Y extends u {
1338
1346
  }
1339
1347
  tryParse(e) {
1340
1348
  try {
1341
- return JSON.parse(e, this.reviver);
1349
+ return JSON.parse(e, this.opts.reviver);
1342
1350
  } catch {
1343
1351
  return !1;
1344
1352
  }
@@ -1366,7 +1374,7 @@ class Y extends u {
1366
1374
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1367
1375
  }
1368
1376
  }
1369
- class rt {
1377
+ class it {
1370
1378
  constructor(e) {
1371
1379
  this.packet = e, this.buffers = [], this.reconPack = e;
1372
1380
  }
@@ -1392,14 +1400,19 @@ class rt {
1392
1400
  this.reconPack = null, this.buffers = [];
1393
1401
  }
1394
1402
  }
1403
+ const rt = Number.isInteger || function(n) {
1404
+ return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1405
+ };
1406
+ function G(n) {
1407
+ return Object.prototype.toString.call(n) === "[object Object]";
1408
+ }
1395
1409
  const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1396
1410
  __proto__: null,
1397
1411
  Decoder: Y,
1398
- Encoder: it,
1412
+ Encoder: nt,
1399
1413
  get PacketType() {
1400
1414
  return h;
1401
- },
1402
- protocol: nt
1415
+ }
1403
1416
  }, Symbol.toStringTag, { value: "Module" }));
1404
1417
  function y(n, e, t) {
1405
1418
  return n.on(e, t), function() {
@@ -1540,11 +1553,11 @@ class fe extends u {
1540
1553
  data: t
1541
1554
  };
1542
1555
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1543
- const _ = this.ids++, d = t.pop();
1544
- this._registerAckCallback(_, d), o.id = _;
1556
+ const _ = this.ids++, p = t.pop();
1557
+ this._registerAckCallback(_, p), o.id = _;
1545
1558
  }
1546
- const l = (i = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || i === void 0 ? void 0 : i.writable, c = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());
1547
- return this.flags.volatile && !l || (c ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1559
+ const c = (i = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || i === void 0 ? void 0 : i.writable, l = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());
1560
+ return this.flags.volatile && !c || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1548
1561
  }
1549
1562
  /**
1550
1563
  * @private
@@ -1558,11 +1571,11 @@ class fe extends u {
1558
1571
  }
1559
1572
  const r = this.io.setTimeoutFn(() => {
1560
1573
  delete this.acks[e];
1561
- for (let l = 0; l < this.sendBuffer.length; l++)
1562
- this.sendBuffer[l].id === e && this.sendBuffer.splice(l, 1);
1574
+ for (let c = 0; c < this.sendBuffer.length; c++)
1575
+ this.sendBuffer[c].id === e && this.sendBuffer.splice(c, 1);
1563
1576
  t.call(this, new Error("operation has timed out"));
1564
- }, i), o = (...l) => {
1565
- this.io.clearTimeoutFn(r), t.apply(this, l);
1577
+ }, i), o = (...c) => {
1578
+ this.io.clearTimeoutFn(r), t.apply(this, c);
1566
1579
  };
1567
1580
  o.withError = !0, this.acks[e] = o;
1568
1581
  }
@@ -1584,7 +1597,7 @@ class fe extends u {
1584
1597
  */
1585
1598
  emitWithAck(e, ...t) {
1586
1599
  return new Promise((s, i) => {
1587
- const r = (o, l) => o ? i(o) : s(l);
1600
+ const r = (o, c) => o ? i(o) : s(c);
1588
1601
  r.withError = !0, t.push(r), this.emit(e, ...t);
1589
1602
  });
1590
1603
  }
@@ -1603,7 +1616,7 @@ class fe extends u {
1603
1616
  args: e,
1604
1617
  flags: Object.assign({ fromQueue: !0 }, this.flags)
1605
1618
  };
1606
- e.push((i, ...r) => s !== this._queue[0] ? void 0 : (i !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...r)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1619
+ e.push((i, ...r) => (this._queue[0], i !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...r)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1607
1620
  }
1608
1621
  /**
1609
1622
  * Send the first packet of the queue, and wait for an acknowledgement from the server.
@@ -1761,7 +1774,7 @@ class fe extends u {
1761
1774
  * @private
1762
1775
  */
1763
1776
  onconnect(e, t) {
1764
- this.id = e, this.recovered = t && this._pid === t, this._pid = t, this.connected = !0, this.emitBuffered(), this.emitReserved("connect"), this._drainQueue(!0);
1777
+ this.id = e, this.recovered = t && this._pid === t, this._pid = t, this.connected = !0, this.emitBuffered(), this._drainQueue(!0), this.emitReserved("connect");
1765
1778
  }
1766
1779
  /**
1767
1780
  * Emit buffered events (received and emitted).
@@ -2086,15 +2099,15 @@ class V extends u {
2086
2099
  this._readyState = "opening", this.skipReconnect = !1;
2087
2100
  const i = y(t, "open", function() {
2088
2101
  s.onopen(), e && e();
2089
- }), r = (l) => {
2090
- this.cleanup(), this._readyState = "closed", this.emitReserved("error", l), e ? e(l) : this.maybeReconnectOnOpen();
2102
+ }), r = (c) => {
2103
+ this.cleanup(), this._readyState = "closed", this.emitReserved("error", c), e ? e(c) : this.maybeReconnectOnOpen();
2091
2104
  }, o = y(t, "error", r);
2092
2105
  if (this._timeout !== !1) {
2093
- const l = this._timeout, c = this.setTimeoutFn(() => {
2106
+ const c = this._timeout, l = this.setTimeoutFn(() => {
2094
2107
  i(), r(new Error("timeout")), t.close();
2095
- }, l);
2096
- this.opts.autoUnref && c.unref(), this.subs.push(() => {
2097
- this.clearTimeoutFn(c);
2108
+ }, c);
2109
+ this.opts.autoUnref && l.unref(), this.subs.push(() => {
2110
+ this.clearTimeoutFn(l);
2098
2111
  });
2099
2112
  }
2100
2113
  return this.subs.push(i), this.subs.push(o), this;
@@ -2271,9 +2284,9 @@ class V extends u {
2271
2284
  const k = {};
2272
2285
  function B(n, e) {
2273
2286
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2274
- const t = Qe(n, e.path || "/socket.io"), s = t.source, i = t.id, r = t.path, o = k[i] && r in k[i].nsps, l = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2275
- let c;
2276
- return l ? c = new V(s, e) : (k[i] || (k[i] = new V(s, e)), c = k[i]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
2287
+ const t = je(n, e.path || "/socket.io"), s = t.source, i = t.id, r = t.path, o = k[i] && r in k[i].nsps, c = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2288
+ let l;
2289
+ return c ? l = new V(s, e) : (k[i] || (k[i] = new V(s, e)), l = k[i]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2277
2290
  }
2278
2291
  Object.assign(B, {
2279
2292
  Manager: V,
@@ -2286,7 +2299,7 @@ class Z extends CustomEvent {
2286
2299
  super(e, t);
2287
2300
  }
2288
2301
  }
2289
- class de extends EventTarget {
2302
+ class pe extends EventTarget {
2290
2303
  __listeners__ = {
2291
2304
  debug: !1
2292
2305
  };
@@ -2387,7 +2400,7 @@ class de extends EventTarget {
2387
2400
  this.__listeners__[e] = !1;
2388
2401
  }
2389
2402
  }
2390
- class a extends de {
2403
+ class a extends pe {
2391
2404
  static instance;
2392
2405
  static devices = {};
2393
2406
  constructor() {
@@ -2579,7 +2592,7 @@ class ct {
2579
2592
  return !this.#i;
2580
2593
  }
2581
2594
  }
2582
- const b = new ct(), D = {
2595
+ const w = new ct(), D = {
2583
2596
  baudRate: 9600,
2584
2597
  dataBits: 8,
2585
2598
  stopBits: 1,
@@ -2587,7 +2600,7 @@ const b = new ct(), D = {
2587
2600
  bufferSize: 32768,
2588
2601
  flowControl: "none"
2589
2602
  };
2590
- class ht extends de {
2603
+ class ht extends pe {
2591
2604
  __internal__ = {
2592
2605
  bypassSerialBytesConnection: !1,
2593
2606
  auto_response: !1,
@@ -2642,8 +2655,11 @@ class ht extends de {
2642
2655
  auto_response: null,
2643
2656
  free_timeout_ms: 50,
2644
2657
  // In previous versions 400 was used
2645
- useRTSCTS: !1
2658
+ useRTSCTS: !1,
2646
2659
  // Use RTS/CTS flow control
2660
+ pipeAbortController: null,
2661
+ pipeDone: null,
2662
+ pumpReader: null
2647
2663
  },
2648
2664
  device: {
2649
2665
  type: "unknown",
@@ -2670,7 +2686,7 @@ class ht extends de {
2670
2686
  device_listen_on_channel: i = 1,
2671
2687
  bypassSerialBytesConnection: r = !1,
2672
2688
  socket: o = !1,
2673
- transformStream: l = !1
2689
+ transformStream: c = !1
2674
2690
  } = {
2675
2691
  filters: null,
2676
2692
  config_port: D,
@@ -2682,7 +2698,14 @@ class ht extends de {
2682
2698
  }) {
2683
2699
  if (super(), !("serial" in navigator))
2684
2700
  throw new Error("Web Serial not supported");
2685
- e && (this.serialFilters = e), t && (this.serialConfigPort = t), r && (this.__internal__.bypassSerialBytesConnection = r), s && this.#v(s), i && ["number", "string"].includes(typeof i) && (this.listenOnChannel = i), this.__internal__.serial.socket = o, this.__internal__.serial.transformStream = l, this.#g(), this.#m();
2701
+ if (e && (this.serialFilters = e), t && (this.serialConfigPort = t), r && (this.__internal__.bypassSerialBytesConnection = r), s && this.#v(s), i && ["number", "string"].includes(typeof i) && (this.listenOnChannel = i), this.__internal__.serial.socket = o, typeof c == "function")
2702
+ this.__internal__.serial.transformStream = c;
2703
+ else if (c) {
2704
+ const l = c;
2705
+ this.__internal__.serial.transformStream = () => l;
2706
+ } else
2707
+ this.__internal__.serial.transformStream = !1;
2708
+ this.#g(), this.#m();
2686
2709
  }
2687
2710
  set listenOnChannel(e) {
2688
2711
  if (typeof e == "string" && (e = parseInt(e)), isNaN(e) || e < 1 || e > 255)
@@ -2898,7 +2921,7 @@ class ht extends de {
2898
2921
  };
2899
2922
  }
2900
2923
  #t(e) {
2901
- return this.useSocket ? this.__internal__.serial.connected && b.isConnected() : !!(e && e.readable && e.writable);
2924
+ return this.useSocket ? this.__internal__.serial.connected && w.isConnected() : !!(e && e.readable && e.writable);
2902
2925
  }
2903
2926
  async timeout(e, t) {
2904
2927
  this.__internal__.last_error.message = "Operation response timed out.", this.__internal__.last_error.action = t, this.__internal__.last_error.code = e, this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0), t === "connect" ? (this.__internal__.serial.connected = !1, this.dispatch("serial:reconnect", {}), a.$dispatchChange(this)) : t === "connection:start" && (await this.serialDisconnect(), this.__internal__.serial.connected = !1, this.__internal__.aux_port_connector += 1, a.$dispatchChange(this), await this.serialConnect()), this.__internal__.serial.queue.length > 0 && this.dispatch("internal:queue", {}), this.dispatch("serial:timeout", {
@@ -2938,29 +2961,38 @@ class ht extends de {
2938
2961
  async serialDisconnect() {
2939
2962
  try {
2940
2963
  if (this.useSocket)
2941
- b.isConnected() && b.disconnectDevice(this.configDeviceSocket);
2964
+ w.isConnected() && w.disconnectDevice(this.configDeviceSocket);
2942
2965
  else {
2943
2966
  this.__internal__.serial.keep_reading = !1;
2944
- const e = this.__internal__.serial.reader, t = this.__internal__.serial.output_stream;
2945
- if (e && (await e.cancel().catch((s) => this.serialErrors(s)), this.__internal__.serial.input_done && await this.__internal__.serial.input_done), t) {
2967
+ const e = this.__internal__.serial.reader;
2968
+ e && await e.cancel().catch(() => {
2969
+ }), this.__internal__.serial.pumpReader && await this.__internal__.serial.pumpReader.cancel().catch(() => {
2970
+ }), this.__internal__.serial.pipeDone && (await this.__internal__.serial.pipeDone.catch(() => {
2971
+ }), this.__internal__.serial.pipeDone = null), this.__internal__.serial.input_done && await this.__internal__.serial.input_done.catch(() => {
2972
+ });
2973
+ const t = this.__internal__.serial.output_stream;
2974
+ if (t) {
2946
2975
  const s = t.getWriter();
2947
- await s.close(), s.releaseLock(), this.__internal__.serial.output_done && await this.__internal__.serial.output_done;
2976
+ await s.close().catch(() => {
2977
+ }), s.releaseLock(), this.__internal__.serial.output_done && await this.__internal__.serial.output_done.catch(() => {
2978
+ });
2948
2979
  }
2949
- this.__internal__.serial && this.__internal__.serial.connected && this.__internal__.serial.port && await this.__internal__.serial.port.close();
2980
+ this.__internal__.serial.port && await this.__internal__.serial.port.close().catch(() => {
2981
+ });
2950
2982
  }
2951
2983
  } catch (e) {
2952
- this.serialErrors(e);
2984
+ console.error(e), this.serialErrors(e);
2953
2985
  } finally {
2954
2986
  this.__internal__.serial.reader = null, this.__internal__.serial.input_done = null, this.__internal__.serial.output_stream = null, this.__internal__.serial.output_done = null, this.__internal__.serial.connected = !1, this.__internal__.serial.port = null, a.$dispatchChange(this);
2955
2987
  }
2956
2988
  }
2957
2989
  async #o(e) {
2958
- if (b.isDisconnected())
2990
+ if (w.isDisconnected())
2959
2991
  throw this.#e({ error: "Socket is disconnected." }), new Error("The socket is disconnected");
2960
2992
  if (this.isDisconnected)
2961
2993
  throw this.#e({ error: "Port is closed, not readable or writable." }), new Error("The port is closed or is not readable/writable");
2962
2994
  const t = this.validateBytes(e);
2963
- b.write({ config: this.configDeviceSocket, bytes: Array.from(t) });
2995
+ w.write({ config: this.configDeviceSocket, bytes: Array.from(t) });
2964
2996
  }
2965
2997
  async #s(e) {
2966
2998
  if (this.useSocket) {
@@ -3116,7 +3148,7 @@ class ht extends de {
3116
3148
  }, this.__internal__.serial.free_timeout_ms || 50));
3117
3149
  }
3118
3150
  }
3119
- async #d() {
3151
+ async #p() {
3120
3152
  const {
3121
3153
  limiter: e,
3122
3154
  prefixLimiter: t = !1,
@@ -3130,56 +3162,83 @@ class ht extends de {
3130
3162
  let r = new TextDecoder().decode(i);
3131
3163
  const o = [];
3132
3164
  if (typeof e == "string") {
3133
- let c;
3165
+ let l;
3134
3166
  if (t && s)
3135
- c = new RegExp(`${e}([^${e}]+)${e}`, "g");
3167
+ l = new RegExp(`${e}([^${e}]+)${e}`, "g");
3136
3168
  else if (t)
3137
- c = new RegExp(`${e}([^${e}]*)`, "g");
3169
+ l = new RegExp(`${e}([^${e}]*)`, "g");
3138
3170
  else if (s)
3139
- c = new RegExp(`([^${e}]+)${e}`, "g");
3171
+ l = new RegExp(`([^${e}]+)${e}`, "g");
3140
3172
  else
3141
3173
  return;
3142
3174
  let f, _ = 0;
3143
- for (; (f = c.exec(r)) !== null; )
3144
- o.push(new TextEncoder().encode(f[1])), _ = c.lastIndex;
3175
+ for (; (f = l.exec(r)) !== null; )
3176
+ o.push(new TextEncoder().encode(f[1])), _ = l.lastIndex;
3145
3177
  r = r.slice(_);
3146
3178
  } else if (e instanceof RegExp) {
3147
- let c, f = 0;
3179
+ let l, f = 0;
3148
3180
  if (t && s) {
3149
3181
  const _ = new RegExp(`${e.source}(.*?)${e.source}`, "g");
3150
- for (; (c = _.exec(r)) !== null; )
3151
- o.push(new TextEncoder().encode(c[1])), f = _.lastIndex;
3182
+ for (; (l = _.exec(r)) !== null; )
3183
+ o.push(new TextEncoder().encode(l[1])), f = _.lastIndex;
3152
3184
  } else if (s)
3153
- for (; (c = e.exec(r)) !== null; ) {
3154
- const _ = c.index, d = r.slice(f, _);
3155
- o.push(new TextEncoder().encode(d)), f = e.lastIndex;
3185
+ for (; (l = e.exec(r)) !== null; ) {
3186
+ const _ = l.index, p = r.slice(f, _);
3187
+ o.push(new TextEncoder().encode(p)), f = e.lastIndex;
3156
3188
  }
3157
3189
  else if (t) {
3158
3190
  const _ = r.split(e);
3159
3191
  _.shift();
3160
- for (const d of _)
3161
- o.push(new TextEncoder().encode(d));
3192
+ for (const p of _)
3193
+ o.push(new TextEncoder().encode(p));
3162
3194
  r = "";
3163
3195
  }
3164
3196
  r = r.slice(f);
3165
3197
  }
3166
- for (const c of o)
3167
- this.#r(c);
3168
- const l = new TextEncoder().encode(r);
3169
- this.__internal__.serial.response.buffer = l, l.length > 0 && (this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
3198
+ for (const l of o)
3199
+ this.#r(l);
3200
+ const c = new TextEncoder().encode(r);
3201
+ this.__internal__.serial.response.buffer = c, c.length > 0 && (this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
3170
3202
  this.#r(this.__internal__.serial.response.buffer, !0), this.__internal__.serial.response.buffer = new Uint8Array(0);
3171
3203
  }, this.__internal__.serial.free_timeout_ms ?? 50));
3172
3204
  }
3173
- async #p() {
3205
+ async #d() {
3174
3206
  const e = this.__internal__.serial.port;
3175
3207
  if (!e || !e.readable) throw new Error("Port is not readable");
3176
- const t = this.__internal__.serial.transformStream ? this.__internal__.serial.transformStream : null, s = t ? e.readable.pipeThrough(t).getReader() : e.readable.getReader();
3208
+ const t = this.__internal__.serial.transformStream;
3209
+ let s;
3210
+ if (t) {
3211
+ const i = t(), r = e.readable.getReader();
3212
+ this.__internal__.serial.pumpReader = r;
3213
+ const o = i.writable.getWriter();
3214
+ this.__internal__.serial.pipeDone = (async () => {
3215
+ try {
3216
+ for (; ; ) {
3217
+ const { value: c, done: l } = await r.read();
3218
+ if (l) break;
3219
+ await o.write(c);
3220
+ }
3221
+ } catch {
3222
+ } finally {
3223
+ try {
3224
+ r.releaseLock();
3225
+ } catch {
3226
+ }
3227
+ try {
3228
+ o.releaseLock();
3229
+ } catch {
3230
+ }
3231
+ this.__internal__.serial.pumpReader = null;
3232
+ }
3233
+ })(), s = i.readable.getReader();
3234
+ } else
3235
+ s = e.readable.getReader();
3177
3236
  this.__internal__.serial.reader = s;
3178
3237
  try {
3179
3238
  for (; this.__internal__.serial.keep_reading; ) {
3180
3239
  const { value: i, done: r } = await s.read();
3181
3240
  if (r) break;
3182
- this.#h(i), this.__internal__.serial.transformStream ? await this.#_() : this.__internal__.serial.response.delimited ? await this.#d() : this.__internal__.serial.response.length === null ? await this.#u() : await this.#f();
3241
+ this.#h(i), t ? await this.#_() : this.__internal__.serial.response.delimited ? await this.#p() : this.__internal__.serial.response.length === null ? await this.#u() : await this.#f();
3183
3242
  }
3184
3243
  } catch (i) {
3185
3244
  this.serialErrors(i);
@@ -3193,11 +3252,11 @@ class ht extends de {
3193
3252
  async serialConnect() {
3194
3253
  try {
3195
3254
  if (this.#a(!0), this.useSocket) {
3196
- if (b.prepare(), this.__internal__.serial.last_action = "connect", this.__internal__.timeout.until_response = setTimeout(async () => {
3255
+ if (w.prepare(), this.__internal__.serial.last_action = "connect", this.__internal__.timeout.until_response = setTimeout(async () => {
3197
3256
  await this.timeout(this.__internal__.serial.bytes_connection ?? [], "connection:start");
3198
- }, this.__internal__.time.response_connection), b.isDisconnected())
3257
+ }, this.__internal__.time.response_connection), w.isDisconnected())
3199
3258
  return;
3200
- b.connectDevice(this.configDeviceSocket), this.dispatch("serial:sent", {
3259
+ w.connectDevice(this.configDeviceSocket), this.dispatch("serial:sent", {
3201
3260
  action: "connect",
3202
3261
  bytes: this.__internal__.serial.bytes_connection
3203
3262
  });
@@ -3225,7 +3284,7 @@ class ht extends de {
3225
3284
  }, this.__internal__.time.response_connection), this.__internal__.serial.last_action = "connect", await this.#s(this.__internal__.serial.bytes_connection ?? []), this.dispatch("serial:sent", {
3226
3285
  action: "connect",
3227
3286
  bytes: this.__internal__.serial.bytes_connection
3228
- }), this.__internal__.auto_response && this.#r(this.__internal__.serial.auto_response), await this.#p();
3287
+ }), this.__internal__.auto_response && this.#r(this.__internal__.serial.auto_response), this.__internal__.serial.input_done = this.#d(), await this.__internal__.serial.input_done;
3229
3288
  }
3230
3289
  } catch (e) {
3231
3290
  this.#a(!1), this.serialErrors(e);
@@ -3279,7 +3338,7 @@ class ht extends de {
3279
3338
  #m() {
3280
3339
  const e = this;
3281
3340
  this.on("internal:queue", async () => {
3282
- await e.#w();
3341
+ await e.#b();
3283
3342
  });
3284
3343
  const t = () => {
3285
3344
  e.isConnected && e.#e({ error: "Socket disconnected." });
@@ -3287,17 +3346,17 @@ class ht extends de {
3287
3346
  e.isDisconnected && !e.isConnecting && e.serialConnect().catch(() => {
3288
3347
  });
3289
3348
  };
3290
- this.useSocket && (window.addEventListener("serial:socket:disconnected", t), window.addEventListener("serial:socket:connected", s)), this.#b();
3349
+ this.useSocket && (window.addEventListener("serial:socket:disconnected", t), window.addEventListener("serial:socket:connected", s)), this.#w();
3291
3350
  }
3292
- #b() {
3351
+ #w() {
3293
3352
  const e = this;
3294
3353
  navigator.serial.addEventListener("connect", async () => {
3295
3354
  e.isDisconnected && await e.serialConnect().catch(() => {
3296
3355
  });
3297
3356
  });
3298
3357
  }
3299
- async #w() {
3300
- if (this.useSocket && b.isDisconnected())
3358
+ async #b() {
3359
+ if (this.useSocket && w.isDisconnected())
3301
3360
  return;
3302
3361
  if (!this.#t(this.__internal__.serial.port)) {
3303
3362
  this.#e({ error: "Port is closed, not readable or writable." }), await this.serialConnect();
@@ -3459,7 +3518,7 @@ class ht extends de {
3459
3518
  }
3460
3519
  }
3461
3520
  export {
3462
- ht as T,
3463
- b as c,
3464
- a as s
3521
+ w as h,
3522
+ a as s,
3523
+ ht as v
3465
3524
  };