@danidoble/webserial 4.2.3 → 4.2.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/LICENSE +21 -0
- package/dist/arduino.cjs +1 -1
- package/dist/arduino.js +36 -42
- package/dist/boardroid.cjs +1 -1
- package/dist/boardroid.js +350 -384
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +688 -560
- package/dist/{kernel-B15wfB2x.js → kernel-Bquzoyqh.js} +413 -437
- package/dist/kernel-DSUxKxea.cjs +4 -0
- package/dist/kernel.cjs +2 -2
- package/dist/kernel.js +3 -3
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +85 -123
- package/dist/pinpad.cjs +13 -13
- package/dist/pinpad.js +569 -560
- package/dist/pinpax.cjs +3 -20
- package/dist/pinpax.js +76 -109
- package/dist/relay-BsUsBpOv.cjs +3 -0
- package/dist/relay-Dop4mFk-.js +1341 -0
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +32 -45
- package/dist/webserial.cjs +2 -2
- package/dist/webserial.js +3 -3
- package/package.json +32 -32
- package/dist/kernel-CtyQRsMI.cjs +0 -4
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var W = (l) => {
|
|
3
3
|
throw TypeError(l);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var w = (l, e, t) => (
|
|
8
|
-
function
|
|
5
|
+
var ue = (l, e, t) => e in l ? ce(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
6
|
+
var N = (l, e, t) => ue(l, typeof e != "symbol" ? e + "" : e, t), F = (l, e, t) => e.has(l) || W("Cannot " + t);
|
|
7
|
+
var w = (l, e, t) => (F(l, e, "read from private field"), t ? t.call(l) : e.get(l)), U = (l, e, t) => e.has(l) ? W("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), j = (l, e, t, n) => (F(l, e, "write to private field"), n ? n.call(l, t) : e.set(l, t), t), a = (l, e, t) => (F(l, e, "access private method"), t);
|
|
8
|
+
function _e(l = 100) {
|
|
9
9
|
return new Promise((e) => setTimeout(() => e(), l));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function ve() {
|
|
12
12
|
return "serial" in navigator;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ke() {
|
|
15
15
|
return "geolocation" in navigator;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Ce() {
|
|
18
18
|
return "crypto" in window;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function De(l = 1) {
|
|
21
21
|
return l * 1e3;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Ae(l) {
|
|
24
24
|
return l == null || l === "";
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var v, A, s, Y, Z, c, O, p, d, I, o, $, T;
|
|
27
27
|
const r = class r {
|
|
28
28
|
static status(e = null) {
|
|
29
|
-
var n,
|
|
30
|
-
if (!a(n = r,
|
|
29
|
+
var n, i;
|
|
30
|
+
if (!a(n = r, s, c).call(n, e)) return !1;
|
|
31
31
|
let t = [];
|
|
32
|
-
switch (w(r,
|
|
32
|
+
switch (w(r, v)) {
|
|
33
33
|
case "locker":
|
|
34
34
|
t = ["0", "8"];
|
|
35
35
|
break;
|
|
@@ -42,13 +42,13 @@ const r = class r {
|
|
|
42
42
|
default:
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
|
-
a(
|
|
45
|
+
a(i = r, s, o).call(i, t);
|
|
46
46
|
}
|
|
47
47
|
static dispensed(e = null) {
|
|
48
|
-
var n,
|
|
49
|
-
if (!a(n = r,
|
|
48
|
+
var n, i;
|
|
49
|
+
if (!a(n = r, s, c).call(n, e)) return !1;
|
|
50
50
|
let t = [];
|
|
51
|
-
switch (w(r,
|
|
51
|
+
switch (w(r, v)) {
|
|
52
52
|
case "locker":
|
|
53
53
|
t = ["0", "7", "4", "4", "4"];
|
|
54
54
|
break;
|
|
@@ -61,13 +61,13 @@ const r = class r {
|
|
|
61
61
|
default:
|
|
62
62
|
return !1;
|
|
63
63
|
}
|
|
64
|
-
a(
|
|
64
|
+
a(i = r, s, o).call(i, t);
|
|
65
65
|
}
|
|
66
66
|
static notDispensed(e = null) {
|
|
67
|
-
var n,
|
|
68
|
-
if (!a(n = r,
|
|
67
|
+
var n, i;
|
|
68
|
+
if (!a(n = r, s, c).call(n, e)) return !1;
|
|
69
69
|
let t = [];
|
|
70
|
-
switch (w(r,
|
|
70
|
+
switch (w(r, v)) {
|
|
71
71
|
case "locker":
|
|
72
72
|
t = ["0", "7", "5", "5", "5"];
|
|
73
73
|
break;
|
|
@@ -80,30 +80,30 @@ const r = class r {
|
|
|
80
80
|
default:
|
|
81
81
|
return !1;
|
|
82
82
|
}
|
|
83
|
-
a(
|
|
83
|
+
a(i = r, s, o).call(i, t);
|
|
84
84
|
}
|
|
85
85
|
static gateInactive(e = null) {
|
|
86
86
|
var t;
|
|
87
|
-
if (!a(t = r,
|
|
88
|
-
a(this,
|
|
87
|
+
if (!a(t = r, s, c).call(t, e) || !a(this, s, O).call(this)) return !1;
|
|
88
|
+
a(this, s, o).call(this, ["0", "7", "5", "5", "5"]);
|
|
89
89
|
}
|
|
90
90
|
static gateConfigured(e = null) {
|
|
91
91
|
var t;
|
|
92
|
-
if (!a(t = r,
|
|
93
|
-
a(this,
|
|
92
|
+
if (!a(t = r, s, c).call(t, e) || !a(this, s, O).call(this)) return !1;
|
|
93
|
+
a(this, s, o).call(this, ["0", "6"]);
|
|
94
94
|
}
|
|
95
95
|
static keyPressed(e = null) {
|
|
96
96
|
var u, g, f;
|
|
97
|
-
if (!a(u = r,
|
|
98
|
-
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], n = (128 + w(r, A)).toString(16),
|
|
99
|
-
a(f = r,
|
|
97
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, d).call(g)) return !1;
|
|
98
|
+
const t = ["30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "2A", "23", "41", "42", "43", "44"], n = (128 + w(r, A)).toString(16), i = Math.floor(Math.random() * 15);
|
|
99
|
+
a(f = r, s, o).call(f, ["2", n, "54", t[i]]);
|
|
100
100
|
}
|
|
101
101
|
static doorOpened(e = null) {
|
|
102
|
-
var
|
|
103
|
-
if (!a(
|
|
102
|
+
var i, u;
|
|
103
|
+
if (!a(i = r, s, c).call(i, e) || !a(this, s, I).call(this)) return !1;
|
|
104
104
|
let t = [];
|
|
105
105
|
const n = (128 + w(r, A)).toString(16);
|
|
106
|
-
switch (w(r,
|
|
106
|
+
switch (w(r, v)) {
|
|
107
107
|
case "boardroid":
|
|
108
108
|
t = ["2", "D8", "dc"];
|
|
109
109
|
break;
|
|
@@ -111,14 +111,14 @@ const r = class r {
|
|
|
111
111
|
t = ["2", n, "50", "4F"];
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
-
a(u = r,
|
|
114
|
+
a(u = r, s, o).call(u, t);
|
|
115
115
|
}
|
|
116
116
|
static doorClosed(e = null) {
|
|
117
|
-
var
|
|
118
|
-
if (!a(
|
|
117
|
+
var i, u;
|
|
118
|
+
if (!a(i = r, s, c).call(i, e) || !a(this, s, I).call(this)) return !1;
|
|
119
119
|
let t = [];
|
|
120
120
|
const n = (128 + w(r, A)).toString(16);
|
|
121
|
-
switch (w(r,
|
|
121
|
+
switch (w(r, v)) {
|
|
122
122
|
case "boardroid":
|
|
123
123
|
t = ["2", "D8", "db"];
|
|
124
124
|
break;
|
|
@@ -126,38 +126,38 @@ const r = class r {
|
|
|
126
126
|
t = ["2", n, "50", "43"];
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
|
-
a(u = r,
|
|
129
|
+
a(u = r, s, o).call(u, t);
|
|
130
130
|
}
|
|
131
131
|
static channelDisconnected(e = null) {
|
|
132
|
-
var n,
|
|
133
|
-
if (!a(n = r,
|
|
132
|
+
var n, i, u;
|
|
133
|
+
if (!a(n = r, s, c).call(n, e) || !a(i = r, s, d).call(i)) return !1;
|
|
134
134
|
const t = (128 + w(r, A)).toString(16);
|
|
135
|
-
a(u = r,
|
|
135
|
+
a(u = r, s, o).call(u, ["2", t, "43", "43", "43", "FD"]);
|
|
136
136
|
}
|
|
137
137
|
static channelConnected(e = null) {
|
|
138
|
-
var n,
|
|
139
|
-
if (!a(n = r,
|
|
138
|
+
var n, i, u;
|
|
139
|
+
if (!a(n = r, s, c).call(n, e) || !a(i = r, s, d).call(i)) return !1;
|
|
140
140
|
const t = (128 + w(r, A)).toString(16);
|
|
141
|
-
a(u = r,
|
|
141
|
+
a(u = r, s, o).call(u, ["2", t, "43", "43", "43", "FC"]);
|
|
142
142
|
}
|
|
143
143
|
static channelEmpty(e = null) {
|
|
144
|
-
var n,
|
|
145
|
-
if (!a(n = r,
|
|
144
|
+
var n, i, u;
|
|
145
|
+
if (!a(n = r, s, c).call(n, e) || !a(i = r, s, d).call(i)) return !1;
|
|
146
146
|
const t = (128 + w(r, A)).toString(16);
|
|
147
|
-
a(u = r,
|
|
147
|
+
a(u = r, s, o).call(u, ["2", t, "43", "43", "43", "FF"]);
|
|
148
148
|
}
|
|
149
149
|
static workingTemperature(e = null) {
|
|
150
|
-
var n,
|
|
151
|
-
if (!a(n = r,
|
|
150
|
+
var n, i, u;
|
|
151
|
+
if (!a(n = r, s, c).call(n, e) || !a(i = r, s, d).call(i)) return !1;
|
|
152
152
|
const t = (128 + w(r, A)).toString(16);
|
|
153
|
-
a(u = r,
|
|
153
|
+
a(u = r, s, o).call(u, ["2", t, "43", "54", "16"]);
|
|
154
154
|
}
|
|
155
155
|
static currentTemperature(e = null) {
|
|
156
|
-
var
|
|
157
|
-
if (!a(
|
|
156
|
+
var i, u, g;
|
|
157
|
+
if (!a(i = r, s, c).call(i, e) || !a(u = r, s, I).call(u)) return !1;
|
|
158
158
|
let t = [];
|
|
159
159
|
const n = (128 + w(r, A)).toString(16);
|
|
160
|
-
switch (w(r,
|
|
160
|
+
switch (w(r, v)) {
|
|
161
161
|
case "boardroid":
|
|
162
162
|
t = ["2", "D9", "44", "30"];
|
|
163
163
|
break;
|
|
@@ -165,217 +165,217 @@ const r = class r {
|
|
|
165
165
|
t = ["2", n, "43", "74", "2B", "30", "39", "2E", "31", "7F", "43"];
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
|
-
a(g = r,
|
|
168
|
+
a(g = r, s, o).call(g, t);
|
|
169
169
|
}
|
|
170
170
|
static ready(e = null) {
|
|
171
|
-
var t, n,
|
|
172
|
-
if (!a(t = r,
|
|
173
|
-
a(
|
|
171
|
+
var t, n, i;
|
|
172
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
173
|
+
a(i = r, s, o).call(i, ["6", "30"]);
|
|
174
174
|
}
|
|
175
175
|
static busy(e = null) {
|
|
176
|
-
var t, n,
|
|
177
|
-
if (!a(t = r,
|
|
178
|
-
a(
|
|
176
|
+
var t, n, i;
|
|
177
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
178
|
+
a(i = r, s, o).call(i, ["6", "31"]);
|
|
179
179
|
}
|
|
180
180
|
static invalidTray(e = null) {
|
|
181
|
-
var t, n,
|
|
182
|
-
if (!a(t = r,
|
|
183
|
-
a(
|
|
181
|
+
var t, n, i;
|
|
182
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
183
|
+
a(i = r, s, o).call(i, ["6", "32"]);
|
|
184
184
|
}
|
|
185
185
|
static invalidChannel(e = null) {
|
|
186
|
-
var t, n,
|
|
187
|
-
if (!a(t = r,
|
|
188
|
-
a(
|
|
186
|
+
var t, n, i;
|
|
187
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
188
|
+
a(i = r, s, o).call(i, ["6", "33"]);
|
|
189
189
|
}
|
|
190
190
|
static emptyChannel(e = null) {
|
|
191
|
-
var t, n,
|
|
192
|
-
if (!a(t = r,
|
|
193
|
-
a(
|
|
191
|
+
var t, n, i;
|
|
192
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
193
|
+
a(i = r, s, o).call(i, ["6", "34"]);
|
|
194
194
|
}
|
|
195
195
|
static elevatorJam(e = null) {
|
|
196
|
-
var t, n,
|
|
197
|
-
if (!a(t = r,
|
|
198
|
-
a(
|
|
196
|
+
var t, n, i;
|
|
197
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
198
|
+
a(i = r, s, o).call(i, ["6", "35"]);
|
|
199
199
|
}
|
|
200
200
|
static elevatorMalfunction(e = null) {
|
|
201
|
-
var t, n,
|
|
202
|
-
if (!a(t = r,
|
|
203
|
-
a(
|
|
201
|
+
var t, n, i;
|
|
202
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
203
|
+
a(i = r, s, o).call(i, ["6", "36"]);
|
|
204
204
|
}
|
|
205
205
|
static phototransistorFailure(e = null) {
|
|
206
|
-
var t, n,
|
|
207
|
-
if (!a(t = r,
|
|
208
|
-
a(
|
|
206
|
+
var t, n, i;
|
|
207
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
208
|
+
a(i = r, s, o).call(i, ["6", "37"]);
|
|
209
209
|
}
|
|
210
210
|
static allChannelsEmpty(e = null) {
|
|
211
|
-
var t, n,
|
|
212
|
-
if (!a(t = r,
|
|
213
|
-
a(
|
|
211
|
+
var t, n, i;
|
|
212
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
213
|
+
a(i = r, s, o).call(i, ["6", "38"]);
|
|
214
214
|
}
|
|
215
215
|
static productDetectorFailure(e = null) {
|
|
216
|
-
var t, n,
|
|
217
|
-
if (!a(t = r,
|
|
218
|
-
a(
|
|
216
|
+
var t, n, i;
|
|
217
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
218
|
+
a(i = r, s, o).call(i, ["6", "39"]);
|
|
219
219
|
}
|
|
220
220
|
static displayDisconnected(e = null) {
|
|
221
|
-
var t, n,
|
|
222
|
-
if (!a(t = r,
|
|
223
|
-
a(
|
|
221
|
+
var t, n, i;
|
|
222
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
223
|
+
a(i = r, s, o).call(i, ["6", "41"]);
|
|
224
224
|
}
|
|
225
225
|
static productUnderElevator(e = null) {
|
|
226
|
-
var t, n,
|
|
227
|
-
if (!a(t = r,
|
|
228
|
-
a(
|
|
226
|
+
var t, n, i;
|
|
227
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
228
|
+
a(i = r, s, o).call(i, ["6", "42"]);
|
|
229
229
|
}
|
|
230
230
|
static elevatorSettingAlarm(e = null) {
|
|
231
|
-
var t, n,
|
|
232
|
-
if (!a(t = r,
|
|
233
|
-
a(
|
|
231
|
+
var t, n, i;
|
|
232
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
233
|
+
a(i = r, s, o).call(i, ["6", "43"]);
|
|
234
234
|
}
|
|
235
235
|
static buttonPanelFailure(e = null) {
|
|
236
|
-
var t, n,
|
|
237
|
-
if (!a(t = r,
|
|
238
|
-
a(
|
|
236
|
+
var t, n, i;
|
|
237
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
238
|
+
a(i = r, s, o).call(i, ["6", "44"]);
|
|
239
239
|
}
|
|
240
240
|
static errorWritingEeprom(e = null) {
|
|
241
|
-
var t, n,
|
|
242
|
-
if (!a(t = r,
|
|
243
|
-
a(
|
|
241
|
+
var t, n, i;
|
|
242
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
243
|
+
a(i = r, s, o).call(i, ["6", "45"]);
|
|
244
244
|
}
|
|
245
245
|
static errorControlTemperature(e = null) {
|
|
246
|
-
var t, n,
|
|
247
|
-
if (!a(t = r,
|
|
248
|
-
a(
|
|
246
|
+
var t, n, i;
|
|
247
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
248
|
+
a(i = r, s, o).call(i, ["6", "46"]);
|
|
249
249
|
}
|
|
250
250
|
static thermometerDisconnected(e = null) {
|
|
251
|
-
var t, n,
|
|
252
|
-
if (!a(t = r,
|
|
253
|
-
a(
|
|
251
|
+
var t, n, i;
|
|
252
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
253
|
+
a(i = r, s, o).call(i, ["6", "47"]);
|
|
254
254
|
}
|
|
255
255
|
static thermometerMisconfigured(e = null) {
|
|
256
|
-
var t, n,
|
|
257
|
-
if (!a(t = r,
|
|
258
|
-
a(
|
|
256
|
+
var t, n, i;
|
|
257
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
258
|
+
a(i = r, s, o).call(i, ["6", "48"]);
|
|
259
259
|
}
|
|
260
260
|
static thermometerFailure(e = null) {
|
|
261
|
-
var t, n,
|
|
262
|
-
if (!a(t = r,
|
|
263
|
-
a(
|
|
261
|
+
var t, n, i;
|
|
262
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
263
|
+
a(i = r, s, o).call(i, ["6", "49"]);
|
|
264
264
|
}
|
|
265
265
|
static errorExtractorConsumption(e = null) {
|
|
266
|
-
var t, n,
|
|
267
|
-
if (!a(t = r,
|
|
268
|
-
a(
|
|
266
|
+
var t, n, i;
|
|
267
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
268
|
+
a(i = r, s, o).call(i, ["6", "4A"]);
|
|
269
269
|
}
|
|
270
270
|
static channelSearchError(e = null) {
|
|
271
|
-
var t, n,
|
|
272
|
-
if (!a(t = r,
|
|
273
|
-
a(
|
|
271
|
+
var t, n, i;
|
|
272
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
273
|
+
a(i = r, s, o).call(i, ["6", "4B"]);
|
|
274
274
|
}
|
|
275
275
|
static productExitMouthSearchError(e = null) {
|
|
276
|
-
var t, n,
|
|
277
|
-
if (!a(t = r,
|
|
278
|
-
a(
|
|
276
|
+
var t, n, i;
|
|
277
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
278
|
+
a(i = r, s, o).call(i, ["6", "4C"]);
|
|
279
279
|
}
|
|
280
280
|
static elevatorInteriorLocked(e = null) {
|
|
281
|
-
var t, n,
|
|
282
|
-
if (!a(t = r,
|
|
283
|
-
a(
|
|
281
|
+
var t, n, i;
|
|
282
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
283
|
+
a(i = r, s, o).call(i, ["6", "4D"]);
|
|
284
284
|
}
|
|
285
285
|
static productDetectorVerifierError(e = null) {
|
|
286
|
-
var t, n,
|
|
287
|
-
if (!a(t = r,
|
|
288
|
-
a(
|
|
286
|
+
var t, n, i;
|
|
287
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
288
|
+
a(i = r, s, o).call(i, ["6", "4E"]);
|
|
289
289
|
}
|
|
290
290
|
static waitingForProductRecall(e = null) {
|
|
291
|
-
var t, n,
|
|
292
|
-
if (!a(t = r,
|
|
293
|
-
a(
|
|
291
|
+
var t, n, i;
|
|
292
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
293
|
+
a(i = r, s, o).call(i, ["6", "4F"]);
|
|
294
294
|
}
|
|
295
295
|
static productExpiredByTemperature(e = null) {
|
|
296
|
-
var t, n,
|
|
297
|
-
if (!a(t = r,
|
|
298
|
-
a(
|
|
296
|
+
var t, n, i;
|
|
297
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
298
|
+
a(i = r, s, o).call(i, ["6", "50"]);
|
|
299
299
|
}
|
|
300
300
|
static faultyAutomaticDoor(e = null) {
|
|
301
|
-
var t, n,
|
|
302
|
-
if (!a(t = r,
|
|
303
|
-
a(
|
|
301
|
+
var t, n, i;
|
|
302
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
303
|
+
a(i = r, s, o).call(i, ["6", "51"]);
|
|
304
304
|
}
|
|
305
305
|
static rejectLever(e = null) {
|
|
306
|
-
var t, n,
|
|
307
|
-
if (!a(t = r,
|
|
308
|
-
a(
|
|
306
|
+
var t, n, i;
|
|
307
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
308
|
+
a(i = r, s, o).call(i, ["2", "A0", "1"]);
|
|
309
309
|
}
|
|
310
310
|
static resetCoinPurse(e = null) {
|
|
311
|
-
var t, n,
|
|
312
|
-
if (!a(t = r,
|
|
313
|
-
a(
|
|
311
|
+
var t, n, i;
|
|
312
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
313
|
+
a(i = r, s, o).call(i, ["2", "A0", "2"]);
|
|
314
314
|
}
|
|
315
315
|
static coinInsertedBox(e = null, t = null) {
|
|
316
316
|
var u, g, f, h;
|
|
317
|
-
if (!a(u = r,
|
|
318
|
-
const n = ["40", "41", "42", "43", "44", "45"],
|
|
319
|
-
a(h = r,
|
|
317
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
318
|
+
const n = ["40", "41", "42", "43", "44", "45"], i = a(f = r, s, $).call(f, n, t);
|
|
319
|
+
a(h = r, s, o).call(h, ["2", "A0", i]);
|
|
320
320
|
}
|
|
321
321
|
static coinInsertedTube(e = null, t = null) {
|
|
322
322
|
var u, g, f, h;
|
|
323
|
-
if (!a(u = r,
|
|
324
|
-
const n = ["50", "51", "52", "53", "54", "55"],
|
|
325
|
-
a(h = r,
|
|
323
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
324
|
+
const n = ["50", "51", "52", "53", "54", "55"], i = a(f = r, s, $).call(f, n, t);
|
|
325
|
+
a(h = r, s, o).call(h, ["2", "A0", i]);
|
|
326
326
|
}
|
|
327
327
|
static banknoteInsertedStacker(e = null, t = null) {
|
|
328
328
|
var u, g, f, h;
|
|
329
|
-
if (!a(u = r,
|
|
330
|
-
const n = ["80", "81", "82", "83", "84"],
|
|
331
|
-
a(h = r,
|
|
329
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
330
|
+
const n = ["80", "81", "82", "83", "84"], i = a(f = r, s, T).call(f, n, t);
|
|
331
|
+
a(h = r, s, o).call(h, ["2", "B0", i]);
|
|
332
332
|
}
|
|
333
333
|
static banknoteInsertedEscrow(e = null, t = null) {
|
|
334
334
|
var u, g, f, h;
|
|
335
|
-
if (!a(u = r,
|
|
336
|
-
const n = ["90", "91", "92", "93", "94"],
|
|
337
|
-
a(h = r,
|
|
335
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
336
|
+
const n = ["90", "91", "92", "93", "94"], i = a(f = r, s, T).call(f, n, t);
|
|
337
|
+
a(h = r, s, o).call(h, ["2", "B0", i]);
|
|
338
338
|
}
|
|
339
339
|
static banknoteEjected(e = null, t = null) {
|
|
340
340
|
var u, g, f, h;
|
|
341
|
-
if (!a(u = r,
|
|
342
|
-
const n = ["A0", "A1", "A2", "A3", "A4"],
|
|
343
|
-
a(h = r,
|
|
341
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
342
|
+
const n = ["A0", "A1", "A2", "A3", "A4"], i = a(f = r, s, T).call(f, n, t);
|
|
343
|
+
a(h = r, s, o).call(h, ["2", "B0", i]);
|
|
344
344
|
}
|
|
345
345
|
static banknoteInsertedRecycler(e = null, t = null) {
|
|
346
346
|
var u, g, f, h;
|
|
347
|
-
if (!a(u = r,
|
|
348
|
-
const n = ["B0", "B1", "B2", "B3", "B4"],
|
|
349
|
-
a(h = r,
|
|
347
|
+
if (!a(u = r, s, c).call(u, e) || !a(g = r, s, p).call(g)) return !1;
|
|
348
|
+
const n = ["B0", "B1", "B2", "B3", "B4"], i = a(f = r, s, T).call(f, n, t);
|
|
349
|
+
a(h = r, s, o).call(h, ["2", "B0", i]);
|
|
350
350
|
}
|
|
351
351
|
static banknoteTaken(e = null) {
|
|
352
|
-
var t, n,
|
|
353
|
-
if (!a(t = r,
|
|
354
|
-
a(
|
|
352
|
+
var t, n, i;
|
|
353
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
354
|
+
a(i = r, s, o).call(i, ["2", "B0", "2a"]);
|
|
355
355
|
}
|
|
356
356
|
static coinPurseEnabled(e = null) {
|
|
357
|
-
var t, n,
|
|
358
|
-
if (!a(t = r,
|
|
359
|
-
a(
|
|
357
|
+
var t, n, i;
|
|
358
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
359
|
+
a(i = r, s, o).call(i, ["2", "D0", "1"]);
|
|
360
360
|
}
|
|
361
361
|
static coinPurseDisabled(e = null) {
|
|
362
|
-
var t, n,
|
|
363
|
-
if (!a(t = r,
|
|
364
|
-
a(
|
|
362
|
+
var t, n, i;
|
|
363
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
364
|
+
a(i = r, s, o).call(i, ["2", "D0", "0"]);
|
|
365
365
|
}
|
|
366
366
|
static billPurseDisabled(e = null) {
|
|
367
|
-
var t, n,
|
|
368
|
-
if (!a(t = r,
|
|
369
|
-
a(
|
|
367
|
+
var t, n, i;
|
|
368
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
369
|
+
a(i = r, s, o).call(i, ["2", "D1", "0", "0"]);
|
|
370
370
|
}
|
|
371
371
|
static billPurseEnabled(e = null) {
|
|
372
|
-
var t, n,
|
|
373
|
-
if (!a(t = r,
|
|
374
|
-
a(
|
|
372
|
+
var t, n, i;
|
|
373
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
374
|
+
a(i = r, s, o).call(i, ["2", "D1", "1", "1"]);
|
|
375
375
|
}
|
|
376
376
|
static readTubes(e = null) {
|
|
377
|
-
var C, D
|
|
378
|
-
if (!a(
|
|
377
|
+
var k, C, D;
|
|
378
|
+
if (!a(k = r, s, c).call(k, e) || !a(C = r, s, p).call(C)) return !1;
|
|
379
379
|
const t = [
|
|
380
380
|
"0",
|
|
381
381
|
"1",
|
|
@@ -409,7 +409,7 @@ const r = class r {
|
|
|
409
409
|
"1d",
|
|
410
410
|
"1e",
|
|
411
411
|
"1f"
|
|
412
|
-
], [n,
|
|
412
|
+
], [n, i, u, g, f, h] = [
|
|
413
413
|
t[Math.floor(Math.random() * 30)],
|
|
414
414
|
t[Math.floor(Math.random() * 30)],
|
|
415
415
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -417,11 +417,11 @@ const r = class r {
|
|
|
417
417
|
t[Math.floor(Math.random() * 30)],
|
|
418
418
|
t[Math.floor(Math.random() * 30)]
|
|
419
419
|
];
|
|
420
|
-
a(
|
|
420
|
+
a(D = r, s, o).call(D, ["2", "D2", n, i, u, g, f, h]);
|
|
421
421
|
}
|
|
422
422
|
static readBillPurse(e = null, t = null) {
|
|
423
|
-
var
|
|
424
|
-
if (!a(
|
|
423
|
+
var i, u, g, f;
|
|
424
|
+
if (!a(i = r, s, c).call(i, e) || !a(u = r, s, p).call(u)) return !1;
|
|
425
425
|
let n = [
|
|
426
426
|
"0",
|
|
427
427
|
"1",
|
|
@@ -455,46 +455,46 @@ const r = class r {
|
|
|
455
455
|
];
|
|
456
456
|
if (e._recycler.ict) {
|
|
457
457
|
const h = n[Math.floor(Math.random() * 31)];
|
|
458
|
-
let
|
|
458
|
+
let k = "0", C = "0", D = "0", S = "0", M = "0";
|
|
459
459
|
if (t !== null && !isNaN(parseInt(t)))
|
|
460
460
|
switch (t.toString()) {
|
|
461
461
|
case "20":
|
|
462
|
-
|
|
462
|
+
k = h;
|
|
463
463
|
break;
|
|
464
464
|
case "50":
|
|
465
|
-
|
|
465
|
+
C = h;
|
|
466
466
|
break;
|
|
467
467
|
case "100":
|
|
468
|
-
|
|
468
|
+
D = h;
|
|
469
469
|
break;
|
|
470
470
|
case "200":
|
|
471
|
-
|
|
471
|
+
S = h;
|
|
472
472
|
break;
|
|
473
473
|
case "500":
|
|
474
|
-
|
|
474
|
+
M = h;
|
|
475
475
|
break;
|
|
476
476
|
}
|
|
477
477
|
else
|
|
478
478
|
switch (e._recycler.bill) {
|
|
479
479
|
case 0:
|
|
480
|
-
|
|
480
|
+
k = h;
|
|
481
481
|
break;
|
|
482
482
|
case 1:
|
|
483
|
-
|
|
483
|
+
C = h;
|
|
484
484
|
break;
|
|
485
485
|
case 2:
|
|
486
|
-
|
|
486
|
+
D = h;
|
|
487
487
|
break;
|
|
488
488
|
case 3:
|
|
489
|
-
|
|
489
|
+
S = h;
|
|
490
490
|
break;
|
|
491
491
|
case 4:
|
|
492
|
-
|
|
492
|
+
M = h;
|
|
493
493
|
break;
|
|
494
494
|
}
|
|
495
|
-
a(g = r,
|
|
495
|
+
a(g = r, s, o).call(g, ["2", "D3", k, C, D, S, M, "0"]);
|
|
496
496
|
} else {
|
|
497
|
-
const [h, C, D, S,
|
|
497
|
+
const [h, k, C, D, S, M] = [
|
|
498
498
|
n[Math.floor(Math.random() * 30)],
|
|
499
499
|
n[Math.floor(Math.random() * 30)],
|
|
500
500
|
n[Math.floor(Math.random() * 30)],
|
|
@@ -502,22 +502,22 @@ const r = class r {
|
|
|
502
502
|
n[Math.floor(Math.random())],
|
|
503
503
|
n[Math.floor(Math.random())]
|
|
504
504
|
];
|
|
505
|
-
a(f = r,
|
|
505
|
+
a(f = r, s, o).call(f, ["2", "D3", h, k, C, D, S, M]);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
static banknoteAccepted(e = null) {
|
|
509
|
-
var t, n,
|
|
510
|
-
if (!a(t = r,
|
|
511
|
-
a(
|
|
509
|
+
var t, n, i;
|
|
510
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
511
|
+
a(i = r, s, o).call(i, ["2", "D4", "1"]);
|
|
512
512
|
}
|
|
513
513
|
static banknoteRejected(e = null) {
|
|
514
|
-
var t, n,
|
|
515
|
-
if (!a(t = r,
|
|
516
|
-
a(
|
|
514
|
+
var t, n, i;
|
|
515
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
516
|
+
a(i = r, s, o).call(i, ["2", "D4", "0"]);
|
|
517
517
|
}
|
|
518
518
|
static banknotesDispensed(e = null) {
|
|
519
|
-
var n,
|
|
520
|
-
if (!a(n = r,
|
|
519
|
+
var n, i, u, g;
|
|
520
|
+
if (!a(n = r, s, c).call(n, e) || !a(i = r, s, p).call(i)) return !1;
|
|
521
521
|
let t = [
|
|
522
522
|
"1",
|
|
523
523
|
"2",
|
|
@@ -550,27 +550,27 @@ const r = class r {
|
|
|
550
550
|
];
|
|
551
551
|
if (e._recycler.ict) {
|
|
552
552
|
const f = t[Math.floor(Math.random() * 30)];
|
|
553
|
-
let h = "0",
|
|
553
|
+
let h = "0", k = "0", C = "0", D = "0", S = "0";
|
|
554
554
|
switch (e._recycler.bill) {
|
|
555
555
|
case 0:
|
|
556
556
|
h = f;
|
|
557
557
|
break;
|
|
558
558
|
case 1:
|
|
559
|
-
|
|
559
|
+
k = f;
|
|
560
560
|
break;
|
|
561
561
|
case 2:
|
|
562
|
-
|
|
562
|
+
C = f;
|
|
563
563
|
break;
|
|
564
564
|
case 3:
|
|
565
|
-
|
|
565
|
+
D = f;
|
|
566
566
|
break;
|
|
567
567
|
case 4:
|
|
568
|
-
|
|
568
|
+
S = f;
|
|
569
569
|
break;
|
|
570
570
|
}
|
|
571
|
-
a(u = r,
|
|
571
|
+
a(u = r, s, o).call(u, ["2", "D5", h, k, C, D, S, "0"]);
|
|
572
572
|
} else {
|
|
573
|
-
const [f, h, C, D, S
|
|
573
|
+
const [f, h, k, C, D, S] = [
|
|
574
574
|
t[Math.floor(Math.random() * 30)],
|
|
575
575
|
t[Math.floor(Math.random() * 30)],
|
|
576
576
|
t[Math.floor(Math.random() * 30)],
|
|
@@ -578,111 +578,111 @@ const r = class r {
|
|
|
578
578
|
t[Math.floor(Math.random())],
|
|
579
579
|
t[Math.floor(Math.random())]
|
|
580
580
|
];
|
|
581
|
-
a(g = r,
|
|
581
|
+
a(g = r, s, o).call(g, ["2", "D5", f, h, k, C, D, S]);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
static coinsDispensed(e = null) {
|
|
585
|
-
var t, n,
|
|
586
|
-
if (!a(t = r,
|
|
587
|
-
a(
|
|
585
|
+
var t, n, i;
|
|
586
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
587
|
+
a(i = r, s, o).call(i, ["2", "D6"]);
|
|
588
588
|
}
|
|
589
589
|
static relayOn(e = null) {
|
|
590
|
-
var t, n,
|
|
591
|
-
if (!a(t = r,
|
|
592
|
-
a(
|
|
590
|
+
var t, n, i;
|
|
591
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
592
|
+
a(i = r, s, o).call(i, ["2", "DA", "1"]);
|
|
593
593
|
}
|
|
594
594
|
static relayOff(e = null) {
|
|
595
|
-
var t, n,
|
|
596
|
-
if (!a(t = r,
|
|
597
|
-
a(
|
|
595
|
+
var t, n, i;
|
|
596
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
597
|
+
a(i = r, s, o).call(i, ["2", "DA", "0"]);
|
|
598
598
|
}
|
|
599
599
|
static nayaxEnabled(e = null) {
|
|
600
|
-
var t, n,
|
|
601
|
-
if (!a(t = r,
|
|
602
|
-
a(
|
|
600
|
+
var t, n, i;
|
|
601
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
602
|
+
a(i = r, s, o).call(i, ["2", "DD", "1"]);
|
|
603
603
|
}
|
|
604
604
|
static nayaxDisabled(e = null) {
|
|
605
|
-
var t, n,
|
|
606
|
-
if (!a(t = r,
|
|
607
|
-
a(
|
|
605
|
+
var t, n, i;
|
|
606
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
607
|
+
a(i = r, s, o).call(i, ["2", "DD", "0"]);
|
|
608
608
|
}
|
|
609
609
|
static nayaxPreCreditAuthorized(e = null) {
|
|
610
|
-
var t, n,
|
|
611
|
-
if (!a(t = r,
|
|
612
|
-
a(
|
|
610
|
+
var t, n, i;
|
|
611
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
612
|
+
a(i = r, s, o).call(i, ["2", "DD", "3"]);
|
|
613
613
|
}
|
|
614
614
|
static nayaxCancelRequest(e = null) {
|
|
615
|
-
var t, n,
|
|
616
|
-
if (!a(t = r,
|
|
617
|
-
a(
|
|
615
|
+
var t, n, i;
|
|
616
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
617
|
+
a(i = r, s, o).call(i, ["2", "DD", "4"]);
|
|
618
618
|
}
|
|
619
619
|
static nayaxSellApproved(e = null) {
|
|
620
|
-
var t, n,
|
|
621
|
-
if (!a(t = r,
|
|
622
|
-
a(
|
|
620
|
+
var t, n, i;
|
|
621
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
622
|
+
a(i = r, s, o).call(i, ["2", "DD", "5"]);
|
|
623
623
|
}
|
|
624
624
|
static nayaxSellDenied(e = null) {
|
|
625
|
-
var t, n,
|
|
626
|
-
if (!a(t = r,
|
|
627
|
-
a(
|
|
625
|
+
var t, n, i;
|
|
626
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
627
|
+
a(i = r, s, o).call(i, ["2", "DD", "6"]);
|
|
628
628
|
}
|
|
629
629
|
static nayaxEndSession(e = null) {
|
|
630
|
-
var t, n,
|
|
631
|
-
if (!a(t = r,
|
|
632
|
-
a(
|
|
630
|
+
var t, n, i;
|
|
631
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
632
|
+
a(i = r, s, o).call(i, ["2", "DD", "7"]);
|
|
633
633
|
}
|
|
634
634
|
static nayaxCancelled(e = null) {
|
|
635
|
-
var t, n,
|
|
636
|
-
if (!a(t = r,
|
|
637
|
-
a(
|
|
635
|
+
var t, n, i;
|
|
636
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
637
|
+
a(i = r, s, o).call(i, ["2", "DD", "8"]);
|
|
638
638
|
}
|
|
639
639
|
static nayaxDispensed(e = null) {
|
|
640
|
-
var t, n,
|
|
641
|
-
if (!a(t = r,
|
|
642
|
-
a(
|
|
640
|
+
var t, n, i;
|
|
641
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
642
|
+
a(i = r, s, o).call(i, ["2", "DD", "A", "0"]);
|
|
643
643
|
}
|
|
644
644
|
static nayaxNotDispensed(e = null) {
|
|
645
|
-
var t, n,
|
|
646
|
-
if (!a(t = r,
|
|
647
|
-
a(
|
|
645
|
+
var t, n, i;
|
|
646
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, p).call(n)) return !1;
|
|
647
|
+
a(i = r, s, o).call(i, ["2", "DD", "A", "1"]);
|
|
648
648
|
}
|
|
649
649
|
static fullTray(e = null) {
|
|
650
|
-
var t, n,
|
|
651
|
-
if (!a(t = r,
|
|
652
|
-
a(
|
|
650
|
+
var t, n, i;
|
|
651
|
+
if (!a(t = r, s, c).call(t, e) || !a(n = r, s, d).call(n)) return !1;
|
|
652
|
+
a(i = r, s, o).call(i, ["6", "4F"]);
|
|
653
653
|
}
|
|
654
654
|
static setConnection(e = null) {
|
|
655
655
|
var t;
|
|
656
|
-
if (!a(t = r,
|
|
656
|
+
if (!a(t = r, s, c).call(t, e)) return !1;
|
|
657
657
|
e.__internal__.serial.connected = !0;
|
|
658
658
|
}
|
|
659
659
|
};
|
|
660
|
-
|
|
660
|
+
v = new WeakMap(), A = new WeakMap(), s = new WeakSet(), Y = function() {
|
|
661
661
|
if (r.enable === !1) throw new Error("Emulator is disabled");
|
|
662
662
|
return r.enable;
|
|
663
|
-
},
|
|
664
|
-
if (typeof e != "object" || !(e instanceof
|
|
663
|
+
}, Z = function(e) {
|
|
664
|
+
if (typeof e != "object" || !(e instanceof me))
|
|
665
665
|
throw new Error(`Type ${e.typeDevice} is not supported`);
|
|
666
|
-
return r.instance = e,
|
|
666
|
+
return r.instance = e, j(r, v, e.typeDevice), j(r, A, e.deviceNumber), !0;
|
|
667
667
|
}, c = function(e = null) {
|
|
668
668
|
var t, n;
|
|
669
|
-
return !a(t = r,
|
|
670
|
-
},
|
|
671
|
-
if (w(r,
|
|
669
|
+
return !a(t = r, s, Y).call(t) || e === null && r.instance === null ? !1 : (r.instance === null && a(n = r, s, Z).call(n, e), !0);
|
|
670
|
+
}, O = function() {
|
|
671
|
+
if (w(r, v) !== "locker") throw new Error("This function is only available for Locker devices");
|
|
672
672
|
return !0;
|
|
673
673
|
}, p = function() {
|
|
674
|
-
if (w(r,
|
|
674
|
+
if (w(r, v) !== "boardroid")
|
|
675
675
|
throw new Error("This function is only available for Boardroid devices");
|
|
676
676
|
return !0;
|
|
677
677
|
}, d = function() {
|
|
678
|
-
if (w(r,
|
|
678
|
+
if (w(r, v) !== "jofemar") throw new Error("This function is only available for Jofemar devices");
|
|
679
679
|
return !0;
|
|
680
|
-
},
|
|
681
|
-
if (w(r,
|
|
680
|
+
}, I = function() {
|
|
681
|
+
if (w(r, v) === "locker") throw new Error("This function is not available for Locker devices");
|
|
682
682
|
return !0;
|
|
683
683
|
}, o = function(e) {
|
|
684
684
|
r.instance.__emulate({ code: e });
|
|
685
|
-
},
|
|
685
|
+
}, $ = function(e, t = null) {
|
|
686
686
|
let n = e[Math.floor(Math.random() * 5)];
|
|
687
687
|
if (t !== null && !isNaN(parseFloat(t)))
|
|
688
688
|
switch (t.toString()) {
|
|
@@ -703,7 +703,7 @@ k = new WeakMap(), A = new WeakMap(), i = new WeakSet(), te = function() {
|
|
|
703
703
|
break;
|
|
704
704
|
}
|
|
705
705
|
return n;
|
|
706
|
-
},
|
|
706
|
+
}, T = function(e, t = null) {
|
|
707
707
|
let n = e[Math.floor(Math.random() * 4)];
|
|
708
708
|
if (t !== null && !isNaN(parseFloat(t)))
|
|
709
709
|
switch (t.toString()) {
|
|
@@ -724,57 +724,30 @@ k = new WeakMap(), A = new WeakMap(), i = new WeakSet(), te = function() {
|
|
|
724
724
|
break;
|
|
725
725
|
}
|
|
726
726
|
return n;
|
|
727
|
-
},
|
|
728
|
-
let
|
|
729
|
-
var
|
|
727
|
+
}, U(r, s), N(r, "enable", !1), N(r, "instance", null), U(r, v, null), U(r, A, 1);
|
|
728
|
+
let L = r;
|
|
729
|
+
var he = Object.defineProperty, ee = (l) => {
|
|
730
730
|
throw TypeError(l);
|
|
731
|
-
},
|
|
732
|
-
|
|
733
|
-
for (let l = 0; l < 256; ++l)
|
|
734
|
-
v.push((l + 256).toString(16).slice(1));
|
|
735
|
-
function ye(l, e = 0) {
|
|
736
|
-
return (v[l[e + 0]] + v[l[e + 1]] + v[l[e + 2]] + v[l[e + 3]] + "-" + v[l[e + 4]] + v[l[e + 5]] + "-" + v[l[e + 6]] + v[l[e + 7]] + "-" + v[l[e + 8]] + v[l[e + 9]] + "-" + v[l[e + 10]] + v[l[e + 11]] + v[l[e + 12]] + v[l[e + 13]] + v[l[e + 14]] + v[l[e + 15]]).toLowerCase();
|
|
737
|
-
}
|
|
738
|
-
let O;
|
|
739
|
-
const we = new Uint8Array(16);
|
|
740
|
-
function ve() {
|
|
741
|
-
if (!O) {
|
|
742
|
-
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
743
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
744
|
-
O = crypto.getRandomValues.bind(crypto);
|
|
745
|
-
}
|
|
746
|
-
return O(we);
|
|
747
|
-
}
|
|
748
|
-
const ke = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), J = { randomUUID: ke };
|
|
749
|
-
function Ce(l, e, t) {
|
|
750
|
-
var n;
|
|
751
|
-
if (J.randomUUID && !l)
|
|
752
|
-
return J.randomUUID();
|
|
753
|
-
l = l || {};
|
|
754
|
-
const s = l.random ?? ((n = l.rng) == null ? void 0 : n.call(l)) ?? ve();
|
|
755
|
-
if (s.length < 16)
|
|
756
|
-
throw new Error("Random bytes length must be >= 16");
|
|
757
|
-
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, ye(s);
|
|
758
|
-
}
|
|
759
|
-
class z extends CustomEvent {
|
|
731
|
+
}, de = (l, e, t) => e in l ? he(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, B = (l, e, t) => de(l, typeof e != "symbol" ? e + "" : e, t), fe = (l, e, t) => e.has(l) || ee("Cannot " + t), pe = (l, e, t) => e.has(l) ? ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t), m = (l, e, t) => (fe(l, e, "access private method"), t);
|
|
732
|
+
class Q extends CustomEvent {
|
|
760
733
|
constructor(e, t) {
|
|
761
734
|
super(e, t);
|
|
762
735
|
}
|
|
763
736
|
}
|
|
764
|
-
class
|
|
737
|
+
class te extends EventTarget {
|
|
765
738
|
constructor() {
|
|
766
739
|
super(...arguments), B(this, "__listeners__", {
|
|
767
740
|
debug: !1
|
|
768
741
|
}), B(this, "__debug__", !1);
|
|
769
742
|
}
|
|
770
743
|
dispatch(e, t = null) {
|
|
771
|
-
const n = new
|
|
772
|
-
this.dispatchEvent(n), this.__debug__ && this.dispatchEvent(new
|
|
744
|
+
const n = new Q(e, { detail: t });
|
|
745
|
+
this.dispatchEvent(n), this.__debug__ && this.dispatchEvent(new Q("debug", { detail: { type: e, data: t } }));
|
|
773
746
|
}
|
|
774
747
|
dispatchAsync(e, t = null, n = 100) {
|
|
775
|
-
const
|
|
748
|
+
const i = this;
|
|
776
749
|
setTimeout(() => {
|
|
777
|
-
|
|
750
|
+
i.dispatch(e, t);
|
|
778
751
|
}, n);
|
|
779
752
|
}
|
|
780
753
|
on(e, t) {
|
|
@@ -793,55 +766,55 @@ class se extends EventTarget {
|
|
|
793
766
|
}));
|
|
794
767
|
}
|
|
795
768
|
}
|
|
796
|
-
const
|
|
769
|
+
const R = class y extends te {
|
|
797
770
|
constructor() {
|
|
798
771
|
super(), ["change"].forEach((e) => {
|
|
799
772
|
this.serialRegisterAvailableListener(e);
|
|
800
773
|
});
|
|
801
774
|
}
|
|
802
775
|
static $dispatchChange(e = null) {
|
|
803
|
-
e && e.$checkAndDispatchConnection(),
|
|
776
|
+
e && e.$checkAndDispatchConnection(), y.instance.dispatch("change", { devices: y.devices, dispatcher: e });
|
|
804
777
|
}
|
|
805
778
|
static typeError(e) {
|
|
806
779
|
const t = new Error();
|
|
807
780
|
throw t.message = `Type ${e} is not supported`, t.name = "DeviceTypeError", t;
|
|
808
781
|
}
|
|
809
782
|
static registerType(e) {
|
|
810
|
-
typeof
|
|
783
|
+
typeof y.devices[e] > "u" && (y.devices[e] = {});
|
|
811
784
|
}
|
|
812
785
|
static add(e) {
|
|
813
786
|
const t = e.typeDevice;
|
|
814
|
-
typeof
|
|
787
|
+
typeof y.devices[t] > "u" && (y.devices[t] = {});
|
|
815
788
|
const n = e.uuid;
|
|
816
|
-
if (typeof
|
|
789
|
+
if (typeof y.devices[t] > "u" && y.typeError(t), y.devices[t][n])
|
|
817
790
|
throw new Error(`Device with id ${n} already exists`);
|
|
818
|
-
return
|
|
791
|
+
return y.devices[t][n] = e, y.$dispatchChange(e), Object.keys(y.devices[t]).indexOf(n);
|
|
819
792
|
}
|
|
820
793
|
static get(e, t) {
|
|
821
|
-
return typeof
|
|
794
|
+
return typeof y.devices[e] > "u" && (y.devices[e] = {}), typeof y.devices[e] > "u" && y.typeError(e), y.devices[e][t];
|
|
822
795
|
}
|
|
823
796
|
static getAll(e = null) {
|
|
824
|
-
return e === null ?
|
|
797
|
+
return e === null ? y.devices : (typeof y.devices[e] > "u" && y.typeError(e), y.devices[e]);
|
|
825
798
|
}
|
|
826
799
|
static getList() {
|
|
827
|
-
return Object.values(
|
|
800
|
+
return Object.values(y.devices).map((e) => Object.values(e)).flat();
|
|
828
801
|
}
|
|
829
802
|
static getByNumber(e, t) {
|
|
830
|
-
return typeof
|
|
803
|
+
return typeof y.devices[e] > "u" && y.typeError(e), Object.values(y.devices[e]).find((n) => n.deviceNumber === t) ?? null;
|
|
831
804
|
}
|
|
832
805
|
static getCustom(e, t = 1) {
|
|
833
|
-
return typeof
|
|
806
|
+
return typeof y.devices[e] > "u" && y.typeError(e), Object.values(y.devices[e]).find((n) => n.deviceNumber === t) ?? null;
|
|
834
807
|
}
|
|
835
808
|
};
|
|
836
|
-
B(
|
|
837
|
-
let _ =
|
|
809
|
+
B(R, "instance"), B(R, "devices", {});
|
|
810
|
+
let _ = R;
|
|
838
811
|
_.instance || (_.instance = new _());
|
|
839
|
-
function
|
|
812
|
+
function J(l = 100) {
|
|
840
813
|
return new Promise(
|
|
841
814
|
(e) => setTimeout(() => e(), l)
|
|
842
815
|
);
|
|
843
816
|
}
|
|
844
|
-
function
|
|
817
|
+
function ge() {
|
|
845
818
|
return "serial" in navigator;
|
|
846
819
|
}
|
|
847
820
|
const q = {
|
|
@@ -852,20 +825,20 @@ const q = {
|
|
|
852
825
|
bufferSize: 32768,
|
|
853
826
|
flowControl: "none"
|
|
854
827
|
};
|
|
855
|
-
var b,
|
|
856
|
-
class
|
|
828
|
+
var b, x, P, H, E, ne, V, z, K, re, ie, se, ae, G, X, le, oe;
|
|
829
|
+
class be extends te {
|
|
857
830
|
constructor({
|
|
858
831
|
filters: e = null,
|
|
859
832
|
config_port: t = q,
|
|
860
833
|
no_device: n = 1,
|
|
861
|
-
device_listen_on_channel:
|
|
834
|
+
device_listen_on_channel: i = 1
|
|
862
835
|
} = {
|
|
863
836
|
filters: null,
|
|
864
837
|
config_port: q,
|
|
865
838
|
no_device: 1,
|
|
866
839
|
device_listen_on_channel: 1
|
|
867
840
|
}) {
|
|
868
|
-
if (super(),
|
|
841
|
+
if (super(), pe(this, b), B(this, "__internal__", {
|
|
869
842
|
auto_response: !1,
|
|
870
843
|
device_number: 1,
|
|
871
844
|
aux_port_connector: 0,
|
|
@@ -882,7 +855,7 @@ class Se extends se {
|
|
|
882
855
|
response: {
|
|
883
856
|
length: null,
|
|
884
857
|
buffer: new Uint8Array([]),
|
|
885
|
-
as: "
|
|
858
|
+
as: "uint8",
|
|
886
859
|
replacer: /[\n\r]+/g,
|
|
887
860
|
limiter: null
|
|
888
861
|
},
|
|
@@ -902,7 +875,7 @@ class Se extends se {
|
|
|
902
875
|
},
|
|
903
876
|
device: {
|
|
904
877
|
type: "unknown",
|
|
905
|
-
id:
|
|
878
|
+
id: window.crypto.randomUUID(),
|
|
906
879
|
listen_on_port: null
|
|
907
880
|
},
|
|
908
881
|
time: {
|
|
@@ -917,7 +890,7 @@ class Se extends se {
|
|
|
917
890
|
}
|
|
918
891
|
}), !("serial" in navigator))
|
|
919
892
|
throw new Error("Web Serial not supported");
|
|
920
|
-
e && (this.serialFilters = e), t && (this.serialConfigPort = t), n &&
|
|
893
|
+
e && (this.serialFilters = e), t && (this.serialConfigPort = t), n && m(this, b, le).call(this, n), i && ["number", "string"].includes(typeof i) && (this.listenOnChannel = i), m(this, b, se).call(this), m(this, b, ae).call(this);
|
|
921
894
|
}
|
|
922
895
|
set listenOnChannel(e) {
|
|
923
896
|
if (typeof e == "string" && (e = parseInt(e)), isNaN(e) || e < 1 || e > 255)
|
|
@@ -943,11 +916,11 @@ class Se extends se {
|
|
|
943
916
|
return this.__internal__.serial.config_port;
|
|
944
917
|
}
|
|
945
918
|
get isConnected() {
|
|
946
|
-
const e = this.__internal__.serial.connected, t =
|
|
947
|
-
return e && !t &&
|
|
919
|
+
const e = this.__internal__.serial.connected, t = m(this, b, x).call(this, this.__internal__.serial.port);
|
|
920
|
+
return e && !t && m(this, b, P).call(this, { error: "Port is closed, not readable or writable." }), this.__internal__.serial.connected = t, this.__internal__.serial.connected;
|
|
948
921
|
}
|
|
949
922
|
get isDisconnected() {
|
|
950
|
-
const e = this.__internal__.serial.connected, t =
|
|
923
|
+
const e = this.__internal__.serial.connected, t = m(this, b, x).call(this, this.__internal__.serial.port);
|
|
951
924
|
return !e && t && (this.dispatch("serial:connected"), _.$dispatchChange(this)), this.__internal__.serial.connected = t, !this.__internal__.serial.connected;
|
|
952
925
|
}
|
|
953
926
|
get deviceNumber() {
|
|
@@ -970,12 +943,12 @@ class Se extends se {
|
|
|
970
943
|
});
|
|
971
944
|
}
|
|
972
945
|
async disconnect(e = null) {
|
|
973
|
-
await this.serialDisconnect(),
|
|
946
|
+
await this.serialDisconnect(), m(this, b, P).call(this, e);
|
|
974
947
|
}
|
|
975
948
|
async connect() {
|
|
976
949
|
return new Promise((e, t) => {
|
|
977
|
-
|
|
978
|
-
await
|
|
950
|
+
ge() || t("Web Serial not supported"), setTimeout(async () => {
|
|
951
|
+
await J(499), await this.serialConnect(), this.isConnected ? e(`${this.typeDevice} device ${this.deviceNumber} connected`) : t(`${this.typeDevice} device ${this.deviceNumber} not connected`);
|
|
979
952
|
}, 1);
|
|
980
953
|
});
|
|
981
954
|
}
|
|
@@ -1063,13 +1036,13 @@ class Se extends se {
|
|
|
1063
1036
|
async serialConnect() {
|
|
1064
1037
|
try {
|
|
1065
1038
|
this.dispatch("serial:connecting", {});
|
|
1066
|
-
const e = await
|
|
1039
|
+
const e = await m(this, b, ne).call(this);
|
|
1067
1040
|
if (e.length > 0)
|
|
1068
1041
|
await this.serialPortsSaved(e);
|
|
1069
1042
|
else {
|
|
1070
|
-
const
|
|
1043
|
+
const i = this.serialFilters;
|
|
1071
1044
|
this.__internal__.serial.port = await navigator.serial.requestPort({
|
|
1072
|
-
filters:
|
|
1045
|
+
filters: i
|
|
1073
1046
|
});
|
|
1074
1047
|
}
|
|
1075
1048
|
const t = this.__internal__.serial.port;
|
|
@@ -1077,22 +1050,22 @@ class Se extends se {
|
|
|
1077
1050
|
throw new Error("No port selected by the user");
|
|
1078
1051
|
await t.open(this.serialConfigPort);
|
|
1079
1052
|
const n = this;
|
|
1080
|
-
t.onconnect = (
|
|
1081
|
-
console.log(
|
|
1053
|
+
t.onconnect = (i) => {
|
|
1054
|
+
console.log(i), n.dispatch("serial:connected", i), _.$dispatchChange(this), n.__internal__.serial.queue.length > 0 && n.dispatch("internal:queue", {});
|
|
1082
1055
|
}, t.ondisconnect = async () => {
|
|
1083
1056
|
await n.disconnect();
|
|
1084
|
-
}, await
|
|
1057
|
+
}, await J(this.__internal__.serial.delay_first_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1085
1058
|
await n.timeout(n.__internal__.serial.bytes_connection ?? [], "connection:start");
|
|
1086
|
-
}, this.__internal__.time.response_connection), this.__internal__.serial.last_action = "connect", await
|
|
1059
|
+
}, this.__internal__.time.response_connection), this.__internal__.serial.last_action = "connect", await m(this, b, H).call(this, this.__internal__.serial.bytes_connection ?? []), this.dispatch("serial:sent", {
|
|
1087
1060
|
action: "connect",
|
|
1088
1061
|
bytes: this.__internal__.serial.bytes_connection
|
|
1089
|
-
}), this.__internal__.auto_response &&
|
|
1062
|
+
}), this.__internal__.auto_response && m(this, b, E).call(this, this.__internal__.serial.auto_response, null), await m(this, b, re).call(this);
|
|
1090
1063
|
} catch (e) {
|
|
1091
1064
|
this.serialErrors(e);
|
|
1092
1065
|
}
|
|
1093
1066
|
}
|
|
1094
1067
|
async serialForget() {
|
|
1095
|
-
return await
|
|
1068
|
+
return await m(this, b, ie).call(this);
|
|
1096
1069
|
}
|
|
1097
1070
|
decToHex(e) {
|
|
1098
1071
|
return typeof e == "string" && (e = parseInt(e, 10)), e.toString(16);
|
|
@@ -1105,15 +1078,29 @@ class Se extends se {
|
|
|
1105
1078
|
}
|
|
1106
1079
|
add0x(e) {
|
|
1107
1080
|
const t = [];
|
|
1108
|
-
return e.forEach((n,
|
|
1109
|
-
t[
|
|
1081
|
+
return e.forEach((n, i) => {
|
|
1082
|
+
t[i] = "0x" + n;
|
|
1110
1083
|
}), t;
|
|
1111
1084
|
}
|
|
1112
1085
|
bytesToHex(e) {
|
|
1113
1086
|
return this.add0x(Array.from(e, (t) => this.hexMaker(t)));
|
|
1114
1087
|
}
|
|
1088
|
+
validateBytes(e) {
|
|
1089
|
+
let t = new Uint8Array(0);
|
|
1090
|
+
if (e instanceof Uint8Array)
|
|
1091
|
+
t = e;
|
|
1092
|
+
else if (typeof e == "string")
|
|
1093
|
+
t = this.parseStringToTextEncoder(e);
|
|
1094
|
+
else if (Array.isArray(e) && typeof e[0] == "string")
|
|
1095
|
+
t = this.stringArrayToUint8Array(e);
|
|
1096
|
+
else if (Array.isArray(e) && typeof e[0] == "number")
|
|
1097
|
+
t = new Uint8Array(e);
|
|
1098
|
+
else
|
|
1099
|
+
throw new Error("Invalid data type");
|
|
1100
|
+
return t;
|
|
1101
|
+
}
|
|
1115
1102
|
async appendToQueue(e, t) {
|
|
1116
|
-
const n = this.
|
|
1103
|
+
const n = this.validateBytes(e);
|
|
1117
1104
|
if (["connect", "connection:start"].includes(t)) {
|
|
1118
1105
|
if (this.__internal__.serial.connected) return;
|
|
1119
1106
|
await this.serialConnect();
|
|
@@ -1149,7 +1136,7 @@ class Se extends se {
|
|
|
1149
1136
|
});
|
|
1150
1137
|
}
|
|
1151
1138
|
softReload() {
|
|
1152
|
-
|
|
1139
|
+
m(this, b, oe).call(this), this.dispatch("serial:soft-reload", {});
|
|
1153
1140
|
}
|
|
1154
1141
|
async sendConnect() {
|
|
1155
1142
|
if (!this.__internal__.serial.bytes_connection)
|
|
@@ -1177,7 +1164,7 @@ class Se extends se {
|
|
|
1177
1164
|
parseStringToBytes(e = "", t = `
|
|
1178
1165
|
`) {
|
|
1179
1166
|
const n = this.parseStringToTextEncoder(e, t);
|
|
1180
|
-
return Array.from(n).map((
|
|
1167
|
+
return Array.from(n).map((i) => i.toString(16));
|
|
1181
1168
|
}
|
|
1182
1169
|
parseUint8ToHex(e) {
|
|
1183
1170
|
return Array.from(e).map((t) => t.toString(16));
|
|
@@ -1188,26 +1175,26 @@ class Se extends se {
|
|
|
1188
1175
|
stringArrayToUint8Array(e) {
|
|
1189
1176
|
const t = [];
|
|
1190
1177
|
return e.forEach((n) => {
|
|
1191
|
-
const
|
|
1192
|
-
t.push(parseInt(
|
|
1178
|
+
const i = n.replace("0x", "");
|
|
1179
|
+
t.push(parseInt(i, 16));
|
|
1193
1180
|
}), new Uint8Array(t);
|
|
1194
1181
|
}
|
|
1195
1182
|
parseUint8ArrayToString(e) {
|
|
1196
|
-
|
|
1197
|
-
e = this.parseUint8ToHex(t);
|
|
1198
|
-
const n = e.map((
|
|
1183
|
+
let t = new Uint8Array(0);
|
|
1184
|
+
e instanceof Uint8Array ? t = e : t = this.stringArrayToUint8Array(e), e = this.parseUint8ToHex(t);
|
|
1185
|
+
const n = e.map((i) => parseInt(i, 16));
|
|
1199
1186
|
return this.__internal__.serial.response.replacer ? String.fromCharCode(...n).replace(this.__internal__.serial.response.replacer, "") : String.fromCharCode(...n);
|
|
1200
1187
|
}
|
|
1201
1188
|
hexToAscii(e) {
|
|
1202
1189
|
const t = e.toString();
|
|
1203
1190
|
let n = "";
|
|
1204
|
-
for (let
|
|
1205
|
-
n += String.fromCharCode(parseInt(t.substring(
|
|
1191
|
+
for (let i = 0; i < t.length; i += 2)
|
|
1192
|
+
n += String.fromCharCode(parseInt(t.substring(i, 2), 16));
|
|
1206
1193
|
return n;
|
|
1207
1194
|
}
|
|
1208
1195
|
asciiToHex(e) {
|
|
1209
1196
|
const t = [];
|
|
1210
|
-
for (let n = 0,
|
|
1197
|
+
for (let n = 0, i = e.length; n < i; n++) {
|
|
1211
1198
|
const u = Number(e.charCodeAt(n)).toString(16);
|
|
1212
1199
|
t.push(u);
|
|
1213
1200
|
}
|
|
@@ -1217,79 +1204,65 @@ class Se extends se {
|
|
|
1217
1204
|
return this.isConnected;
|
|
1218
1205
|
}
|
|
1219
1206
|
}
|
|
1220
|
-
b = /* @__PURE__ */ new WeakSet(),
|
|
1207
|
+
b = /* @__PURE__ */ new WeakSet(), x = function(l) {
|
|
1221
1208
|
return !!(l && l.readable && l.writable);
|
|
1222
|
-
},
|
|
1209
|
+
}, P = function(l = null) {
|
|
1223
1210
|
this.__internal__.serial.connected = !1, this.__internal__.aux_port_connector = 0, this.dispatch("serial:disconnected", l), _.$dispatchChange(this);
|
|
1224
|
-
},
|
|
1211
|
+
}, H = async function(l) {
|
|
1225
1212
|
const e = this.__internal__.serial.port;
|
|
1226
1213
|
if (!e || e && (!e.readable || !e.writable))
|
|
1227
|
-
throw
|
|
1228
|
-
const t = this.
|
|
1214
|
+
throw m(this, b, P).call(this, { error: "Port is closed, not readable or writable." }), new Error("The port is closed or is not readable/writable");
|
|
1215
|
+
const t = this.validateBytes(l);
|
|
1229
1216
|
if (e.writable === null) return;
|
|
1230
1217
|
const n = e.writable.getWriter();
|
|
1231
1218
|
await n.write(t), n.releaseLock();
|
|
1232
|
-
}, E = function(l = [], e = null) {
|
|
1219
|
+
}, E = function(l = new Uint8Array([]), e = null) {
|
|
1233
1220
|
if (l && l.length > 0) {
|
|
1234
1221
|
const t = this.__internal__.serial.connected;
|
|
1235
|
-
this.__internal__.serial.connected =
|
|
1236
|
-
|
|
1237
|
-
for (const s in l)
|
|
1238
|
-
n.push(l[s].toString().padStart(2, "0").toLowerCase());
|
|
1239
|
-
if (this.__internal__.serial.response.as === "hex")
|
|
1240
|
-
this.serialMessage(n);
|
|
1222
|
+
if (this.__internal__.serial.connected = m(this, b, x).call(this, this.__internal__.serial.port), _.$dispatchChange(this), !t && this.__internal__.serial.connected && this.dispatch("serial:connected"), this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0), this.__internal__.serial.response.as === "hex")
|
|
1223
|
+
this.serialMessage(this.parseUint8ToHex(l));
|
|
1241
1224
|
else if (this.__internal__.serial.response.as === "uint8")
|
|
1242
|
-
this.serialMessage(
|
|
1243
|
-
else if (this.__internal__.serial.response.as === "string")
|
|
1225
|
+
this.serialMessage(l);
|
|
1226
|
+
else if (this.__internal__.serial.response.as === "string") {
|
|
1227
|
+
const n = this.parseUint8ArrayToString(l);
|
|
1244
1228
|
if (this.__internal__.serial.response.limiter !== null) {
|
|
1245
|
-
const
|
|
1246
|
-
for (const u in
|
|
1247
|
-
|
|
1229
|
+
const i = n.split(this.__internal__.serial.response.limiter);
|
|
1230
|
+
for (const u in i)
|
|
1231
|
+
i[u] && this.serialMessage(i[u]);
|
|
1248
1232
|
} else
|
|
1249
|
-
this.serialMessage(
|
|
1250
|
-
else {
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
);
|
|
1254
|
-
this.serialMessage(s);
|
|
1233
|
+
this.serialMessage(n);
|
|
1234
|
+
} else {
|
|
1235
|
+
const n = this.stringToArrayBuffer(this.parseUint8ArrayToString(l));
|
|
1236
|
+
this.serialMessage(n);
|
|
1255
1237
|
}
|
|
1256
1238
|
} else
|
|
1257
1239
|
this.serialCorruptMessage(l, e);
|
|
1258
1240
|
this.__internal__.serial.queue.length !== 0 && this.dispatch("internal:queue", {});
|
|
1259
|
-
},
|
|
1241
|
+
}, ne = async function() {
|
|
1260
1242
|
const l = this.serialFilters, e = await navigator.serial.getPorts({ filters: l });
|
|
1261
1243
|
return l.length === 0 ? e : e.filter((t) => {
|
|
1262
1244
|
const n = t.getInfo();
|
|
1263
|
-
return l.some((
|
|
1264
|
-
}).filter((t) => !
|
|
1265
|
-
},
|
|
1245
|
+
return l.some((i) => n.usbProductId === i.usbProductId && n.usbVendorId === i.usbVendorId);
|
|
1246
|
+
}).filter((t) => !m(this, b, x).call(this, t));
|
|
1247
|
+
}, V = function(l) {
|
|
1266
1248
|
if (l) {
|
|
1267
1249
|
const e = this.__internal__.serial.response.buffer, t = new Uint8Array(e.length + l.byteLength);
|
|
1268
1250
|
t.set(e, 0), t.set(new Uint8Array(l), e.length), this.__internal__.serial.response.buffer = t;
|
|
1269
1251
|
}
|
|
1270
|
-
},
|
|
1252
|
+
}, z = async function() {
|
|
1271
1253
|
this.__internal__.serial.time_until_send_bytes && (clearTimeout(this.__internal__.serial.time_until_send_bytes), this.__internal__.serial.time_until_send_bytes = 0), this.__internal__.serial.time_until_send_bytes = setTimeout(() => {
|
|
1272
|
-
|
|
1273
|
-
for (const e in this.__internal__.serial.response.buffer)
|
|
1274
|
-
l.push(this.__internal__.serial.response.buffer[e].toString(16));
|
|
1275
|
-
this.__internal__.serial.response.buffer && y(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1254
|
+
this.__internal__.serial.response.buffer && m(this, b, E).call(this, this.__internal__.serial.response.buffer), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1276
1255
|
}, 400);
|
|
1277
|
-
},
|
|
1256
|
+
}, K = async function() {
|
|
1278
1257
|
if (this.__internal__.serial.response.length !== null) {
|
|
1279
|
-
if (this.__internal__.serial.response.length === this.__internal__.serial.response.buffer.length)
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
l.push(this.__internal__.serial.response.buffer[e].toString(16));
|
|
1283
|
-
y(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1284
|
-
} else if (this.__internal__.serial.response.length < this.__internal__.serial.response.buffer.length) {
|
|
1258
|
+
if (this.__internal__.serial.response.length === this.__internal__.serial.response.buffer.length)
|
|
1259
|
+
m(this, b, E).call(this, this.__internal__.serial.response.buffer), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1260
|
+
else if (this.__internal__.serial.response.length < this.__internal__.serial.response.buffer.length) {
|
|
1285
1261
|
let l = new Uint8Array(0);
|
|
1286
1262
|
for (let t = 0; t < this.__internal__.serial.response.length; t++)
|
|
1287
1263
|
l[t] = this.__internal__.serial.response.buffer[t];
|
|
1288
1264
|
if (l.length === this.__internal__.serial.response.length) {
|
|
1289
|
-
|
|
1290
|
-
for (const n in l)
|
|
1291
|
-
t.push(l[n].toString(16));
|
|
1292
|
-
y(this, b, E).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1265
|
+
m(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1293
1266
|
return;
|
|
1294
1267
|
}
|
|
1295
1268
|
l = new Uint8Array(0);
|
|
@@ -1297,16 +1270,11 @@ b = /* @__PURE__ */ new WeakSet(), M = function(l) {
|
|
|
1297
1270
|
if (this.__internal__.serial.response.buffer.length === e) {
|
|
1298
1271
|
for (let t = 14; t < e; t++)
|
|
1299
1272
|
l[t - this.__internal__.serial.response.length] = this.__internal__.serial.response.buffer[t];
|
|
1300
|
-
|
|
1301
|
-
const t = [];
|
|
1302
|
-
for (const n in l)
|
|
1303
|
-
t.push(l[n].toString(16));
|
|
1304
|
-
y(this, b, E).call(this, t), this.__internal__.serial.response.buffer = new Uint8Array(0);
|
|
1305
|
-
}
|
|
1273
|
+
l.length === this.__internal__.serial.response.length && (m(this, b, E).call(this, l), this.__internal__.serial.response.buffer = new Uint8Array(0));
|
|
1306
1274
|
}
|
|
1307
1275
|
}
|
|
1308
1276
|
}
|
|
1309
|
-
},
|
|
1277
|
+
}, re = async function() {
|
|
1310
1278
|
const l = this.__internal__.serial.port;
|
|
1311
1279
|
if (!l || !l.readable) throw new Error("Port is not readable");
|
|
1312
1280
|
for (; l.readable && this.__internal__.serial.keep_reading; ) {
|
|
@@ -1315,12 +1283,12 @@ b = /* @__PURE__ */ new WeakSet(), M = function(l) {
|
|
|
1315
1283
|
try {
|
|
1316
1284
|
let t = !0;
|
|
1317
1285
|
for (; t; ) {
|
|
1318
|
-
const { value: n, done:
|
|
1319
|
-
if (
|
|
1286
|
+
const { value: n, done: i } = await e.read();
|
|
1287
|
+
if (i) {
|
|
1320
1288
|
e.releaseLock(), this.__internal__.serial.keep_reading = !1, t = !1;
|
|
1321
1289
|
break;
|
|
1322
1290
|
}
|
|
1323
|
-
|
|
1291
|
+
m(this, b, V).call(this, n), this.__internal__.serial.response.length === null ? await m(this, b, z).call(this) : await m(this, b, K).call(this);
|
|
1324
1292
|
}
|
|
1325
1293
|
} catch (t) {
|
|
1326
1294
|
this.serialErrors(t);
|
|
@@ -1329,9 +1297,9 @@ b = /* @__PURE__ */ new WeakSet(), M = function(l) {
|
|
|
1329
1297
|
}
|
|
1330
1298
|
}
|
|
1331
1299
|
this.__internal__.serial.keep_reading = !0, this.__internal__.serial.port && await this.__internal__.serial.port.close();
|
|
1332
|
-
},
|
|
1300
|
+
}, ie = async function() {
|
|
1333
1301
|
return typeof window > "u" ? !1 : "serial" in navigator && "forget" in SerialPort.prototype && this.__internal__.serial.port ? (await this.__internal__.serial.port.forget(), !0) : !1;
|
|
1334
|
-
},
|
|
1302
|
+
}, se = function() {
|
|
1335
1303
|
[
|
|
1336
1304
|
"serial:connected",
|
|
1337
1305
|
"serial:connecting",
|
|
@@ -1350,37 +1318,45 @@ b = /* @__PURE__ */ new WeakSet(), M = function(l) {
|
|
|
1350
1318
|
].forEach((l) => {
|
|
1351
1319
|
this.serialRegisterAvailableListener(l);
|
|
1352
1320
|
});
|
|
1353
|
-
},
|
|
1321
|
+
}, ae = function() {
|
|
1354
1322
|
const l = this;
|
|
1355
1323
|
this.on("internal:queue", async () => {
|
|
1356
1324
|
var e;
|
|
1357
|
-
await
|
|
1358
|
-
}),
|
|
1359
|
-
},
|
|
1325
|
+
await m(e = l, b, X).call(e);
|
|
1326
|
+
}), m(this, b, G).call(this);
|
|
1327
|
+
}, G = function() {
|
|
1360
1328
|
const l = this;
|
|
1361
1329
|
navigator.serial.addEventListener("connect", async () => {
|
|
1362
1330
|
l.isDisconnected && await l.serialConnect().catch(() => {
|
|
1363
1331
|
});
|
|
1364
1332
|
});
|
|
1365
|
-
},
|
|
1366
|
-
if (!
|
|
1367
|
-
|
|
1333
|
+
}, X = async function() {
|
|
1334
|
+
if (!m(this, b, x).call(this, this.__internal__.serial.port)) {
|
|
1335
|
+
m(this, b, P).call(this, { error: "Port is closed, not readable or writable." }), await this.serialConnect();
|
|
1368
1336
|
return;
|
|
1369
1337
|
}
|
|
1370
1338
|
if (this.__internal__.timeout.until_response || this.__internal__.serial.queue.length === 0) return;
|
|
1371
1339
|
const l = this.__internal__.serial.queue[0];
|
|
1372
1340
|
let e = this.__internal__.time.response_general;
|
|
1373
|
-
l.action === "connect" && (e = this.__internal__.time.response_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1341
|
+
if (l.action === "connect" && (e = this.__internal__.time.response_connection), this.__internal__.timeout.until_response = setTimeout(async () => {
|
|
1374
1342
|
await this.timeout(l.bytes, l.action);
|
|
1375
|
-
}, e), this.__internal__.serial.last_action = l.action ?? "unknown", await
|
|
1343
|
+
}, e), this.__internal__.serial.last_action = l.action ?? "unknown", await m(this, b, H).call(this, l.bytes), this.dispatch("serial:sent", {
|
|
1376
1344
|
action: l.action,
|
|
1377
1345
|
bytes: l.bytes
|
|
1378
|
-
}), this.__internal__.auto_response
|
|
1346
|
+
}), this.__internal__.auto_response) {
|
|
1347
|
+
let n = new Uint8Array(0);
|
|
1348
|
+
try {
|
|
1349
|
+
n = this.validateBytes(this.__internal__.serial.auto_response);
|
|
1350
|
+
} catch (i) {
|
|
1351
|
+
this.serialErrors(i);
|
|
1352
|
+
}
|
|
1353
|
+
m(this, b, E).call(this, n, null);
|
|
1354
|
+
}
|
|
1379
1355
|
const t = [...this.__internal__.serial.queue];
|
|
1380
1356
|
this.__internal__.serial.queue = t.splice(1);
|
|
1381
|
-
},
|
|
1357
|
+
}, le = function(l = 1) {
|
|
1382
1358
|
this.__internal__.device_number = l, this.__internal__.serial.bytes_connection = this.serialSetConnectionConstant(l);
|
|
1383
|
-
},
|
|
1359
|
+
}, oe = function() {
|
|
1384
1360
|
this.__internal__.last_error = {
|
|
1385
1361
|
message: null,
|
|
1386
1362
|
action: null,
|
|
@@ -1389,7 +1365,7 @@ b = /* @__PURE__ */ new WeakSet(), M = function(l) {
|
|
|
1389
1365
|
};
|
|
1390
1366
|
};
|
|
1391
1367
|
_.instance || (_.instance = new _());
|
|
1392
|
-
const
|
|
1368
|
+
const ye = {
|
|
1393
1369
|
relay: [],
|
|
1394
1370
|
locker: [],
|
|
1395
1371
|
jofemar: [],
|
|
@@ -1398,7 +1374,7 @@ const Ae = {
|
|
|
1398
1374
|
pinpad: [],
|
|
1399
1375
|
pinpax: []
|
|
1400
1376
|
};
|
|
1401
|
-
_.devices = { ..._.devices, ...
|
|
1377
|
+
_.devices = { ..._.devices, ...ye };
|
|
1402
1378
|
_.addCustom = (l, e) => {
|
|
1403
1379
|
_.registerType(l), _.add(e);
|
|
1404
1380
|
};
|
|
@@ -1417,7 +1393,7 @@ _.getRelay = (l = 1) => _.getByNumber("relay", l);
|
|
|
1417
1393
|
_.getArduino = (l = 1) => _.getByNumber("arduino", l);
|
|
1418
1394
|
_.getPinPad = (l = 1) => _.getByNumber("pinpad", l);
|
|
1419
1395
|
_.getPinPax = (l = 1) => _.getByNumber("pinpax", l);
|
|
1420
|
-
class
|
|
1396
|
+
class me extends be {
|
|
1421
1397
|
constructor(e) {
|
|
1422
1398
|
super(e), this.__internal__ = structuredClone(this.__internal__), this.getResponseAsArrayHex(), this.__internal__.device.door_open = !1, this.__internal__.time.response_engines = 2e3, this.__internal__.time.sense = 100, this.__internal__.interval.waiting_sense = 0, this.__internal__.dispense = {
|
|
1423
1399
|
must_response: !1,
|
|
@@ -1460,7 +1436,7 @@ class xe extends Se {
|
|
|
1460
1436
|
}), null);
|
|
1461
1437
|
}
|
|
1462
1438
|
async internalDispenseStatus() {
|
|
1463
|
-
if (this.__internal__.dispense.must_response && (await
|
|
1439
|
+
if (this.__internal__.dispense.must_response && (await _e(this.__internal__.time.response_engines + 10), this.__internal__.dispense.status === "no-response"))
|
|
1464
1440
|
return this.internalClearSensing(), this.__internal__.dispense.status = !1, this.dispatch("not-dispensed", { reason: "no-response" }), { status: !1, error: "no-response" };
|
|
1465
1441
|
this.__internal__.dispense.status = null, this.__internal__.dispense.dispensing = !0, this.dispatch("internal:dispense:running", {});
|
|
1466
1442
|
const e = this;
|
|
@@ -1488,14 +1464,14 @@ class xe extends Se {
|
|
|
1488
1464
|
}
|
|
1489
1465
|
async internalDispense(e) {
|
|
1490
1466
|
if (this.isDispensing) throw new Error("Another dispensing process is running");
|
|
1491
|
-
if (!
|
|
1467
|
+
if (!L.enable && !this.__internal__.serial.connected && (await this.serialConnect(), !this.__internal__.serial.connected))
|
|
1492
1468
|
throw new Error("Serial device not connected");
|
|
1493
1469
|
return this.__internal__.serial.queue.length === 0 ? (await this.appendToQueue(e, "dispense"), await this.internalDispenseStatus()) : new Promise((t) => {
|
|
1494
1470
|
const n = setInterval(async () => {
|
|
1495
1471
|
if (this.__internal__.serial.queue.length > 0) return;
|
|
1496
1472
|
clearInterval(n), await this.appendToQueue(e, "dispense");
|
|
1497
|
-
const
|
|
1498
|
-
t(
|
|
1473
|
+
const i = await this.internalDispenseStatus();
|
|
1474
|
+
t(i);
|
|
1499
1475
|
}, 100);
|
|
1500
1476
|
});
|
|
1501
1477
|
}
|
|
@@ -1525,13 +1501,13 @@ class xe extends Se {
|
|
|
1525
1501
|
}
|
|
1526
1502
|
}
|
|
1527
1503
|
export {
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1504
|
+
L as E,
|
|
1505
|
+
me as K,
|
|
1506
|
+
_,
|
|
1507
|
+
Ce as a,
|
|
1508
|
+
ke as b,
|
|
1509
|
+
De as g,
|
|
1510
|
+
Ae as i,
|
|
1511
|
+
ve as s,
|
|
1512
|
+
_e as w
|
|
1537
1513
|
};
|