@limrun/ui 0.22.6 → 0.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/remote-control.d.ts +2 -2
- package/dist/core/stream-options.d.ts +1 -1
- package/dist/core/stream-utils.d.ts +1 -1
- package/dist/core-B3nWmNki.js +2 -0
- package/dist/{core-BPDihn1M.mjs → core-B7MkSLE_.mjs} +340 -340
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{duo-frame-d3lnF2F7.js → duo-frame-Bpou_8n1.js} +1 -1
- package/dist/{duo-frame-s8ZpiZc-.mjs → duo-frame-BvOU1zvh.mjs} +2 -2
- package/dist/{duo-view-CKlDgO_u.js → duo-view-DbnkRRU-.js} +1 -1
- package/dist/{duo-view-B2i1POpD.mjs → duo-view-DuGDgUyB.mjs} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +2 -2
- package/dist/{macbook-frame-BZhBYM9R.mjs → macbook-frame-Bhu3fUB7.mjs} +1 -1
- package/dist/{macbook-frame-g3h4xP5G.js → macbook-frame-DASJ960L.js} +1 -1
- package/dist/{remote-control-y8mgo_2E.js → remote-control-D_851mel.js} +1 -1
- package/dist/{remote-control-DmPKov-i.mjs → remote-control-cQIifCub.mjs} +2 -2
- package/package.json +1 -1
- package/dist/core-_qwksEry.js +0 -2
|
@@ -259,7 +259,7 @@ const ee = {
|
|
|
259
259
|
KEYCODE_SLEEP: 223,
|
|
260
260
|
KEYCODE_WAKEUP: 224,
|
|
261
261
|
KEYCODE_SOFT_SLEEP: 276
|
|
262
|
-
},
|
|
262
|
+
}, tr = {
|
|
263
263
|
KeyA: a.KEYCODE_A,
|
|
264
264
|
KeyB: a.KEYCODE_B,
|
|
265
265
|
KeyC: a.KEYCODE_C,
|
|
@@ -365,7 +365,7 @@ const ee = {
|
|
|
365
365
|
// Some numpads have comma
|
|
366
366
|
NumpadEnter: a.KEYCODE_NUMPAD_ENTER,
|
|
367
367
|
NumpadEqual: a.KEYCODE_NUMPAD_EQUALS
|
|
368
|
-
},
|
|
368
|
+
}, rr = {
|
|
369
369
|
KeyA: 0,
|
|
370
370
|
KeyS: 1,
|
|
371
371
|
KeyD: 2,
|
|
@@ -480,50 +480,50 @@ const ee = {
|
|
|
480
480
|
ArrowDown: 125,
|
|
481
481
|
ArrowUp: 126
|
|
482
482
|
};
|
|
483
|
-
function
|
|
484
|
-
return
|
|
483
|
+
function Mt(t) {
|
|
484
|
+
return rr[t];
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function nr(t, e, r, o, u, l, i = 1, h = 0, D = 0) {
|
|
487
487
|
const p = new ArrayBuffer(32), S = new DataView(p);
|
|
488
488
|
let w = 0;
|
|
489
489
|
S.setUint8(w, ee.INJECT_TOUCH_EVENT), w += 1;
|
|
490
490
|
const N = t === ze.ACTION_POINTER_DOWN ? ze.ACTION_DOWN : t === ze.ACTION_POINTER_UP ? ze.ACTION_UP : t;
|
|
491
|
-
return S.setUint8(w, N), w += 1, S.setBigInt64(w, BigInt(e), !0), w += 8, S.setInt32(w, Math.round(u), !0), w += 4, S.setInt32(w, Math.round(l), !0), w += 4, S.setUint16(w, r, !0), w += 2, S.setUint16(w, o, !0), w += 2, S.setInt16(w, Math.round(i * 65535), !0), w += 2, S.setInt32(w,
|
|
491
|
+
return S.setUint8(w, N), w += 1, S.setBigInt64(w, BigInt(e), !0), w += 8, S.setInt32(w, Math.round(u), !0), w += 4, S.setInt32(w, Math.round(l), !0), w += 4, S.setUint16(w, r, !0), w += 2, S.setUint16(w, o, !0), w += 2, S.setInt16(w, Math.round(i * 65535), !0), w += 2, S.setInt32(w, h, !0), w += 4, S.setInt32(w, D, !0), p;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
const
|
|
493
|
+
function jr(t, e, r, o, u, l, i) {
|
|
494
|
+
const h = new ArrayBuffer(24), D = new DataView(h);
|
|
495
495
|
let p = 0;
|
|
496
|
-
return D.setUint8(p, ee.INJECT_TWO_FINGER_TOUCH_EVENT), p += 1, D.setUint8(p, t), p += 1, D.setInt32(p, Math.round(o), !0), p += 4, D.setInt32(p, Math.round(u), !0), p += 4, D.setInt32(p, Math.round(l), !0), p += 4, D.setInt32(p, Math.round(i), !0), p += 4, D.setUint16(p, e, !0), p += 2, D.setUint16(p, r, !0), p += 2, D.setUint16(p, 0, !0),
|
|
496
|
+
return D.setUint8(p, ee.INJECT_TWO_FINGER_TOUCH_EVENT), p += 1, D.setUint8(p, t), p += 1, D.setInt32(p, Math.round(o), !0), p += 4, D.setInt32(p, Math.round(u), !0), p += 4, D.setInt32(p, Math.round(l), !0), p += 4, D.setInt32(p, Math.round(i), !0), p += 4, D.setUint16(p, e, !0), p += 2, D.setUint16(p, r, !0), p += 2, D.setUint16(p, 0, !0), h;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function ir(t, e = !0) {
|
|
499
499
|
const o = new TextEncoder().encode(t), u = new ArrayBuffer(14 + o.length), l = new DataView(u);
|
|
500
500
|
let i = 0;
|
|
501
501
|
return l.setUint8(i, ee.SET_CLIPBOARD), i += 1, l.setBigInt64(i, BigInt(0), !1), i += 8, l.setUint8(i, e ? 1 : 0), i += 1, l.setUint32(i, o.length, !1), i += 4, new Uint8Array(u, i).set(o), u;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function ct(t, e, r = 0, o = 0) {
|
|
504
504
|
const u = new ArrayBuffer(14), l = new DataView(u);
|
|
505
505
|
let i = 0;
|
|
506
506
|
return l.setUint8(i, ee.INJECT_KEYCODE), i += 1, l.setUint8(i, t), i += 1, l.setInt32(i, e, !0), i += 4, l.setInt32(i, r, !0), i += 4, l.setInt32(i, o, !0), u;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
const i = new ArrayBuffer(18),
|
|
510
|
-
return
|
|
508
|
+
function Xr(t, e, r, o, u, l) {
|
|
509
|
+
const i = new ArrayBuffer(18), h = new DataView(i);
|
|
510
|
+
return h.setUint8(0, ee.INJECT_MOUSE_EVENT), h.setUint8(1, t), h.setInt32(2, Math.round(o), !0), h.setInt32(6, Math.round(u), !0), h.setUint16(10, e, !0), h.setUint16(12, r, !0), h.setInt32(14, l, !0), i;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function or(t, e) {
|
|
513
513
|
const r = new ArrayBuffer(4), o = new DataView(r);
|
|
514
514
|
return o.setUint8(0, ee.INJECT_MAC_KEY), o.setUint8(1, t), o.setUint16(2, e, !0), r;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
const i = new ArrayBuffer(21),
|
|
518
|
-
return
|
|
516
|
+
function Qr(t, e, r, o, u, l) {
|
|
517
|
+
const i = new ArrayBuffer(21), h = new DataView(i);
|
|
518
|
+
return h.setUint8(0, ee.INJECT_MAC_SCROLL), h.setInt32(1, Math.round(r), !0), h.setInt32(5, Math.round(o), !0), h.setUint16(9, t, !0), h.setUint16(11, e, !0), h.setFloat32(13, u, !0), h.setFloat32(17, l, !0), i;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function zr(t) {
|
|
521
521
|
return t?.displays.find((e) => e.id === (t.angleDegrees < 90 ? "outer" : "inner"));
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function ar(t) {
|
|
524
524
|
return t === 2 ? 2 : t === 3 ? 1 : t === 4 ? 3 : 0;
|
|
525
525
|
}
|
|
526
|
-
class
|
|
526
|
+
class Zr {
|
|
527
527
|
constructor(e) {
|
|
528
528
|
this.send = e;
|
|
529
529
|
}
|
|
@@ -534,13 +534,13 @@ class en {
|
|
|
534
534
|
get active() {
|
|
535
535
|
return this.held !== void 0;
|
|
536
536
|
}
|
|
537
|
-
setDisplay(e, r =
|
|
537
|
+
setDisplay(e, r = ar(e?.orientation)) {
|
|
538
538
|
(this.screenId !== e?.screenId || this.turns !== r) && this.release(), this.screenId = e?.screenId, this.turns = r;
|
|
539
539
|
}
|
|
540
540
|
/** Coordinates are normalized; native input already accounts for the viewer's rotation. */
|
|
541
541
|
touch(e, r, o, u = !1) {
|
|
542
542
|
if (this.screenId === void 0) return;
|
|
543
|
-
const l =
|
|
543
|
+
const l = sr(r, o, u ? 0 : this.turns);
|
|
544
544
|
e === "begin" && (this.release(), this.held = { screenId: this.screenId, ...l }), this.held && (Object.assign(this.held, l), e === "end" ? this.release() : this.send(e === "begin" ? 0 : 2, this.held.screenId, l.x, l.y));
|
|
545
545
|
}
|
|
546
546
|
/** Call on pointer cancellation, lost capture, disconnect, and viewer disposal. */
|
|
@@ -550,26 +550,26 @@ class en {
|
|
|
550
550
|
this.held = void 0, this.send(1, e, r, o);
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
const
|
|
554
|
-
function
|
|
553
|
+
const en = { width: 164.6, height: 117.8, depth: 5.2 };
|
|
554
|
+
function sr(t, e, r) {
|
|
555
555
|
return t = Math.max(0, Math.min(1, t)), e = Math.max(0, Math.min(1, e)), r === 1 ? { x: e, y: 1 - t } : r === 2 ? { x: 1 - t, y: 1 - e } : r === 3 ? { x: 1 - e, y: t } : { x: t, y: e };
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function cr(t) {
|
|
558
558
|
return Number.isFinite(t) && t >= 0 && t <= 180;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function tn(t, e) {
|
|
561
561
|
return { x: Math.max(0, Math.min(1, t)), y: Math.max(0, Math.min(1, 1 - e)) };
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function rn(t, e, r) {
|
|
564
564
|
return e && (t || !r) ? "touch" : t ? "ignore" : "orbit";
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function lr(t, e, r, o) {
|
|
567
567
|
if (!Number.isInteger(t) || t < 0 || t > 3 || !Number.isInteger(e) || e < 1 || e > 255 || !Number.isFinite(r) || !Number.isFinite(o) || r < 0 || r > 1 || o < 0 || o > 1)
|
|
568
568
|
throw new RangeError("Invalid display touch coordinates");
|
|
569
569
|
const u = new ArrayBuffer(12), l = new DataView(u);
|
|
570
570
|
return l.setUint8(0, 19), l.setUint8(1, t), l.setUint8(2, e), l.setFloat32(4, r, !0), l.setFloat32(8, o, !0), u;
|
|
571
571
|
}
|
|
572
|
-
class
|
|
572
|
+
class nn {
|
|
573
573
|
constructor(e, r) {
|
|
574
574
|
this.send = e, this.failed = r;
|
|
575
575
|
}
|
|
@@ -579,7 +579,7 @@ class on {
|
|
|
579
579
|
running = !1;
|
|
580
580
|
stopped = !1;
|
|
581
581
|
set(e) {
|
|
582
|
-
this.stopped || !
|
|
582
|
+
this.stopped || !cr(e) || (this.latest = e, this.flush());
|
|
583
583
|
}
|
|
584
584
|
stop() {
|
|
585
585
|
this.stopped = !0, this.latest = void 0;
|
|
@@ -600,12 +600,12 @@ class on {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
const
|
|
603
|
+
const on = {
|
|
604
604
|
side: "Sleep/Wake",
|
|
605
605
|
volumeUp: "Volume Up",
|
|
606
606
|
volumeDown: "Volume Down"
|
|
607
607
|
};
|
|
608
|
-
class
|
|
608
|
+
class an {
|
|
609
609
|
constructor(e, r) {
|
|
610
610
|
this.send = e, this.failed = r;
|
|
611
611
|
}
|
|
@@ -627,25 +627,25 @@ class sn {
|
|
|
627
627
|
this.tail = this.tail.then(() => this.send(e, r)).catch(this.failed);
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
const
|
|
630
|
+
const lt = "Accessibility unavailable on this device.", Ze = 500, Ut = (t, e) => Math.abs(t.x - e.x) < 0.5 && Math.abs(t.y - e.y) < 0.5 && Math.abs(t.width - e.width) < 0.5 && Math.abs(t.height - e.height) < 0.5, dr = (t) => Math.max(0, t.width) * Math.max(0, t.height), ur = (t) => {
|
|
631
631
|
const e = t.find((r) => r.frame && r.frame.width > 0 && r.frame.height > 0);
|
|
632
632
|
return e?.frame ? ((Math.abs(e.frame.x) > 0.5 || Math.abs(e.frame.y) > 0.5) && console.warn(
|
|
633
633
|
`[ax-tree] iOS root frame is not anchored at (0,0): (${e.frame.x},${e.frame.y}). Element positions may be slightly off from the rendered video.`
|
|
634
634
|
), { x: 0, y: 0, width: e.frame.width, height: e.frame.height }) : { x: 0, y: 0, width: 1, height: 1 };
|
|
635
|
-
},
|
|
635
|
+
}, fr = (t) => {
|
|
636
636
|
const e = {};
|
|
637
637
|
return typeof t.AXUniqueId == "string" && t.AXUniqueId.length > 0 && (e.AXUniqueId = t.AXUniqueId), typeof t.AXLabel == "string" && t.AXLabel.length > 0 && (e.AXLabel = t.AXLabel), typeof t.type == "string" && t.type.length > 0 && (e.className = t.type), e;
|
|
638
|
-
},
|
|
638
|
+
}, Er = (t) => {
|
|
639
639
|
const e = {};
|
|
640
640
|
for (const [r, o] of Object.entries(t))
|
|
641
641
|
r !== "children" && (e[r] = o);
|
|
642
642
|
return e;
|
|
643
643
|
};
|
|
644
|
-
function
|
|
645
|
-
const e = Array.isArray(t) ? t : [t], r =
|
|
644
|
+
function hr(t) {
|
|
645
|
+
const e = Array.isArray(t) ? t : [t], r = ur(e), o = [], u = (l, i) => {
|
|
646
646
|
if (o.length >= Ze) return;
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
647
|
+
const h = l.frame;
|
|
648
|
+
if (h && h.width > 0 && h.height > 0 && !Ut(h, r)) {
|
|
649
649
|
const p = l.role_description || l.role || "", S = (typeof l.AXLabel == "string" ? l.AXLabel : "") || (typeof l.title == "string" ? l.title : "") || "";
|
|
650
650
|
o.push({
|
|
651
651
|
id: typeof l.AXUniqueId == "string" && l.AXUniqueId.length > 0 ? l.AXUniqueId : i,
|
|
@@ -656,9 +656,9 @@ function pr(t) {
|
|
|
656
656
|
type: typeof l.type == "string" ? l.type : "",
|
|
657
657
|
enabled: l.enabled !== !1,
|
|
658
658
|
focused: l.focused === !0,
|
|
659
|
-
frame: { x:
|
|
660
|
-
selectors:
|
|
661
|
-
raw:
|
|
659
|
+
frame: { x: h.x, y: h.y, width: h.width, height: h.height },
|
|
660
|
+
selectors: fr(l),
|
|
661
|
+
raw: Er(l)
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
664
|
const D = Array.isArray(l.children) ? l.children : [];
|
|
@@ -674,28 +674,28 @@ function pr(t) {
|
|
|
674
674
|
capturedAt: Date.now()
|
|
675
675
|
};
|
|
676
676
|
}
|
|
677
|
-
const
|
|
677
|
+
const pr = (t) => {
|
|
678
678
|
let e = { x: 0, y: 0, width: 1, height: 1 }, r = 0;
|
|
679
679
|
for (const o of t) {
|
|
680
680
|
const u = o.parsedBounds;
|
|
681
681
|
if (!u) continue;
|
|
682
|
-
const l = u.right - u.left, i = u.bottom - u.top,
|
|
683
|
-
|
|
682
|
+
const l = u.right - u.left, i = u.bottom - u.top, h = Math.max(0, l) * Math.max(0, i);
|
|
683
|
+
h > r && (r = h, e = { x: 0, y: 0, width: l, height: i });
|
|
684
684
|
}
|
|
685
685
|
return e;
|
|
686
|
-
},
|
|
686
|
+
}, mr = (t) => {
|
|
687
687
|
const e = {};
|
|
688
688
|
return typeof t.resourceId == "string" && t.resourceId.length > 0 && (e.resourceId = t.resourceId), typeof t.contentDesc == "string" && t.contentDesc.length > 0 && (e.contentDesc = t.contentDesc), typeof t.text == "string" && t.text.length > 0 && (e.text = t.text), typeof t.className == "string" && t.className.length > 0 && (e.className = t.className), e;
|
|
689
689
|
};
|
|
690
|
-
function
|
|
691
|
-
const e =
|
|
690
|
+
function Cr(t) {
|
|
691
|
+
const e = pr(t), r = [];
|
|
692
692
|
for (let o = 0; o < t.length && r.length < Ze; o++) {
|
|
693
693
|
const u = t[o], l = u.parsedBounds;
|
|
694
694
|
if (!l) continue;
|
|
695
|
-
const i = Math.max(0, l.right - l.left),
|
|
696
|
-
if (i <= 0 ||
|
|
697
|
-
const D = { x: l.left, y: l.top, width: i, height:
|
|
698
|
-
if (
|
|
695
|
+
const i = Math.max(0, l.right - l.left), h = Math.max(0, l.bottom - l.top);
|
|
696
|
+
if (i <= 0 || h <= 0) continue;
|
|
697
|
+
const D = { x: l.left, y: l.top, width: i, height: h };
|
|
698
|
+
if (Ut(D, { x: 0, y: 0, width: e.width, height: e.height })) continue;
|
|
699
699
|
const p = u.contentDesc || u.text || "", S = u.className || "";
|
|
700
700
|
r.push({
|
|
701
701
|
id: u.resourceId && u.resourceId.length > 0 ? u.resourceId : u.contentDesc && u.contentDesc.length > 0 ? `cd:${u.contentDesc}` : String(o),
|
|
@@ -707,7 +707,7 @@ function Or(t) {
|
|
|
707
707
|
enabled: u.enabled !== !1,
|
|
708
708
|
focused: u.focused === !0,
|
|
709
709
|
frame: D,
|
|
710
|
-
selectors:
|
|
710
|
+
selectors: mr(u),
|
|
711
711
|
raw: { ...u }
|
|
712
712
|
});
|
|
713
713
|
}
|
|
@@ -718,34 +718,34 @@ function Or(t) {
|
|
|
718
718
|
capturedAt: Date.now()
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
const r = Math.max(0, t.x), o = Math.max(0, t.y), u = Math.min(e.width, t.x + t.width), l = Math.min(e.height, t.y + t.height), i = Math.max(0, u - r),
|
|
723
|
-
return i > 0 &&
|
|
721
|
+
function sn(t, e) {
|
|
722
|
+
const r = Math.max(0, t.x), o = Math.max(0, t.y), u = Math.min(e.width, t.x + t.width), l = Math.min(e.height, t.y + t.height), i = Math.max(0, u - r), h = Math.max(0, l - o);
|
|
723
|
+
return i > 0 && h > 0 ? { x: r, y: o, width: i, height: h } : null;
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Or(t, e) {
|
|
726
726
|
if (t === e) return !0;
|
|
727
727
|
if (t.id !== e.id || t.path !== e.path || t.label !== e.label || t.value !== e.value || t.role !== e.role || t.type !== e.type || t.enabled !== e.enabled || t.focused !== e.focused) return !1;
|
|
728
728
|
const r = t.frame, o = e.frame;
|
|
729
729
|
return r.x === o.x && r.y === o.y && r.width === o.width && r.height === o.height;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function Dr(t, e) {
|
|
732
732
|
if (t === e) return !0;
|
|
733
733
|
if (!t || !e || t.platform !== e.platform || t.screen.width !== e.screen.width || t.screen.height !== e.screen.height || t.elements.length !== e.elements.length) return !1;
|
|
734
734
|
for (let r = 0; r < t.elements.length; r++)
|
|
735
|
-
if (!
|
|
735
|
+
if (!Or(t.elements[r], e.elements[r])) return !1;
|
|
736
736
|
return !0;
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function cn(t, e, r) {
|
|
739
739
|
let o = null, u = 1 / 0;
|
|
740
740
|
for (const l of t.elements) {
|
|
741
741
|
const i = l.frame;
|
|
742
742
|
if (e < i.x || r < i.y || e > i.x + i.width || r > i.y + i.height) continue;
|
|
743
|
-
const
|
|
744
|
-
|
|
743
|
+
const h = dr(i);
|
|
744
|
+
h < u && (u = h, o = l);
|
|
745
745
|
}
|
|
746
746
|
return o;
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function ln(t, e) {
|
|
749
749
|
if (e === "ios") {
|
|
750
750
|
if (t.selectors.AXUniqueId)
|
|
751
751
|
return `client.tapElement({ AXUniqueId: ${JSON.stringify(t.selectors.AXUniqueId)} })`;
|
|
@@ -757,21 +757,21 @@ function dn(t, e) {
|
|
|
757
757
|
}
|
|
758
758
|
return t.selectors.resourceId ? `client.tap({ selector: { resourceId: ${JSON.stringify(t.selectors.resourceId)} } })` : t.selectors.contentDesc ? `client.tap({ selector: { contentDesc: ${JSON.stringify(t.selectors.contentDesc)} } })` : t.selectors.text ? `client.tap({ selector: { text: ${JSON.stringify(t.selectors.text)} } })` : null;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function _r(t) {
|
|
761
761
|
const e = t.role || t.type || "";
|
|
762
762
|
if (!e) return "element";
|
|
763
763
|
let r = e.replace(/^AX/, "");
|
|
764
764
|
return r.includes(".") && (r = r.split(".").pop()), r === "GenericElement" ? "Element" : (r = r.replace(/([a-z])([A-Z])/g, "$1 $2"), r);
|
|
765
765
|
}
|
|
766
|
-
const
|
|
767
|
-
function
|
|
768
|
-
const e =
|
|
766
|
+
const wt = 80;
|
|
767
|
+
function dn(t) {
|
|
768
|
+
const e = _r(t), r = t.label || t.value || "";
|
|
769
769
|
if (!r) return e;
|
|
770
|
-
const o = r.length >
|
|
770
|
+
const o = r.length > wt ? r.slice(0, wt).trimEnd() + "…" : r;
|
|
771
771
|
return `${e} · ${o}`;
|
|
772
772
|
}
|
|
773
|
-
const
|
|
774
|
-
class
|
|
773
|
+
const gr = 500, Tr = 2e3, Nt = 5e3, yr = 8e3, Sr = 1200, Kr = 250, Ar = () => `ax-rc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
774
|
+
class vr {
|
|
775
775
|
platform;
|
|
776
776
|
send;
|
|
777
777
|
onSnapshot;
|
|
@@ -798,7 +798,7 @@ class Mr {
|
|
|
798
798
|
// identical-to-current transitions are no-ops.
|
|
799
799
|
status = "idle";
|
|
800
800
|
constructor(e) {
|
|
801
|
-
this.platform = e.platform, this.send = e.send, this.onSnapshot = e.onSnapshot, this.onStatusChange = e.onStatusChange, this.baseIntervalMs = e.baseIntervalMs ??
|
|
801
|
+
this.platform = e.platform, this.send = e.send, this.onSnapshot = e.onSnapshot, this.onStatusChange = e.onStatusChange, this.baseIntervalMs = e.baseIntervalMs ?? gr, this.maxBackoffMs = e.maxBackoffMs ?? Tr, this.androidElementTreeOptions = e.androidElementTreeOptions, this.currentInterval = this.baseIntervalMs;
|
|
802
802
|
}
|
|
803
803
|
start() {
|
|
804
804
|
this.running || (this.running = !0, this.currentInterval = this.baseIntervalMs, this.boostUntilMs = 0, this.setStatus("starting"), this.runOnce());
|
|
@@ -830,7 +830,7 @@ class Mr {
|
|
|
830
830
|
bumpActivity() {
|
|
831
831
|
if (!this.running) return;
|
|
832
832
|
const e = Date.now();
|
|
833
|
-
this.boostUntilMs = e +
|
|
833
|
+
this.boostUntilMs = e + Sr;
|
|
834
834
|
const r = Math.max(150, Math.floor(this.baseIntervalMs / 2));
|
|
835
835
|
if (e - this.lastBumpAtMs < r) {
|
|
836
836
|
this.currentInterval = this.baseIntervalMs;
|
|
@@ -862,12 +862,12 @@ class Mr {
|
|
|
862
862
|
if (!this.pending.get(r)) return !1;
|
|
863
863
|
if (this.platform === "ios") {
|
|
864
864
|
if (e.type !== "elementTreeResult") return !1;
|
|
865
|
-
const
|
|
866
|
-
if (
|
|
867
|
-
return this.settleReject(r, new Error(
|
|
865
|
+
const h = typeof e.error == "string" ? e.error : null;
|
|
866
|
+
if (h)
|
|
867
|
+
return this.settleReject(r, new Error(h)), !0;
|
|
868
868
|
const D = typeof e.json == "string" ? e.json : "";
|
|
869
869
|
try {
|
|
870
|
-
const p = JSON.parse(D), S =
|
|
870
|
+
const p = JSON.parse(D), S = hr(p);
|
|
871
871
|
this.settleResolve(r, S);
|
|
872
872
|
} catch (p) {
|
|
873
873
|
this.settleReject(r, p instanceof Error ? p : new Error(String(p)));
|
|
@@ -877,15 +877,15 @@ class Mr {
|
|
|
877
877
|
if (e.type !== "getElementTreeResult") return !1;
|
|
878
878
|
const u = e.error;
|
|
879
879
|
if (u && typeof u == "object") {
|
|
880
|
-
const
|
|
881
|
-
return this.settleReject(r, new Error(
|
|
880
|
+
const h = typeof u.message == "string" ? u.message : "getElementTree failed";
|
|
881
|
+
return this.settleReject(r, new Error(h)), !0;
|
|
882
882
|
}
|
|
883
883
|
const l = e.payload, i = Array.isArray(l?.nodes) ? l.nodes : [];
|
|
884
884
|
try {
|
|
885
|
-
const
|
|
886
|
-
this.settleResolve(r,
|
|
887
|
-
} catch (
|
|
888
|
-
this.settleReject(r,
|
|
885
|
+
const h = Cr(i);
|
|
886
|
+
this.settleResolve(r, h);
|
|
887
|
+
} catch (h) {
|
|
888
|
+
this.settleReject(r, h instanceof Error ? h : new Error(String(h)));
|
|
889
889
|
}
|
|
890
890
|
return !0;
|
|
891
891
|
}
|
|
@@ -893,13 +893,13 @@ class Mr {
|
|
|
893
893
|
return this.platform === "ios" ? { type: "elementTree", id: e } : { type: "getElementTree", id: e, ...this.androidElementTreeOptions };
|
|
894
894
|
}
|
|
895
895
|
async requestOnce() {
|
|
896
|
-
const e =
|
|
896
|
+
const e = Ar();
|
|
897
897
|
return new Promise((r, o) => {
|
|
898
898
|
const u = window.setTimeout(
|
|
899
899
|
() => {
|
|
900
900
|
this.pending.delete(e), o(new Error("elementTree request timed out"));
|
|
901
901
|
},
|
|
902
|
-
|
|
902
|
+
yr + (this.androidElementTreeOptions?.waitForIdleTimeoutMs ?? 0)
|
|
903
903
|
);
|
|
904
904
|
this.pending.set(e, { resolve: r, reject: o, timer: u }), this.send(this.buildRequest(e)) || (window.clearTimeout(u), this.pending.delete(e), o(new Error("elementTree send failed (WebSocket not open)")));
|
|
905
905
|
});
|
|
@@ -914,7 +914,7 @@ class Mr {
|
|
|
914
914
|
} catch (e) {
|
|
915
915
|
if (!this.running) return;
|
|
916
916
|
const r = e instanceof Error ? e.message : String(e), o = /unavailable|not (yet )?running|failed|timeout/i.test(r);
|
|
917
|
-
this.currentInterval = o ?
|
|
917
|
+
this.currentInterval = o ? Nt : Math.min(this.currentInterval * 2, this.maxBackoffMs), this.setStatus(o ? "unavailable" : "error", r);
|
|
918
918
|
} finally {
|
|
919
919
|
this.inflight = !1, this.scheduleNext();
|
|
920
920
|
}
|
|
@@ -922,16 +922,16 @@ class Mr {
|
|
|
922
922
|
}
|
|
923
923
|
deliver(e) {
|
|
924
924
|
const r = this.lastSnapshot;
|
|
925
|
-
if (
|
|
926
|
-
this.currentInterval = Math.min(this.currentInterval * 2, this.maxBackoffMs), this.lastSnapshot = e, e.errors?.includes(
|
|
925
|
+
if (Dr(r, e)) {
|
|
926
|
+
this.currentInterval = Math.min(this.currentInterval * 2, this.maxBackoffMs), this.lastSnapshot = e, e.errors?.includes(lt) || this.setStatus("ready");
|
|
927
927
|
return;
|
|
928
928
|
}
|
|
929
|
-
this.lastSnapshot = e, this.currentInterval = this.baseIntervalMs, e.errors?.includes(
|
|
929
|
+
this.lastSnapshot = e, this.currentInterval = this.baseIntervalMs, e.errors?.includes(lt) ? (this.currentInterval = Nt, this.setStatus("unavailable", lt)) : this.setStatus("ready"), this.onSnapshot(e);
|
|
930
930
|
}
|
|
931
931
|
scheduleNext() {
|
|
932
932
|
if (!this.running) return;
|
|
933
933
|
this.timer !== void 0 && window.clearTimeout(this.timer);
|
|
934
|
-
const e = Date.now() < this.boostUntilMs ? Math.min(
|
|
934
|
+
const e = Date.now() < this.boostUntilMs ? Math.min(Kr, this.currentInterval) : this.currentInterval;
|
|
935
935
|
this.timer = window.setTimeout(() => {
|
|
936
936
|
this.timer = void 0, this.runOnce();
|
|
937
937
|
}, e);
|
|
@@ -949,7 +949,7 @@ class Mr {
|
|
|
949
949
|
window.clearTimeout(o.timer), o.reject(new Error(e)), this.pending.delete(r);
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function bt(t, e) {
|
|
953
953
|
if (e != null && (!Number.isFinite(e) || e < 0 || e > 4e3)) {
|
|
954
954
|
console.warn("RemoteControl: jitterBufferTargetMs must be a finite number between 0 and 4000.");
|
|
955
955
|
return;
|
|
@@ -962,12 +962,12 @@ function Yt(t, e) {
|
|
|
962
962
|
console.warn("RemoteControl: could not set the jitter buffer target.", o);
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
const
|
|
966
|
-
`,
|
|
967
|
-
function
|
|
965
|
+
const Pt = `(function(){"use strict";let e,t;self.onmessage=async({data:s})=>{s.type==="start"?(e=new AbortController,t=s.readable.pipeTo(s.writable,{signal:e.signal}).catch(o=>{e?.signal.aborted||self.postMessage({type:"error",message:String(o)})})):s.type==="stop"&&(e?.abort(),await t,self.postMessage({type:"stopped"}),self.close())}})();
|
|
966
|
+
`, Yt = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Pt], { type: "text/javascript;charset=utf-8" });
|
|
967
|
+
function Mr(t) {
|
|
968
968
|
let e;
|
|
969
969
|
try {
|
|
970
|
-
if (e =
|
|
970
|
+
if (e = Yt && (self.URL || self.webkitURL).createObjectURL(Yt), !e) throw "";
|
|
971
971
|
const r = new Worker(e, {
|
|
972
972
|
name: t?.name
|
|
973
973
|
});
|
|
@@ -976,18 +976,18 @@ function wr(t) {
|
|
|
976
976
|
}), r;
|
|
977
977
|
} catch {
|
|
978
978
|
return new Worker(
|
|
979
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
979
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(Pt),
|
|
980
980
|
{
|
|
981
981
|
name: t?.name
|
|
982
982
|
}
|
|
983
983
|
);
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
function
|
|
986
|
+
function wr(t, e, r) {
|
|
987
987
|
const { MediaStreamTrackProcessor: o, MediaStreamTrackGenerator: u } = globalThis, l = e.getVideoTracks()[0];
|
|
988
|
-
let i,
|
|
988
|
+
let i, h, D, p, S = !1;
|
|
989
989
|
const w = () => {
|
|
990
|
-
S || (S = !0, i?.stop(),
|
|
990
|
+
S || (S = !0, i?.stop(), h?.stop(), D && (D.postMessage({ type: "stop" }), p = setTimeout(() => D?.terminate(), 1e3)));
|
|
991
991
|
}, N = (_) => {
|
|
992
992
|
t.srcObject = _, t.play().catch(() => {
|
|
993
993
|
});
|
|
@@ -998,7 +998,7 @@ function Nr(t, e, r) {
|
|
|
998
998
|
if (l && o && u) {
|
|
999
999
|
i = l.clone();
|
|
1000
1000
|
const _ = new o({ track: i, maxBufferSize: 1 }), H = new u({ kind: "video" });
|
|
1001
|
-
|
|
1001
|
+
h = H, D = new Mr(), D.onmessage = ({ data: L }) => {
|
|
1002
1002
|
L.type === "error" ? V(new Error(L.message)) : L.type === "stopped" && (clearTimeout(p), D?.terminate());
|
|
1003
1003
|
}, D.onerror = (L) => V(new Error(L.message)), D.postMessage({ type: "start", readable: _.readable, writable: H.writable }, [
|
|
1004
1004
|
_.readable,
|
|
@@ -1018,7 +1018,7 @@ function Se(t, e) {
|
|
|
1018
1018
|
if (!(!Pe(t) || !Pe(e) || t < e || e < 0))
|
|
1019
1019
|
return t - e;
|
|
1020
1020
|
}
|
|
1021
|
-
class
|
|
1021
|
+
class Nr {
|
|
1022
1022
|
previous = /* @__PURE__ */ new Map();
|
|
1023
1023
|
reset() {
|
|
1024
1024
|
this.previous.clear();
|
|
@@ -1029,9 +1029,9 @@ class br {
|
|
|
1029
1029
|
const l = /* @__PURE__ */ new Map();
|
|
1030
1030
|
return e.forEach((i) => {
|
|
1031
1031
|
if (i.type !== "inbound-rtp" || !Pe(i.timestamp)) return;
|
|
1032
|
-
const
|
|
1033
|
-
if (
|
|
1034
|
-
const D = r.filter((P) => P.kind ===
|
|
1032
|
+
const h = i.kind ?? i.mediaType;
|
|
1033
|
+
if (h !== "video" && h !== "audio") return;
|
|
1034
|
+
const D = r.filter((P) => P.kind === h), p = i.trackIdentifier ? D.find((P) => P.trackId === i.trackIdentifier) : i.mid != null ? D.find((P) => P.mid === i.mid) : D.length === 1 ? D[0] : void 0;
|
|
1035
1035
|
if (!p) return;
|
|
1036
1036
|
const S = this.previous.get(i.id), N = S?.trackId === p.trackId && S.stats.ssrc === i.ssrc ? S.stats : void 0, V = N ? i.timestamp - N.timestamp : void 0, _ = {
|
|
1037
1037
|
id: i.id,
|
|
@@ -1045,7 +1045,7 @@ class br {
|
|
|
1045
1045
|
const x = Se(i.bytesReceived, N?.bytesReceived);
|
|
1046
1046
|
x !== void 0 && (_.bitrateBps = x * 8e3 / V);
|
|
1047
1047
|
}
|
|
1048
|
-
if (
|
|
1048
|
+
if (h === "video") {
|
|
1049
1049
|
const P = { ..._, display: p.display ?? "primary" };
|
|
1050
1050
|
if (_.intervalMs !== void 0) {
|
|
1051
1051
|
const B = Se(i.framesDecoded, N?.framesDecoded);
|
|
@@ -1062,11 +1062,11 @@ class br {
|
|
|
1062
1062
|
}), this.previous = l, u.video.length || u.audio.length ? u : null;
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
|
-
const
|
|
1066
|
-
function
|
|
1067
|
-
const { peer: o, displays: u } = t, l = new
|
|
1068
|
-
let i,
|
|
1069
|
-
const V = () => !
|
|
1065
|
+
const dt = /* @__PURE__ */ new WeakSet();
|
|
1066
|
+
function br(t, e, r) {
|
|
1067
|
+
const { peer: o, displays: u } = t, l = new Nr();
|
|
1068
|
+
let i, h = !1, D = !1, p = !1, S = 0, w = !1, N = !1;
|
|
1069
|
+
const V = () => !h && !document.hidden && o.connectionState === "connected", _ = (B) => {
|
|
1070
1070
|
if (!(!B && !w)) {
|
|
1071
1071
|
w = B !== null;
|
|
1072
1072
|
try {
|
|
@@ -1079,13 +1079,13 @@ function Yr(t, e, r) {
|
|
|
1079
1079
|
D = !1, S++, clearTimeout(i), l.reset(), _(null);
|
|
1080
1080
|
}, L = async () => {
|
|
1081
1081
|
if (p || !V()) return;
|
|
1082
|
-
if (
|
|
1082
|
+
if (dt.has(o)) {
|
|
1083
1083
|
i = setTimeout(() => {
|
|
1084
1084
|
L();
|
|
1085
1085
|
}, 2e3);
|
|
1086
1086
|
return;
|
|
1087
1087
|
}
|
|
1088
|
-
p = !0,
|
|
1088
|
+
p = !0, dt.add(o);
|
|
1089
1089
|
const B = S;
|
|
1090
1090
|
try {
|
|
1091
1091
|
const x = await o.getStats();
|
|
@@ -1103,7 +1103,7 @@ function Yr(t, e, r) {
|
|
|
1103
1103
|
if (B !== S || !V()) return;
|
|
1104
1104
|
N || console.warn("[RemoteControl] could not read playback stats:", x), N = !0, l.reset(), _(null);
|
|
1105
1105
|
} finally {
|
|
1106
|
-
p = !1,
|
|
1106
|
+
p = !1, dt.delete(o), D && V() && (i = setTimeout(
|
|
1107
1107
|
() => {
|
|
1108
1108
|
L();
|
|
1109
1109
|
},
|
|
@@ -1118,10 +1118,10 @@ function Yr(t, e, r) {
|
|
|
1118
1118
|
D || (D = !0, L());
|
|
1119
1119
|
};
|
|
1120
1120
|
return document.addEventListener("visibilitychange", P), o.addEventListener("connectionstatechange", P), P(), () => {
|
|
1121
|
-
|
|
1121
|
+
h = !0, document.removeEventListener("visibilitychange", P), o.removeEventListener("connectionstatechange", P), H();
|
|
1122
1122
|
};
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function Yr(t, e) {
|
|
1125
1125
|
const r = t.createDataChannel("latency-trace-v1", {
|
|
1126
1126
|
ordered: !0,
|
|
1127
1127
|
negotiated: !0,
|
|
@@ -1130,14 +1130,14 @@ function Ir(t, e) {
|
|
|
1130
1130
|
let o = !1, u = !1, l = 0;
|
|
1131
1131
|
return r.onmessage = (i) => {
|
|
1132
1132
|
if (u) return;
|
|
1133
|
-
let
|
|
1133
|
+
let h;
|
|
1134
1134
|
try {
|
|
1135
|
-
|
|
1135
|
+
h = JSON.parse(i.data);
|
|
1136
1136
|
} catch (D) {
|
|
1137
1137
|
console.warn("Invalid latency trace message", D);
|
|
1138
1138
|
return;
|
|
1139
1139
|
}
|
|
1140
|
-
|
|
1140
|
+
h && typeof h == "object" && !Array.isArray(h) && e(h);
|
|
1141
1141
|
}, r.onclose = () => {
|
|
1142
1142
|
u = !0, o = !1;
|
|
1143
1143
|
}, {
|
|
@@ -1146,7 +1146,7 @@ function Ir(t, e) {
|
|
|
1146
1146
|
},
|
|
1147
1147
|
wrap(i) {
|
|
1148
1148
|
if (!o || i.byteLength === 0) return i;
|
|
1149
|
-
const
|
|
1149
|
+
const h = new DataView(i), D = h.getUint8(0), p = D === ee.INJECT_MOUSE_EVENT || D === ee.INJECT_MAC_KEY || D === ee.INJECT_MAC_SCROLL, S = i.byteLength === 32 && D === ee.INJECT_TOUCH_EVENT && h.getUint8(1) <= 2;
|
|
1150
1150
|
if (!p && !S) return i;
|
|
1151
1151
|
const w = new ArrayBuffer(6 + i.byteLength), N = new DataView(w);
|
|
1152
1152
|
return N.setUint8(0, 240), N.setUint8(1, 1), N.setUint32(2, ++l, !0), new Uint8Array(w, 6).set(new Uint8Array(i)), w;
|
|
@@ -1156,7 +1156,7 @@ function Ir(t, e) {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
};
|
|
1158
1158
|
}
|
|
1159
|
-
class
|
|
1159
|
+
class Ir {
|
|
1160
1160
|
generation = 0;
|
|
1161
1161
|
tail = Promise.resolve();
|
|
1162
1162
|
get currentGeneration() {
|
|
@@ -1187,23 +1187,23 @@ class Rr {
|
|
|
1187
1187
|
++this.generation;
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1190
|
+
function Rr(t) {
|
|
1191
1191
|
if (!t || typeof t != "object") return null;
|
|
1192
1192
|
const e = t;
|
|
1193
1193
|
if (e.type !== "cameraRequest" || typeof e.active != "boolean") return null;
|
|
1194
1194
|
const r = { active: e.active };
|
|
1195
1195
|
return (e.facingMode === "user" || e.facingMode === "environment") && (r.facingMode = e.facingMode), r;
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function kr(t) {
|
|
1198
1198
|
const e = {
|
|
1199
1199
|
frameRate: { ideal: 30, max: 30 }
|
|
1200
1200
|
};
|
|
1201
1201
|
return t?.facingMode && (e.facingMode = { ideal: t.facingMode }), e;
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function Ur(t, e) {
|
|
1204
1204
|
return !t || t.facingMode !== e.facingMode;
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function Pr(t) {
|
|
1207
1207
|
const e = t.getSettings();
|
|
1208
1208
|
return {
|
|
1209
1209
|
width: e.width,
|
|
@@ -1214,20 +1214,20 @@ function Lr(t) {
|
|
|
1214
1214
|
facingMode: e.facingMode
|
|
1215
1215
|
};
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function Lr(t) {
|
|
1218
1218
|
return {
|
|
1219
1219
|
type: "cameraResult",
|
|
1220
1220
|
granted: !0,
|
|
1221
|
-
camera:
|
|
1221
|
+
camera: Pr(t)
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
const le = (...t) => {
|
|
1225
1225
|
window.debugRemoteControl && console.log(...t);
|
|
1226
1226
|
}, y = (...t) => {
|
|
1227
1227
|
window.debugRemoteControl && console.warn(...t);
|
|
1228
|
-
},
|
|
1228
|
+
}, It = ["click", "keydown"], et = /* @__PURE__ */ new WeakMap(), Fr = (t) => {
|
|
1229
1229
|
et.get(t)?.();
|
|
1230
|
-
},
|
|
1230
|
+
}, Lt = (t, e) => {
|
|
1231
1231
|
if (et.has(t)) {
|
|
1232
1232
|
Promise.resolve(t.play()).catch(() => {
|
|
1233
1233
|
});
|
|
@@ -1238,12 +1238,12 @@ const le = (...t) => {
|
|
|
1238
1238
|
t.muted = !0, Promise.resolve(t.play()).catch(() => {
|
|
1239
1239
|
});
|
|
1240
1240
|
const o = t.ownerDocument, u = () => {
|
|
1241
|
-
l(), t.muted = !1,
|
|
1241
|
+
l(), t.muted = !1, Lt(t, e);
|
|
1242
1242
|
}, l = () => {
|
|
1243
|
-
for (const i of
|
|
1243
|
+
for (const i of It) o.removeEventListener(i, u, !0);
|
|
1244
1244
|
et.delete(t);
|
|
1245
1245
|
};
|
|
1246
|
-
for (const i of
|
|
1246
|
+
for (const i of It) o.addEventListener(i, u, !0);
|
|
1247
1247
|
et.set(t, l), e();
|
|
1248
1248
|
});
|
|
1249
1249
|
}, F = (t, e, ...r) => {
|
|
@@ -1253,21 +1253,21 @@ const le = (...t) => {
|
|
|
1253
1253
|
} catch (o) {
|
|
1254
1254
|
console.error(`[RemoteControl] customer callback "${t}" threw:`, o);
|
|
1255
1255
|
}
|
|
1256
|
-
},
|
|
1256
|
+
}, Br = (t) => t.includes("/android_") ? "android" : t.includes("/macos_") ? "macos" : "ios", Rt = (t, e) => {
|
|
1257
1257
|
const r = new URL(t);
|
|
1258
1258
|
return r.searchParams.set("token", e), r.toString();
|
|
1259
|
-
},
|
|
1260
|
-
function
|
|
1259
|
+
}, ut = 3, xr = 1e3, Wr = 15e3, qr = 3e3, Vr = 4e3;
|
|
1260
|
+
function kt() {
|
|
1261
1261
|
const t = crypto.getRandomValues(new Uint8Array(16));
|
|
1262
1262
|
t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
1263
1263
|
const e = Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("");
|
|
1264
1264
|
return `${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}`;
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function un(t) {
|
|
1267
1267
|
let e = { ...t };
|
|
1268
1268
|
const { url: r, deviceModel: o } = e;
|
|
1269
1269
|
let u = e.token;
|
|
1270
|
-
const l = e.watchOnly ?? !1, i = e.sessionId ??
|
|
1270
|
+
const l = e.watchOnly ?? !1, i = e.sessionId ?? kt(), h = e.platform ?? Br(r ?? "");
|
|
1271
1271
|
let D = {
|
|
1272
1272
|
connection: "idle",
|
|
1273
1273
|
videoReady: !1,
|
|
@@ -1280,44 +1280,44 @@ function fn(t) {
|
|
|
1280
1280
|
}, S = (n) => p({ videoReady: n }), w = (n) => p({ duoState: n }), N = (n) => p({ duoError: n }), V = (n) => p({ duo: n }), _ = (n) => le(n);
|
|
1281
1281
|
let H = null, L;
|
|
1282
1282
|
const P = () => {
|
|
1283
|
-
L?.(), L = H && e.onPlaybackStats ?
|
|
1283
|
+
L?.(), L = H && e.onPlaybackStats ? br(
|
|
1284
1284
|
H,
|
|
1285
1285
|
() => e.onPlaybackStats,
|
|
1286
1286
|
() => e.jitterBufferTargetMs
|
|
1287
1287
|
) : void 0;
|
|
1288
1288
|
}, B = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), se = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map();
|
|
1289
1289
|
let Ee = !1;
|
|
1290
|
-
const Le = /* @__PURE__ */ new Map(),
|
|
1291
|
-
f.stop?.(), f.stop =
|
|
1290
|
+
const Le = /* @__PURE__ */ new Map(), ft = (n, f, c) => {
|
|
1291
|
+
f.stop?.(), f.stop = wr(n, c, (d) => y("Video playback fallback:", d));
|
|
1292
1292
|
}, Ke = /* @__PURE__ */ new Set();
|
|
1293
1293
|
let Ae = null;
|
|
1294
|
-
const
|
|
1295
|
-
n.srcObject = Ae, Ae &&
|
|
1296
|
-
},
|
|
1294
|
+
const Et = (n) => {
|
|
1295
|
+
n.srcObject = Ae, Ae && Lt(n, () => F("onSpeakerBlocked", e.onSpeakerBlocked));
|
|
1296
|
+
}, Ft = () => {
|
|
1297
1297
|
Le.clear(), Ae = null;
|
|
1298
1298
|
for (const n of Ke) n.srcObject = null;
|
|
1299
1299
|
for (const [n, f] of B)
|
|
1300
1300
|
f.clear?.(), f.stop?.(), f.stop = void 0, n.srcObject = null;
|
|
1301
1301
|
};
|
|
1302
1302
|
let he = !1, ve = !1, Fe = 0, g = null, pe = null;
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1303
|
+
const ht = () => {
|
|
1304
|
+
!pe || pe !== g || pe.readyState === WebSocket.OPEN && pe.send(
|
|
1305
1305
|
JSON.stringify({ type: "speakerAudio", sessionId: i, enabled: !(e.speakerMuted ?? !0) })
|
|
1306
1306
|
);
|
|
1307
1307
|
};
|
|
1308
1308
|
let R = null, W = null, Be = null, me, Me, we, xe, Ce, de = 0, We = 0, re = !1, ue = null, Q = null, fe;
|
|
1309
|
-
const tt = new
|
|
1310
|
-
let Ne = null, qe = null, rt = !l && (e.microphoneEnabled ?? !1), nt = !1, be = null, te = null, Ve = 0,
|
|
1309
|
+
const tt = new Ir();
|
|
1310
|
+
let Ne = null, qe = null, rt = !l && (e.microphoneEnabled ?? !1), nt = !1, be = null, te = null, Ve = 0, pt = Promise.resolve(), Oe = null, Ye = !1, ne = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Map(), $ = null, Ie = null, mt = 0;
|
|
1311
1311
|
const $e = (n) => {
|
|
1312
1312
|
if (n === null && Ie === null) return;
|
|
1313
1313
|
Ie = n;
|
|
1314
|
-
const f = ++
|
|
1314
|
+
const f = ++mt;
|
|
1315
1315
|
queueMicrotask(() => {
|
|
1316
|
-
f ===
|
|
1316
|
+
f === mt && F("onAxSnapshotChange", e.onAxSnapshotChange, n);
|
|
1317
1317
|
});
|
|
1318
1318
|
};
|
|
1319
1319
|
let De = null, _e = /* @__PURE__ */ new Map();
|
|
1320
|
-
const
|
|
1320
|
+
const Bt = (n, f) => new Promise((c, d) => {
|
|
1321
1321
|
if (l) {
|
|
1322
1322
|
d(new Error("Device is watch-only"));
|
|
1323
1323
|
return;
|
|
@@ -1327,7 +1327,7 @@ function fn(t) {
|
|
|
1327
1327
|
d(new Error("Simulator disconnected"));
|
|
1328
1328
|
return;
|
|
1329
1329
|
}
|
|
1330
|
-
const m =
|
|
1330
|
+
const m = kt(), C = setTimeout(() => {
|
|
1331
1331
|
_e.delete(m), d(new Error("Device control timed out"));
|
|
1332
1332
|
}, 5e3);
|
|
1333
1333
|
_e.set(m, { resolve: c, reject: d, timer: C }), K.send(JSON.stringify({ type: n, id: m, ...f }));
|
|
@@ -1335,15 +1335,15 @@ function fn(t) {
|
|
|
1335
1335
|
De !== n && (De = n, p({ connection: n }), F("onConnectionStateChange", e.onConnectionStateChange, n));
|
|
1336
1336
|
}, oe = (n) => {
|
|
1337
1337
|
l || !W || W.readyState !== "open" || (W.send(Be?.wrap(n) ?? n), $?.bumpActivity());
|
|
1338
|
-
},
|
|
1338
|
+
}, xt = () => {
|
|
1339
1339
|
g && g.readyState === WebSocket.OPEN && g.send(
|
|
1340
1340
|
JSON.stringify({
|
|
1341
1341
|
type: "keepAlive",
|
|
1342
1342
|
sessionId: i
|
|
1343
1343
|
})
|
|
1344
1344
|
);
|
|
1345
|
-
},
|
|
1346
|
-
me && window.clearInterval(me), me = window.setInterval(
|
|
1345
|
+
}, Ct = () => {
|
|
1346
|
+
me && window.clearInterval(me), me = window.setInterval(xt, 1e4);
|
|
1347
1347
|
}, Re = () => {
|
|
1348
1348
|
me && (window.clearInterval(me), me = void 0);
|
|
1349
1349
|
}, He = () => {
|
|
@@ -1354,7 +1354,7 @@ function fn(t) {
|
|
|
1354
1354
|
xe && (window.clearInterval(xe), xe = void 0);
|
|
1355
1355
|
}, Ue = () => {
|
|
1356
1356
|
Ce !== void 0 && (window.clearTimeout(Ce), Ce = void 0);
|
|
1357
|
-
},
|
|
1357
|
+
}, Wt = () => {
|
|
1358
1358
|
Ye || (Ye = !0, ke(), S(!0), ge("connected"));
|
|
1359
1359
|
}, J = (n) => {
|
|
1360
1360
|
for (const f of n.getTracks())
|
|
@@ -1363,22 +1363,22 @@ function fn(t) {
|
|
|
1363
1363
|
} catch (c) {
|
|
1364
1364
|
y("track.stop() failed:", c);
|
|
1365
1365
|
}
|
|
1366
|
-
},
|
|
1366
|
+
}, qt = () => {
|
|
1367
1367
|
const n = Q;
|
|
1368
1368
|
n && (Q = null, J(n));
|
|
1369
|
-
},
|
|
1370
|
-
const f =
|
|
1369
|
+
}, Ot = (n) => {
|
|
1370
|
+
const f = pt.then(n).catch((c) => {
|
|
1371
1371
|
y("microphone operation failed:", c);
|
|
1372
1372
|
});
|
|
1373
|
-
return
|
|
1374
|
-
}, it = () => rt || nt,
|
|
1373
|
+
return pt = f, f;
|
|
1374
|
+
}, it = () => rt || nt, Dt = (n) => {
|
|
1375
1375
|
const f = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1376
1376
|
Oe = f, n.send(JSON.stringify({ type: "microphoneStart", id: f }));
|
|
1377
|
-
}, ot = () =>
|
|
1378
|
-
const n = Ve, f = () => n === Ve && it(), c = (
|
|
1377
|
+
}, ot = () => Ot(() => Vt()), Vt = async () => {
|
|
1378
|
+
const n = Ve, f = () => n === Ve && it(), c = (E) => {
|
|
1379
1379
|
F("onMicrophoneStateChange", e.onMicrophoneStateChange, {
|
|
1380
1380
|
active: !1,
|
|
1381
|
-
error:
|
|
1381
|
+
error: E
|
|
1382
1382
|
});
|
|
1383
1383
|
};
|
|
1384
1384
|
if (!f()) return;
|
|
@@ -1393,8 +1393,8 @@ function fn(t) {
|
|
|
1393
1393
|
let m = null;
|
|
1394
1394
|
try {
|
|
1395
1395
|
m = await navigator.mediaDevices.getUserMedia({ audio: !0, video: !1 });
|
|
1396
|
-
} catch (
|
|
1397
|
-
console.warn("[RemoteControl] microphone getUserMedia denied/failed:",
|
|
1396
|
+
} catch (E) {
|
|
1397
|
+
console.warn("[RemoteControl] microphone getUserMedia denied/failed:", E);
|
|
1398
1398
|
}
|
|
1399
1399
|
if (!f()) {
|
|
1400
1400
|
m && J(m);
|
|
@@ -1411,26 +1411,26 @@ function fn(t) {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
try {
|
|
1413
1413
|
await K.replaceTrack(C);
|
|
1414
|
-
} catch (
|
|
1415
|
-
y("replaceTrack(audioTrack) failed:",
|
|
1414
|
+
} catch (E) {
|
|
1415
|
+
y("replaceTrack(audioTrack) failed:", E), J(m), c("Failed to attach the microphone track to the connection");
|
|
1416
1416
|
return;
|
|
1417
1417
|
}
|
|
1418
1418
|
if (!f()) {
|
|
1419
1419
|
try {
|
|
1420
1420
|
await K.replaceTrack(null);
|
|
1421
|
-
} catch (
|
|
1422
|
-
y("replaceTrack(null) on stale mic attach failed:",
|
|
1421
|
+
} catch (E) {
|
|
1422
|
+
y("replaceTrack(null) on stale mic attach failed:", E);
|
|
1423
1423
|
}
|
|
1424
1424
|
J(m);
|
|
1425
1425
|
return;
|
|
1426
1426
|
}
|
|
1427
1427
|
te = m, C.onended = () => {
|
|
1428
1428
|
te === m && Ge("microphone capture ended by the browser");
|
|
1429
|
-
},
|
|
1429
|
+
}, Dt(d), F("onMicrophoneStateChange", e.onMicrophoneStateChange, {
|
|
1430
1430
|
active: !0,
|
|
1431
1431
|
label: C.label || void 0
|
|
1432
1432
|
});
|
|
1433
|
-
}, Ge = (n) => (++Ve, Oe = null,
|
|
1433
|
+
}, Ge = (n) => (++Ve, Oe = null, Ot(async () => {
|
|
1434
1434
|
const f = be, c = te;
|
|
1435
1435
|
if (te = null, f && c)
|
|
1436
1436
|
try {
|
|
@@ -1448,10 +1448,10 @@ function fn(t) {
|
|
|
1448
1448
|
active: !1,
|
|
1449
1449
|
...n !== void 0 && { error: n }
|
|
1450
1450
|
});
|
|
1451
|
-
})),
|
|
1451
|
+
})), _t = (n, f) => {
|
|
1452
1452
|
let c;
|
|
1453
1453
|
try {
|
|
1454
|
-
c =
|
|
1454
|
+
c = Lr(f), console.info(
|
|
1455
1455
|
`[RemoteControl] camera capture: ${c.camera?.width}x${c.camera?.height} @ ${c.camera?.frameRate ?? "?"}fps` + (c.camera?.label ? ` — ${c.camera.label}` : "")
|
|
1456
1456
|
);
|
|
1457
1457
|
} catch (d) {
|
|
@@ -1464,11 +1464,11 @@ function fn(t) {
|
|
|
1464
1464
|
};
|
|
1465
1465
|
}
|
|
1466
1466
|
n.send(JSON.stringify(c)), F("onCameraDemandChange", e.onCameraDemandChange, !0, !0, c.camera);
|
|
1467
|
-
},
|
|
1467
|
+
}, $t = (n) => {
|
|
1468
1468
|
if (!n) return;
|
|
1469
1469
|
const f = n.indexOf("/"), d = (f >= 0 ? n.slice(f + 1) : n).toUpperCase();
|
|
1470
1470
|
return d === "HEVC" ? "H265" : d;
|
|
1471
|
-
},
|
|
1471
|
+
}, Ht = async () => {
|
|
1472
1472
|
const n = ue, f = e.onCameraStats;
|
|
1473
1473
|
if (!n || !f) return;
|
|
1474
1474
|
let c;
|
|
@@ -1485,12 +1485,12 @@ function fn(t) {
|
|
|
1485
1485
|
U && (K = U.mimeType);
|
|
1486
1486
|
}
|
|
1487
1487
|
if (!d) return;
|
|
1488
|
-
const C = d.timestamp ?? Date.now(),
|
|
1488
|
+
const C = d.timestamp ?? Date.now(), E = qe;
|
|
1489
1489
|
let k, b, G;
|
|
1490
|
-
if (
|
|
1491
|
-
const U = (C -
|
|
1492
|
-
if (typeof d.framesEncoded == "number" && typeof
|
|
1493
|
-
const A = d.packetsSent -
|
|
1490
|
+
if (E && C > E.timestamp) {
|
|
1491
|
+
const U = (C - E.timestamp) / 1e3;
|
|
1492
|
+
if (typeof d.framesEncoded == "number" && typeof E.framesEncoded == "number" && (k = Math.max(0, (d.framesEncoded - E.framesEncoded) / U)), typeof d.bytesSent == "number" && typeof E.bytesSent == "number" && (b = Math.max(0, (d.bytesSent - E.bytesSent) * 8 / U)), typeof d.packetsSent == "number" && typeof E.packetsSent == "number" && m && typeof m.packetsLost == "number" && typeof E.packetsLost == "number") {
|
|
1493
|
+
const A = d.packetsSent - E.packetsSent, Xe = m.packetsLost - E.packetsLost;
|
|
1494
1494
|
A > 0 && (G = Math.max(0, Math.min(100, Xe / A * 100)));
|
|
1495
1495
|
}
|
|
1496
1496
|
}
|
|
@@ -1502,7 +1502,7 @@ function fn(t) {
|
|
|
1502
1502
|
packetsLost: m?.packetsLost
|
|
1503
1503
|
};
|
|
1504
1504
|
const M = {
|
|
1505
|
-
codec:
|
|
1505
|
+
codec: $t(K),
|
|
1506
1506
|
encoderImplementation: d.encoderImplementation,
|
|
1507
1507
|
hardwareAccelerated: typeof d.powerEfficientEncoder == "boolean" ? d.powerEfficientEncoder : void 0,
|
|
1508
1508
|
framesPerSecond: k,
|
|
@@ -1515,13 +1515,13 @@ function fn(t) {
|
|
|
1515
1515
|
packetsLostPct: G
|
|
1516
1516
|
};
|
|
1517
1517
|
F("onCameraStats", e.onCameraStats, M);
|
|
1518
|
-
},
|
|
1518
|
+
}, gt = () => {
|
|
1519
1519
|
Ne === null && (qe = null, Ne = setInterval(() => {
|
|
1520
|
-
|
|
1520
|
+
Ht();
|
|
1521
1521
|
}, 1e3));
|
|
1522
1522
|
}, je = () => {
|
|
1523
1523
|
Ne !== null && (clearInterval(Ne), Ne = null), qe = null, F("onCameraStats", e.onCameraStats, null);
|
|
1524
|
-
},
|
|
1524
|
+
}, Jt = (n, f, c, d) => tt.enqueue(async ({ isCurrent: K }) => {
|
|
1525
1525
|
const m = () => K() && d() && g === f && ue === c;
|
|
1526
1526
|
if (!m()) return;
|
|
1527
1527
|
if (!n.active) {
|
|
@@ -1536,9 +1536,9 @@ function fn(t) {
|
|
|
1536
1536
|
return;
|
|
1537
1537
|
}
|
|
1538
1538
|
F("onCameraDemandChange", e.onCameraDemandChange, !0);
|
|
1539
|
-
const C = Q,
|
|
1540
|
-
if (
|
|
1541
|
-
fe = n,
|
|
1539
|
+
const C = Q, E = C?.getVideoTracks()[0], k = fe;
|
|
1540
|
+
if (E?.readyState === "live" && k && !Ur(k, n)) {
|
|
1541
|
+
fe = n, _t(f, E), gt();
|
|
1542
1542
|
return;
|
|
1543
1543
|
}
|
|
1544
1544
|
if (C) {
|
|
@@ -1559,7 +1559,7 @@ function fn(t) {
|
|
|
1559
1559
|
let b = null;
|
|
1560
1560
|
try {
|
|
1561
1561
|
b = await navigator.mediaDevices.getUserMedia({
|
|
1562
|
-
video:
|
|
1562
|
+
video: kr(n),
|
|
1563
1563
|
audio: !1
|
|
1564
1564
|
});
|
|
1565
1565
|
} catch (M) {
|
|
@@ -1625,7 +1625,7 @@ function fn(t) {
|
|
|
1625
1625
|
!M() || Q !== b || !d() || g !== f || ue !== c || (Q = null, fe = void 0, J(b), je(), f.send(JSON.stringify({ type: "cameraResult", granted: !1 })), F("onCameraDemandChange", e.onCameraDemandChange, !0, !1));
|
|
1626
1626
|
}
|
|
1627
1627
|
}).catch((M) => y("camera ended cleanup failed:", M));
|
|
1628
|
-
}, m() && (
|
|
1628
|
+
}, m() && (_t(f, G), gt());
|
|
1629
1629
|
}), Te = () => {
|
|
1630
1630
|
for (const n of se) n();
|
|
1631
1631
|
se.clear();
|
|
@@ -1635,26 +1635,26 @@ function fn(t) {
|
|
|
1635
1635
|
n(new Error("Simulator disconnected"));
|
|
1636
1636
|
for (const n of ie.values())
|
|
1637
1637
|
n(new Error("Simulator disconnected"));
|
|
1638
|
-
Z.clear(), ne.clear(), ie.clear(), ce.clear(), L?.(), L = void 0,
|
|
1638
|
+
Z.clear(), ne.clear(), ie.clear(), ce.clear(), L?.(), L = void 0, Ft(), H = null;
|
|
1639
1639
|
for (const n of _e.values())
|
|
1640
1640
|
clearTimeout(n.timer), n.reject(new Error("Simulator disconnected"));
|
|
1641
|
-
_e.clear(), w(null), p({ controlReady: !1, videoReady: !1 }), Je(), Ue(), ke(), $ && ($.stop(), $ = null), Ie !== null && $e(null), tt.invalidate(), je(),
|
|
1641
|
+
_e.clear(), w(null), p({ controlReady: !1, videoReady: !1 }), Je(), Ue(), ke(), $ && ($.stop(), $ = null), Ie !== null && $e(null), tt.invalidate(), je(), qt(), fe = void 0, ue = null, ++Ve, nt = !1, Oe = null, te && (J(te), te = null, F("onMicrophoneStateChange", e.onMicrophoneStateChange, {
|
|
1642
1642
|
active: !1
|
|
1643
1643
|
})), be = null, pe = null, g && (g.onopen = null, g.onmessage = null, g.onerror = null, g.onclose = null, g.close(), g = null), Be?.close(), Be = null, R && (R.onconnectionstatechange = null, R.oniceconnectionstatechange = null, R.ontrack = null, R.onicecandidate = null, R.close(), R = null), W && (W.onopen = null, W.onclose = null, W.onerror = null, W.close(), W = null);
|
|
1644
|
-
},
|
|
1645
|
-
document.hidden ? Re() :
|
|
1646
|
-
},
|
|
1644
|
+
}, Tt = () => {
|
|
1645
|
+
document.hidden ? Re() : Ct();
|
|
1646
|
+
}, Gt = async () => {
|
|
1647
1647
|
if (e.transport) return e.transport.isTerminated?.() ?? !1;
|
|
1648
1648
|
if (typeof navigator < "u" && navigator.onLine === !1)
|
|
1649
1649
|
return !1;
|
|
1650
1650
|
let n;
|
|
1651
1651
|
try {
|
|
1652
1652
|
const d = new URL(r);
|
|
1653
|
-
d.protocol = d.protocol === "wss:" ? "https:" : d.protocol === "ws:" ? "http:" : d.protocol, n =
|
|
1653
|
+
d.protocol = d.protocol === "wss:" ? "https:" : d.protocol === "ws:" ? "http:" : d.protocol, n = Rt(d.toString(), u);
|
|
1654
1654
|
} catch {
|
|
1655
1655
|
return !1;
|
|
1656
1656
|
}
|
|
1657
|
-
const f = new AbortController(), c = window.setTimeout(() => f.abort(),
|
|
1657
|
+
const f = new AbortController(), c = window.setTimeout(() => f.abort(), Vr);
|
|
1658
1658
|
try {
|
|
1659
1659
|
return (await fetch(n, { method: "GET", cache: "no-store", signal: f.signal })).status === 404;
|
|
1660
1660
|
} catch {
|
|
@@ -1662,19 +1662,19 @@ function fn(t) {
|
|
|
1662
1662
|
} finally {
|
|
1663
1663
|
window.clearTimeout(c);
|
|
1664
1664
|
}
|
|
1665
|
-
},
|
|
1665
|
+
}, jt = () => {
|
|
1666
1666
|
he || (he = !0, de += 1, He(), Je(), Ue(), Te(), _("Instance terminated"), Re(), ge("terminated"), F("onTerminated", e.onTerminated));
|
|
1667
|
-
},
|
|
1667
|
+
}, Xt = () => {
|
|
1668
1668
|
if (he || ve) return;
|
|
1669
1669
|
ve = !0;
|
|
1670
1670
|
const n = Fe;
|
|
1671
|
-
|
|
1672
|
-
n === Fe && (ve = !1, f &&
|
|
1671
|
+
Gt().catch(() => !1).then((f) => {
|
|
1672
|
+
n === Fe && (ve = !1, f && jt());
|
|
1673
1673
|
});
|
|
1674
1674
|
}, ye = (n, f) => {
|
|
1675
1675
|
if (he || f !== de)
|
|
1676
1676
|
return;
|
|
1677
|
-
if (
|
|
1677
|
+
if (Xt(), re) {
|
|
1678
1678
|
if (e.autoReconnect === !1) {
|
|
1679
1679
|
_(`Connection failed after it was established: ${n}`), Re(), ge("failed"), Te();
|
|
1680
1680
|
return;
|
|
@@ -1683,14 +1683,14 @@ function fn(t) {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
He();
|
|
1685
1685
|
const c = We + 1;
|
|
1686
|
-
if (c >=
|
|
1687
|
-
_(`Connection failed after ${
|
|
1686
|
+
if (c >= ut) {
|
|
1687
|
+
_(`Connection failed after ${ut} attempts: ${n}`), Re(), ge("failed"), Te();
|
|
1688
1688
|
return;
|
|
1689
1689
|
}
|
|
1690
|
-
_(`Retrying connection (${c + 1}/${
|
|
1691
|
-
Me = void 0, f === de &&
|
|
1692
|
-
},
|
|
1693
|
-
},
|
|
1690
|
+
_(`Retrying connection (${c + 1}/${ut})`), ge("reconnecting"), Te(), Me = window.setTimeout(() => {
|
|
1691
|
+
Me = void 0, f === de && yt(c);
|
|
1692
|
+
}, xr);
|
|
1693
|
+
}, yt = async (n = 0) => {
|
|
1694
1694
|
const { openUrl: f, axPollIntervalMs: c, axMaxBackoffMs: d, androidElementTreeOptions: K } = e;
|
|
1695
1695
|
if (he) return;
|
|
1696
1696
|
const m = de + 1;
|
|
@@ -1698,14 +1698,14 @@ function fn(t) {
|
|
|
1698
1698
|
const C = () => m === de;
|
|
1699
1699
|
we = window.setTimeout(() => {
|
|
1700
1700
|
we = void 0, !(!C() || re) && ye("Connection did not succeed within 15 seconds", m);
|
|
1701
|
-
},
|
|
1701
|
+
}, Wr);
|
|
1702
1702
|
try {
|
|
1703
|
-
const
|
|
1703
|
+
const E = e.transport ? await e.transport.connect() : new WebSocket(Rt(r, u));
|
|
1704
1704
|
if (!C()) {
|
|
1705
|
-
|
|
1705
|
+
E.close();
|
|
1706
1706
|
return;
|
|
1707
1707
|
}
|
|
1708
|
-
if (g =
|
|
1708
|
+
if (g = E, await new Promise((O, s) => {
|
|
1709
1709
|
let Y = !1;
|
|
1710
1710
|
const q = () => v(() => s(new Error("Connection stopped")));
|
|
1711
1711
|
se.add(q);
|
|
@@ -1715,36 +1715,36 @@ function fn(t) {
|
|
|
1715
1715
|
), v = (z) => {
|
|
1716
1716
|
Y || (Y = !0, se.delete(q), window.clearTimeout(T), z());
|
|
1717
1717
|
};
|
|
1718
|
-
|
|
1719
|
-
!C() || g !==
|
|
1720
|
-
},
|
|
1721
|
-
!C() || g !==
|
|
1722
|
-
},
|
|
1723
|
-
!C() || g !==
|
|
1724
|
-
},
|
|
1725
|
-
}), !C() || g !==
|
|
1718
|
+
E.onopen = () => {
|
|
1719
|
+
!C() || g !== E || v(O);
|
|
1720
|
+
}, E.onerror = (z) => {
|
|
1721
|
+
!C() || g !== E || (_("WebSocket error: " + z), v(() => s(new Error("WebSocket connection failed"))));
|
|
1722
|
+
}, E.onclose = () => {
|
|
1723
|
+
!C() || g !== E || (_("WebSocket closed"), v(() => s(new Error("WebSocket closed before connection was established"))));
|
|
1724
|
+
}, E.readyState === WebSocket.OPEN ? v(O) : E.readyState !== WebSocket.CONNECTING && v(() => s(new Error("WebSocket is closed")));
|
|
1725
|
+
}), !C() || g !== E)
|
|
1726
1726
|
return;
|
|
1727
|
-
|
|
1728
|
-
!C() || g !==
|
|
1729
|
-
},
|
|
1730
|
-
!C() || g !==
|
|
1727
|
+
E.onerror = (O) => {
|
|
1728
|
+
!C() || g !== E || _("WebSocket error: " + O);
|
|
1729
|
+
}, E.onclose = () => {
|
|
1730
|
+
!C() || g !== E || _("WebSocket closed");
|
|
1731
1731
|
};
|
|
1732
1732
|
const k = new Promise((O, s) => {
|
|
1733
1733
|
let Y = !1;
|
|
1734
1734
|
const q = () => T(() => s(new Error("Connection stopped")));
|
|
1735
1735
|
se.add(q);
|
|
1736
1736
|
const T = (j) => {
|
|
1737
|
-
Y || (Y = !0, se.delete(q), window.clearTimeout(v),
|
|
1737
|
+
Y || (Y = !0, se.delete(q), window.clearTimeout(v), E.removeEventListener("message", z), j());
|
|
1738
1738
|
}, v = window.setTimeout(
|
|
1739
1739
|
() => T(() => s(new Error("RTCConfiguration timeout"))),
|
|
1740
1740
|
3e4
|
|
1741
1741
|
), z = (j) => {
|
|
1742
|
-
if (!(!C() || g !==
|
|
1742
|
+
if (!(!C() || g !== E))
|
|
1743
1743
|
try {
|
|
1744
1744
|
const X = JSON.parse(j.data);
|
|
1745
1745
|
if (X.type === "signalingError" && X.requestType === "requestRtcConfiguration" && X.sessionId === i) {
|
|
1746
|
-
const
|
|
1747
|
-
T(() => s(new Error(
|
|
1746
|
+
const er = typeof X.error == "string" ? X.error : "Unable to load streaming configuration";
|
|
1747
|
+
T(() => s(new Error(er)));
|
|
1748
1748
|
} else X.type === "rtcConfiguration" && T(
|
|
1749
1749
|
() => O({
|
|
1750
1750
|
rtcConfiguration: X.rtcConfiguration,
|
|
@@ -1756,7 +1756,7 @@ function fn(t) {
|
|
|
1756
1756
|
console.error("Error handling RTC configuration:", X), T(() => s(X));
|
|
1757
1757
|
}
|
|
1758
1758
|
};
|
|
1759
|
-
|
|
1759
|
+
E.addEventListener("message", z), E.send(
|
|
1760
1760
|
JSON.stringify({
|
|
1761
1761
|
type: "requestRtcConfiguration",
|
|
1762
1762
|
sessionId: i
|
|
@@ -1767,7 +1767,7 @@ function fn(t) {
|
|
|
1767
1767
|
cameraSupported: G,
|
|
1768
1768
|
foldSupported: M
|
|
1769
1769
|
} = await k;
|
|
1770
|
-
if (!C() || g !==
|
|
1770
|
+
if (!C() || g !== E)
|
|
1771
1771
|
return;
|
|
1772
1772
|
const U = o === "iphone-duo" || M;
|
|
1773
1773
|
V(U);
|
|
@@ -1775,10 +1775,10 @@ function fn(t) {
|
|
|
1775
1775
|
R = A;
|
|
1776
1776
|
const Xe = { peer: A, displays: /* @__PURE__ */ new Map() };
|
|
1777
1777
|
H = Xe, P(), A.addTransceiver("audio", { direction: "recvonly" });
|
|
1778
|
-
const
|
|
1778
|
+
const zt = A.addTransceiver("video", { direction: "recvonly" }), Zt = U ? A.addTransceiver("video", { direction: "recvonly" }) : null, vt = !l && (h === "ios" || G), at = vt ? A.addTransceiver("video", {
|
|
1779
1779
|
direction: "sendonly"
|
|
1780
1780
|
}) : null;
|
|
1781
|
-
if (ue =
|
|
1781
|
+
if (ue = at?.sender ?? null, be = (vt ? A.addTransceiver("audio", {
|
|
1782
1782
|
direction: "sendonly"
|
|
1783
1783
|
}) : null)?.sender ?? null, RTCRtpReceiver.getCapabilities) {
|
|
1784
1784
|
const O = RTCRtpReceiver.getCapabilities("video");
|
|
@@ -1790,10 +1790,10 @@ function fn(t) {
|
|
|
1790
1790
|
};
|
|
1791
1791
|
return v(q) - v(T);
|
|
1792
1792
|
});
|
|
1793
|
-
|
|
1793
|
+
zt.setCodecPreferences(Y), Zt?.setCodecPreferences(Y), le("Set codec preferences:", Y.map((q) => q.mimeType).join(", "));
|
|
1794
1794
|
}
|
|
1795
1795
|
}
|
|
1796
|
-
if (
|
|
1796
|
+
if (at && RTCRtpSender.getCapabilities) {
|
|
1797
1797
|
const O = RTCRtpSender.getCapabilities("video");
|
|
1798
1798
|
if (O && O.codecs) {
|
|
1799
1799
|
const s = /* @__PURE__ */ new Set(["42e01f", "42e028", "640c1f"]), Y = (T) => {
|
|
@@ -1801,7 +1801,7 @@ function fn(t) {
|
|
|
1801
1801
|
return v === "video/h265" || v === "video/hevc" ? 1 : v === "video/h264" && s.has(X) ? 2 : v === "video/h264" ? 3 : v === "video/vp9" ? 4 : v === "video/vp8" ? 5 : v === "video/rtx" || v === "video/red" || v === "video/ulpfec" ? 0 : 6;
|
|
1802
1802
|
}, q = [...O.codecs].sort((T, v) => Y(T) - Y(v));
|
|
1803
1803
|
try {
|
|
1804
|
-
|
|
1804
|
+
at.setCodecPreferences(q), le(
|
|
1805
1805
|
"Outbound camera codec preferences:",
|
|
1806
1806
|
q.map((T) => `${T.mimeType}${T.sdpFmtpLine ? `[${T.sdpFmtpLine}]` : ""}`).join(", ")
|
|
1807
1807
|
);
|
|
@@ -1816,14 +1816,14 @@ function fn(t) {
|
|
|
1816
1816
|
id: 1
|
|
1817
1817
|
});
|
|
1818
1818
|
W = ae;
|
|
1819
|
-
const
|
|
1819
|
+
const st = !l && !U && e.onTrace ? Yr(A, (O) => {
|
|
1820
1820
|
C() && R === A && F("onTrace", e.onTrace, O);
|
|
1821
1821
|
}) : null;
|
|
1822
|
-
if (Be =
|
|
1823
|
-
if (!C() || W !== ae || g !==
|
|
1822
|
+
if (Be = st, ae.onopen = () => {
|
|
1823
|
+
if (!C() || W !== ae || g !== E)
|
|
1824
1824
|
return;
|
|
1825
|
-
re = !0, p({ controlReady: !l }), Je(), _("Control channel opened"), U &&
|
|
1826
|
-
platform:
|
|
1825
|
+
re = !0, p({ controlReady: !l }), Je(), _("Control channel opened"), U && E.send(JSON.stringify({ type: "getFoldState", id: "duo-capabilities" })), !$ && h !== "macos" && ($ = new vr({
|
|
1826
|
+
platform: h,
|
|
1827
1827
|
baseIntervalMs: c,
|
|
1828
1828
|
maxBackoffMs: d,
|
|
1829
1829
|
androidElementTreeOptions: K,
|
|
@@ -1841,10 +1841,10 @@ function fn(t) {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
}), (e.inspectMode === !0 || e.inspectMode === "hover-only") && $.start());
|
|
1843
1843
|
const O = () => {
|
|
1844
|
-
!C() || Ye || W !== ae || g !==
|
|
1844
|
+
!C() || Ye || W !== ae || g !== E || E.readyState !== WebSocket.OPEN || E.send(JSON.stringify({ type: "requestFrame", sessionId: i }));
|
|
1845
1845
|
};
|
|
1846
1846
|
if (O(), ke(), xe = window.setInterval(() => {
|
|
1847
|
-
if (!C() || Ye || W !== ae || g !==
|
|
1847
|
+
if (!C() || Ye || W !== ae || g !== E || E.readyState !== WebSocket.OPEN) {
|
|
1848
1848
|
ke();
|
|
1849
1849
|
return;
|
|
1850
1850
|
}
|
|
@@ -1852,7 +1852,7 @@ function fn(t) {
|
|
|
1852
1852
|
}, 250), !l && f) {
|
|
1853
1853
|
try {
|
|
1854
1854
|
const s = decodeURIComponent(f);
|
|
1855
|
-
_("Opening URL"),
|
|
1855
|
+
_("Opening URL"), E.send(
|
|
1856
1856
|
JSON.stringify({
|
|
1857
1857
|
type: "openUrl",
|
|
1858
1858
|
url: s,
|
|
@@ -1860,7 +1860,7 @@ function fn(t) {
|
|
|
1860
1860
|
})
|
|
1861
1861
|
);
|
|
1862
1862
|
} catch (s) {
|
|
1863
|
-
console.error({ error: s }, "Error decoding URL, falling back to the original URL"),
|
|
1863
|
+
console.error({ error: s }, "Error decoding URL, falling back to the original URL"), E.send(
|
|
1864
1864
|
JSON.stringify({
|
|
1865
1865
|
type: "openUrl",
|
|
1866
1866
|
url: f,
|
|
@@ -1890,25 +1890,25 @@ function fn(t) {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
O === "disconnected" && re && e.autoReconnect !== !1 && Ce === void 0 && (Ce = window.setTimeout(() => {
|
|
1892
1892
|
Ce = void 0, !(!C() || R !== A) && A.iceConnectionState === "disconnected" && ye("ICE stayed disconnected past grace period", m);
|
|
1893
|
-
},
|
|
1893
|
+
}, qr));
|
|
1894
1894
|
}, A.ontrack = (O) => {
|
|
1895
1895
|
if (!C() || R !== A)
|
|
1896
1896
|
return;
|
|
1897
|
-
|
|
1897
|
+
bt(O.receiver, e.jitterBufferTargetMs);
|
|
1898
1898
|
const s = O.track.id === "duo-inner" || O.streams.some((Y) => Y.id === "duo-inner");
|
|
1899
1899
|
if (O.track.kind === "video" && Xe.displays.set(O.receiver, s ? "inner" : "primary"), _("Received remote track: " + O.track.kind), O.track.kind === "video") {
|
|
1900
1900
|
const Y = s ? "inner" : "primary", q = U ? new MediaStream([O.track]) : O.streams[0] ?? new MediaStream([O.track]);
|
|
1901
1901
|
Le.set(Y, q);
|
|
1902
1902
|
for (const [T, v] of B)
|
|
1903
|
-
v.display === Y &&
|
|
1903
|
+
v.display === Y && ft(T, v, q);
|
|
1904
1904
|
}
|
|
1905
|
-
if (O.track.kind === "audio"
|
|
1905
|
+
if (O.track.kind === "audio") {
|
|
1906
1906
|
Ae = new MediaStream([O.track]);
|
|
1907
|
-
for (const Y of Ke)
|
|
1907
|
+
for (const Y of Ke) Et(Y);
|
|
1908
1908
|
}
|
|
1909
1909
|
}, A.onicecandidate = (O) => {
|
|
1910
|
-
if (!(!C() || R !== A || g !==
|
|
1911
|
-
if (O.candidate &&
|
|
1910
|
+
if (!(!C() || R !== A || g !== E))
|
|
1911
|
+
if (O.candidate && E.readyState === WebSocket.OPEN) {
|
|
1912
1912
|
const s = {
|
|
1913
1913
|
type: "candidate",
|
|
1914
1914
|
candidate: O.candidate.candidate,
|
|
@@ -1916,11 +1916,11 @@ function fn(t) {
|
|
|
1916
1916
|
sdpMLineIndex: O.candidate.sdpMLineIndex,
|
|
1917
1917
|
sessionId: i
|
|
1918
1918
|
};
|
|
1919
|
-
|
|
1919
|
+
E.send(JSON.stringify(s)), _("Sent ICE candidate");
|
|
1920
1920
|
} else
|
|
1921
1921
|
_("ICE candidate gathering completed");
|
|
1922
|
-
},
|
|
1923
|
-
if (!C() || g !==
|
|
1922
|
+
}, E.onmessage = async (O) => {
|
|
1923
|
+
if (!C() || g !== E)
|
|
1924
1924
|
return;
|
|
1925
1925
|
let s;
|
|
1926
1926
|
try {
|
|
@@ -1952,14 +1952,14 @@ function fn(t) {
|
|
|
1952
1952
|
_("No peer connection, skipping answer");
|
|
1953
1953
|
break;
|
|
1954
1954
|
}
|
|
1955
|
-
if (
|
|
1955
|
+
if (st?.accept(s.latencyTraceVersion), await A.setRemoteDescription(
|
|
1956
1956
|
new RTCSessionDescription({
|
|
1957
1957
|
type: "answer",
|
|
1958
1958
|
sdp: s.sdp
|
|
1959
1959
|
})
|
|
1960
1960
|
), !C() || R !== A)
|
|
1961
1961
|
return;
|
|
1962
|
-
_("Set remote description"), pe =
|
|
1962
|
+
_("Set remote description"), pe = E, (e.speakerMuted ?? !0) || ht();
|
|
1963
1963
|
break;
|
|
1964
1964
|
case "candidate":
|
|
1965
1965
|
if (!R || R !== A) {
|
|
@@ -1982,7 +1982,7 @@ function fn(t) {
|
|
|
1982
1982
|
y("Received invalid screenshot success message:", s);
|
|
1983
1983
|
break;
|
|
1984
1984
|
}
|
|
1985
|
-
const T =
|
|
1985
|
+
const T = $r(s);
|
|
1986
1986
|
if (T) {
|
|
1987
1987
|
const j = Z.get(s.id);
|
|
1988
1988
|
if (typeof j != "function") {
|
|
@@ -1992,7 +1992,7 @@ function fn(t) {
|
|
|
1992
1992
|
y(`Received screenshot error for id ${s.id}: ${T}`), j(new Error(T)), ne.delete(s.id), Z.delete(s.id), clearTimeout(I.get(s.id)), I.delete(s.id);
|
|
1993
1993
|
break;
|
|
1994
1994
|
}
|
|
1995
|
-
const v =
|
|
1995
|
+
const v = Hr(s);
|
|
1996
1996
|
if (!v) {
|
|
1997
1997
|
y("Received screenshot message without image data:", s);
|
|
1998
1998
|
break;
|
|
@@ -2021,12 +2021,12 @@ function fn(t) {
|
|
|
2021
2021
|
const T = ue;
|
|
2022
2022
|
if (!T)
|
|
2023
2023
|
break;
|
|
2024
|
-
const v =
|
|
2024
|
+
const v = Rr(s);
|
|
2025
2025
|
if (!v) {
|
|
2026
2026
|
y("Received invalid cameraRequest:", s);
|
|
2027
2027
|
break;
|
|
2028
2028
|
}
|
|
2029
|
-
console.info("[RemoteControl] cameraRequest received:", v.active, v.facingMode), await
|
|
2029
|
+
console.info("[RemoteControl] cameraRequest received:", v.active, v.facingMode), await Jt(v, E, T, C);
|
|
2030
2030
|
break;
|
|
2031
2031
|
}
|
|
2032
2032
|
case "microphoneRequest": {
|
|
@@ -2038,7 +2038,7 @@ function fn(t) {
|
|
|
2038
2038
|
break;
|
|
2039
2039
|
}
|
|
2040
2040
|
if (te) {
|
|
2041
|
-
|
|
2041
|
+
Dt(E);
|
|
2042
2042
|
break;
|
|
2043
2043
|
}
|
|
2044
2044
|
await ot();
|
|
@@ -2078,54 +2078,54 @@ function fn(t) {
|
|
|
2078
2078
|
}, R === A) {
|
|
2079
2079
|
const O = await A.createOffer({
|
|
2080
2080
|
offerToReceiveVideo: !0,
|
|
2081
|
-
// This legacy option overrides transceiver directions: false
|
|
2082
|
-
// the speaker's receive-only audio section inactive.
|
|
2083
|
-
offerToReceiveAudio:
|
|
2081
|
+
// This legacy option overrides transceiver directions: false would
|
|
2082
|
+
// turn the speaker's receive-only audio section inactive.
|
|
2083
|
+
offerToReceiveAudio: !0
|
|
2084
2084
|
});
|
|
2085
2085
|
if (!C() || R !== A || (await A.setLocalDescription(O), !C() || R !== A))
|
|
2086
2086
|
return;
|
|
2087
|
-
C() && g ===
|
|
2087
|
+
C() && g === E && E.readyState === WebSocket.OPEN && E.send(
|
|
2088
2088
|
JSON.stringify({
|
|
2089
2089
|
type: "offer",
|
|
2090
2090
|
...U ? { displayStreams: !0 } : {},
|
|
2091
|
-
|
|
2092
|
-
...
|
|
2091
|
+
speakerAudio: !0,
|
|
2092
|
+
...st ? { latencyTraceVersion: 1 } : {},
|
|
2093
2093
|
sdp: O.sdp,
|
|
2094
2094
|
sessionId: i
|
|
2095
2095
|
})
|
|
2096
2096
|
), _("Sent offer");
|
|
2097
2097
|
}
|
|
2098
|
-
} catch (
|
|
2099
|
-
if (!C() ||
|
|
2098
|
+
} catch (E) {
|
|
2099
|
+
if (!C() || E instanceof Error && E.message === "Connection stopped")
|
|
2100
2100
|
return;
|
|
2101
|
-
const k =
|
|
2101
|
+
const k = E instanceof Error ? E.message : String(E);
|
|
2102
2102
|
_("Error: " + k), ye(k, m);
|
|
2103
2103
|
}
|
|
2104
|
-
},
|
|
2104
|
+
}, St = () => {
|
|
2105
2105
|
if (Ee) throw new Error("Device stream is disposed");
|
|
2106
|
-
Fe++, ve = !1, $e(null), De !== "reconnecting" && (De = null), document.addEventListener("visibilitychange",
|
|
2107
|
-
},
|
|
2108
|
-
Fe++, ve = !1, Re(), document.removeEventListener("visibilitychange",
|
|
2109
|
-
},
|
|
2106
|
+
Fe++, ve = !1, $e(null), De !== "reconnecting" && (De = null), document.addEventListener("visibilitychange", Tt), document.hidden || Ct(), he = !1, yt(0);
|
|
2107
|
+
}, Kt = () => {
|
|
2108
|
+
Fe++, ve = !1, Re(), document.removeEventListener("visibilitychange", Tt), de += 1, We = 0, re = !1, He(), Ue(), Te(), De = null, p({ connection: "idle", videoReady: !1, controlReady: !1 }), _("Stopped");
|
|
2109
|
+
}, Qt = (n) => {
|
|
2110
2110
|
if (Ee) throw new Error("Device stream is disposed");
|
|
2111
2111
|
if (Ke.has(n)) throw new Error("Audio element is already attached");
|
|
2112
|
-
Ke.add(n), Ae &&
|
|
2112
|
+
Ke.add(n), Ae && Et(n);
|
|
2113
2113
|
let f = !1;
|
|
2114
2114
|
const c = () => {
|
|
2115
|
-
f || (f = !0, x.delete(c), Ke.delete(n),
|
|
2115
|
+
f || (f = !0, x.delete(c), Ke.delete(n), Fr(n), n.srcObject = null);
|
|
2116
2116
|
};
|
|
2117
2117
|
return x.add(c), c;
|
|
2118
|
-
},
|
|
2118
|
+
}, At = (n, f = "primary") => {
|
|
2119
2119
|
if (Ee) throw new Error("Device stream is disposed");
|
|
2120
2120
|
if (B.has(n)) throw new Error("Video element is already attached");
|
|
2121
2121
|
const c = { display: f };
|
|
2122
2122
|
B.set(n, c);
|
|
2123
2123
|
const d = () => {
|
|
2124
|
-
f === "primary" && Le.has(f) &&
|
|
2124
|
+
f === "primary" && Le.has(f) && Wt();
|
|
2125
2125
|
};
|
|
2126
2126
|
n.addEventListener("loadeddata", d);
|
|
2127
2127
|
const K = Le.get(f);
|
|
2128
|
-
K &&
|
|
2128
|
+
K && ft(n, c, K);
|
|
2129
2129
|
let m = !1;
|
|
2130
2130
|
const C = () => {
|
|
2131
2131
|
m || (m = !0, x.delete(C), n.removeEventListener("loadeddata", d), c.stop?.(), B.delete(n), n.srcObject = null);
|
|
@@ -2133,16 +2133,16 @@ function fn(t) {
|
|
|
2133
2133
|
return x.add(C), C;
|
|
2134
2134
|
};
|
|
2135
2135
|
return {
|
|
2136
|
-
start:
|
|
2137
|
-
stop:
|
|
2138
|
-
attachVideo:
|
|
2139
|
-
attachAudio:
|
|
2136
|
+
start: St,
|
|
2137
|
+
stop: Kt,
|
|
2138
|
+
attachVideo: At,
|
|
2139
|
+
attachAudio: Qt,
|
|
2140
2140
|
attachFrameSink: (n, f = "primary") => {
|
|
2141
2141
|
const c = document.createElement("video");
|
|
2142
2142
|
c.muted = !0, c.playsInline = !0, c.autoplay = !0;
|
|
2143
|
-
const d =
|
|
2143
|
+
const d = At(c, f);
|
|
2144
2144
|
let K = !1, m = 0, C = 0;
|
|
2145
|
-
const
|
|
2145
|
+
const E = () => {
|
|
2146
2146
|
c.cancelVideoFrameCallback?.(m), cancelAnimationFrame(C);
|
|
2147
2147
|
}, k = () => {
|
|
2148
2148
|
K || !c.srcObject || (c.readyState >= 2 && c.videoWidth > 0 && F(
|
|
@@ -2154,17 +2154,17 @@ function fn(t) {
|
|
|
2154
2154
|
f
|
|
2155
2155
|
), !(K || !c.srcObject) && (c.requestVideoFrameCallback ? m = c.requestVideoFrameCallback(k) : C = requestAnimationFrame(k)));
|
|
2156
2156
|
}, b = () => {
|
|
2157
|
-
|
|
2157
|
+
E(), k();
|
|
2158
2158
|
};
|
|
2159
|
-
B.get(c).clear =
|
|
2159
|
+
B.get(c).clear = E, c.addEventListener("loadeddata", b);
|
|
2160
2160
|
const G = () => {
|
|
2161
|
-
K || (K = !0, x.delete(G),
|
|
2161
|
+
K || (K = !0, x.delete(G), E(), c.removeEventListener("loadeddata", b), d(), c.remove());
|
|
2162
2162
|
};
|
|
2163
2163
|
return x.delete(d), x.add(G), c.readyState >= 2 && b(), G;
|
|
2164
2164
|
},
|
|
2165
2165
|
dispose: () => {
|
|
2166
2166
|
if (!Ee) {
|
|
2167
|
-
Ee = !0,
|
|
2167
|
+
Ee = !0, Kt();
|
|
2168
2168
|
for (const n of x) n();
|
|
2169
2169
|
x.clear();
|
|
2170
2170
|
}
|
|
@@ -2180,12 +2180,12 @@ function fn(t) {
|
|
|
2180
2180
|
const c = e;
|
|
2181
2181
|
if (e = { ...e, ...f }, c.jitterBufferTargetMs !== e.jitterBufferTargetMs)
|
|
2182
2182
|
for (const d of R?.getTransceivers() ?? [])
|
|
2183
|
-
(d.currentDirection === "recvonly" || d.currentDirection === "sendrecv") &&
|
|
2184
|
-
!!c.onPlaybackStats != !!e.onPlaybackStats && P(), !!c.microphoneEnabled != !!e.microphoneEnabled && (rt = !l && (e.microphoneEnabled ?? !1), it() ? ot() : Ge()), (c.speakerMuted ?? !0) !== (e.speakerMuted ?? !0) &&
|
|
2183
|
+
(d.currentDirection === "recvonly" || d.currentDirection === "sendrecv") && bt(d.receiver, e.jitterBufferTargetMs);
|
|
2184
|
+
!!c.onPlaybackStats != !!e.onPlaybackStats && P(), !!c.microphoneEnabled != !!e.microphoneEnabled && (rt = !l && (e.microphoneEnabled ?? !1), it() ? ot() : Ge()), (c.speakerMuted ?? !0) !== (e.speakerMuted ?? !0) && ht(), !!c.inspectMode != !!e.inspectMode && (e.inspectMode ? $?.start() : ($?.stop(), Ie !== null && $e(null)));
|
|
2185
2185
|
},
|
|
2186
2186
|
sendControl: oe,
|
|
2187
2187
|
sendTouch: (n, f, c, d, K, m = 0) => oe(
|
|
2188
|
-
|
|
2188
|
+
nr(
|
|
2189
2189
|
n === "begin" ? 0 : n === "end" ? 1 : 2,
|
|
2190
2190
|
m,
|
|
2191
2191
|
d,
|
|
@@ -2195,12 +2195,12 @@ function fn(t) {
|
|
|
2195
2195
|
n === "end" ? 0 : 1
|
|
2196
2196
|
)
|
|
2197
2197
|
),
|
|
2198
|
-
sendText: (n) => oe(
|
|
2199
|
-
sendDisplayTouch: (n, f, c, d) => oe(
|
|
2200
|
-
sendDuoControl:
|
|
2198
|
+
sendText: (n) => oe(ir(n)),
|
|
2199
|
+
sendDisplayTouch: (n, f, c, d) => oe(lr(n, f, c, d)),
|
|
2200
|
+
sendDuoControl: Bt,
|
|
2201
2201
|
pressButton: (n) => {
|
|
2202
2202
|
const f = { home: 3, back: 4, recents: 187, power: 26 }[n];
|
|
2203
|
-
oe(
|
|
2203
|
+
oe(ct(0, f, 0, 0)), oe(ct(1, f, 0, 0));
|
|
2204
2204
|
},
|
|
2205
2205
|
rotate: () => oe(new Uint8Array([11]).buffer),
|
|
2206
2206
|
bumpActivity: () => $?.bumpActivity(),
|
|
@@ -2237,8 +2237,8 @@ function fn(t) {
|
|
|
2237
2237
|
y("Data channel not ready for imperative key command:", W?.readyState);
|
|
2238
2238
|
return;
|
|
2239
2239
|
}
|
|
2240
|
-
if (
|
|
2241
|
-
const m =
|
|
2240
|
+
if (h === "macos") {
|
|
2241
|
+
const m = Mt(n.code);
|
|
2242
2242
|
if (m === void 0) {
|
|
2243
2243
|
y(`Unknown event.code for imperative command: ${n.code}`);
|
|
2244
2244
|
return;
|
|
@@ -2248,17 +2248,17 @@ function fn(t) {
|
|
|
2248
2248
|
[n.ctrlKey, "Control"],
|
|
2249
2249
|
[n.altKey, "Alt"],
|
|
2250
2250
|
[n.shiftKey, "Shift"]
|
|
2251
|
-
].filter(([k, b]) => k && !n.code.startsWith(b)).map(([, k]) =>
|
|
2251
|
+
].filter(([k, b]) => k && !n.code.startsWith(b)).map(([, k]) => Mt(`${k}Left`)), E = (k, b) => oe(or(k, b));
|
|
2252
2252
|
if (n.type === "keydown") {
|
|
2253
|
-
for (const k of C)
|
|
2254
|
-
|
|
2253
|
+
for (const k of C) E(Qe.DOWN, k);
|
|
2254
|
+
E(Qe.DOWN, m);
|
|
2255
2255
|
} else {
|
|
2256
|
-
|
|
2257
|
-
for (const k of [...C].reverse())
|
|
2256
|
+
E(Qe.UP, m);
|
|
2257
|
+
for (const k of [...C].reverse()) E(Qe.UP, k);
|
|
2258
2258
|
}
|
|
2259
2259
|
return;
|
|
2260
2260
|
}
|
|
2261
|
-
const f =
|
|
2261
|
+
const f = tr[n.code];
|
|
2262
2262
|
if (!f) {
|
|
2263
2263
|
y(`Unknown event.code for imperative command: ${n.code}`);
|
|
2264
2264
|
return;
|
|
@@ -2269,7 +2269,7 @@ function fn(t) {
|
|
|
2269
2269
|
le(
|
|
2270
2270
|
`Sending Imperative Key Command: code=${n.code}, keycode=${f}, action=${d}, meta=${c}`
|
|
2271
2271
|
);
|
|
2272
|
-
const K =
|
|
2272
|
+
const K = ct(
|
|
2273
2273
|
d,
|
|
2274
2274
|
f,
|
|
2275
2275
|
0,
|
|
@@ -2322,7 +2322,7 @@ function fn(t) {
|
|
|
2322
2322
|
}, 3e4)
|
|
2323
2323
|
);
|
|
2324
2324
|
}),
|
|
2325
|
-
reconnect: () =>
|
|
2325
|
+
reconnect: () => St(),
|
|
2326
2326
|
refreshAxTree: async () => {
|
|
2327
2327
|
const n = $;
|
|
2328
2328
|
if (!n)
|
|
@@ -2332,47 +2332,47 @@ function fn(t) {
|
|
|
2332
2332
|
getAxSnapshot: () => Ie
|
|
2333
2333
|
};
|
|
2334
2334
|
}
|
|
2335
|
-
const
|
|
2335
|
+
const $r = (t) => typeof t.message == "string" ? t.message : typeof t.error == "string" ? t.error : null, Hr = (t) => typeof t.dataUri == "string" ? { dataUri: t.dataUri } : typeof t.base64 == "string" ? t.base64.startsWith("data:") ? { dataUri: t.base64 } : { dataUri: `data:${t.base64.startsWith("/9j/") ? "image/jpeg" : "image/png"};base64,${t.base64}` } : null;
|
|
2336
2336
|
export {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2337
|
+
lt as A,
|
|
2338
|
+
Mt as B,
|
|
2339
|
+
ir as C,
|
|
2340
|
+
en as D,
|
|
2341
|
+
ct as E,
|
|
2342
2342
|
a as F,
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2343
|
+
nr as G,
|
|
2344
|
+
nn as H,
|
|
2345
|
+
tr as I,
|
|
2346
2346
|
ze as J,
|
|
2347
|
-
|
|
2347
|
+
jr as K,
|
|
2348
2348
|
ee as L,
|
|
2349
2349
|
Qe as M,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2350
|
+
lr as N,
|
|
2351
|
+
sr as O,
|
|
2352
|
+
cn as a,
|
|
2353
|
+
ln as b,
|
|
2354
|
+
dn as c,
|
|
2355
|
+
Or as d,
|
|
2356
|
+
Dr as e,
|
|
2357
|
+
sn as f,
|
|
2358
|
+
hr as g,
|
|
2359
|
+
Zr as h,
|
|
2360
|
+
zr as i,
|
|
2361
|
+
ar as j,
|
|
2362
|
+
an as k,
|
|
2363
|
+
on as l,
|
|
2364
|
+
rn as m,
|
|
2365
|
+
Cr as n,
|
|
2366
|
+
Xr as o,
|
|
2367
|
+
tn as p,
|
|
2368
|
+
Qr as q,
|
|
2369
|
+
_r as r,
|
|
2370
|
+
Br as s,
|
|
2371
|
+
or as t,
|
|
2372
2372
|
F as u,
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2373
|
+
un as v,
|
|
2374
|
+
Fr as w,
|
|
2375
|
+
Lt as x,
|
|
2376
2376
|
le as y,
|
|
2377
2377
|
y as z
|
|
2378
2378
|
};
|