@busy-app/busy-lib 0.13.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,112 +1,117 @@
1
- var F = Object.defineProperty;
2
- var M = (r, e, n) => e in r ? F(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var l = (r, e, n) => M(r, typeof e != "symbol" ? e + "" : e, n);
4
- import q from "openapi-fetch";
5
- const V = (r, e) => {
6
- if (typeof FormData < "u" && r instanceof FormData || typeof Buffer < "u" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(r) || typeof File < "u" && r instanceof File || typeof Blob < "u" && r instanceof Blob || typeof ArrayBuffer < "u" && r instanceof ArrayBuffer || typeof ArrayBuffer < "u" && ArrayBuffer.isView && ArrayBuffer.isView(r))
7
- return r;
8
- let n;
9
- return e && (e instanceof Headers ? n = e.get("Content-Type") ?? e.get("content-type") ?? void 0 : typeof e == "object" && (n = e["Content-Type"] ?? e["content-type"]), n === "application/x-www-form-urlencoded") ? r && typeof r == "object" && !(r instanceof URLSearchParams) ? new URLSearchParams(r).toString() : String(r) : JSON.stringify(r);
1
+ var x = Object.defineProperty;
2
+ var U = (e, n, t) => n in e ? x(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var l = (e, n, t) => U(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import D from "openapi-fetch";
5
+ const B = (e, n) => {
6
+ if (typeof FormData < "u" && e instanceof FormData || typeof Buffer < "u" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(e) || typeof File < "u" && e instanceof File || typeof Blob < "u" && e instanceof Blob || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer || typeof ArrayBuffer < "u" && ArrayBuffer.isView && ArrayBuffer.isView(e))
7
+ return e;
8
+ let t;
9
+ return n && (n instanceof Headers ? t = n.get("Content-Type") ?? n.get("content-type") ?? void 0 : typeof n == "object" && (t = n["Content-Type"] ?? n["content-type"]), t === "application/x-www-form-urlencoded") ? e && typeof e == "object" && !(e instanceof URLSearchParams) ? new URLSearchParams(e).toString() : String(e) : JSON.stringify(e);
10
10
  };
11
- async function T(r) {
12
- const t = (r.headers.get("content-type") || "").includes("application/json") ? await r.clone().json() : await r.clone().text(), i = typeof t == "object" && t !== null ? t.error || t.message : typeof t == "string" ? t : void 0;
13
- return Object.assign(new Error(i || `HTTP ${r.status} ${r.statusText}`), {
14
- status: r.status,
15
- statusText: r.statusText,
16
- body: t
11
+ async function w(e) {
12
+ const r = (e.headers.get("content-type") || "").includes("application/json") ? await e.clone().json() : await e.clone().text(), i = typeof r == "object" && r !== null ? r.error || r.message : typeof r == "string" ? r : void 0;
13
+ return Object.assign(new Error(i || `HTTP ${e.status} ${e.statusText}`), {
14
+ status: e.status,
15
+ statusText: e.statusText,
16
+ body: r
17
17
  });
18
18
  }
19
- async function s(r, e = 3e3) {
20
- if (e <= 0)
21
- return await r();
22
- const n = new AbortController(), t = setTimeout(() => n.abort(), e);
23
- try {
24
- return await r(n.signal);
25
- } catch (i) {
26
- throw i instanceof DOMException && i.name === "AbortError" ? new Error(`Request timed out after ${e}ms`) : i;
27
- } finally {
28
- clearTimeout(t);
29
- }
30
- }
31
- function W(r, e, n) {
32
- let t, i = n ?? void 0, o, a = null;
33
- const c = async () => {
34
- t || (a || (a = (async () => {
35
- const f = await e();
19
+ function M(e, n, t, r = 3e3) {
20
+ let i, o = t ?? void 0, s, u = null;
21
+ const a = async () => {
22
+ i || (u || (u = (async () => {
23
+ const f = await n();
36
24
  if (!f.api_semver)
37
25
  throw new Error("Empty API version");
38
- t = f.api_semver;
26
+ i = f.api_semver;
39
27
  })().finally(() => {
40
- a = null;
41
- })), await a);
42
- }, u = {
43
- async onRequest({ request: f, schemaPath: h }) {
44
- return i && f.headers.set("Authorization", `Bearer ${i}`), h !== "/version" && (await c(), t && f.headers.set("X-API-Sem-Ver", t), o && f.headers.set("X-API-Token", o)), f;
28
+ u = null;
29
+ })), await u);
30
+ }, F = {
31
+ async onRequest({ request: f, schemaPath: p }) {
32
+ return o && f.headers.set("Authorization", `Bearer ${o}`), p !== "/version" && (await a(), i && f.headers.set("X-API-Sem-Ver", i), s && f.headers.set("X-API-Token", s)), f;
45
33
  },
46
- async onResponse({ request: f, response: h, options: U, schemaPath: B }) {
34
+ async onResponse({ request: f, response: p, options: T, schemaPath: A }) {
35
+ if (p.ok)
36
+ return p;
37
+ if (A === "/version")
38
+ throw await w(p);
39
+ if (p.status !== 405)
40
+ throw await w(p);
41
+ i = void 0, await a(), i && f.headers.set("X-API-Sem-Ver", i), o && f.headers.set("Authorization", `Bearer ${o}`);
42
+ const h = await (T.fetch ?? fetch)(f);
47
43
  if (h.ok)
48
44
  return h;
49
- if (B === "/version")
50
- throw await T(h);
51
- if (h.status !== 405)
52
- throw await T(h);
53
- t = void 0, await c(), t && f.headers.set("X-API-Sem-Ver", t), i && f.headers.set("Authorization", `Bearer ${i}`);
54
- const R = await (U.fetch ?? fetch)(f);
55
- if (R.ok)
56
- return R;
57
- throw await T(R);
45
+ throw await w(h);
58
46
  }
59
- }, m = q({
60
- baseUrl: r,
61
- bodySerializer: V
47
+ }, R = D({
48
+ baseUrl: e,
49
+ bodySerializer: B
62
50
  });
63
- return m.use(u), {
64
- client: m,
51
+ return R.withTimeout = async (f, p = r) => {
52
+ if (p <= 0)
53
+ return await f();
54
+ const T = new AbortController(), A = setTimeout(() => T.abort(), p);
55
+ try {
56
+ return await f(T.signal);
57
+ } catch (h) {
58
+ throw h instanceof DOMException && h.name === "AbortError" ? new Error(`Request timed out after ${p}ms`) : h;
59
+ } finally {
60
+ clearTimeout(A);
61
+ }
62
+ }, R.use(F), {
63
+ client: R,
65
64
  setApiKey: (f) => {
66
- o = f;
65
+ s = f;
67
66
  },
68
67
  setToken: (f) => {
69
- i = f;
68
+ o = f;
70
69
  }
71
70
  };
72
71
  }
73
- async function G(r, e) {
74
- const { data: n, error: t } = await s((i) => r.GET("/version", { signal: i }), e == null ? void 0 : e.timeout);
75
- if (t)
76
- throw t;
77
- return n;
78
- }
79
- async function $(r, e) {
80
- const { data: n, error: t } = await s((i) => r.GET("/status", { signal: i }), e == null ? void 0 : e.timeout);
81
- if (t)
82
- throw t;
83
- return n;
84
- }
85
- async function z(r, e) {
86
- const { data: n, error: t } = await s((i) => r.GET("/status/system", { signal: i }), e == null ? void 0 : e.timeout);
87
- if (t)
88
- throw t;
89
- return n;
90
- }
91
- async function J(r, e) {
92
- const { data: n, error: t } = await s((i) => r.GET("/status/power", { signal: i }), e == null ? void 0 : e.timeout);
93
- if (t)
94
- throw t;
95
- return n;
96
- }
97
- async function H(r, e) {
98
- const { data: n, error: t } = await s((i) => r.GET("/status/device", { signal: i }), e == null ? void 0 : e.timeout);
99
- if (t)
100
- throw t;
101
- return n;
102
- }
103
- async function K(r, e) {
104
- const { data: n, error: t } = await s((i) => r.GET("/status/firmware", { signal: i }), e == null ? void 0 : e.timeout);
105
- if (t)
106
- throw t;
107
- return n;
108
- }
109
- class X {
72
+ async function G(e, n) {
73
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/version", { signal: i }), n == null ? void 0 : n.timeout);
74
+ if (r)
75
+ throw r;
76
+ return t;
77
+ }
78
+ async function V(e, n) {
79
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/status", { signal: i }), n == null ? void 0 : n.timeout);
80
+ if (r)
81
+ throw r;
82
+ return t;
83
+ }
84
+ async function W(e, n) {
85
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/status/system", { signal: i }), n == null ? void 0 : n.timeout);
86
+ if (r)
87
+ throw r;
88
+ return t;
89
+ }
90
+ async function $(e, n) {
91
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/status/power", { signal: i }), n == null ? void 0 : n.timeout);
92
+ if (r)
93
+ throw r;
94
+ return t;
95
+ }
96
+ async function z(e, n) {
97
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/status/device", { signal: i }), n == null ? void 0 : n.timeout);
98
+ if (r)
99
+ throw r;
100
+ return t;
101
+ }
102
+ async function H(e, n) {
103
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/status/firmware", { signal: i }), n == null ? void 0 : n.timeout);
104
+ if (r)
105
+ throw r;
106
+ return t;
107
+ }
108
+ async function J(e, n) {
109
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/transport", { signal: i }), n == null ? void 0 : n.timeout);
110
+ if (r)
111
+ throw r;
112
+ return t;
113
+ }
114
+ class K {
110
115
  /**
111
116
  * Get API version information.
112
117
  *
@@ -114,9 +119,9 @@ class X {
114
119
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
115
120
  * @returns {Promise<VersionInfo>} A promise that resolves to an object containing the `api_semver` string.
116
121
  */
117
- async SystemVersionGet(e) {
118
- const n = await G(this.apiClient, e);
119
- return this.apiSemver = n.api_semver, n;
122
+ async SystemVersionGet(n) {
123
+ const t = await G(this.apiClient, n);
124
+ return this.apiSemver = t.api_semver, t;
120
125
  }
121
126
  /**
122
127
  * Get full status.
@@ -125,8 +130,8 @@ class X {
125
130
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
126
131
  * @returns {Promise<Status>} Current status of the device.
127
132
  */
128
- async SystemStatusGet(e) {
129
- return await $(this.apiClient, e);
133
+ async SystemStatusGet(n) {
134
+ return await V(this.apiClient, n);
130
135
  }
131
136
  /**
132
137
  * Get system status.
@@ -135,8 +140,8 @@ class X {
135
140
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
136
141
  * @returns {Promise<StatusSystem>} Current system status.
137
142
  */
138
- async SystemInfoGet(e) {
139
- return await z(this.apiClient, e);
143
+ async SystemInfoGet(n) {
144
+ return await W(this.apiClient, n);
140
145
  }
141
146
  /**
142
147
  * Get power status.
@@ -145,8 +150,8 @@ class X {
145
150
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
146
151
  * @returns {Promise<StatusPower>} Current power status.
147
152
  */
148
- async SystemStatusPowerGet(e) {
149
- return await J(this.apiClient, e);
153
+ async SystemStatusPowerGet(n) {
154
+ return await $(this.apiClient, n);
150
155
  }
151
156
  /**
152
157
  * Get device status.
@@ -155,8 +160,8 @@ class X {
155
160
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
156
161
  * @returns {Promise<StatusDevice>} Current device status.
157
162
  */
158
- async SystemStatusDeviceGet(e) {
159
- return await H(this.apiClient, e);
163
+ async SystemStatusDeviceGet(n) {
164
+ return await z(this.apiClient, n);
160
165
  }
161
166
  /**
162
167
  * Get firmware status.
@@ -165,94 +170,104 @@ class X {
165
170
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
166
171
  * @returns {Promise<StatusFirmware>} Current firmware status.
167
172
  */
168
- async SystemStatusFirmwareGet(e) {
169
- return await K(this.apiClient, e);
173
+ async SystemStatusFirmwareGet(n) {
174
+ return await H(this.apiClient, n);
175
+ }
176
+ /**
177
+ * Get device transport information.
178
+ *
179
+ * @param {TimeoutOptions} [params] - Optional parameters.
180
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
181
+ * @returns {Promise<NetworkInterfaceInfo>} Current transport info (usb/wifi).
182
+ */
183
+ async SystemTransportGet(n) {
184
+ return await J(this.apiClient, n);
170
185
  }
171
186
  }
172
- async function Y(r, e) {
173
- const { file: n } = e, { data: t, error: i } = await s(
174
- (o) => r.POST("/update", {
187
+ async function Y(e, n) {
188
+ const { file: t } = n, { data: r, error: i } = await e.withTimeout(
189
+ (o) => e.POST("/update", {
175
190
  headers: {
176
191
  "Content-Type": "application/octet-stream"
177
192
  },
178
- body: n,
193
+ body: t,
179
194
  signal: o
180
195
  }),
181
- e.timeout
196
+ n.timeout
182
197
  );
183
198
  if (i)
184
199
  throw i;
200
+ return r;
201
+ }
202
+ async function X(e, n) {
203
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/update/check", { signal: i }), n == null ? void 0 : n.timeout);
204
+ if (r)
205
+ throw r;
206
+ return t;
207
+ }
208
+ async function Z(e, n) {
209
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/update/status", { signal: i }), n == null ? void 0 : n.timeout);
210
+ if (r)
211
+ throw r;
185
212
  return t;
186
213
  }
187
- async function Z(r, e) {
188
- const { data: n, error: t } = await s((i) => r.POST("/update/check", { signal: i }), e == null ? void 0 : e.timeout);
189
- if (t)
190
- throw t;
191
- return n;
192
- }
193
- async function Q(r, e) {
194
- const { data: n, error: t } = await s((i) => r.GET("/update/status", { signal: i }), e == null ? void 0 : e.timeout);
195
- if (t)
196
- throw t;
197
- return n;
198
- }
199
- async function ee(r, e) {
200
- const { version: n } = e, { data: t, error: i } = await s(
201
- (o) => r.GET("/update/changelog", {
214
+ async function Q(e, n) {
215
+ const { version: t } = n, { data: r, error: i } = await e.withTimeout(
216
+ (o) => e.GET("/update/changelog", {
202
217
  params: {
203
218
  query: {
204
- version: n
219
+ version: t
205
220
  }
206
221
  },
207
222
  signal: o
208
223
  }),
209
- e.timeout
224
+ n.timeout
210
225
  );
211
226
  if (i)
212
227
  throw i;
213
- return t;
228
+ return r;
214
229
  }
215
- async function ne(r, e) {
216
- const { version: n } = e, { data: t, error: i } = await s(
217
- (o) => r.POST("/update/install", {
230
+ async function nn(e, n) {
231
+ const { version: t } = n, { data: r, error: i } = await e.withTimeout(
232
+ (o) => e.POST("/update/install", {
218
233
  params: {
219
234
  query: {
220
- version: n
235
+ version: t
221
236
  }
222
237
  },
223
238
  signal: o
224
239
  }),
225
- e.timeout
240
+ n.timeout
226
241
  );
227
242
  if (i)
228
243
  throw i;
244
+ return r;
245
+ }
246
+ async function en(e, n) {
247
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/update/abort_download", { signal: i }), n == null ? void 0 : n.timeout);
248
+ if (r)
249
+ throw r;
229
250
  return t;
230
251
  }
231
- async function te(r, e) {
232
- const { data: n, error: t } = await s((i) => r.POST("/update/abort_download", { signal: i }), e == null ? void 0 : e.timeout);
233
- if (t)
234
- throw t;
235
- return n;
236
- }
237
- async function re(r, e) {
238
- const { data: n, error: t } = await s((i) => r.GET("/update/autoupdate", { signal: i }), e == null ? void 0 : e.timeout);
239
- if (t)
240
- throw t;
241
- return n;
242
- }
243
- async function ie(r, e) {
244
- const { is_enabled: n, interval_start: t, interval_end: i } = e, { data: o, error: a } = await s(
245
- (c) => r.POST("/update/autoupdate", {
246
- body: { is_enabled: n, interval_start: t, interval_end: i },
247
- signal: c
252
+ async function tn(e, n) {
253
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/update/autoupdate", { signal: i }), n == null ? void 0 : n.timeout);
254
+ if (r)
255
+ throw r;
256
+ return t;
257
+ }
258
+ async function rn(e, n) {
259
+ const { is_enabled: t, interval_start: r, interval_end: i } = n, { data: o, error: s } = await e.withTimeout(
260
+ (u) => e.POST("/update/autoupdate", {
261
+ body: { is_enabled: t, interval_start: r, interval_end: i },
262
+ signal: u
248
263
  }),
249
- e.timeout
264
+ n.timeout
250
265
  );
251
- if (a)
252
- throw a;
266
+ if (s)
267
+ throw s;
253
268
  return o;
254
269
  }
255
- class oe {
270
+ class on {
256
271
  /**
257
272
  * Upload firmware update package.
258
273
  *
@@ -261,8 +276,8 @@ class oe {
261
276
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
262
277
  * @returns {Promise<SuccessResponse>} A promise that resolves when upload is complete.
263
278
  */
264
- async UpdateFromFile(e) {
265
- return await Y(this.apiClient, e);
279
+ async UpdateFromFile(n) {
280
+ return await Y(this.apiClient, n);
266
281
  }
267
282
  /**
268
283
  * Start firmware update check.
@@ -271,8 +286,8 @@ class oe {
271
286
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
272
287
  * @returns {Promise<SuccessResponse>} A promise that resolves to the update check result.
273
288
  */
274
- async UpdateCheck(e) {
275
- return await Z(this.apiClient, e);
289
+ async UpdateCheck(n) {
290
+ return await X(this.apiClient, n);
276
291
  }
277
292
  /**
278
293
  * Get firmware update status.
@@ -281,8 +296,8 @@ class oe {
281
296
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
282
297
  * @returns {Promise<UpdateStatus>} A promise that resolves to the update status.
283
298
  */
284
- async UpdateStatusGet(e) {
285
- return await Q(this.apiClient, e);
299
+ async UpdateStatusGet(n) {
300
+ return await Z(this.apiClient, n);
286
301
  }
287
302
  /**
288
303
  * Get firmware update changelog.
@@ -292,8 +307,8 @@ class oe {
292
307
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
293
308
  * @returns {Promise<UpdateChangelog>} A promise that resolves to the changelog content.
294
309
  */
295
- async UpdateChangelogGet(e) {
296
- return await ee(this.apiClient, e);
310
+ async UpdateChangelogGet(n) {
311
+ return await Q(this.apiClient, n);
297
312
  }
298
313
  /**
299
314
  * Start firmware update installation.
@@ -303,8 +318,8 @@ class oe {
303
318
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
304
319
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful initiation.
305
320
  */
306
- async UpdateInstall(e) {
307
- return await ne(this.apiClient, e);
321
+ async UpdateInstall(n) {
322
+ return await nn(this.apiClient, n);
308
323
  }
309
324
  /**
310
325
  * Abort firmware update download.
@@ -313,8 +328,8 @@ class oe {
313
328
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
314
329
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful abort.
315
330
  */
316
- async UpdateAbort(e) {
317
- return await te(this.apiClient, e);
331
+ async UpdateAbort(n) {
332
+ return await en(this.apiClient, n);
318
333
  }
319
334
  /**
320
335
  * Get current auto-update settings.
@@ -323,8 +338,8 @@ class oe {
323
338
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
324
339
  * @returns {Promise<AutoUpdateSettings>} A promise that resolves to the current auto-update settings.
325
340
  */
326
- async UpdateAutoUpdateGet(e) {
327
- return await re(this.apiClient, e);
341
+ async UpdateAutoUpdateGet(n) {
342
+ return await tn(this.apiClient, n);
328
343
  }
329
344
  /**
330
345
  * Set auto-update settings.
@@ -336,57 +351,57 @@ class oe {
336
351
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
337
352
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful update of settings.
338
353
  */
339
- async UpdateAutoUpdateSet(e) {
340
- return await ie(this.apiClient, e);
354
+ async UpdateAutoUpdateSet(n) {
355
+ return await rn(this.apiClient, n);
341
356
  }
342
357
  }
343
- async function se(r, e) {
344
- const { data: n, error: t } = await s((i) => r.GET("/time", { signal: i }), e == null ? void 0 : e.timeout);
345
- if (t)
346
- throw t;
347
- return n;
358
+ async function sn(e, n) {
359
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/time", { signal: i }), n == null ? void 0 : n.timeout);
360
+ if (r)
361
+ throw r;
362
+ return t;
348
363
  }
349
- async function ae(r, e) {
350
- const { timestamp: n } = e, { data: t, error: i } = await s(
351
- (o) => r.POST("/time/timestamp", {
364
+ async function an(e, n) {
365
+ const { timestamp: t } = n, { data: r, error: i } = await e.withTimeout(
366
+ (o) => e.POST("/time/timestamp", {
352
367
  params: {
353
- query: { timestamp: n }
368
+ query: { timestamp: t }
354
369
  },
355
370
  signal: o
356
371
  }),
357
- e.timeout
372
+ n.timeout
358
373
  );
359
374
  if (i)
360
375
  throw i;
361
- return t;
376
+ return r;
362
377
  }
363
- async function ue(r, e) {
364
- const { data: n, error: t } = await s((i) => r.GET("/time/timezone", { signal: i }), e == null ? void 0 : e.timeout);
365
- if (t)
366
- throw t;
367
- return n;
378
+ async function un(e, n) {
379
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/time/timezone", { signal: i }), n == null ? void 0 : n.timeout);
380
+ if (r)
381
+ throw r;
382
+ return t;
368
383
  }
369
- async function le(r, e) {
370
- const { timezone: n } = e, { data: t, error: i } = await s(
371
- (o) => r.POST("/time/timezone", {
384
+ async function ln(e, n) {
385
+ const { timezone: t } = n, { data: r, error: i } = await e.withTimeout(
386
+ (o) => e.POST("/time/timezone", {
372
387
  params: {
373
- query: { timezone: n }
388
+ query: { timezone: t }
374
389
  },
375
390
  signal: o
376
391
  }),
377
- e.timeout
392
+ n.timeout
378
393
  );
379
394
  if (i)
380
395
  throw i;
381
- return t;
396
+ return r;
382
397
  }
383
- async function ce(r, e) {
384
- const { data: n, error: t } = await s((i) => r.GET("/time/tzlist", { signal: i }), e == null ? void 0 : e.timeout);
385
- if (t)
386
- throw t;
387
- return n;
398
+ async function fn(e, n) {
399
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/time/tzlist", { signal: i }), n == null ? void 0 : n.timeout);
400
+ if (r)
401
+ throw r;
402
+ return t;
388
403
  }
389
- class fe {
404
+ class cn {
390
405
  /**
391
406
  * Get current timestamp info.
392
407
  *
@@ -394,8 +409,8 @@ class fe {
394
409
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
395
410
  * @returns {Promise<TimestampInfo>} A promise that resolves to the timestamp information.
396
411
  */
397
- async TimeGet(e) {
398
- return await se(this.apiClient, e);
412
+ async TimeGet(n) {
413
+ return await sn(this.apiClient, n);
399
414
  }
400
415
  /**
401
416
  * Set system timestamp.
@@ -405,8 +420,8 @@ class fe {
405
420
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
406
421
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
407
422
  */
408
- async TimeTimestampSet(e) {
409
- return await ae(this.apiClient, e);
423
+ async TimeTimestampSet(n) {
424
+ return await an(this.apiClient, n);
410
425
  }
411
426
  /**
412
427
  * Get current timezone.
@@ -415,8 +430,8 @@ class fe {
415
430
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
416
431
  * @returns {Promise<TimezoneInfo>} A promise that resolves to the timezone information.
417
432
  */
418
- async TimeTimezoneGet(e) {
419
- return await ue(this.apiClient, e);
433
+ async TimeTimezoneGet(n) {
434
+ return await un(this.apiClient, n);
420
435
  }
421
436
  /**
422
437
  * Set system timezone.
@@ -426,8 +441,8 @@ class fe {
426
441
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
427
442
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
428
443
  */
429
- async TimeTimezoneSet(e) {
430
- return await le(this.apiClient, e);
444
+ async TimeTimezoneSet(n) {
445
+ return await ln(this.apiClient, n);
431
446
  }
432
447
  /**
433
448
  * Get list of supported timezones.
@@ -436,58 +451,58 @@ class fe {
436
451
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
437
452
  * @returns {Promise<TimezoneList>} A promise that resolves to a list of timezone items.
438
453
  */
439
- async TimeTzListGet(e) {
440
- return await ce(this.apiClient, e);
441
- }
442
- }
443
- async function de(r, e) {
444
- const { data: n, error: t } = await s((i) => r.GET("/account/status", { signal: i }), e == null ? void 0 : e.timeout);
445
- if (t)
446
- throw t;
447
- return n;
448
- }
449
- async function pe(r, e) {
450
- const { data: n, error: t } = await s((i) => r.GET("/account/info", { signal: i }), e == null ? void 0 : e.timeout);
451
- if (t)
452
- throw t;
453
- return n;
454
- }
455
- async function he(r, e) {
456
- const { data: n, error: t } = await s((i) => r.GET("/account/profile", { signal: i }), e == null ? void 0 : e.timeout);
457
- if (t)
458
- throw t;
459
- return n;
460
- }
461
- async function ye(r, e) {
462
- const { profile: n, custom_url: t } = e, { data: i, error: o } = await s(
463
- (a) => r.POST("/account/profile", {
454
+ async TimeTzListGet(n) {
455
+ return await fn(this.apiClient, n);
456
+ }
457
+ }
458
+ async function dn(e, n) {
459
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/account/status", { signal: i }), n == null ? void 0 : n.timeout);
460
+ if (r)
461
+ throw r;
462
+ return t;
463
+ }
464
+ async function pn(e, n) {
465
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/account/info", { signal: i }), n == null ? void 0 : n.timeout);
466
+ if (r)
467
+ throw r;
468
+ return t;
469
+ }
470
+ async function hn(e, n) {
471
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/account/profile", { signal: i }), n == null ? void 0 : n.timeout);
472
+ if (r)
473
+ throw r;
474
+ return t;
475
+ }
476
+ async function yn(e, n) {
477
+ const { profile: t, custom_url: r } = n, { data: i, error: o } = await e.withTimeout(
478
+ (s) => e.POST("/account/profile", {
464
479
  params: {
465
480
  query: {
466
- profile: n,
467
- custom_url: t
481
+ profile: t,
482
+ custom_url: r
468
483
  }
469
484
  },
470
- signal: a
485
+ signal: s
471
486
  }),
472
- e.timeout
487
+ n.timeout
473
488
  );
474
489
  if (o)
475
490
  throw o;
476
491
  return i;
477
492
  }
478
- async function me(r, e) {
479
- const { data: n, error: t } = await s((i) => r.DELETE("/account", { signal: i }), e == null ? void 0 : e.timeout);
480
- if (t)
481
- throw t;
482
- return n;
493
+ async function mn(e, n) {
494
+ const { data: t, error: r } = await e.withTimeout((i) => e.DELETE("/account", { signal: i }), n == null ? void 0 : n.timeout);
495
+ if (r)
496
+ throw r;
497
+ return t;
483
498
  }
484
- async function ve(r, e) {
485
- const { data: n, error: t } = await s((i) => r.POST("/account/link", { signal: i }), e == null ? void 0 : e.timeout);
486
- if (t)
487
- throw t;
488
- return n;
499
+ async function vn(e, n) {
500
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/account/link", { signal: i }), n == null ? void 0 : n.timeout);
501
+ if (r)
502
+ throw r;
503
+ return t;
489
504
  }
490
- class ge {
505
+ class gn {
491
506
  /**
492
507
  * Get account info.
493
508
  *
@@ -495,8 +510,8 @@ class ge {
495
510
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
496
511
  * @returns {Promise<AccountInfo>} A promise that resolves to the account information.
497
512
  */
498
- async AccountInfoGet(e) {
499
- return await pe(this.apiClient, e);
513
+ async AccountInfoGet(n) {
514
+ return await pn(this.apiClient, n);
500
515
  }
501
516
  /**
502
517
  * Get account state.
@@ -505,8 +520,8 @@ class ge {
505
520
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
506
521
  * @returns {Promise<AccountStatus>} A promise that resolves to the account state.
507
522
  */
508
- async AccountStateGet(e) {
509
- return await de(this.apiClient, e);
523
+ async AccountStateGet(n) {
524
+ return await dn(this.apiClient, n);
510
525
  }
511
526
  /**
512
527
  * Get account profile.
@@ -515,8 +530,8 @@ class ge {
515
530
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
516
531
  * @returns {Promise<AccountProfile>} A promise that resolves to the account profile.
517
532
  */
518
- async AccountProfileGet(e) {
519
- return await he(this.apiClient, e);
533
+ async AccountProfileGet(n) {
534
+ return await hn(this.apiClient, n);
520
535
  }
521
536
  /**
522
537
  * Set account profile.
@@ -527,8 +542,8 @@ class ge {
527
542
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
528
543
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
529
544
  */
530
- async AccountProfileSet(e) {
531
- return await ye(this.apiClient, e);
545
+ async AccountProfileSet(n) {
546
+ return await yn(this.apiClient, n);
532
547
  }
533
548
  /**
534
549
  * Unlink device from account. Removes association with the current account.
@@ -537,8 +552,8 @@ class ge {
537
552
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
538
553
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful unlinking.
539
554
  */
540
- async AccountUnlink(e) {
541
- return await me(this.apiClient, e);
555
+ async AccountUnlink(n) {
556
+ return await mn(this.apiClient, n);
542
557
  }
543
558
  /**
544
559
  * Link device to account. Requests account link PIN. Works only if device is connected to MQTT and is not linked to account.
@@ -547,89 +562,89 @@ class ge {
547
562
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
548
563
  * @returns {Promise<AccountLink>} A promise that resolves to the link information (e.g., PIN).
549
564
  */
550
- async AccountLink(e) {
551
- return await ve(this.apiClient, e);
565
+ async AccountLink(n) {
566
+ return await vn(this.apiClient, n);
552
567
  }
553
568
  }
554
- async function be(r, e) {
555
- const { application_name: n, elements: t, priority: i = 50, timeout: o } = e, { data: a, error: c } = await s(
556
- (u) => r.POST("/display/draw", {
569
+ async function bn(e, n) {
570
+ const { application_name: t, elements: r, priority: i = 50, timeout: o } = n, { data: s, error: u } = await e.withTimeout(
571
+ (a) => e.POST("/display/draw", {
557
572
  body: {
558
- application_name: n,
573
+ application_name: t,
559
574
  priority: i,
560
- elements: t
575
+ elements: r
561
576
  },
562
- signal: u
577
+ signal: a
563
578
  }),
564
579
  o
565
580
  );
566
- if (c)
567
- throw c;
568
- return a;
581
+ if (u)
582
+ throw u;
583
+ return s;
569
584
  }
570
- async function Ee(r, e) {
571
- const { data: n, error: t } = await s(
572
- (i) => r.DELETE("/display/draw", {
585
+ async function En(e, n) {
586
+ const { data: t, error: r } = await e.withTimeout(
587
+ (i) => e.DELETE("/display/draw", {
573
588
  params: {
574
589
  query: {
575
- application_name: e == null ? void 0 : e.application_name
590
+ application_name: n == null ? void 0 : n.application_name
576
591
  }
577
592
  },
578
593
  signal: i
579
594
  }),
580
- e == null ? void 0 : e.timeout
595
+ n == null ? void 0 : n.timeout
581
596
  );
582
- if (t)
583
- throw t;
584
- return n;
597
+ if (r)
598
+ throw r;
599
+ return t;
585
600
  }
586
- async function _e(r, e) {
587
- const { display: n, timeout: t } = e, { data: i, error: o } = await s(
588
- (a) => r.GET("/screen", {
601
+ async function _n(e, n) {
602
+ const { display: t, timeout: r } = n, { data: i, error: o } = await e.withTimeout(
603
+ (s) => e.GET("/screen", {
589
604
  params: {
590
605
  query: {
591
- display: n
606
+ display: t
592
607
  }
593
608
  },
594
609
  parseAs: "blob",
595
- signal: a
610
+ signal: s
596
611
  }),
597
- t
612
+ r
598
613
  );
599
614
  if (o)
600
615
  throw o;
601
616
  return i;
602
617
  }
603
- async function Oe(r, e) {
604
- const { data: n, error: t } = await s((i) => r.GET("/display/brightness", { signal: i }), e == null ? void 0 : e.timeout);
605
- if (t)
606
- throw t;
607
- return n;
618
+ async function Tn(e, n) {
619
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/display/brightness", { signal: i }), n == null ? void 0 : n.timeout);
620
+ if (r)
621
+ throw r;
622
+ return t;
608
623
  }
609
- async function we(r, e) {
610
- const { value: n } = e, i = ((c) => {
611
- if (typeof c == "number") {
612
- if (c < 0 || c > 100)
624
+ async function On(e, n) {
625
+ const { value: t } = n, i = ((u) => {
626
+ if (typeof u == "number") {
627
+ if (u < 0 || u > 100)
613
628
  throw new Error("Brightness value must be between 0 and 100 or 'auto'");
614
- return String(c);
629
+ return String(u);
615
630
  }
616
631
  return "auto";
617
- })(n), { data: o, error: a } = await s(
618
- (c) => r.POST("/display/brightness", {
632
+ })(t), { data: o, error: s } = await e.withTimeout(
633
+ (u) => e.POST("/display/brightness", {
619
634
  params: {
620
635
  query: {
621
636
  value: i
622
637
  }
623
638
  },
624
- signal: c
639
+ signal: u
625
640
  }),
626
- e.timeout
641
+ n.timeout
627
642
  );
628
- if (a)
629
- throw a;
643
+ if (s)
644
+ throw s;
630
645
  return o;
631
646
  }
632
- class Re {
647
+ class Rn {
633
648
  /**
634
649
  * Draw on display. Sends drawing data to the display. Supports JSON-defined display elements.
635
650
  *
@@ -640,8 +655,8 @@ class Re {
640
655
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
641
656
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful draw command.
642
657
  */
643
- async DisplayDraw(e) {
644
- return await be(this.apiClient, e);
658
+ async DisplayDraw(n) {
659
+ return await bn(this.apiClient, n);
645
660
  }
646
661
  /**
647
662
  * Clear display. Deletes display elements drawn by the Canvas application.
@@ -652,8 +667,8 @@ class Re {
652
667
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
653
668
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful clear command.
654
669
  */
655
- async DisplayClear(e) {
656
- return await Ee(this.apiClient, e);
670
+ async DisplayClear(n) {
671
+ return await En(this.apiClient, n);
657
672
  }
658
673
  /**
659
674
  * Get single frame for requested screen.
@@ -663,8 +678,8 @@ class Re {
663
678
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
664
679
  * @returns {Promise<Blob>} A promise that resolves to the screen frame as a Blob.
665
680
  */
666
- async DisplayScreenFrameGet(e) {
667
- return await _e(this.apiClient, e);
681
+ async DisplayScreenFrameGet(n) {
682
+ return await _n(this.apiClient, n);
668
683
  }
669
684
  /**
670
685
  * Get display brightness.
@@ -673,8 +688,8 @@ class Re {
673
688
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
674
689
  * @returns {Promise<DisplayBrightnessInfo>} A promise that resolves to the brightness information.
675
690
  */
676
- async DisplayBrightnessGet(e) {
677
- return await Oe(this.apiClient, e);
691
+ async DisplayBrightnessGet(n) {
692
+ return await Tn(this.apiClient, n);
678
693
  }
679
694
  /**
680
695
  * Set display brightness.
@@ -684,59 +699,60 @@ class Re {
684
699
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
685
700
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
686
701
  */
687
- async DisplayBrightnessSet(e) {
688
- return await we(this.apiClient, e);
702
+ async DisplayBrightnessSet(n) {
703
+ return await On(this.apiClient, n);
689
704
  }
690
705
  }
691
- async function Te(r, e) {
692
- const { application_name: n, path: t } = e, { data: i, error: o } = await s(
693
- (a) => r.POST("/audio/play", {
706
+ async function An(e, n) {
707
+ const { application_name: t, path: r } = n, { data: i, error: o } = await e.withTimeout(
708
+ (s) => e.POST("/audio/play", {
694
709
  params: {
695
710
  query: {
696
- application_name: n,
697
- path: t
711
+ application_name: t,
712
+ path: r
698
713
  }
699
714
  },
700
- signal: a
715
+ signal: s
701
716
  }),
702
- e.timeout
717
+ n.timeout
703
718
  );
704
719
  if (o)
705
720
  throw o;
706
721
  return i;
707
722
  }
708
- async function Ae(r, e) {
709
- const { data: n, error: t } = await s((i) => r.DELETE("/audio/play", { signal: i }), e == null ? void 0 : e.timeout);
710
- if (t)
711
- throw t;
712
- return n;
713
- }
714
- async function Se(r, e) {
715
- const { data: n, error: t } = await s((i) => r.GET("/audio/volume", { signal: i }), e == null ? void 0 : e.timeout);
716
- if (t)
717
- throw t;
718
- return n;
719
- }
720
- async function Ne(r, e) {
721
- const { volume: n } = e;
722
- if (typeof n != "number" || n < 0 || n > 100)
723
+ async function wn(e, n) {
724
+ const { data: t, error: r } = await e.withTimeout((i) => e.DELETE("/audio/play", { signal: i }), n == null ? void 0 : n.timeout);
725
+ if (r)
726
+ throw r;
727
+ return t;
728
+ }
729
+ async function Sn(e, n) {
730
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/audio/volume", { signal: i }), n == null ? void 0 : n.timeout);
731
+ if (r)
732
+ throw r;
733
+ return t;
734
+ }
735
+ async function Nn(e, n) {
736
+ const { volume: t, silent: r } = n;
737
+ if (typeof t != "number" || t < 0 || t > 100)
723
738
  throw new Error("Volume must be a number between 0 and 100");
724
- const { data: t, error: i } = await s(
725
- (o) => r.POST("/audio/volume", {
739
+ const { data: i, error: o } = await e.withTimeout(
740
+ (s) => e.POST("/audio/volume", {
726
741
  params: {
727
742
  query: {
728
- volume: n
743
+ volume: t,
744
+ silent: r
729
745
  }
730
746
  },
731
- signal: o
747
+ signal: s
732
748
  }),
733
- e.timeout
749
+ n.timeout
734
750
  );
735
- if (i)
736
- throw i;
737
- return t;
751
+ if (o)
752
+ throw o;
753
+ return i;
738
754
  }
739
- class ke {
755
+ class In {
740
756
  /**
741
757
  * Play audio file. Plays a file from internal storage.
742
758
  *
@@ -746,8 +762,8 @@ class ke {
746
762
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
747
763
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful play command.
748
764
  */
749
- async AudioPlay(e) {
750
- return await Te(this.apiClient, e);
765
+ async AudioPlay(n) {
766
+ return await An(this.apiClient, n);
751
767
  }
752
768
  /**
753
769
  * Stop audio playback. Stops any currently playing audio.
@@ -756,8 +772,8 @@ class ke {
756
772
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
757
773
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful stop command.
758
774
  */
759
- async AudioStop(e) {
760
- return await Ae(this.apiClient, e);
775
+ async AudioStop(n) {
776
+ return await wn(this.apiClient, n);
761
777
  }
762
778
  /**
763
779
  * Get audio volume.
@@ -766,8 +782,8 @@ class ke {
766
782
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
767
783
  * @returns {Promise<AudioVolumeInfo>} A promise that resolves to the audio volume information.
768
784
  */
769
- async AudioVolumeGet(e) {
770
- return await Se(this.apiClient, e);
785
+ async AudioVolumeGet(n) {
786
+ return await Sn(this.apiClient, n);
771
787
  }
772
788
  /**
773
789
  * Set audio volume.
@@ -777,46 +793,46 @@ class ke {
777
793
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
778
794
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
779
795
  */
780
- async AudioVolumeSet(e) {
781
- return await Ne(this.apiClient, e);
796
+ async AudioVolumeSet(n) {
797
+ return await Nn(this.apiClient, n);
782
798
  }
783
799
  }
784
- async function Ce(r, e) {
785
- const { data: n, error: t } = await s((i) => r.GET("/wifi/status", { signal: i }), e == null ? void 0 : e.timeout);
786
- if (t)
787
- throw t;
788
- return n;
800
+ async function Cn(e, n) {
801
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/wifi/status", { signal: i }), n == null ? void 0 : n.timeout);
802
+ if (r)
803
+ throw r;
804
+ return t;
789
805
  }
790
- async function Ie(r, e) {
791
- const { ssid: n, password: t, security: i, ip_config: o } = e, { data: a, error: c } = await s(
792
- (u) => r.POST("/wifi/connect", {
806
+ async function kn(e, n) {
807
+ const { ssid: t, password: r, security: i, ip_config: o } = n, { data: s, error: u } = await e.withTimeout(
808
+ (a) => e.POST("/wifi/connect", {
793
809
  body: {
794
- ssid: n,
795
- password: t,
810
+ ssid: t,
811
+ password: r,
796
812
  security: i,
797
813
  ip_config: o
798
814
  },
799
- signal: u
815
+ signal: a
800
816
  }),
801
- e.timeout
817
+ n.timeout
802
818
  );
803
- if (c)
804
- throw c;
805
- return a;
806
- }
807
- async function qe(r, e) {
808
- const { data: n, error: t } = await s((i) => r.POST("/wifi/disconnect", { signal: i }), e == null ? void 0 : e.timeout);
809
- if (t)
810
- throw t;
811
- return n;
812
- }
813
- async function je(r, e) {
814
- const { data: n, error: t } = await s((i) => r.GET("/wifi/networks", { signal: i }), e == null ? void 0 : e.timeout);
815
- if (t)
816
- throw t;
817
- return n;
818
- }
819
- class Pe {
819
+ if (u)
820
+ throw u;
821
+ return s;
822
+ }
823
+ async function qn(e, n) {
824
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/wifi/disconnect", { signal: i }), n == null ? void 0 : n.timeout);
825
+ if (r)
826
+ throw r;
827
+ return t;
828
+ }
829
+ async function Pn(e, n) {
830
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/wifi/networks", { signal: i }), n == null ? void 0 : n.timeout);
831
+ if (r)
832
+ throw r;
833
+ return t;
834
+ }
835
+ class jn {
820
836
  /**
821
837
  * Returns current Wi-Fi status.
822
838
  *
@@ -824,8 +840,8 @@ class Pe {
824
840
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
825
841
  * @returns {Promise<WifiStatusResponse>} A promise that resolves to the Wi-Fi status.
826
842
  */
827
- async WifiStatusGet(e) {
828
- return await Ce(this.apiClient, e);
843
+ async WifiStatusGet(n) {
844
+ return await Cn(this.apiClient, n);
829
845
  }
830
846
  /**
831
847
  * Connects to Wi-Fi network.
@@ -838,8 +854,8 @@ class Pe {
838
854
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
839
855
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful connection initiation.
840
856
  */
841
- async WifiConnect(e) {
842
- return await Ie(this.apiClient, e);
857
+ async WifiConnect(n) {
858
+ return await kn(this.apiClient, n);
843
859
  }
844
860
  /**
845
861
  * Disconnects from Wi-Fi.
@@ -848,8 +864,8 @@ class Pe {
848
864
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
849
865
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful disconnection.
850
866
  */
851
- async WifiDisconnect(e) {
852
- return await qe(this.apiClient, e);
867
+ async WifiDisconnect(n) {
868
+ return await qn(this.apiClient, n);
853
869
  }
854
870
  /**
855
871
  * Scans environment for available Wi-Fi networks.
@@ -858,119 +874,119 @@ class Pe {
858
874
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
859
875
  * @returns {Promise<WifiNetworkResponse>} A promise that resolves to a list of available networks.
860
876
  */
861
- async WifiNetworksGet(e) {
862
- return await je(this.apiClient, e);
877
+ async WifiNetworksGet(n) {
878
+ return await Pn(this.apiClient, n);
863
879
  }
864
880
  }
865
- async function De(r, e) {
866
- const { path: n, file: t } = e, { data: i, error: o } = await s(
867
- (a) => r.POST("/storage/write", {
881
+ async function Dn(e, n) {
882
+ const { path: t, file: r } = n, { data: i, error: o } = await e.withTimeout(
883
+ (s) => e.POST("/storage/write", {
868
884
  params: {
869
885
  query: {
870
- path: n
886
+ path: t
871
887
  }
872
888
  },
873
889
  headers: {
874
890
  "Content-Type": "application/octet-stream"
875
891
  },
876
- body: t,
877
- signal: a
892
+ body: r,
893
+ signal: s
878
894
  }),
879
- e.timeout
895
+ n.timeout
880
896
  );
881
897
  if (o)
882
898
  throw o;
883
899
  return i;
884
900
  }
885
- async function Le(r, e) {
886
- const { path: n, as_array_buffer: t } = e, { data: i, error: o } = await s(
887
- (a) => r.GET("/storage/read", {
901
+ async function Ln(e, n) {
902
+ const { path: t, as_array_buffer: r } = n, { data: i, error: o } = await e.withTimeout(
903
+ (s) => e.GET("/storage/read", {
888
904
  params: {
889
905
  query: {
890
- path: n
906
+ path: t
891
907
  }
892
908
  },
893
- parseAs: t ? "arrayBuffer" : "blob",
894
- signal: a
909
+ parseAs: r ? "arrayBuffer" : "blob",
910
+ signal: s
895
911
  }),
896
- e.timeout
912
+ n.timeout
897
913
  );
898
914
  if (o)
899
915
  throw o;
900
916
  return i;
901
917
  }
902
- async function xe(r, e) {
903
- const { path: n } = e, { data: t, error: i } = await s(
904
- (o) => r.GET("/storage/list", {
918
+ async function Fn(e, n) {
919
+ const { path: t } = n, { data: r, error: i } = await e.withTimeout(
920
+ (o) => e.GET("/storage/list", {
905
921
  params: {
906
922
  query: {
907
- path: n
923
+ path: t
908
924
  }
909
925
  },
910
926
  signal: o
911
927
  }),
912
- e.timeout
928
+ n.timeout
913
929
  );
914
930
  if (i)
915
931
  throw i;
916
- return t;
932
+ return r;
917
933
  }
918
- async function Ue(r, e) {
919
- const { path: n } = e, { data: t, error: i } = await s(
920
- (o) => r.DELETE("/storage/remove", {
934
+ async function xn(e, n) {
935
+ const { path: t } = n, { data: r, error: i } = await e.withTimeout(
936
+ (o) => e.DELETE("/storage/remove", {
921
937
  params: {
922
938
  query: {
923
- path: n
939
+ path: t
924
940
  }
925
941
  },
926
942
  signal: o
927
943
  }),
928
- e.timeout
944
+ n.timeout
929
945
  );
930
946
  if (i)
931
947
  throw i;
932
- return t;
948
+ return r;
933
949
  }
934
- async function Be(r, e) {
935
- const { path: n } = e, { data: t, error: i } = await s(
936
- (o) => r.POST("/storage/mkdir", {
950
+ async function Un(e, n) {
951
+ const { path: t } = n, { data: r, error: i } = await e.withTimeout(
952
+ (o) => e.POST("/storage/mkdir", {
937
953
  params: {
938
954
  query: {
939
- path: n
955
+ path: t
940
956
  }
941
957
  },
942
958
  signal: o
943
959
  }),
944
- e.timeout
960
+ n.timeout
945
961
  );
946
962
  if (i)
947
963
  throw i;
948
- return t;
964
+ return r;
949
965
  }
950
- async function Fe(r, e) {
951
- const { data: n, error: t } = await s((i) => r.GET("/storage/status", { signal: i }), e == null ? void 0 : e.timeout);
952
- if (t)
953
- throw t;
954
- return n;
966
+ async function Bn(e, n) {
967
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/storage/status", { signal: i }), n == null ? void 0 : n.timeout);
968
+ if (r)
969
+ throw r;
970
+ return t;
955
971
  }
956
- async function Me(r, e) {
957
- const { path: n, new_path: t } = e, { data: i, error: o } = await s(
958
- (a) => r.POST("/storage/rename", {
972
+ async function Mn(e, n) {
973
+ const { path: t, new_path: r } = n, { data: i, error: o } = await e.withTimeout(
974
+ (s) => e.POST("/storage/rename", {
959
975
  params: {
960
976
  query: {
961
- path: n,
962
- new_path: t
977
+ path: t,
978
+ new_path: r
963
979
  }
964
980
  },
965
- signal: a
981
+ signal: s
966
982
  }),
967
- e.timeout
983
+ n.timeout
968
984
  );
969
985
  if (o)
970
986
  throw o;
971
987
  return i;
972
988
  }
973
- class Ve {
989
+ class Gn {
974
990
  /**
975
991
  * Upload file to internal storage. Uploads a file to a specified path.
976
992
  *
@@ -980,8 +996,8 @@ class Ve {
980
996
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
981
997
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful upload.
982
998
  */
983
- async StorageWrite(e) {
984
- return await De(this.apiClient, e);
999
+ async StorageWrite(n) {
1000
+ return await Dn(this.apiClient, n);
985
1001
  }
986
1002
  /**
987
1003
  * Download file from internal storage. Downloads a file from a specified path.
@@ -992,8 +1008,8 @@ class Ve {
992
1008
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
993
1009
  * @returns {Promise<StorageReadResponse>} A promise that resolves to the file content (Blob or ArrayBuffer).
994
1010
  */
995
- async StorageRead(e) {
996
- return await Le(this.apiClient, e);
1011
+ async StorageRead(n) {
1012
+ return await Ln(this.apiClient, n);
997
1013
  }
998
1014
  /**
999
1015
  * List files on internal storage.
@@ -1003,8 +1019,8 @@ class Ve {
1003
1019
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1004
1020
  * @returns {Promise<StorageList>} A promise that resolves to a list of files and directories.
1005
1021
  */
1006
- async StorageListGet(e) {
1007
- return await xe(this.apiClient, e);
1022
+ async StorageListGet(n) {
1023
+ return await Fn(this.apiClient, n);
1008
1024
  }
1009
1025
  /**
1010
1026
  * Remove a file on internal storage. Removes a file with a specified path.
@@ -1014,8 +1030,8 @@ class Ve {
1014
1030
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1015
1031
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful removal.
1016
1032
  */
1017
- async StorageRemove(e) {
1018
- return await Ue(this.apiClient, e);
1033
+ async StorageRemove(n) {
1034
+ return await xn(this.apiClient, n);
1019
1035
  }
1020
1036
  /**
1021
1037
  * Create a directory on internal storage. Creates a new directory with a specified path.
@@ -1025,8 +1041,8 @@ class Ve {
1025
1041
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1026
1042
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful creation.
1027
1043
  */
1028
- async StorageMkdir(e) {
1029
- return await Be(this.apiClient, e);
1044
+ async StorageMkdir(n) {
1045
+ return await Un(this.apiClient, n);
1030
1046
  }
1031
1047
  /**
1032
1048
  * Show storage usage.
@@ -1035,8 +1051,8 @@ class Ve {
1035
1051
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1036
1052
  * @returns {Promise<StorageStatus>} A promise that resolves to the storage status.
1037
1053
  */
1038
- async StorageStatusGet(e) {
1039
- return await Fe(this.apiClient, e);
1054
+ async StorageStatusGet(n) {
1055
+ return await Bn(this.apiClient, n);
1040
1056
  }
1041
1057
  /**
1042
1058
  * Rename/move a file. Moves a file to a new location.
@@ -1047,55 +1063,55 @@ class Ve {
1047
1063
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1048
1064
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful rename.
1049
1065
  */
1050
- async StorageRename(e) {
1051
- return await Me(this.apiClient, e);
1066
+ async StorageRename(n) {
1067
+ return await Mn(this.apiClient, n);
1052
1068
  }
1053
1069
  }
1054
- async function We(r, e) {
1055
- const { data: n, error: t } = await s((i) => r.GET("/access", { signal: i }), e == null ? void 0 : e.timeout);
1056
- if (t)
1057
- throw t;
1058
- return n;
1070
+ async function Vn(e, n) {
1071
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/access", { signal: i }), n == null ? void 0 : n.timeout);
1072
+ if (r)
1073
+ throw r;
1074
+ return t;
1059
1075
  }
1060
- async function Ge(r, e) {
1061
- const { mode: n, key: t } = e, i = t ?? "";
1076
+ async function Wn(e, n) {
1077
+ const { mode: t, key: r } = n, i = r ?? "";
1062
1078
  if (String(i).trim() && !/^\d{4,10}$/.test(String(i)))
1063
1079
  throw new Error("Key must be a string of 4 to 10 digits");
1064
- const { data: o, error: a } = await s(
1065
- (c) => r.POST("/access", {
1080
+ const { data: o, error: s } = await e.withTimeout(
1081
+ (u) => e.POST("/access", {
1066
1082
  params: {
1067
1083
  query: {
1068
- mode: n,
1084
+ mode: t,
1069
1085
  key: i
1070
1086
  }
1071
1087
  },
1072
- signal: c
1088
+ signal: u
1073
1089
  }),
1074
- e.timeout
1090
+ n.timeout
1075
1091
  );
1076
- if (a)
1077
- throw a;
1092
+ if (s)
1093
+ throw s;
1078
1094
  return o;
1079
1095
  }
1080
- async function $e(r, e) {
1081
- const { data: n, error: t } = await s((i) => r.GET("/name", { signal: i }), e == null ? void 0 : e.timeout);
1082
- if (t)
1083
- throw t;
1084
- return n;
1096
+ async function $n(e, n) {
1097
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/name", { signal: i }), n == null ? void 0 : n.timeout);
1098
+ if (r)
1099
+ throw r;
1100
+ return t;
1085
1101
  }
1086
- async function ze(r, e) {
1087
- const { name: n } = e, { data: t, error: i } = await s(
1088
- (o) => r.POST("/name", {
1089
- body: { name: n },
1102
+ async function zn(e, n) {
1103
+ const { name: t } = n, { data: r, error: i } = await e.withTimeout(
1104
+ (o) => e.POST("/name", {
1105
+ body: { name: t },
1090
1106
  signal: o
1091
1107
  }),
1092
- e.timeout
1108
+ n.timeout
1093
1109
  );
1094
1110
  if (i)
1095
1111
  throw i;
1096
- return t;
1112
+ return r;
1097
1113
  }
1098
- class Je {
1114
+ class Hn {
1099
1115
  /**
1100
1116
  * Get HTTP API access over Wi-Fi configuration.
1101
1117
  *
@@ -1103,8 +1119,8 @@ class Je {
1103
1119
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1104
1120
  * @returns {Promise<HttpAccessInfo>} A promise that resolves to the access configuration.
1105
1121
  */
1106
- async SettingsAccessGet(e) {
1107
- return await We(this.apiClient, e);
1122
+ async SettingsAccessGet(n) {
1123
+ return await Vn(this.apiClient, n);
1108
1124
  }
1109
1125
  /**
1110
1126
  * Set HTTP API access over Wi-Fi configuration.
@@ -1115,9 +1131,9 @@ class Je {
1115
1131
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1116
1132
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1117
1133
  */
1118
- async SettingsAccessSet(e) {
1119
- const n = await Ge(this.apiClient, e);
1120
- return e.mode === "key" && e.key && this.setApiKey(e.key), n;
1134
+ async SettingsAccessSet(n) {
1135
+ const t = await Wn(this.apiClient, n);
1136
+ return n.mode === "key" && n.key && this.setApiKey(n.key), t;
1121
1137
  }
1122
1138
  /**
1123
1139
  * Get current device name.
@@ -1126,8 +1142,8 @@ class Je {
1126
1142
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1127
1143
  * @returns {Promise<NameInfo>} A promise that resolves to the device name.
1128
1144
  */
1129
- async SettingsNameGet(e) {
1130
- return await $e(this.apiClient, e);
1145
+ async SettingsNameGet(n) {
1146
+ return await $n(this.apiClient, n);
1131
1147
  }
1132
1148
  /**
1133
1149
  * Set device name.
@@ -1137,35 +1153,35 @@ class Je {
1137
1153
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1138
1154
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1139
1155
  */
1140
- async SettingsNameSet(e) {
1141
- return await ze(this.apiClient, e);
1142
- }
1143
- }
1144
- async function He(r, e) {
1145
- const { data: n, error: t } = await s((i) => r.POST("/ble/enable", { signal: i }), e == null ? void 0 : e.timeout);
1146
- if (t)
1147
- throw t;
1148
- return n;
1149
- }
1150
- async function Ke(r, e) {
1151
- const { data: n, error: t } = await s((i) => r.POST("/ble/disable", { signal: i }), e == null ? void 0 : e.timeout);
1152
- if (t)
1153
- throw t;
1154
- return n;
1155
- }
1156
- async function Xe(r, e) {
1157
- const { data: n, error: t } = await s((i) => r.DELETE("/ble/pairing", { signal: i }), e == null ? void 0 : e.timeout);
1158
- if (t)
1159
- throw t;
1160
- return n;
1161
- }
1162
- async function Ye(r, e) {
1163
- const { data: n, error: t } = await s((i) => r.GET("/ble/status", { signal: i }), e == null ? void 0 : e.timeout);
1164
- if (t)
1165
- throw t;
1166
- return n;
1167
- }
1168
- class Ze {
1156
+ async SettingsNameSet(n) {
1157
+ return await zn(this.apiClient, n);
1158
+ }
1159
+ }
1160
+ async function Jn(e, n) {
1161
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/ble/enable", { signal: i }), n == null ? void 0 : n.timeout);
1162
+ if (r)
1163
+ throw r;
1164
+ return t;
1165
+ }
1166
+ async function Kn(e, n) {
1167
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/ble/disable", { signal: i }), n == null ? void 0 : n.timeout);
1168
+ if (r)
1169
+ throw r;
1170
+ return t;
1171
+ }
1172
+ async function Yn(e, n) {
1173
+ const { data: t, error: r } = await e.withTimeout((i) => e.DELETE("/ble/pairing", { signal: i }), n == null ? void 0 : n.timeout);
1174
+ if (r)
1175
+ throw r;
1176
+ return t;
1177
+ }
1178
+ async function Xn(e, n) {
1179
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/ble/status", { signal: i }), n == null ? void 0 : n.timeout);
1180
+ if (r)
1181
+ throw r;
1182
+ return t;
1183
+ }
1184
+ class Zn {
1169
1185
  /**
1170
1186
  * Enable BLE. Starts advertising.
1171
1187
  *
@@ -1173,8 +1189,8 @@ class Ze {
1173
1189
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1174
1190
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1175
1191
  */
1176
- async BleEnable(e) {
1177
- return await He(this.apiClient, e);
1192
+ async BleEnable(n) {
1193
+ return await Jn(this.apiClient, n);
1178
1194
  }
1179
1195
  /**
1180
1196
  * Disable BLE. Stops advertising.
@@ -1183,8 +1199,8 @@ class Ze {
1183
1199
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1184
1200
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1185
1201
  */
1186
- async BleDisable(e) {
1187
- return await Ke(this.apiClient, e);
1202
+ async BleDisable(n) {
1203
+ return await Kn(this.apiClient, n);
1188
1204
  }
1189
1205
  /**
1190
1206
  * Remove pairing. Remove pairing with previous device.
@@ -1193,8 +1209,8 @@ class Ze {
1193
1209
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1194
1210
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1195
1211
  */
1196
- async BleUnpair(e) {
1197
- return await Xe(this.apiClient, e);
1212
+ async BleUnpair(n) {
1213
+ return await Yn(this.apiClient, n);
1198
1214
  }
1199
1215
  /**
1200
1216
  * Returns current BLE status.
@@ -1203,70 +1219,70 @@ class Ze {
1203
1219
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1204
1220
  * @returns {Promise<BleStatusResponse>} A promise that resolves to the BLE status.
1205
1221
  */
1206
- async BleStatusGet(e) {
1207
- return await Ye(this.apiClient, e);
1222
+ async BleStatusGet(n) {
1223
+ return await Xn(this.apiClient, n);
1208
1224
  }
1209
1225
  }
1210
- async function Qe(r, e) {
1211
- const { key: n } = e, { data: t, error: i } = await s(
1212
- (o) => r.POST("/input", {
1226
+ async function Qn(e, n) {
1227
+ const { key: t } = n, { data: r, error: i } = await e.withTimeout(
1228
+ (o) => e.POST("/input", {
1213
1229
  params: {
1214
1230
  query: {
1215
- key: n
1231
+ key: t
1216
1232
  }
1217
1233
  },
1218
1234
  signal: o
1219
1235
  }),
1220
- e.timeout
1236
+ n.timeout
1221
1237
  );
1222
1238
  if (i)
1223
1239
  throw i;
1224
- return t;
1240
+ return r;
1225
1241
  }
1226
- class en {
1242
+ class ne {
1227
1243
  /**
1228
1244
  * Send input event. Send single key press event.
1229
1245
  *
1230
1246
  * @param {InputKeyParams} params - Button press parameters:
1231
- * @param {KeyName} params.key - Key name.
1247
+ * @param {InputKeyParams['key']} params.key - Key name.
1232
1248
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1233
1249
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1234
1250
  */
1235
- async InputSend(e) {
1236
- return await Qe(this.apiClient, e);
1237
- }
1238
- }
1239
- async function nn(r, e) {
1240
- const { data: n, error: t } = await s((i) => r.GET("/smart_home/pairing", { signal: i }), e == null ? void 0 : e.timeout);
1241
- if (t)
1242
- throw t;
1243
- return n;
1244
- }
1245
- async function tn(r, e) {
1246
- const { data: n, error: t } = await s((i) => r.POST("/smart_home/pairing", { signal: i }), e == null ? void 0 : e.timeout);
1247
- if (t)
1248
- throw t;
1249
- return n;
1250
- }
1251
- async function rn(r, e) {
1252
- const { data: n, error: t } = await s((i) => r.DELETE("/smart_home/pairing", { signal: i }), e == null ? void 0 : e.timeout);
1253
- if (t)
1254
- throw t;
1255
- return n;
1256
- }
1257
- async function on(r, e) {
1258
- const { data: n, error: t } = await s((i) => r.GET("/smart_home/switch", { signal: i }), e == null ? void 0 : e.timeout);
1259
- if (t)
1260
- throw t;
1261
- return n;
1262
- }
1263
- async function sn(r, e) {
1264
- const { timeout: n, ...t } = e, { data: i, error: o } = await s((a) => r.POST("/smart_home/switch", { body: t, signal: a }), n);
1251
+ async InputSend(n) {
1252
+ return await Qn(this.apiClient, n);
1253
+ }
1254
+ }
1255
+ async function ee(e, n) {
1256
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/smart_home/pairing", { signal: i }), n == null ? void 0 : n.timeout);
1257
+ if (r)
1258
+ throw r;
1259
+ return t;
1260
+ }
1261
+ async function te(e, n) {
1262
+ const { data: t, error: r } = await e.withTimeout((i) => e.POST("/smart_home/pairing", { signal: i }), n == null ? void 0 : n.timeout);
1263
+ if (r)
1264
+ throw r;
1265
+ return t;
1266
+ }
1267
+ async function re(e, n) {
1268
+ const { data: t, error: r } = await e.withTimeout((i) => e.DELETE("/smart_home/pairing", { signal: i }), n == null ? void 0 : n.timeout);
1269
+ if (r)
1270
+ throw r;
1271
+ return t;
1272
+ }
1273
+ async function ie(e, n) {
1274
+ const { data: t, error: r } = await e.withTimeout((i) => e.GET("/smart_home/switch", { signal: i }), n == null ? void 0 : n.timeout);
1275
+ if (r)
1276
+ throw r;
1277
+ return t;
1278
+ }
1279
+ async function oe(e, n) {
1280
+ const { timeout: t, ...r } = n, { data: i, error: o } = await e.withTimeout((s) => e.POST("/smart_home/switch", { body: r, signal: s }), t);
1265
1281
  if (o)
1266
1282
  throw o;
1267
1283
  return i;
1268
1284
  }
1269
- class an {
1285
+ class se {
1270
1286
  /**
1271
1287
  * Smart home commissioning status.
1272
1288
  *
@@ -1274,8 +1290,8 @@ class an {
1274
1290
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1275
1291
  * @returns {Promise<SmartHomePairingInfo>} A promise that resolves to the pairing info.
1276
1292
  */
1277
- async SmartHomePairingGet(e) {
1278
- return await nn(this.apiClient, e);
1293
+ async SmartHomePairingGet(n) {
1294
+ return await ee(this.apiClient, n);
1279
1295
  }
1280
1296
  /**
1281
1297
  * Link device to a smart home.
@@ -1283,8 +1299,8 @@ class an {
1283
1299
  * @param {TimeoutOptions} [params] - Optional timeout.
1284
1300
  * @returns {Promise<SmartHomePairingPayload>} A promise that resolves to the pairing payload.
1285
1301
  */
1286
- async SmartHomePair(e) {
1287
- return await tn(this.apiClient, e);
1302
+ async SmartHomePair(n) {
1303
+ return await te(this.apiClient, n);
1288
1304
  }
1289
1305
  /**
1290
1306
  * Erase all smart home links.
@@ -1293,8 +1309,8 @@ class an {
1293
1309
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1294
1310
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1295
1311
  */
1296
- async SmartHomeErase(e) {
1297
- return await rn(this.apiClient, e);
1312
+ async SmartHomeErase(n) {
1313
+ return await re(this.apiClient, n);
1298
1314
  }
1299
1315
  /**
1300
1316
  * Get state of emulated smart home switch.
@@ -1303,8 +1319,8 @@ class an {
1303
1319
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1304
1320
  * @returns {Promise<SmartHomeSwitchState>} A promise that resolves to the switch state.
1305
1321
  */
1306
- async SmartHomeSwitchStateGet(e) {
1307
- return await on(this.apiClient, e);
1322
+ async SmartHomeSwitchStateGet(n) {
1323
+ return await ie(this.apiClient, n);
1308
1324
  }
1309
1325
  /**
1310
1326
  * Set state of emulated smart home switch.
@@ -1312,67 +1328,67 @@ class an {
1312
1328
  * @param {SmartHomeSwitchState & TimeoutOptions} params - Switch state and optional timeout.
1313
1329
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1314
1330
  */
1315
- async SmartHomeSwitchStateSet(e) {
1316
- return await sn(this.apiClient, e);
1331
+ async SmartHomeSwitchStateSet(n) {
1332
+ return await oe(this.apiClient, n);
1317
1333
  }
1318
1334
  // ALIASES for backward compatibility (Matter -> SmartHome)
1319
1335
  /**
1320
1336
  * @deprecated Use SmartHomePairingGet instead.
1321
1337
  */
1322
- async MatterStatusGet(e) {
1323
- return await this.SmartHomePairingGet(e);
1338
+ async MatterStatusGet(n) {
1339
+ return await this.SmartHomePairingGet(n);
1324
1340
  }
1325
1341
  /**
1326
1342
  * @deprecated Use SmartHomePair instead.
1327
1343
  */
1328
- async MatterPair(e) {
1329
- return await this.SmartHomePair(e);
1344
+ async MatterPair(n) {
1345
+ return await this.SmartHomePair(n);
1330
1346
  }
1331
1347
  /**
1332
1348
  * @deprecated Use SmartHomeErase instead.
1333
1349
  */
1334
- async MatterErase(e) {
1335
- return await this.SmartHomeErase(e);
1350
+ async MatterErase(n) {
1351
+ return await this.SmartHomeErase(n);
1336
1352
  }
1337
1353
  }
1338
- async function un(r, e) {
1339
- const { application_name: n, file: t, data: i } = e, { data: o, error: a } = await s(
1340
- (c) => r.POST("/assets/upload", {
1354
+ async function ae(e, n) {
1355
+ const { application_name: t, file: r, data: i } = n, { data: o, error: s } = await e.withTimeout(
1356
+ (u) => e.POST("/assets/upload", {
1341
1357
  params: {
1342
1358
  query: {
1343
- application_name: n,
1344
- file: t
1359
+ application_name: t,
1360
+ file: r
1345
1361
  }
1346
1362
  },
1347
1363
  headers: {
1348
1364
  "Content-Type": "application/octet-stream"
1349
1365
  },
1350
1366
  body: i,
1351
- signal: c
1367
+ signal: u
1352
1368
  }),
1353
- e.timeout
1369
+ n.timeout
1354
1370
  );
1355
- if (a)
1356
- throw a;
1371
+ if (s)
1372
+ throw s;
1357
1373
  return o;
1358
1374
  }
1359
- async function ln(r, e) {
1360
- const { application_name: n } = e, { data: t, error: i } = await s(
1361
- (o) => r.DELETE("/assets/upload", {
1375
+ async function ue(e, n) {
1376
+ const { application_name: t } = n, { data: r, error: i } = await e.withTimeout(
1377
+ (o) => e.DELETE("/assets/upload", {
1362
1378
  params: {
1363
1379
  query: {
1364
- application_name: n
1380
+ application_name: t
1365
1381
  }
1366
1382
  },
1367
1383
  signal: o
1368
1384
  }),
1369
- e.timeout
1385
+ n.timeout
1370
1386
  );
1371
1387
  if (i)
1372
1388
  throw i;
1373
- return t;
1389
+ return r;
1374
1390
  }
1375
- class cn {
1391
+ class le {
1376
1392
  /**
1377
1393
  * Upload asset file with app ID. Uploads a file to a specific app's assets directory.
1378
1394
  *
@@ -1383,8 +1399,8 @@ class cn {
1383
1399
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1384
1400
  * @returns {Promise<SuccessResponse>} Result of the upload operation.
1385
1401
  */
1386
- async AssetsUpload(e) {
1387
- return await un(this.apiClient, e);
1402
+ async AssetsUpload(n) {
1403
+ return await ae(this.apiClient, n);
1388
1404
  }
1389
1405
  /**
1390
1406
  * Delete app assets. Deletes all assets for a specific app ID.
@@ -1394,28 +1410,28 @@ class cn {
1394
1410
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1395
1411
  * @returns {Promise<SuccessResponse>} Result of the delete operation.
1396
1412
  */
1397
- async AssetsDelete(e) {
1398
- return await ln(this.apiClient, e);
1413
+ async AssetsDelete(n) {
1414
+ return await ue(this.apiClient, n);
1399
1415
  }
1400
1416
  }
1401
- const N = "http://10.0.4.20", fn = "https://proxy.busy.app", dn = /^https?:\/\/proxy(?:\.(?:dev|test|stage))?\.busy\.app$/i;
1402
- function k(r) {
1403
- const e = r.split(".");
1404
- if (e.length !== 4)
1417
+ const fe = "http://10.0.4.20", ce = "https://proxy.busy.app", de = /^https?:\/\/proxy(?:\.(?:dev|test|stage))?\.busy\.app$/i;
1418
+ function pe(e) {
1419
+ const n = e.split(".");
1420
+ if (n.length !== 4)
1405
1421
  return !1;
1406
- for (const n of e) {
1407
- if (n.length === 0 || n.length > 1 && n[0] === "0" || !/^\d+$/.test(n))
1422
+ for (const t of n) {
1423
+ if (t.length === 0 || t.length > 1 && t[0] === "0" || !/^\d+$/.test(t))
1408
1424
  return !1;
1409
- const t = Number(n);
1410
- if (t < 0 || t > 255)
1425
+ const r = Number(t);
1426
+ if (r < 0 || r > 255)
1411
1427
  return !1;
1412
1428
  }
1413
1429
  return !0;
1414
1430
  }
1415
- function C(r) {
1416
- return /\.local$/i.test(r);
1431
+ function he(e) {
1432
+ return /\.local$/i.test(e);
1417
1433
  }
1418
- class pn {
1434
+ class ye {
1419
1435
  /**
1420
1436
  * Creates an instance of BUSY Bar.
1421
1437
  * Initializes the API client with the provided host address.
@@ -1437,8 +1453,13 @@ class pn {
1437
1453
  *
1438
1454
  * Must be provided when `addr` points to a secured proxy endpoint
1439
1455
  * such as `https://proxy.busy.app`.
1456
+ *
1457
+ * @param {BusyBarConfig['timeout']} config.timeout -
1458
+ * Optional default timeout for all requests in milliseconds.
1459
+ *
1460
+ * Defaults to `3000` if not provided. This value can be overridden in individual method calls.
1440
1461
  */
1441
- constructor(e) {
1462
+ constructor(n) {
1442
1463
  /**
1443
1464
  * Device host address (IP or mDNS).
1444
1465
  * @type {BusyBarConfig['host']}
@@ -1463,330 +1484,90 @@ class pn {
1463
1484
  * - "unknown": Detection failed or not yet completed.
1464
1485
  */
1465
1486
  l(this, "connectionType", "unknown");
1466
- if (!e || !e.addr && !e.token)
1467
- this.addr = N;
1468
- else if (!e.addr)
1469
- this.addr = fn;
1487
+ if (!n || !n.addr && !n.token)
1488
+ this.addr = fe;
1489
+ else if (!n.addr)
1490
+ this.addr = ce;
1470
1491
  else {
1471
- let o = e.addr.trim();
1472
- if (/^https?:\/\//i.test(o) || (o = `http://${o}`), dn.test(o) && !e.token)
1492
+ let o = n.addr.trim();
1493
+ if (/^https?:\/\//i.test(o) || (o = `http://${o}`), de.test(o) && !n.token)
1473
1494
  throw new Error("Token is required. Please provide it.");
1474
1495
  this.addr = o;
1475
1496
  }
1476
1497
  this.apiSemver = "";
1477
- const { client: n, setApiKey: t, setToken: i } = W(`${this.addr}/api/`, this.SystemVersionGet.bind(this), e == null ? void 0 : e.token);
1478
- this.apiClient = n, this.setApiKeyFn = t, this.setTokenFn = i, this.detectConnectionType();
1498
+ const { client: t, setApiKey: r, setToken: i } = M(`${this.addr}/api/`, this.SystemVersionGet.bind(this), n == null ? void 0 : n.token, n == null ? void 0 : n.timeout);
1499
+ this.apiClient = t, this.setApiKeyFn = r, this.setTokenFn = i, this.detectConnectionType();
1479
1500
  }
1480
1501
  /**
1481
1502
  * Probes the device to determine connection type.
1482
1503
  * Sends a request without authentication credentials.
1483
1504
  */
1484
1505
  async detectConnectionType() {
1485
- const e = new URL(this.addr).hostname;
1486
- if (!k(e) && !C(e)) {
1506
+ const n = new URL(this.addr).hostname;
1507
+ if (!pe(n) && !he(n)) {
1487
1508
  this.connectionType = "wifi";
1488
1509
  return;
1489
1510
  }
1490
- const n = q({
1511
+ const t = D({
1491
1512
  baseUrl: `${this.addr}/api/`
1492
1513
  });
1493
1514
  try {
1494
- const { response: t } = await n.GET("/name");
1495
- if (t.status === 401 || t.status === 403)
1515
+ const { response: r } = await t.GET("/name");
1516
+ if (r.status === 401 || r.status === 403)
1496
1517
  this.connectionType = "wifi";
1497
- else if (t.ok)
1518
+ else if (r.ok)
1498
1519
  this.connectionType = "usb";
1499
1520
  else
1500
- throw new Error(`Failed to detect connection type. Status: ${t.status}`);
1501
- } catch (t) {
1502
- throw t;
1521
+ throw new Error(`Failed to detect connection type. Status: ${r.status}`);
1522
+ } catch (r) {
1523
+ throw r;
1503
1524
  }
1504
1525
  }
1505
1526
  /**
1506
1527
  * Sets API key for all subsequent requests.
1507
1528
  * @param {string} key - API key to use in "X-API-Token" header.
1508
1529
  */
1509
- setApiKey(e) {
1510
- this.setApiKeyFn(e);
1530
+ setApiKey(n) {
1531
+ this.setApiKeyFn(n);
1511
1532
  }
1512
1533
  /**
1513
1534
  * Sets Bearer token for all subsequent requests.
1514
1535
  * @param {string} token - Bearer token to use in "Authorization" header.
1515
1536
  */
1516
- setToken(e) {
1517
- this.setTokenFn(e);
1537
+ setToken(n) {
1538
+ this.setTokenFn(n);
1518
1539
  }
1519
1540
  }
1520
- function hn(r, e) {
1521
- e.forEach((n) => {
1522
- Object.getOwnPropertyNames(n.prototype).forEach((t) => {
1523
- Object.defineProperty(r.prototype, t, Object.getOwnPropertyDescriptor(n.prototype, t) || /* @__PURE__ */ Object.create(null));
1541
+ function me(e, n) {
1542
+ n.forEach((t) => {
1543
+ Object.getOwnPropertyNames(t.prototype).forEach((r) => {
1544
+ Object.defineProperty(e.prototype, r, Object.getOwnPropertyDescriptor(t.prototype, r) || /* @__PURE__ */ Object.create(null));
1524
1545
  });
1525
1546
  });
1526
1547
  }
1527
- hn(pn, [
1528
- X,
1529
- oe,
1530
- fe,
1531
- ge,
1532
- Re,
1533
- ke,
1534
- Pe,
1535
- Ve,
1536
- Je,
1537
- Ze,
1538
- en,
1539
- an,
1540
- cn
1548
+ me(ye, [
1549
+ K,
1550
+ on,
1551
+ cn,
1552
+ gn,
1553
+ Rn,
1554
+ In,
1555
+ jn,
1556
+ Gn,
1557
+ Hn,
1558
+ Zn,
1559
+ ne,
1560
+ se,
1561
+ le
1541
1562
  ]);
1542
- var A = /* @__PURE__ */ ((r) => (r[r.FRONT = 0] = "FRONT", r[r.BACK = 1] = "BACK", r))(A || {});
1543
- const j = 3e3, P = /* @__PURE__ */ new Set([1001, 1006, 1012, 1013, 1014, 3008]);
1544
- function D(r, e) {
1545
- if (e < 0 || e >= r.length)
1546
- throw new Error(`Index ${e} is out of bounds (0…${r.length - 1})`);
1547
- const n = r[e];
1548
- if (n === void 0)
1549
- throw new Error(`Unexpected undefined at index ${e}`);
1550
- return n;
1551
- }
1552
- function yn(r, e) {
1553
- let n = 0;
1554
- const t = r.length, i = [];
1555
- for (; n < t; ) {
1556
- const o = D(r, n);
1557
- if (n += 1, (o & 128) !== 0) {
1558
- const a = o & 127;
1559
- for (let c = 0; c < a * e; c++)
1560
- i.push(r[n + c]);
1561
- n += a * e;
1562
- } else {
1563
- const a = o, c = r.slice(n, n + e);
1564
- for (let u = 0; u < a; u++)
1565
- for (let m = 0; m < e; m++)
1566
- i.push(c[m]);
1567
- n += e;
1568
- }
1569
- }
1570
- return new Uint8Array(i);
1571
- }
1572
- function mn(r) {
1573
- const e = new Uint8Array(r.length * 2);
1574
- let n = 0, t = 0;
1575
- for (; n < r.length; ) {
1576
- const i = D(r, n), o = i & 15, a = i >> 4 & 15;
1577
- e[t] = o, e[t + 1] = a, n += 1, t += 2;
1578
- }
1579
- return e;
1580
- }
1581
- const L = () => typeof window < "u" && typeof window.document < "u";
1582
- class On {
1583
- constructor(e) {
1584
- l(this, "addr");
1585
- l(this, "connected", !1);
1586
- // @ts-ignore
1587
- l(this, "apiKey");
1588
- // @ts-ignore
1589
- l(this, "apiSemver");
1590
- l(this, "dataListeners", []);
1591
- l(this, "stopListeners", []);
1592
- l(this, "errorListeners", []);
1593
- l(this, "socket", null);
1594
- if (this.config = e, !L())
1595
- throw new Error("not browser");
1596
- if (e.apiKey && (this.apiKey = e.apiKey), e.apiSemver && (this.apiSemver = e.apiSemver), !e || !e.addr)
1597
- this.addr = N;
1598
- else {
1599
- let n = e.addr.trim();
1600
- /^https?:\/\//i.test(n) || (n = `http://${n}`);
1601
- try {
1602
- const i = new URL(n).hostname;
1603
- if (!k(i) && !C(i))
1604
- throw new Error(`Invalid address: "${e.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`);
1605
- } catch (t) {
1606
- throw t instanceof Error && t.message.startsWith("Invalid address") ? t : new Error(`Invalid URL format: "${e.addr}"`);
1607
- }
1608
- this.addr = n;
1609
- }
1610
- }
1611
- onData(e) {
1612
- this.dataListeners.push(e);
1613
- }
1614
- onStop(e) {
1615
- this.stopListeners.push(e);
1616
- }
1617
- onError(e) {
1618
- this.errorListeners.push(e);
1619
- }
1620
- emitData(e) {
1621
- for (const n of this.dataListeners)
1622
- n(e);
1623
- }
1624
- emitStop() {
1625
- for (const e of this.stopListeners)
1626
- e();
1627
- }
1628
- emitError(e) {
1629
- for (const n of this.errorListeners)
1630
- n(e);
1631
- }
1632
- async openWebsocket() {
1633
- this.socket && await this.closeWebsocket();
1634
- const e = new URL(`${this.addr}/api/screen/ws`);
1635
- if (this.apiKey && e.searchParams.append("x-api-token", this.apiKey), this.apiSemver && e.searchParams.append("x-api-sem-ver", this.apiSemver), !e)
1636
- throw new Error("The WebSocket URL is not specified");
1637
- this.socket = new WebSocket(e), this.socket.onopen = () => {
1638
- this.socket && (this.socket.send(JSON.stringify({ display: this.config.deviceScreen })), this.connected = !0);
1639
- }, this.socket.binaryType = "arraybuffer", this.socket.onmessage = (n) => {
1640
- try {
1641
- if (typeof n.data == "string")
1642
- return;
1643
- const t = new Uint8Array(n.data);
1644
- let i;
1645
- const o = this.config.deviceScreen === A.FRONT ? 3 : 2;
1646
- try {
1647
- const a = yn(t, o);
1648
- this.config.deviceScreen === A.BACK ? i = mn(a) : i = a, this.emitData(i);
1649
- } catch {
1650
- this.emitData(t);
1651
- }
1652
- } catch {
1653
- this.connected = !1, this.emitStop();
1654
- }
1655
- }, this.socket.onerror = (n) => {
1656
- this.connected = !1, this.emitError({
1657
- code: 1006,
1658
- // Standard «abnormal closure» code per RFC-6455
1659
- message: "WebSocket error occurred",
1660
- raw: n
1661
- }), this.emitStop();
1662
- }, this.socket.onclose = async (n) => {
1663
- if (this.socket = null, this.connected = !1, n.code === j || P.has(n.code)) {
1664
- this.emitError({
1665
- code: n.code,
1666
- message: n.reason,
1667
- raw: n
1668
- });
1669
- return;
1670
- }
1671
- this.emitStop();
1672
- };
1673
- }
1674
- closeWebsocket() {
1675
- return this.connected = !1, new Promise((e) => {
1676
- this.socket ? (this.socket.onclose = () => {
1677
- e();
1678
- }, this.socket.close(), this.socket = null) : e(), this.emitStop();
1679
- });
1680
- }
1681
- }
1682
- class wn {
1683
- constructor(e) {
1684
- l(this, "addr");
1685
- l(this, "connected", !1);
1686
- // @ts-ignore
1687
- l(this, "apiKey");
1688
- // @ts-ignore
1689
- l(this, "apiSemver");
1690
- l(this, "inputEvent");
1691
- l(this, "dataListeners", []);
1692
- l(this, "stopListeners", []);
1693
- l(this, "errorListeners", []);
1694
- l(this, "socket", null);
1695
- if (!L())
1696
- throw new Error("not browser");
1697
- if (e != null && e.apiKey && (this.apiKey = e.apiKey), e != null && e.apiSemver && (this.apiSemver = e.apiSemver), !e || !e.addr)
1698
- this.addr = N;
1699
- else {
1700
- let n = e.addr.trim();
1701
- /^https?:\/\//i.test(n) || (n = `http://${n}`);
1702
- try {
1703
- const i = new URL(n).hostname;
1704
- if (!k(i) && !C(i))
1705
- throw new Error(`Invalid address: "${e.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`);
1706
- } catch (t) {
1707
- throw t instanceof Error && t.message.startsWith("Invalid address") ? t : new Error(`Invalid URL format: "${e.addr}"`);
1708
- }
1709
- this.addr = n;
1710
- }
1711
- this.inputEvent = {};
1712
- }
1713
- onData(e) {
1714
- this.dataListeners.push(e);
1715
- }
1716
- onStop(e) {
1717
- this.stopListeners.push(e);
1718
- }
1719
- onError(e) {
1720
- this.errorListeners.push(e);
1721
- }
1722
- emitData(e) {
1723
- for (const n of this.dataListeners)
1724
- n(e);
1725
- }
1726
- emitStop() {
1727
- for (const e of this.stopListeners)
1728
- e();
1729
- }
1730
- emitError(e) {
1731
- for (const n of this.errorListeners)
1732
- n(e);
1733
- }
1734
- async openWebsocket() {
1735
- this.socket && await this.closeWebsocket();
1736
- const e = new URL(`${this.addr}/api/input`);
1737
- if (this.apiKey && e.searchParams.append("x-api-token", this.apiKey), this.apiSemver && e.searchParams.append("x-api-sem-ver", this.apiSemver), !e)
1738
- throw new Error("The WebSocket URL is not specified");
1739
- this.socket = new WebSocket(e), this.socket.onopen = () => {
1740
- this.socket && (this.connected = !0);
1741
- }, this.socket.binaryType = "arraybuffer", this.socket.onmessage = (n) => {
1742
- try {
1743
- if (typeof n.data == "string")
1744
- return;
1745
- const t = new Uint8Array(n.data);
1746
- this.emitData(t);
1747
- } catch {
1748
- this.connected = !1, this.emitStop();
1749
- }
1750
- }, this.socket.onerror = (n) => {
1751
- this.connected = !1, this.emitError({
1752
- code: 1006,
1753
- // Standard «abnormal closure» code per RFC-6455
1754
- message: "WebSocket error occurred",
1755
- raw: n
1756
- }), this.emitStop();
1757
- }, this.socket.onclose = async (n) => {
1758
- if (this.socket = null, this.connected = !1, n.code === j || P.has(n.code)) {
1759
- this.emitError({
1760
- code: n.code,
1761
- message: n.reason,
1762
- raw: n
1763
- });
1764
- return;
1765
- }
1766
- this.emitStop();
1767
- };
1768
- }
1769
- sendInput({ keyName: e, value: n }) {
1770
- if (!this.socket || !this.connected)
1771
- throw new Error("WebSocket: Not connected");
1772
- this.inputEvent[e] = n, this.socket.send(JSON.stringify(this.inputEvent)), n === 0 && delete this.inputEvent[e];
1773
- }
1774
- closeWebsocket() {
1775
- return this.connected = !1, new Promise((e) => {
1776
- this.socket ? (this.socket.onclose = () => {
1777
- e();
1778
- }, this.socket.close(), this.socket = null) : e(), this.emitStop();
1779
- });
1780
- }
1781
- }
1782
- var d = /* @__PURE__ */ ((r) => (r.CONNECTION_FAILED = "CONNECTION_FAILED", r.RECONNECT_FAILED = "RECONNECT_FAILED", r.CONNECTION_LOST = "CONNECTION_LOST", r.CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_REFRESH_FAILED = "AUTH_REFRESH_FAILED", r.DEVICE_ERROR = "DEVICE_ERROR", r.DECODE_ERROR = "DECODE_ERROR", r.FRAME_PROCESS_ERROR = "FRAME_PROCESS_ERROR", r.STREAM_ALREADY_STARTED = "STREAM_ALREADY_STARTED", r.WORKER_INIT_FAILED = "WORKER_INIT_FAILED", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(d || {});
1563
+ var c = /* @__PURE__ */ ((e) => (e.CONNECTION_FAILED = "CONNECTION_FAILED", e.RECONNECT_FAILED = "RECONNECT_FAILED", e.CONNECTION_LOST = "CONNECTION_LOST", e.CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT", e.AUTH_FAILED = "AUTH_FAILED", e.AUTH_REFRESH_FAILED = "AUTH_REFRESH_FAILED", e.DEVICE_ERROR = "DEVICE_ERROR", e.DECODE_ERROR = "DECODE_ERROR", e.FRAME_PROCESS_ERROR = "FRAME_PROCESS_ERROR", e.STREAM_ALREADY_STARTED = "STREAM_ALREADY_STARTED", e.WORKER_INIT_FAILED = "WORKER_INIT_FAILED", e.UNKNOWN_ERROR = "UNKNOWN_ERROR", e))(c || {});
1783
1564
  class y extends Error {
1784
- constructor(e, n, t) {
1785
- super(n), this.code = e, this.data = t, this.name = "StateStreamError";
1565
+ constructor(n, t, r) {
1566
+ super(t), this.code = n, this.data = r, this.name = "StateStreamError";
1786
1567
  }
1787
1568
  }
1788
- var p = /* @__PURE__ */ ((r) => (r.IDLE = "IDLE", r.STARTING = "STARTING", r.RUNNING = "RUNNING", r.STOPPED = "STOPPED", r.FAILED = "FAILED", r))(p || {}), v = /* @__PURE__ */ ((r) => (r.DISCONNECTED = "DISCONNECTED", r.CONNECTING = "CONNECTING", r.CONNECTED = "CONNECTED", r.RECONNECTING = "RECONNECTING", r))(v || {}), E = /* @__PURE__ */ ((r) => (r.UNAUTHENTICATED = "UNAUTHENTICATED", r.AUTHENTICATING = "AUTHENTICATING", r.AUTHENTICATED = "AUTHENTICATED", r.FAILED = "FAILED", r))(E || {}), _ = /* @__PURE__ */ ((r) => (r.NONE = "NONE", r.ACTIVE = "ACTIVE", r.STALE = "STALE", r))(_ || {}), O = /* @__PURE__ */ ((r) => (r.OFF = "OFF", r.INITIALIZING = "INITIALIZING", r.READY = "READY", r.ERROR = "ERROR", r))(O || {});
1789
- const x = `var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, src = { exports: {} }, indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
1569
+ var d = /* @__PURE__ */ ((e) => (e.IDLE = "IDLE", e.STARTING = "STARTING", e.RUNNING = "RUNNING", e.STOPPED = "STOPPED", e.FAILED = "FAILED", e))(d || {}), m = /* @__PURE__ */ ((e) => (e.DISCONNECTED = "DISCONNECTED", e.CONNECTING = "CONNECTING", e.CONNECTED = "CONNECTED", e.RECONNECTING = "RECONNECTING", e))(m || {}), b = /* @__PURE__ */ ((e) => (e.UNAUTHENTICATED = "UNAUTHENTICATED", e.AUTHENTICATING = "AUTHENTICATING", e.AUTHENTICATED = "AUTHENTICATED", e.FAILED = "FAILED", e))(b || {}), E = /* @__PURE__ */ ((e) => (e.NONE = "NONE", e.ACTIVE = "ACTIVE", e.STALE = "STALE", e))(E || {}), _ = /* @__PURE__ */ ((e) => (e.OFF = "OFF", e.INITIALIZING = "INITIALIZING", e.READY = "READY", e.ERROR = "ERROR", e))(_ || {});
1570
+ const L = `var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, src = { exports: {} }, indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
1790
1571
  function requireAspromise() {
1791
1572
  if (hasRequiredAspromise) return aspromise;
1792
1573
  hasRequiredAspromise = 1, aspromise = u;
@@ -5693,10 +5474,12 @@ function connect(u, f, h = !0, c = "local") {
5693
5474
  code: StateStreamErrorCode.DEVICE_ERROR,
5694
5475
  message: \`Server reported \${E}: \${y}\`,
5695
5476
  data: l.error
5696
- }), a === p.values.FATAL || a === p.values.ERROR) {
5477
+ }), a === p.values.FATAL) {
5697
5478
  stopAndCleanup();
5698
5479
  return;
5699
5480
  }
5481
+ if (a === p.values.ERROR)
5482
+ return;
5700
5483
  } else
5701
5484
  broadcast({
5702
5485
  type: "ERROR",
@@ -5727,7 +5510,12 @@ function connect(u, f, h = !0, c = "local") {
5727
5510
  } : { type: "DATA", data: l });
5728
5511
  }
5729
5512
  } catch (e) {
5730
- broadcast({ type: "ERROR", code: StateStreamErrorCode.DECODE_ERROR, message: \`Decode error: \${String(e)}\` });
5513
+ broadcast({
5514
+ type: "ERROR",
5515
+ code: StateStreamErrorCode.DECODE_ERROR,
5516
+ message: \`Decode error: \${String(e)}\`,
5517
+ data: n.data
5518
+ });
5731
5519
  }
5732
5520
  }).catch(console.error);
5733
5521
  }, socket.onerror = () => {
@@ -5811,29 +5599,29 @@ if ("SharedWorkerGlobalScope" in self) {
5811
5599
  handleCommand(f.data, u);
5812
5600
  };
5813
5601
  }
5814
- `, I = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", x], { type: "text/javascript;charset=utf-8" });
5815
- function vn(r) {
5816
- let e;
5602
+ `, N = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", L], { type: "text/javascript;charset=utf-8" });
5603
+ function ve(e) {
5604
+ let n;
5817
5605
  try {
5818
- if (e = I && (self.URL || self.webkitURL).createObjectURL(I), !e) throw "";
5819
- const n = new Worker(e, {
5606
+ if (n = N && (self.URL || self.webkitURL).createObjectURL(N), !n) throw "";
5607
+ const t = new Worker(n, {
5820
5608
  type: "module",
5821
- name: r == null ? void 0 : r.name
5609
+ name: e == null ? void 0 : e.name
5822
5610
  });
5823
- return n.addEventListener("error", () => {
5824
- (self.URL || self.webkitURL).revokeObjectURL(e);
5825
- }), n;
5611
+ return t.addEventListener("error", () => {
5612
+ (self.URL || self.webkitURL).revokeObjectURL(n);
5613
+ }), t;
5826
5614
  } catch {
5827
5615
  return new Worker(
5828
- "data:text/javascript;charset=utf-8," + encodeURIComponent(x),
5616
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(L),
5829
5617
  {
5830
5618
  type: "module",
5831
- name: r == null ? void 0 : r.name
5619
+ name: e == null ? void 0 : e.name
5832
5620
  }
5833
5621
  );
5834
5622
  }
5835
5623
  }
5836
- const gn = `var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, src = { exports: {} }, indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
5624
+ const ge = `var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, src = { exports: {} }, indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise, hasRequiredAspromise;
5837
5625
  function requireAspromise() {
5838
5626
  if (hasRequiredAspromise) return aspromise;
5839
5627
  hasRequiredAspromise = 1, aspromise = u;
@@ -9740,10 +9528,12 @@ function connect(u, f, h = !0, c = "local") {
9740
9528
  code: StateStreamErrorCode.DEVICE_ERROR,
9741
9529
  message: \`Server reported \${E}: \${y}\`,
9742
9530
  data: l.error
9743
- }), a === p.values.FATAL || a === p.values.ERROR) {
9531
+ }), a === p.values.FATAL) {
9744
9532
  stopAndCleanup();
9745
9533
  return;
9746
9534
  }
9535
+ if (a === p.values.ERROR)
9536
+ return;
9747
9537
  } else
9748
9538
  broadcast({
9749
9539
  type: "ERROR",
@@ -9774,7 +9564,12 @@ function connect(u, f, h = !0, c = "local") {
9774
9564
  } : { type: "DATA", data: l });
9775
9565
  }
9776
9566
  } catch (e) {
9777
- broadcast({ type: "ERROR", code: StateStreamErrorCode.DECODE_ERROR, message: \`Decode error: \${String(e)}\` });
9567
+ broadcast({
9568
+ type: "ERROR",
9569
+ code: StateStreamErrorCode.DECODE_ERROR,
9570
+ message: \`Decode error: \${String(e)}\`,
9571
+ data: n.data
9572
+ });
9778
9573
  }
9779
9574
  }).catch(console.error);
9780
9575
  }, socket.onerror = () => {
@@ -9859,17 +9654,17 @@ if ("SharedWorkerGlobalScope" in self) {
9859
9654
  };
9860
9655
  }
9861
9656
  `;
9862
- function bn(r) {
9657
+ function be(e) {
9863
9658
  return new SharedWorker(
9864
- "data:text/javascript;charset=utf-8," + encodeURIComponent(gn),
9659
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(ge),
9865
9660
  {
9866
9661
  type: "module",
9867
- name: r == null ? void 0 : r.name
9662
+ name: e == null ? void 0 : e.name
9868
9663
  }
9869
9664
  );
9870
9665
  }
9871
- const g = class g {
9872
- constructor(e, n) {
9666
+ const v = class v {
9667
+ constructor(n, t) {
9873
9668
  l(this, "addr");
9874
9669
  l(this, "token");
9875
9670
  l(this, "isBinary");
@@ -9884,12 +9679,12 @@ const g = class g {
9884
9679
  l(this, "rawDataCallback");
9885
9680
  l(this, "errorCallback");
9886
9681
  l(this, "statusCallback");
9887
- this.addr = e.addr || "", this.token = e.token, this.isBinary = e.isBinary ?? !0, this.connectTimeout = (n == null ? void 0 : n.timeout) ?? 5e3, this.dataTimeout = (n == null ? void 0 : n.dataTimeout) ?? 15e3, this._status = {
9888
- main: { status: p.IDLE },
9889
- connection: { status: v.DISCONNECTED },
9890
- auth: { status: E.UNAUTHENTICATED },
9891
- data: { status: _.NONE },
9892
- worker: { status: O.OFF }
9682
+ this.addr = n.addr || "", this.token = n.token, this.isBinary = n.isBinary ?? !0, this.connectTimeout = (t == null ? void 0 : t.timeout) ?? 5e3, this.dataTimeout = (t == null ? void 0 : t.dataTimeout) ?? 15e3, this._status = {
9683
+ main: { status: d.IDLE },
9684
+ connection: { status: m.DISCONNECTED },
9685
+ auth: { status: b.UNAUTHENTICATED },
9686
+ data: { status: E.NONE },
9687
+ worker: { status: _.OFF }
9893
9688
  };
9894
9689
  }
9895
9690
  get status() {
@@ -9898,39 +9693,39 @@ const g = class g {
9898
9693
  /**
9899
9694
  * Transforms http/https to ws/wss and prefixes with auto-inferred protocol if no protocol present.
9900
9695
  */
9901
- resolveProtocol(e) {
9902
- let n = e.trim();
9903
- if (n.startsWith("https://"))
9904
- return n.replace("https://", "wss://");
9905
- if (n.startsWith("http://"))
9906
- return n.replace("http://", "ws://");
9907
- if (n.startsWith("wss://") || n.startsWith("ws://"))
9908
- return n;
9909
- let t = "ws:";
9910
- return typeof window < "u" && window.location.protocol === "https:" && (t = "wss:"), `${t}//${n}`;
9696
+ resolveProtocol(n) {
9697
+ let t = n.trim();
9698
+ if (t.startsWith("https://"))
9699
+ return t.replace("https://", "wss://");
9700
+ if (t.startsWith("http://"))
9701
+ return t.replace("http://", "ws://");
9702
+ if (t.startsWith("wss://") || t.startsWith("ws://"))
9703
+ return t;
9704
+ let r = "ws:";
9705
+ return typeof window < "u" && window.location.protocol === "https:" && (r = "wss:"), `${r}//${t}`;
9911
9706
  }
9912
9707
  /**
9913
9708
  * Starts the stream connection.
9914
9709
  * Throws an error if already running.
9915
9710
  */
9916
9711
  start({
9917
- dataCallback: e,
9918
- rawDataCallback: n,
9919
- errorCallback: t,
9712
+ dataCallback: n,
9713
+ rawDataCallback: t,
9714
+ errorCallback: r,
9920
9715
  statusCallback: i
9921
9716
  }) {
9922
- if (this._status.main.status === p.STARTING || this._status.main.status === p.RUNNING) {
9923
- const o = new y(d.STREAM_ALREADY_STARTED, "StateStream is already running. Call stop() before starting again.");
9717
+ if (this._status.main.status === d.STARTING || this._status.main.status === d.RUNNING) {
9718
+ const o = new y(c.STREAM_ALREADY_STARTED, "StateStream is already running. Call stop() before starting again.");
9924
9719
  if (i && i({
9925
9720
  ...this._status,
9926
9721
  main: { ...this._status.main, lastError: o }
9927
- }), t)
9928
- t(o);
9722
+ }), r)
9723
+ r(o);
9929
9724
  else
9930
9725
  throw o;
9931
9726
  return;
9932
9727
  }
9933
- this.dataCallback = e, this.rawDataCallback = n, this.errorCallback = t, this.statusCallback = i, this.updateStatusComponent("main", { status: p.STARTING, lastError: void 0 });
9728
+ this.dataCallback = n, this.rawDataCallback = t, this.errorCallback = r, this.statusCallback = i, this.updateStatusComponent("main", { status: d.STARTING, lastError: void 0 });
9934
9729
  try {
9935
9730
  this.ensureWorker(), this.sendCommand({
9936
9731
  type: "START",
@@ -9939,19 +9734,19 @@ const g = class g {
9939
9734
  isBinary: this.isBinary,
9940
9735
  mode: this.streamMode
9941
9736
  }), this.clearConnectionTimer(), this.connectionTimer = setTimeout(() => {
9942
- const o = new y(d.CONNECTION_TIMEOUT, `Connection timed out after ${this.connectTimeout}ms`);
9737
+ const o = new y(c.CONNECTION_TIMEOUT, `Connection timed out after ${this.connectTimeout}ms`);
9943
9738
  this.mapErrorToStatus(o), this.errorCallback && this.errorCallback(o), this.stop();
9944
9739
  }, this.connectTimeout);
9945
9740
  } catch (o) {
9946
- const a = o instanceof y ? o : new y(d.UNKNOWN_ERROR, String(o));
9947
- this.errorCallback && this.errorCallback(a);
9741
+ const s = o instanceof y ? o : new y(c.UNKNOWN_ERROR, String(o));
9742
+ this.errorCallback && this.errorCallback(s);
9948
9743
  }
9949
9744
  }
9950
9745
  /**
9951
9746
  * Stops the stream connection.
9952
9747
  */
9953
9748
  stop() {
9954
- this.clearConnectionTimer(), this.clearDataTimer(), !(this._status.main.status === p.IDLE || this._status.main.status === p.STOPPED) && (this.updateStatusComponent("main", { status: p.STOPPED }), this.updateStatusComponent("connection", { status: v.DISCONNECTED }), this.sendCommand({ type: "STOP" }), this.clearCallbacks());
9749
+ this.clearConnectionTimer(), this.clearDataTimer(), !(this._status.main.status === d.IDLE || this._status.main.status === d.STOPPED) && (this.updateStatusComponent("main", { status: d.STOPPED }), this.updateStatusComponent("connection", { status: m.DISCONNECTED }), this.sendCommand({ type: "STOP" }), this.clearCallbacks());
9955
9750
  }
9956
9751
  /**
9957
9752
  * Cleans up all resources.
@@ -9968,87 +9763,87 @@ const g = class g {
9968
9763
  /**
9969
9764
  * Sends a new token to the worker (for auth or token refresh).
9970
9765
  */
9971
- sendToken(e) {
9972
- this.token = e, this.sendCommand({ type: "UPDATE_TOKEN", token: e });
9766
+ sendToken(n) {
9767
+ this.token = n, this.sendCommand({ type: "UPDATE_TOKEN", token: n });
9973
9768
  }
9974
9769
  /**
9975
9770
  * Sends a command to the worker port.
9976
9771
  */
9977
- sendCommand(e) {
9978
- this.worker && this.worker.port.postMessage(e);
9772
+ sendCommand(n) {
9773
+ this.worker && this.worker.port.postMessage(n);
9979
9774
  }
9980
9775
  ensureWorker() {
9981
9776
  if (this.worker || typeof window > "u") return;
9982
- const e = btoa(this.addr);
9777
+ const n = btoa(this.addr);
9983
9778
  try {
9984
- if (this.updateStatusComponent("worker", { status: O.INITIALIZING, lastError: void 0 }), window.SharedWorker) {
9985
- const n = new bn({
9986
- name: e
9779
+ if (this.updateStatusComponent("worker", { status: _.INITIALIZING, lastError: void 0 }), window.SharedWorker) {
9780
+ const t = new be({
9781
+ name: n
9987
9782
  });
9988
9783
  this.worker = {
9989
- port: n.port
9990
- }, n.port.onmessage = (t) => {
9991
- this.handleWorkerMessage(t.data);
9992
- }, n.port.start();
9784
+ port: t.port
9785
+ }, t.port.onmessage = (r) => {
9786
+ this.handleWorkerMessage(r.data);
9787
+ }, t.port.start();
9993
9788
  } else {
9994
- const n = new vn();
9789
+ const t = new ve();
9995
9790
  this.worker = {
9996
- port: n,
9997
- terminate: () => n.terminate()
9998
- }, n.onmessage = (t) => {
9999
- this.handleWorkerMessage(t.data);
9791
+ port: t,
9792
+ terminate: () => t.terminate()
9793
+ }, t.onmessage = (r) => {
9794
+ this.handleWorkerMessage(r.data);
10000
9795
  };
10001
9796
  }
10002
- this.updateStatusComponent("worker", { status: O.READY });
10003
- } catch (n) {
10004
- const t = new y(d.WORKER_INIT_FAILED, `Failed to initialize worker: ${String(n)}`);
10005
- throw this.updateStatusComponent("worker", { status: O.ERROR, lastError: t }), this.updateStatusComponent("main", { status: p.FAILED, lastError: t }), t;
9797
+ this.updateStatusComponent("worker", { status: _.READY });
9798
+ } catch (t) {
9799
+ const r = new y(c.WORKER_INIT_FAILED, `Failed to initialize worker: ${String(t)}`);
9800
+ throw this.updateStatusComponent("worker", { status: _.ERROR, lastError: r }), this.updateStatusComponent("main", { status: d.FAILED, lastError: r }), r;
10006
9801
  }
10007
9802
  }
10008
9803
  /**
10009
9804
  * Processes messages from the worker.
10010
9805
  */
10011
- handleWorkerMessage(e) {
10012
- switch (e.type) {
9806
+ handleWorkerMessage(n) {
9807
+ switch (n.type) {
10013
9808
  case "DATA":
10014
- this.resetDataTimer(), this.dataCallback && this.dataCallback(this.normalizeState(e.data));
9809
+ this.resetDataTimer(), this.dataCallback && this.dataCallback(this.normalizeState(n.data));
10015
9810
  break;
10016
9811
  case "RAW_DATA":
10017
- this.resetDataTimer(), this.rawDataCallback && this.rawDataCallback(e.data);
9812
+ this.resetDataTimer(), this.rawDataCallback && this.rawDataCallback(n.data);
10018
9813
  break;
10019
9814
  case "CONNECTED":
10020
- this.clearConnectionTimer(), this.updateStatusComponent("connection", { status: v.CONNECTED }), this.streamMode === "local" && this.updateStatusComponent("main", { status: p.RUNNING });
9815
+ this.clearConnectionTimer(), this.updateStatusComponent("connection", { status: m.CONNECTED }), this.streamMode === "local" && this.updateStatusComponent("main", { status: d.RUNNING });
10021
9816
  break;
10022
9817
  case "STATUS_UPDATE":
10023
- e.connection && this.updateStatusComponent("connection", { status: e.connection }), e.auth && (this.updateStatusComponent("auth", { status: e.auth }), e.auth === E.AUTHENTICATED && this.updateStatusComponent("main", { status: p.RUNNING }));
9818
+ n.connection && this.updateStatusComponent("connection", { status: n.connection }), n.auth && (this.updateStatusComponent("auth", { status: n.auth }), n.auth === b.AUTHENTICATED && this.updateStatusComponent("main", { status: d.RUNNING }));
10024
9819
  break;
10025
9820
  case "ERROR": {
10026
9821
  this.clearConnectionTimer();
10027
- const n = new y(e.code, e.message, e.data);
10028
- this.mapErrorToStatus(n), this.errorCallback && this.errorCallback(n);
9822
+ const t = new y(n.code, n.message, n.data);
9823
+ this.mapErrorToStatus(t), this.errorCallback && this.errorCallback(t);
10029
9824
  break;
10030
9825
  }
10031
9826
  case "TOKEN_EXPIRED":
10032
- this.updateStatusComponent("auth", { status: E.AUTHENTICATING }), this.handleTokenExpiredInternal();
9827
+ this.updateStatusComponent("auth", { status: b.AUTHENTICATING }), this.handleTokenExpiredInternal();
10033
9828
  break;
10034
9829
  case "DISCONNECTED":
10035
- this.updateStatusComponent("connection", { status: v.DISCONNECTED });
9830
+ this.updateStatusComponent("connection", { status: m.DISCONNECTED });
10036
9831
  break;
10037
9832
  }
10038
9833
  }
10039
9834
  /**
10040
9835
  * Maps an error code to the corresponding status component
10041
9836
  */
10042
- mapErrorToStatus(e) {
10043
- const n = e.code;
10044
- (n === d.CONNECTION_FAILED || n === d.CONNECTION_LOST || n === d.RECONNECT_FAILED || n === d.CONNECTION_TIMEOUT) && (this.updateStatusComponent("connection", { status: v.DISCONNECTED, lastError: e }), this.updateStatusComponent("main", { status: p.FAILED, lastError: e })), (n === d.AUTH_FAILED || n === d.AUTH_REFRESH_FAILED) && (this.updateStatusComponent("auth", { status: E.FAILED, lastError: e }), this.updateStatusComponent("main", { status: p.FAILED, lastError: e })), (n === d.DEVICE_ERROR || n === d.DECODE_ERROR) && this.updateStatusComponent("main", { lastError: e });
9837
+ mapErrorToStatus(n) {
9838
+ const t = n.code;
9839
+ (t === c.CONNECTION_FAILED || t === c.CONNECTION_LOST || t === c.RECONNECT_FAILED || t === c.CONNECTION_TIMEOUT) && (this.updateStatusComponent("connection", { status: m.DISCONNECTED, lastError: n }), this.updateStatusComponent("main", { status: d.FAILED, lastError: n })), (t === c.AUTH_FAILED || t === c.AUTH_REFRESH_FAILED) && (this.updateStatusComponent("auth", { status: b.FAILED, lastError: n }), this.updateStatusComponent("main", { status: d.FAILED, lastError: n })), (t === c.DEVICE_ERROR || t === c.DECODE_ERROR) && this.updateStatusComponent("main", { lastError: n });
10045
9840
  }
10046
9841
  /**
10047
9842
  * Updates a single component of the status and notifies listeners
10048
9843
  */
10049
- updateStatusComponent(e, n) {
10050
- const t = this._status[e];
10051
- this._status[e] = { ...t, ...n }, this.statusCallback && this.statusCallback({ ...this._status });
9844
+ updateStatusComponent(n, t) {
9845
+ const r = this._status[n];
9846
+ this._status[n] = { ...r, ...t }, this.statusCallback && this.statusCallback({ ...this._status });
10052
9847
  }
10053
9848
  /**
10054
9849
  * Safe timer cleanup
@@ -10060,11 +9855,11 @@ const g = class g {
10060
9855
  * Reset the data inactivity timer
10061
9856
  */
10062
9857
  resetDataTimer() {
10063
- this.clearDataTimer(), this._status.data.status !== _.ACTIVE ? this.updateStatusComponent("data", {
10064
- status: _.ACTIVE,
9858
+ this.clearDataTimer(), this._status.data.status !== E.ACTIVE ? this.updateStatusComponent("data", {
9859
+ status: E.ACTIVE,
10065
9860
  lastActivity: Date.now()
10066
9861
  }) : this._status.data.lastActivity = Date.now(), this.dataTimer = setTimeout(() => {
10067
- this.updateStatusComponent("data", { status: _.STALE });
9862
+ this.updateStatusComponent("data", { status: E.STALE });
10068
9863
  }, this.dataTimeout);
10069
9864
  }
10070
9865
  clearDataTimer() {
@@ -10074,98 +9869,99 @@ const g = class g {
10074
9869
  * Normalizes the raw state from the worker into a ProcessedState for the UI.
10075
9870
  * Extracts the 'state' key for each update and merges bar_id for remote mode.
10076
9871
  */
10077
- normalizeState(e) {
10078
- let n, t;
10079
- "bar_id" in e && "state" in e ? (n = e.state, t = e.bar_id) : n = e;
10080
- let i = n.updates;
9872
+ normalizeState(n) {
9873
+ let t, r;
9874
+ "bar_id" in n && "state" in n ? (t = n.state, r = n.bar_id) : t = n;
9875
+ let i = t.updates;
10081
9876
  return i && (i = i.map((o) => {
10082
- const a = Object.keys(o).find((c) => o[c] != null);
9877
+ const s = Object.keys(o).find((u) => o[u] != null);
10083
9878
  return {
10084
9879
  ...o,
10085
- state: a
9880
+ state: s
10086
9881
  };
10087
9882
  })), {
10088
- ...n,
9883
+ ...t,
10089
9884
  updates: i,
10090
- bar_id: t
9885
+ bar_id: r
10091
9886
  };
10092
9887
  }
10093
9888
  /**
10094
9889
  * Internally deduplicates token refresh requests for the same address.
10095
9890
  */
10096
9891
  async handleTokenExpiredInternal() {
10097
- const e = this.addr;
10098
- let n = g.tokenRefreshPromises.get(e);
10099
- if (!n && this.onTokenExpired && (n = (async () => {
9892
+ const n = this.addr;
9893
+ let t = v.tokenRefreshPromises.get(n);
9894
+ if (!t && this.onTokenExpired && (t = (async () => {
10100
9895
  try {
10101
9896
  const i = this.onTokenExpired();
10102
9897
  return i instanceof Promise ? await i : "";
10103
9898
  } finally {
10104
- g.tokenRefreshPromises.delete(e);
9899
+ v.tokenRefreshPromises.delete(n);
10105
9900
  }
10106
- })(), g.tokenRefreshPromises.set(e, n)), n) {
10107
- const t = await n;
10108
- t && this.sendToken(t);
9901
+ })(), v.tokenRefreshPromises.set(n, t)), t) {
9902
+ const r = await t;
9903
+ r && this.sendToken(r);
10109
9904
  }
10110
9905
  }
10111
9906
  };
10112
9907
  /** Static map to deduplicate token refresh requests across all instances in this JS context */
10113
- l(g, "tokenRefreshPromises", /* @__PURE__ */ new Map());
10114
- let w = g;
10115
- class Rn extends w {
10116
- constructor(n = {}, t) {
10117
- let i = n.addr;
9908
+ l(v, "tokenRefreshPromises", /* @__PURE__ */ new Map());
9909
+ let O = v;
9910
+ class Te extends O {
9911
+ constructor(t = {}, r) {
9912
+ let i = t.addr;
10118
9913
  i || (typeof window < "u" ? i = window.location.origin : i = "10.0.4.20");
10119
9914
  super(
10120
9915
  {
10121
9916
  isBinary: !0,
10122
9917
  // Default for local is binary
10123
- ...n,
9918
+ ...t,
10124
9919
  addr: i
10125
9920
  },
10126
- t
9921
+ r
10127
9922
  );
10128
9923
  l(this, "streamMode", "local");
10129
9924
  }
10130
9925
  /**
10131
9926
  * Normalizes the address to use ws:// protocol and adds default path if missing.
9927
+ * Adds x-api-token query parameter if token is provided.
10132
9928
  */
10133
- normalizeUrl(n) {
10134
- const t = this.resolveProtocol(n), i = new URL(t);
10135
- return (i.pathname === "/" || !i.pathname) && (i.pathname = "/api/status/ws"), i.toString();
9929
+ normalizeUrl(t) {
9930
+ const r = this.resolveProtocol(t), i = new URL(r);
9931
+ return (i.pathname === "/" || !i.pathname) && (i.pathname = "/api/status/ws"), this.token && i.searchParams.set("x-api-token", this.token), i.toString();
10136
9932
  }
10137
9933
  }
10138
- class Tn extends w {
10139
- constructor(n, t) {
9934
+ class Oe extends O {
9935
+ constructor(t, r) {
10140
9936
  super(
10141
9937
  {
10142
9938
  isBinary: !1,
10143
9939
  // Default for remote is JSON
10144
- ...n
9940
+ ...t
10145
9941
  },
10146
- t
9942
+ r
10147
9943
  );
10148
9944
  l(this, "streamMode", "remote");
10149
9945
  l(this, "tokenProvider");
10150
- this.tokenProvider = n.tokenProvider;
9946
+ this.tokenProvider = t.tokenProvider;
10151
9947
  }
10152
9948
  /**
10153
9949
  * Subscribes to updates for a specific device GUID.
10154
9950
  */
10155
- subscribe(n) {
10156
- this.sendCommand({ type: "SUBSCRIBE", guid: n });
9951
+ subscribe(t) {
9952
+ this.sendCommand({ type: "SUBSCRIBE", guid: t });
10157
9953
  }
10158
9954
  /**
10159
9955
  * Unsubscribes from updates for a specific device GUID.
10160
9956
  */
10161
- unsubscribe(n) {
10162
- this.sendCommand({ type: "UNSUBSCRIBE", guid: n });
9957
+ unsubscribe(t) {
9958
+ this.sendCommand({ type: "UNSUBSCRIBE", guid: t });
10163
9959
  }
10164
9960
  /**
10165
9961
  * Standardizes the address to use wss:// or ws:// protocol.
10166
9962
  */
10167
- normalizeUrl(n) {
10168
- return this.resolveProtocol(n);
9963
+ normalizeUrl(t) {
9964
+ return this.resolveProtocol(t);
10169
9965
  }
10170
9966
  /**
10171
9967
  * Handles token expiration by invoking the tokenProvider.
@@ -10173,13 +9969,79 @@ class Tn extends w {
10173
9969
  */
10174
9970
  onTokenExpired() {
10175
9971
  if (this.tokenProvider)
10176
- return this.tokenProvider().then((n) => (this.sendToken(n), n)).catch((n) => {
10177
- const t = `Failed to refresh token: ${n.message}`;
10178
- throw this.errorCallback && this.errorCallback(new y(d.AUTH_REFRESH_FAILED, t)), n;
9972
+ return this.tokenProvider().then((t) => (this.sendToken(t), t)).catch((t) => {
9973
+ const r = `Failed to refresh token: ${t.message}`;
9974
+ throw this.errorCallback && this.errorCallback(new y(c.AUTH_REFRESH_FAILED, r)), t;
10179
9975
  });
10180
9976
  }
10181
9977
  }
10182
- const b = class b {
9978
+ var I;
9979
+ ((e) => {
9980
+ ((n) => {
9981
+ n[n.DISCHARGING = 0] = "DISCHARGING", n[n.CHARGING = 1] = "CHARGING", n[n.CHARGED = 2] = "CHARGED";
9982
+ })(e.BatteryStatus || (e.BatteryStatus = {})), ((n) => {
9983
+ n[n.CONNECTED = 0] = "CONNECTED", n[n.CONNECTING = 1] = "CONNECTING", n[n.DISCONNECTING = 2] = "DISCONNECTING", n[n.RECONNECTING = 3] = "RECONNECTING";
9984
+ })(e.WifiConnectionStatus || (e.WifiConnectionStatus = {})), ((n) => {
9985
+ n[n.UNKNOWN = 0] = "UNKNOWN", n[n.OPEN = 1] = "OPEN", n[n.WPA = 2] = "WPA", n[n.WPA2 = 3] = "WPA2", n[n.WEP = 4] = "WEP", n[n.WPA_WPA2 = 5] = "WPA_WPA2", n[n.WPA3 = 6] = "WPA3", n[n.WPA2_WPA3 = 7] = "WPA2_WPA3";
9986
+ })(e.WifiSecurity || (e.WifiSecurity = {})), ((n) => {
9987
+ n[n.DHCP = 0] = "DHCP", n[n.STATIC = 1] = "STATIC";
9988
+ })(e.IpConfigurationMethod || (e.IpConfigurationMethod = {})), ((n) => {
9989
+ n[n.IPV4 = 0] = "IPV4", n[n.IPV6 = 1] = "IPV6";
9990
+ })(e.IpProtocol || (e.IpProtocol = {})), ((n) => {
9991
+ n[n.NEVER_STARTED = 0] = "NEVER_STARTED", n[n.STARTED = 1] = "STARTED", n[n.COMPLETED_SUCCESSFULLY = 2] = "COMPLETED_SUCCESSFULLY", n[n.FAILED = 3] = "FAILED";
9992
+ })(e.MatterCommissioningStatus || (e.MatterCommissioningStatus = {})), ((n) => {
9993
+ ((t) => {
9994
+ t[t.RESET = 0] = "RESET", t[t.INITIALIZATION = 1] = "INITIALIZATION", t[t.READY = 2] = "READY", t[t.ADVERTISING = 3] = "ADVERTISING", t[t.CONNECTABLE = 4] = "CONNECTABLE", t[t.CONNECTED = 5] = "CONNECTED", t[t.ERROR = 6] = "ERROR";
9995
+ })(n.ServiceStatus || (n.ServiceStatus = {}));
9996
+ })(e.Ble || (e.Ble = {}));
9997
+ })(I || (I = {}));
9998
+ var C;
9999
+ ((e) => {
10000
+ ((n) => {
10001
+ n[n.SESSION_START = 0] = "SESSION_START", n[n.SESSION_STOP = 1] = "SESSION_STOP", n[n.ACTION_BEGIN = 2] = "ACTION_BEGIN", n[n.ACTION_DONE = 3] = "ACTION_DONE", n[n.DETAIL_CHANGE = 4] = "DETAIL_CHANGE", n[n.ACTION_PROGRESS = 5] = "ACTION_PROGRESS", n[n.EVENT_NONE = 6] = "EVENT_NONE";
10002
+ })(e.UpdateEvent || (e.UpdateEvent = {})), ((n) => {
10003
+ n[n.DOWNLOAD = 0] = "DOWNLOAD", n[n.SHA_VERIFICATION = 1] = "SHA_VERIFICATION", n[n.UNPACK = 2] = "UNPACK", n[n.INSTALLATION_PREPARE = 3] = "INSTALLATION_PREPARE", n[n.INSTALLATION_APPLY = 4] = "INSTALLATION_APPLY", n[n.ACTION_NONE = 5] = "ACTION_NONE";
10004
+ })(e.UpdateAction || (e.UpdateAction = {})), ((n) => {
10005
+ n[n.OK = 0] = "OK", n[n.BATTERY_LOW = 1] = "BATTERY_LOW", n[n.BUSY = 2] = "BUSY", n[n.DOWNLOAD_FAILURE = 3] = "DOWNLOAD_FAILURE", n[n.DOWNLOAD_ABORT = 4] = "DOWNLOAD_ABORT", n[n.SHA_MISMATCH = 5] = "SHA_MISMATCH", n[n.UNPACK_CREATE_STAGING_DIRECTORY_FAILURE = 6] = "UNPACK_CREATE_STAGING_DIRECTORY_FAILURE", n[n.UNPACK_ARCHIVE_OPEN_FAILURE = 7] = "UNPACK_ARCHIVE_OPEN_FAILURE", n[n.UNPACK_ARCHIVE_UNPACK_FAILURE = 8] = "UNPACK_ARCHIVE_UNPACK_FAILURE", n[n.INSTALLATION_PREPARE_MANIFEST_NOT_FOUND = 9] = "INSTALLATION_PREPARE_MANIFEST_NOT_FOUND", n[n.INSTALLATION_PREPARE_MANIFEST_INVALID = 10] = "INSTALLATION_PREPARE_MANIFEST_INVALID", n[n.INSTALLATION_PREPARE_SESSION_CONFIG_SETUP_FAILURE = 11] = "INSTALLATION_PREPARE_SESSION_CONFIG_SETUP_FAILURE", n[n.INSTALLATION_PREPARE_POINTER_SETUP_FAILURE = 12] = "INSTALLATION_PREPARE_POINTER_SETUP_FAILURE", n[n.UNKNOWN_FAILURE = 13] = "UNKNOWN_FAILURE";
10006
+ })(e.UpdateStatus || (e.UpdateStatus = {})), ((n) => {
10007
+ n[n.NOT_AVAILABLE = 0] = "NOT_AVAILABLE", n[n.FAILURE = 1] = "FAILURE", n[n.IDLE = 2] = "IDLE";
10008
+ })(e.CheckError || (e.CheckError = {}));
10009
+ })(C || (C = {}));
10010
+ var k;
10011
+ ((e) => {
10012
+ ((n) => {
10013
+ n[n.PLAIN = 0] = "PLAIN", n[n.RUN_LENGTH = 1] = "RUN_LENGTH", n[n.DEFLATE = 2] = "DEFLATE", n[n.DEFLATE_RUN_LENGTH = 3] = "DEFLATE_RUN_LENGTH";
10014
+ })(e.Encoding || (e.Encoding = {})), ((n) => {
10015
+ n[n.RGB888 = 0] = "RGB888", n[n.L8 = 1] = "L8", n[n.L4 = 2] = "L4";
10016
+ })(e.PixelFormat || (e.PixelFormat = {})), ((n) => {
10017
+ n[n.FRONT = 0] = "FRONT", n[n.BACK = 1] = "BACK";
10018
+ })(e.Screen || (e.Screen = {}));
10019
+ })(k || (k = {}));
10020
+ var q;
10021
+ ((e) => {
10022
+ ((n) => {
10023
+ n[n.PLAIN = 0] = "PLAIN", n[n.GZIP = 1] = "GZIP";
10024
+ })(e.Compression || (e.Compression = {}));
10025
+ })(q || (q = {}));
10026
+ var P;
10027
+ ((e) => {
10028
+ ((n) => {
10029
+ n[n.OK = 0] = "OK", n[n.BACK = 1] = "BACK", n[n.START = 2] = "START";
10030
+ })(e.Button || (e.Button = {})), ((n) => {
10031
+ n[n.PRESS = 0] = "PRESS", n[n.RELEASE = 1] = "RELEASE";
10032
+ })(e.ButtonAction || (e.ButtonAction = {})), ((n) => {
10033
+ n[n.BUSY = 0] = "BUSY", n[n.CUSTOM = 1] = "CUSTOM", n[n.OFF = 2] = "OFF", n[n.APPS = 3] = "APPS", n[n.SETTINGS = 4] = "SETTINGS";
10034
+ })(e.SwitchPosition || (e.SwitchPosition = {}));
10035
+ })(P || (P = {}));
10036
+ var j;
10037
+ ((e) => {
10038
+ ((n) => {
10039
+ n[n.RESOURCE_LIMIT = 0] = "RESOURCE_LIMIT";
10040
+ })(e.Cause || (e.Cause = {})), ((n) => {
10041
+ n[n.FATAL = 0] = "FATAL", n[n.ERROR = 1] = "ERROR", n[n.WARNING = 2] = "WARNING";
10042
+ })(e.Severity || (e.Severity = {}));
10043
+ })(j || (j = {}));
10044
+ const g = class g {
10183
10045
  constructor() {
10184
10046
  l(this, "gl", null);
10185
10047
  l(this, "program", null);
@@ -10226,9 +10088,9 @@ const b = class b {
10226
10088
  outColor = vec4(finalColor, color.a * mask);
10227
10089
  }
10228
10090
  `);
10229
- if (b.instance)
10230
- return b.instance;
10231
- b.instance = this;
10091
+ if (g.instance)
10092
+ return g.instance;
10093
+ g.instance = this;
10232
10094
  }
10233
10095
  /**
10234
10096
  * Lazily initializes the WebGL context and resources.
@@ -10237,61 +10099,64 @@ const b = class b {
10237
10099
  init() {
10238
10100
  if (this.gl || typeof window > "u")
10239
10101
  return;
10240
- const n = document.createElement("canvas").getContext("webgl2", {
10102
+ const t = document.createElement("canvas").getContext("webgl2", {
10241
10103
  antialias: !0,
10242
10104
  alpha: !0,
10243
10105
  preserveDrawingBuffer: !0
10244
10106
  });
10245
- if (!n)
10107
+ if (!t)
10246
10108
  throw new Error("WebGL 2.0 not supported");
10247
- this.gl = n, this.program = this.createProgram(this.vs, this.fs);
10248
- const t = n.createBuffer();
10249
- n.bindBuffer(n.ARRAY_BUFFER, t), n.bufferData(n.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), n.STATIC_DRAW);
10250
- const i = n.getAttribLocation(this.program, "position");
10251
- n.enableVertexAttribArray(i), n.vertexAttribPointer(i, 2, n.FLOAT, !1, 0, 0), this.texture = n.createTexture(), n.bindTexture(n.TEXTURE_2D, this.texture), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
10109
+ this.gl = t, this.program = this.createProgram(this.vs, this.fs);
10110
+ const r = t.createBuffer();
10111
+ t.bindBuffer(t.ARRAY_BUFFER, r), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]), t.STATIC_DRAW);
10112
+ const i = t.getAttribLocation(this.program, "position");
10113
+ t.enableVertexAttribArray(i), t.vertexAttribPointer(i, 2, t.FLOAT, !1, 0, 0), this.texture = t.createTexture(), t.bindTexture(t.TEXTURE_2D, this.texture), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MIN_FILTER, t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_MAG_FILTER, t.NEAREST), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(t.TEXTURE_2D, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE);
10252
10114
  }
10253
10115
  /**
10254
10116
  * Internal WebGL rendering pass.
10255
10117
  */
10256
- render(e, n, t, i) {
10257
- const { pixelSize: o = 0.85, radius: a = 0.5, darkThreshold: c = 0.04 } = i, u = this.gl;
10258
- u.viewport(0, 0, u.canvas.width, u.canvas.height), u.useProgram(this.program), u.bindTexture(u.TEXTURE_2D, this.texture), u.texImage2D(u.TEXTURE_2D, 0, u.RGBA8, n, t, 0, u.RGBA, u.UNSIGNED_BYTE, e), u.uniform2f(u.getUniformLocation(this.program, "u_dataRes"), n, t), u.uniform2f(u.getUniformLocation(this.program, "u_canvasRes"), u.canvas.width, u.canvas.height), u.uniform1f(u.getUniformLocation(this.program, "u_pixelSize"), o), u.uniform1f(u.getUniformLocation(this.program, "u_radius"), a), u.uniform1f(u.getUniformLocation(this.program, "u_darkThreshold"), c), u.clearColor(0, 0, 0, 0), u.clear(u.COLOR_BUFFER_BIT), u.enable(u.BLEND), u.blendFunc(u.SRC_ALPHA, u.ONE_MINUS_SRC_ALPHA), u.drawArrays(u.TRIANGLES, 0, 6);
10118
+ render(n, t, r, i) {
10119
+ const { pixelSize: o = 0.85, radius: s = 0.5, darkThreshold: u = 0.04 } = i, a = this.gl;
10120
+ a.viewport(0, 0, a.canvas.width, a.canvas.height), a.useProgram(this.program), a.bindTexture(a.TEXTURE_2D, this.texture), a.texImage2D(a.TEXTURE_2D, 0, a.RGBA8, t, r, 0, a.RGBA, a.UNSIGNED_BYTE, n), a.uniform2f(a.getUniformLocation(this.program, "u_dataRes"), t, r), a.uniform2f(a.getUniformLocation(this.program, "u_canvasRes"), a.canvas.width, a.canvas.height), a.uniform1f(a.getUniformLocation(this.program, "u_pixelSize"), o), a.uniform1f(a.getUniformLocation(this.program, "u_radius"), s), a.uniform1f(a.getUniformLocation(this.program, "u_darkThreshold"), u), a.clearColor(0, 0, 0, 0), a.clear(a.COLOR_BUFFER_BIT), a.enable(a.BLEND), a.blendFunc(a.SRC_ALPHA, a.ONE_MINUS_SRC_ALPHA), a.drawArrays(a.TRIANGLES, 0, 6);
10259
10121
  }
10260
10122
  /**
10261
10123
  * Public API: Renders the LED frame to a target 2D canvas.
10262
10124
  */
10263
- renderFrame(e, n, t, i, o = {}) {
10125
+ renderFrame(n, t, r, i, o = {}) {
10264
10126
  if (this.init(), typeof window > "u" || !this.gl)
10265
10127
  return;
10266
- (this.gl.canvas.width !== e.width || this.gl.canvas.height !== e.height) && (this.gl.canvas.width = e.width, this.gl.canvas.height = e.height), this.render(n, t, i, o);
10267
- const a = e.getContext("2d");
10268
- a && (a.clearRect(0, 0, e.width, e.height), a.drawImage(this.gl.canvas, 0, 0));
10269
- }
10270
- createProgram(e, n) {
10271
- const t = this.gl, i = (a, c) => {
10272
- const u = t.createShader(a);
10273
- if (t.shaderSource(u, c), t.compileShader(u), !t.getShaderParameter(u, t.COMPILE_STATUS)) throw new Error(t.getShaderInfoLog(u) || "Shader Error");
10274
- return u;
10275
- }, o = t.createProgram();
10276
- return t.attachShader(o, i(t.VERTEX_SHADER, e)), t.attachShader(o, i(t.FRAGMENT_SHADER, n)), t.linkProgram(o), o;
10128
+ (this.gl.canvas.width !== n.width || this.gl.canvas.height !== n.height) && (this.gl.canvas.width = n.width, this.gl.canvas.height = n.height), this.render(t, r, i, o);
10129
+ const s = n.getContext("2d");
10130
+ s && (s.clearRect(0, 0, n.width, n.height), s.drawImage(this.gl.canvas, 0, 0));
10131
+ }
10132
+ createProgram(n, t) {
10133
+ const r = this.gl, i = (s, u) => {
10134
+ const a = r.createShader(s);
10135
+ if (r.shaderSource(a, u), r.compileShader(a), !r.getShaderParameter(a, r.COMPILE_STATUS)) throw new Error(r.getShaderInfoLog(a) || "Shader Error");
10136
+ return a;
10137
+ }, o = r.createProgram();
10138
+ return r.attachShader(o, i(r.VERTEX_SHADER, n)), r.attachShader(o, i(r.FRAGMENT_SHADER, t)), r.linkProgram(o), o;
10277
10139
  }
10278
10140
  };
10279
- l(b, "instance", null);
10280
- let S = b;
10281
- const An = new S();
10141
+ l(g, "instance", null);
10142
+ let S = g;
10143
+ const Re = new S();
10282
10144
  export {
10283
- E as AuthStatus,
10284
- pn as BusyBar,
10285
- v as ConnectionStatus,
10286
- _ as DataStatus,
10287
- A as DeviceScreen,
10288
- wn as Input,
10289
- An as LEDRenderer,
10290
- Rn as LocalStateStream,
10291
- Tn as RemoteStateStream,
10292
- On as ScreenStream,
10145
+ b as AuthStatus,
10146
+ j as BSB_Error,
10147
+ k as BSB_Frame,
10148
+ P as BSB_Input,
10149
+ I as BSB_State,
10150
+ C as BSB_Update,
10151
+ q as BSB_Util,
10152
+ ye as BusyBar,
10153
+ m as ConnectionStatus,
10154
+ E as DataStatus,
10155
+ Re as LEDRenderer,
10156
+ Te as LocalStateStream,
10157
+ Oe as RemoteStateStream,
10293
10158
  y as StateStreamError,
10294
- d as StateStreamErrorCode,
10295
- p as StreamLifecycle,
10296
- O as WorkerStatus
10159
+ c as StateStreamErrorCode,
10160
+ d as StreamLifecycle,
10161
+ _ as WorkerStatus
10297
10162
  };