@limrun/ui 0.17.0-rc.4 → 0.17.0-rc.6

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.
@@ -1,39 +1,39 @@
1
- import { jsx as k, jsxs as ce, Fragment as Lr } from "react/jsx-runtime";
2
- import { memo as er, useState as X, useEffect as de, useMemo as Re, useCallback as Nn, lazy as In, forwardRef as Yn, useRef as _, useImperativeHandle as Kn, Suspense as kn } from "react";
3
- import { createPortal as Pn } from "react-dom";
4
- import './index.css';function Fr(r) {
1
+ import { jsx as k, jsxs as ce, Fragment as Fr } from "react/jsx-runtime";
2
+ import { memo as or, useState as X, useEffect as de, useMemo as Re, useCallback as In, lazy as Yn, forwardRef as Kn, useRef as _, useImperativeHandle as kn, Suspense as Pn } from "react";
3
+ import { createPortal as Un } from "react-dom";
4
+ import './index.css';function Wr(r) {
5
5
  var t, c, a = "";
6
6
  if (typeof r == "string" || typeof r == "number") a += r;
7
7
  else if (typeof r == "object") if (Array.isArray(r)) {
8
8
  var E = r.length;
9
- for (t = 0; t < E; t++) r[t] && (c = Fr(r[t])) && (a && (a += " "), a += c);
9
+ for (t = 0; t < E; t++) r[t] && (c = Wr(r[t])) && (a && (a += " "), a += c);
10
10
  } else for (c in r) r[c] && (a && (a += " "), a += c);
11
11
  return a;
12
12
  }
13
13
  function Ne() {
14
- for (var r, t, c = 0, a = "", E = arguments.length; c < E; c++) (r = arguments[c]) && (t = Fr(r)) && (a && (a += " "), a += t);
14
+ for (var r, t, c = 0, a = "", E = arguments.length; c < E; c++) (r = arguments[c]) && (t = Wr(r)) && (a && (a += " "), a += t);
15
15
  return a;
16
16
  }
17
- const Yi = { width: 164.6, height: 117.8, depth: 5.2 };
18
- function Ki(r, t, c) {
17
+ const Ki = { width: 164.6, height: 117.8, depth: 5.2 };
18
+ function ki(r, t, c) {
19
19
  return r = Math.max(0, Math.min(1, r)), t = Math.max(0, Math.min(1, t)), c === 1 ? { x: t, y: 1 - r } : c === 2 ? { x: 1 - r, y: 1 - t } : c === 3 ? { x: 1 - t, y: r } : { x: r, y: t };
20
20
  }
21
- function Un(r) {
21
+ function Ln(r) {
22
22
  return Number.isFinite(r) && r >= 0 && r <= 180;
23
23
  }
24
- function ki(r, t) {
24
+ function Pi(r, t) {
25
25
  return { x: Math.max(0, Math.min(1, r)), y: Math.max(0, Math.min(1, 1 - t)) };
26
26
  }
27
- function Pi(r, t, c) {
27
+ function Ui(r, t, c) {
28
28
  return t && (r || !c) ? "touch" : r ? "ignore" : "orbit";
29
29
  }
30
- function Ln(r, t, c, a) {
30
+ function xn(r, t, c, a) {
31
31
  if (!Number.isInteger(r) || r < 0 || r > 3 || !Number.isInteger(t) || t < 1 || t > 255 || !Number.isFinite(c) || !Number.isFinite(a) || c < 0 || c > 1 || a < 0 || a > 1)
32
32
  throw new RangeError("Invalid display touch coordinates");
33
33
  const E = new ArrayBuffer(12), m = new DataView(E);
34
34
  return m.setUint8(0, 19), m.setUint8(1, r), m.setUint8(2, t), m.setFloat32(4, c, !0), m.setFloat32(8, a, !0), E;
35
35
  }
36
- class Ui {
36
+ class Li {
37
37
  constructor(t, c) {
38
38
  this.send = t, this.failed = c;
39
39
  }
@@ -43,7 +43,7 @@ class Ui {
43
43
  running = !1;
44
44
  stopped = !1;
45
45
  set(t) {
46
- this.stopped || !Un(t) || (this.latest = t, this.flush());
46
+ this.stopped || !Ln(t) || (this.latest = t, this.flush());
47
47
  }
48
48
  stop() {
49
49
  this.stopped = !0, this.latest = void 0;
@@ -64,7 +64,7 @@ class Ui {
64
64
  }
65
65
  }
66
66
  }
67
- const Li = {
67
+ const xi = {
68
68
  side: "Sleep/Wake",
69
69
  volumeUp: "Volume Up",
70
70
  volumeDown: "Volume Down"
@@ -91,7 +91,7 @@ class Fi {
91
91
  this.tail = this.tail.then(() => this.send(t, c)).catch(this.failed);
92
92
  }
93
93
  }
94
- const Pt = {
94
+ const Ut = {
95
95
  INJECT_KEYCODE: 0,
96
96
  INJECT_TOUCH_EVENT: 2,
97
97
  // iOS-specific: send two touch points in one message (Option/Alt+drag pinch)
@@ -233,7 +233,7 @@ const Pt = {
233
233
  KEYCODE_NUMPAD_COMMA: 159,
234
234
  KEYCODE_NUMPAD_ENTER: 160,
235
235
  KEYCODE_NUMPAD_EQUALS: 161
236
- }, xr = {
236
+ }, Hr = {
237
237
  KeyA: s.KEYCODE_A,
238
238
  KeyB: s.KEYCODE_B,
239
239
  KeyC: s.KEYCODE_C,
@@ -340,65 +340,65 @@ const Pt = {
340
340
  NumpadEnter: s.KEYCODE_NUMPAD_ENTER,
341
341
  NumpadEqual: s.KEYCODE_NUMPAD_EQUALS
342
342
  };
343
- function Yt(r, t, c, a, E, m, C = 1, v = 0, b = 0) {
344
- const D = new ArrayBuffer(32), R = new DataView(D);
343
+ function Kt(r, t, c, a, E, m, C = 1, v = 0, R = 0) {
344
+ const D = new ArrayBuffer(32), N = new DataView(D);
345
345
  let M = 0;
346
- return R.setUint8(M, Pt.INJECT_TOUCH_EVENT), M += 1, R.setUint8(M, r), M += 1, R.setBigInt64(M, BigInt(t), !0), M += 8, R.setInt32(M, Math.round(E), !0), M += 4, R.setInt32(M, Math.round(m), !0), M += 4, R.setUint16(M, c, !0), M += 2, R.setUint16(M, a, !0), M += 2, R.setInt16(M, Math.round(C * 65535), !0), M += 2, R.setInt32(M, v, !0), M += 4, R.setInt32(M, b, !0), D;
346
+ return N.setUint8(M, Ut.INJECT_TOUCH_EVENT), M += 1, N.setUint8(M, r), M += 1, N.setBigInt64(M, BigInt(t), !0), M += 8, N.setInt32(M, Math.round(E), !0), M += 4, N.setInt32(M, Math.round(m), !0), M += 4, N.setUint16(M, c, !0), M += 2, N.setUint16(M, a, !0), M += 2, N.setInt16(M, Math.round(C * 65535), !0), M += 2, N.setInt32(M, v, !0), M += 4, N.setInt32(M, R, !0), D;
347
347
  }
348
348
  function Fn(r, t, c, a, E, m, C) {
349
- const v = new ArrayBuffer(24), b = new DataView(v);
349
+ const v = new ArrayBuffer(24), R = new DataView(v);
350
350
  let D = 0;
351
- return b.setUint8(D, Pt.INJECT_TWO_FINGER_TOUCH_EVENT), D += 1, b.setUint8(D, r), D += 1, b.setInt32(D, Math.round(a), !0), D += 4, b.setInt32(D, Math.round(E), !0), D += 4, b.setInt32(D, Math.round(m), !0), D += 4, b.setInt32(D, Math.round(C), !0), D += 4, b.setUint16(D, t, !0), D += 2, b.setUint16(D, c, !0), D += 2, b.setUint16(D, 0, !0), v;
351
+ return R.setUint8(D, Ut.INJECT_TWO_FINGER_TOUCH_EVENT), D += 1, R.setUint8(D, r), D += 1, R.setInt32(D, Math.round(a), !0), D += 4, R.setInt32(D, Math.round(E), !0), D += 4, R.setInt32(D, Math.round(m), !0), D += 4, R.setInt32(D, Math.round(C), !0), D += 4, R.setUint16(D, t, !0), D += 2, R.setUint16(D, c, !0), D += 2, R.setUint16(D, 0, !0), v;
352
352
  }
353
- function xn(r, t = !0) {
353
+ function Wn(r, t = !0) {
354
354
  const a = new TextEncoder().encode(r), E = new ArrayBuffer(14 + a.length), m = new DataView(E);
355
355
  let C = 0;
356
- return m.setUint8(C, Pt.SET_CLIPBOARD), C += 1, m.setBigInt64(C, BigInt(0), !1), C += 8, m.setUint8(C, t ? 1 : 0), C += 1, m.setUint32(C, a.length, !1), C += 4, new Uint8Array(E, C).set(a), E;
356
+ return m.setUint8(C, Ut.SET_CLIPBOARD), C += 1, m.setBigInt64(C, BigInt(0), !1), C += 8, m.setUint8(C, t ? 1 : 0), C += 1, m.setUint32(C, a.length, !1), C += 4, new Uint8Array(E, C).set(a), E;
357
357
  }
358
358
  function pt(r, t, c = 0, a = 0) {
359
359
  const E = new ArrayBuffer(14), m = new DataView(E);
360
360
  let C = 0;
361
- return m.setUint8(C, Pt.INJECT_KEYCODE), C += 1, m.setUint8(C, r), C += 1, m.setInt32(C, t, !0), C += 4, m.setInt32(C, c, !0), C += 4, m.setInt32(C, a, !0), E;
361
+ return m.setUint8(C, Ut.INJECT_KEYCODE), C += 1, m.setUint8(C, r), C += 1, m.setInt32(C, t, !0), C += 4, m.setInt32(C, c, !0), C += 4, m.setInt32(C, a, !0), E;
362
362
  }
363
- const Qt = "Accessibility unavailable on this device.", kt = 500, Wr = (r, t) => Math.abs(r.x - t.x) < 0.5 && Math.abs(r.y - t.y) < 0.5 && Math.abs(r.width - t.width) < 0.5 && Math.abs(r.height - t.height) < 0.5, Wn = (r) => Math.max(0, r.width) * Math.max(0, r.height), Hn = (r) => {
363
+ const nr = "Accessibility unavailable on this device.", Pt = 500, $r = (r, t) => Math.abs(r.x - t.x) < 0.5 && Math.abs(r.y - t.y) < 0.5 && Math.abs(r.width - t.width) < 0.5 && Math.abs(r.height - t.height) < 0.5, Hn = (r) => Math.max(0, r.width) * Math.max(0, r.height), $n = (r) => {
364
364
  const t = r.find((c) => c.frame && c.frame.width > 0 && c.frame.height > 0);
365
365
  return t?.frame ? ((Math.abs(t.frame.x) > 0.5 || Math.abs(t.frame.y) > 0.5) && console.warn(
366
366
  `[ax-tree] iOS root frame is not anchored at (0,0): (${t.frame.x},${t.frame.y}). Element positions may be slightly off from the rendered video.`
367
367
  ), { x: 0, y: 0, width: t.frame.width, height: t.frame.height }) : { x: 0, y: 0, width: 1, height: 1 };
368
- }, $n = (r) => {
368
+ }, Xn = (r) => {
369
369
  const t = {};
370
370
  return typeof r.AXUniqueId == "string" && r.AXUniqueId.length > 0 && (t.AXUniqueId = r.AXUniqueId), typeof r.AXLabel == "string" && r.AXLabel.length > 0 && (t.AXLabel = r.AXLabel), typeof r.type == "string" && r.type.length > 0 && (t.className = r.type), t;
371
- }, Xn = (r) => {
371
+ }, Bn = (r) => {
372
372
  const t = {};
373
373
  for (const [c, a] of Object.entries(r))
374
374
  c !== "children" && (t[c] = a);
375
375
  return t;
376
376
  };
377
- function Bn(r) {
378
- const t = Array.isArray(r) ? r : [r], c = Hn(t), a = [], E = (m, C) => {
379
- if (a.length >= kt) return;
377
+ function qn(r) {
378
+ const t = Array.isArray(r) ? r : [r], c = $n(t), a = [], E = (m, C) => {
379
+ if (a.length >= Pt) return;
380
380
  const v = m.frame;
381
- if (v && v.width > 0 && v.height > 0 && !Wr(v, c)) {
382
- const D = m.role_description || m.role || "", R = (typeof m.AXLabel == "string" ? m.AXLabel : "") || (typeof m.title == "string" ? m.title : "") || "";
381
+ if (v && v.width > 0 && v.height > 0 && !$r(v, c)) {
382
+ const D = m.role_description || m.role || "", N = (typeof m.AXLabel == "string" ? m.AXLabel : "") || (typeof m.title == "string" ? m.title : "") || "";
383
383
  a.push({
384
384
  id: typeof m.AXUniqueId == "string" && m.AXUniqueId.length > 0 ? m.AXUniqueId : C,
385
385
  path: C,
386
- label: R,
386
+ label: N,
387
387
  value: typeof m.AXValue == "string" ? m.AXValue : "",
388
388
  role: D,
389
389
  type: typeof m.type == "string" ? m.type : "",
390
390
  enabled: m.enabled !== !1,
391
391
  focused: m.focused === !0,
392
392
  frame: { x: v.x, y: v.y, width: v.width, height: v.height },
393
- selectors: $n(m),
394
- raw: Xn(m)
393
+ selectors: Xn(m),
394
+ raw: Bn(m)
395
395
  });
396
396
  }
397
- const b = Array.isArray(m.children) ? m.children : [];
398
- for (let D = 0; D < b.length && a.length < kt; D++)
399
- E(b[D], `${C}.${D}`);
397
+ const R = Array.isArray(m.children) ? m.children : [];
398
+ for (let D = 0; D < R.length && a.length < Pt; D++)
399
+ E(R[D], `${C}.${D}`);
400
400
  };
401
- for (let m = 0; m < t.length && a.length < kt; m++)
401
+ for (let m = 0; m < t.length && a.length < Pt; m++)
402
402
  E(t[m], String(m));
403
403
  return {
404
404
  platform: "ios",
@@ -407,7 +407,7 @@ function Bn(r) {
407
407
  capturedAt: Date.now()
408
408
  };
409
409
  }
410
- const qn = (r) => {
410
+ const Vn = (r) => {
411
411
  let t = { x: 0, y: 0, width: 1, height: 1 }, c = 0;
412
412
  for (const a of r) {
413
413
  const E = a.parsedBounds;
@@ -416,31 +416,31 @@ const qn = (r) => {
416
416
  v > c && (c = v, t = { x: 0, y: 0, width: m, height: C });
417
417
  }
418
418
  return t;
419
- }, Vn = (r) => {
419
+ }, Gn = (r) => {
420
420
  const t = {};
421
421
  return typeof r.resourceId == "string" && r.resourceId.length > 0 && (t.resourceId = r.resourceId), typeof r.contentDesc == "string" && r.contentDesc.length > 0 && (t.contentDesc = r.contentDesc), typeof r.text == "string" && r.text.length > 0 && (t.text = r.text), typeof r.className == "string" && r.className.length > 0 && (t.className = r.className), t;
422
422
  };
423
- function Gn(r) {
424
- const t = qn(r), c = [];
425
- for (let a = 0; a < r.length && c.length < kt; a++) {
423
+ function Jn(r) {
424
+ const t = Vn(r), c = [];
425
+ for (let a = 0; a < r.length && c.length < Pt; a++) {
426
426
  const E = r[a], m = E.parsedBounds;
427
427
  if (!m) continue;
428
428
  const C = Math.max(0, m.right - m.left), v = Math.max(0, m.bottom - m.top);
429
429
  if (C <= 0 || v <= 0) continue;
430
- const b = { x: m.left, y: m.top, width: C, height: v };
431
- if (Wr(b, { x: 0, y: 0, width: t.width, height: t.height })) continue;
432
- const D = E.contentDesc || E.text || "", R = E.className || "";
430
+ const R = { x: m.left, y: m.top, width: C, height: v };
431
+ if ($r(R, { x: 0, y: 0, width: t.width, height: t.height })) continue;
432
+ const D = E.contentDesc || E.text || "", N = E.className || "";
433
433
  c.push({
434
434
  id: E.resourceId && E.resourceId.length > 0 ? E.resourceId : E.contentDesc && E.contentDesc.length > 0 ? `cd:${E.contentDesc}` : String(a),
435
435
  path: String(a),
436
436
  label: D,
437
437
  value: typeof E.text == "string" ? E.text : "",
438
- role: R,
439
- type: R,
438
+ role: N,
439
+ type: N,
440
440
  enabled: E.enabled !== !1,
441
441
  focused: E.focused === !0,
442
- frame: b,
443
- selectors: Vn(E),
442
+ frame: R,
443
+ selectors: Gn(E),
444
444
  raw: { ...E }
445
445
  });
446
446
  }
@@ -451,34 +451,34 @@ function Gn(r) {
451
451
  capturedAt: Date.now()
452
452
  };
453
453
  }
454
- function Jn(r, t) {
454
+ function zn(r, t) {
455
455
  const c = Math.max(0, r.x), a = Math.max(0, r.y), E = Math.min(t.width, r.x + r.width), m = Math.min(t.height, r.y + r.height), C = Math.max(0, E - c), v = Math.max(0, m - a);
456
456
  return C > 0 && v > 0 ? { x: c, y: a, width: C, height: v } : null;
457
457
  }
458
- function Hr(r, t) {
458
+ function Xr(r, t) {
459
459
  if (r === t) return !0;
460
460
  if (r.id !== t.id || r.path !== t.path || r.label !== t.label || r.value !== t.value || r.role !== t.role || r.type !== t.type || r.enabled !== t.enabled || r.focused !== t.focused) return !1;
461
461
  const c = r.frame, a = t.frame;
462
462
  return c.x === a.x && c.y === a.y && c.width === a.width && c.height === a.height;
463
463
  }
464
- function $r(r, t) {
464
+ function Br(r, t) {
465
465
  if (r === t) return !0;
466
466
  if (!r || !t || r.platform !== t.platform || r.screen.width !== t.screen.width || r.screen.height !== t.screen.height || r.elements.length !== t.elements.length) return !1;
467
467
  for (let c = 0; c < r.elements.length; c++)
468
- if (!Hr(r.elements[c], t.elements[c])) return !1;
468
+ if (!Xr(r.elements[c], t.elements[c])) return !1;
469
469
  return !0;
470
470
  }
471
- function zn(r, t, c) {
471
+ function jn(r, t, c) {
472
472
  let a = null, E = 1 / 0;
473
473
  for (const m of r.elements) {
474
474
  const C = m.frame;
475
475
  if (t < C.x || c < C.y || t > C.x + C.width || c > C.y + C.height) continue;
476
- const v = Wn(C);
476
+ const v = Hn(C);
477
477
  v < E && (E = v, a = m);
478
478
  }
479
479
  return a;
480
480
  }
481
- function jn(r, t) {
481
+ function Qn(r, t) {
482
482
  if (t === "ios") {
483
483
  if (r.selectors.AXUniqueId)
484
484
  return `client.tapElement({ AXUniqueId: ${JSON.stringify(r.selectors.AXUniqueId)} })`;
@@ -490,21 +490,21 @@ function jn(r, t) {
490
490
  }
491
491
  return r.selectors.resourceId ? `client.tap({ selector: { resourceId: ${JSON.stringify(r.selectors.resourceId)} } })` : r.selectors.contentDesc ? `client.tap({ selector: { contentDesc: ${JSON.stringify(r.selectors.contentDesc)} } })` : r.selectors.text ? `client.tap({ selector: { text: ${JSON.stringify(r.selectors.text)} } })` : null;
492
492
  }
493
- function Xr(r) {
493
+ function qr(r) {
494
494
  const t = r.role || r.type || "";
495
495
  if (!t) return "element";
496
496
  let c = t.replace(/^AX/, "");
497
497
  return c.includes(".") && (c = c.split(".").pop()), c === "GenericElement" ? "Element" : (c = c.replace(/([a-z])([A-Z])/g, "$1 $2"), c);
498
498
  }
499
- const Yr = 80;
500
- function Br(r) {
501
- const t = Xr(r), c = r.label || r.value || "";
499
+ const kr = 80;
500
+ function Vr(r) {
501
+ const t = qr(r), c = r.label || r.value || "";
502
502
  if (!c) return t;
503
- const a = c.length > Yr ? c.slice(0, Yr).trimEnd() + "…" : c;
503
+ const a = c.length > kr ? c.slice(0, kr).trimEnd() + "…" : c;
504
504
  return `${t} · ${a}`;
505
505
  }
506
- const Qn = 500, Zn = 2e3, Kr = 5e3, ei = 8e3, ti = 1200, ri = 250, ni = () => `ax-rc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
507
- class ii {
506
+ const Zn = 500, ei = 2e3, Pr = 5e3, ti = 8e3, ri = 1200, ni = 250, ii = () => `ax-rc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
507
+ class oi {
508
508
  platform;
509
509
  send;
510
510
  onSnapshot;
@@ -531,7 +531,7 @@ class ii {
531
531
  // identical-to-current transitions are no-ops.
532
532
  status = "idle";
533
533
  constructor(t) {
534
- this.platform = t.platform, this.send = t.send, this.onSnapshot = t.onSnapshot, this.onStatusChange = t.onStatusChange, this.baseIntervalMs = t.baseIntervalMs ?? Qn, this.maxBackoffMs = t.maxBackoffMs ?? Zn, this.androidElementTreeOptions = t.androidElementTreeOptions, this.currentInterval = this.baseIntervalMs;
534
+ this.platform = t.platform, this.send = t.send, this.onSnapshot = t.onSnapshot, this.onStatusChange = t.onStatusChange, this.baseIntervalMs = t.baseIntervalMs ?? Zn, this.maxBackoffMs = t.maxBackoffMs ?? ei, this.androidElementTreeOptions = t.androidElementTreeOptions, this.currentInterval = this.baseIntervalMs;
535
535
  }
536
536
  start() {
537
537
  this.running || (this.running = !0, this.currentInterval = this.baseIntervalMs, this.boostUntilMs = 0, this.setStatus("starting"), this.runOnce());
@@ -563,7 +563,7 @@ class ii {
563
563
  bumpActivity() {
564
564
  if (!this.running) return;
565
565
  const t = Date.now();
566
- this.boostUntilMs = t + ti;
566
+ this.boostUntilMs = t + ri;
567
567
  const c = Math.max(150, Math.floor(this.baseIntervalMs / 2));
568
568
  if (t - this.lastBumpAtMs < c) {
569
569
  this.currentInterval = this.baseIntervalMs;
@@ -598,10 +598,10 @@ class ii {
598
598
  const v = typeof t.error == "string" ? t.error : null;
599
599
  if (v)
600
600
  return this.settleReject(c, new Error(v)), !0;
601
- const b = typeof t.json == "string" ? t.json : "";
601
+ const R = typeof t.json == "string" ? t.json : "";
602
602
  try {
603
- const D = JSON.parse(b), R = Bn(D);
604
- this.settleResolve(c, R);
603
+ const D = JSON.parse(R), N = qn(D);
604
+ this.settleResolve(c, N);
605
605
  } catch (D) {
606
606
  this.settleReject(c, D instanceof Error ? D : new Error(String(D)));
607
607
  }
@@ -615,7 +615,7 @@ class ii {
615
615
  }
616
616
  const m = t.payload, C = Array.isArray(m?.nodes) ? m.nodes : [];
617
617
  try {
618
- const v = Gn(C);
618
+ const v = Jn(C);
619
619
  this.settleResolve(c, v);
620
620
  } catch (v) {
621
621
  this.settleReject(c, v instanceof Error ? v : new Error(String(v)));
@@ -626,13 +626,13 @@ class ii {
626
626
  return this.platform === "ios" ? { type: "elementTree", id: t } : { type: "getElementTree", id: t, ...this.androidElementTreeOptions };
627
627
  }
628
628
  async requestOnce() {
629
- const t = ni();
629
+ const t = ii();
630
630
  return new Promise((c, a) => {
631
631
  const E = window.setTimeout(
632
632
  () => {
633
633
  this.pending.delete(t), a(new Error("elementTree request timed out"));
634
634
  },
635
- ei + (this.androidElementTreeOptions?.waitForIdleTimeoutMs ?? 0)
635
+ ti + (this.androidElementTreeOptions?.waitForIdleTimeoutMs ?? 0)
636
636
  );
637
637
  this.pending.set(t, { resolve: c, reject: a, timer: E }), this.send(this.buildRequest(t)) || (window.clearTimeout(E), this.pending.delete(t), a(new Error("elementTree send failed (WebSocket not open)")));
638
638
  });
@@ -647,7 +647,7 @@ class ii {
647
647
  } catch (t) {
648
648
  if (!this.running) return;
649
649
  const c = t instanceof Error ? t.message : String(t), a = /unavailable|not (yet )?running|failed|timeout/i.test(c);
650
- this.currentInterval = a ? Kr : Math.min(this.currentInterval * 2, this.maxBackoffMs), this.setStatus(a ? "unavailable" : "error", c);
650
+ this.currentInterval = a ? Pr : Math.min(this.currentInterval * 2, this.maxBackoffMs), this.setStatus(a ? "unavailable" : "error", c);
651
651
  } finally {
652
652
  this.inflight = !1, this.scheduleNext();
653
653
  }
@@ -655,16 +655,16 @@ class ii {
655
655
  }
656
656
  deliver(t) {
657
657
  const c = this.lastSnapshot;
658
- if ($r(c, t)) {
659
- this.currentInterval = Math.min(this.currentInterval * 2, this.maxBackoffMs), this.lastSnapshot = t, t.errors?.includes(Qt) || this.setStatus("ready");
658
+ if (Br(c, t)) {
659
+ this.currentInterval = Math.min(this.currentInterval * 2, this.maxBackoffMs), this.lastSnapshot = t, t.errors?.includes(nr) || this.setStatus("ready");
660
660
  return;
661
661
  }
662
- this.lastSnapshot = t, this.currentInterval = this.baseIntervalMs, t.errors?.includes(Qt) ? (this.currentInterval = Kr, this.setStatus("unavailable", Qt)) : this.setStatus("ready"), this.onSnapshot(t);
662
+ this.lastSnapshot = t, this.currentInterval = this.baseIntervalMs, t.errors?.includes(nr) ? (this.currentInterval = Pr, this.setStatus("unavailable", nr)) : this.setStatus("ready"), this.onSnapshot(t);
663
663
  }
664
664
  scheduleNext() {
665
665
  if (!this.running) return;
666
666
  this.timer !== void 0 && window.clearTimeout(this.timer);
667
- const t = Date.now() < this.boostUntilMs ? Math.min(ri, this.currentInterval) : this.currentInterval;
667
+ const t = Date.now() < this.boostUntilMs ? Math.min(ni, this.currentInterval) : this.currentInterval;
668
668
  this.timer = window.setTimeout(() => {
669
669
  this.timer = void 0, this.runOnce();
670
670
  }, t);
@@ -682,7 +682,7 @@ class ii {
682
682
  window.clearTimeout(a.timer), a.reject(new Error(t)), this.pending.delete(c);
683
683
  }
684
684
  }
685
- class oi {
685
+ class ci {
686
686
  generation = 0;
687
687
  tail = Promise.resolve();
688
688
  get currentGeneration() {
@@ -713,23 +713,23 @@ class oi {
713
713
  ++this.generation;
714
714
  }
715
715
  }
716
- function ci(r) {
716
+ function si(r) {
717
717
  if (!r || typeof r != "object") return null;
718
718
  const t = r;
719
719
  if (t.type !== "cameraRequest" || typeof t.active != "boolean") return null;
720
720
  const c = { active: t.active };
721
721
  return (t.facingMode === "user" || t.facingMode === "environment") && (c.facingMode = t.facingMode), c;
722
722
  }
723
- function si(r) {
723
+ function ai(r) {
724
724
  const t = {
725
725
  frameRate: { ideal: 30, max: 30 }
726
726
  };
727
727
  return r?.facingMode && (t.facingMode = { ideal: r.facingMode }), t;
728
728
  }
729
- function ai(r, t) {
729
+ function ui(r, t) {
730
730
  return !r || r.facingMode !== t.facingMode;
731
731
  }
732
- function ui(r) {
732
+ function li(r) {
733
733
  const t = r.getSettings();
734
734
  return {
735
735
  width: t.width,
@@ -740,14 +740,14 @@ function ui(r) {
740
740
  facingMode: t.facingMode
741
741
  };
742
742
  }
743
- function li(r) {
743
+ function di(r) {
744
744
  return {
745
745
  type: "cameraResult",
746
746
  granted: !0,
747
- camera: ui(r)
747
+ camera: li(r)
748
748
  };
749
749
  }
750
- const di = async (r) => {
750
+ const fi = async (r) => {
751
751
  if (!r) return !1;
752
752
  try {
753
753
  if (typeof navigator < "u" && navigator.clipboard?.writeText)
@@ -762,11 +762,11 @@ const di = async (r) => {
762
762
  } catch {
763
763
  return !1;
764
764
  }
765
- }, fi = er(
765
+ }, hi = or(
766
766
  function({ element: t, screen: c, highlighted: a, selected: E, selectable: m, onClick: C }) {
767
- const v = Jn(t.frame, c);
767
+ const v = zn(t.frame, c);
768
768
  if (!v) return null;
769
- const b = Br(t);
769
+ const R = Vr(t);
770
770
  return /* @__PURE__ */ k(
771
771
  "button",
772
772
  {
@@ -778,7 +778,7 @@ const di = async (r) => {
778
778
  "data-ax-role": t.role || void 0,
779
779
  "data-highlighted": a ? "true" : "false",
780
780
  "data-selected": E ? "true" : "false",
781
- "aria-label": b,
781
+ "aria-label": R,
782
782
  onClick: (D) => {
783
783
  m && (D.preventDefault(), D.stopPropagation(), C(t, { x: D.clientX, y: D.clientY }));
784
784
  },
@@ -791,8 +791,8 @@ const di = async (r) => {
791
791
  }
792
792
  );
793
793
  },
794
- (r, t) => r.highlighted === t.highlighted && r.selected === t.selected && r.selectable === t.selectable && r.screen.width === t.screen.width && r.screen.height === t.screen.height && r.onClick === t.onClick && Hr(r.element, t.element)
795
- ), hi = 260, pi = 220, mi = 6, Ei = 8, gi = er(function({
794
+ (r, t) => r.highlighted === t.highlighted && r.selected === t.selected && r.selectable === t.selectable && r.screen.width === t.screen.width && r.screen.height === t.screen.height && r.onClick === t.onClick && Xr(r.element, t.element)
795
+ ), pi = 260, mi = 220, Ei = 6, gi = 8, Ci = or(function({
796
796
  element: t,
797
797
  platform: c,
798
798
  anchor: a,
@@ -800,22 +800,22 @@ const di = async (r) => {
800
800
  showActions: m,
801
801
  onTap: C
802
802
  }) {
803
- const [v, b] = X(null);
803
+ const [v, R] = X(null);
804
804
  de(() => {
805
805
  if (!v) return;
806
- const B = window.setTimeout(() => b(null), 1100);
806
+ const B = window.setTimeout(() => R(null), 1100);
807
807
  return () => window.clearTimeout(B);
808
808
  }, [v]);
809
809
  const D = Re(() => {
810
- const B = hi, fe = pi, ne = mi, H = Ei, he = typeof window < "u" ? window.innerWidth : 1024, mt = typeof window < "u" ? window.innerHeight : 768, Ye = a.x + ne + B <= he - H, pe = a.y - ne - fe >= H;
811
- let x = Ye ? a.x + ne : a.x - ne, Ke = pe ? a.y - ne : a.y + ne;
810
+ const B = pi, fe = mi, ie = Ei, $ = gi, he = typeof window < "u" ? window.innerWidth : 1024, mt = typeof window < "u" ? window.innerHeight : 768, Ye = a.x + ie + B <= he - $, pe = a.y - ie - fe >= $;
811
+ let W = Ye ? a.x + ie : a.x - ie, Ke = pe ? a.y - ie : a.y + ie;
812
812
  const se = `translate(${Ye ? "0" : "-100%"}, ${pe ? "-100%" : "0"})`;
813
- return x = Math.max(H + (Ye ? 0 : B), Math.min(he - H - (Ye ? B : 0), x)), Ke = Math.max(H + (pe ? fe : 0), Math.min(mt - H - (pe ? 0 : fe), Ke)), { left: `${x}px`, top: `${Ke}px`, transform: se };
814
- }, [a.x, a.y]), R = Re(() => jn(t, c), [t, c]), M = c === "ios" ? t.selectors.AXUniqueId : t.selectors.resourceId, Z = c === "ios" ? "AXUniqueId" : "resourceId", ge = Nn(async (B, fe) => {
813
+ return W = Math.max($ + (Ye ? 0 : B), Math.min(he - $ - (Ye ? B : 0), W)), Ke = Math.max($ + (pe ? fe : 0), Math.min(mt - $ - (pe ? 0 : fe), Ke)), { left: `${W}px`, top: `${Ke}px`, transform: se };
814
+ }, [a.x, a.y]), N = Re(() => Qn(t, c), [t, c]), M = c === "ios" ? t.selectors.AXUniqueId : t.selectors.resourceId, Z = c === "ios" ? "AXUniqueId" : "resourceId", ge = In(async (B, fe) => {
815
815
  if (!B) return;
816
- await di(B) && b(fe);
817
- }, []), Ce = Xr(t), Ze = t.label || t.value || Ce, Ie = Br(t);
818
- return Pn(
816
+ await fi(B) && R(fe);
817
+ }, []), Ce = qr(t), Ze = t.label || t.value || Ce, Ie = Vr(t);
818
+ return Un(
819
819
  /* @__PURE__ */ ce(
820
820
  "div",
821
821
  {
@@ -870,9 +870,9 @@ const di = async (r) => {
870
870
  {
871
871
  type: "button",
872
872
  className: Ne("rc-inspect-card-btn", v === "selector" && "rc-inspect-card-btn-copied"),
873
- disabled: !R,
874
- title: R ?? "No usable selector for this element",
875
- onClick: () => ge(R ?? void 0, "selector"),
873
+ disabled: !N,
874
+ title: N ?? "No usable selector for this element",
875
+ onClick: () => ge(N ?? void 0, "selector"),
876
876
  children: v === "selector" ? "Copied!" : "Copy selector"
877
877
  }
878
878
  ),
@@ -893,7 +893,7 @@ const di = async (r) => {
893
893
  ),
894
894
  document.body
895
895
  );
896
- }), Ci = er(function({
896
+ }), yi = or(function({
897
897
  snapshot: t,
898
898
  geometry: c,
899
899
  highlightedId: a,
@@ -901,47 +901,47 @@ const di = async (r) => {
901
901
  mode: m,
902
902
  cursorPosition: C,
903
903
  frozenCursorPosition: v,
904
- onSelectChange: b,
904
+ onSelectChange: R,
905
905
  onTapElement: D
906
906
  }) {
907
- const R = m === "select", M = R ? a !== null && a !== E : a !== null, Z = R ? a ?? E : a, ge = Re(() => {
908
- const H = /* @__PURE__ */ new Map();
909
- if (!t) return H;
910
- for (const he of t.elements) H.set(he.id, he);
911
- return H;
907
+ const N = m === "select", M = N ? a !== null && a !== E : a !== null, Z = N ? a ?? E : a, ge = Re(() => {
908
+ const $ = /* @__PURE__ */ new Map();
909
+ if (!t) return $;
910
+ for (const he of t.elements) $.set(he.id, he);
911
+ return $;
912
912
  }, [t]), Ce = Re(() => Z ? ge.get(Z) ?? null : null, [Z, ge]);
913
913
  if (!(!!t && !!c && t.screen.width > 0 && t.screen.height > 0 && t.elements.length > 0)) return null;
914
- const Ie = M ? C : v ?? C, B = M, fe = R && !M && E !== null, ne = (H) => {
915
- R && H.target === H.currentTarget && b(null, null);
914
+ const Ie = M ? C : v ?? C, B = M, fe = N && !M && E !== null, ie = ($) => {
915
+ N && $.target === $.currentTarget && R(null, null);
916
916
  };
917
- return /* @__PURE__ */ ce(Lr, { children: [
917
+ return /* @__PURE__ */ ce(Fr, { children: [
918
918
  /* @__PURE__ */ k(
919
919
  "div",
920
920
  {
921
- className: Ne("rc-inspect-overlay", R && "rc-inspect-overlay-select"),
921
+ className: Ne("rc-inspect-overlay", N && "rc-inspect-overlay-select"),
922
922
  style: {
923
923
  left: `${c.left}px`,
924
924
  top: `${c.top}px`,
925
925
  width: `${c.width}px`,
926
926
  height: `${c.height}px`
927
927
  },
928
- onClick: ne,
929
- children: t.elements.map((H) => /* @__PURE__ */ k(
930
- fi,
928
+ onClick: ie,
929
+ children: t.elements.map(($) => /* @__PURE__ */ k(
930
+ hi,
931
931
  {
932
- element: H,
932
+ element: $,
933
933
  screen: t.screen,
934
- highlighted: H.id === a,
935
- selected: H.id === E,
936
- selectable: R,
937
- onClick: b
934
+ highlighted: $.id === a,
935
+ selected: $.id === E,
936
+ selectable: N,
937
+ onClick: R
938
938
  },
939
- H.id
939
+ $.id
940
940
  ))
941
941
  }
942
942
  ),
943
943
  Ce && Ie && /* @__PURE__ */ k(
944
- gi,
944
+ Ci,
945
945
  {
946
946
  element: Ce,
947
947
  platform: t.platform,
@@ -952,23 +952,23 @@ const di = async (r) => {
952
952
  }
953
953
  )
954
954
  ] });
955
- }), yi = In(() => import("./duo-view-BEkVGxom.mjs").then((r) => r.d)), F = (...r) => {
955
+ }), vi = Yn(() => import("./duo-view-D0A0aNPD.mjs").then((r) => r.d)), F = (...r) => {
956
956
  window.debugRemoteControl && console.log(...r);
957
957
  }, w = (...r) => {
958
958
  window.debugRemoteControl && console.warn(...r);
959
- }, L = (r, t, ...c) => {
959
+ }, x = (r, t, ...c) => {
960
960
  if (t)
961
961
  try {
962
962
  t(...c);
963
963
  } catch (a) {
964
964
  console.error(`[RemoteControl] customer callback "${r}" threw:`, a);
965
965
  }
966
- }, Kt = (r) => Object.entries(U).find(
966
+ }, kt = (r) => Object.entries(U).find(
967
967
  ([c, a]) => c.startsWith("ACTION_") && a === r
968
- )?.[0] ?? String(r), vi = (r) => r.includes("/android_") ? "android" : "ios", kr = (r, t) => {
968
+ )?.[0] ?? String(r), Oi = (r) => r.includes("/android_") ? "android" : "ios", Ur = (r, t) => {
969
969
  const c = new URL(r);
970
970
  return c.searchParams.set("token", t), c.toString();
971
- }, Pr = 1920, Ur = 1200, Zt = 3, Oi = 1e3, _i = 15e3, Di = 3e3, Ti = 4e3, wi = (r, t) => r === Pr && t === Ur || r === Ur && t === Pr, Ai = {
971
+ }, Lr = 1920, xr = 1200, ir = 3, _i = 1e3, Di = 15e3, Ti = 3e3, wi = 4e3, Ai = (r, t) => r === Lr && t === xr || r === xr && t === Lr, Si = {
972
972
  ios: {
973
973
  videoBorderRadiusMultiplier: 0.15,
974
974
  loadingLogoSize: "20%",
@@ -988,8 +988,8 @@ const di = async (r) => {
988
988
  }
989
989
  }
990
990
  };
991
- function Si(r) {
992
- const t = r.code, c = xr[t];
991
+ function Mi(r) {
992
+ const t = r.code, c = Hr[t];
993
993
  if (!c)
994
994
  return w(`Unknown event.code: ${t}, key: ${r.key}`), null;
995
995
  let a = s.META_NONE;
@@ -997,7 +997,7 @@ function Si(r) {
997
997
  let v = C;
998
998
  return E && (v = C !== m), v && (a |= s.META_SHIFT_ON), r.ctrlKey && (a |= s.META_CTRL_ON), r.altKey && (a |= s.META_ALT_ON), r.metaKey && (a |= s.META_META_ON), { keycode: c, metaState: a };
999
999
  }
1000
- const xi = Yn(
1000
+ const Wi = Kn(
1001
1001
  ({
1002
1002
  className: r,
1003
1003
  url: t,
@@ -1007,9 +1007,9 @@ const xi = Yn(
1007
1007
  showFrame: m = !0,
1008
1008
  deviceModel: C,
1009
1009
  duoModelUrl: v,
1010
- autoReconnect: b = !1,
1010
+ autoReconnect: R = !1,
1011
1011
  onTerminated: D,
1012
- assets: R,
1012
+ assets: N,
1013
1013
  onConnectionStateChange: M,
1014
1014
  inspectMode: Z,
1015
1015
  onAxSnapshotChange: ge,
@@ -1018,14 +1018,14 @@ const xi = Yn(
1018
1018
  axPollIntervalMs: Ie,
1019
1019
  axMaxBackoffMs: B,
1020
1020
  androidElementTreeOptions: fe,
1021
- onCameraDemandChange: ne,
1022
- onCameraStats: H,
1021
+ onCameraDemandChange: ie,
1022
+ onCameraStats: $,
1023
1023
  microphoneEnabled: he = !1,
1024
1024
  onMicrophoneStateChange: mt
1025
1025
  }, Ye) => {
1026
- const pe = _(null), x = _(null), Ke = _(null), [tr, rr] = X(!1), se = C === "iphone-duo" || tr, et = _(null), [nr, ir] = X(null), [or, cr] = X(), ke = _(
1026
+ const pe = _(null), W = _(null), Ke = _(null), [cr, sr] = X(!1), se = C === "iphone-duo" || cr, et = _(null), [ar, ur] = X(null), [lr, dr] = X(), ke = _(
1027
1027
  /* @__PURE__ */ new Map()
1028
- ), Ut = (e, o) => new Promise((i, n) => {
1028
+ ), Lt = (e, o) => new Promise((i, n) => {
1029
1029
  const l = T.current;
1030
1030
  if (!l || l.readyState !== WebSocket.OPEN) {
1031
1031
  n(new Error("Simulator disconnected"));
@@ -1035,56 +1035,56 @@ const xi = Yn(
1035
1035
  ke.current.delete(u), n(new Error("Device control timed out"));
1036
1036
  }, 5e3);
1037
1037
  ke.current.set(u, { resolve: i, reject: n, timer: f }), l.send(JSON.stringify({ type: e, id: u, ...o }));
1038
- }), [qr, Lt] = X(!1), [Vr, Et] = X(!1), [Gr, sr] = X(!1), Pe = _(!1), Ft = _(!1), [ar, Jr] = X(!1), [zr, jr] = X(!1), [Qr, Zr] = X(!0), [en, ur] = X({}), T = _(null), W = _(null), P = _(null), Ue = _(void 0), tt = _(void 0), rt = _(void 0), gt = _(void 0), Le = _(void 0), Oe = _(0), Ct = _(0), Fe = _(!1), xt = _(b);
1039
- xt.current = b;
1040
- const _e = _(null), ee = _(null), De = _(void 0), Wt = Re(() => new oi(), []), me = _(ne);
1041
- me.current = ne;
1042
- const yt = _(H);
1043
- yt.current = H;
1044
- const nt = _(null), vt = _(null), Ht = _(he);
1045
- Ht.current = he;
1046
- const $t = _(!1), it = _(mt);
1038
+ }), [Gr, xt] = X(!1), [Jr, Et] = X(!1), [zr, fr] = X(!1), Pe = _(!1), Ft = _(!1), [Wt, jr] = X(!1), [Qr, Zr] = X(!1), [Ht, en] = X(null), [tn, $t] = X({}), T = _(null), H = _(null), P = _(null), Ue = _(void 0), tt = _(void 0), rt = _(void 0), gt = _(void 0), Le = _(void 0), Oe = _(0), Ct = _(0), xe = _(!1), Xt = _(R);
1039
+ Xt.current = R;
1040
+ const _e = _(null), ee = _(null), De = _(void 0), Bt = Re(() => new ci(), []), me = _(ie);
1041
+ me.current = ie;
1042
+ const yt = _($);
1043
+ yt.current = $;
1044
+ const nt = _(null), vt = _(null), qt = _(he);
1045
+ qt.current = he;
1046
+ const Vt = _(!1), it = _(mt);
1047
1047
  it.current = mt;
1048
- const ot = _(null), le = _(null), Ot = _(0), lr = _(Promise.resolve()), xe = _(null), ct = _(!1), ye = _(/* @__PURE__ */ new Map()), Ee = _(/* @__PURE__ */ new Map()), Te = _(/* @__PURE__ */ new Map()), we = _(/* @__PURE__ */ new Map()), J = _(/* @__PURE__ */ new Map()), Ae = _(!1), [tn, rn] = X(!1), q = _(null), We = _(null), st = _({
1048
+ const ot = _(null), le = _(null), Ot = _(0), hr = _(Promise.resolve()), Fe = _(null), ct = _(!1), ye = _(/* @__PURE__ */ new Map()), Ee = _(/* @__PURE__ */ new Map()), Te = _(/* @__PURE__ */ new Map()), we = _(/* @__PURE__ */ new Map()), J = _(/* @__PURE__ */ new Map()), Ae = _(!1), [rn, nn] = X(!1), q = _(null), We = _(null), st = _({
1049
1049
  handle: () => {
1050
1050
  },
1051
1051
  end: () => {
1052
1052
  }
1053
- }), [Se, _t] = X(null), z = _(null), [dr, fr] = X(null), [Xt, at] = X(null), [Bt, Dt] = X(null), [nn, hr] = X(null), [on, pr] = X(null), Tt = _(null), ie = _(void 0), mr = (e) => {
1054
- Tt.current = e, ie.current === void 0 && (ie.current = window.requestAnimationFrame(() => {
1055
- ie.current = void 0, pr(Tt.current);
1053
+ }), [Se, _t] = X(null), z = _(null), [pr, mr] = X(null), [Gt, at] = X(null), [Jt, Dt] = X(null), [on, Er] = X(null), [cn, gr] = X(null), Tt = _(null), oe = _(void 0), Cr = (e) => {
1054
+ Tt.current = e, oe.current === void 0 && (oe.current = window.requestAnimationFrame(() => {
1055
+ oe.current = void 0, gr(Tt.current);
1056
1056
  }));
1057
- }, [cn, He] = X(null), $e = _(Z);
1057
+ }, [sn, He] = X(null), $e = _(Z);
1058
1058
  $e.current = Z;
1059
1059
  const Xe = _(null);
1060
- Xe.current = dr;
1061
- const qt = _(ge);
1062
- qt.current = ge;
1060
+ Xe.current = pr;
1061
+ const zt = _(ge);
1062
+ zt.current = ge;
1063
1063
  const Be = _(Ce);
1064
1064
  Be.current = Ce;
1065
- const Er = _(Ze);
1066
- Er.current = Ze;
1067
- const gr = _(D);
1068
- gr.current = D;
1069
- const Cr = _(M);
1070
- Cr.current = M;
1071
- const Vt = _(null), qe = (e) => {
1072
- Vt.current !== e && (Vt.current = e, L("onConnectionStateChange", Cr.current, e));
1073
- }, ut = Z === !0 || Z === "hover-only", sn = Z === "hover-only" ? "hover-only" : "select", ae = Re(
1065
+ const yr = _(Ze);
1066
+ yr.current = Ze;
1067
+ const vr = _(D);
1068
+ vr.current = D;
1069
+ const Or = _(M);
1070
+ Or.current = M;
1071
+ const jt = _(null), qe = (e) => {
1072
+ jt.current !== e && (jt.current = e, x("onConnectionStateChange", Or.current, e));
1073
+ }, ut = Z === !0 || Z === "hover-only", an = Z === "hover-only" ? "hover-only" : "select", ae = Re(
1074
1074
  () => a || Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
1075
1075
  [a]
1076
- ), oe = Re(() => vi(t), [t]), Ve = Ai[oe], lt = R?.[oe], yr = oe === "android" && zr ? ar ? lt?.tabletFrameLandscape : lt?.tabletFrame : ar ? lt?.frameLandscape : lt?.frame, vr = lt?.loadingLogo, wt = !se && m && !!yr && (oe !== "ios" || Qr), Y = (e) => {
1076
+ ), te = Re(() => Oi(t), [t]), wt = te === "ios" && (Ht === "tablet" || Ht === null && C === "ipad"), Ve = Si[te], lt = N?.[te], _r = te === "android" && Qr || wt ? Wt ? lt?.tabletFrameLandscape : lt?.tabletFrame : Wt ? lt?.frameLandscape : lt?.frame, Dr = lt?.loadingLogo, At = !se && m && !!_r && (te !== "ios" || Ht !== "watch"), Y = (e) => {
1077
1077
  F(e);
1078
1078
  }, ue = (e) => {
1079
1079
  !P.current || P.current.readyState !== "open" || (P.current.send(e), z.current?.bumpActivity());
1080
- }, Or = -10, _r = (e, o) => {
1080
+ }, Tr = -10, wr = (e, o) => {
1081
1081
  const i = dt();
1082
1082
  if (!i) return;
1083
1083
  const n = Je(i, e, o);
1084
1084
  if (!n) return;
1085
- const { videoX: l, videoY: u, videoWidth: f, videoHeight: p } = n, g = Yt(
1085
+ const { videoX: l, videoY: u, videoWidth: f, videoHeight: p } = n, g = Kt(
1086
1086
  U.ACTION_DOWN,
1087
- Or,
1087
+ Tr,
1088
1088
  f,
1089
1089
  p,
1090
1090
  l,
@@ -1094,9 +1094,9 @@ const xi = Yn(
1094
1094
  U.BUTTON_PRIMARY
1095
1095
  );
1096
1096
  g && ue(g), window.setTimeout(() => {
1097
- const h = Yt(
1097
+ const h = Kt(
1098
1098
  U.ACTION_UP,
1099
- Or,
1099
+ Tr,
1100
1100
  f,
1101
1101
  p,
1102
1102
  l,
@@ -1107,13 +1107,13 @@ const xi = Yn(
1107
1107
  );
1108
1108
  h && ue(h);
1109
1109
  }, 60);
1110
- }, an = (e, o) => {
1110
+ }, un = (e, o) => {
1111
1111
  const i = dt();
1112
1112
  if (!i || o.screen.width <= 0 || o.screen.height <= 0) return;
1113
1113
  const n = e.frame.x + e.frame.width / 2, l = e.frame.y + e.frame.height / 2, u = n / o.screen.width * i.actualWidth, f = l / o.screen.height * i.actualHeight, p = i.videoRect.left + i.offsetX + u, g = i.videoRect.top + i.offsetY + f;
1114
- _r(p, g);
1115
- }, At = -1, St = -2, Me = -3, Ge = (e, o, i, n, l, u) => {
1116
- const f = Yt(
1114
+ wr(p, g);
1115
+ }, St = -1, Mt = -2, Me = -3, Ge = (e, o, i, n, l, u) => {
1116
+ const f = Kt(
1117
1117
  e,
1118
1118
  o,
1119
1119
  i,
@@ -1127,7 +1127,7 @@ const xi = Yn(
1127
1127
  );
1128
1128
  f && (F("[rc-touch] sendSingleTouch", {
1129
1129
  action: e,
1130
- actionName: Kt(e),
1130
+ actionName: kt(e),
1131
1131
  pointerId: o,
1132
1132
  x: l,
1133
1133
  y: u,
@@ -1137,10 +1137,10 @@ const xi = Yn(
1137
1137
  if (!i) return;
1138
1138
  const { videoX: n, videoY: l, videoWidth: u, videoHeight: f } = i;
1139
1139
  let p = null, g = null, h = 1;
1140
- const I = U.BUTTON_PRIMARY;
1140
+ const b = U.BUTTON_PRIMARY;
1141
1141
  switch (o) {
1142
1142
  case "down":
1143
- e !== Me && st.current.end(), p = J.current.size === 0 ? U.ACTION_DOWN : U.ACTION_POINTER_DOWN, g = { x: n, y: l }, J.current.set(e, g), e === -1 && x.current?.focus();
1143
+ e !== Me && st.current.end(), p = J.current.size === 0 ? U.ACTION_DOWN : U.ACTION_POINTER_DOWN, g = { x: n, y: l }, J.current.set(e, g), e === -1 && W.current?.focus();
1144
1144
  break;
1145
1145
  case "move":
1146
1146
  J.current.has(e) && (p = U.ACTION_MOVE, g = { x: n, y: l }, J.current.set(e, g));
@@ -1155,17 +1155,17 @@ const xi = Yn(
1155
1155
  pointerId: e,
1156
1156
  eventType: o,
1157
1157
  action: p,
1158
- actionName: Kt(p),
1158
+ actionName: kt(p),
1159
1159
  positionToSend: g,
1160
1160
  video: { width: u, height: f },
1161
1161
  altHeld: Ae.current,
1162
- activePointersAfter: Array.from(J.current.entries()).map(([S, $]) => ({
1162
+ activePointersAfter: Array.from(J.current.entries()).map(([S, L]) => ({
1163
1163
  id: S,
1164
- x: $.x,
1165
- y: $.y
1164
+ x: L.x,
1165
+ y: L.y
1166
1166
  }))
1167
1167
  });
1168
- const O = Yt(
1168
+ const O = Kt(
1169
1169
  p,
1170
1170
  e,
1171
1171
  u,
@@ -1173,20 +1173,20 @@ const xi = Yn(
1173
1173
  g.x,
1174
1174
  g.y,
1175
1175
  h,
1176
- I,
1177
- I
1176
+ b,
1177
+ b
1178
1178
  );
1179
1179
  O && (F("[rc-touch][mouse->touch] buffer", {
1180
1180
  pointerId: e,
1181
- actionName: Kt(p),
1181
+ actionName: kt(p),
1182
1182
  byteLength: O.byteLength
1183
1183
  }), ue(O));
1184
1184
  } else (o === "up" || o === "cancel") && J.current.delete(e);
1185
- }, Gt = (e) => {
1186
- if (Ae.current !== e && (Ae.current = e, rn(e), e || _t(null), F("[rc-touch][alt] updateAltHeld", {
1185
+ }, Qt = (e) => {
1186
+ if (Ae.current !== e && (Ae.current = e, nn(e), e || _t(null), F("[rc-touch][alt] updateAltHeld", {
1187
1187
  nextHeld: e,
1188
1188
  activePointerIds: Array.from(J.current.keys())
1189
- }), oe === "ios" && P.current && P.current.readyState === "open")) {
1189
+ }), te === "ios" && P.current && P.current.readyState === "open")) {
1190
1190
  const o = e ? s.ACTION_DOWN : s.ACTION_UP, i = pt(
1191
1191
  o,
1192
1192
  s.KEYCODE_ALT_LEFT,
@@ -1199,23 +1199,23 @@ const xi = Yn(
1199
1199
  }), i && ue(i);
1200
1200
  }
1201
1201
  }, dt = () => {
1202
- const e = x.current, o = pe.current;
1202
+ const e = W.current, o = pe.current;
1203
1203
  if (!e || !o) return null;
1204
1204
  const i = e.videoWidth, n = e.videoHeight;
1205
1205
  if (!i || !n) return null;
1206
1206
  const l = e.getBoundingClientRect(), u = o.getBoundingClientRect(), f = l.width, p = l.height, g = i / n, h = f / p;
1207
- let I = f, O = p;
1208
- g > h ? O = f / g : I = p * g;
1209
- const S = (f - I) / 2, $ = (p - O) / 2;
1207
+ let b = f, O = p;
1208
+ g > h ? O = f / g : b = p * g;
1209
+ const S = (f - b) / 2, L = (p - O) / 2;
1210
1210
  return {
1211
1211
  videoWidth: i,
1212
1212
  videoHeight: n,
1213
1213
  videoRect: l,
1214
1214
  containerRect: u,
1215
- actualWidth: I,
1215
+ actualWidth: b,
1216
1216
  actualHeight: O,
1217
1217
  offsetX: S,
1218
- offsetY: $
1218
+ offsetY: L
1219
1219
  };
1220
1220
  }, Je = (e, o, i) => {
1221
1221
  const n = o - e.videoRect.left - e.offsetX, l = i - e.videoRect.top - e.offsetY, u = Math.max(0, Math.min(e.actualWidth, n)), f = Math.max(0, Math.min(e.actualHeight, l)), p = Math.max(
@@ -1231,30 +1231,30 @@ const xi = Yn(
1231
1231
  videoWidth: e.videoWidth,
1232
1232
  videoHeight: e.videoHeight
1233
1233
  };
1234
- }, un = (e, o, i) => {
1234
+ }, ln = (e, o, i) => {
1235
1235
  const n = o - e.videoRect.left - e.offsetX, l = i - e.videoRect.top - e.offsetY, u = Math.max(0, Math.min(e.actualWidth, n)), f = Math.max(0, Math.min(e.actualHeight, l)), p = Math.max(
1236
1236
  0,
1237
1237
  Math.min(e.videoWidth, u / e.actualWidth * e.videoWidth)
1238
1238
  ), g = Math.max(
1239
1239
  0,
1240
1240
  Math.min(e.videoHeight, f / e.actualHeight * e.videoHeight)
1241
- ), h = e.videoWidth - p, I = e.videoHeight - g, O = e.videoRect.left + e.offsetX, S = e.videoRect.top + e.offsetY, $ = O - e.containerRect.left + u, te = S - e.containerRect.top + f, G = O - e.containerRect.left + (e.actualWidth - u), y = S - e.containerRect.top + (e.actualHeight - f);
1241
+ ), h = e.videoWidth - p, b = e.videoHeight - g, O = e.videoRect.left + e.offsetX, S = e.videoRect.top + e.offsetY, L = O - e.containerRect.left + u, re = S - e.containerRect.top + f, G = O - e.containerRect.left + (e.actualWidth - u), y = S - e.containerRect.top + (e.actualHeight - f);
1242
1242
  return {
1243
- containerX: $,
1244
- containerY: te,
1243
+ containerX: L,
1244
+ containerY: re,
1245
1245
  mirrorContainerX: G,
1246
1246
  mirrorContainerY: y,
1247
1247
  videoX: p,
1248
1248
  videoY: g,
1249
1249
  mirrorVideoX: h,
1250
- mirrorVideoY: I,
1250
+ mirrorVideoY: b,
1251
1251
  videoWidth: e.videoWidth,
1252
1252
  videoHeight: e.videoHeight
1253
1253
  };
1254
- }, ln = (e, o, i, n, l, u, f) => {
1254
+ }, dn = (e, o, i, n, l, u, f) => {
1255
1255
  const p = Fn(e, o, i, n, l, u, f);
1256
1256
  F("[rc-touch2] sendTwoFingerMessage (iOS)", {
1257
- actionName: Kt(e),
1257
+ actionName: kt(e),
1258
1258
  video: { width: o, height: i },
1259
1259
  p0: { x: n, y: l },
1260
1260
  p1: { x: u, y: f },
@@ -1262,42 +1262,42 @@ const xi = Yn(
1262
1262
  }), ue(p);
1263
1263
  }, ze = (e, o, i, n, l, u, f, p, g) => {
1264
1264
  if (F("[rc-touch2] applyTwoFingerEvent", {
1265
- platform: oe,
1265
+ platform: te,
1266
1266
  eventType: e,
1267
1267
  video: { width: o, height: i },
1268
1268
  p0: { x: n, y: l, id: p },
1269
1269
  p1: { x: u, y: f, id: g }
1270
- }), e === "down" && st.current.end(), oe === "ios") {
1270
+ }), e === "down" && st.current.end(), te === "ios") {
1271
1271
  const h = e === "down" ? U.ACTION_DOWN : e === "move" ? U.ACTION_MOVE : U.ACTION_UP;
1272
- ln(h, o, i, n, l, u, f);
1272
+ dn(h, o, i, n, l, u, f);
1273
1273
  } else
1274
1274
  e === "down" ? (Ge(U.ACTION_DOWN, p, o, i, n, l), Ge(U.ACTION_POINTER_DOWN, g, o, i, u, f)) : e === "move" ? (Ge(U.ACTION_MOVE, p, o, i, n, l), Ge(U.ACTION_MOVE, g, o, i, u, f)) : (Ge(U.ACTION_POINTER_UP, g, o, i, u, f), Ge(U.ACTION_UP, p, o, i, n, l));
1275
- }, dn = (e, o, i) => {
1275
+ }, fn = (e, o, i) => {
1276
1276
  if (!Ae.current) {
1277
1277
  Se !== null && _t(null);
1278
1278
  return;
1279
1279
  }
1280
- const n = un(e, o, i);
1280
+ const n = ln(e, o, i);
1281
1281
  _t(n);
1282
- }, fn = (e, o, i) => {
1282
+ }, hn = (e, o, i) => {
1283
1283
  const n = Xe.current;
1284
1284
  if (!n || n.screen.width <= 0 || n.screen.height <= 0) return null;
1285
1285
  const l = o - e.videoRect.left - e.offsetX, u = i - e.videoRect.top - e.offsetY;
1286
1286
  if (l < 0 || u < 0 || l > e.actualWidth || u > e.actualHeight) return null;
1287
1287
  const f = l / e.actualWidth * n.screen.width, p = u / e.actualHeight * n.screen.height;
1288
- return zn(n, f, p);
1288
+ return jn(n, f, p);
1289
1289
  }, ve = (e) => {
1290
1290
  if (se) return;
1291
1291
  e.preventDefault(), e.stopPropagation();
1292
1292
  const o = dt();
1293
1293
  if (($e.current === !0 || $e.current === "hover-only") && !("touches" in e))
1294
1294
  if (e.type === "mousemove") {
1295
- if (mr({ x: e.clientX, y: e.clientY }), o) {
1296
- const n = fn(o, e.clientX, e.clientY);
1295
+ if (Cr({ x: e.clientX, y: e.clientY }), o) {
1296
+ const n = hn(o, e.clientX, e.clientY);
1297
1297
  at(n?.id ?? null);
1298
1298
  }
1299
- } else e.type === "mouseleave" && (mr(null), at(null));
1300
- if ($e.current !== !0 && (!("touches" in e) && o && (e.type === "mousemove" ? dn(o, e.clientX, e.clientY) : e.type === "mouseleave" && _t(null)), !(!P.current || P.current.readyState !== "open" || !x.current || !o)))
1299
+ } else e.type === "mouseleave" && (Cr(null), at(null));
1300
+ if ($e.current !== !0 && (!("touches" in e) && o && (e.type === "mousemove" ? fn(o, e.clientX, e.clientY) : e.type === "mouseleave" && _t(null)), !(!P.current || P.current.readyState !== "open" || !W.current || !o)))
1301
1301
  if ("touches" in e) {
1302
1302
  const n = e.touches, l = e.changedTouches;
1303
1303
  let u;
@@ -1409,10 +1409,10 @@ const xi = Yn(
1409
1409
  videoHeight: f.videoHeight
1410
1410
  },
1411
1411
  activePointerIds: Array.from(J.current.keys())
1412
- }), Ae.current || u ? hn(l, f) : be(-1, l, f);
1412
+ }), Ae.current || u ? pn(l, f) : be(-1, l, f);
1413
1413
  }
1414
1414
  }
1415
- }, hn = (e, o) => {
1415
+ }, pn = (e, o) => {
1416
1416
  const { videoX: i, videoY: n, videoWidth: l, videoHeight: u } = o, f = l - i, p = u - n;
1417
1417
  if (e === "down") {
1418
1418
  q.current = {
@@ -1420,9 +1420,9 @@ const xi = Yn(
1420
1420
  finger1: { x: f, y: p },
1421
1421
  videoSize: { width: l, height: u },
1422
1422
  source: "alt-mouse",
1423
- pointerId0: At,
1424
- pointerId1: St
1425
- }, x.current?.focus(), ze(
1423
+ pointerId0: St,
1424
+ pointerId1: Mt
1425
+ }, W.current?.focus(), ze(
1426
1426
  "down",
1427
1427
  l,
1428
1428
  u,
@@ -1430,8 +1430,8 @@ const xi = Yn(
1430
1430
  n,
1431
1431
  f,
1432
1432
  p,
1433
- At,
1434
- St
1433
+ St,
1434
+ Mt
1435
1435
  );
1436
1436
  return;
1437
1437
  }
@@ -1444,33 +1444,33 @@ const xi = Yn(
1444
1444
  n,
1445
1445
  f,
1446
1446
  p,
1447
- At,
1448
- St
1447
+ St,
1448
+ Mt
1449
1449
  ));
1450
1450
  return;
1451
1451
  }
1452
1452
  if (e === "up" || e === "cancel") {
1453
1453
  const g = q.current;
1454
1454
  if (g?.source === "alt-mouse") {
1455
- const { finger0: h, finger1: I, videoSize: O } = g;
1455
+ const { finger0: h, finger1: b, videoSize: O } = g;
1456
1456
  ze(
1457
1457
  "up",
1458
1458
  O.width,
1459
1459
  O.height,
1460
1460
  h.x,
1461
1461
  h.y,
1462
- I.x,
1463
- I.y,
1464
- At,
1465
- St
1462
+ b.x,
1463
+ b.y,
1464
+ St,
1465
+ Mt
1466
1466
  ), q.current = null;
1467
1467
  }
1468
1468
  return;
1469
1469
  }
1470
- }, pn = 150, Dr = () => {
1470
+ }, mn = 150, Ar = () => {
1471
1471
  const e = We.current;
1472
1472
  e && (window.clearTimeout(e.endTimer), be(Me, "up", e.pos), We.current = null);
1473
- }, mn = (e) => {
1473
+ }, En = (e) => {
1474
1474
  if (e.ctrlKey || Ae.current || q.current) return;
1475
1475
  const o = J.current.size;
1476
1476
  if (o > 1 || o === 1 && !J.current.has(Me)) return;
@@ -1482,11 +1482,11 @@ const xi = Yn(
1482
1482
  const u = Je(i, e.clientX, e.clientY);
1483
1483
  if (!u) return;
1484
1484
  e.preventDefault();
1485
- const f = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? i.actualWidth : 1) * (i.videoWidth / i.actualWidth), p = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? i.actualHeight : 1) * (i.videoHeight / i.actualHeight), g = -e.deltaX * f, h = -e.deltaY * p, I = (y) => {
1486
- window.clearTimeout(y.endTimer), y.endTimer = window.setTimeout(Dr, pn);
1485
+ const f = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? i.actualWidth : 1) * (i.videoWidth / i.actualWidth), p = (e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? i.actualHeight : 1) * (i.videoHeight / i.actualHeight), g = -e.deltaX * f, h = -e.deltaY * p, b = (y) => {
1486
+ window.clearTimeout(y.endTimer), y.endTimer = window.setTimeout(Ar, mn);
1487
1487
  };
1488
1488
  if (g === 0 && h === 0) {
1489
- We.current && I(We.current);
1489
+ We.current && b(We.current);
1490
1490
  return;
1491
1491
  }
1492
1492
  const O = () => ({
@@ -1499,18 +1499,18 @@ const xi = Yn(
1499
1499
  videoX: Math.min(Math.max(y.videoX + g, 0), y.videoWidth),
1500
1500
  videoY: Math.min(Math.max(y.videoY + h, 0), y.videoHeight)
1501
1501
  });
1502
- let $ = We.current;
1503
- if ($)
1504
- window.clearTimeout($.endTimer);
1502
+ let L = We.current;
1503
+ if (L)
1504
+ window.clearTimeout(L.endTimer);
1505
1505
  else {
1506
1506
  const y = O();
1507
- be(Me, "down", y), $ = { pos: y, endTimer: 0 }, We.current = $;
1507
+ be(Me, "down", y), L = { pos: y, endTimer: 0 }, We.current = L;
1508
1508
  }
1509
- let te = $.pos, G = S(te);
1510
- G.videoX === te.videoX && G.videoY === te.videoY && (be(Me, "up", te), te = O(), be(Me, "down", te), G = S(te)), be(Me, "move", G), $.pos = G, I($);
1509
+ let re = L.pos, G = S(re);
1510
+ G.videoX === re.videoX && G.videoY === re.videoY && (be(Me, "up", re), re = O(), be(Me, "down", re), G = S(re)), be(Me, "move", G), L.pos = G, b(L);
1511
1511
  };
1512
1512
  de(() => {
1513
- st.current = { handle: mn, end: Dr };
1513
+ st.current = { handle: En, end: Ar };
1514
1514
  }), de(() => {
1515
1515
  const e = pe.current;
1516
1516
  if (!e) return;
@@ -1520,19 +1520,19 @@ const xi = Yn(
1520
1520
  };
1521
1521
  }, []), de(() => {
1522
1522
  const e = (n) => {
1523
- n.key === "Alt" && Gt(!0);
1523
+ n.key === "Alt" && Qt(!0);
1524
1524
  }, o = (n) => {
1525
- n.key === "Alt" && Gt(!1);
1525
+ n.key === "Alt" && Qt(!1);
1526
1526
  }, i = () => {
1527
- Gt(!1);
1527
+ Qt(!1);
1528
1528
  };
1529
1529
  return window.addEventListener("keydown", e, !0), window.addEventListener("keyup", o, !0), window.addEventListener("blur", i), () => {
1530
1530
  window.removeEventListener("keydown", e, !0), window.removeEventListener("keyup", o, !0), window.removeEventListener("blur", i);
1531
1531
  };
1532
1532
  }, []);
1533
- const Mt = (e) => {
1533
+ const bt = (e) => {
1534
1534
  e.preventDefault(), e.stopPropagation();
1535
- const o = document.activeElement === x.current || se && document.activeElement === e.currentTarget;
1535
+ const o = document.activeElement === W.current || se && document.activeElement === e.currentTarget;
1536
1536
  if (F("Keyboard event:", {
1537
1537
  type: e.type,
1538
1538
  key: e.key,
@@ -1556,7 +1556,7 @@ const xi = Yn(
1556
1556
  "Pasting text via SET_CLIPBOARD:",
1557
1557
  n.substring(0, 20) + (n.length > 20 ? "..." : "")
1558
1558
  );
1559
- const l = xn(n, !0);
1559
+ const l = Wn(n, !0);
1560
1560
  ue(l);
1561
1561
  }
1562
1562
  }).catch((n) => {
@@ -1584,7 +1584,7 @@ const xi = Yn(
1584
1584
  return;
1585
1585
  }
1586
1586
  }
1587
- const i = Si(e);
1587
+ const i = Mi(e);
1588
1588
  if (i) {
1589
1589
  const { keycode: n, metaState: l } = i, u = e.type === "keydown" ? s.ACTION_DOWN : s.ACTION_UP;
1590
1590
  F(`Sending Keycode: key=${e.key}, code=${n}, action=${u}, meta=${l}`);
@@ -1598,27 +1598,27 @@ const xi = Yn(
1598
1598
  ue(f);
1599
1599
  } else
1600
1600
  F(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`);
1601
- }, En = () => {
1601
+ }, gn = () => {
1602
1602
  T.current && T.current.readyState === WebSocket.OPEN && T.current.send(
1603
1603
  JSON.stringify({
1604
1604
  type: "keepAlive",
1605
1605
  sessionId: ae
1606
1606
  })
1607
1607
  );
1608
- }, Tr = () => {
1609
- Ue.current && window.clearInterval(Ue.current), Ue.current = window.setInterval(En, 1e4);
1610
- }, wr = () => {
1608
+ }, Sr = () => {
1609
+ Ue.current && window.clearInterval(Ue.current), Ue.current = window.setInterval(gn, 1e4);
1610
+ }, Mr = () => {
1611
1611
  Ue.current && (window.clearInterval(Ue.current), Ue.current = void 0);
1612
- }, bt = () => {
1613
- tt.current && (window.clearTimeout(tt.current), tt.current = void 0);
1614
1612
  }, Rt = () => {
1613
+ tt.current && (window.clearTimeout(tt.current), tt.current = void 0);
1614
+ }, Nt = () => {
1615
1615
  rt.current && (window.clearTimeout(rt.current), rt.current = void 0);
1616
1616
  }, ft = () => {
1617
1617
  gt.current && (window.clearInterval(gt.current), gt.current = void 0);
1618
1618
  }, ht = () => {
1619
1619
  Le.current !== void 0 && (window.clearTimeout(Le.current), Le.current = void 0);
1620
- }, gn = () => {
1621
- ct.current || (ct.current = !0, ft(), Lt(!0), qe("connected"));
1620
+ }, Cn = () => {
1621
+ ct.current || (ct.current = !0, ft(), xt(!0), qe("connected"));
1622
1622
  }, j = (e) => {
1623
1623
  for (const o of e.getTracks())
1624
1624
  try {
@@ -1626,20 +1626,20 @@ const xi = Yn(
1626
1626
  } catch (i) {
1627
1627
  w("track.stop() failed:", i);
1628
1628
  }
1629
- }, Cn = () => {
1629
+ }, yn = () => {
1630
1630
  const e = ee.current;
1631
1631
  e && (ee.current = null, j(e));
1632
- }, Ar = (e) => {
1633
- const o = lr.current.then(e).catch((i) => {
1632
+ }, br = (e) => {
1633
+ const o = hr.current.then(e).catch((i) => {
1634
1634
  w("microphone operation failed:", i);
1635
1635
  });
1636
- return lr.current = o, o;
1637
- }, Jt = () => Ht.current || $t.current, Sr = (e) => {
1636
+ return hr.current = o, o;
1637
+ }, Zt = () => qt.current || Vt.current, Rr = (e) => {
1638
1638
  const o = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
1639
- xe.current = o, e.send(JSON.stringify({ type: "microphoneStart", id: o }));
1640
- }, zt = () => Ar(() => yn()), yn = async () => {
1641
- const e = Ot.current, o = () => e === Ot.current && Jt(), i = (p) => {
1642
- L("onMicrophoneStateChange", it.current, {
1639
+ Fe.current = o, e.send(JSON.stringify({ type: "microphoneStart", id: o }));
1640
+ }, er = () => br(() => vn()), vn = async () => {
1641
+ const e = Ot.current, o = () => e === Ot.current && Zt(), i = (p) => {
1642
+ x("onMicrophoneStateChange", it.current, {
1643
1643
  active: !1,
1644
1644
  error: p
1645
1645
  });
@@ -1688,12 +1688,12 @@ const xi = Yn(
1688
1688
  return;
1689
1689
  }
1690
1690
  le.current = u, f.onended = () => {
1691
- le.current === u && Nt("microphone capture ended by the browser");
1692
- }, Sr(n), L("onMicrophoneStateChange", it.current, {
1691
+ le.current === u && It("microphone capture ended by the browser");
1692
+ }, Rr(n), x("onMicrophoneStateChange", it.current, {
1693
1693
  active: !0,
1694
1694
  label: f.label || void 0
1695
1695
  });
1696
- }, Nt = (e) => (++Ot.current, xe.current = null, Ar(async () => {
1696
+ }, It = (e) => (++Ot.current, Fe.current = null, br(async () => {
1697
1697
  const o = ot.current, i = le.current;
1698
1698
  if (le.current = null, o && i)
1699
1699
  try {
@@ -1707,14 +1707,14 @@ const xi = Yn(
1707
1707
  const l = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
1708
1708
  n.send(JSON.stringify({ type: "microphoneStop", id: l }));
1709
1709
  }
1710
- (i || e) && L("onMicrophoneStateChange", it.current, {
1710
+ (i || e) && x("onMicrophoneStateChange", it.current, {
1711
1711
  active: !1,
1712
1712
  ...e !== void 0 && { error: e }
1713
1713
  });
1714
- })), Mr = (e, o) => {
1714
+ })), Nr = (e, o) => {
1715
1715
  let i;
1716
1716
  try {
1717
- i = li(o), console.info(
1717
+ i = di(o), console.info(
1718
1718
  `[RemoteControl] camera capture: ${i.camera?.width}x${i.camera?.height} @ ${i.camera?.frameRate ?? "?"}fps` + (i.camera?.label ? ` — ${i.camera.label}` : "")
1719
1719
  );
1720
1720
  } catch (n) {
@@ -1726,12 +1726,12 @@ const xi = Yn(
1726
1726
  }
1727
1727
  };
1728
1728
  }
1729
- e.send(JSON.stringify(i)), L("onCameraDemandChange", me.current, !0, !0, i.camera);
1730
- }, vn = (e) => {
1729
+ e.send(JSON.stringify(i)), x("onCameraDemandChange", me.current, !0, !0, i.camera);
1730
+ }, On = (e) => {
1731
1731
  if (!e) return;
1732
1732
  const o = e.indexOf("/"), n = (o >= 0 ? e.slice(o + 1) : e).toUpperCase();
1733
1733
  return n === "HEVC" ? "H265" : n;
1734
- }, On = async () => {
1734
+ }, _n = async () => {
1735
1735
  const e = _e.current, o = yt.current;
1736
1736
  if (!e || !o) return;
1737
1737
  let i;
@@ -1749,12 +1749,12 @@ const xi = Yn(
1749
1749
  }
1750
1750
  if (!n) return;
1751
1751
  const f = n.timestamp ?? Date.now(), p = vt.current;
1752
- let g, h, I;
1752
+ let g, h, b;
1753
1753
  if (p && f > p.timestamp) {
1754
1754
  const S = (f - p.timestamp) / 1e3;
1755
1755
  if (typeof n.framesEncoded == "number" && typeof p.framesEncoded == "number" && (g = Math.max(0, (n.framesEncoded - p.framesEncoded) / S)), typeof n.bytesSent == "number" && typeof p.bytesSent == "number" && (h = Math.max(0, (n.bytesSent - p.bytesSent) * 8 / S)), typeof n.packetsSent == "number" && typeof p.packetsSent == "number" && u && typeof u.packetsLost == "number" && typeof p.packetsLost == "number") {
1756
- const $ = n.packetsSent - p.packetsSent, te = u.packetsLost - p.packetsLost;
1757
- $ > 0 && (I = Math.max(0, Math.min(100, te / $ * 100)));
1756
+ const L = n.packetsSent - p.packetsSent, re = u.packetsLost - p.packetsLost;
1757
+ L > 0 && (b = Math.max(0, Math.min(100, re / L * 100)));
1758
1758
  }
1759
1759
  }
1760
1760
  vt.current = {
@@ -1765,7 +1765,7 @@ const xi = Yn(
1765
1765
  packetsLost: u?.packetsLost
1766
1766
  };
1767
1767
  const O = {
1768
- codec: vn(l),
1768
+ codec: On(l),
1769
1769
  encoderImplementation: n.encoderImplementation,
1770
1770
  hardwareAccelerated: typeof n.powerEfficientEncoder == "boolean" ? n.powerEfficientEncoder : void 0,
1771
1771
  framesPerSecond: g,
@@ -1775,16 +1775,16 @@ const xi = Yn(
1775
1775
  height: n.frameHeight,
1776
1776
  qualityLimitationReason: n.qualityLimitationReason,
1777
1777
  rttMs: typeof u?.roundTripTime == "number" ? u.roundTripTime * 1e3 : void 0,
1778
- packetsLostPct: I
1778
+ packetsLostPct: b
1779
1779
  };
1780
- L("onCameraStats", yt.current, O);
1781
- }, br = () => {
1780
+ x("onCameraStats", yt.current, O);
1781
+ }, Ir = () => {
1782
1782
  nt.current === null && (vt.current = null, nt.current = setInterval(() => {
1783
- On();
1783
+ _n();
1784
1784
  }, 1e3));
1785
- }, It = () => {
1786
- nt.current !== null && (clearInterval(nt.current), nt.current = null), vt.current = null, L("onCameraStats", yt.current, null);
1787
- }, _n = (e, o, i, n) => Wt.enqueue(async ({ isCurrent: l }) => {
1785
+ }, Yt = () => {
1786
+ nt.current !== null && (clearInterval(nt.current), nt.current = null), vt.current = null, x("onCameraStats", yt.current, null);
1787
+ }, Dn = (e, o, i, n) => Bt.enqueue(async ({ isCurrent: l }) => {
1788
1788
  const u = () => l() && n() && T.current === o && _e.current === i;
1789
1789
  if (!u()) return;
1790
1790
  if (!e.active) {
@@ -1794,14 +1794,14 @@ const xi = Yn(
1794
1794
  } catch (S) {
1795
1795
  w("replaceTrack(null) on camera detach failed:", S);
1796
1796
  }
1797
- if (ee.current === O && (ee.current = null, De.current = void 0, O && j(O)), It(), !u()) return;
1798
- L("onCameraDemandChange", me.current, !1);
1797
+ if (ee.current === O && (ee.current = null, De.current = void 0, O && j(O)), Yt(), !u()) return;
1798
+ x("onCameraDemandChange", me.current, !1);
1799
1799
  return;
1800
1800
  }
1801
- L("onCameraDemandChange", me.current, !0);
1801
+ x("onCameraDemandChange", me.current, !0);
1802
1802
  const f = ee.current, p = f?.getVideoTracks()[0], g = De.current;
1803
- if (p?.readyState === "live" && g && !ai(g, e)) {
1804
- De.current = e, Mr(o, p), br();
1803
+ if (p?.readyState === "live" && g && !ui(g, e)) {
1804
+ De.current = e, Nr(o, p), Ir();
1805
1805
  return;
1806
1806
  }
1807
1807
  if (f) {
@@ -1810,19 +1810,19 @@ const xi = Yn(
1810
1810
  } catch (O) {
1811
1811
  w("replaceTrack(null) before camera switch failed:", O);
1812
1812
  }
1813
- if (ee.current === f && (ee.current = null, De.current = void 0, j(f)), It(), !u()) return;
1813
+ if (ee.current === f && (ee.current = null, De.current = void 0, j(f)), Yt(), !u()) return;
1814
1814
  }
1815
1815
  if (!navigator.mediaDevices || typeof navigator.mediaDevices.getUserMedia != "function") {
1816
1816
  if (console.warn(
1817
1817
  "[RemoteControl] navigator.mediaDevices.getUserMedia unavailable. getUserMedia requires a secure context (https or http://localhost). Replying cameraResult granted=false so limulator falls back to black frames."
1818
1818
  ), !u()) return;
1819
- o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", me.current, !0, !1);
1819
+ o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), x("onCameraDemandChange", me.current, !0, !1);
1820
1820
  return;
1821
1821
  }
1822
1822
  let h = null;
1823
1823
  try {
1824
1824
  h = await navigator.mediaDevices.getUserMedia({
1825
- video: si(e),
1825
+ video: ai(e),
1826
1826
  audio: !1
1827
1827
  });
1828
1828
  } catch (O) {
@@ -1833,24 +1833,24 @@ const xi = Yn(
1833
1833
  return;
1834
1834
  }
1835
1835
  if (!h) {
1836
- o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", me.current, !0, !1);
1836
+ o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), x("onCameraDemandChange", me.current, !0, !1);
1837
1837
  return;
1838
1838
  }
1839
- const I = h.getVideoTracks()[0] ?? null;
1840
- if (!I) {
1839
+ const b = h.getVideoTracks()[0] ?? null;
1840
+ if (!b) {
1841
1841
  if (j(h), !u()) return;
1842
- o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", me.current, !0, !1);
1842
+ o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), x("onCameraDemandChange", me.current, !0, !1);
1843
1843
  return;
1844
1844
  }
1845
1845
  try {
1846
- I.contentHint = "motion";
1846
+ b.contentHint = "motion";
1847
1847
  } catch {
1848
1848
  }
1849
1849
  try {
1850
- await i.replaceTrack(I);
1850
+ await i.replaceTrack(b);
1851
1851
  } catch (O) {
1852
1852
  if (w("replaceTrack(videoTrack) failed:", O), j(h), !u()) return;
1853
- o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", me.current, !0, !1);
1853
+ o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), x("onCameraDemandChange", me.current, !0, !1);
1854
1854
  return;
1855
1855
  }
1856
1856
  if (!u()) {
@@ -1877,37 +1877,37 @@ const xi = Yn(
1877
1877
  j(h);
1878
1878
  return;
1879
1879
  }
1880
- ee.current = h, De.current = e, I.onended = () => {
1881
- ee.current === h && Wt.enqueueCurrent(async ({ isCurrent: O }) => {
1880
+ ee.current = h, De.current = e, b.onended = () => {
1881
+ ee.current === h && Bt.enqueueCurrent(async ({ isCurrent: O }) => {
1882
1882
  if (!(!O() || ee.current !== h || !n() || T.current !== o || _e.current !== i)) {
1883
1883
  try {
1884
1884
  await i.replaceTrack(null);
1885
1885
  } catch (S) {
1886
1886
  w("replaceTrack(null) after camera ended failed:", S);
1887
1887
  }
1888
- !O() || ee.current !== h || !n() || T.current !== o || _e.current !== i || (ee.current = null, De.current = void 0, j(h), It(), o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), L("onCameraDemandChange", me.current, !0, !1));
1888
+ !O() || ee.current !== h || !n() || T.current !== o || _e.current !== i || (ee.current = null, De.current = void 0, j(h), Yt(), o.send(JSON.stringify({ type: "cameraResult", granted: !1 })), x("onCameraDemandChange", me.current, !0, !1));
1889
1889
  }
1890
1890
  }).catch((O) => w("camera ended cleanup failed:", O));
1891
- }, u() && (Mr(o, I), br());
1891
+ }, u() && (Nr(o, b), Ir());
1892
1892
  }), je = () => {
1893
1893
  for (const e of ke.current.values())
1894
1894
  clearTimeout(e.timer), e.reject(new Error("Simulator disconnected"));
1895
- ke.current.clear(), ir(null), et.current && (et.current.srcObject = null), Rt(), ht(), ft(), z.current && (z.current.stop(), z.current = null), Wt.invalidate(), It(), Cn(), De.current = void 0, _e.current = null, ++Ot.current, $t.current = !1, xe.current = null, le.current && (j(le.current), le.current = null, L("onMicrophoneStateChange", it.current, {
1895
+ ke.current.clear(), ur(null), et.current && (et.current.srcObject = null), Nt(), ht(), ft(), z.current && (z.current.stop(), z.current = null), Bt.invalidate(), Yt(), yn(), De.current = void 0, _e.current = null, ++Ot.current, Vt.current = !1, Fe.current = null, le.current && (j(le.current), le.current = null, x("onMicrophoneStateChange", it.current, {
1896
1896
  active: !1
1897
- })), ot.current = null, ie.current !== void 0 && (window.cancelAnimationFrame(ie.current), ie.current = void 0), T.current && (T.current.onopen = null, T.current.onmessage = null, T.current.onerror = null, T.current.onclose = null, T.current.close(), T.current = null), W.current && (W.current.onconnectionstatechange = null, W.current.oniceconnectionstatechange = null, W.current.ontrack = null, W.current.onicecandidate = null, W.current.close(), W.current = null), x.current && (x.current.srcObject = null), P.current && (P.current.onopen = null, P.current.onclose = null, P.current.onerror = null, P.current.close(), P.current = null);
1898
- }, Rr = () => {
1899
- document.hidden ? wr() : Tr();
1900
- }, Dn = async () => {
1897
+ })), ot.current = null, oe.current !== void 0 && (window.cancelAnimationFrame(oe.current), oe.current = void 0), T.current && (T.current.onopen = null, T.current.onmessage = null, T.current.onerror = null, T.current.onclose = null, T.current.close(), T.current = null), H.current && (H.current.onconnectionstatechange = null, H.current.oniceconnectionstatechange = null, H.current.ontrack = null, H.current.onicecandidate = null, H.current.close(), H.current = null), W.current && (W.current.srcObject = null), P.current && (P.current.onopen = null, P.current.onclose = null, P.current.onerror = null, P.current.close(), P.current = null);
1898
+ }, Yr = () => {
1899
+ document.hidden ? Mr() : Sr();
1900
+ }, Tn = async () => {
1901
1901
  if (typeof navigator < "u" && navigator.onLine === !1)
1902
1902
  return !1;
1903
1903
  let e;
1904
1904
  try {
1905
1905
  const n = new URL(t);
1906
- n.protocol = n.protocol === "wss:" ? "https:" : n.protocol === "ws:" ? "http:" : n.protocol, e = kr(n.toString(), c);
1906
+ n.protocol = n.protocol === "wss:" ? "https:" : n.protocol === "ws:" ? "http:" : n.protocol, e = Ur(n.toString(), c);
1907
1907
  } catch {
1908
1908
  return !1;
1909
1909
  }
1910
- const o = new AbortController(), i = window.setTimeout(() => o.abort(), Ti);
1910
+ const o = new AbortController(), i = window.setTimeout(() => o.abort(), wi);
1911
1911
  try {
1912
1912
  return (await fetch(e, { method: "GET", cache: "no-store", signal: o.signal })).status === 404;
1913
1913
  } catch {
@@ -1915,50 +1915,50 @@ const xi = Yn(
1915
1915
  } finally {
1916
1916
  window.clearTimeout(i);
1917
1917
  }
1918
- }, Tn = () => {
1919
- Pe.current || (Pe.current = !0, sr(!0), Et(!1), Oe.current += 1, bt(), Rt(), ht(), je(), Y("Instance terminated"), qe("terminated"), L("onTerminated", gr.current));
1920
1918
  }, wn = () => {
1921
- Pe.current || Ft.current || (Ft.current = !0, Dn().then((e) => {
1922
- Ft.current = !1, e && Tn();
1919
+ Pe.current || (Pe.current = !0, fr(!0), Et(!1), Oe.current += 1, Rt(), Nt(), ht(), je(), Y("Instance terminated"), qe("terminated"), x("onTerminated", vr.current));
1920
+ }, An = () => {
1921
+ Pe.current || Ft.current || (Ft.current = !0, Tn().then((e) => {
1922
+ Ft.current = !1, e && wn();
1923
1923
  }));
1924
1924
  }, Qe = (e, o) => {
1925
1925
  if (Pe.current || o !== Oe.current)
1926
1926
  return;
1927
- if (wn(), Fe.current) {
1928
- if (!xt.current) {
1927
+ if (An(), xe.current) {
1928
+ if (!Xt.current) {
1929
1929
  Y(`Connection failed after it was established: ${e}`), Et(!0), qe("failed"), je();
1930
1930
  return;
1931
1931
  }
1932
- Y(`Reconnecting after established session dropped: ${e}`), Fe.current = !1, Ct.current = -1;
1932
+ Y(`Reconnecting after established session dropped: ${e}`), xe.current = !1, Ct.current = -1;
1933
1933
  }
1934
- bt();
1934
+ Rt();
1935
1935
  const i = Ct.current + 1;
1936
- if (i >= Zt) {
1937
- Y(`Connection failed after ${Zt} attempts: ${e}`), Et(!0), qe("failed"), je();
1936
+ if (i >= ir) {
1937
+ Y(`Connection failed after ${ir} attempts: ${e}`), Et(!0), qe("failed"), je();
1938
1938
  return;
1939
1939
  }
1940
- Y(`Retrying connection (${i + 1}/${Zt})`), qe("reconnecting"), je(), tt.current = window.setTimeout(() => {
1941
- tt.current = void 0, o === Oe.current && Nr(i);
1942
- }, Oi);
1943
- }, Nr = async (e = 0) => {
1940
+ Y(`Retrying connection (${i + 1}/${ir})`), qe("reconnecting"), je(), tt.current = window.setTimeout(() => {
1941
+ tt.current = void 0, o === Oe.current && Kr(i);
1942
+ }, _i);
1943
+ }, Kr = async (e = 0) => {
1944
1944
  if (Pe.current) return;
1945
1945
  const o = Oe.current + 1;
1946
- Oe.current = o, Ct.current = e, Fe.current = !1, Et(!1), e === 0 && Vt.current !== "reconnecting" && qe("connecting"), bt(), Rt(), ft(), ct.current = !1, Lt(!1), je();
1946
+ Oe.current = o, Ct.current = e, xe.current = !1, Et(!1), e === 0 && jt.current !== "reconnecting" && qe("connecting"), Rt(), Nt(), ft(), ct.current = !1, xt(!1), je();
1947
1947
  const i = () => o === Oe.current;
1948
1948
  rt.current = window.setTimeout(() => {
1949
- rt.current = void 0, !(!i() || Fe.current) && Qe("Connection did not succeed within 15 seconds", o);
1950
- }, _i);
1949
+ rt.current = void 0, !(!i() || xe.current) && Qe("Connection did not succeed within 15 seconds", o);
1950
+ }, Di);
1951
1951
  try {
1952
- const n = new WebSocket(kr(t, c));
1952
+ const n = new WebSocket(Ur(t, c));
1953
1953
  if (T.current = n, await new Promise((y, d) => {
1954
1954
  let K = !1;
1955
- const Q = window.setTimeout(() => d(new Error("WebSocket connection timeout")), 3e4), A = (N) => {
1956
- K || (K = !0, window.clearTimeout(Q), N());
1955
+ const Q = window.setTimeout(() => d(new Error("WebSocket connection timeout")), 3e4), A = (I) => {
1956
+ K || (K = !0, window.clearTimeout(Q), I());
1957
1957
  };
1958
1958
  n.onopen = () => {
1959
1959
  !i() || T.current !== n || A(y);
1960
- }, n.onerror = (N) => {
1961
- !i() || T.current !== n || (Y("WebSocket error: " + N), A(() => d(new Error("WebSocket connection failed"))));
1960
+ }, n.onerror = (I) => {
1961
+ !i() || T.current !== n || (Y("WebSocket error: " + I), A(() => d(new Error("WebSocket connection failed"))));
1962
1962
  }, n.onclose = () => {
1963
1963
  !i() || T.current !== n || (Y("WebSocket closed"), A(() => d(new Error("WebSocket closed before connection was established"))));
1964
1964
  };
@@ -1970,18 +1970,18 @@ const xi = Yn(
1970
1970
  !i() || T.current !== n || Y("WebSocket closed");
1971
1971
  };
1972
1972
  const l = new Promise((y, d) => {
1973
- const K = (N) => {
1974
- window.clearTimeout(Q), n.removeEventListener("message", A), N();
1973
+ const K = (I) => {
1974
+ window.clearTimeout(Q), n.removeEventListener("message", A), I();
1975
1975
  }, Q = window.setTimeout(
1976
1976
  () => K(() => d(new Error("RTCConfiguration timeout"))),
1977
1977
  3e4
1978
- ), A = (N) => {
1978
+ ), A = (I) => {
1979
1979
  if (!(!i() || T.current !== n))
1980
1980
  try {
1981
- const V = JSON.parse(N.data);
1981
+ const V = JSON.parse(I.data);
1982
1982
  if (V.type === "signalingError" && V.requestType === "requestRtcConfiguration" && V.sessionId === ae) {
1983
- const re = typeof V.error == "string" ? V.error : "Unable to load streaming configuration";
1984
- K(() => d(new Error(re)));
1983
+ const ne = typeof V.error == "string" ? V.error : "Unable to load streaming configuration";
1984
+ K(() => d(new Error(ne)));
1985
1985
  } else V.type === "rtcConfiguration" && K(
1986
1986
  () => y({
1987
1987
  rtcConfiguration: V.rtcConfiguration,
@@ -2007,38 +2007,38 @@ const xi = Yn(
2007
2007
  if (!i() || T.current !== n)
2008
2008
  return;
2009
2009
  const g = C === "iphone-duo" || p;
2010
- rr(g);
2010
+ sr(g);
2011
2011
  const h = new RTCPeerConnection(u);
2012
- W.current = h, h.addTransceiver("audio", { direction: "recvonly" });
2013
- const I = h.addTransceiver("video", { direction: "recvonly" }), O = g ? h.addTransceiver("video", { direction: "recvonly" }) : null, S = oe === "ios" || f, $ = S ? h.addTransceiver("video", {
2012
+ H.current = h, h.addTransceiver("audio", { direction: "recvonly" });
2013
+ const b = h.addTransceiver("video", { direction: "recvonly" }), O = g ? h.addTransceiver("video", { direction: "recvonly" }) : null, S = te === "ios" || f, L = S ? h.addTransceiver("video", {
2014
2014
  direction: "sendonly"
2015
2015
  }) : null;
2016
- _e.current = $?.sender ?? null;
2017
- const te = S ? h.addTransceiver("audio", {
2016
+ _e.current = L?.sender ?? null;
2017
+ const re = S ? h.addTransceiver("audio", {
2018
2018
  direction: "sendonly"
2019
2019
  }) : null;
2020
- if (ot.current = te?.sender ?? null, RTCRtpReceiver.getCapabilities) {
2020
+ if (ot.current = re?.sender ?? null, RTCRtpReceiver.getCapabilities) {
2021
2021
  const y = RTCRtpReceiver.getCapabilities("video");
2022
2022
  if (y && y.codecs) {
2023
2023
  const K = y.codecs.sort((Q, A) => {
2024
- const N = (V) => {
2025
- const re = V.mimeType.toLowerCase();
2026
- return re.includes("vp9") ? 1 : re.includes("h265") || re.includes("hevc") ? 2 : re.includes("h264") || re.includes("avc") ? 3 : 4;
2024
+ const I = (V) => {
2025
+ const ne = V.mimeType.toLowerCase();
2026
+ return ne.includes("vp9") ? 1 : ne.includes("h265") || ne.includes("hevc") ? 2 : ne.includes("h264") || ne.includes("avc") ? 3 : 4;
2027
2027
  };
2028
- return N(Q) - N(A);
2028
+ return I(Q) - I(A);
2029
2029
  });
2030
- I.setCodecPreferences(K), O?.setCodecPreferences(K), F("Set codec preferences:", K.map((Q) => Q.mimeType).join(", "));
2030
+ b.setCodecPreferences(K), O?.setCodecPreferences(K), F("Set codec preferences:", K.map((Q) => Q.mimeType).join(", "));
2031
2031
  }
2032
2032
  }
2033
- if ($ && RTCRtpSender.getCapabilities) {
2033
+ if (L && RTCRtpSender.getCapabilities) {
2034
2034
  const y = RTCRtpSender.getCapabilities("video");
2035
2035
  if (y && y.codecs) {
2036
2036
  const d = /* @__PURE__ */ new Set(["42e01f", "42e028", "640c1f"]), K = (A) => {
2037
- const N = A.mimeType.toLowerCase(), re = (A.sdpFmtpLine || "").toLowerCase().match(/profile-level-id=([0-9a-f]{6})/), Rn = re ? re[1] : "";
2038
- return N === "video/h265" || N === "video/hevc" ? 1 : N === "video/h264" && d.has(Rn) ? 2 : N === "video/h264" ? 3 : N === "video/vp9" ? 4 : N === "video/vp8" ? 5 : N === "video/rtx" || N === "video/red" || N === "video/ulpfec" ? 0 : 6;
2039
- }, Q = [...y.codecs].sort((A, N) => K(A) - K(N));
2037
+ const I = A.mimeType.toLowerCase(), ne = (A.sdpFmtpLine || "").toLowerCase().match(/profile-level-id=([0-9a-f]{6})/), Nn = ne ? ne[1] : "";
2038
+ return I === "video/h265" || I === "video/hevc" ? 1 : I === "video/h264" && d.has(Nn) ? 2 : I === "video/h264" ? 3 : I === "video/vp9" ? 4 : I === "video/vp8" ? 5 : I === "video/rtx" || I === "video/red" || I === "video/ulpfec" ? 0 : 6;
2039
+ }, Q = [...y.codecs].sort((A, I) => K(A) - K(I));
2040
2040
  try {
2041
- $.setCodecPreferences(Q), F(
2041
+ L.setCodecPreferences(Q), F(
2042
2042
  "Outbound camera codec preferences:",
2043
2043
  Q.map((A) => `${A.mimeType}${A.sdpFmtpLine ? `[${A.sdpFmtpLine}]` : ""}`).join(", ")
2044
2044
  );
@@ -2055,8 +2055,8 @@ const xi = Yn(
2055
2055
  if (P.current = G, G.onopen = () => {
2056
2056
  if (!i() || P.current !== G || T.current !== n)
2057
2057
  return;
2058
- Fe.current = !0, Rt(), Y("Control channel opened"), g && n.send(JSON.stringify({ type: "getFoldState", id: "duo-capabilities" })), z.current || (z.current = new ii({
2059
- platform: oe,
2058
+ xe.current = !0, Nt(), Y("Control channel opened"), g && n.send(JSON.stringify({ type: "getFoldState", id: "duo-capabilities" })), z.current || (z.current = new oi({
2059
+ platform: te,
2060
2060
  baseIntervalMs: Ie,
2061
2061
  maxBackoffMs: B,
2062
2062
  androidElementTreeOptions: fe,
@@ -2069,12 +2069,12 @@ const xi = Yn(
2069
2069
  }
2070
2070
  },
2071
2071
  onSnapshot: (d) => {
2072
- fr((K) => $r(K, d) ? K : d), queueMicrotask(() => {
2073
- L("onAxSnapshotChange", qt.current, d);
2072
+ mr((K) => Br(K, d) ? K : d), queueMicrotask(() => {
2073
+ x("onAxSnapshotChange", zt.current, d);
2074
2074
  });
2075
2075
  },
2076
2076
  onStatusChange: (d, K) => {
2077
- L("onAxStatusChange", Er.current, d, K);
2077
+ x("onAxStatusChange", yr.current, d, K);
2078
2078
  }
2079
2079
  }), ($e.current === !0 || $e.current === "hover-only") && z.current.start());
2080
2080
  const y = () => {
@@ -2112,31 +2112,31 @@ const xi = Yn(
2112
2112
  }, G.onerror = (y) => {
2113
2113
  !i() || P.current !== G || (console.error("Control channel error:", y), Y("Control channel error: " + y));
2114
2114
  }, h.onconnectionstatechange = () => {
2115
- !i() || W.current !== h || (Y("Connection state: " + h.connectionState), h.connectionState === "failed" && Qe("WebRTC connection entered failed state", o));
2115
+ !i() || H.current !== h || (Y("Connection state: " + h.connectionState), h.connectionState === "failed" && Qe("WebRTC connection entered failed state", o));
2116
2116
  }, h.oniceconnectionstatechange = () => {
2117
- if (!i() || W.current !== h)
2117
+ if (!i() || H.current !== h)
2118
2118
  return;
2119
2119
  const y = h.iceConnectionState;
2120
2120
  if (Y("ICE state: " + y), y === "connected" || y === "completed") {
2121
- ht(), Jt() && !le.current && zt();
2121
+ ht(), Zt() && !le.current && er();
2122
2122
  return;
2123
2123
  }
2124
2124
  if (y === "failed") {
2125
2125
  ht(), Qe("ICE connection entered failed state", o);
2126
2126
  return;
2127
2127
  }
2128
- y === "disconnected" && xt.current && Le.current === void 0 && (Le.current = window.setTimeout(() => {
2129
- Le.current = void 0, !(!i() || W.current !== h) && h.iceConnectionState === "disconnected" && Qe("ICE stayed disconnected past grace period", o);
2130
- }, Di));
2128
+ y === "disconnected" && Xt.current && Le.current === void 0 && (Le.current = window.setTimeout(() => {
2129
+ Le.current = void 0, !(!i() || H.current !== h) && h.iceConnectionState === "disconnected" && Qe("ICE stayed disconnected past grace period", o);
2130
+ }, Ti));
2131
2131
  }, h.ontrack = (y) => {
2132
- if (!(!i() || W.current !== h) && (Y("Received remote track: " + y.track.kind), y.track.kind === "video" && x.current)) {
2132
+ if (!(!i() || H.current !== h) && (Y("Received remote track: " + y.track.kind), y.track.kind === "video" && W.current)) {
2133
2133
  F(`[${(/* @__PURE__ */ new Date()).toISOString()}] Video track received:`, y.track);
2134
- const K = y.track.id === "duo-inner" || y.streams.some((Q) => Q.id === "duo-inner") ? et.current : x.current;
2134
+ const K = y.track.id === "duo-inner" || y.streams.some((Q) => Q.id === "duo-inner") ? et.current : W.current;
2135
2135
  K && (K.srcObject = g ? new MediaStream([y.track]) : y.streams[0] ?? new MediaStream([y.track]), K.play().catch(() => {
2136
2136
  }));
2137
2137
  }
2138
2138
  }, h.onicecandidate = (y) => {
2139
- if (!(!i() || W.current !== h || T.current !== n))
2139
+ if (!(!i() || H.current !== h || T.current !== n))
2140
2140
  if (y.candidate && n.readyState === WebSocket.OPEN) {
2141
2141
  const d = {
2142
2142
  type: "candidate",
@@ -2164,7 +2164,7 @@ const xi = Yn(
2164
2164
  case "foldStateResult":
2165
2165
  case "foldStateChanged": {
2166
2166
  if (!g) break;
2167
- d.state ? (ir(d.state), cr(void 0)) : d.id === "duo-capabilities" && cr(d.error || "This instance does not support native iPhone Duo displays.");
2167
+ d.state ? (ur(d.state), dr(void 0)) : d.id === "duo-capabilities" && dr(d.error || "This instance does not support native iPhone Duo displays.");
2168
2168
  const A = ke.current.get(d.id);
2169
2169
  A && (clearTimeout(A.timer), ke.current.delete(d.id), d.error ? A.reject(new Error(d.error)) : A.resolve());
2170
2170
  break;
@@ -2177,7 +2177,7 @@ const xi = Yn(
2177
2177
  break;
2178
2178
  }
2179
2179
  case "answer":
2180
- if (!W.current || W.current !== h) {
2180
+ if (!H.current || H.current !== h) {
2181
2181
  Y("No peer connection, skipping answer");
2182
2182
  break;
2183
2183
  }
@@ -2186,12 +2186,12 @@ const xi = Yn(
2186
2186
  type: "answer",
2187
2187
  sdp: d.sdp
2188
2188
  })
2189
- ), !i() || W.current !== h)
2189
+ ), !i() || H.current !== h)
2190
2190
  return;
2191
2191
  Y("Set remote description");
2192
2192
  break;
2193
2193
  case "candidate":
2194
- if (!W.current || W.current !== h) {
2194
+ if (!H.current || H.current !== h) {
2195
2195
  Y("No peer connection, skipping candidate");
2196
2196
  break;
2197
2197
  }
@@ -2201,7 +2201,7 @@ const xi = Yn(
2201
2201
  sdpMid: d.sdpMid,
2202
2202
  sdpMLineIndex: d.sdpMLineIndex
2203
2203
  })
2204
- ), !i() || W.current !== h)
2204
+ ), !i() || H.current !== h)
2205
2205
  return;
2206
2206
  Y("Added ICE candidate");
2207
2207
  break;
@@ -2211,18 +2211,18 @@ const xi = Yn(
2211
2211
  w("Received invalid screenshot success message:", d);
2212
2212
  break;
2213
2213
  }
2214
- const A = Mi(d);
2214
+ const A = bi(d);
2215
2215
  if (A) {
2216
- const re = Ee.current.get(d.id);
2217
- if (!re) {
2216
+ const ne = Ee.current.get(d.id);
2217
+ if (!ne) {
2218
2218
  w(`Received screenshot error for unknown or handled id: ${d.id}`);
2219
2219
  break;
2220
2220
  }
2221
- w(`Received screenshot error for id ${d.id}: ${A}`), re(new Error(A)), ye.current.delete(d.id), Ee.current.delete(d.id);
2221
+ w(`Received screenshot error for id ${d.id}: ${A}`), ne(new Error(A)), ye.current.delete(d.id), Ee.current.delete(d.id);
2222
2222
  break;
2223
2223
  }
2224
- const N = bi(d);
2225
- if (!N) {
2224
+ const I = Ri(d);
2225
+ if (!I) {
2226
2226
  w("Received screenshot message without image data:", d);
2227
2227
  break;
2228
2228
  }
@@ -2231,7 +2231,7 @@ const xi = Yn(
2231
2231
  w(`Received screenshot data for unknown or handled id: ${d.id}`);
2232
2232
  break;
2233
2233
  }
2234
- F(`Received screenshot data for id ${d.id}`), V(N), ye.current.delete(d.id), Ee.current.delete(d.id);
2234
+ F(`Received screenshot data for id ${d.id}`), V(I), ye.current.delete(d.id), Ee.current.delete(d.id);
2235
2235
  break;
2236
2236
  }
2237
2237
  case "screenshotError":
@@ -2250,33 +2250,33 @@ const xi = Yn(
2250
2250
  const A = _e.current;
2251
2251
  if (!A)
2252
2252
  break;
2253
- const N = ci(d);
2254
- if (!N) {
2253
+ const I = si(d);
2254
+ if (!I) {
2255
2255
  w("Received invalid cameraRequest:", d);
2256
2256
  break;
2257
2257
  }
2258
- console.info("[RemoteControl] cameraRequest received:", N.active, N.facingMode), await _n(N, n, A, i);
2258
+ console.info("[RemoteControl] cameraRequest received:", I.active, I.facingMode), await Dn(I, n, A, i);
2259
2259
  break;
2260
2260
  }
2261
2261
  case "microphoneRequest": {
2262
2262
  if (!ot.current)
2263
2263
  break;
2264
2264
  const A = d.active === !0;
2265
- if ($t.current = A, console.info("[RemoteControl] microphoneRequest received, active=", A), !A) {
2266
- Ht.current || await Nt();
2265
+ if (Vt.current = A, console.info("[RemoteControl] microphoneRequest received, active=", A), !A) {
2266
+ qt.current || await It();
2267
2267
  break;
2268
2268
  }
2269
2269
  if (le.current) {
2270
- Sr(n);
2270
+ Rr(n);
2271
2271
  break;
2272
2272
  }
2273
- await zt();
2273
+ await er();
2274
2274
  break;
2275
2275
  }
2276
2276
  case "microphoneStartResult": {
2277
- if (xe.current === null || d.id !== xe.current)
2277
+ if (Fe.current === null || d.id !== Fe.current)
2278
2278
  break;
2279
- xe.current = null, typeof d.error == "string" && (console.warn("[RemoteControl] microphoneStart rejected by host:", d.error), Nt(d.error));
2279
+ Fe.current = null, typeof d.error == "string" && (console.warn("[RemoteControl] microphoneStart rejected by host:", d.error), It(d.error));
2280
2280
  break;
2281
2281
  }
2282
2282
  case "terminateAppResult":
@@ -2304,12 +2304,12 @@ const xi = Yn(
2304
2304
  w(`Received unhandled message type: ${d.type}`, d);
2305
2305
  break;
2306
2306
  }
2307
- }, W.current === h) {
2307
+ }, H.current === h) {
2308
2308
  const y = await h.createOffer({
2309
2309
  offerToReceiveVideo: !0,
2310
2310
  offerToReceiveAudio: !1
2311
2311
  });
2312
- if (!i() || W.current !== h || (await h.setLocalDescription(y), !i() || W.current !== h))
2312
+ if (!i() || H.current !== h || (await h.setLocalDescription(y), !i() || H.current !== h))
2313
2313
  return;
2314
2314
  i() && T.current === n && n.readyState === WebSocket.OPEN && n.send(
2315
2315
  JSON.stringify({
@@ -2326,22 +2326,22 @@ const xi = Yn(
2326
2326
  const l = n instanceof Error ? n.message : String(n);
2327
2327
  Y("Error: " + l), Qe(l, o);
2328
2328
  }
2329
- }, jt = () => {
2330
- Pe.current = !1, sr(!1), Nr(0);
2331
- }, An = () => {
2332
- Oe.current += 1, Ct.current = 0, Fe.current = !1, bt(), ht(), je(), Y("Stopped");
2333
- }, Sn = (e) => {
2334
- e.stopPropagation(), jt();
2329
+ }, tr = () => {
2330
+ Pe.current = !1, fr(!1), Kr(0);
2331
+ }, Sn = () => {
2332
+ Oe.current += 1, Ct.current = 0, xe.current = !1, Rt(), ht(), je(), Y("Stopped");
2333
+ }, Mn = (e) => {
2334
+ e.stopPropagation(), tr();
2335
2335
  };
2336
2336
  de(() => {
2337
- Jt() ? zt() : Nt();
2338
- }, [he]), de(() => (Lt(!1), jt(), document.hidden || Tr(), document.addEventListener("visibilitychange", Rr), () => {
2339
- wr(), An(), document.removeEventListener("visibilitychange", Rr);
2337
+ Zt() ? er() : It();
2338
+ }, [he]), de(() => (xt(!1), tr(), document.hidden || Sr(), document.addEventListener("visibilitychange", Yr), () => {
2339
+ Mr(), Sn(), document.removeEventListener("visibilitychange", Yr);
2340
2340
  }), [t, c, a, C]);
2341
- const Ir = () => {
2341
+ const rr = () => {
2342
2342
  const e = dt();
2343
2343
  if (!e) {
2344
- hr(null);
2344
+ Er(null);
2345
2345
  return;
2346
2346
  }
2347
2347
  const o = {
@@ -2350,24 +2350,39 @@ const xi = Yn(
2350
2350
  width: e.actualWidth,
2351
2351
  height: e.actualHeight
2352
2352
  };
2353
- hr(
2353
+ Er(
2354
2354
  (i) => i && i.left === o.left && i.top === o.top && i.width === o.width && i.height === o.height ? i : o
2355
2355
  );
2356
2356
  };
2357
2357
  de(() => {
2358
- const e = x.current, o = Ke.current, i = pe.current;
2358
+ const e = W.current, o = Ke.current, i = pe.current;
2359
2359
  if (!e) return;
2360
2360
  const n = () => {
2361
2361
  const { videoWidth: f, videoHeight: p } = e, g = f > p;
2362
- if (f > 0 && p > 0 && (Jr(g), jr(oe === "android" && wi(f, p)), Zr(Math.min(f, p) / Math.max(f, p) < 0.6)), !wt || !o) {
2363
- ur({}), Ir();
2362
+ if (f > 0 && p > 0) {
2363
+ jr(g), Zr(te === "android" && Ai(f, p));
2364
+ const L = Math.min(f, p) / Math.max(f, p);
2365
+ en(
2366
+ L < 0.6 ? "phone" : L < 0.8 ? "tablet" : "watch"
2367
+ );
2368
+ }
2369
+ if (!At || !o) {
2370
+ $t({}), rr();
2371
+ return;
2372
+ }
2373
+ const h = o.clientWidth, b = o.clientHeight;
2374
+ if (h === 0 || b === 0) return;
2375
+ if (wt) {
2376
+ $t({
2377
+ width: `${h * (g ? 1210 / 1258 : 834 / 882)}px`,
2378
+ height: `${b * (g ? 834 / 882 : 1210 / 1258)}px`,
2379
+ borderRadius: `${Math.min(h, b) * 18 / 882}px`
2380
+ }), rr();
2364
2381
  return;
2365
2382
  }
2366
- const h = o.clientWidth, I = o.clientHeight;
2367
- if (h === 0 || I === 0) return;
2368
2383
  const O = g ? Ve.videoPosition.landscape : Ve.videoPosition.portrait;
2369
2384
  let S = {};
2370
- O.heightMultiplier ? (S.height = `${I * O.heightMultiplier}px`, S.width = "auto") : O.widthMultiplier && (S.width = `${h * O.widthMultiplier}px`, S.height = "auto"), S.borderRadius = `${g ? I * Ve.videoBorderRadiusMultiplier : h * Ve.videoBorderRadiusMultiplier}px`, ur(S), Ir();
2385
+ O.heightMultiplier ? (S.height = `${b * O.heightMultiplier}px`, S.width = "auto") : O.widthMultiplier && (S.width = `${h * O.widthMultiplier}px`, S.height = "auto"), S.borderRadius = `${g ? b * Ve.videoBorderRadiusMultiplier : h * Ve.videoBorderRadiusMultiplier}px`, $t(S), rr();
2371
2386
  }, l = new ResizeObserver(() => {
2372
2387
  n();
2373
2388
  });
@@ -2376,22 +2391,22 @@ const xi = Yn(
2376
2391
  return e.addEventListener("resize", u), n(), () => {
2377
2392
  l.disconnect(), e.removeEventListener("loadedmetadata", n), e.removeEventListener("resize", n), e.removeEventListener("resize", u), o && o.removeEventListener("load", n);
2378
2393
  };
2379
- }, [Ve, wt, oe]), de(() => {
2394
+ }, [Ve, At, te, wt, Wt]), de(() => {
2380
2395
  const e = z.current;
2381
- ut ? e?.start() : (e?.stop(), fr(null), at(null), Dt(null), pr(null), He(null), Tt.current = null, ie.current !== void 0 && (window.cancelAnimationFrame(ie.current), ie.current = void 0), L("onAxSnapshotChange", qt.current, null));
2396
+ ut ? e?.start() : (e?.stop(), mr(null), at(null), Dt(null), gr(null), He(null), Tt.current = null, oe.current !== void 0 && (window.cancelAnimationFrame(oe.current), oe.current = void 0), x("onAxSnapshotChange", zt.current, null));
2382
2397
  }, [ut]), de(() => () => {
2383
- ie.current !== void 0 && (window.cancelAnimationFrame(ie.current), ie.current = void 0);
2398
+ oe.current !== void 0 && (window.cancelAnimationFrame(oe.current), oe.current = void 0);
2384
2399
  }, []), de(() => {
2385
2400
  if (!ut) return;
2386
2401
  const e = (o) => {
2387
- o.key === "Escape" && (Bt || Xt) && (Dt(null), at(null), He(null), L("onInspectSelectionChange", Be.current, null));
2402
+ o.key === "Escape" && (Jt || Gt) && (Dt(null), at(null), He(null), x("onInspectSelectionChange", Be.current, null));
2388
2403
  };
2389
2404
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2390
- }, [ut, Bt, Xt]);
2391
- const Mn = () => {
2392
- x.current && x.current.focus();
2405
+ }, [ut, Jt, Gt]);
2406
+ const bn = () => {
2407
+ W.current && W.current.focus();
2393
2408
  };
2394
- Kn(Ye, () => ({
2409
+ kn(Ye, () => ({
2395
2410
  openUrl: (e) => {
2396
2411
  if (!T.current || T.current.readyState !== WebSocket.OPEN) {
2397
2412
  w("WebSocket not open, cannot send open_url command via ref.");
@@ -2422,7 +2437,7 @@ const xi = Yn(
2422
2437
  w("Data channel not ready for imperative key command:", P.current?.readyState);
2423
2438
  return;
2424
2439
  }
2425
- const o = xr[e.code];
2440
+ const o = Hr[e.code];
2426
2441
  if (!o) {
2427
2442
  w(`Unknown event.code for imperative command: ${e.code}`);
2428
2443
  return;
@@ -2480,7 +2495,7 @@ const xi = Yn(
2480
2495
  Te.current.has(n) && (w(`terminateApp request timed out for id ${n}`), we.current.get(n)?.(new Error("terminateApp request timed out")), Te.current.delete(n), we.current.delete(n));
2481
2496
  }, 3e4);
2482
2497
  }),
2483
- reconnect: () => jt(),
2498
+ reconnect: () => tr(),
2484
2499
  refreshAxTree: async () => {
2485
2500
  const e = z.current;
2486
2501
  if (!e)
@@ -2494,11 +2509,11 @@ const xi = Yn(
2494
2509
  setInspectSelection: (e) => {
2495
2510
  Dt(e?.id ?? null), He(e ? Tt.current : null);
2496
2511
  const o = Xe.current;
2497
- e && o ? L("onInspectSelectionChange", Be.current, { element: e, snapshot: o }) : L("onInspectSelectionChange", Be.current, null);
2512
+ e && o ? x("onInspectSelectionChange", Be.current, { element: e, snapshot: o }) : x("onInspectSelectionChange", Be.current, null);
2498
2513
  },
2499
2514
  getAxStatus: () => z.current?.getStatus() ?? "idle"
2500
2515
  }));
2501
- const bn = tn && Se !== null;
2516
+ const Rn = rn && Se !== null;
2502
2517
  return /* @__PURE__ */ ce(
2503
2518
  "div",
2504
2519
  {
@@ -2514,7 +2529,7 @@ const xi = Yn(
2514
2529
  onTouchEnd: ve,
2515
2530
  onTouchCancel: ve,
2516
2531
  children: [
2517
- bn && Se && /* @__PURE__ */ ce(Lr, { children: [
2532
+ Rn && Se && /* @__PURE__ */ ce(Fr, { children: [
2518
2533
  /* @__PURE__ */ k(
2519
2534
  "div",
2520
2535
  {
@@ -2536,30 +2551,34 @@ const xi = Yn(
2536
2551
  }
2537
2552
  )
2538
2553
  ] }),
2539
- wt && /* @__PURE__ */ k(
2554
+ At && /* @__PURE__ */ k(
2540
2555
  "img",
2541
2556
  {
2542
2557
  ref: Ke,
2543
- src: yr,
2558
+ src: _r,
2544
2559
  alt: "",
2545
- className: oe === "ios" ? Ne("rc-phone-frame", "rc-phone-frame-ios") : "rc-phone-frame",
2560
+ className: Ne(
2561
+ "rc-phone-frame",
2562
+ te === "ios" && "rc-phone-frame-ios",
2563
+ wt && "rc-ipad-frame"
2564
+ ),
2546
2565
  draggable: !1
2547
2566
  }
2548
2567
  ),
2549
2568
  /* @__PURE__ */ k(
2550
2569
  "video",
2551
2570
  {
2552
- ref: x,
2571
+ ref: W,
2553
2572
  className: Ne(
2554
2573
  "rc-video",
2555
- !wt && "rc-video-frameless",
2556
- !qr && "rc-video-loading"
2574
+ !At && "rc-video-frameless",
2575
+ !Gr && "rc-video-loading"
2557
2576
  ),
2558
2577
  style: {
2559
- ...en,
2578
+ ...tn,
2560
2579
  ...se ? { opacity: 0, width: 1, height: 1, pointerEvents: "none" } : {},
2561
- ...vr ? {
2562
- backgroundImage: `url("${vr}")`,
2580
+ ...Dr ? {
2581
+ backgroundImage: `url("${Dr}")`,
2563
2582
  backgroundRepeat: "no-repeat",
2564
2583
  backgroundPosition: "center",
2565
2584
  backgroundSize: Ve.loadingLogoSize
@@ -2569,15 +2588,15 @@ const xi = Yn(
2569
2588
  playsInline: !0,
2570
2589
  muted: !0,
2571
2590
  tabIndex: se ? -1 : 0,
2572
- onKeyDown: Mt,
2573
- onKeyUp: Mt,
2574
- onClick: Mn,
2575
- onLoadedData: gn,
2591
+ onKeyDown: bt,
2592
+ onKeyUp: bt,
2593
+ onClick: bn,
2594
+ onLoadedData: Cn,
2576
2595
  onFocus: () => {
2577
- x.current && (x.current.style.outline = "none");
2596
+ W.current && (W.current.style.outline = "none");
2578
2597
  },
2579
2598
  onBlur: () => {
2580
- x.current && (x.current.style.outline = "none");
2599
+ W.current && (W.current.style.outline = "none");
2581
2600
  }
2582
2601
  }
2583
2602
  ),
@@ -2591,81 +2610,81 @@ const xi = Yn(
2591
2610
  style: { position: "absolute", width: 1, height: 1, opacity: 0, pointerEvents: "none" }
2592
2611
  }
2593
2612
  ),
2594
- se && nr && /* @__PURE__ */ k(kn, { fallback: /* @__PURE__ */ k("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ k(
2595
- yi,
2613
+ se && ar && /* @__PURE__ */ k(Pn, { fallback: /* @__PURE__ */ k("div", { children: "Loading iPhone Duo…" }), children: /* @__PURE__ */ k(
2614
+ vi,
2596
2615
  {
2597
2616
  showFrame: m,
2598
2617
  modelUrl: v,
2599
- outer: x.current,
2618
+ outer: W.current,
2600
2619
  inner: et.current,
2601
- state: nr,
2602
- setAngle: (e) => Ut("setHingeAngle", { angleDegrees: e }),
2603
- setOrientation: (e) => Ut("setDuoOrientation", { orientation: e }),
2604
- button: (e, o) => Ut("performActions", {
2620
+ state: ar,
2621
+ setAngle: (e) => Lt("setHingeAngle", { angleDegrees: e }),
2622
+ setOrientation: (e) => Lt("setDuoOrientation", { orientation: e }),
2623
+ button: (e, o) => Lt("performActions", {
2605
2624
  actions: [{ type: o ? "buttonDown" : "buttonUp", button: e }]
2606
2625
  }),
2607
2626
  touch: (e, o, i, n) => {
2608
2627
  const l = P.current;
2609
- l?.readyState === "open" && l.send(Ln(e, o, i, n));
2628
+ l?.readyState === "open" && l.send(xn(e, o, i, n));
2610
2629
  },
2611
- onKeyDown: Mt,
2612
- onKeyUp: Mt
2630
+ onKeyDown: bt,
2631
+ onKeyUp: bt
2613
2632
  }
2614
2633
  ) }),
2615
- se && or && /* @__PURE__ */ k("div", { role: "alert", className: "rc-duo-error", children: or }),
2634
+ se && lr && /* @__PURE__ */ k("div", { role: "alert", className: "rc-duo-error", children: lr }),
2616
2635
  !se && ut && /* @__PURE__ */ k(
2617
- Ci,
2636
+ yi,
2618
2637
  {
2619
- snapshot: dr,
2620
- geometry: nn,
2621
- highlightedId: Xt,
2622
- selectedId: Bt,
2623
- mode: sn,
2624
- cursorPosition: on,
2625
- frozenCursorPosition: cn,
2638
+ snapshot: pr,
2639
+ geometry: on,
2640
+ highlightedId: Gt,
2641
+ selectedId: Jt,
2642
+ mode: an,
2643
+ cursorPosition: cn,
2644
+ frozenCursorPosition: sn,
2626
2645
  onSelectChange: (e, o) => {
2627
2646
  Dt(e?.id ?? null), e && o ? He(o) : e || He(null);
2628
2647
  const i = Xe.current;
2629
- e && i ? L("onInspectSelectionChange", Be.current, {
2648
+ e && i ? x("onInspectSelectionChange", Be.current, {
2630
2649
  element: e,
2631
2650
  snapshot: i
2632
- }) : L("onInspectSelectionChange", Be.current, null);
2651
+ }) : x("onInspectSelectionChange", Be.current, null);
2633
2652
  },
2634
2653
  onTapElement: (e, o) => {
2635
2654
  if (o) {
2636
- _r(o.x, o.y);
2655
+ wr(o.x, o.y);
2637
2656
  return;
2638
2657
  }
2639
2658
  const i = Xe.current;
2640
- i && an(e, i);
2659
+ i && un(e, i);
2641
2660
  }
2642
2661
  }
2643
2662
  ),
2644
- Gr ? /* @__PURE__ */ ce("div", { className: "rc-terminated", role: "status", children: [
2663
+ zr ? /* @__PURE__ */ ce("div", { className: "rc-terminated", role: "status", children: [
2645
2664
  /* @__PURE__ */ k("div", { className: "rc-terminated-title", children: "Instance terminated" }),
2646
2665
  /* @__PURE__ */ k("div", { className: "rc-terminated-message", children: "This instance no longer exists and can't be reconnected." })
2647
- ] }) : Vr && /* @__PURE__ */ k("button", { type: "button", className: "rc-retry-button", onClick: Sn, children: "Retry" })
2666
+ ] }) : Jr && /* @__PURE__ */ k("button", { type: "button", className: "rc-retry-button", onClick: Mn, children: "Retry" })
2648
2667
  ]
2649
2668
  }
2650
2669
  );
2651
2670
  }
2652
- ), Mi = (r) => typeof r.message == "string" ? r.message : typeof r.error == "string" ? r.error : null, bi = (r) => typeof r.dataUri == "string" ? { dataUri: r.dataUri } : typeof r.base64 == "string" ? r.base64.startsWith("data:") ? { dataUri: r.base64 } : { dataUri: `data:${r.base64.startsWith("/9j/") ? "image/jpeg" : "image/png"};base64,${r.base64}` } : null;
2671
+ ), bi = (r) => typeof r.message == "string" ? r.message : typeof r.error == "string" ? r.error : null, Ri = (r) => typeof r.dataUri == "string" ? { dataUri: r.dataUri } : typeof r.base64 == "string" ? r.base64.startsWith("data:") ? { dataUri: r.base64 } : { dataUri: `data:${r.base64.startsWith("/9j/") ? "image/jpeg" : "image/png"};base64,${r.base64}` } : null;
2653
2672
  export {
2654
- Qt as A,
2655
- Yi as D,
2656
- Ui as H,
2657
- xi as R,
2658
- zn as a,
2659
- jn as b,
2660
- Br as c,
2661
- Hr as d,
2662
- $r as e,
2663
- Jn as f,
2664
- Bn as g,
2673
+ nr as A,
2674
+ Ki as D,
2675
+ Li as H,
2676
+ Wi as R,
2677
+ jn as a,
2678
+ Qn as b,
2679
+ Vr as c,
2680
+ Xr as d,
2681
+ Br as e,
2682
+ zn as f,
2683
+ qn as g,
2665
2684
  Fi as h,
2666
- Li as i,
2667
- Ki as j,
2668
- Pi as k,
2669
- Gn as n,
2670
- ki as p
2685
+ xi as i,
2686
+ ki as j,
2687
+ Ui as k,
2688
+ Jn as n,
2689
+ Pi as p
2671
2690
  };