@busy-app/busy-lib 0.10.0 → 0.12.0

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,8 +1,8 @@
1
- var P = Object.defineProperty;
2
- var G = (n, t, e) => t in n ? P(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var c = (n, t, e) => G(n, typeof t != "symbol" ? t + "" : t, e);
4
- import m from "openapi-fetch";
5
- const L = (n, t) => {
1
+ var G = Object.defineProperty;
2
+ var v = (n, t, e) => t in n ? G(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var u = (n, t, e) => v(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import E from "openapi-fetch";
5
+ const O = (n, t) => {
6
6
  if (typeof FormData < "u" && n instanceof FormData || typeof Buffer < "u" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(n) || typeof File < "u" && n instanceof File || typeof Blob < "u" && n instanceof Blob || typeof ArrayBuffer < "u" && n instanceof ArrayBuffer || typeof ArrayBuffer < "u" && ArrayBuffer.isView && ArrayBuffer.isView(n))
7
7
  return n;
8
8
  let e;
@@ -10,14 +10,11 @@ const L = (n, t) => {
10
10
  };
11
11
  async function y(n) {
12
12
  const i = (n.headers.get("content-type") || "").includes("application/json") ? await n.clone().json() : await n.clone().text(), r = typeof i == "object" && i !== null ? i.error || i.message : typeof i == "string" ? i : void 0;
13
- return Object.assign(
14
- new Error(r || `HTTP ${n.status} ${n.statusText}`),
15
- {
16
- status: n.status,
17
- statusText: n.statusText,
18
- body: i
19
- }
20
- );
13
+ return Object.assign(new Error(r || `HTTP ${n.status} ${n.statusText}`), {
14
+ status: n.status,
15
+ statusText: n.statusText,
16
+ body: i
17
+ });
21
18
  }
22
19
  async function s(n, t = 3e3) {
23
20
  if (t <= 0)
@@ -31,9 +28,9 @@ async function s(n, t = 3e3) {
31
28
  clearTimeout(i);
32
29
  }
33
30
  }
34
- function O(n, t, e) {
31
+ function L(n, t, e) {
35
32
  let i, r = e ?? void 0, o, a = null;
36
- const u = async () => {
33
+ const c = async () => {
37
34
  i || (a || (a = (async () => {
38
35
  const h = await t();
39
36
  if (!h.api_semver)
@@ -42,28 +39,28 @@ function O(n, t, e) {
42
39
  })().finally(() => {
43
40
  a = null;
44
41
  })), await a);
45
- }, l = {
46
- async onRequest({ request: h, schemaPath: d }) {
47
- return r && h.headers.set("Authorization", `Bearer ${r}`), d !== "/version" && (await u(), i && h.headers.set("X-API-Sem-Ver", i), o && h.headers.set("X-API-Token", o)), h;
42
+ }, d = {
43
+ async onRequest({ request: h, schemaPath: w }) {
44
+ return r && h.headers.set("Authorization", `Bearer ${r}`), w !== "/version" && (await c(), i && h.headers.set("X-API-Sem-Ver", i), o && h.headers.set("X-API-Token", o)), h;
48
45
  },
49
- async onResponse({ request: h, response: d, options: b, schemaPath: v }) {
50
- if (d.ok)
51
- return d;
52
- if (v === "/version")
53
- throw await y(d);
54
- if (d.status !== 405)
55
- throw await y(d);
56
- i = void 0, await u(), i && h.headers.set("X-API-Sem-Ver", i), r && h.headers.set("Authorization", `Bearer ${r}`);
57
- const w = await (b.fetch ?? fetch)(h);
46
+ async onResponse({ request: h, response: w, options: b, schemaPath: P }) {
58
47
  if (w.ok)
59
48
  return w;
60
- throw await y(w);
49
+ if (P === "/version")
50
+ throw await y(w);
51
+ if (w.status !== 405)
52
+ throw await y(w);
53
+ i = void 0, await c(), i && h.headers.set("X-API-Sem-Ver", i), r && h.headers.set("Authorization", `Bearer ${r}`);
54
+ const l = await (b.fetch ?? fetch)(h);
55
+ if (l.ok)
56
+ return l;
57
+ throw await y(l);
61
58
  }
62
- }, f = m({
59
+ }, f = E({
63
60
  baseUrl: n,
64
- bodySerializer: L
61
+ bodySerializer: O
65
62
  });
66
- return f.use(l), {
63
+ return f.use(d), {
67
64
  client: f,
68
65
  setApiKey: (h) => {
69
66
  o = h;
@@ -74,42 +71,42 @@ function O(n, t, e) {
74
71
  };
75
72
  }
76
73
  async function D(n, t) {
77
- const { data: e, error: i } = await s(
78
- (r) => n.GET("/version", { signal: r }),
79
- t == null ? void 0 : t.timeout
80
- );
74
+ const { data: e, error: i } = await s((r) => n.GET("/version", { signal: r }), t == null ? void 0 : t.timeout);
75
+ if (i)
76
+ throw i;
77
+ return e;
78
+ }
79
+ async function U(n, t) {
80
+ const { data: e, error: i } = await s((r) => n.GET("/status", { signal: r }), t == null ? void 0 : t.timeout);
81
81
  if (i)
82
82
  throw i;
83
83
  return e;
84
84
  }
85
85
  async function B(n, t) {
86
- const { data: e, error: i } = await s(
87
- (r) => n.GET("/status", { signal: r }),
88
- t == null ? void 0 : t.timeout
89
- );
86
+ const { data: e, error: i } = await s((r) => n.GET("/status/system", { signal: r }), t == null ? void 0 : t.timeout);
90
87
  if (i)
91
88
  throw i;
92
89
  return e;
93
90
  }
94
- async function U(n, t) {
95
- const { data: e, error: i } = await s(
96
- (r) => n.GET("/status/system", { signal: r }),
97
- t == null ? void 0 : t.timeout
98
- );
91
+ async function _(n, t) {
92
+ const { data: e, error: i } = await s((r) => n.GET("/status/power", { signal: r }), t == null ? void 0 : t.timeout);
93
+ if (i)
94
+ throw i;
95
+ return e;
96
+ }
97
+ async function $(n, t) {
98
+ const { data: e, error: i } = await s((r) => n.GET("/status/device", { signal: r }), t == null ? void 0 : t.timeout);
99
99
  if (i)
100
100
  throw i;
101
101
  return e;
102
102
  }
103
103
  async function I(n, t) {
104
- const { data: e, error: i } = await s(
105
- (r) => n.GET("/status/power", { signal: r }),
106
- t == null ? void 0 : t.timeout
107
- );
104
+ const { data: e, error: i } = await s((r) => n.GET("/status/firmware", { signal: r }), t == null ? void 0 : t.timeout);
108
105
  if (i)
109
106
  throw i;
110
107
  return e;
111
108
  }
112
- class $ {
109
+ class R {
113
110
  /**
114
111
  * Get API version information.
115
112
  *
@@ -122,14 +119,14 @@ class $ {
122
119
  return this.apiSemver = e.api_semver, e;
123
120
  }
124
121
  /**
125
- * Get device status.
122
+ * Get full status.
126
123
  *
127
124
  * @param {TimeoutOptions} [params] - Optional parameters.
128
125
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
129
126
  * @returns {Promise<Status>} Current status of the device.
130
127
  */
131
128
  async SystemStatusGet(t) {
132
- return await B(this.apiClient, t);
129
+ return await U(this.apiClient, t);
133
130
  }
134
131
  /**
135
132
  * Get system status.
@@ -139,7 +136,7 @@ class $ {
139
136
  * @returns {Promise<StatusSystem>} Current system status.
140
137
  */
141
138
  async SystemInfoGet(t) {
142
- return await U(this.apiClient, t);
139
+ return await B(this.apiClient, t);
143
140
  }
144
141
  /**
145
142
  * Get power status.
@@ -149,6 +146,26 @@ class $ {
149
146
  * @returns {Promise<StatusPower>} Current power status.
150
147
  */
151
148
  async SystemStatusPowerGet(t) {
149
+ return await _(this.apiClient, t);
150
+ }
151
+ /**
152
+ * Get device status.
153
+ *
154
+ * @param {TimeoutOptions} [params] - Optional parameters.
155
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
156
+ * @returns {Promise<StatusDevice>} Current device status.
157
+ */
158
+ async SystemStatusDeviceGet(t) {
159
+ return await $(this.apiClient, t);
160
+ }
161
+ /**
162
+ * Get firmware status.
163
+ *
164
+ * @param {TimeoutOptions} [params] - Optional parameters.
165
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
166
+ * @returns {Promise<StatusFirmware>} Current firmware status.
167
+ */
168
+ async SystemStatusFirmwareGet(t) {
152
169
  return await I(this.apiClient, t);
153
170
  }
154
171
  }
@@ -167,25 +184,19 @@ async function K(n, t) {
167
184
  throw r;
168
185
  return i;
169
186
  }
170
- async function R(n, t) {
171
- const { data: e, error: i } = await s(
172
- (r) => n.POST("/update/check", { signal: r }),
173
- t == null ? void 0 : t.timeout
174
- );
187
+ async function F(n, t) {
188
+ const { data: e, error: i } = await s((r) => n.POST("/update/check", { signal: r }), t == null ? void 0 : t.timeout);
175
189
  if (i)
176
190
  throw i;
177
191
  return e;
178
192
  }
179
- async function F(n, t) {
180
- const { data: e, error: i } = await s(
181
- (r) => n.GET("/update/status", { signal: r }),
182
- t == null ? void 0 : t.timeout
183
- );
193
+ async function W(n, t) {
194
+ const { data: e, error: i } = await s((r) => n.GET("/update/status", { signal: r }), t == null ? void 0 : t.timeout);
184
195
  if (i)
185
196
  throw i;
186
197
  return e;
187
198
  }
188
- async function W(n, t) {
199
+ async function M(n, t) {
189
200
  const { version: e } = t, { data: i, error: r } = await s(
190
201
  (o) => n.GET("/update/changelog", {
191
202
  params: {
@@ -201,7 +212,7 @@ async function W(n, t) {
201
212
  throw r;
202
213
  return i;
203
214
  }
204
- async function M(n, t) {
215
+ async function q(n, t) {
205
216
  const { version: e } = t, { data: i, error: r } = await s(
206
217
  (o) => n.POST("/update/install", {
207
218
  params: {
@@ -218,15 +229,30 @@ async function M(n, t) {
218
229
  return i;
219
230
  }
220
231
  async function N(n, t) {
221
- const { data: e, error: i } = await s(
222
- (r) => n.POST("/update/abort_download", { signal: r }),
223
- t == null ? void 0 : t.timeout
224
- );
232
+ const { data: e, error: i } = await s((r) => n.POST("/update/abort_download", { signal: r }), t == null ? void 0 : t.timeout);
225
233
  if (i)
226
234
  throw i;
227
235
  return e;
228
236
  }
229
- class _ {
237
+ async function x(n, t) {
238
+ const { data: e, error: i } = await s((r) => n.GET("/update/autoupdate", { signal: r }), t == null ? void 0 : t.timeout);
239
+ if (i)
240
+ throw i;
241
+ return e;
242
+ }
243
+ async function H(n, t) {
244
+ const { is_enabled: e, interval_start: i, interval_end: r } = t, { data: o, error: a } = await s(
245
+ (c) => n.POST("/update/autoupdate", {
246
+ body: { is_enabled: e, interval_start: i, interval_end: r },
247
+ signal: c
248
+ }),
249
+ t.timeout
250
+ );
251
+ if (a)
252
+ throw a;
253
+ return o;
254
+ }
255
+ class V {
230
256
  /**
231
257
  * Upload firmware update package.
232
258
  *
@@ -246,7 +272,7 @@ class _ {
246
272
  * @returns {Promise<SuccessResponse>} A promise that resolves to the update check result.
247
273
  */
248
274
  async UpdateCheck(t) {
249
- return await R(this.apiClient, t);
275
+ return await F(this.apiClient, t);
250
276
  }
251
277
  /**
252
278
  * Get firmware update status.
@@ -256,7 +282,7 @@ class _ {
256
282
  * @returns {Promise<UpdateStatus>} A promise that resolves to the update status.
257
283
  */
258
284
  async UpdateStatusGet(t) {
259
- return await F(this.apiClient, t);
285
+ return await W(this.apiClient, t);
260
286
  }
261
287
  /**
262
288
  * Get firmware update changelog.
@@ -267,7 +293,7 @@ class _ {
267
293
  * @returns {Promise<UpdateChangelog>} A promise that resolves to the changelog content.
268
294
  */
269
295
  async UpdateChangelogGet(t) {
270
- return await W(this.apiClient, t);
296
+ return await M(this.apiClient, t);
271
297
  }
272
298
  /**
273
299
  * Start firmware update installation.
@@ -278,7 +304,7 @@ class _ {
278
304
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful initiation.
279
305
  */
280
306
  async UpdateInstall(t) {
281
- return await M(this.apiClient, t);
307
+ return await q(this.apiClient, t);
282
308
  }
283
309
  /**
284
310
  * Abort firmware update download.
@@ -290,63 +316,77 @@ class _ {
290
316
  async UpdateAbort(t) {
291
317
  return await N(this.apiClient, t);
292
318
  }
319
+ /**
320
+ * Get current auto-update settings.
321
+ *
322
+ * @param {TimeoutOptions} [params] - Optional parameters.
323
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
324
+ * @returns {Promise<AutoUpdateSettings>} A promise that resolves to the current auto-update settings.
325
+ */
326
+ async UpdateAutoUpdateGet(t) {
327
+ return await x(this.apiClient, t);
328
+ }
329
+ /**
330
+ * Set auto-update settings.
331
+ *
332
+ * @param {AutoUpdateParams} params - Parameters for auto-update settings.
333
+ * @param {AutoUpdateParams['is_enabled']} params.is_enabled - Whether auto-update is enabled.
334
+ * @param {AutoUpdateParams['interval_start']} params.interval_start - Auto-update interval start time (HH:mm).
335
+ * @param {AutoUpdateParams['interval_end']} params.interval_end - Auto-update interval end time (HH:mm).
336
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
337
+ * @returns {Promise<SuccessResponse>} A promise that resolves on successful update of settings.
338
+ */
339
+ async UpdateAutoUpdateSet(t) {
340
+ return await H(this.apiClient, t);
341
+ }
293
342
  }
294
- async function x(n, t) {
295
- const { data: e, error: i } = await s(
296
- (r) => n.GET("/time", { signal: r }),
297
- t == null ? void 0 : t.timeout
298
- );
343
+ async function j(n, t) {
344
+ const { data: e, error: i } = await s((r) => n.GET("/time", { signal: r }), t == null ? void 0 : t.timeout);
299
345
  if (i)
300
346
  throw i;
301
347
  return e;
302
348
  }
303
- async function q(n, t) {
304
- const { data: e, error: i } = await s(
305
- (r) => n.POST("/time/timestamp", {
349
+ async function z(n, t) {
350
+ const { timestamp: e } = t, { data: i, error: r } = await s(
351
+ (o) => n.POST("/time/timestamp", {
306
352
  params: {
307
- query: { ...t, timeout: void 0 }
353
+ query: { timestamp: e }
308
354
  },
309
- signal: r
355
+ signal: o
310
356
  }),
311
357
  t.timeout
312
358
  );
313
- if (i)
314
- throw i;
315
- return e;
359
+ if (r)
360
+ throw r;
361
+ return i;
316
362
  }
317
- async function V(n, t) {
318
- const { data: e, error: i } = await s(
319
- (r) => n.GET("/time/timezone", { signal: r }),
320
- t == null ? void 0 : t.timeout
321
- );
363
+ async function J(n, t) {
364
+ const { data: e, error: i } = await s((r) => n.GET("/time/timezone", { signal: r }), t == null ? void 0 : t.timeout);
322
365
  if (i)
323
366
  throw i;
324
367
  return e;
325
368
  }
326
- async function j(n, t) {
327
- const { data: e, error: i } = await s(
328
- (r) => n.POST("/time/timezone", {
369
+ async function X(n, t) {
370
+ const { timezone: e } = t, { data: i, error: r } = await s(
371
+ (o) => n.POST("/time/timezone", {
329
372
  params: {
330
- query: { ...t, timeout: void 0 }
373
+ query: { timezone: e }
331
374
  },
332
- signal: r
375
+ signal: o
333
376
  }),
334
377
  t.timeout
335
378
  );
336
- if (i)
337
- throw i;
338
- return e;
379
+ if (r)
380
+ throw r;
381
+ return i;
339
382
  }
340
- async function z(n, t) {
341
- const { data: e, error: i } = await s(
342
- (r) => n.GET("/time/tzlist", { signal: r }),
343
- t == null ? void 0 : t.timeout
344
- );
383
+ async function Y(n, t) {
384
+ const { data: e, error: i } = await s((r) => n.GET("/time/tzlist", { signal: r }), t == null ? void 0 : t.timeout);
345
385
  if (i)
346
386
  throw i;
347
387
  return e;
348
388
  }
349
- class H {
389
+ class Q {
350
390
  /**
351
391
  * Get current timestamp info.
352
392
  *
@@ -355,7 +395,7 @@ class H {
355
395
  * @returns {Promise<TimestampInfo>} A promise that resolves to the timestamp information.
356
396
  */
357
397
  async TimeGet(t) {
358
- return await x(this.apiClient, t);
398
+ return await j(this.apiClient, t);
359
399
  }
360
400
  /**
361
401
  * Set system timestamp.
@@ -366,7 +406,7 @@ class H {
366
406
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
367
407
  */
368
408
  async TimeTimestampSet(t) {
369
- return await q(this.apiClient, t);
409
+ return await z(this.apiClient, t);
370
410
  }
371
411
  /**
372
412
  * Get current timezone.
@@ -376,7 +416,7 @@ class H {
376
416
  * @returns {Promise<TimezoneInfo>} A promise that resolves to the timezone information.
377
417
  */
378
418
  async TimeTimezoneGet(t) {
379
- return await V(this.apiClient, t);
419
+ return await J(this.apiClient, t);
380
420
  }
381
421
  /**
382
422
  * Set system timezone.
@@ -387,7 +427,7 @@ class H {
387
427
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
388
428
  */
389
429
  async TimeTimezoneSet(t) {
390
- return await j(this.apiClient, t);
430
+ return await X(this.apiClient, t);
391
431
  }
392
432
  /**
393
433
  * Get list of supported timezones.
@@ -397,71 +437,57 @@ class H {
397
437
  * @returns {Promise<TimezoneList>} A promise that resolves to a list of timezone items.
398
438
  */
399
439
  async TimeTzListGet(t) {
400
- return await z(this.apiClient, t);
440
+ return await Y(this.apiClient, t);
401
441
  }
402
442
  }
403
- async function J(n, t) {
404
- const { data: e, error: i } = await s(
405
- (r) => n.GET("/account/status", { signal: r }),
406
- t == null ? void 0 : t.timeout
407
- );
443
+ async function Z(n, t) {
444
+ const { data: e, error: i } = await s((r) => n.GET("/account/status", { signal: r }), t == null ? void 0 : t.timeout);
408
445
  if (i)
409
446
  throw i;
410
447
  return e;
411
448
  }
412
- async function X(n, t) {
413
- const { data: e, error: i } = await s(
414
- (r) => n.GET("/account/info", { signal: r }),
415
- t == null ? void 0 : t.timeout
416
- );
449
+ async function tt(n, t) {
450
+ const { data: e, error: i } = await s((r) => n.GET("/account/info", { signal: r }), t == null ? void 0 : t.timeout);
417
451
  if (i)
418
452
  throw i;
419
453
  return e;
420
454
  }
421
- async function Y(n, t) {
422
- const { data: e, error: i } = await s(
423
- (r) => n.GET("/account/profile", { signal: r }),
424
- t == null ? void 0 : t.timeout
425
- );
455
+ async function et(n, t) {
456
+ const { data: e, error: i } = await s((r) => n.GET("/account/profile", { signal: r }), t == null ? void 0 : t.timeout);
426
457
  if (i)
427
458
  throw i;
428
459
  return e;
429
460
  }
430
- async function Q(n, t) {
431
- const { profile: e } = t, { data: i, error: r } = await s(
432
- (o) => n.POST("/account/profile", {
461
+ async function it(n, t) {
462
+ const { profile: e, custom_url: i } = t, { data: r, error: o } = await s(
463
+ (a) => n.POST("/account/profile", {
433
464
  params: {
434
465
  query: {
435
- profile: e
466
+ profile: e,
467
+ custom_url: i
436
468
  }
437
469
  },
438
- signal: o
470
+ signal: a
439
471
  }),
440
472
  t.timeout
441
473
  );
442
- if (r)
443
- throw r;
444
- return i;
474
+ if (o)
475
+ throw o;
476
+ return r;
445
477
  }
446
- async function Z(n, t) {
447
- const { data: e, error: i } = await s(
448
- (r) => n.DELETE("/account", { signal: r }),
449
- t == null ? void 0 : t.timeout
450
- );
478
+ async function nt(n, t) {
479
+ const { data: e, error: i } = await s((r) => n.DELETE("/account", { signal: r }), t == null ? void 0 : t.timeout);
451
480
  if (i)
452
481
  throw i;
453
482
  return e;
454
483
  }
455
- async function tt(n, t) {
456
- const { data: e, error: i } = await s(
457
- (r) => n.POST("/account/link", { signal: r }),
458
- t == null ? void 0 : t.timeout
459
- );
484
+ async function rt(n, t) {
485
+ const { data: e, error: i } = await s((r) => n.POST("/account/link", { signal: r }), t == null ? void 0 : t.timeout);
460
486
  if (i)
461
487
  throw i;
462
488
  return e;
463
489
  }
464
- class et {
490
+ class ot {
465
491
  /**
466
492
  * Get account info.
467
493
  *
@@ -470,17 +496,17 @@ class et {
470
496
  * @returns {Promise<AccountInfo>} A promise that resolves to the account information.
471
497
  */
472
498
  async AccountInfoGet(t) {
473
- return await X(this.apiClient, t);
499
+ return await tt(this.apiClient, t);
474
500
  }
475
501
  /**
476
502
  * Get account state.
477
503
  *
478
504
  * @param {TimeoutOptions} [params] - Optional parameters.
479
505
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
480
- * @returns {Promise<AccountState>} A promise that resolves to the account state.
506
+ * @returns {Promise<AccountStatus>} A promise that resolves to the account state.
481
507
  */
482
508
  async AccountStateGet(t) {
483
- return await J(this.apiClient, t);
509
+ return await Z(this.apiClient, t);
484
510
  }
485
511
  /**
486
512
  * Get account profile.
@@ -490,18 +516,19 @@ class et {
490
516
  * @returns {Promise<AccountProfile>} A promise that resolves to the account profile.
491
517
  */
492
518
  async AccountProfileGet(t) {
493
- return await Y(this.apiClient, t);
519
+ return await et(this.apiClient, t);
494
520
  }
495
521
  /**
496
522
  * Set account profile.
497
523
  *
498
524
  * @param {SetAccountProfileParams} params - Parameters for setting the account profile.
499
- * @param {string} params.profile - Profile data string.
525
+ * @param {string} params.profile - Profile name.
526
+ * @param {string} [params.custom_url] - Custom profile URL.
500
527
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
501
528
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
502
529
  */
503
530
  async AccountProfileSet(t) {
504
- return await Q(this.apiClient, t);
531
+ return await it(this.apiClient, t);
505
532
  }
506
533
  /**
507
534
  * Unlink device from account. Removes association with the current account.
@@ -511,7 +538,7 @@ class et {
511
538
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful unlinking.
512
539
  */
513
540
  async AccountUnlink(t) {
514
- return await Z(this.apiClient, t);
541
+ return await nt(this.apiClient, t);
515
542
  }
516
543
  /**
517
544
  * Link device to account. Requests account link PIN. Works only if device is connected to MQTT and is not linked to account.
@@ -521,77 +548,80 @@ class et {
521
548
  * @returns {Promise<AccountLink>} A promise that resolves to the link information (e.g., PIN).
522
549
  */
523
550
  async AccountLink(t) {
524
- return await tt(this.apiClient, t);
551
+ return await rt(this.apiClient, t);
525
552
  }
526
553
  }
527
- async function it(n, t) {
528
- const { appId: e, elements: i, priority: r = 6 } = t, { data: o, error: a } = await s(
529
- (u) => n.POST("/display/draw", {
554
+ async function st(n, t) {
555
+ const { application_name: e, elements: i, priority: r = 50, timeout: o } = t, { data: a, error: c } = await s(
556
+ (d) => n.POST("/display/draw", {
530
557
  body: {
531
- app_id: e,
558
+ application_name: e,
532
559
  priority: r,
533
560
  elements: i
534
561
  },
535
- signal: u
562
+ signal: d
536
563
  }),
537
- t.timeout
564
+ o
538
565
  );
539
- if (a)
540
- throw a;
541
- return o;
566
+ if (c)
567
+ throw c;
568
+ return a;
542
569
  }
543
- async function nt(n, t) {
570
+ async function at(n, t) {
544
571
  const { data: e, error: i } = await s(
545
- (r) => n.DELETE("/display/draw", { signal: r }),
572
+ (r) => n.DELETE("/display/draw", {
573
+ params: {
574
+ query: {
575
+ application_name: t == null ? void 0 : t.application_name
576
+ }
577
+ },
578
+ signal: r
579
+ }),
546
580
  t == null ? void 0 : t.timeout
547
581
  );
548
582
  if (i)
549
583
  throw i;
550
584
  return e;
551
585
  }
552
- async function rt(n, t) {
553
- const { display: e } = t, { data: i, error: r } = await s(
554
- (o) => n.GET("/screen", {
586
+ async function ct(n, t) {
587
+ const { display: e, timeout: i } = t, { data: r, error: o } = await s(
588
+ (a) => n.GET("/screen", {
555
589
  params: {
556
590
  query: {
557
591
  display: e
558
592
  }
559
593
  },
560
594
  parseAs: "blob",
561
- signal: o
595
+ signal: a
562
596
  }),
563
- t.timeout
597
+ i
564
598
  );
565
- if (r)
566
- throw r;
567
- return i;
599
+ if (o)
600
+ throw o;
601
+ return r;
568
602
  }
569
- async function ot(n, t) {
570
- const { data: e, error: i } = await s(
571
- (r) => n.GET("/display/brightness", { signal: r }),
572
- t == null ? void 0 : t.timeout
573
- );
603
+ async function ut(n, t) {
604
+ const { data: e, error: i } = await s((r) => n.GET("/display/brightness", { signal: r }), t == null ? void 0 : t.timeout);
574
605
  if (i)
575
606
  throw i;
576
607
  return e;
577
608
  }
578
- async function st(n, t) {
579
- const { value: e } = t, r = ((u) => {
580
- if (typeof u == "number") {
581
- if (u < 0 || u > 100)
609
+ async function ht(n, t) {
610
+ const { value: e } = t, r = ((c) => {
611
+ if (typeof c == "number") {
612
+ if (c < 0 || c > 100)
582
613
  throw new Error("Brightness value must be between 0 and 100 or 'auto'");
583
- return String(u);
614
+ return String(c);
584
615
  }
585
- if (u === "auto")
586
- return "auto";
616
+ return "auto";
587
617
  })(e), { data: o, error: a } = await s(
588
- (u) => n.POST("/display/brightness", {
618
+ (c) => n.POST("/display/brightness", {
589
619
  params: {
590
620
  query: {
591
621
  value: r
592
622
  }
593
623
  },
594
- signal: u
624
+ signal: c
595
625
  }),
596
626
  t.timeout
597
627
  );
@@ -599,40 +629,42 @@ async function st(n, t) {
599
629
  throw a;
600
630
  return o;
601
631
  }
602
- class at {
632
+ class dt {
603
633
  /**
604
- * Draw on display. Starts the Canvas application if not running.
634
+ * Draw on display. Sends drawing data to the display. Supports JSON-defined display elements.
605
635
  *
606
636
  * @param {DrawParams} params - Parameters for the draw operation.
607
- * @param {DrawParams['appId']} params.appId - Application ID.
608
- * @param {DrawParams['elements']} params.elements - Display elements to draw.
609
- * @param {DrawParams['priority']} [params.priority=6] - Priority for the draw request (1-10).
637
+ * @param {string} params.application_name - Application ID for organizing assets.
638
+ * @param {Array} params.elements - Display elements to draw.
639
+ * @param {number} [params.priority=50] - Draw priority in the range [1, 100].
610
640
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
611
641
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful draw command.
612
642
  */
613
643
  async DisplayDraw(t) {
614
- return await it(this.apiClient, t);
644
+ return await st(this.apiClient, t);
615
645
  }
616
646
  /**
617
- * Clear display. Clears the display and stops the Canvas application if running.
647
+ * Clear display. Deletes display elements drawn by the Canvas application.
648
+ * If application_name is specified, only elements for that app are removed.
618
649
  *
619
- * @param {TimeoutOptions} [params] - Optional parameters.
650
+ * @param {ClearParams} [params] - Optional parameters.
651
+ * @param {string} [params.application_name] - Application identifier.
620
652
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
621
653
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful clear command.
622
654
  */
623
655
  async DisplayClear(t) {
624
- return await nt(this.apiClient, t);
656
+ return await at(this.apiClient, t);
625
657
  }
626
658
  /**
627
659
  * Get single frame for requested screen.
628
660
  *
629
661
  * @param {GetScreenFrameParams} params - Parameters for the frame request.
630
- * @param {string} params.display - Display identifier.
662
+ * @param {number} params.display - Type of the display (Front = 0, Back = 1).
631
663
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
632
664
  * @returns {Promise<Blob>} A promise that resolves to the screen frame as a Blob.
633
665
  */
634
666
  async DisplayScreenFrameGet(t) {
635
- return await rt(this.apiClient, t);
667
+ return await ct(this.apiClient, t);
636
668
  }
637
669
  /**
638
670
  * Get display brightness.
@@ -642,26 +674,26 @@ class at {
642
674
  * @returns {Promise<DisplayBrightnessInfo>} A promise that resolves to the brightness information.
643
675
  */
644
676
  async DisplayBrightnessGet(t) {
645
- return await ot(this.apiClient, t);
677
+ return await ut(this.apiClient, t);
646
678
  }
647
679
  /**
648
680
  * Set display brightness.
649
681
  *
650
- * @param {BrightnessParams} params - Brightness parameters:
651
- * @param {BrightnessParams['value']} [params.value] - Brightness (0-100 or "auto").
682
+ * @param {BrightnessParams} params - Brightness parameters.
683
+ * @param {number | 'auto'} params.value - Brightness (0-100 or "auto").
652
684
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
653
685
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
654
686
  */
655
687
  async DisplayBrightnessSet(t) {
656
- return await st(this.apiClient, t);
688
+ return await ht(this.apiClient, t);
657
689
  }
658
690
  }
659
- async function ct(n, t) {
660
- const { appId: e, path: i } = t, { data: r, error: o } = await s(
691
+ async function wt(n, t) {
692
+ const { application_name: e, path: i } = t, { data: r, error: o } = await s(
661
693
  (a) => n.POST("/audio/play", {
662
694
  params: {
663
695
  query: {
664
- app_id: e,
696
+ application_name: e,
665
697
  path: i
666
698
  }
667
699
  },
@@ -673,25 +705,19 @@ async function ct(n, t) {
673
705
  throw o;
674
706
  return r;
675
707
  }
676
- async function ut(n, t) {
677
- const { data: e, error: i } = await s(
678
- (r) => n.DELETE("/audio/play", { signal: r }),
679
- t == null ? void 0 : t.timeout
680
- );
708
+ async function ft(n, t) {
709
+ const { data: e, error: i } = await s((r) => n.DELETE("/audio/play", { signal: r }), t == null ? void 0 : t.timeout);
681
710
  if (i)
682
711
  throw i;
683
712
  return e;
684
713
  }
685
- async function ht(n, t) {
686
- const { data: e, error: i } = await s(
687
- (r) => n.GET("/audio/volume", { signal: r }),
688
- t == null ? void 0 : t.timeout
689
- );
714
+ async function lt(n, t) {
715
+ const { data: e, error: i } = await s((r) => n.GET("/audio/volume", { signal: r }), t == null ? void 0 : t.timeout);
690
716
  if (i)
691
717
  throw i;
692
718
  return e;
693
719
  }
694
- async function dt(n, t) {
720
+ async function yt(n, t) {
695
721
  const { volume: e } = t;
696
722
  if (typeof e != "number" || e < 0 || e > 100)
697
723
  throw new Error("Volume must be a number between 0 and 100");
@@ -710,18 +736,18 @@ async function dt(n, t) {
710
736
  throw r;
711
737
  return i;
712
738
  }
713
- class ft {
739
+ class pt {
714
740
  /**
715
741
  * Play audio file. Plays a file from internal storage.
716
742
  *
717
743
  * @param {AudioPlayParams} params - Parameters for audio playback.
718
- * @param {string} params.appId - Application ID.
744
+ * @param {string} params.application_name - Application name.
719
745
  * @param {string} params.path - Path to the audio file.
720
746
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
721
747
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful play command.
722
748
  */
723
749
  async AudioPlay(t) {
724
- return await ct(this.apiClient, t);
750
+ return await wt(this.apiClient, t);
725
751
  }
726
752
  /**
727
753
  * Stop audio playback. Stops any currently playing audio.
@@ -731,7 +757,7 @@ class ft {
731
757
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful stop command.
732
758
  */
733
759
  async AudioStop(t) {
734
- return await ut(this.apiClient, t);
760
+ return await ft(this.apiClient, t);
735
761
  }
736
762
  /**
737
763
  * Get audio volume.
@@ -741,7 +767,7 @@ class ft {
741
767
  * @returns {Promise<AudioVolumeInfo>} A promise that resolves to the audio volume information.
742
768
  */
743
769
  async AudioVolumeGet(t) {
744
- return await ht(this.apiClient, t);
770
+ return await lt(this.apiClient, t);
745
771
  }
746
772
  /**
747
773
  * Set audio volume.
@@ -752,59 +778,45 @@ class ft {
752
778
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
753
779
  */
754
780
  async AudioVolumeSet(t) {
755
- return await dt(this.apiClient, t);
781
+ return await yt(this.apiClient, t);
756
782
  }
757
783
  }
758
- async function lt(n, t) {
759
- const { data: e, error: i } = await s(
760
- (r) => n.GET("/wifi/status", { signal: r }),
761
- t == null ? void 0 : t.timeout
762
- );
784
+ async function St(n, t) {
785
+ const { data: e, error: i } = await s((r) => n.GET("/wifi/status", { signal: r }), t == null ? void 0 : t.timeout);
763
786
  if (i)
764
787
  throw i;
765
788
  return e;
766
789
  }
767
- async function wt(n, t) {
768
- const { data: e, error: i } = await s(
769
- (r) => n.POST("/wifi/connect", {
790
+ async function mt(n, t) {
791
+ const { ssid: e, password: i, security: r, ip_config: o } = t, { data: a, error: c } = await s(
792
+ (d) => n.POST("/wifi/connect", {
770
793
  body: {
771
- ssid: t.ssid,
772
- password: t.password,
773
- security: t.security,
774
- ip_config: {
775
- ip_method: t.ipConfig.ipMethod,
776
- address: t.ipConfig.address,
777
- mask: t.ipConfig.mask,
778
- gateway: t.ipConfig.gateway
779
- }
794
+ ssid: e,
795
+ password: i,
796
+ security: r,
797
+ ip_config: o
780
798
  },
781
- signal: r
799
+ signal: d
782
800
  }),
783
801
  t.timeout
784
802
  );
785
- if (i)
786
- throw i;
787
- return e;
803
+ if (c)
804
+ throw c;
805
+ return a;
788
806
  }
789
- async function yt(n, t) {
790
- const { data: e, error: i } = await s(
791
- (r) => n.POST("/wifi/disconnect", { signal: r }),
792
- t == null ? void 0 : t.timeout
793
- );
807
+ async function Tt(n, t) {
808
+ const { data: e, error: i } = await s((r) => n.POST("/wifi/disconnect", { signal: r }), t == null ? void 0 : t.timeout);
794
809
  if (i)
795
810
  throw i;
796
811
  return e;
797
812
  }
798
- async function pt(n, t) {
799
- const { data: e, error: i } = await s(
800
- (r) => n.GET("/wifi/networks", { signal: r }),
801
- t == null ? void 0 : t.timeout
802
- );
813
+ async function Et(n, t) {
814
+ const { data: e, error: i } = await s((r) => n.GET("/wifi/networks", { signal: r }), t == null ? void 0 : t.timeout);
803
815
  if (i)
804
816
  throw i;
805
817
  return e;
806
818
  }
807
- class St {
819
+ class Ct {
808
820
  /**
809
821
  * Returns current Wi-Fi status.
810
822
  *
@@ -813,7 +825,7 @@ class St {
813
825
  * @returns {Promise<WifiStatusResponse>} A promise that resolves to the Wi-Fi status.
814
826
  */
815
827
  async WifiStatusGet(t) {
816
- return await lt(this.apiClient, t);
828
+ return await St(this.apiClient, t);
817
829
  }
818
830
  /**
819
831
  * Connects to Wi-Fi network.
@@ -822,12 +834,12 @@ class St {
822
834
  * @param {string} params.ssid - Network SSID.
823
835
  * @param {string} params.password - Network password.
824
836
  * @param {WifiSecurityMethod} params.security - Security method.
825
- * @param {object} params.ipConfig - IP configuration.
837
+ * @param {object} [params.ip_config] - IP configuration.
826
838
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
827
839
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful connection initiation.
828
840
  */
829
841
  async WifiConnect(t) {
830
- return await wt(this.apiClient, t);
842
+ return await mt(this.apiClient, t);
831
843
  }
832
844
  /**
833
845
  * Disconnects from Wi-Fi.
@@ -837,7 +849,7 @@ class St {
837
849
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful disconnection.
838
850
  */
839
851
  async WifiDisconnect(t) {
840
- return await yt(this.apiClient, t);
852
+ return await Tt(this.apiClient, t);
841
853
  }
842
854
  /**
843
855
  * Scans environment for available Wi-Fi networks.
@@ -847,10 +859,10 @@ class St {
847
859
  * @returns {Promise<WifiNetworkResponse>} A promise that resolves to a list of available networks.
848
860
  */
849
861
  async WifiNetworksGet(t) {
850
- return await pt(this.apiClient, t);
862
+ return await Et(this.apiClient, t);
851
863
  }
852
864
  }
853
- async function Tt(n, t) {
865
+ async function kt(n, t) {
854
866
  const { path: e, file: i } = t, { data: r, error: o } = await s(
855
867
  (a) => n.POST("/storage/write", {
856
868
  params: {
@@ -870,8 +882,8 @@ async function Tt(n, t) {
870
882
  throw o;
871
883
  return r;
872
884
  }
873
- async function Et(n, t) {
874
- const { path: e, asArrayBuffer: i } = t, { data: r, error: o } = await s(
885
+ async function gt(n, t) {
886
+ const { path: e, as_array_buffer: i } = t, { data: r, error: o } = await s(
875
887
  (a) => n.GET("/storage/read", {
876
888
  params: {
877
889
  query: {
@@ -887,7 +899,7 @@ async function Et(n, t) {
887
899
  throw o;
888
900
  return r;
889
901
  }
890
- async function mt(n, t) {
902
+ async function At(n, t) {
891
903
  const { path: e } = t, { data: i, error: r } = await s(
892
904
  (o) => n.GET("/storage/list", {
893
905
  params: {
@@ -903,7 +915,7 @@ async function mt(n, t) {
903
915
  throw r;
904
916
  return i;
905
917
  }
906
- async function Ct(n, t) {
918
+ async function bt(n, t) {
907
919
  const { path: e } = t, { data: i, error: r } = await s(
908
920
  (o) => n.DELETE("/storage/remove", {
909
921
  params: {
@@ -919,7 +931,7 @@ async function Ct(n, t) {
919
931
  throw r;
920
932
  return i;
921
933
  }
922
- async function kt(n, t) {
934
+ async function Pt(n, t) {
923
935
  const { path: e } = t, { data: i, error: r } = await s(
924
936
  (o) => n.POST("/storage/mkdir", {
925
937
  params: {
@@ -935,16 +947,30 @@ async function kt(n, t) {
935
947
  throw r;
936
948
  return i;
937
949
  }
938
- async function gt(n, t) {
939
- const { data: e, error: i } = await s(
940
- (r) => n.GET("/storage/status", { signal: r }),
941
- t == null ? void 0 : t.timeout
942
- );
950
+ async function Gt(n, t) {
951
+ const { data: e, error: i } = await s((r) => n.GET("/storage/status", { signal: r }), t == null ? void 0 : t.timeout);
943
952
  if (i)
944
953
  throw i;
945
954
  return e;
946
955
  }
947
- class At {
956
+ async function vt(n, t) {
957
+ const { path: e, new_path: i } = t, { data: r, error: o } = await s(
958
+ (a) => n.POST("/storage/rename", {
959
+ params: {
960
+ query: {
961
+ path: e,
962
+ new_path: i
963
+ }
964
+ },
965
+ signal: a
966
+ }),
967
+ t.timeout
968
+ );
969
+ if (o)
970
+ throw o;
971
+ return r;
972
+ }
973
+ class Ot {
948
974
  /**
949
975
  * Upload file to internal storage. Uploads a file to a specified path.
950
976
  *
@@ -955,19 +981,19 @@ class At {
955
981
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful upload.
956
982
  */
957
983
  async StorageWrite(t) {
958
- return await Tt(this.apiClient, t);
984
+ return await kt(this.apiClient, t);
959
985
  }
960
986
  /**
961
987
  * Download file from internal storage. Downloads a file from a specified path.
962
988
  *
963
989
  * @param {DownloadFileParams} params - Download parameters:
964
990
  * @param {string} params.path - Path to the file.
965
- * @param {boolean} [params.asArrayBuffer] - Whether to return ArrayBuffer instead of Blob.
991
+ * @param {boolean} [params.as_array_buffer] - Whether to return ArrayBuffer instead of Blob.
966
992
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
967
993
  * @returns {Promise<StorageReadResponse>} A promise that resolves to the file content (Blob or ArrayBuffer).
968
994
  */
969
995
  async StorageRead(t) {
970
- return await Et(this.apiClient, t);
996
+ return await gt(this.apiClient, t);
971
997
  }
972
998
  /**
973
999
  * List files on internal storage.
@@ -978,7 +1004,7 @@ class At {
978
1004
  * @returns {Promise<StorageList>} A promise that resolves to a list of files and directories.
979
1005
  */
980
1006
  async StorageListGet(t) {
981
- return await mt(this.apiClient, t);
1007
+ return await At(this.apiClient, t);
982
1008
  }
983
1009
  /**
984
1010
  * Remove a file on internal storage. Removes a file with a specified path.
@@ -989,7 +1015,7 @@ class At {
989
1015
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful removal.
990
1016
  */
991
1017
  async StorageRemove(t) {
992
- return await Ct(this.apiClient, t);
1018
+ return await bt(this.apiClient, t);
993
1019
  }
994
1020
  /**
995
1021
  * Create a directory on internal storage. Creates a new directory with a specified path.
@@ -1000,7 +1026,7 @@ class At {
1000
1026
  * @returns {Promise<SuccessResponse>} A promise that resolves on successful creation.
1001
1027
  */
1002
1028
  async StorageMkdir(t) {
1003
- return await kt(this.apiClient, t);
1029
+ return await Pt(this.apiClient, t);
1004
1030
  }
1005
1031
  /**
1006
1032
  * Show storage usage.
@@ -1010,60 +1036,66 @@ class At {
1010
1036
  * @returns {Promise<StorageStatus>} A promise that resolves to the storage status.
1011
1037
  */
1012
1038
  async StorageStatusGet(t) {
1013
- return await gt(this.apiClient, t);
1039
+ return await Gt(this.apiClient, t);
1040
+ }
1041
+ /**
1042
+ * Rename/move a file. Moves a file to a new location.
1043
+ *
1044
+ * @param {RenameParams} params - Rename parameters:
1045
+ * @param {RenameParams['path']} params.path - Current path of the file or directory.
1046
+ * @param {RenameParams['new_path']} params.new_path - New path for the file or directory.
1047
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1048
+ * @returns {Promise<SuccessResponse>} A promise that resolves on successful rename.
1049
+ */
1050
+ async StorageRename(t) {
1051
+ return await vt(this.apiClient, t);
1014
1052
  }
1015
1053
  }
1016
- async function bt(n, t) {
1017
- const { data: e, error: i } = await s(
1018
- (r) => n.GET("/access", { signal: r }),
1019
- t == null ? void 0 : t.timeout
1020
- );
1054
+ async function Lt(n, t) {
1055
+ const { data: e, error: i } = await s((r) => n.GET("/access", { signal: r }), t == null ? void 0 : t.timeout);
1021
1056
  if (i)
1022
1057
  throw i;
1023
1058
  return e;
1024
1059
  }
1025
- async function vt(n, t) {
1026
- let { mode: e, key: i } = t;
1027
- if (i = i ?? "", String(i).trim() && !/^\d{4,10}$/.test(String(i)))
1060
+ async function Dt(n, t) {
1061
+ const { mode: e, key: i } = t, r = i ?? "";
1062
+ if (String(r).trim() && !/^\d{4,10}$/.test(String(r)))
1028
1063
  throw new Error("Key must be a string of 4 to 10 digits");
1029
- const { data: r, error: o } = await s(
1030
- (a) => n.POST("/access", {
1064
+ const { data: o, error: a } = await s(
1065
+ (c) => n.POST("/access", {
1031
1066
  params: {
1032
1067
  query: {
1033
1068
  mode: e,
1034
- key: i
1069
+ key: r
1035
1070
  }
1036
1071
  },
1037
- signal: a
1072
+ signal: c
1038
1073
  }),
1039
1074
  t.timeout
1040
1075
  );
1041
- if (o)
1042
- throw o;
1043
- return r;
1076
+ if (a)
1077
+ throw a;
1078
+ return o;
1044
1079
  }
1045
- async function Pt(n, t) {
1046
- const { data: e, error: i } = await s(
1047
- (r) => n.GET("/name", { signal: r }),
1048
- t == null ? void 0 : t.timeout
1049
- );
1080
+ async function Ut(n, t) {
1081
+ const { data: e, error: i } = await s((r) => n.GET("/name", { signal: r }), t == null ? void 0 : t.timeout);
1050
1082
  if (i)
1051
1083
  throw i;
1052
1084
  return e;
1053
1085
  }
1054
- async function Gt(n, t) {
1055
- const { data: e, error: i } = await s(
1056
- (r) => n.POST("/name", {
1057
- body: t,
1058
- signal: r
1086
+ async function Bt(n, t) {
1087
+ const { name: e } = t, { data: i, error: r } = await s(
1088
+ (o) => n.POST("/name", {
1089
+ body: { name: e },
1090
+ signal: o
1059
1091
  }),
1060
1092
  t.timeout
1061
1093
  );
1062
- if (i)
1063
- throw i;
1064
- return e;
1094
+ if (r)
1095
+ throw r;
1096
+ return i;
1065
1097
  }
1066
- class Lt {
1098
+ class _t {
1067
1099
  /**
1068
1100
  * Get HTTP API access over Wi-Fi configuration.
1069
1101
  *
@@ -1072,19 +1104,19 @@ class Lt {
1072
1104
  * @returns {Promise<HttpAccessInfo>} A promise that resolves to the access configuration.
1073
1105
  */
1074
1106
  async SettingsAccessGet(t) {
1075
- return await bt(this.apiClient, t);
1107
+ return await Lt(this.apiClient, t);
1076
1108
  }
1077
1109
  /**
1078
1110
  * Set HTTP API access over Wi-Fi configuration.
1079
1111
  *
1080
1112
  * @param {HttpAccessParams} params - Access parameters:
1081
1113
  * @param {boolean} params.mode - Enable/disable access.
1082
- * @param {string} params.key - Access key (4-10 digits).
1114
+ * @param {string} [params.key] - Access key (4-10 digits).
1083
1115
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1084
1116
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1085
1117
  */
1086
1118
  async SettingsAccessSet(t) {
1087
- const e = await vt(this.apiClient, t);
1119
+ const e = await Dt(this.apiClient, t);
1088
1120
  return t.mode === "key" && t.key && this.setApiKey(t.key), e;
1089
1121
  }
1090
1122
  /**
@@ -1095,7 +1127,7 @@ class Lt {
1095
1127
  * @returns {Promise<NameInfo>} A promise that resolves to the device name.
1096
1128
  */
1097
1129
  async SettingsNameGet(t) {
1098
- return await Pt(this.apiClient, t);
1130
+ return await Ut(this.apiClient, t);
1099
1131
  }
1100
1132
  /**
1101
1133
  * Set device name.
@@ -1106,46 +1138,34 @@ class Lt {
1106
1138
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1107
1139
  */
1108
1140
  async SettingsNameSet(t) {
1109
- return await Gt(this.apiClient, t);
1141
+ return await Bt(this.apiClient, t);
1110
1142
  }
1111
1143
  }
1112
- async function Ot(n, t) {
1113
- const { data: e, error: i } = await s(
1114
- (r) => n.POST("/ble/enable", { signal: r }),
1115
- t == null ? void 0 : t.timeout
1116
- );
1144
+ async function $t(n, t) {
1145
+ const { data: e, error: i } = await s((r) => n.POST("/ble/enable", { signal: r }), t == null ? void 0 : t.timeout);
1117
1146
  if (i)
1118
1147
  throw i;
1119
1148
  return e;
1120
1149
  }
1121
- async function Dt(n, t) {
1122
- const { data: e, error: i } = await s(
1123
- (r) => n.POST("/ble/disable", { signal: r }),
1124
- t == null ? void 0 : t.timeout
1125
- );
1150
+ async function It(n, t) {
1151
+ const { data: e, error: i } = await s((r) => n.POST("/ble/disable", { signal: r }), t == null ? void 0 : t.timeout);
1126
1152
  if (i)
1127
1153
  throw i;
1128
1154
  return e;
1129
1155
  }
1130
- async function Bt(n, t) {
1131
- const { data: e, error: i } = await s(
1132
- (r) => n.DELETE("/ble/pairing", { signal: r }),
1133
- t == null ? void 0 : t.timeout
1134
- );
1156
+ async function Rt(n, t) {
1157
+ const { data: e, error: i } = await s((r) => n.DELETE("/ble/pairing", { signal: r }), t == null ? void 0 : t.timeout);
1135
1158
  if (i)
1136
1159
  throw i;
1137
1160
  return e;
1138
1161
  }
1139
- async function Ut(n, t) {
1140
- const { data: e, error: i } = await s(
1141
- (r) => n.GET("/ble/status", { signal: r }),
1142
- t == null ? void 0 : t.timeout
1143
- );
1162
+ async function Kt(n, t) {
1163
+ const { data: e, error: i } = await s((r) => n.GET("/ble/status", { signal: r }), t == null ? void 0 : t.timeout);
1144
1164
  if (i)
1145
1165
  throw i;
1146
1166
  return e;
1147
1167
  }
1148
- class It {
1168
+ class Ft {
1149
1169
  /**
1150
1170
  * Enable BLE. Starts advertising.
1151
1171
  *
@@ -1154,7 +1174,7 @@ class It {
1154
1174
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1155
1175
  */
1156
1176
  async BleEnable(t) {
1157
- return await Ot(this.apiClient, t);
1177
+ return await $t(this.apiClient, t);
1158
1178
  }
1159
1179
  /**
1160
1180
  * Disable BLE. Stops advertising.
@@ -1164,7 +1184,7 @@ class It {
1164
1184
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1165
1185
  */
1166
1186
  async BleDisable(t) {
1167
- return await Dt(this.apiClient, t);
1187
+ return await It(this.apiClient, t);
1168
1188
  }
1169
1189
  /**
1170
1190
  * Remove pairing. Remove pairing with previous device.
@@ -1174,7 +1194,7 @@ class It {
1174
1194
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1175
1195
  */
1176
1196
  async BleUnpair(t) {
1177
- return await Bt(this.apiClient, t);
1197
+ return await Rt(this.apiClient, t);
1178
1198
  }
1179
1199
  /**
1180
1200
  * Returns current BLE status.
@@ -1184,11 +1204,11 @@ class It {
1184
1204
  * @returns {Promise<BleStatusResponse>} A promise that resolves to the BLE status.
1185
1205
  */
1186
1206
  async BleStatusGet(t) {
1187
- return await Ut(this.apiClient, t);
1207
+ return await Kt(this.apiClient, t);
1188
1208
  }
1189
1209
  }
1190
- async function $t(n, t) {
1191
- const { keyName: e } = t, { data: i, error: r } = await s(
1210
+ async function Wt(n, t) {
1211
+ const { key: e } = t, { data: i, error: r } = await s(
1192
1212
  (o) => n.POST("/input", {
1193
1213
  params: {
1194
1214
  query: {
@@ -1203,84 +1223,124 @@ async function $t(n, t) {
1203
1223
  throw r;
1204
1224
  return i;
1205
1225
  }
1206
- class Kt {
1226
+ class Mt {
1207
1227
  /**
1208
1228
  * Send input event. Send single key press event.
1209
1229
  *
1210
1230
  * @param {InputKeyParams} params - Button press parameters:
1211
- * @param {KeyName} params.keyName - Name of the key to press.
1231
+ * @param {KeyName} params.key - Key name.
1212
1232
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1213
1233
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1214
1234
  */
1215
1235
  async InputSend(t) {
1216
- return await $t(this.apiClient, t);
1236
+ return await Wt(this.apiClient, t);
1217
1237
  }
1218
1238
  }
1219
- async function Rt(n, t) {
1220
- const { data: e, error: i } = await s(
1221
- (r) => n.GET("/matter/commissioning", { signal: r }),
1222
- t == null ? void 0 : t.timeout
1223
- );
1239
+ async function qt(n, t) {
1240
+ const { data: e, error: i } = await s((r) => n.GET("/smart_home/pairing", { signal: r }), t == null ? void 0 : t.timeout);
1224
1241
  if (i)
1225
1242
  throw i;
1226
1243
  return e;
1227
1244
  }
1228
- async function Ft(n, t) {
1229
- const { data: e, error: i } = await s(
1230
- (r) => n.POST("/matter/commissioning", { signal: r }),
1231
- t == null ? void 0 : t.timeout
1232
- );
1245
+ async function Nt(n, t) {
1246
+ const { data: e, error: i } = await s((r) => n.POST("/smart_home/pairing", { signal: r }), t == null ? void 0 : t.timeout);
1233
1247
  if (i)
1234
1248
  throw i;
1235
1249
  return e;
1236
1250
  }
1237
- async function Wt(n, t) {
1238
- const { data: e, error: i } = await s(
1239
- (r) => n.DELETE("/matter/commissioning", { signal: r }),
1240
- t == null ? void 0 : t.timeout
1241
- );
1251
+ async function xt(n, t) {
1252
+ const { data: e, error: i } = await s((r) => n.DELETE("/smart_home/pairing", { signal: r }), t == null ? void 0 : t.timeout);
1242
1253
  if (i)
1243
1254
  throw i;
1244
1255
  return e;
1245
1256
  }
1246
- class Mt {
1257
+ async function Ht(n, t) {
1258
+ const { data: e, error: i } = await s((r) => n.GET("/smart_home/switch", { signal: r }), t == null ? void 0 : t.timeout);
1259
+ if (i)
1260
+ throw i;
1261
+ return e;
1262
+ }
1263
+ async function Vt(n, t) {
1264
+ const { timeout: e, ...i } = t, { data: r, error: o } = await s((a) => n.POST("/smart_home/switch", { body: i, signal: a }), e);
1265
+ if (o)
1266
+ throw o;
1267
+ return r;
1268
+ }
1269
+ class jt {
1247
1270
  /**
1248
- * Get Matter status.
1271
+ * Smart home commissioning status.
1249
1272
  *
1250
1273
  * @param {TimeoutOptions} [params] - Optional parameters.
1251
1274
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1252
- * @returns {Promise<MatterStatus>} A promise that resolves to the Matter status.
1275
+ * @returns {Promise<SmartHomePairingInfo>} A promise that resolves to the pairing info.
1253
1276
  */
1254
- async MatterStatusGet(t) {
1255
- return await Rt(this.apiClient, t);
1277
+ async SmartHomePairingGet(t) {
1278
+ return await qt(this.apiClient, t);
1256
1279
  }
1257
1280
  /**
1258
- * Pair Matter device.
1281
+ * Link device to a smart home.
1282
+ *
1283
+ * @param {TimeoutOptions} [params] - Optional timeout.
1284
+ * @returns {Promise<SmartHomePairingPayload>} A promise that resolves to the pairing payload.
1285
+ */
1286
+ async SmartHomePair(t) {
1287
+ return await Nt(this.apiClient, t);
1288
+ }
1289
+ /**
1290
+ * Erase all smart home links.
1259
1291
  *
1260
1292
  * @param {TimeoutOptions} [params] - Optional parameters.
1261
1293
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1262
- * @returns {Promise<MatterPairingInfo>} A promise that resolves on success.
1294
+ * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1263
1295
  */
1264
- async MatterPair(t) {
1265
- return await Ft(this.apiClient, t);
1296
+ async SmartHomeErase(t) {
1297
+ return await xt(this.apiClient, t);
1266
1298
  }
1267
1299
  /**
1268
- * Erase Matter devices.
1300
+ * Get state of emulated smart home switch.
1269
1301
  *
1270
1302
  * @param {TimeoutOptions} [params] - Optional parameters.
1271
1303
  * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1304
+ * @returns {Promise<SmartHomeSwitchState>} A promise that resolves to the switch state.
1305
+ */
1306
+ async SmartHomeSwitchStateGet(t) {
1307
+ return await Ht(this.apiClient, t);
1308
+ }
1309
+ /**
1310
+ * Set state of emulated smart home switch.
1311
+ *
1312
+ * @param {SmartHomeSwitchState & TimeoutOptions} params - Switch state and optional timeout.
1272
1313
  * @returns {Promise<SuccessResponse>} A promise that resolves on success.
1273
1314
  */
1315
+ async SmartHomeSwitchStateSet(t) {
1316
+ return await Vt(this.apiClient, t);
1317
+ }
1318
+ // ALIASES for backward compatibility (Matter -> SmartHome)
1319
+ /**
1320
+ * @deprecated Use SmartHomePairingGet instead.
1321
+ */
1322
+ async MatterStatusGet(t) {
1323
+ return await this.SmartHomePairingGet(t);
1324
+ }
1325
+ /**
1326
+ * @deprecated Use SmartHomePair instead.
1327
+ */
1328
+ async MatterPair(t) {
1329
+ return await this.SmartHomePair(t);
1330
+ }
1331
+ /**
1332
+ * @deprecated Use SmartHomeErase instead.
1333
+ */
1274
1334
  async MatterErase(t) {
1275
- return await Wt(this.apiClient, t);
1335
+ return await this.SmartHomeErase(t);
1276
1336
  }
1277
1337
  }
1278
- async function Nt(n, t) {
1279
- const { appId: e, fileName: i, file: r } = t, { data: o, error: a } = await s(
1280
- (u) => n.POST("/assets/upload", {
1338
+ async function zt(n, t) {
1339
+ const { application_name: e, file: i, data: r } = t, { data: o, error: a } = await s(
1340
+ (c) => n.POST("/assets/upload", {
1281
1341
  params: {
1282
1342
  query: {
1283
- app_id: e,
1343
+ application_name: e,
1284
1344
  file: i
1285
1345
  }
1286
1346
  },
@@ -1288,7 +1348,7 @@ async function Nt(n, t) {
1288
1348
  "Content-Type": "application/octet-stream"
1289
1349
  },
1290
1350
  body: r,
1291
- signal: u
1351
+ signal: c
1292
1352
  }),
1293
1353
  t.timeout
1294
1354
  );
@@ -1296,12 +1356,12 @@ async function Nt(n, t) {
1296
1356
  throw a;
1297
1357
  return o;
1298
1358
  }
1299
- async function _t(n, t) {
1300
- const { appId: e } = t, { data: i, error: r } = await s(
1359
+ async function Jt(n, t) {
1360
+ const { application_name: e } = t, { data: i, error: r } = await s(
1301
1361
  (o) => n.DELETE("/assets/upload", {
1302
1362
  params: {
1303
1363
  query: {
1304
- app_id: e
1364
+ application_name: e
1305
1365
  }
1306
1366
  },
1307
1367
  signal: o
@@ -1312,34 +1372,34 @@ async function _t(n, t) {
1312
1372
  throw r;
1313
1373
  return i;
1314
1374
  }
1315
- class xt {
1375
+ class Xt {
1316
1376
  /**
1317
1377
  * Upload asset file with app ID. Uploads a file to a specific app's assets directory.
1318
1378
  *
1319
1379
  * @param {UploadParams} params - Parameters for the upload.
1320
- * @param {UploadParams['appId']} params.appId - Application ID for organizing assets.
1321
- * @param {UploadParams['fileName']} params.fileName - Filename for the uploaded asset.
1322
- * @param {UploadParams['file']} params.file - File data to upload.
1323
- * @param {UploadParams['timeout']} [params.timeout] - Request timeout in milliseconds.
1380
+ * @param {string} params.application_name - Application name for organizing assets.
1381
+ * @param {string} params.file - Filename for the uploaded asset.
1382
+ * @param {BusyFile} params.data - File data to upload.
1383
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1324
1384
  * @returns {Promise<SuccessResponse>} Result of the upload operation.
1325
1385
  */
1326
1386
  async AssetsUpload(t) {
1327
- return await Nt(this.apiClient, t);
1387
+ return await zt(this.apiClient, t);
1328
1388
  }
1329
1389
  /**
1330
1390
  * Delete app assets. Deletes all assets for a specific app ID.
1331
1391
  *
1332
1392
  * @param {DeleteParams} params - Parameters for the delete.
1333
- * @param {DeleteParams['appId']} params.appId - Application ID whose assets should be deleted.
1334
- * @param {DeleteParams['timeout']} [params.timeout] - Request timeout in milliseconds.
1393
+ * @param {string} params.application_name - Application name whose assets should be deleted.
1394
+ * @param {TimeoutOptions['timeout']} [params.timeout] - Request timeout in milliseconds.
1335
1395
  * @returns {Promise<SuccessResponse>} Result of the delete operation.
1336
1396
  */
1337
1397
  async AssetsDelete(t) {
1338
- return await _t(this.apiClient, t);
1398
+ return await Jt(this.apiClient, t);
1339
1399
  }
1340
1400
  }
1341
- const S = "http://10.0.4.20", qt = "https://proxy.busy.app", Vt = /^https?:\/\/proxy(?:\.(?:dev|test|stage))?\.busy\.app$/i;
1342
- function T(n) {
1401
+ const S = "http://10.0.4.20", Yt = "https://proxy.busy.app", Qt = /^https?:\/\/proxy(?:\.(?:dev|test|stage))?\.busy\.app$/i;
1402
+ function m(n) {
1343
1403
  const t = n.split(".");
1344
1404
  if (t.length !== 4)
1345
1405
  return !1;
@@ -1352,10 +1412,10 @@ function T(n) {
1352
1412
  }
1353
1413
  return !0;
1354
1414
  }
1355
- function E(n) {
1415
+ function T(n) {
1356
1416
  return /\.local$/i.test(n);
1357
1417
  }
1358
- class jt {
1418
+ class Zt {
1359
1419
  /**
1360
1420
  * Creates an instance of BUSY Bar.
1361
1421
  * Initializes the API client with the provided host address.
@@ -1384,41 +1444,37 @@ class jt {
1384
1444
  * @type {BusyBarConfig['host']}
1385
1445
  * @readonly
1386
1446
  */
1387
- c(this, "addr");
1447
+ u(this, "addr");
1388
1448
  /**
1389
1449
  * Current API semantic version.
1390
1450
  * @type {ApiSemver}
1391
1451
  */
1392
- c(this, "apiSemver");
1452
+ u(this, "apiSemver");
1393
1453
  /**
1394
1454
  * API Client instance.
1395
1455
  */
1396
- c(this, "apiClient");
1397
- c(this, "setApiKeyFn");
1398
- c(this, "setTokenFn");
1456
+ u(this, "apiClient");
1457
+ u(this, "setApiKeyFn");
1458
+ u(this, "setTokenFn");
1399
1459
  /**
1400
1460
  * Detected connection type based on auth requirements.
1401
1461
  * - "wifi": Device requires authentication (returned 401/403).
1402
1462
  * - "usb": Device allows access without token (returned 200).
1403
1463
  * - "unknown": Detection failed or not yet completed.
1404
1464
  */
1405
- c(this, "connectionType", "unknown");
1465
+ u(this, "connectionType", "unknown");
1406
1466
  if (!t || !t.addr && !t.token)
1407
1467
  this.addr = S;
1408
1468
  else if (!t.addr)
1409
- this.addr = qt;
1469
+ this.addr = Yt;
1410
1470
  else {
1411
1471
  let o = t.addr.trim();
1412
- if (/^https?:\/\//i.test(o) || (o = `http://${o}`), Vt.test(o) && !t.token)
1472
+ if (/^https?:\/\//i.test(o) || (o = `http://${o}`), Qt.test(o) && !t.token)
1413
1473
  throw new Error("Token is required. Please provide it.");
1414
1474
  this.addr = o;
1415
1475
  }
1416
1476
  this.apiSemver = "";
1417
- const { client: e, setApiKey: i, setToken: r } = O(
1418
- `${this.addr}/api/`,
1419
- this.SystemVersionGet.bind(this),
1420
- t == null ? void 0 : t.token
1421
- );
1477
+ const { client: e, setApiKey: i, setToken: r } = L(`${this.addr}/api/`, this.SystemVersionGet.bind(this), t == null ? void 0 : t.token);
1422
1478
  this.apiClient = e, this.setApiKeyFn = i, this.setTokenFn = r, this.detectConnectionType();
1423
1479
  }
1424
1480
  /**
@@ -1427,11 +1483,11 @@ class jt {
1427
1483
  */
1428
1484
  async detectConnectionType() {
1429
1485
  const t = new URL(this.addr).hostname;
1430
- if (!T(t) && !E(t)) {
1486
+ if (!m(t) && !T(t)) {
1431
1487
  this.connectionType = "wifi";
1432
1488
  return;
1433
1489
  }
1434
- const e = m({
1490
+ const e = E({
1435
1491
  baseUrl: `${this.addr}/api/`
1436
1492
  });
1437
1493
  try {
@@ -1441,9 +1497,7 @@ class jt {
1441
1497
  else if (i.ok)
1442
1498
  this.connectionType = "usb";
1443
1499
  else
1444
- throw new Error(
1445
- `Failed to detect connection type. Status: ${i.status}`
1446
- );
1500
+ throw new Error(`Failed to detect connection type. Status: ${i.status}`);
1447
1501
  } catch (i) {
1448
1502
  throw i;
1449
1503
  }
@@ -1463,31 +1517,27 @@ class jt {
1463
1517
  this.setTokenFn(t);
1464
1518
  }
1465
1519
  }
1466
- function zt(n, t) {
1520
+ function te(n, t) {
1467
1521
  t.forEach((e) => {
1468
1522
  Object.getOwnPropertyNames(e.prototype).forEach((i) => {
1469
- Object.defineProperty(
1470
- n.prototype,
1471
- i,
1472
- Object.getOwnPropertyDescriptor(e.prototype, i) || /* @__PURE__ */ Object.create(null)
1473
- );
1523
+ Object.defineProperty(n.prototype, i, Object.getOwnPropertyDescriptor(e.prototype, i) || /* @__PURE__ */ Object.create(null));
1474
1524
  });
1475
1525
  });
1476
1526
  }
1477
- zt(jt, [
1478
- $,
1479
- _,
1480
- H,
1481
- et,
1482
- at,
1483
- ft,
1484
- St,
1485
- At,
1486
- Lt,
1487
- It,
1488
- Kt,
1527
+ te(Zt, [
1528
+ R,
1529
+ V,
1530
+ Q,
1531
+ ot,
1532
+ dt,
1533
+ pt,
1534
+ Ct,
1535
+ Ot,
1536
+ _t,
1537
+ Ft,
1489
1538
  Mt,
1490
- xt
1539
+ jt,
1540
+ Xt
1491
1541
  ]);
1492
1542
  var p = /* @__PURE__ */ ((n) => (n[n.FRONT = 0] = "FRONT", n[n.BACK = 1] = "BACK", n))(p || {});
1493
1543
  const C = 3e3, k = /* @__PURE__ */ new Set([1001, 1006, 1012, 1013, 1014, 3008]);
@@ -1499,27 +1549,27 @@ function g(n, t) {
1499
1549
  throw new Error(`Unexpected undefined at index ${t}`);
1500
1550
  return e;
1501
1551
  }
1502
- function Ht(n, t) {
1552
+ function ee(n, t) {
1503
1553
  let e = 0;
1504
1554
  const i = n.length, r = [];
1505
1555
  for (; e < i; ) {
1506
1556
  const o = g(n, e);
1507
1557
  if (e += 1, (o & 128) !== 0) {
1508
1558
  const a = o & 127;
1509
- for (let u = 0; u < a * t; u++)
1510
- r.push(n[e + u]);
1559
+ for (let c = 0; c < a * t; c++)
1560
+ r.push(n[e + c]);
1511
1561
  e += a * t;
1512
1562
  } else {
1513
- const a = o, u = n.slice(e, e + t);
1514
- for (let l = 0; l < a; l++)
1563
+ const a = o, c = n.slice(e, e + t);
1564
+ for (let d = 0; d < a; d++)
1515
1565
  for (let f = 0; f < t; f++)
1516
- r.push(u[f]);
1566
+ r.push(c[f]);
1517
1567
  e += t;
1518
1568
  }
1519
1569
  }
1520
1570
  return new Uint8Array(r);
1521
1571
  }
1522
- function Jt(n) {
1572
+ function ie(n) {
1523
1573
  const t = new Uint8Array(n.length * 2);
1524
1574
  let e = 0, i = 0;
1525
1575
  for (; e < n.length; ) {
@@ -1529,18 +1579,18 @@ function Jt(n) {
1529
1579
  return t;
1530
1580
  }
1531
1581
  const A = () => typeof window < "u" && typeof window.document < "u";
1532
- class Qt {
1582
+ class oe {
1533
1583
  constructor(t) {
1534
- c(this, "addr");
1535
- c(this, "connected", !1);
1584
+ u(this, "addr");
1585
+ u(this, "connected", !1);
1536
1586
  // @ts-ignore
1537
- c(this, "apiKey");
1587
+ u(this, "apiKey");
1538
1588
  // @ts-ignore
1539
- c(this, "apiSemver");
1540
- c(this, "dataListeners", []);
1541
- c(this, "stopListeners", []);
1542
- c(this, "errorListeners", []);
1543
- c(this, "socket", null);
1589
+ u(this, "apiSemver");
1590
+ u(this, "dataListeners", []);
1591
+ u(this, "stopListeners", []);
1592
+ u(this, "errorListeners", []);
1593
+ u(this, "socket", null);
1544
1594
  if (this.config = t, !A())
1545
1595
  throw new Error("not browser");
1546
1596
  if (t.apiKey && (this.apiKey = t.apiKey), t.apiSemver && (this.apiSemver = t.apiSemver), !t || !t.addr)
@@ -1550,10 +1600,8 @@ class Qt {
1550
1600
  /^https?:\/\//i.test(e) || (e = `http://${e}`);
1551
1601
  try {
1552
1602
  const r = new URL(e).hostname;
1553
- if (!T(r) && !E(r))
1554
- throw new Error(
1555
- `Invalid address: "${t.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`
1556
- );
1603
+ if (!m(r) && !T(r))
1604
+ throw new Error(`Invalid address: "${t.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`);
1557
1605
  } catch (i) {
1558
1606
  throw i instanceof Error && i.message.startsWith("Invalid address") ? i : new Error(`Invalid URL format: "${t.addr}"`);
1559
1607
  }
@@ -1596,8 +1644,8 @@ class Qt {
1596
1644
  let r;
1597
1645
  const o = this.config.deviceScreen === p.FRONT ? 3 : 2;
1598
1646
  try {
1599
- const a = Ht(i, o);
1600
- this.config.deviceScreen === p.BACK ? r = Jt(a) : r = a, this.emitData(r);
1647
+ const a = ee(i, o);
1648
+ this.config.deviceScreen === p.BACK ? r = ie(a) : r = a, this.emitData(r);
1601
1649
  } catch {
1602
1650
  this.emitData(i);
1603
1651
  }
@@ -1631,19 +1679,19 @@ class Qt {
1631
1679
  });
1632
1680
  }
1633
1681
  }
1634
- class Zt {
1682
+ class se {
1635
1683
  constructor(t) {
1636
- c(this, "addr");
1637
- c(this, "connected", !1);
1684
+ u(this, "addr");
1685
+ u(this, "connected", !1);
1638
1686
  // @ts-ignore
1639
- c(this, "apiKey");
1687
+ u(this, "apiKey");
1640
1688
  // @ts-ignore
1641
- c(this, "apiSemver");
1642
- c(this, "inputEvent");
1643
- c(this, "dataListeners", []);
1644
- c(this, "stopListeners", []);
1645
- c(this, "errorListeners", []);
1646
- c(this, "socket", null);
1689
+ u(this, "apiSemver");
1690
+ u(this, "inputEvent");
1691
+ u(this, "dataListeners", []);
1692
+ u(this, "stopListeners", []);
1693
+ u(this, "errorListeners", []);
1694
+ u(this, "socket", null);
1647
1695
  if (!A())
1648
1696
  throw new Error("not browser");
1649
1697
  if (t != null && t.apiKey && (this.apiKey = t.apiKey), t != null && t.apiSemver && (this.apiSemver = t.apiSemver), !t || !t.addr)
@@ -1653,10 +1701,8 @@ class Zt {
1653
1701
  /^https?:\/\//i.test(e) || (e = `http://${e}`);
1654
1702
  try {
1655
1703
  const r = new URL(e).hostname;
1656
- if (!T(r) && !E(r))
1657
- throw new Error(
1658
- `Invalid address: "${t.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`
1659
- );
1704
+ if (!m(r) && !T(r))
1705
+ throw new Error(`Invalid address: "${t.addr}". Only IP addresses and mDNS names (ending in .local) are supported.`);
1660
1706
  } catch (i) {
1661
1707
  throw i instanceof Error && i.message.startsWith("Invalid address") ? i : new Error(`Invalid URL format: "${t.addr}"`);
1662
1708
  }
@@ -1734,8 +1780,8 @@ class Zt {
1734
1780
  }
1735
1781
  }
1736
1782
  export {
1737
- jt as BusyBar,
1783
+ Zt as BusyBar,
1738
1784
  p as DeviceScreen,
1739
- Zt as Input,
1740
- Qt as ScreenStream
1785
+ se as Input,
1786
+ oe as ScreenStream
1741
1787
  };