@ikonai/sdk 1.0.29 → 1.0.30
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/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ps = {
|
|
2
2
|
Compressed: 8
|
|
3
3
|
};
|
|
4
|
-
function
|
|
4
|
+
function _f(t) {
|
|
5
5
|
return t;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function Se(t) {
|
|
8
8
|
if (t.length < 8)
|
|
9
9
|
throw new Error("Protocol message too short");
|
|
10
10
|
return (t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24) >>> 0;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function Me(t) {
|
|
13
|
+
return Se(t) & 4294901760;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const e =
|
|
15
|
+
function ae(t) {
|
|
16
|
+
const e = le(t), n = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
17
17
|
if (e.length < 27)
|
|
18
18
|
throw new Error("Protocol payload too short");
|
|
19
|
-
const r = n.getUint32(0, !0), s = n.getUint32(4, !0), i = n.getUint32(8, !0), o = n.getUint32(12, !0), a = n.getUint32(16, !0), c = n.getUint32(20, !0), l = n.getUint8(24),
|
|
19
|
+
const r = n.getUint32(0, !0), s = n.getUint32(4, !0), i = n.getUint32(8, !0), o = n.getUint32(12, !0), a = n.getUint32(16, !0), c = n.getUint32(20, !0), l = n.getUint8(24), f = n.getUint8(25), p = n.getUint8(26);
|
|
20
20
|
if (27 + c * 4 > e.length)
|
|
21
21
|
throw new Error("Protocol header exceeds payload length");
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
for (let
|
|
25
|
-
|
|
22
|
+
const m = [];
|
|
23
|
+
let S = 27;
|
|
24
|
+
for (let T = 0; T < c; T++)
|
|
25
|
+
m.push(n.getUint32(S, !0)), S += 4;
|
|
26
26
|
return {
|
|
27
27
|
length: r,
|
|
28
28
|
opcode: s,
|
|
29
29
|
senderId: i,
|
|
30
30
|
trackId: o,
|
|
31
31
|
sequenceId: a,
|
|
32
|
-
targetIds:
|
|
32
|
+
targetIds: m,
|
|
33
33
|
payloadVersion: l,
|
|
34
|
-
payloadType:
|
|
35
|
-
flags:
|
|
34
|
+
payloadType: f,
|
|
35
|
+
flags: p
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const r =
|
|
38
|
+
function ce(t, e, n) {
|
|
39
|
+
const r = le(t), s = ae(r);
|
|
40
40
|
if (e !== void 0 && s.opcode !== e)
|
|
41
41
|
throw new Error(`Unexpected opcode ${s.opcode}`);
|
|
42
42
|
if (s.payloadType !== 8)
|
|
@@ -45,24 +45,24 @@ function ae(t, e, n) {
|
|
|
45
45
|
return r.subarray(i, s.length);
|
|
46
46
|
}
|
|
47
47
|
async function dt(t, e, n) {
|
|
48
|
-
const r =
|
|
48
|
+
const r = le(t), s = ae(r);
|
|
49
49
|
if (e !== void 0 && s.opcode !== e)
|
|
50
50
|
throw new Error(`Unexpected opcode ${s.opcode}`);
|
|
51
51
|
if (s.payloadType !== 8)
|
|
52
52
|
throw new Error(`Unexpected payload type ${s.payloadType}`);
|
|
53
53
|
const i = 27 + s.targetIds.length * 4;
|
|
54
54
|
let o = r.subarray(i, s.length);
|
|
55
|
-
return (s.flags &
|
|
55
|
+
return (s.flags & Ps.Compressed) !== 0 && (o = await Ls(o)), o;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const i = s?.trackId ?? 0, o = s?.sequenceId ?? 0, a = s?.flags ?? 0, c = s?.targetIds ?? [], l = s?.payloadType ?? 8,
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
for (let
|
|
62
|
-
|
|
63
|
-
return d.set(e,
|
|
57
|
+
function P(t, e, n, r, s) {
|
|
58
|
+
const i = s?.trackId ?? 0, o = s?.sequenceId ?? 0, a = s?.flags ?? 0, c = s?.targetIds ?? [], l = s?.payloadType ?? 8, f = 27 + c.length * 4, p = f + e.length, d = new Uint8Array(p), m = new DataView(d.buffer);
|
|
59
|
+
m.setUint32(0, p, !0), m.setUint32(4, t >>> 0, !0), m.setUint32(8, r >>> 0, !0), m.setUint32(12, i >>> 0, !0), m.setUint32(16, o >>> 0, !0), m.setUint32(20, c.length >>> 0, !0), m.setUint8(24, n & 255), m.setUint8(25, l & 255), m.setUint8(26, a & 255);
|
|
60
|
+
let S = 27;
|
|
61
|
+
for (let T = 0; T < c.length; T++)
|
|
62
|
+
m.setUint32(S, c[T] >>> 0, !0), S += 4;
|
|
63
|
+
return d.set(e, f), d;
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
65
|
+
async function Ls(t) {
|
|
66
66
|
if (typeof DecompressionStream > "u")
|
|
67
67
|
throw new Error("DecompressionStream not supported");
|
|
68
68
|
const e = new DecompressionStream("gzip"), n = e.writable.getWriter(), r = new Uint8Array(t);
|
|
@@ -70,9 +70,9 @@ async function Ps(t) {
|
|
|
70
70
|
const s = e.readable.getReader(), i = [];
|
|
71
71
|
let o = 0;
|
|
72
72
|
for (; ; ) {
|
|
73
|
-
const { done: l, value:
|
|
73
|
+
const { done: l, value: f } = await s.read();
|
|
74
74
|
if (l) break;
|
|
75
|
-
i.push(
|
|
75
|
+
i.push(f), o += f.length;
|
|
76
76
|
}
|
|
77
77
|
const a = new Uint8Array(o);
|
|
78
78
|
let c = 0;
|
|
@@ -111,7 +111,7 @@ class U {
|
|
|
111
111
|
this.writeFixedField(e, 2, () => this.buffer.writeByte(n ? 1 : 0));
|
|
112
112
|
}
|
|
113
113
|
writeGuidField(e, n) {
|
|
114
|
-
const r = n instanceof
|
|
114
|
+
const r = n instanceof w ? n.asBytes() : n;
|
|
115
115
|
if (r.length !== 16)
|
|
116
116
|
throw new Error("Guid payload must be 16 bytes");
|
|
117
117
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(r));
|
|
@@ -130,7 +130,7 @@ class U {
|
|
|
130
130
|
this.writeVariableField(e, 11, i);
|
|
131
131
|
}
|
|
132
132
|
writeArrayField(e, n, r) {
|
|
133
|
-
const s = new
|
|
133
|
+
const s = new Ve(n);
|
|
134
134
|
r(s);
|
|
135
135
|
const i = s.finish();
|
|
136
136
|
this.writeVariableField(e, 9, i);
|
|
@@ -151,10 +151,10 @@ class U {
|
|
|
151
151
|
this.writeFieldHeader(e, n, r.length), this.buffer.writeBytes(r);
|
|
152
152
|
}
|
|
153
153
|
writeFieldHeader(e, n, r) {
|
|
154
|
-
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(
|
|
154
|
+
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(Fe(n)), Vs(n) && this.buffer.writeVarUInt(r >>> 0);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
class
|
|
157
|
+
class Ve {
|
|
158
158
|
constructor(e) {
|
|
159
159
|
this.elementType = e;
|
|
160
160
|
}
|
|
@@ -207,7 +207,7 @@ class Ge {
|
|
|
207
207
|
14
|
|
208
208
|
/* Guid */
|
|
209
209
|
), this.count++;
|
|
210
|
-
const n = e instanceof
|
|
210
|
+
const n = e instanceof w ? e.asBytes() : e;
|
|
211
211
|
if (n.length !== 16)
|
|
212
212
|
throw new Error("Guid payload must be 16 bytes");
|
|
213
213
|
this.payload.writeBytes(n);
|
|
@@ -241,7 +241,7 @@ class Ge {
|
|
|
241
241
|
9
|
|
242
242
|
/* Array */
|
|
243
243
|
), this.count++;
|
|
244
|
-
const r = new
|
|
244
|
+
const r = new Ve(e);
|
|
245
245
|
n(r);
|
|
246
246
|
const s = r.finish();
|
|
247
247
|
this.payload.writeBytes(s);
|
|
@@ -258,7 +258,7 @@ class Ge {
|
|
|
258
258
|
}
|
|
259
259
|
finish() {
|
|
260
260
|
const e = new q();
|
|
261
|
-
return e.writeByte(
|
|
261
|
+
return e.writeByte(Fe(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
262
262
|
}
|
|
263
263
|
ensureElementType(e) {
|
|
264
264
|
if (this.elementType !== e)
|
|
@@ -267,7 +267,7 @@ class Ge {
|
|
|
267
267
|
}
|
|
268
268
|
class ht {
|
|
269
269
|
constructor(e, n) {
|
|
270
|
-
this.keyType = e, this.valueType = n,
|
|
270
|
+
this.keyType = e, this.valueType = n, mt(e);
|
|
271
271
|
}
|
|
272
272
|
payload = new q();
|
|
273
273
|
count = 0;
|
|
@@ -283,7 +283,7 @@ class ht {
|
|
|
283
283
|
if (this.entryOpen)
|
|
284
284
|
throw new Error("Dictionary entry not completed");
|
|
285
285
|
const e = new q();
|
|
286
|
-
return e.writeByte(
|
|
286
|
+
return e.writeByte(Fe(this.keyType)), e.writeByte(Fe(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
class Bs {
|
|
@@ -340,7 +340,7 @@ class Bs {
|
|
|
340
340
|
14
|
|
341
341
|
/* Guid */
|
|
342
342
|
);
|
|
343
|
-
const n = e instanceof
|
|
343
|
+
const n = e instanceof w ? e.asBytes() : e;
|
|
344
344
|
if (n.length !== 16)
|
|
345
345
|
throw new Error("Guid payload must be 16 bytes");
|
|
346
346
|
this.payload.writeBytes(n), this.keyWritten = !0;
|
|
@@ -406,7 +406,7 @@ class Bs {
|
|
|
406
406
|
14
|
|
407
407
|
/* Guid */
|
|
408
408
|
);
|
|
409
|
-
const n = e instanceof
|
|
409
|
+
const n = e instanceof w ? e.asBytes() : e;
|
|
410
410
|
if (n.length !== 16)
|
|
411
411
|
throw new Error("Guid payload must be 16 bytes");
|
|
412
412
|
this.payload.writeBytes(n), this.valueWritten = !0;
|
|
@@ -446,7 +446,7 @@ class Bs {
|
|
|
446
446
|
9
|
|
447
447
|
/* Array */
|
|
448
448
|
);
|
|
449
|
-
const r = new
|
|
449
|
+
const r = new Ve(e);
|
|
450
450
|
n(r);
|
|
451
451
|
const s = r.finish();
|
|
452
452
|
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
@@ -484,7 +484,7 @@ class V {
|
|
|
484
484
|
offset;
|
|
485
485
|
end;
|
|
486
486
|
static create(e) {
|
|
487
|
-
const n =
|
|
487
|
+
const n = le(e);
|
|
488
488
|
if (n.length < 2)
|
|
489
489
|
throw new Error("Teleport payload too short");
|
|
490
490
|
if (n[0] !== tn || n[n.length - 1] !== nn)
|
|
@@ -502,7 +502,7 @@ class V {
|
|
|
502
502
|
const n = this.buffer[this.offset++], r = n >> 4 & 15;
|
|
503
503
|
if ((n & 15) !== 0)
|
|
504
504
|
throw new Error("Teleport field flags must be zero");
|
|
505
|
-
const s =
|
|
505
|
+
const s = se(r);
|
|
506
506
|
let i;
|
|
507
507
|
if (s >= 0)
|
|
508
508
|
F(this.buffer, this.offset, s), i = this.buffer.subarray(this.offset, this.offset + s), this.offset += s;
|
|
@@ -581,7 +581,7 @@ class K {
|
|
|
581
581
|
return this.ensureType(
|
|
582
582
|
14
|
|
583
583
|
/* Guid */
|
|
584
|
-
),
|
|
584
|
+
), w.fromBytes(this.payload);
|
|
585
585
|
}
|
|
586
586
|
asObject() {
|
|
587
587
|
return this.ensureType(
|
|
@@ -630,7 +630,7 @@ class ft {
|
|
|
630
630
|
this.count = W(e, r, "ArrayMalformed"), this.offset = r.offset;
|
|
631
631
|
}
|
|
632
632
|
static create(e) {
|
|
633
|
-
return new ft(
|
|
633
|
+
return new ft(le(e));
|
|
634
634
|
}
|
|
635
635
|
next() {
|
|
636
636
|
if (this.index >= this.count) {
|
|
@@ -651,38 +651,38 @@ class ft {
|
|
|
651
651
|
case 4:
|
|
652
652
|
case 6:
|
|
653
653
|
case 14: {
|
|
654
|
-
const e =
|
|
654
|
+
const e = se(this.elementType);
|
|
655
655
|
F(this.payload, this.offset, e);
|
|
656
656
|
const n = this.payload.subarray(this.offset, this.offset + e);
|
|
657
|
-
return this.offset += e, new
|
|
657
|
+
return this.offset += e, new pe(this.elementType, n);
|
|
658
658
|
}
|
|
659
659
|
case 12:
|
|
660
660
|
case 13: {
|
|
661
661
|
const e = { offset: this.offset }, n = W(this.payload, e, "ArrayMalformed");
|
|
662
662
|
F(this.payload, e.offset, n);
|
|
663
663
|
const r = this.payload.subarray(e.offset, e.offset + n);
|
|
664
|
-
return this.offset = e.offset + n, new
|
|
664
|
+
return this.offset = e.offset + n, new pe(this.elementType, r);
|
|
665
665
|
}
|
|
666
666
|
case 11: {
|
|
667
667
|
const e = { offset: this.offset }, n = W(this.payload, e, "ArrayMalformed");
|
|
668
668
|
F(this.payload, e.offset, n);
|
|
669
669
|
const r = this.payload.subarray(e.offset, e.offset + n);
|
|
670
|
-
return this.offset = e.offset + n, new
|
|
670
|
+
return this.offset = e.offset + n, new pe(11, r);
|
|
671
671
|
}
|
|
672
672
|
case 9: {
|
|
673
|
-
const e =
|
|
674
|
-
return this.offset += e, new
|
|
673
|
+
const e = Et(this.payload, this.offset), n = this.payload.subarray(this.offset, this.offset + e);
|
|
674
|
+
return this.offset += e, new pe(9, n);
|
|
675
675
|
}
|
|
676
676
|
case 10: {
|
|
677
677
|
const e = It(this.payload, this.offset), n = this.payload.subarray(this.offset, this.offset + e);
|
|
678
|
-
return this.offset += e, new
|
|
678
|
+
return this.offset += e, new pe(10, n);
|
|
679
679
|
}
|
|
680
680
|
default:
|
|
681
681
|
throw new Error(`Unsupported array element type ${O[this.elementType]}`);
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
class
|
|
685
|
+
class pe extends K {
|
|
686
686
|
constructor(e, n) {
|
|
687
687
|
super(e, n);
|
|
688
688
|
}
|
|
@@ -699,12 +699,12 @@ class pt {
|
|
|
699
699
|
throw new Error("Dictionary payload too short");
|
|
700
700
|
if (this.keyType = e[0] >> 4 & 15, this.valueType = e[1] >> 4 & 15, (e[0] & 15) !== 0 || (e[1] & 15) !== 0)
|
|
701
701
|
throw new Error("Dictionary key/value flags must be zero");
|
|
702
|
-
|
|
702
|
+
mt(this.keyType);
|
|
703
703
|
const n = { offset: 2 };
|
|
704
704
|
this.count = W(e, n, "DictMalformed"), this.offset = n.offset;
|
|
705
705
|
}
|
|
706
706
|
static create(e) {
|
|
707
|
-
return new pt(
|
|
707
|
+
return new pt(le(e));
|
|
708
708
|
}
|
|
709
709
|
next() {
|
|
710
710
|
if (this.index >= this.count) {
|
|
@@ -716,7 +716,7 @@ class pt {
|
|
|
716
716
|
return this.index++, new Ws(e, n);
|
|
717
717
|
}
|
|
718
718
|
readKey() {
|
|
719
|
-
const e =
|
|
719
|
+
const e = se(this.keyType);
|
|
720
720
|
if (e >= 0) {
|
|
721
721
|
F(this.payload, this.offset, e);
|
|
722
722
|
const n = this.payload.subarray(this.offset, this.offset + e);
|
|
@@ -746,7 +746,7 @@ class pt {
|
|
|
746
746
|
return this.offset = e.offset + n, new K(11, r);
|
|
747
747
|
}
|
|
748
748
|
case 9: {
|
|
749
|
-
const e =
|
|
749
|
+
const e = Et(this.payload, this.offset), n = this.payload.subarray(this.offset, this.offset + e);
|
|
750
750
|
return this.offset += e, new K(9, n);
|
|
751
751
|
}
|
|
752
752
|
case 10: {
|
|
@@ -762,7 +762,7 @@ class pt {
|
|
|
762
762
|
case 6:
|
|
763
763
|
case 14:
|
|
764
764
|
case 1: {
|
|
765
|
-
const e =
|
|
765
|
+
const e = se(this.valueType);
|
|
766
766
|
F(this.payload, this.offset, e);
|
|
767
767
|
const n = this.payload.subarray(this.offset, this.offset + e);
|
|
768
768
|
return this.offset += e, new K(this.valueType, n);
|
|
@@ -777,7 +777,7 @@ class Ws {
|
|
|
777
777
|
this.key = e, this.value = n;
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
|
-
class
|
|
780
|
+
class w {
|
|
781
781
|
constructor(e) {
|
|
782
782
|
this.bytes = e;
|
|
783
783
|
}
|
|
@@ -787,19 +787,19 @@ class S {
|
|
|
787
787
|
const n = e.replace(/-/g, "");
|
|
788
788
|
if (n.length !== 32)
|
|
789
789
|
throw new Error("Guid string must be 32 hex characters");
|
|
790
|
-
const r = new Uint8Array(16), s =
|
|
791
|
-
|
|
790
|
+
const r = new Uint8Array(16), s = w.parseHexSlice(n, 0, 8), i = w.parseHexSlice(n, 8, 4), o = w.parseHexSlice(n, 12, 4);
|
|
791
|
+
w.writeUInt32LE(r, 0, s), w.writeUInt16LE(r, 4, i), w.writeUInt16LE(r, 6, o);
|
|
792
792
|
for (let a = 0; a < 8; a++)
|
|
793
|
-
r[8 + a] =
|
|
794
|
-
return new
|
|
793
|
+
r[8 + a] = w.parseHexSlice(n, 16 + a * 2, 2);
|
|
794
|
+
return new w(r);
|
|
795
795
|
}
|
|
796
796
|
static fromBytes(e) {
|
|
797
797
|
if (e.length !== 16)
|
|
798
798
|
throw new Error("Guid byte array must be 16 bytes");
|
|
799
|
-
return new
|
|
799
|
+
return new w(Uint8Array.from(e));
|
|
800
800
|
}
|
|
801
801
|
static createZero() {
|
|
802
|
-
return new
|
|
802
|
+
return new w(new Uint8Array(16));
|
|
803
803
|
}
|
|
804
804
|
static createRandom() {
|
|
805
805
|
const e = new Uint8Array(16), n = globalThis.crypto;
|
|
@@ -808,14 +808,14 @@ class S {
|
|
|
808
808
|
else
|
|
809
809
|
for (let r = 0; r < e.length; r++)
|
|
810
810
|
e[r] = Math.floor(Math.random() * 256);
|
|
811
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new
|
|
811
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new w(e);
|
|
812
812
|
}
|
|
813
813
|
toString() {
|
|
814
814
|
const e = this.bytes;
|
|
815
815
|
return [
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
816
|
+
w.toHex(w.readUInt32LE(e, 0), 8),
|
|
817
|
+
w.toHex(w.readUInt16LE(e, 4), 4),
|
|
818
|
+
w.toHex(w.readUInt16LE(e, 6), 4),
|
|
819
819
|
Ot(e.subarray(8, 10)),
|
|
820
820
|
Ot(e.subarray(10, 16))
|
|
821
821
|
].join("-");
|
|
@@ -918,7 +918,7 @@ function W(t, e, n) {
|
|
|
918
918
|
function Gs(t) {
|
|
919
919
|
return t < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5;
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function Fe(t, e = 0) {
|
|
922
922
|
if ((e & 240) !== 0)
|
|
923
923
|
throw new Error("Teleport flags must fit into 4 bits");
|
|
924
924
|
return (t & 15) << 4 | e & 15;
|
|
@@ -926,7 +926,7 @@ function Pe(t, e = 0) {
|
|
|
926
926
|
function Vs(t) {
|
|
927
927
|
return t === 12 || t === 13 || t === 9 || t === 11 || t === 10;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function se(t) {
|
|
930
930
|
switch (t) {
|
|
931
931
|
case 3:
|
|
932
932
|
case 5:
|
|
@@ -946,7 +946,7 @@ function re(t) {
|
|
|
946
946
|
return -1;
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
949
|
+
function mt(t) {
|
|
950
950
|
if (t === 9 || t === 11 || t === 10 || t === 1)
|
|
951
951
|
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
952
952
|
}
|
|
@@ -957,13 +957,13 @@ function F(t, e, n) {
|
|
|
957
957
|
function Hs(t, e) {
|
|
958
958
|
return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function Et(t, e) {
|
|
961
961
|
if (e >= t.length)
|
|
962
962
|
throw new Error("Array payload exceeds bounds");
|
|
963
963
|
const n = t[e], r = n >> 4 & 15;
|
|
964
964
|
if ((n & 15) !== 0)
|
|
965
965
|
throw new Error("Array flags must be zero");
|
|
966
|
-
const s = { offset: e + 1 }, i = W(t, s, "ArrayMalformed"), o =
|
|
966
|
+
const s = { offset: e + 1 }, i = W(t, s, "ArrayMalformed"), o = se(r);
|
|
967
967
|
if (o >= 0) {
|
|
968
968
|
const c = o * i;
|
|
969
969
|
return F(t, s.offset, c), s.offset + c - e;
|
|
@@ -979,7 +979,7 @@ function It(t, e) {
|
|
|
979
979
|
const n = t[e] >> 4 & 15, r = t[e + 1] >> 4 & 15;
|
|
980
980
|
if ((t[e] & 15) !== 0 || (t[e + 1] & 15) !== 0)
|
|
981
981
|
throw new Error("Dictionary key/value flags must be zero");
|
|
982
|
-
|
|
982
|
+
mt(n);
|
|
983
983
|
const s = { offset: e + 2 }, i = W(t, s, "DictMalformed");
|
|
984
984
|
let o = s.offset;
|
|
985
985
|
for (let a = 0; a < i; a++)
|
|
@@ -987,7 +987,7 @@ function It(t, e) {
|
|
|
987
987
|
return o - e;
|
|
988
988
|
}
|
|
989
989
|
function Ze(t, e, n, r) {
|
|
990
|
-
const s =
|
|
990
|
+
const s = se(t);
|
|
991
991
|
if (s >= 0)
|
|
992
992
|
return F(e, n, s), n + s;
|
|
993
993
|
switch (t) {
|
|
@@ -1001,7 +1001,7 @@ function Ze(t, e, n, r) {
|
|
|
1001
1001
|
return F(e, i.offset, o), i.offset + o;
|
|
1002
1002
|
}
|
|
1003
1003
|
case 9:
|
|
1004
|
-
return n +
|
|
1004
|
+
return n + Et(e, n);
|
|
1005
1005
|
case 10:
|
|
1006
1006
|
return n + It(e, n);
|
|
1007
1007
|
default:
|
|
@@ -1011,10 +1011,10 @@ function Ze(t, e, n, r) {
|
|
|
1011
1011
|
function Ot(t) {
|
|
1012
1012
|
return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function le(t) {
|
|
1015
1015
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
1016
1016
|
}
|
|
1017
|
-
var rn = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Opus = 1] = "Opus", t[t.Mp3 = 2] = "Mp3", t[t.RawPcm16 = 3] = "RawPcm16", t))(rn || {}), te = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.MobileWeb = 1] = "MobileWeb", t[t.MobileApp = 2] = "MobileApp", t[t.DesktopWeb = 3] = "DesktopWeb", t[t.DesktopApp = 4] = "DesktopApp", t))(te || {}), le = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Backend = 2] = "Backend", t[t.Server = 4] = "Server", t[t.Plugin = 8] = "Plugin", t[t.Browser = 16] = "Browser", t))(le || {}), b = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t[t.WebRTC = 128] = "WebRTC", t[t.TcpTls = 256] = "TcpTls", t))(b || {}), sn = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.SendBackToSender = 1] = "SendBackToSender", t[t.Delayable = 2] = "Delayable", t[t.SendToUser = 4] = "SendToUser", t[t.Compressed = 8] = "Compressed", t[t.Unreliable = 16] = "Unreliable", t))(sn || {}), ue = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.MessagePack = 1] = "MessagePack", t[t.MemoryPack = 2] = "MemoryPack", t[t.Json = 4] = "Json", t[t.Teleport = 8] = "Teleport", t[t.All = 15] = "All", t))(ue || {}), on = /* @__PURE__ */ ((t) => (t[t.Face = 0] = "Face", t[t.Hands = 1] = "Hands", t[t.Pose = 2] = "Pose", t[t.All = 3] = "All", t))(on || {}), de = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Machine = 1] = "Machine", t[t.Human = 2] = "Human", t))(de || {}), an = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(an || {}), _t = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.DotNet = 1] = "DotNet", t[t.TypeScript = 2] = "TypeScript", t[t.Cpp = 3] = "Cpp", t))(_t || {}), cn = /* @__PURE__ */ ((t) => (t[t.Local = 0] = "Local", t[t.Cloud = 1] = "Cloud", t))(cn || {}), ln = /* @__PURE__ */ ((t) => (t[t.Bundle = 0] = "Bundle", t[t.GitSource = 1] = "GitSource", t))(ln || {}), g = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(g || {});
|
|
1017
|
+
var rn = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Opus = 1] = "Opus", t[t.Mp3 = 2] = "Mp3", t[t.RawPcm16 = 3] = "RawPcm16", t))(rn || {}), ne = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.MobileWeb = 1] = "MobileWeb", t[t.MobileApp = 2] = "MobileApp", t[t.DesktopWeb = 3] = "DesktopWeb", t[t.DesktopApp = 4] = "DesktopApp", t))(ne || {}), ue = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Backend = 2] = "Backend", t[t.Server = 4] = "Server", t[t.Plugin = 8] = "Plugin", t[t.Browser = 16] = "Browser", t))(ue || {}), b = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t[t.WebRTC = 128] = "WebRTC", t[t.TcpTls = 256] = "TcpTls", t))(b || {}), sn = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.SendBackToSender = 1] = "SendBackToSender", t[t.Delayable = 2] = "Delayable", t[t.SendToUser = 4] = "SendToUser", t[t.Compressed = 8] = "Compressed", t[t.Unreliable = 16] = "Unreliable", t))(sn || {}), de = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.MessagePack = 1] = "MessagePack", t[t.MemoryPack = 2] = "MemoryPack", t[t.Json = 4] = "Json", t[t.Teleport = 8] = "Teleport", t[t.All = 15] = "All", t))(de || {}), on = /* @__PURE__ */ ((t) => (t[t.Face = 0] = "Face", t[t.Hands = 1] = "Hands", t[t.Pose = 2] = "Pose", t[t.All = 3] = "All", t))(on || {}), he = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Machine = 1] = "Machine", t[t.Human = 2] = "Human", t))(he || {}), an = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(an || {}), _t = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.DotNet = 1] = "DotNet", t[t.TypeScript = 2] = "TypeScript", t[t.Cpp = 3] = "Cpp", t))(_t || {}), cn = /* @__PURE__ */ ((t) => (t[t.Local = 0] = "Local", t[t.Cloud = 1] = "Cloud", t))(cn || {}), ln = /* @__PURE__ */ ((t) => (t[t.Bundle = 0] = "Bundle", t[t.GitSource = 1] = "GitSource", t))(ln || {}), g = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(g || {});
|
|
1018
1018
|
const un = 1, $s = 1048637, Ks = 727023925, Ys = 3395085689;
|
|
1019
1019
|
function js(t) {
|
|
1020
1020
|
const e = new U(un);
|
|
@@ -1025,18 +1025,18 @@ function zs(t, e) {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
function Xs(t, e, n) {
|
|
1027
1027
|
const r = js(t);
|
|
1028
|
-
return
|
|
1028
|
+
return P($s, r, un, e, n);
|
|
1029
1029
|
}
|
|
1030
|
-
const Js = 1, dn = 467348717, hn = 972460562, fn = 1911490601, pn = 2603556958,
|
|
1030
|
+
const Js = 1, dn = 467348717, hn = 972460562, fn = 1911490601, pn = 2603556958, mn = 3609695522, En = 4094837378, In = 4257460908;
|
|
1031
1031
|
function _n(t) {
|
|
1032
1032
|
const e = {};
|
|
1033
1033
|
return Tn(e), t && Object.assign(e, t), e;
|
|
1034
1034
|
}
|
|
1035
1035
|
function Tn(t) {
|
|
1036
|
-
return t.ParameterIndex = 0, t.TypeName = "", t.ValueJson = "", t.ValueData = new Uint8Array(0), t.IsEnumerable = !1, t.EnumerableItemTypeName = "", t.EnumerationId =
|
|
1036
|
+
return t.ParameterIndex = 0, t.TypeName = "", t.ValueJson = "", t.ValueData = new Uint8Array(0), t.IsEnumerable = !1, t.EnumerableItemTypeName = "", t.EnumerationId = w.fromBytes(new Uint8Array(16)), t;
|
|
1037
1037
|
}
|
|
1038
1038
|
function Qs(t, e) {
|
|
1039
|
-
e.writeGuidField(dn, t.EnumerationId), e.writeStringField(hn, t.EnumerableItemTypeName), e.writeStringField(fn, t.ValueJson), e.writeBoolField(pn, t.IsEnumerable), e.writeStringField(
|
|
1039
|
+
e.writeGuidField(dn, t.EnumerationId), e.writeStringField(hn, t.EnumerableItemTypeName), e.writeStringField(fn, t.ValueJson), e.writeBoolField(pn, t.IsEnumerable), e.writeStringField(mn, t.TypeName), e.writeBinaryField(En, t.ValueData), e.writeInt32Field(In, t.ParameterIndex | 0);
|
|
1040
1040
|
}
|
|
1041
1041
|
function Zs(t, e) {
|
|
1042
1042
|
const n = e ?? _n();
|
|
@@ -1066,12 +1066,12 @@ function qs(t, e) {
|
|
|
1066
1066
|
e.IsEnumerable = n.asBool();
|
|
1067
1067
|
break;
|
|
1068
1068
|
}
|
|
1069
|
-
case
|
|
1069
|
+
case mn: {
|
|
1070
1070
|
if (n.isNull) throw new Error();
|
|
1071
1071
|
e.TypeName = n.asString();
|
|
1072
1072
|
break;
|
|
1073
1073
|
}
|
|
1074
|
-
case
|
|
1074
|
+
case En: {
|
|
1075
1075
|
if (n.isNull) throw new Error();
|
|
1076
1076
|
e.ValueData = n.asBinary();
|
|
1077
1077
|
break;
|
|
@@ -1100,7 +1100,7 @@ function ii(t, e) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
function oi(t, e, n) {
|
|
1102
1102
|
const r = si(t);
|
|
1103
|
-
return
|
|
1103
|
+
return P(ei, r, wn, e, n);
|
|
1104
1104
|
}
|
|
1105
1105
|
const ai = 161083277, ci = 265814330, li = 1368629611, ui = 2431514951, di = 2745379226, hi = 3282782683, fi = 3284746250, pi = 4101844078;
|
|
1106
1106
|
function Sn(t) {
|
|
@@ -1110,11 +1110,11 @@ function Sn(t) {
|
|
|
1110
1110
|
function gn(t) {
|
|
1111
1111
|
return t.StreamId = "", t.Description = "", t.SourceType = "", t.Codec = rn.Unknown, t.CodecDetails = "", t.SampleRate = 0, t.Channels = 0, t.ShapeSets = void 0, t;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function mi(t, e) {
|
|
1114
1114
|
const n = e ?? Sn();
|
|
1115
|
-
return gn(n),
|
|
1115
|
+
return gn(n), Ei(t, n), n;
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function Ei(t, e) {
|
|
1118
1118
|
let n;
|
|
1119
1119
|
for (; (n = t.next()) !== null; )
|
|
1120
1120
|
switch (n.fieldId) {
|
|
@@ -1210,13 +1210,13 @@ function yi(t) {
|
|
|
1210
1210
|
e.push(n.asString());
|
|
1211
1211
|
return e;
|
|
1212
1212
|
}
|
|
1213
|
-
const Ai = 76337612, Ri = 185396121, bi = 250031587, Ni = 388632637, ki = 417197284, Di = 469070965, vi = 470595159, Ui = 594855258, Oi = 781727218, Mi = 834078886,
|
|
1213
|
+
const Ai = 76337612, Ri = 185396121, bi = 250031587, Ni = 388632637, ki = 417197284, Di = 469070965, vi = 470595159, Ui = 594855258, Oi = 781727218, Mi = 834078886, Pi = 1043273762, Li = 1236999138, Fi = 1286979607, Bi = 1368629611, xi = 1715899485, Wi = 1942830531, Gi = 1999510636, Vi = 2033288346, Hi = 2079864626, $i = 2142346422, Ki = 2232517119, Yi = 2598291686, ji = 2719718823, zi = 2810953526, Xi = 2840065720, Ji = 2885165957, Qi = 3542818975, Zi = 3586157513, qi = 3717933110, eo = 4062655306;
|
|
1214
1214
|
function qe(t) {
|
|
1215
1215
|
const e = {};
|
|
1216
1216
|
return yn(e), e;
|
|
1217
1217
|
}
|
|
1218
1218
|
function yn(t) {
|
|
1219
|
-
return t.ContextType =
|
|
1219
|
+
return t.ContextType = ue.Unknown, t.UserType = he.Unknown, t.PayloadType = de.Unknown, t.Description = "", t.UserId = "", t.DeviceId = "", t.ProductId = "", t.VersionId = "", t.InstallId = "", t.Locale = "", t.SessionId = -1, t.IsInternal = !1, t.IsReady = !1, t.HasInput = !1, t.ChannelLocale = "", t.EmbeddedSpaceId = "", t.AuthSessionId = "", t.ReceiveAllMessages = !1, t.PreciseJoinedAt = 0n, t.UserAgent = "", t.ClientType = ne.Unknown, t.UniqueSessionId = "", t.Parameters = /* @__PURE__ */ Object.create(null), t.SdkType = _t.Unknown, t.ViewportWidth = 0, t.ViewportHeight = 0, t.Theme = "", t.Timezone = "", t.IsTouchDevice = !1, t.InitialPath = "", t;
|
|
1220
1220
|
}
|
|
1221
1221
|
function et(t, e) {
|
|
1222
1222
|
const n = e ?? qe();
|
|
@@ -1276,12 +1276,12 @@ function to(t, e) {
|
|
|
1276
1276
|
e.ProductId = n.asString();
|
|
1277
1277
|
break;
|
|
1278
1278
|
}
|
|
1279
|
-
case
|
|
1279
|
+
case Pi: {
|
|
1280
1280
|
if (n.isNull) throw new Error();
|
|
1281
1281
|
e.AuthSessionId = n.asString();
|
|
1282
1282
|
break;
|
|
1283
1283
|
}
|
|
1284
|
-
case
|
|
1284
|
+
case Li: {
|
|
1285
1285
|
if (n.isNull) throw new Error();
|
|
1286
1286
|
e.ReceiveAllMessages = n.asBool();
|
|
1287
1287
|
break;
|
|
@@ -1445,7 +1445,7 @@ function po(t, e) {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
1448
|
-
const
|
|
1448
|
+
const mo = 65537, Eo = 166277978, Io = 1482635149, _o = 1559330978, To = 2802434353, wo = 3085883711, So = 3669484338, go = 3707543140, Co = 3712281496, yo = 3823842552;
|
|
1449
1449
|
function Ao(t) {
|
|
1450
1450
|
const e = {};
|
|
1451
1451
|
return Rn(e), e;
|
|
@@ -1465,7 +1465,7 @@ function No(t, e) {
|
|
|
1465
1465
|
let n;
|
|
1466
1466
|
for (; (n = t.next()) !== null; )
|
|
1467
1467
|
switch (n.fieldId) {
|
|
1468
|
-
case
|
|
1468
|
+
case Eo: {
|
|
1469
1469
|
if (n.isNull) throw new Error();
|
|
1470
1470
|
e.CertHash = n.asString();
|
|
1471
1471
|
break;
|
|
@@ -1513,7 +1513,7 @@ function No(t, e) {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
async function ko(t, e) {
|
|
1516
|
-
const n = await dt(t,
|
|
1516
|
+
const n = await dt(t, mo);
|
|
1517
1517
|
return Ro(n, e);
|
|
1518
1518
|
}
|
|
1519
1519
|
function Do(t) {
|
|
@@ -1537,34 +1537,34 @@ function Uo(t) {
|
|
|
1537
1537
|
return Oo(e), t && Object.assign(e, t), e;
|
|
1538
1538
|
}
|
|
1539
1539
|
function Oo(t) {
|
|
1540
|
-
return t.ServerSessionId = "", t.ContextType =
|
|
1540
|
+
return t.ServerSessionId = "", t.ContextType = ue.Unknown, t.UserType = he.Unknown, t.PayloadType = de.Unknown, t.IsInternal = !1, t.Description = "", t.UserId = "", t.DeviceId = "", t.ProductId = "", t.VersionId = "", t.InstallId = "", t.Locale = "", t.OpcodeGroupsFromServer = g.NONE, t.OpcodeGroupsToServer = g.NONE, t.ProtocolVersion = 0, t.HasInput = !1, t.ChannelLocale = "", t.EmbeddedSpaceId = "", t.AuthSessionId = "", t.ReceiveAllMessages = !1, t.UserAgent = "", t.ClientType = ne.Unknown, t.Parameters = /* @__PURE__ */ Object.create(null), t.SdkType = _t.Unknown, t.ViewportWidth = 0, t.ViewportHeight = 0, t.Theme = "", t.Timezone = "", t.IsTouchDevice = !1, t.InitialPath = "", t;
|
|
1541
1541
|
}
|
|
1542
|
-
const bn = 1, Mo = 1048632,
|
|
1542
|
+
const bn = 1, Mo = 1048632, Po = 3748161056, Lo = 4289118421;
|
|
1543
1543
|
function Fo(t) {
|
|
1544
1544
|
const e = {};
|
|
1545
1545
|
return Bo(e), t && Object.assign(e, t), e;
|
|
1546
1546
|
}
|
|
1547
1547
|
function Bo(t) {
|
|
1548
|
-
return t.CallId =
|
|
1548
|
+
return t.CallId = w.fromBytes(new Uint8Array(16)), t.InstanceId = w.fromBytes(new Uint8Array(16)), t;
|
|
1549
1549
|
}
|
|
1550
1550
|
function xo(t) {
|
|
1551
1551
|
const e = new U(bn);
|
|
1552
1552
|
return Wo(t, e), e.finish();
|
|
1553
1553
|
}
|
|
1554
1554
|
function Wo(t, e) {
|
|
1555
|
-
e.writeGuidField(
|
|
1555
|
+
e.writeGuidField(Po, t.CallId), e.writeGuidField(Lo, t.InstanceId);
|
|
1556
1556
|
}
|
|
1557
1557
|
function Go(t, e, n) {
|
|
1558
1558
|
const r = xo(t);
|
|
1559
|
-
return
|
|
1559
|
+
return P(Mo, r, bn, e, n);
|
|
1560
1560
|
}
|
|
1561
|
-
const Nn = 1, kn = 1048601, Dn = 112005851, vn = 814454131, Un = 976255570, On = 2610786289, Mn = 2885165957,
|
|
1561
|
+
const Nn = 1, kn = 1048601, Dn = 112005851, vn = 814454131, Un = 976255570, On = 2610786289, Mn = 2885165957, Pn = 3748161056, Ln = 4289118421;
|
|
1562
1562
|
function Fn(t) {
|
|
1563
1563
|
const e = {};
|
|
1564
1564
|
return Bn(e), t && Object.assign(e, t), e;
|
|
1565
1565
|
}
|
|
1566
1566
|
function Bn(t) {
|
|
1567
|
-
return t.FunctionId =
|
|
1567
|
+
return t.FunctionId = w.fromBytes(new Uint8Array(16)), t.CallId = w.fromBytes(new Uint8Array(16)), t.InstanceId = w.fromBytes(new Uint8Array(16)), t.FunctionName = "", t.Parameters = [], t.Scopes = [], t.Version = "", t;
|
|
1568
1568
|
}
|
|
1569
1569
|
function Vo(t) {
|
|
1570
1570
|
const e = new U(Nn);
|
|
@@ -1581,7 +1581,7 @@ function Ho(t, e) {
|
|
|
1581
1581
|
n.writeObject(Js, (s) => {
|
|
1582
1582
|
Qs(r, s);
|
|
1583
1583
|
});
|
|
1584
|
-
}), e.writeGuidField(
|
|
1584
|
+
}), e.writeGuidField(Pn, t.CallId), e.writeGuidField(Ln, t.InstanceId);
|
|
1585
1585
|
}
|
|
1586
1586
|
function $o(t, e) {
|
|
1587
1587
|
const n = V.create(t);
|
|
@@ -1620,12 +1620,12 @@ function Yo(t, e) {
|
|
|
1620
1620
|
e.Parameters = Jo(n.asArray());
|
|
1621
1621
|
break;
|
|
1622
1622
|
}
|
|
1623
|
-
case
|
|
1623
|
+
case Pn: {
|
|
1624
1624
|
if (n.isNull) throw new Error();
|
|
1625
1625
|
e.CallId = n.asGuid();
|
|
1626
1626
|
break;
|
|
1627
1627
|
}
|
|
1628
|
-
case
|
|
1628
|
+
case Ln: {
|
|
1629
1629
|
if (n.isNull) throw new Error();
|
|
1630
1630
|
e.InstanceId = n.asGuid();
|
|
1631
1631
|
break;
|
|
@@ -1634,7 +1634,7 @@ function Yo(t, e) {
|
|
|
1634
1634
|
}
|
|
1635
1635
|
function jo(t, e, n) {
|
|
1636
1636
|
const r = Vo(t);
|
|
1637
|
-
return
|
|
1637
|
+
return P(kn, r, Nn, e, n);
|
|
1638
1638
|
}
|
|
1639
1639
|
async function zo(t, e) {
|
|
1640
1640
|
const n = await dt(t, kn);
|
|
@@ -1691,7 +1691,7 @@ function Xn(t) {
|
|
|
1691
1691
|
return Jn(e), t && Object.assign(e, t), e;
|
|
1692
1692
|
}
|
|
1693
1693
|
function Jn(t) {
|
|
1694
|
-
return t.CallId =
|
|
1694
|
+
return t.CallId = w.fromBytes(new Uint8Array(16)), t.InstanceId = w.fromBytes(new Uint8Array(16)), t.ErrorMessage = "", t.ErrorTypeName = "", t.StackTrace = "", t;
|
|
1695
1695
|
}
|
|
1696
1696
|
function na(t) {
|
|
1697
1697
|
const e = new U(Vn);
|
|
@@ -1741,10 +1741,10 @@ function oa(t, e) {
|
|
|
1741
1741
|
}
|
|
1742
1742
|
function aa(t, e, n) {
|
|
1743
1743
|
const r = na(t);
|
|
1744
|
-
return
|
|
1744
|
+
return P(Hn, r, Vn, e, n);
|
|
1745
1745
|
}
|
|
1746
1746
|
function ca(t, e) {
|
|
1747
|
-
const n =
|
|
1747
|
+
const n = ce(t, Hn);
|
|
1748
1748
|
return sa(n, e);
|
|
1749
1749
|
}
|
|
1750
1750
|
const Tt = 1, la = 1048600, Qn = 703025676, Zn = 814454131, qn = 972460562, er = 976255570, tr = 1368629611, nr = 1479280922, rr = 1533537016, sr = 1909301063, ir = 2274386296, or = 2603556958, ar = 2885165957, cr = 3568439632;
|
|
@@ -1753,7 +1753,7 @@ function ua(t) {
|
|
|
1753
1753
|
return lr(e), e;
|
|
1754
1754
|
}
|
|
1755
1755
|
function lr(t) {
|
|
1756
|
-
return t.FunctionId =
|
|
1756
|
+
return t.FunctionId = w.fromBytes(new Uint8Array(16)), t.FunctionName = "", t.Parameters = [], t.ResultTypeName = "", t.IsEnumerable = !1, t.EnumerableItemTypeName = "", t.IsCancellable = !1, t.Description = "", t.LlmInlineResult = !1, t.LlmCallOnlyOnce = !1, t.RequiresInstance = !1, t.Versions = [], t;
|
|
1757
1757
|
}
|
|
1758
1758
|
function da(t) {
|
|
1759
1759
|
const e = new U(Tt);
|
|
@@ -1815,7 +1815,7 @@ function fa(t, e) {
|
|
|
1815
1815
|
}
|
|
1816
1816
|
case sr: {
|
|
1817
1817
|
if (n.isNull) throw new Error();
|
|
1818
|
-
e.Versions =
|
|
1818
|
+
e.Versions = ma(n.asArray());
|
|
1819
1819
|
break;
|
|
1820
1820
|
}
|
|
1821
1821
|
case ir: {
|
|
@@ -1830,7 +1830,7 @@ function fa(t, e) {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
case ar: {
|
|
1832
1832
|
if (n.isNull) throw new Error();
|
|
1833
|
-
e.Parameters =
|
|
1833
|
+
e.Parameters = Ea(n.asArray());
|
|
1834
1834
|
break;
|
|
1835
1835
|
}
|
|
1836
1836
|
case cr: {
|
|
@@ -1842,23 +1842,23 @@ function fa(t, e) {
|
|
|
1842
1842
|
}
|
|
1843
1843
|
function pa(t, e, n) {
|
|
1844
1844
|
const r = da(t);
|
|
1845
|
-
return
|
|
1845
|
+
return P(la, r, Tt, e, n);
|
|
1846
1846
|
}
|
|
1847
|
-
function
|
|
1847
|
+
function ma(t) {
|
|
1848
1848
|
const e = [];
|
|
1849
1849
|
let n;
|
|
1850
1850
|
for (; (n = t.next()) !== null; )
|
|
1851
1851
|
e.push(n.asString());
|
|
1852
1852
|
return e;
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function Ea(t) {
|
|
1855
1855
|
const e = [];
|
|
1856
1856
|
let n;
|
|
1857
1857
|
for (; (n = t.next()) !== null; )
|
|
1858
1858
|
e.push(wa(n.asObject()));
|
|
1859
1859
|
return e;
|
|
1860
1860
|
}
|
|
1861
|
-
const Ia = 1, dr = 607861992, hr = 894485888, fr = 972460562, pr = 1368629611,
|
|
1861
|
+
const Ia = 1, dr = 607861992, hr = 894485888, fr = 972460562, pr = 1368629611, mr = 1883521406, Er = 2603556958, Ir = 3609695522, _r = 4075263697, Tr = 4257460908;
|
|
1862
1862
|
function _a(t) {
|
|
1863
1863
|
const e = {};
|
|
1864
1864
|
return wr(e), e;
|
|
@@ -1867,7 +1867,7 @@ function wr(t) {
|
|
|
1867
1867
|
return t.ParameterIndex = 0, t.ParameterName = "", t.TypeName = "", t.HasDefaultValue = !1, t.DefaultValueJson = "", t.DefaultValueData = new Uint8Array(0), t.IsEnumerable = !1, t.EnumerableItemTypeName = "", t.Description = "", t;
|
|
1868
1868
|
}
|
|
1869
1869
|
function Ta(t, e) {
|
|
1870
|
-
e.writeBoolField(dr, t.HasDefaultValue), e.writeStringField(hr, t.DefaultValueJson), e.writeStringField(fr, t.EnumerableItemTypeName), e.writeStringField(pr, t.Description), e.writeBinaryField(
|
|
1870
|
+
e.writeBoolField(dr, t.HasDefaultValue), e.writeStringField(hr, t.DefaultValueJson), e.writeStringField(fr, t.EnumerableItemTypeName), e.writeStringField(pr, t.Description), e.writeBinaryField(mr, t.DefaultValueData), e.writeBoolField(Er, t.IsEnumerable), e.writeStringField(Ir, t.TypeName), e.writeStringField(_r, t.ParameterName), e.writeInt32Field(Tr, t.ParameterIndex | 0);
|
|
1871
1871
|
}
|
|
1872
1872
|
function wa(t, e) {
|
|
1873
1873
|
const n = e ?? _a();
|
|
@@ -1897,12 +1897,12 @@ function Sa(t, e) {
|
|
|
1897
1897
|
e.Description = n.asString();
|
|
1898
1898
|
break;
|
|
1899
1899
|
}
|
|
1900
|
-
case
|
|
1900
|
+
case mr: {
|
|
1901
1901
|
if (n.isNull) throw new Error();
|
|
1902
1902
|
e.DefaultValueData = n.asBinary();
|
|
1903
1903
|
break;
|
|
1904
1904
|
}
|
|
1905
|
-
case
|
|
1905
|
+
case Er: {
|
|
1906
1906
|
if (n.isNull) throw new Error();
|
|
1907
1907
|
e.IsEnumerable = n.asBool();
|
|
1908
1908
|
break;
|
|
@@ -1946,7 +1946,7 @@ function ba(t, e) {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
function Na(t, e, n) {
|
|
1948
1948
|
const r = Ra(t);
|
|
1949
|
-
return
|
|
1949
|
+
return P(ga, r, Sr, e, n);
|
|
1950
1950
|
}
|
|
1951
1951
|
const gr = 1, Cr = 1048602, yr = 349453957, Ar = 703025676, Rr = 3403385840, br = 3748161056, Nr = 4289118421;
|
|
1952
1952
|
function kr(t) {
|
|
@@ -1954,7 +1954,7 @@ function kr(t) {
|
|
|
1954
1954
|
return Dr(e), t && Object.assign(e, t), e;
|
|
1955
1955
|
}
|
|
1956
1956
|
function Dr(t) {
|
|
1957
|
-
return t.CallId =
|
|
1957
|
+
return t.CallId = w.fromBytes(new Uint8Array(16)), t.InstanceId = w.fromBytes(new Uint8Array(16)), t.ResultTypeName = "", t.ResultJson = "", t.ResultData = new Uint8Array(0), t;
|
|
1958
1958
|
}
|
|
1959
1959
|
function ka(t) {
|
|
1960
1960
|
const e = new U(gr);
|
|
@@ -2004,22 +2004,22 @@ function Oa(t, e) {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
function Ma(t, e, n) {
|
|
2006
2006
|
const r = ka(t);
|
|
2007
|
-
return
|
|
2007
|
+
return P(Cr, r, gr, e, n);
|
|
2008
2008
|
}
|
|
2009
|
-
function
|
|
2010
|
-
const n =
|
|
2009
|
+
function Pa(t, e) {
|
|
2010
|
+
const n = ce(t, Cr);
|
|
2011
2011
|
return va(n, e);
|
|
2012
2012
|
}
|
|
2013
|
-
const vr = 1,
|
|
2013
|
+
const vr = 1, La = 65549;
|
|
2014
2014
|
function Mt(t) {
|
|
2015
2015
|
return {};
|
|
2016
2016
|
}
|
|
2017
2017
|
function Fa(t) {
|
|
2018
2018
|
return new U(vr).finish();
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2020
|
+
function Pt(t, e, n) {
|
|
2021
2021
|
const r = Fa();
|
|
2022
|
-
return
|
|
2022
|
+
return P(La, r, vr, e, n);
|
|
2023
2023
|
}
|
|
2024
2024
|
const Ba = 3167053791, xa = 3342364356, Wa = 3612929027;
|
|
2025
2025
|
function Ur(t) {
|
|
@@ -2064,14 +2064,14 @@ function Ha(t) {
|
|
|
2064
2064
|
const $a = 3612929027;
|
|
2065
2065
|
function Mr(t) {
|
|
2066
2066
|
const e = {};
|
|
2067
|
-
return
|
|
2067
|
+
return Pr(e), e;
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2069
|
+
function Pr(t) {
|
|
2070
2070
|
return t.Category = "", t;
|
|
2071
2071
|
}
|
|
2072
2072
|
function Ka(t, e) {
|
|
2073
2073
|
const n = e ?? Mr();
|
|
2074
|
-
return
|
|
2074
|
+
return Pr(n), Ya(t, n), n;
|
|
2075
2075
|
}
|
|
2076
2076
|
function Ya(t, e) {
|
|
2077
2077
|
let n;
|
|
@@ -2085,7 +2085,7 @@ function Ya(t, e) {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
const ja = 161083277, za = 164808083, Xa = 1368629611, Ja = 2745379226, Qa = 2950031986, Za = 3282782683, qa = 3284746250, ec = 4065070594;
|
|
2088
|
-
function
|
|
2088
|
+
function Lr(t) {
|
|
2089
2089
|
const e = {};
|
|
2090
2090
|
return Fr(e), e;
|
|
2091
2091
|
}
|
|
@@ -2093,7 +2093,7 @@ function Fr(t) {
|
|
|
2093
2093
|
return t.StreamId = "", t.Description = "", t.SourceType = "", t.Codec = an.H264, t.CodecDetails = "", t.Width = 0, t.Height = 0, t.Framerate = 30, t;
|
|
2094
2094
|
}
|
|
2095
2095
|
function tc(t, e) {
|
|
2096
|
-
const n = e ??
|
|
2096
|
+
const n = e ?? Lr();
|
|
2097
2097
|
return Fr(n), nc(t, n), n;
|
|
2098
2098
|
}
|
|
2099
2099
|
function nc(t, e) {
|
|
@@ -2142,7 +2142,7 @@ function nc(t, e) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
|
-
const rc = 65539, sc = 693643444, ic = 1144553441, oc = 1497620243, ac = 1559330978, cc = 1976546434, lc = 1999510636, uc = 2271236852, dc = 2277643855, hc = 2469008121, fc = 3042922213, pc = 3064612128,
|
|
2145
|
+
const rc = 65539, sc = 693643444, ic = 1144553441, oc = 1497620243, ac = 1559330978, cc = 1976546434, lc = 1999510636, uc = 2271236852, dc = 2277643855, hc = 2469008121, fc = 3042922213, pc = 3064612128, mc = 3219210453, Ec = 3504054055, Ic = 3678477544, _c = 3696445035, Tc = 3707543140, wc = 3712281496, Sc = 3895362455, gc = 3897397815, Cc = 4225107827;
|
|
2146
2146
|
function yc(t) {
|
|
2147
2147
|
const e = {};
|
|
2148
2148
|
return Br(e), e;
|
|
@@ -2217,12 +2217,12 @@ function bc(t, e) {
|
|
|
2217
2217
|
e.ServerRunType = n.asInt32();
|
|
2218
2218
|
break;
|
|
2219
2219
|
}
|
|
2220
|
-
case
|
|
2220
|
+
case mc: {
|
|
2221
2221
|
if (n.isNull) throw new Error();
|
|
2222
2222
|
e.OrganisationName = n.asString();
|
|
2223
2223
|
break;
|
|
2224
2224
|
}
|
|
2225
|
-
case
|
|
2225
|
+
case Ec: {
|
|
2226
2226
|
if (n.isNull) throw new Error();
|
|
2227
2227
|
e.DebugMode = n.asBool();
|
|
2228
2228
|
break;
|
|
@@ -2291,7 +2291,7 @@ function vc(t) {
|
|
|
2291
2291
|
let n;
|
|
2292
2292
|
for (; (n = t.next()) !== null; ) {
|
|
2293
2293
|
const r = n.key.asInt32();
|
|
2294
|
-
e[r] =
|
|
2294
|
+
e[r] = Pc(n.value.asArray());
|
|
2295
2295
|
}
|
|
2296
2296
|
return e;
|
|
2297
2297
|
}
|
|
@@ -2322,14 +2322,14 @@ function Mc(t) {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
return e;
|
|
2324
2324
|
}
|
|
2325
|
-
function
|
|
2325
|
+
function Pc(t) {
|
|
2326
2326
|
const e = [];
|
|
2327
2327
|
let n;
|
|
2328
2328
|
for (; (n = t.next()) !== null; )
|
|
2329
2329
|
e.push(ha(n.asObject()));
|
|
2330
2330
|
return e;
|
|
2331
2331
|
}
|
|
2332
|
-
const
|
|
2332
|
+
const Lc = 161083277, Fc = 325678206, Bc = 3469892363, xc = 3645544153;
|
|
2333
2333
|
function Wc(t) {
|
|
2334
2334
|
const e = {};
|
|
2335
2335
|
return xr(e), e;
|
|
@@ -2345,7 +2345,7 @@ function Vc(t, e) {
|
|
|
2345
2345
|
let n;
|
|
2346
2346
|
for (; (n = t.next()) !== null; )
|
|
2347
2347
|
switch (n.fieldId) {
|
|
2348
|
-
case
|
|
2348
|
+
case Lc: {
|
|
2349
2349
|
if (n.isNull) throw new Error();
|
|
2350
2350
|
e.StreamId = n.asString();
|
|
2351
2351
|
break;
|
|
@@ -2400,7 +2400,7 @@ function Xc(t, e) {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
case Yc: {
|
|
2402
2402
|
if (n.isNull) throw new Error();
|
|
2403
|
-
e.Info =
|
|
2403
|
+
e.Info = mi(n.asObject());
|
|
2404
2404
|
break;
|
|
2405
2405
|
}
|
|
2406
2406
|
}
|
|
@@ -2411,7 +2411,7 @@ function el(t) {
|
|
|
2411
2411
|
return Gr(e), e;
|
|
2412
2412
|
}
|
|
2413
2413
|
function Gr(t) {
|
|
2414
|
-
return t.StreamId = "", t.ClientSessionId = 0, t.TrackId = 0, t.Info =
|
|
2414
|
+
return t.StreamId = "", t.ClientSessionId = 0, t.TrackId = 0, t.Info = Lr(), t;
|
|
2415
2415
|
}
|
|
2416
2416
|
function tl(t, e) {
|
|
2417
2417
|
const n = e ?? el();
|
|
@@ -2490,9 +2490,9 @@ function dl(t) {
|
|
|
2490
2490
|
}
|
|
2491
2491
|
function Kr(t, e, n) {
|
|
2492
2492
|
const r = dl();
|
|
2493
|
-
return
|
|
2493
|
+
return P(ul, r, Hr, e, n);
|
|
2494
2494
|
}
|
|
2495
|
-
const Yr = 1, hl = 65558, fl = 250031587, pl = 1286979607,
|
|
2495
|
+
const Yr = 1, hl = 65558, fl = 250031587, pl = 1286979607, ml = 2033288346, El = 3542818975;
|
|
2496
2496
|
function Il(t) {
|
|
2497
2497
|
const e = {};
|
|
2498
2498
|
return _l(e), t && Object.assign(e, t), e;
|
|
@@ -2505,11 +2505,11 @@ function Tl(t) {
|
|
|
2505
2505
|
return wl(t, e), e.finish();
|
|
2506
2506
|
}
|
|
2507
2507
|
function wl(t, e) {
|
|
2508
|
-
e.writeStringField(fl, t.Theme), e.writeInt32Field(pl, t.ViewportHeight | 0), e.writeInt32Field(
|
|
2508
|
+
e.writeStringField(fl, t.Theme), e.writeInt32Field(pl, t.ViewportHeight | 0), e.writeInt32Field(ml, t.ViewportWidth | 0), e.writeStringField(El, t.Timezone);
|
|
2509
2509
|
}
|
|
2510
2510
|
function Sl(t, e, n) {
|
|
2511
2511
|
const r = Tl(t);
|
|
2512
|
-
return
|
|
2512
|
+
return P(hl, r, Yr, e, n);
|
|
2513
2513
|
}
|
|
2514
2514
|
const jr = 1, gl = 8388612;
|
|
2515
2515
|
function Cl(t) {
|
|
@@ -2520,7 +2520,7 @@ function yl(t) {
|
|
|
2520
2520
|
}
|
|
2521
2521
|
function Al(t, e, n) {
|
|
2522
2522
|
const r = yl();
|
|
2523
|
-
return
|
|
2523
|
+
return P(gl, r, jr, e, n);
|
|
2524
2524
|
}
|
|
2525
2525
|
const zr = 65567, Rl = 1455877031;
|
|
2526
2526
|
function bl(t) {
|
|
@@ -2550,27 +2550,27 @@ function Dl(t, e) {
|
|
|
2550
2550
|
}
|
|
2551
2551
|
}
|
|
2552
2552
|
function vl(t, e) {
|
|
2553
|
-
const n =
|
|
2553
|
+
const n = ce(t, zr);
|
|
2554
2554
|
return Nl(n, e);
|
|
2555
2555
|
}
|
|
2556
2556
|
const Jr = 1, Ul = 65570, Ol = 2677673673;
|
|
2557
|
-
function
|
|
2557
|
+
function Lt(t) {
|
|
2558
2558
|
const e = {};
|
|
2559
2559
|
return Ml(e), t && Object.assign(e, t), e;
|
|
2560
2560
|
}
|
|
2561
2561
|
function Ml(t) {
|
|
2562
2562
|
return t.IsStart = !1, t;
|
|
2563
2563
|
}
|
|
2564
|
-
function
|
|
2564
|
+
function Pl(t) {
|
|
2565
2565
|
const e = new U(Jr);
|
|
2566
|
-
return
|
|
2566
|
+
return Ll(t, e), e.finish();
|
|
2567
2567
|
}
|
|
2568
|
-
function
|
|
2568
|
+
function Ll(t, e) {
|
|
2569
2569
|
e.writeBoolField(Ol, t.IsStart);
|
|
2570
2570
|
}
|
|
2571
2571
|
function Ft(t, e, n) {
|
|
2572
|
-
const r =
|
|
2573
|
-
return
|
|
2572
|
+
const r = Pl(t);
|
|
2573
|
+
return P(Ul, r, Jr, e, n);
|
|
2574
2574
|
}
|
|
2575
2575
|
const Qr = 1, wt = 65568, Zr = 646075140, qr = 2324511977, es = 4002097439;
|
|
2576
2576
|
function ts(t) {
|
|
@@ -2618,10 +2618,10 @@ function Gl(t, e) {
|
|
|
2618
2618
|
}
|
|
2619
2619
|
function Vl(t, e, n) {
|
|
2620
2620
|
const r = Fl(t);
|
|
2621
|
-
return
|
|
2621
|
+
return P(wt, r, Qr, e, n);
|
|
2622
2622
|
}
|
|
2623
2623
|
function Hl(t, e) {
|
|
2624
|
-
const n =
|
|
2624
|
+
const n = ce(t, wt);
|
|
2625
2625
|
return xl(n, e);
|
|
2626
2626
|
}
|
|
2627
2627
|
const rs = 1, $l = 65566, Kl = 407060584, Yl = 1175184220, jl = 1241248827, zl = 1455877031, Xl = 3419353826, Jl = 3686066300;
|
|
@@ -2641,7 +2641,7 @@ function eu(t, e) {
|
|
|
2641
2641
|
}
|
|
2642
2642
|
function tu(t, e, n) {
|
|
2643
2643
|
const r = ql(t);
|
|
2644
|
-
return
|
|
2644
|
+
return P($l, r, rs, e, n);
|
|
2645
2645
|
}
|
|
2646
2646
|
const ss = 65569, nu = 2838554230, ru = 3673535008;
|
|
2647
2647
|
function su(t) {
|
|
@@ -2676,11 +2676,11 @@ function au(t, e) {
|
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
2678
|
function cu(t, e) {
|
|
2679
|
-
const n =
|
|
2679
|
+
const n = ce(t, ss);
|
|
2680
2680
|
return iu(n, e);
|
|
2681
2681
|
}
|
|
2682
|
-
const os = 65571, lu = 161083277, uu = 317031266, du = 1093174542, hu = 1970024675, fu = 2481928696, pu = 2762891795,
|
|
2683
|
-
function
|
|
2682
|
+
const os = 65571, lu = 161083277, uu = 317031266, du = 1093174542, hu = 1970024675, fu = 2481928696, pu = 2762891795, mu = 3282782683;
|
|
2683
|
+
function Eu(t) {
|
|
2684
2684
|
const e = {};
|
|
2685
2685
|
return as(e), e;
|
|
2686
2686
|
}
|
|
@@ -2692,7 +2692,7 @@ function Iu(t, e) {
|
|
|
2692
2692
|
return _u(n, e);
|
|
2693
2693
|
}
|
|
2694
2694
|
function _u(t, e) {
|
|
2695
|
-
const n = e ??
|
|
2695
|
+
const n = e ?? Eu();
|
|
2696
2696
|
return as(n), Tu(t, n), n;
|
|
2697
2697
|
}
|
|
2698
2698
|
function Tu(t, e) {
|
|
@@ -2729,7 +2729,7 @@ function Tu(t, e) {
|
|
|
2729
2729
|
e.TrackIndex = n.asInt32();
|
|
2730
2730
|
break;
|
|
2731
2731
|
}
|
|
2732
|
-
case
|
|
2732
|
+
case mu: {
|
|
2733
2733
|
if (n.isNull) throw new Error();
|
|
2734
2734
|
e.SourceType = n.asString();
|
|
2735
2735
|
break;
|
|
@@ -2737,7 +2737,7 @@ function Tu(t, e) {
|
|
|
2737
2737
|
}
|
|
2738
2738
|
}
|
|
2739
2739
|
function wu(t, e) {
|
|
2740
|
-
const n =
|
|
2740
|
+
const n = ce(t, os);
|
|
2741
2741
|
return Iu(n, e);
|
|
2742
2742
|
}
|
|
2743
2743
|
class St extends Error {
|
|
@@ -2770,17 +2770,17 @@ class gu extends D {
|
|
|
2770
2770
|
super(`Channel provisioning timeout after ${e}ms`), this.name = "ProvisioningTimeoutError";
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
|
-
class
|
|
2773
|
+
class Tf extends D {
|
|
2774
2774
|
constructor(e) {
|
|
2775
2775
|
super(`Channel not found: ${e}`), this.name = "ChannelNotFoundError";
|
|
2776
2776
|
}
|
|
2777
2777
|
}
|
|
2778
|
-
class
|
|
2778
|
+
class wf extends D {
|
|
2779
2779
|
constructor(e) {
|
|
2780
2780
|
super(`Space not found for domain: ${e}`), this.name = "SpaceNotFoundError";
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
|
-
class
|
|
2783
|
+
class Sf extends D {
|
|
2784
2784
|
constructor() {
|
|
2785
2785
|
super("No channels available in this space"), this.name = "NoChannelsError";
|
|
2786
2786
|
}
|
|
@@ -2799,22 +2799,22 @@ function cs(t, e) {
|
|
|
2799
2799
|
e?.addEventListener("abort", s, { once: !0 });
|
|
2800
2800
|
});
|
|
2801
2801
|
}
|
|
2802
|
-
var
|
|
2803
|
-
let Ct = 1,
|
|
2802
|
+
var He = /* @__PURE__ */ ((t) => (t[t.DEBUG = 0] = "DEBUG", t[t.INFO = 1] = "INFO", t[t.WARN = 2] = "WARN", t[t.ERROR = 3] = "ERROR", t[t.NONE = 4] = "NONE", t))(He || {});
|
|
2803
|
+
let Ct = 1, Be = null;
|
|
2804
2804
|
const tt = /* @__PURE__ */ new Map();
|
|
2805
2805
|
function ls(t) {
|
|
2806
2806
|
Ct = t;
|
|
2807
2807
|
}
|
|
2808
|
-
function
|
|
2808
|
+
function gf() {
|
|
2809
2809
|
return Ct;
|
|
2810
2810
|
}
|
|
2811
2811
|
function Cu(t) {
|
|
2812
|
-
|
|
2812
|
+
Be = t;
|
|
2813
2813
|
}
|
|
2814
|
-
function
|
|
2815
|
-
return
|
|
2814
|
+
function Cf() {
|
|
2815
|
+
return Be;
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2817
|
+
function yf(t, e) {
|
|
2818
2818
|
return tt.set(t, e ?? {
|
|
2819
2819
|
minLevel: 2
|
|
2820
2820
|
/* WARN */
|
|
@@ -2832,7 +2832,7 @@ const yu = {
|
|
|
2832
2832
|
function Au(t, e) {
|
|
2833
2833
|
return `[${t}] ${e}`;
|
|
2834
2834
|
}
|
|
2835
|
-
function
|
|
2835
|
+
function be(t, e, n, r) {
|
|
2836
2836
|
const s = (/* @__PURE__ */ new Date()).toISOString(), i = yu[t], o = {
|
|
2837
2837
|
timestamp: s,
|
|
2838
2838
|
level: t,
|
|
@@ -2841,7 +2841,7 @@ function Re(t, e, n, r) {
|
|
|
2841
2841
|
message: n,
|
|
2842
2842
|
args: r
|
|
2843
2843
|
};
|
|
2844
|
-
|
|
2844
|
+
Be && Be(o);
|
|
2845
2845
|
for (const [a, c] of tt) {
|
|
2846
2846
|
const l = c?.minLevel ?? 2;
|
|
2847
2847
|
if (t >= l)
|
|
@@ -2868,23 +2868,23 @@ function Re(t, e, n, r) {
|
|
|
2868
2868
|
}
|
|
2869
2869
|
}
|
|
2870
2870
|
}
|
|
2871
|
-
function
|
|
2871
|
+
function L(t) {
|
|
2872
2872
|
return {
|
|
2873
2873
|
debug(e, ...n) {
|
|
2874
|
-
|
|
2874
|
+
be(0, t, e, n);
|
|
2875
2875
|
},
|
|
2876
2876
|
info(e, ...n) {
|
|
2877
|
-
|
|
2877
|
+
be(1, t, e, n);
|
|
2878
2878
|
},
|
|
2879
2879
|
warn(e, ...n) {
|
|
2880
|
-
|
|
2880
|
+
be(2, t, e, n);
|
|
2881
2881
|
},
|
|
2882
2882
|
error(e, ...n) {
|
|
2883
|
-
|
|
2883
|
+
be(3, t, e, n);
|
|
2884
2884
|
}
|
|
2885
2885
|
};
|
|
2886
2886
|
}
|
|
2887
|
-
const
|
|
2887
|
+
const Ne = L("WebSocketTransport"), Ru = 1e4;
|
|
2888
2888
|
class bu {
|
|
2889
2889
|
ws = null;
|
|
2890
2890
|
keepaliveTimeout = null;
|
|
@@ -2917,7 +2917,7 @@ class bu {
|
|
|
2917
2917
|
this.ws.onopen = () => {
|
|
2918
2918
|
i = !0, clearTimeout(c), this.ws.send(n), this.resetKeepaliveTimeout(), o || (o = !0, r());
|
|
2919
2919
|
}, this.ws.onerror = () => {
|
|
2920
|
-
clearTimeout(c),
|
|
2920
|
+
clearTimeout(c), Ne.error("WebSocket error"), o || (o = !0, a(), s(new Z("WebSocket connection failed")));
|
|
2921
2921
|
}, this.ws.onclose = (l) => {
|
|
2922
2922
|
if (this.clearKeepaliveTimeout(), !i && !o) {
|
|
2923
2923
|
o = !0, a(), s(new Z("WebSocket connection closed before opening"));
|
|
@@ -2925,15 +2925,15 @@ class bu {
|
|
|
2925
2925
|
}
|
|
2926
2926
|
if (this.isClosed)
|
|
2927
2927
|
return;
|
|
2928
|
-
const
|
|
2929
|
-
this.callbacks.onClose(d,
|
|
2928
|
+
const f = l.wasClean && (l.code === 1e3 || l.code === 1001), p = l.code === 1e3 || l.code === 1001, d = l.reason || `code=${l.code}`;
|
|
2929
|
+
this.callbacks.onClose(d, f, p);
|
|
2930
2930
|
}, this.ws.onmessage = (l) => {
|
|
2931
2931
|
this.handleProtocolMessage(new Uint8Array(l.data));
|
|
2932
2932
|
};
|
|
2933
2933
|
});
|
|
2934
2934
|
}
|
|
2935
2935
|
send(e) {
|
|
2936
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) :
|
|
2936
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : Ne.warn("Cannot send: WebSocket not connected");
|
|
2937
2937
|
}
|
|
2938
2938
|
close() {
|
|
2939
2939
|
this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -2946,25 +2946,25 @@ class bu {
|
|
|
2946
2946
|
}
|
|
2947
2947
|
handleProtocolMessage(e) {
|
|
2948
2948
|
try {
|
|
2949
|
-
if (
|
|
2949
|
+
if (ae(e).opcode === g.KEEPALIVE_REQUEST) {
|
|
2950
2950
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
2951
2951
|
return;
|
|
2952
2952
|
}
|
|
2953
2953
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
2954
2954
|
} catch (n) {
|
|
2955
|
-
|
|
2955
|
+
Ne.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
|
|
2956
2956
|
}
|
|
2957
2957
|
}
|
|
2958
2958
|
resetKeepaliveTimeout() {
|
|
2959
2959
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
2960
|
-
|
|
2960
|
+
Ne.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new gt(this.keepaliveTimeoutMs)), this.close();
|
|
2961
2961
|
}, this.keepaliveTimeoutMs);
|
|
2962
2962
|
}
|
|
2963
2963
|
clearKeepaliveTimeout() {
|
|
2964
2964
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
const Y =
|
|
2967
|
+
const Y = L("WebTransportTransport"), Bt = 4, Nu = 65536;
|
|
2968
2968
|
function us() {
|
|
2969
2969
|
return typeof WebTransport < "u";
|
|
2970
2970
|
}
|
|
@@ -3091,7 +3091,7 @@ class ku {
|
|
|
3091
3091
|
*/
|
|
3092
3092
|
handleProtocolMessage(e) {
|
|
3093
3093
|
try {
|
|
3094
|
-
if (
|
|
3094
|
+
if (ae(e).opcode === g.KEEPALIVE_REQUEST) {
|
|
3095
3095
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
3096
3096
|
return;
|
|
3097
3097
|
}
|
|
@@ -3133,7 +3133,7 @@ class ku {
|
|
|
3133
3133
|
}
|
|
3134
3134
|
}
|
|
3135
3135
|
}
|
|
3136
|
-
const
|
|
3136
|
+
const me = L("Channel");
|
|
3137
3137
|
class Du {
|
|
3138
3138
|
state = "disconnected";
|
|
3139
3139
|
transport = null;
|
|
@@ -3176,7 +3176,7 @@ class Du {
|
|
|
3176
3176
|
try {
|
|
3177
3177
|
await this.connectTransport(), this.setState("connected");
|
|
3178
3178
|
} catch (e) {
|
|
3179
|
-
throw
|
|
3179
|
+
throw me.error("Channel connection failed:", e), this.setState("disconnected"), e;
|
|
3180
3180
|
}
|
|
3181
3181
|
}
|
|
3182
3182
|
/**
|
|
@@ -3197,7 +3197,7 @@ class Du {
|
|
|
3197
3197
|
*/
|
|
3198
3198
|
send(e) {
|
|
3199
3199
|
if (!this.transport?.isConnected) {
|
|
3200
|
-
|
|
3200
|
+
me.warn("Cannot send: channel not connected");
|
|
3201
3201
|
return;
|
|
3202
3202
|
}
|
|
3203
3203
|
this.transport.send(e);
|
|
@@ -3237,13 +3237,13 @@ class Du {
|
|
|
3237
3237
|
handleProtocolMessage(e) {
|
|
3238
3238
|
try {
|
|
3239
3239
|
const n = e;
|
|
3240
|
-
if (
|
|
3241
|
-
|
|
3240
|
+
if (Se(n) === g.CORE_ON_SERVER_STOPPING) {
|
|
3241
|
+
me.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
3242
3242
|
return;
|
|
3243
3243
|
}
|
|
3244
3244
|
this.config.onProtocolMessage?.(n);
|
|
3245
3245
|
} catch (n) {
|
|
3246
|
-
|
|
3246
|
+
me.error("Failed to handle protocol message:", n), this.config.onError?.(n instanceof Error ? n : new Error(String(n)));
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
3249
|
/**
|
|
@@ -3256,7 +3256,7 @@ class Du {
|
|
|
3256
3256
|
* Handle transport error.
|
|
3257
3257
|
*/
|
|
3258
3258
|
handleError(e) {
|
|
3259
|
-
|
|
3259
|
+
me.error("Channel error:", e), this.config.onError?.(e), e instanceof gt && this.handleClose("Keepalive timeout", !1);
|
|
3260
3260
|
}
|
|
3261
3261
|
/**
|
|
3262
3262
|
* Update and notify state change.
|
|
@@ -3265,7 +3265,7 @@ class Du {
|
|
|
3265
3265
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
3266
3266
|
}
|
|
3267
3267
|
}
|
|
3268
|
-
const M =
|
|
3268
|
+
const M = L("ChannelManager");
|
|
3269
3269
|
class vu {
|
|
3270
3270
|
channels = /* @__PURE__ */ new Map();
|
|
3271
3271
|
// keyed by opcode group
|
|
@@ -3297,10 +3297,14 @@ class vu {
|
|
|
3297
3297
|
/**
|
|
3298
3298
|
* Connect to the server using the provided entrypoints.
|
|
3299
3299
|
*/
|
|
3300
|
-
async connect(e) {
|
|
3300
|
+
async connect(e, n) {
|
|
3301
3301
|
if (this.state !== "idle" && this.state !== "offline")
|
|
3302
3302
|
throw new Error(`Cannot connect: already in state ${this.state}`);
|
|
3303
|
-
this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.demotedTypes.clear(), this.connectionStable = !1, this.abortController = new AbortController(),
|
|
3303
|
+
if (this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.demotedTypes.clear(), this.connectionStable = !1, this.abortController = new AbortController(), n?.retry) {
|
|
3304
|
+
this.attemptReconnect();
|
|
3305
|
+
return;
|
|
3306
|
+
}
|
|
3307
|
+
await this.connectInternal();
|
|
3304
3308
|
}
|
|
3305
3309
|
/**
|
|
3306
3310
|
* Disconnect all channels.
|
|
@@ -3313,7 +3317,7 @@ class vu {
|
|
|
3313
3317
|
* The opcode group is extracted from the message automatically.
|
|
3314
3318
|
*/
|
|
3315
3319
|
sendProtocolMessage(e) {
|
|
3316
|
-
const n =
|
|
3320
|
+
const n = Me(e);
|
|
3317
3321
|
for (const [r, s] of this.channels)
|
|
3318
3322
|
if (r & n) {
|
|
3319
3323
|
s.send(e);
|
|
@@ -3496,7 +3500,7 @@ class vu {
|
|
|
3496
3500
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
3497
3501
|
}
|
|
3498
3502
|
}
|
|
3499
|
-
const
|
|
3503
|
+
const Af = "opus", Rf = 48e3, bf = 2, Nf = 64e3, Uu = 150, kf = "VP8", Ou = 5e6, Df = 30, Mu = 0.05, Pu = "max-bundle", Lu = "require", Fu = [], Bu = 16, xu = 16, Wu = "ikon-data", Gu = !1, Vu = 0, G = L("WebRTCConnection");
|
|
3500
3504
|
class Hu {
|
|
3501
3505
|
pc = null;
|
|
3502
3506
|
dataChannel = null;
|
|
@@ -3522,8 +3526,8 @@ class Hu {
|
|
|
3522
3526
|
const e = Fu;
|
|
3523
3527
|
if (this.pc = new RTCPeerConnection({
|
|
3524
3528
|
iceServers: e,
|
|
3525
|
-
bundlePolicy:
|
|
3526
|
-
rtcpMuxPolicy:
|
|
3529
|
+
bundlePolicy: Pu,
|
|
3530
|
+
rtcpMuxPolicy: Lu
|
|
3527
3531
|
}), this.setupEventHandlers(), this.config.useAudioTrack)
|
|
3528
3532
|
for (let n = 0; n < Bu; n++)
|
|
3529
3533
|
this.pc.addTransceiver("audio", { direction: "sendrecv" });
|
|
@@ -3655,7 +3659,7 @@ class Hu {
|
|
|
3655
3659
|
this._state !== e && (this._state = e, this.config.onStateChange?.(e));
|
|
3656
3660
|
}
|
|
3657
3661
|
}
|
|
3658
|
-
const A =
|
|
3662
|
+
const A = L("WebRTCSignaling");
|
|
3659
3663
|
class $u {
|
|
3660
3664
|
config;
|
|
3661
3665
|
connection = null;
|
|
@@ -3709,7 +3713,7 @@ class $u {
|
|
|
3709
3713
|
}
|
|
3710
3714
|
handleProtocolMessage(e) {
|
|
3711
3715
|
const n = (e instanceof Uint8Array, e), r = n;
|
|
3712
|
-
switch (
|
|
3716
|
+
switch (Se(r)) {
|
|
3713
3717
|
case zr:
|
|
3714
3718
|
return this.handleAnswer(r), !0;
|
|
3715
3719
|
case wt:
|
|
@@ -3747,7 +3751,7 @@ class $u {
|
|
|
3747
3751
|
}
|
|
3748
3752
|
const e = this.audioCaptureStream?.getAudioTracks()[0];
|
|
3749
3753
|
e && (e.enabled = !0);
|
|
3750
|
-
const n =
|
|
3754
|
+
const n = Lt({ IsStart: !0 }), r = Ft(n, this.config.sessionId);
|
|
3751
3755
|
this.sendMessage(r), A.debug("Started audio segment");
|
|
3752
3756
|
}
|
|
3753
3757
|
endAudioSegment() {
|
|
@@ -3755,7 +3759,7 @@ class $u {
|
|
|
3755
3759
|
A.warn("Cannot end audio segment: no send function");
|
|
3756
3760
|
return;
|
|
3757
3761
|
}
|
|
3758
|
-
const e =
|
|
3762
|
+
const e = Lt({ IsStart: !1 }), n = Ft(e, this.config.sessionId);
|
|
3759
3763
|
this.sendMessage(n);
|
|
3760
3764
|
const r = this.audioCaptureStream?.getAudioTracks()[0];
|
|
3761
3765
|
r && (r.enabled = !1), A.debug("Ended audio segment");
|
|
@@ -3886,19 +3890,19 @@ class $u {
|
|
|
3886
3890
|
}
|
|
3887
3891
|
}
|
|
3888
3892
|
}
|
|
3889
|
-
const Ku = 5e3, Yu = 3e4, xt = 15e3, Wt = 2e3, Gt = 2, ds = 6e4,
|
|
3893
|
+
const Ku = 5e3, Yu = 3e4, xt = 15e3, Wt = 2e3, Gt = 2, ds = 6e4, ge = "ikon.theme", Ce = "ikon.theme-user", ju = "ikon.theme-change";
|
|
3890
3894
|
function nt(t) {
|
|
3891
3895
|
typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", t);
|
|
3892
3896
|
}
|
|
3893
3897
|
function hs() {
|
|
3894
3898
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3895
3899
|
}
|
|
3896
|
-
function
|
|
3900
|
+
function $e() {
|
|
3897
3901
|
if (typeof window > "u" || !window.localStorage)
|
|
3898
3902
|
return "light";
|
|
3899
|
-
const t = window.localStorage.getItem(
|
|
3903
|
+
const t = window.localStorage.getItem(Ce);
|
|
3900
3904
|
if (t) return t;
|
|
3901
|
-
const e = window.localStorage.getItem(
|
|
3905
|
+
const e = window.localStorage.getItem(ge);
|
|
3902
3906
|
return e || hs();
|
|
3903
3907
|
}
|
|
3904
3908
|
function yt() {
|
|
@@ -3907,13 +3911,13 @@ function yt() {
|
|
|
3907
3911
|
function zu() {
|
|
3908
3912
|
if (typeof window > "u" || !window.localStorage)
|
|
3909
3913
|
return "light";
|
|
3910
|
-
const t = window.localStorage.getItem(
|
|
3914
|
+
const t = window.localStorage.getItem(Ce), e = window.localStorage.getItem(ge);
|
|
3911
3915
|
if (t || e) {
|
|
3912
3916
|
const r = t ?? e;
|
|
3913
3917
|
return nt(r), r;
|
|
3914
3918
|
}
|
|
3915
3919
|
const n = hs();
|
|
3916
|
-
return window.localStorage.setItem(
|
|
3920
|
+
return window.localStorage.setItem(ge, n), nt(n), n;
|
|
3917
3921
|
}
|
|
3918
3922
|
const Xu = {
|
|
3919
3923
|
name: "ikon.client.getTheme",
|
|
@@ -3923,7 +3927,7 @@ const Xu = {
|
|
|
3923
3927
|
function Ju() {
|
|
3924
3928
|
if (typeof window > "u" || !window.localStorage)
|
|
3925
3929
|
return null;
|
|
3926
|
-
const t = window.localStorage.getItem(
|
|
3930
|
+
const t = window.localStorage.getItem(Ce), e = window.localStorage.getItem(ge);
|
|
3927
3931
|
return t ?? e ?? null;
|
|
3928
3932
|
}
|
|
3929
3933
|
const Qu = {
|
|
@@ -3942,7 +3946,7 @@ function Zu(t, e) {
|
|
|
3942
3946
|
if (!n)
|
|
3943
3947
|
return !1;
|
|
3944
3948
|
const r = e === void 0 ? !0 : !!e, s = window.localStorage;
|
|
3945
|
-
r ? s.setItem(
|
|
3949
|
+
r ? s.setItem(Ce, n) : s.removeItem(Ce), s.setItem(ge, n);
|
|
3946
3950
|
try {
|
|
3947
3951
|
window.dispatchEvent(new CustomEvent(ju, { detail: { mode: n } }));
|
|
3948
3952
|
} catch {
|
|
@@ -3983,9 +3987,9 @@ function Rt() {
|
|
|
3983
3987
|
}
|
|
3984
3988
|
function bt() {
|
|
3985
3989
|
if (typeof navigator > "u" || typeof window > "u")
|
|
3986
|
-
return
|
|
3990
|
+
return ne.Unknown;
|
|
3987
3991
|
const t = navigator.maxTouchPoints > 0, e = window.innerWidth <= 1024;
|
|
3988
|
-
return t && e ?
|
|
3992
|
+
return t && e ? ne.MobileWeb : ne.DesktopWeb;
|
|
3989
3993
|
}
|
|
3990
3994
|
const rd = {
|
|
3991
3995
|
name: "ikon.client.getUrl",
|
|
@@ -4034,7 +4038,7 @@ function cd(t) {
|
|
|
4034
4038
|
return !1;
|
|
4035
4039
|
}
|
|
4036
4040
|
}
|
|
4037
|
-
let Q = null, rt = !1,
|
|
4041
|
+
let Q = null, rt = !1, ke = !1;
|
|
4038
4042
|
async function ld() {
|
|
4039
4043
|
if (!(typeof navigator > "u" || !("wakeLock" in navigator)))
|
|
4040
4044
|
try {
|
|
@@ -4055,7 +4059,7 @@ async function dd(t) {
|
|
|
4055
4059
|
if (typeof navigator > "u" || !("wakeLock" in navigator))
|
|
4056
4060
|
return !1;
|
|
4057
4061
|
try {
|
|
4058
|
-
return !!t ? (rt = !0, Q || (Q = await navigator.wakeLock.request("screen")),
|
|
4062
|
+
return !!t ? (rt = !0, Q || (Q = await navigator.wakeLock.request("screen")), ke || (document.addEventListener("visibilitychange", Vt), ke = !0)) : (rt = !1, ke && (document.removeEventListener("visibilitychange", Vt), ke = !1), Q && (await Q.release(), Q = null)), !0;
|
|
4059
4063
|
} catch {
|
|
4060
4064
|
return !1;
|
|
4061
4065
|
}
|
|
@@ -4078,7 +4082,7 @@ const pd = {
|
|
|
4078
4082
|
{ name: "smooth", type: { kind: "boolean", nullable: !0 }, description: "Whether to animate the scroll" }
|
|
4079
4083
|
]
|
|
4080
4084
|
};
|
|
4081
|
-
function
|
|
4085
|
+
function md(t, e, n) {
|
|
4082
4086
|
if (typeof window > "u" || typeof t != "number" || typeof e != "number")
|
|
4083
4087
|
return !1;
|
|
4084
4088
|
try {
|
|
@@ -4091,7 +4095,7 @@ function Ed(t, e, n) {
|
|
|
4091
4095
|
return !1;
|
|
4092
4096
|
}
|
|
4093
4097
|
}
|
|
4094
|
-
const
|
|
4098
|
+
const Ed = {
|
|
4095
4099
|
name: "ikon.client.getBatteryLevel",
|
|
4096
4100
|
description: "Get the current battery level (0-100)",
|
|
4097
4101
|
returnType: { kind: "number", nullable: !0 }
|
|
@@ -4157,8 +4161,8 @@ const yd = [
|
|
|
4157
4161
|
{ definition: ad, handler: cd },
|
|
4158
4162
|
{ definition: ud, handler: dd },
|
|
4159
4163
|
{ definition: hd, handler: fd },
|
|
4160
|
-
{ definition: pd, handler:
|
|
4161
|
-
{ definition:
|
|
4164
|
+
{ definition: pd, handler: md },
|
|
4165
|
+
{ definition: Ed, handler: Id },
|
|
4162
4166
|
{ definition: _d, handler: Td },
|
|
4163
4167
|
{ definition: wd, handler: Sd },
|
|
4164
4168
|
{ definition: gd, handler: Cd }
|
|
@@ -4171,7 +4175,7 @@ function je() {
|
|
|
4171
4175
|
return typeof window < "u" && typeof navigator < "u";
|
|
4172
4176
|
}
|
|
4173
4177
|
const st = "ikon_device_id";
|
|
4174
|
-
function
|
|
4178
|
+
function Ke() {
|
|
4175
4179
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
4176
4180
|
return crypto.randomUUID();
|
|
4177
4181
|
try {
|
|
@@ -4181,7 +4185,7 @@ function $e() {
|
|
|
4181
4185
|
return crypto.randomUUID();
|
|
4182
4186
|
}
|
|
4183
4187
|
}
|
|
4184
|
-
function
|
|
4188
|
+
function vf() {
|
|
4185
4189
|
if (!(typeof localStorage > "u"))
|
|
4186
4190
|
try {
|
|
4187
4191
|
localStorage.removeItem(st);
|
|
@@ -4196,26 +4200,26 @@ function Rd(t) {
|
|
|
4196
4200
|
return null;
|
|
4197
4201
|
}
|
|
4198
4202
|
}
|
|
4199
|
-
const
|
|
4203
|
+
const xe = {}, it = "https://api.prod.ikon.live", ot = "https://api.dev.ikon.live", Ht = "https://auth.ikonai.com", $t = "https://auth.dev.ikonai.com", Uf = "https://auth.ikonai.com";
|
|
4200
4204
|
function fs(t) {
|
|
4201
4205
|
return t === "development" ? ot : it;
|
|
4202
4206
|
}
|
|
4203
4207
|
function bd() {
|
|
4204
|
-
const t = typeof import.meta < "u" ?
|
|
4208
|
+
const t = typeof import.meta < "u" ? xe?.VITE_IKON_BACKEND_URL : void 0;
|
|
4205
4209
|
return t || (typeof window > "u" ? it : !Nt() || window.location.hostname.includes(".dev.") ? ot : it);
|
|
4206
4210
|
}
|
|
4207
|
-
function
|
|
4208
|
-
const t = typeof import.meta < "u" ?
|
|
4211
|
+
function Of() {
|
|
4212
|
+
const t = typeof import.meta < "u" ? xe?.VITE_IKON_BACKEND_TYPE : void 0;
|
|
4209
4213
|
if (t === "development" || t === "production")
|
|
4210
4214
|
return t;
|
|
4211
|
-
const e = typeof import.meta < "u" ?
|
|
4215
|
+
const e = typeof import.meta < "u" ? xe?.VITE_IKON_BACKEND_URL : void 0;
|
|
4212
4216
|
return e ? e.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : Nt() ? window.location.hostname.includes(".dev.") ? "development" : "production" : "development";
|
|
4213
4217
|
}
|
|
4214
4218
|
function Nd() {
|
|
4215
|
-
const t = typeof import.meta < "u" ?
|
|
4219
|
+
const t = typeof import.meta < "u" ? xe?.VITE_IKON_AUTH_URL : void 0;
|
|
4216
4220
|
return t || (typeof window > "u" ? Ht : !Nt() || window.location.hostname.includes(".dev.") ? $t : Ht);
|
|
4217
4221
|
}
|
|
4218
|
-
function
|
|
4222
|
+
function Ye() {
|
|
4219
4223
|
if (typeof window > "u")
|
|
4220
4224
|
return {};
|
|
4221
4225
|
const t = new URLSearchParams(window.location.search), e = {};
|
|
@@ -4224,7 +4228,7 @@ function Ke() {
|
|
|
4224
4228
|
return e;
|
|
4225
4229
|
}
|
|
4226
4230
|
const kd = ["ikon_token", "ikon_provider", "error"];
|
|
4227
|
-
function
|
|
4231
|
+
function Mf() {
|
|
4228
4232
|
if (typeof window > "u")
|
|
4229
4233
|
return { parameters: {} };
|
|
4230
4234
|
const t = window.location.pathname;
|
|
@@ -4234,7 +4238,7 @@ function Nf() {
|
|
|
4234
4238
|
const s = t.match(/^\/c\/([^/]+)/);
|
|
4235
4239
|
if (s && (n = decodeURIComponent(s[1])), e && n)
|
|
4236
4240
|
throw new Error("URL cannot contain both /s/[sessionId] and /c/[channelKey]");
|
|
4237
|
-
const i =
|
|
4241
|
+
const i = Ye(), o = {};
|
|
4238
4242
|
for (const [a, c] of Object.entries(i))
|
|
4239
4243
|
kd.includes(a) || (o[a] = c);
|
|
4240
4244
|
return { sessionId: e, channelKey: n, parameters: o };
|
|
@@ -4254,7 +4258,7 @@ function Nt() {
|
|
|
4254
4258
|
function kt() {
|
|
4255
4259
|
return typeof window > "u" ? "" : window.location.pathname.replace(/^\/(s|c)\/[^/]+/, "") || "/";
|
|
4256
4260
|
}
|
|
4257
|
-
function
|
|
4261
|
+
function Pf() {
|
|
4258
4262
|
if (typeof window > "u") return;
|
|
4259
4263
|
const t = window.location.pathname, e = t.match(/^\/s\/[^/]+/), n = t.match(/^\/c\/[^/]+/);
|
|
4260
4264
|
if (e || n) {
|
|
@@ -4262,7 +4266,7 @@ function kf() {
|
|
|
4262
4266
|
window.history.replaceState(null, "", r + window.location.search);
|
|
4263
4267
|
}
|
|
4264
4268
|
}
|
|
4265
|
-
const ee =
|
|
4269
|
+
const ee = L("Authenticator"), ie = g.GROUP_CORE | g.GROUP_KEEPALIVE | g.GROUP_EVENTS | g.GROUP_ACTIONS | g.GROUP_UI | g.GROUP_AUDIO | g.GROUP_VIDEO | g.GROUP_ANALYTICS, Dd = 1e3, vd = 5e3;
|
|
4266
4270
|
async function Ud(t, e, n, r) {
|
|
4267
4271
|
if (t)
|
|
4268
4272
|
try {
|
|
@@ -4307,7 +4311,7 @@ function ps(t, e, n) {
|
|
|
4307
4311
|
};
|
|
4308
4312
|
return e || (r.credentials = "include"), r;
|
|
4309
4313
|
}
|
|
4310
|
-
async function
|
|
4314
|
+
async function ms(t, e, n, r, s, i, o) {
|
|
4311
4315
|
const a = `${t}/rooms`, c = {
|
|
4312
4316
|
space: e,
|
|
4313
4317
|
...n ? { key: n } : {},
|
|
@@ -4315,8 +4319,8 @@ async function Es(t, e, n, r, s, i, o) {
|
|
|
4315
4319
|
...s ? { hash: s } : {}
|
|
4316
4320
|
}, l = await fetch(a, ps(c, i, o));
|
|
4317
4321
|
if (!l.ok) {
|
|
4318
|
-
const
|
|
4319
|
-
throw new D(`Failed to request channel: ${l.status} ${
|
|
4322
|
+
const p = await l.text().catch(() => "Unknown error");
|
|
4323
|
+
throw new D(`Failed to request channel: ${l.status} ${p}`);
|
|
4320
4324
|
}
|
|
4321
4325
|
return await l.json();
|
|
4322
4326
|
}
|
|
@@ -4328,7 +4332,7 @@ async function Md(t, e, n, r) {
|
|
|
4328
4332
|
}
|
|
4329
4333
|
return i.json();
|
|
4330
4334
|
}
|
|
4331
|
-
async function
|
|
4335
|
+
async function Es(t, e, n, r, s) {
|
|
4332
4336
|
const i = Date.now();
|
|
4333
4337
|
let o = Dd;
|
|
4334
4338
|
for (; ; ) {
|
|
@@ -4346,7 +4350,7 @@ async function ms(t, e, n, r, s) {
|
|
|
4346
4350
|
throw new D(`Unexpected channel state: ${c.state}`);
|
|
4347
4351
|
}
|
|
4348
4352
|
}
|
|
4349
|
-
async function
|
|
4353
|
+
async function We(t, e) {
|
|
4350
4354
|
const n = await fetch(t, { signal: e });
|
|
4351
4355
|
if (!n.ok) {
|
|
4352
4356
|
const o = await n.text().catch(() => "Unknown error");
|
|
@@ -4362,31 +4366,31 @@ async function Is(t, e, n, r, s) {
|
|
|
4362
4366
|
let o;
|
|
4363
4367
|
for (const a of i)
|
|
4364
4368
|
try {
|
|
4365
|
-
const c = await
|
|
4369
|
+
const c = await We(a.url, s);
|
|
4366
4370
|
return c.usedProxyUrl = a.isProxy, c;
|
|
4367
4371
|
} catch (c) {
|
|
4368
4372
|
o = c, ee.warn(`Auth via ${a.isProxy ? "proxy" : "direct"} URL failed: ${c}`);
|
|
4369
4373
|
}
|
|
4370
4374
|
throw o ?? new D("All authentication attempts failed");
|
|
4371
4375
|
}
|
|
4372
|
-
function
|
|
4376
|
+
function Pd(t, e) {
|
|
4373
4377
|
const n = yt();
|
|
4374
4378
|
return Uo({
|
|
4375
4379
|
ServerSessionId: "",
|
|
4376
4380
|
// Server will fill this in
|
|
4377
|
-
ContextType:
|
|
4378
|
-
UserType:
|
|
4379
|
-
PayloadType:
|
|
4381
|
+
ContextType: ue.Browser,
|
|
4382
|
+
UserType: he.Human,
|
|
4383
|
+
PayloadType: de.Teleport,
|
|
4380
4384
|
IsInternal: !1,
|
|
4381
4385
|
Description: t.description ?? "Ikon SDK TypeScript",
|
|
4382
4386
|
UserId: e,
|
|
4383
|
-
DeviceId: t.deviceId ??
|
|
4387
|
+
DeviceId: t.deviceId ?? Ke(),
|
|
4384
4388
|
ProductId: t.productId ?? "ikon-sdk",
|
|
4385
4389
|
VersionId: t.versionId ?? "1.0.0",
|
|
4386
4390
|
InstallId: t.installId ?? "",
|
|
4387
4391
|
Locale: t.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4388
|
-
OpcodeGroupsFromServer: t.opcodeGroupsFromServer ??
|
|
4389
|
-
OpcodeGroupsToServer: t.opcodeGroupsToServer ??
|
|
4392
|
+
OpcodeGroupsFromServer: t.opcodeGroupsFromServer ?? ie,
|
|
4393
|
+
OpcodeGroupsToServer: t.opcodeGroupsToServer ?? ie,
|
|
4390
4394
|
ProtocolVersion: 1,
|
|
4391
4395
|
HasInput: !1,
|
|
4392
4396
|
ChannelLocale: "",
|
|
@@ -4398,13 +4402,13 @@ function Ld(t, e) {
|
|
|
4398
4402
|
Parameters: t.parameters ?? {},
|
|
4399
4403
|
ViewportWidth: n.width,
|
|
4400
4404
|
ViewportHeight: n.height,
|
|
4401
|
-
Theme:
|
|
4405
|
+
Theme: $e(),
|
|
4402
4406
|
Timezone: At(),
|
|
4403
4407
|
IsTouchDevice: Rt(),
|
|
4404
4408
|
InitialPath: kt()
|
|
4405
4409
|
});
|
|
4406
4410
|
}
|
|
4407
|
-
function
|
|
4411
|
+
function Ld(t) {
|
|
4408
4412
|
return {
|
|
4409
4413
|
ServerSessionId: t.ServerSessionId,
|
|
4410
4414
|
ContextType: t.ContextType,
|
|
@@ -4440,14 +4444,14 @@ function Pd(t) {
|
|
|
4440
4444
|
async function Fd(t, e) {
|
|
4441
4445
|
const n = `https://${t.host}:${t.httpsPort}`;
|
|
4442
4446
|
ee.debug(`Authenticating with local server: ${n}`);
|
|
4443
|
-
const s = { ...
|
|
4447
|
+
const s = { ...Ye(), ...t.parameters }, i = t.deviceId ?? Ke();
|
|
4444
4448
|
let o = t.userId, a = t.token;
|
|
4445
4449
|
if (!o) {
|
|
4446
|
-
const
|
|
4447
|
-
|
|
4450
|
+
const S = await Ud(t.spaceId, i, Nd(), e);
|
|
4451
|
+
S && (o = S.userId, a = S.token);
|
|
4448
4452
|
}
|
|
4449
4453
|
o || (o = i, ee.debug("Using deviceId as userId fallback")), t.spaceId && a && await Od(bd(), t.spaceId, a, e);
|
|
4450
|
-
const c =
|
|
4454
|
+
const c = Pd({ ...t, parameters: s }, o), l = Ld(c), f = await fetch(`${n}/connect-token`, {
|
|
4451
4455
|
method: "POST",
|
|
4452
4456
|
headers: {
|
|
4453
4457
|
"Content-Type": "application/json"
|
|
@@ -4455,15 +4459,15 @@ async function Fd(t, e) {
|
|
|
4455
4459
|
body: JSON.stringify(l),
|
|
4456
4460
|
signal: e
|
|
4457
4461
|
});
|
|
4458
|
-
if (!
|
|
4459
|
-
const
|
|
4460
|
-
throw new D(`Failed to get connect token: ${
|
|
4462
|
+
if (!f.ok) {
|
|
4463
|
+
const S = await f.text().catch(() => "Unknown error");
|
|
4464
|
+
throw new D(`Failed to get connect token: ${f.status} ${S}`);
|
|
4461
4465
|
}
|
|
4462
|
-
const d = (await
|
|
4466
|
+
const d = (await f.json()).token;
|
|
4463
4467
|
if (!d)
|
|
4464
4468
|
throw new D("Server did not return a token");
|
|
4465
|
-
const
|
|
4466
|
-
return
|
|
4469
|
+
const m = `${n}/connect?token=${encodeURIComponent(d)}`;
|
|
4470
|
+
return We(m, e);
|
|
4467
4471
|
}
|
|
4468
4472
|
async function Bd(t, e, n = "auto", r = !1) {
|
|
4469
4473
|
if (t.sessionId && t.channelKey)
|
|
@@ -4483,8 +4487,8 @@ async function Bd(t, e, n = "auto", r = !1) {
|
|
|
4483
4487
|
signal: e
|
|
4484
4488
|
});
|
|
4485
4489
|
if (!i.ok) {
|
|
4486
|
-
const
|
|
4487
|
-
throw new D(`API key authentication failed: ${i.status} ${
|
|
4490
|
+
const T = await i.text().catch(() => "Unknown error");
|
|
4491
|
+
throw new D(`API key authentication failed: ${i.status} ${T}`);
|
|
4488
4492
|
}
|
|
4489
4493
|
const a = (await i.json()).token;
|
|
4490
4494
|
if (!a)
|
|
@@ -4497,40 +4501,40 @@ async function Bd(t, e, n = "auto", r = !1) {
|
|
|
4497
4501
|
signal: e
|
|
4498
4502
|
});
|
|
4499
4503
|
if (!c.ok) {
|
|
4500
|
-
const
|
|
4501
|
-
throw new D(`Failed to get or create profile: ${c.status} ${
|
|
4504
|
+
const T = await c.text().catch(() => "Unknown error");
|
|
4505
|
+
throw new D(`Failed to get or create profile: ${c.status} ${T}`);
|
|
4502
4506
|
}
|
|
4503
|
-
const l = await
|
|
4507
|
+
const l = await ms(s, t.spaceId, t.channelKey, t.parameters, t.sessionId, a, e), f = Ye(), p = yt(), d = {
|
|
4504
4508
|
code: l.code,
|
|
4505
|
-
contextType:
|
|
4506
|
-
userType: t.userType ??
|
|
4509
|
+
contextType: ue.Plugin,
|
|
4510
|
+
userType: t.userType ?? he.Human,
|
|
4507
4511
|
clientType: t.clientType ?? bt(),
|
|
4508
|
-
payloadType:
|
|
4512
|
+
payloadType: de.Teleport,
|
|
4509
4513
|
description: t.description ?? "Ikon SDK TypeScript",
|
|
4510
|
-
deviceId: t.deviceId ??
|
|
4514
|
+
deviceId: t.deviceId ?? Ke(),
|
|
4511
4515
|
productId: t.productId ?? "",
|
|
4512
4516
|
versionId: t.versionId ?? "",
|
|
4513
4517
|
installId: t.installId ?? "",
|
|
4514
4518
|
locale: t.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4515
|
-
opcodeGroupsFromServer: t.opcodeGroupsFromServer ??
|
|
4516
|
-
opcodeGroupsToServer: t.opcodeGroupsToServer ??
|
|
4519
|
+
opcodeGroupsFromServer: t.opcodeGroupsFromServer ?? ie,
|
|
4520
|
+
opcodeGroupsToServer: t.opcodeGroupsToServer ?? ie,
|
|
4517
4521
|
protocolVersion: 1,
|
|
4518
4522
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4519
|
-
launchParams: { ...
|
|
4523
|
+
launchParams: { ...f, ...t.parameters },
|
|
4520
4524
|
hash: t.sessionId,
|
|
4521
4525
|
waitForRunning: !0,
|
|
4522
|
-
viewportWidth:
|
|
4523
|
-
viewportHeight:
|
|
4524
|
-
theme:
|
|
4526
|
+
viewportWidth: p.width,
|
|
4527
|
+
viewportHeight: p.height,
|
|
4528
|
+
theme: $e(),
|
|
4525
4529
|
timezone: At(),
|
|
4526
4530
|
isTouchDevice: Rt(),
|
|
4527
4531
|
initialPath: kt()
|
|
4528
|
-
},
|
|
4529
|
-
if (!
|
|
4532
|
+
}, m = t.provisioningTimeoutMs ?? ds, S = await Es(s, d, m, a, e);
|
|
4533
|
+
if (!S.configuration?.url)
|
|
4530
4534
|
throw new D("Backend did not return a connect URL");
|
|
4531
4535
|
return Is(
|
|
4532
|
-
|
|
4533
|
-
|
|
4536
|
+
S.configuration.url,
|
|
4537
|
+
S.configuration.proxyUrl,
|
|
4534
4538
|
n,
|
|
4535
4539
|
r,
|
|
4536
4540
|
e
|
|
@@ -4549,23 +4553,23 @@ async function xd(t, e, n = "auto", r = !1) {
|
|
|
4549
4553
|
signal: e
|
|
4550
4554
|
});
|
|
4551
4555
|
if (!o.ok) {
|
|
4552
|
-
const
|
|
4553
|
-
throw new D(`Failed to get or create profile: ${o.status} ${
|
|
4556
|
+
const m = await o.text().catch(() => "Unknown error");
|
|
4557
|
+
throw new D(`Failed to get or create profile: ${o.status} ${m}`);
|
|
4554
4558
|
}
|
|
4555
|
-
const a = await
|
|
4559
|
+
const a = await ms(s, t.spaceId, t.channelKey, t.parameters, t.sessionId, i, e), c = Ye(), l = yt(), f = {
|
|
4556
4560
|
code: a.code,
|
|
4557
|
-
contextType:
|
|
4558
|
-
userType:
|
|
4561
|
+
contextType: ue.Browser,
|
|
4562
|
+
userType: he.Human,
|
|
4559
4563
|
clientType: bt(),
|
|
4560
|
-
payloadType:
|
|
4564
|
+
payloadType: de.Teleport,
|
|
4561
4565
|
description: t.description ?? "Ikon SDK TypeScript",
|
|
4562
|
-
deviceId: t.deviceId ??
|
|
4566
|
+
deviceId: t.deviceId ?? Ke(),
|
|
4563
4567
|
productId: t.productId ?? "",
|
|
4564
4568
|
versionId: t.versionId ?? "",
|
|
4565
4569
|
installId: t.installId ?? "",
|
|
4566
4570
|
locale: t.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4567
|
-
opcodeGroupsFromServer: t.opcodeGroupsFromServer ??
|
|
4568
|
-
opcodeGroupsToServer: t.opcodeGroupsToServer ??
|
|
4571
|
+
opcodeGroupsFromServer: t.opcodeGroupsFromServer ?? ie,
|
|
4572
|
+
opcodeGroupsToServer: t.opcodeGroupsToServer ?? ie,
|
|
4569
4573
|
protocolVersion: 1,
|
|
4570
4574
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4571
4575
|
launchParams: { ...c, ...t.parameters },
|
|
@@ -4573,11 +4577,11 @@ async function xd(t, e, n = "auto", r = !1) {
|
|
|
4573
4577
|
waitForRunning: !0,
|
|
4574
4578
|
viewportWidth: l.width,
|
|
4575
4579
|
viewportHeight: l.height,
|
|
4576
|
-
theme:
|
|
4580
|
+
theme: $e(),
|
|
4577
4581
|
timezone: At(),
|
|
4578
4582
|
isTouchDevice: Rt(),
|
|
4579
4583
|
initialPath: kt()
|
|
4580
|
-
},
|
|
4584
|
+
}, p = t.provisioningTimeoutMs ?? ds, d = await Es(s, f, p, i, e);
|
|
4581
4585
|
if (!d.configuration?.url)
|
|
4582
4586
|
throw new D("Backend did not return a connect URL");
|
|
4583
4587
|
return Is(
|
|
@@ -4588,7 +4592,7 @@ async function xd(t, e, n = "auto", r = !1) {
|
|
|
4588
4592
|
e
|
|
4589
4593
|
);
|
|
4590
4594
|
}
|
|
4591
|
-
const Wd = "ikon-proxy", Gd = "ikon-websocket", Vd = "ikon-webtransport", _s = "ikon-debug", Hd = "ikon-lang", $d = "ikon-server-url",
|
|
4595
|
+
const Wd = "ikon-proxy", Gd = "ikon-websocket", Vd = "ikon-webtransport", _s = "ikon-debug", Hd = "ikon-lang", $d = "ikon-server-url", Lf = "ikon-git-source", Ff = "ikon-git-branch", Kd = "ikon-audio", Yd = "ikon-video", jd = "ikon-webrtc";
|
|
4592
4596
|
function Dt(t, e) {
|
|
4593
4597
|
if (typeof window > "u")
|
|
4594
4598
|
return null;
|
|
@@ -4598,48 +4602,57 @@ function Dt(t, e) {
|
|
|
4598
4602
|
const s = n.get(t.replace(/-/g, "_"));
|
|
4599
4603
|
return s !== null ? s : null;
|
|
4600
4604
|
}
|
|
4601
|
-
function
|
|
4605
|
+
function te(t, e) {
|
|
4602
4606
|
const n = Dt(t);
|
|
4603
4607
|
return n === "true" ? !0 : n === "false" ? !1 : null;
|
|
4604
4608
|
}
|
|
4605
|
-
function
|
|
4609
|
+
function zd(t, e) {
|
|
4606
4610
|
if (typeof window > "u")
|
|
4607
4611
|
return;
|
|
4608
4612
|
const n = new URL(window.location.href);
|
|
4609
4613
|
n.searchParams.get(t) !== e && (n.searchParams.set(t, e), window.history.replaceState(null, "", n.toString()));
|
|
4610
4614
|
}
|
|
4611
|
-
function
|
|
4612
|
-
return
|
|
4615
|
+
function Xd() {
|
|
4616
|
+
return te(Wd);
|
|
4613
4617
|
}
|
|
4614
|
-
function
|
|
4615
|
-
return
|
|
4618
|
+
function Jd() {
|
|
4619
|
+
return te(Gd);
|
|
4616
4620
|
}
|
|
4617
|
-
function
|
|
4618
|
-
return
|
|
4621
|
+
function Qd() {
|
|
4622
|
+
return te(Vd);
|
|
4619
4623
|
}
|
|
4620
|
-
function
|
|
4621
|
-
return
|
|
4624
|
+
function Zd() {
|
|
4625
|
+
return te(_s) === !0;
|
|
4622
4626
|
}
|
|
4623
|
-
function
|
|
4627
|
+
function Bf() {
|
|
4624
4628
|
return Dt(Hd);
|
|
4625
4629
|
}
|
|
4626
|
-
function
|
|
4630
|
+
function qd() {
|
|
4627
4631
|
return Dt($d);
|
|
4628
4632
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
4633
|
+
function eh() {
|
|
4634
|
+
return te(Kd);
|
|
4635
|
+
}
|
|
4636
|
+
function th() {
|
|
4637
|
+
return te(Yd);
|
|
4638
|
+
}
|
|
4639
|
+
function nh() {
|
|
4640
|
+
return te(jd);
|
|
4641
|
+
}
|
|
4642
|
+
const rh = new Uint8Array(0);
|
|
4643
|
+
function Ge(t) {
|
|
4631
4644
|
switch (t.kind) {
|
|
4632
4645
|
case "array":
|
|
4633
4646
|
return {
|
|
4634
4647
|
kind: "array",
|
|
4635
|
-
element:
|
|
4648
|
+
element: Ge(t.element),
|
|
4636
4649
|
nullable: t.nullable ?? !1
|
|
4637
4650
|
};
|
|
4638
4651
|
case "dictionary":
|
|
4639
4652
|
return {
|
|
4640
4653
|
kind: "dictionary",
|
|
4641
4654
|
keyType: t.keyType ?? "string",
|
|
4642
|
-
value:
|
|
4655
|
+
value: Ge(t.value),
|
|
4643
4656
|
nullable: t.nullable ?? !1
|
|
4644
4657
|
};
|
|
4645
4658
|
default:
|
|
@@ -4649,7 +4662,7 @@ function We(t) {
|
|
|
4649
4662
|
};
|
|
4650
4663
|
}
|
|
4651
4664
|
}
|
|
4652
|
-
function
|
|
4665
|
+
function ye(t) {
|
|
4653
4666
|
switch (t.kind) {
|
|
4654
4667
|
case "boolean":
|
|
4655
4668
|
return "System.Boolean";
|
|
@@ -4658,9 +4671,9 @@ function Ce(t) {
|
|
|
4658
4671
|
case "string":
|
|
4659
4672
|
return "System.String";
|
|
4660
4673
|
case "array":
|
|
4661
|
-
return `System.Collections.Generic.List\`1[${
|
|
4674
|
+
return `System.Collections.Generic.List\`1[${ye(t.element)}]`;
|
|
4662
4675
|
case "dictionary":
|
|
4663
|
-
return `System.Collections.Generic.Dictionary\`2[${t.keyType === "int" ? "System.Int32" : "System.String"},${
|
|
4676
|
+
return `System.Collections.Generic.Dictionary\`2[${t.keyType === "int" ? "System.Int32" : "System.String"},${ye(t.value)}]`;
|
|
4664
4677
|
default:
|
|
4665
4678
|
return t;
|
|
4666
4679
|
}
|
|
@@ -4686,9 +4699,9 @@ function Ts(t, e) {
|
|
|
4686
4699
|
}
|
|
4687
4700
|
return JSON.stringify(t);
|
|
4688
4701
|
}
|
|
4689
|
-
function
|
|
4702
|
+
function sh(t, e) {
|
|
4690
4703
|
const n = (t.parameters ?? []).map((i) => {
|
|
4691
|
-
const o =
|
|
4704
|
+
const o = Ge(i.type), a = Object.prototype.hasOwnProperty.call(i, "defaultValue"), c = a ? Ts(i.defaultValue, o) : "";
|
|
4692
4705
|
return {
|
|
4693
4706
|
name: i.name,
|
|
4694
4707
|
descriptor: o,
|
|
@@ -4696,13 +4709,13 @@ function Zd(t, e) {
|
|
|
4696
4709
|
defaultValueJson: c,
|
|
4697
4710
|
description: i.description
|
|
4698
4711
|
};
|
|
4699
|
-
}), r =
|
|
4700
|
-
FunctionId:
|
|
4712
|
+
}), r = Ge(t.returnType), s = {
|
|
4713
|
+
FunctionId: w.createRandom(),
|
|
4701
4714
|
FunctionName: t.name,
|
|
4702
4715
|
Description: t.description ?? "",
|
|
4703
4716
|
LlmInlineResult: t.llmInlineResult ?? !1,
|
|
4704
4717
|
LlmCallOnlyOnce: t.llmCallOnlyOnce ?? !1,
|
|
4705
|
-
ResultTypeName:
|
|
4718
|
+
ResultTypeName: ye(r),
|
|
4706
4719
|
IsEnumerable: !1,
|
|
4707
4720
|
EnumerableItemTypeName: "",
|
|
4708
4721
|
IsCancellable: !1,
|
|
@@ -4711,10 +4724,10 @@ function Zd(t, e) {
|
|
|
4711
4724
|
Parameters: n.map((i, o) => ({
|
|
4712
4725
|
ParameterIndex: o,
|
|
4713
4726
|
ParameterName: i.name,
|
|
4714
|
-
TypeName:
|
|
4727
|
+
TypeName: ye(i.descriptor),
|
|
4715
4728
|
HasDefaultValue: i.hasDefaultValue,
|
|
4716
4729
|
DefaultValueJson: i.defaultValueJson,
|
|
4717
|
-
DefaultValueData:
|
|
4730
|
+
DefaultValueData: rh,
|
|
4718
4731
|
IsEnumerable: !1,
|
|
4719
4732
|
EnumerableItemTypeName: "",
|
|
4720
4733
|
Description: i.description ?? ""
|
|
@@ -4728,19 +4741,19 @@ function Zd(t, e) {
|
|
|
4728
4741
|
returnType: r
|
|
4729
4742
|
};
|
|
4730
4743
|
}
|
|
4731
|
-
function
|
|
4744
|
+
function ih(t, e) {
|
|
4732
4745
|
return { value: t, data: e };
|
|
4733
4746
|
}
|
|
4734
|
-
class
|
|
4747
|
+
class oh extends Error {
|
|
4735
4748
|
constructor(e, n, r) {
|
|
4736
4749
|
super(e), this.remoteErrorType = n, this.remoteStackTrace = r, this.name = "FunctionCallError";
|
|
4737
4750
|
}
|
|
4738
4751
|
}
|
|
4739
|
-
const Ee =
|
|
4740
|
-
function
|
|
4752
|
+
const Ee = L("FunctionRegistry"), Yt = new Uint8Array(0), jt = 3e4;
|
|
4753
|
+
function ah(t) {
|
|
4741
4754
|
return !t || typeof t != "object" ? !1 : t.data instanceof Uint8Array;
|
|
4742
4755
|
}
|
|
4743
|
-
class
|
|
4756
|
+
class ch {
|
|
4744
4757
|
functions = /* @__PURE__ */ new Map();
|
|
4745
4758
|
remoteFunctions = /* @__PURE__ */ new Map();
|
|
4746
4759
|
pendingCalls = /* @__PURE__ */ new Map();
|
|
@@ -4767,7 +4780,7 @@ class nh {
|
|
|
4767
4780
|
* If already connected, sends registration to server immediately.
|
|
4768
4781
|
*/
|
|
4769
4782
|
register(e, n) {
|
|
4770
|
-
const r =
|
|
4783
|
+
const r = sh(e, n);
|
|
4771
4784
|
return this.functions.set(e.name, r), this.isConnected && this.config && this.sendRegistration(r), () => this.unregister(e.name);
|
|
4772
4785
|
}
|
|
4773
4786
|
/**
|
|
@@ -4821,18 +4834,18 @@ class nh {
|
|
|
4821
4834
|
const r = this.remoteFunctions.get(e);
|
|
4822
4835
|
if (!r)
|
|
4823
4836
|
throw new Error(`Remote function not found: ${e}`);
|
|
4824
|
-
const s =
|
|
4825
|
-
const
|
|
4837
|
+
const s = w.createRandom(), i = n.map((c, l) => {
|
|
4838
|
+
const f = r.parameters[l], p = f ? f.TypeName : this.inferTypeName(c);
|
|
4826
4839
|
return _n({
|
|
4827
4840
|
ParameterIndex: l,
|
|
4828
|
-
TypeName:
|
|
4841
|
+
TypeName: p,
|
|
4829
4842
|
ValueJson: JSON.stringify(c ?? null),
|
|
4830
4843
|
ValueData: Yt
|
|
4831
4844
|
});
|
|
4832
4845
|
}), o = Fn({
|
|
4833
|
-
FunctionId:
|
|
4846
|
+
FunctionId: w.createRandom(),
|
|
4834
4847
|
CallId: s,
|
|
4835
|
-
InstanceId:
|
|
4848
|
+
InstanceId: w.createRandom(),
|
|
4836
4849
|
FunctionName: e,
|
|
4837
4850
|
Parameters: i,
|
|
4838
4851
|
Scopes: [],
|
|
@@ -4841,13 +4854,13 @@ class nh {
|
|
|
4841
4854
|
targetIds: [r.clientSessionId]
|
|
4842
4855
|
});
|
|
4843
4856
|
return new Promise((c, l) => {
|
|
4844
|
-
const
|
|
4857
|
+
const f = setTimeout(() => {
|
|
4845
4858
|
this.pendingCalls.delete(s.toString()), l(new Error(`Function call '${e}' timed out after ${jt}ms`));
|
|
4846
4859
|
}, jt);
|
|
4847
4860
|
this.pendingCalls.set(s.toString(), {
|
|
4848
4861
|
resolve: c,
|
|
4849
4862
|
reject: l,
|
|
4850
|
-
timeout:
|
|
4863
|
+
timeout: f
|
|
4851
4864
|
}), this.config.sendProtocolMessage(a);
|
|
4852
4865
|
});
|
|
4853
4866
|
}
|
|
@@ -4896,7 +4909,7 @@ class nh {
|
|
|
4896
4909
|
*/
|
|
4897
4910
|
handleProtocolMessage(e, n) {
|
|
4898
4911
|
if (n === g.ACTION_FUNCTION_CALL) {
|
|
4899
|
-
const r =
|
|
4912
|
+
const r = ae(e);
|
|
4900
4913
|
return this.handleFunctionCall(e, r.senderId).catch((s) => {
|
|
4901
4914
|
Ee.error("Failed to handle function call:", s);
|
|
4902
4915
|
}), !0;
|
|
@@ -4904,7 +4917,7 @@ class nh {
|
|
|
4904
4917
|
return n === g.ACTION_FUNCTION_RESULT ? (this.handleFunctionResult(e), !0) : n === g.ACTION_FUNCTION_ERROR ? (this.handleFunctionError(e), !0) : !1;
|
|
4905
4918
|
}
|
|
4906
4919
|
handleFunctionResult(e) {
|
|
4907
|
-
const n =
|
|
4920
|
+
const n = Pa(e), r = n.CallId.toString(), s = this.pendingCalls.get(r);
|
|
4908
4921
|
if (!s) {
|
|
4909
4922
|
Ee.warn(`Received result for unknown call: ${r}`);
|
|
4910
4923
|
return;
|
|
@@ -4919,7 +4932,7 @@ class nh {
|
|
|
4919
4932
|
Ee.warn(`Received error for unknown call: ${r}`);
|
|
4920
4933
|
return;
|
|
4921
4934
|
}
|
|
4922
|
-
this.pendingCalls.delete(r), clearTimeout(s.timeout), s.reject(new
|
|
4935
|
+
this.pendingCalls.delete(r), clearTimeout(s.timeout), s.reject(new oh(n.ErrorMessage, n.ErrorTypeName, n.StackTrace));
|
|
4923
4936
|
}
|
|
4924
4937
|
inferTypeName(e) {
|
|
4925
4938
|
if (e == null)
|
|
@@ -4972,12 +4985,12 @@ class nh {
|
|
|
4972
4985
|
try {
|
|
4973
4986
|
const s = [];
|
|
4974
4987
|
for (let l = 0; l < e.parameters.length; l++) {
|
|
4975
|
-
const
|
|
4976
|
-
d === void 0 || d === "" ?
|
|
4988
|
+
const f = e.parameters[l], d = n.Parameters?.[l]?.ValueJson;
|
|
4989
|
+
d === void 0 || d === "" ? f.hasDefaultValue ? s.push(Kt(f.defaultValueJson, f.descriptor)) : s.push(void 0) : s.push(Kt(d, f.descriptor));
|
|
4977
4990
|
}
|
|
4978
4991
|
const i = await e.handler(...s);
|
|
4979
4992
|
let o = i, a = Yt;
|
|
4980
|
-
|
|
4993
|
+
ah(i) && (o = i.value, a = new Uint8Array(i.data));
|
|
4981
4994
|
const c = Ts(o, e.returnType);
|
|
4982
4995
|
this.sendResult(n.CallId, n.InstanceId, r, e, c, a);
|
|
4983
4996
|
} catch (s) {
|
|
@@ -5003,7 +5016,7 @@ class nh {
|
|
|
5003
5016
|
kr({
|
|
5004
5017
|
CallId: e,
|
|
5005
5018
|
InstanceId: n,
|
|
5006
|
-
ResultTypeName:
|
|
5019
|
+
ResultTypeName: ye(s.returnType),
|
|
5007
5020
|
ResultJson: i,
|
|
5008
5021
|
ResultData: o
|
|
5009
5022
|
}),
|
|
@@ -5032,7 +5045,7 @@ class nh {
|
|
|
5032
5045
|
this.config.sendProtocolMessage(i);
|
|
5033
5046
|
}
|
|
5034
5047
|
}
|
|
5035
|
-
function
|
|
5048
|
+
function Ie(t) {
|
|
5036
5049
|
if (!(typeof t != "string" || !t.trim()))
|
|
5037
5050
|
try {
|
|
5038
5051
|
return JSON.parse(t);
|
|
@@ -5040,75 +5053,75 @@ function me(t) {
|
|
|
5040
5053
|
return;
|
|
5041
5054
|
}
|
|
5042
5055
|
}
|
|
5043
|
-
const
|
|
5056
|
+
const Ae = {
|
|
5044
5057
|
StartVideoCapture: "ikon.client.startVideoCapture",
|
|
5045
5058
|
StartAudioCapture: "ikon.client.startAudioCapture",
|
|
5046
5059
|
StopCapture: "ikon.client.stopCapture",
|
|
5047
5060
|
CaptureImage: "ikon.client.captureImage",
|
|
5048
5061
|
GetMediaDevices: "ikon.client.getMediaDevices"
|
|
5049
|
-
},
|
|
5050
|
-
name:
|
|
5062
|
+
}, lh = {
|
|
5063
|
+
name: Ae.StartVideoCapture,
|
|
5051
5064
|
description: "Start camera or screen capture and stream video frames to the server",
|
|
5052
5065
|
returnType: { kind: "string" },
|
|
5053
5066
|
parameters: [
|
|
5054
5067
|
{ name: "source", type: { kind: "string", nullable: !0 }, description: "camera or screen" },
|
|
5055
5068
|
{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }
|
|
5056
5069
|
]
|
|
5057
|
-
},
|
|
5058
|
-
name:
|
|
5070
|
+
}, uh = {
|
|
5071
|
+
name: Ae.StartAudioCapture,
|
|
5059
5072
|
description: "Start microphone capture and stream audio frames to the server",
|
|
5060
5073
|
returnType: { kind: "string" },
|
|
5061
5074
|
parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
|
|
5062
|
-
},
|
|
5063
|
-
name:
|
|
5075
|
+
}, dh = {
|
|
5076
|
+
name: Ae.StopCapture,
|
|
5064
5077
|
description: "Stop a previously started capture by streamId",
|
|
5065
5078
|
returnType: { kind: "boolean" },
|
|
5066
5079
|
parameters: [{ name: "streamId", type: { kind: "string" }, description: "Stream ID to stop" }]
|
|
5067
|
-
},
|
|
5068
|
-
name:
|
|
5080
|
+
}, hh = {
|
|
5081
|
+
name: Ae.CaptureImage,
|
|
5069
5082
|
description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
|
|
5070
5083
|
returnType: { kind: "string" },
|
|
5071
5084
|
parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
|
|
5072
|
-
},
|
|
5073
|
-
name:
|
|
5085
|
+
}, fh = {
|
|
5086
|
+
name: Ae.GetMediaDevices,
|
|
5074
5087
|
description: "Get list of available media input devices",
|
|
5075
5088
|
returnType: { kind: "string" },
|
|
5076
5089
|
parameters: []
|
|
5077
5090
|
};
|
|
5078
|
-
function
|
|
5091
|
+
function ph(t, e) {
|
|
5079
5092
|
const n = [];
|
|
5080
5093
|
return n.push(
|
|
5081
|
-
t.register(
|
|
5094
|
+
t.register(lh, async (r, s) => {
|
|
5082
5095
|
if (e.isWebRtcEnabled) {
|
|
5083
5096
|
const l = e.webRtcSignaling;
|
|
5084
5097
|
if (!l)
|
|
5085
5098
|
throw new Error("WebRTC signaling is not connected");
|
|
5086
|
-
const
|
|
5087
|
-
return await l.startVideoCapture(
|
|
5099
|
+
const f = Ie(s);
|
|
5100
|
+
return await l.startVideoCapture(f?.constraints), "webrtc-video";
|
|
5088
5101
|
}
|
|
5089
5102
|
const i = e.mediaCapture;
|
|
5090
5103
|
if (!i)
|
|
5091
5104
|
throw new Error("Media capture is not available in this environment");
|
|
5092
|
-
const o =
|
|
5105
|
+
const o = Ie(s);
|
|
5093
5106
|
return ((typeof r == "string" && r.trim().toLowerCase() === "screen" ? "screen" : "camera") === "screen" ? await i.video.startScreen({ userGesture: !1, options: o, constraints: o?.constraints }) : await i.video.startCamera({ userGesture: !1, options: o, constraints: o?.constraints })).streamId;
|
|
5094
5107
|
})
|
|
5095
5108
|
), n.push(
|
|
5096
|
-
t.register(
|
|
5109
|
+
t.register(uh, async (r) => {
|
|
5097
5110
|
if (e.isWebRtcEnabled) {
|
|
5098
5111
|
const a = e.webRtcSignaling;
|
|
5099
5112
|
if (!a)
|
|
5100
5113
|
throw new Error("WebRTC signaling is not connected");
|
|
5101
|
-
const c =
|
|
5114
|
+
const c = Ie(r);
|
|
5102
5115
|
return await a.startAudioCapture(c?.constraints), "webrtc-audio";
|
|
5103
5116
|
}
|
|
5104
5117
|
const s = e.mediaCapture;
|
|
5105
5118
|
if (!s)
|
|
5106
5119
|
throw new Error("Media capture is not available in this environment");
|
|
5107
|
-
const i =
|
|
5120
|
+
const i = Ie(r);
|
|
5108
5121
|
return (await s.audio.startMic({ userGesture: !1, options: i, constraints: i?.constraints })).streamId;
|
|
5109
5122
|
})
|
|
5110
5123
|
), n.push(
|
|
5111
|
-
t.register(
|
|
5124
|
+
t.register(dh, async (r) => {
|
|
5112
5125
|
if (e.isWebRtcEnabled) {
|
|
5113
5126
|
const a = e.webRtcSignaling;
|
|
5114
5127
|
return a && await a.stopCapture(), !0;
|
|
@@ -5120,11 +5133,11 @@ function ch(t, e) {
|
|
|
5120
5133
|
return i || o;
|
|
5121
5134
|
})
|
|
5122
5135
|
), n.push(
|
|
5123
|
-
t.register(
|
|
5136
|
+
t.register(hh, async (r) => {
|
|
5124
5137
|
const s = e.mediaCapture;
|
|
5125
5138
|
if (!s)
|
|
5126
5139
|
throw new Error("Media capture is not available in this environment");
|
|
5127
|
-
const i =
|
|
5140
|
+
const i = Ie(r) ?? {}, o = await s.image.captureFromCamera({
|
|
5128
5141
|
userGesture: !1,
|
|
5129
5142
|
constraints: i.constraints,
|
|
5130
5143
|
mime: i.mime,
|
|
@@ -5132,10 +5145,10 @@ function ch(t, e) {
|
|
|
5132
5145
|
width: i.width,
|
|
5133
5146
|
height: i.height
|
|
5134
5147
|
}), a = JSON.stringify({ mime: o.mime, width: o.width, height: o.height });
|
|
5135
|
-
return
|
|
5148
|
+
return ih(a, o.data);
|
|
5136
5149
|
})
|
|
5137
5150
|
), n.push(
|
|
5138
|
-
t.register(
|
|
5151
|
+
t.register(fh, async () => {
|
|
5139
5152
|
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices)
|
|
5140
5153
|
return JSON.stringify([]);
|
|
5141
5154
|
const s = (await navigator.mediaDevices.enumerateDevices()).filter((i) => i.kind === "audioinput" || i.kind === "videoinput").map((i) => ({
|
|
@@ -5154,9 +5167,9 @@ function ch(t, e) {
|
|
|
5154
5167
|
const ws = {
|
|
5155
5168
|
PlaySound: "ikon.client.playSound",
|
|
5156
5169
|
StopSound: "ikon.client.stopSound"
|
|
5157
|
-
}, at = /* @__PURE__ */ new Map(),
|
|
5158
|
-
let
|
|
5159
|
-
const
|
|
5170
|
+
}, at = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
|
|
5171
|
+
let mh = 1;
|
|
5172
|
+
const Eh = {
|
|
5160
5173
|
name: ws.PlaySound,
|
|
5161
5174
|
description: "Play a sound effect",
|
|
5162
5175
|
returnType: { kind: "string", nullable: !0 },
|
|
@@ -5167,7 +5180,7 @@ const uh = {
|
|
|
5167
5180
|
{ name: "loop", type: { kind: "boolean", nullable: !0 }, description: "Loop the sound" }
|
|
5168
5181
|
]
|
|
5169
5182
|
};
|
|
5170
|
-
function
|
|
5183
|
+
function Ih(t, e, n, r) {
|
|
5171
5184
|
if (typeof window > "u" || typeof Audio > "u" || typeof t != "string" || !t.trim())
|
|
5172
5185
|
return Promise.resolve(null);
|
|
5173
5186
|
let s = t;
|
|
@@ -5181,10 +5194,10 @@ function dh(t, e, n, r) {
|
|
|
5181
5194
|
try {
|
|
5182
5195
|
const o = new Audio(s), a = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
|
|
5183
5196
|
o.volume = a, r === !0 && (o.loop = !0);
|
|
5184
|
-
const c = `sound-${
|
|
5185
|
-
|
|
5197
|
+
const c = `sound-${mh++}`, l = () => {
|
|
5198
|
+
oe.delete(c), o.removeEventListener("ended", l), o.removeEventListener("error", l);
|
|
5186
5199
|
};
|
|
5187
|
-
o.addEventListener("ended", l), o.addEventListener("error", l),
|
|
5200
|
+
o.addEventListener("ended", l), o.addEventListener("error", l), oe.set(c, o), o.play().then(
|
|
5188
5201
|
() => i(c),
|
|
5189
5202
|
() => {
|
|
5190
5203
|
l(), i(null);
|
|
@@ -5195,42 +5208,42 @@ function dh(t, e, n, r) {
|
|
|
5195
5208
|
}
|
|
5196
5209
|
});
|
|
5197
5210
|
}
|
|
5198
|
-
const
|
|
5211
|
+
const _h = {
|
|
5199
5212
|
name: ws.StopSound,
|
|
5200
5213
|
description: "Stop a playing sound by ID",
|
|
5201
5214
|
returnType: { kind: "boolean" },
|
|
5202
5215
|
parameters: [{ name: "playbackId", type: { kind: "string" }, description: "Playback ID from playSound" }]
|
|
5203
5216
|
};
|
|
5204
|
-
function
|
|
5217
|
+
function Th(t) {
|
|
5205
5218
|
if (typeof t != "string")
|
|
5206
5219
|
return !1;
|
|
5207
|
-
const e =
|
|
5220
|
+
const e = oe.get(t);
|
|
5208
5221
|
if (!e)
|
|
5209
5222
|
return !1;
|
|
5210
5223
|
try {
|
|
5211
|
-
return e.pause(), e.currentTime = 0,
|
|
5224
|
+
return e.pause(), e.currentTime = 0, oe.delete(t), !0;
|
|
5212
5225
|
} catch {
|
|
5213
5226
|
return !1;
|
|
5214
5227
|
}
|
|
5215
5228
|
}
|
|
5216
|
-
function
|
|
5229
|
+
function wh() {
|
|
5217
5230
|
at.clear();
|
|
5218
|
-
for (const [t, e] of
|
|
5231
|
+
for (const [t, e] of oe) {
|
|
5219
5232
|
try {
|
|
5220
5233
|
e.pause(), e.currentTime = 0;
|
|
5221
5234
|
} catch {
|
|
5222
5235
|
}
|
|
5223
|
-
|
|
5236
|
+
oe.delete(t);
|
|
5224
5237
|
}
|
|
5225
5238
|
}
|
|
5226
|
-
const
|
|
5227
|
-
{ definition:
|
|
5228
|
-
{ definition:
|
|
5239
|
+
const Sh = [
|
|
5240
|
+
{ definition: Eh, handler: Ih },
|
|
5241
|
+
{ definition: _h, handler: Th }
|
|
5229
5242
|
];
|
|
5230
|
-
function
|
|
5231
|
-
const e =
|
|
5243
|
+
function gh(t) {
|
|
5244
|
+
const e = Sh.map(({ definition: n, handler: r }) => t.register(n, r));
|
|
5232
5245
|
return () => {
|
|
5233
|
-
e.forEach((n) => n()),
|
|
5246
|
+
e.forEach((n) => n()), wh();
|
|
5234
5247
|
};
|
|
5235
5248
|
}
|
|
5236
5249
|
const Ss = () => {
|
|
@@ -5238,25 +5251,25 @@ const Ss = () => {
|
|
|
5238
5251
|
return !1;
|
|
5239
5252
|
const t = navigator.userAgent, e = /iPad|iPhone|iPod/.test(t), n = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
|
|
5240
5253
|
return e || n;
|
|
5241
|
-
},
|
|
5242
|
-
function
|
|
5254
|
+
}, De = L("Capabilities"), Ch = globalThis;
|
|
5255
|
+
function Pe() {
|
|
5243
5256
|
if (typeof SharedArrayBuffer > "u")
|
|
5244
|
-
return
|
|
5257
|
+
return De.debug("SharedArrayBuffer not supported: SharedArrayBuffer is undefined"), !1;
|
|
5245
5258
|
if (typeof Atomics > "u")
|
|
5246
|
-
return
|
|
5247
|
-
if (
|
|
5248
|
-
return
|
|
5259
|
+
return De.debug("SharedArrayBuffer not supported: Atomics is undefined"), !1;
|
|
5260
|
+
if (Ch.crossOriginIsolated === !1)
|
|
5261
|
+
return De.debug("SharedArrayBuffer not supported: crossOriginIsolated is false (missing COOP/COEP headers)"), !1;
|
|
5249
5262
|
try {
|
|
5250
5263
|
new SharedArrayBuffer(1);
|
|
5251
5264
|
} catch (t) {
|
|
5252
|
-
return
|
|
5265
|
+
return De.debug(`SharedArrayBuffer not supported: construction failed - ${t instanceof Error ? t.message : String(t)}`), !1;
|
|
5253
5266
|
}
|
|
5254
5267
|
return !0;
|
|
5255
5268
|
}
|
|
5256
5269
|
function gs(t) {
|
|
5257
5270
|
return typeof AudioWorkletNode != "function" ? !1 : typeof t.audioWorklet?.addModule == "function";
|
|
5258
5271
|
}
|
|
5259
|
-
function
|
|
5272
|
+
function yh() {
|
|
5260
5273
|
const r = new ArrayBuffer(882044), s = new DataView(r), i = (a, c) => {
|
|
5261
5274
|
for (let l = 0; l < c.length; l++)
|
|
5262
5275
|
s.setUint8(a + l, c.charCodeAt(l));
|
|
@@ -5271,7 +5284,7 @@ class Cs {
|
|
|
5271
5284
|
return this._silentAudioElement;
|
|
5272
5285
|
}
|
|
5273
5286
|
setup(e, n) {
|
|
5274
|
-
if (!(typeof document > "u") && (this._silentAudioElement || (this._silentAudioElement = document.createElement("audio"), this._silentAudioElement.src =
|
|
5287
|
+
if (!(typeof document > "u") && (this._silentAudioElement || (this._silentAudioElement = document.createElement("audio"), this._silentAudioElement.src = yh(), this._silentAudioElement.loop = !0, this._silentAudioElement.volume = 0.01, this._silentAudioElement.play().catch(() => {
|
|
5275
5288
|
})), typeof navigator < "u" && "mediaSession" in navigator)) {
|
|
5276
5289
|
const r = e ?? {};
|
|
5277
5290
|
navigator.mediaSession.metadata = new MediaMetadata({
|
|
@@ -5309,7 +5322,7 @@ class Cs {
|
|
|
5309
5322
|
}
|
|
5310
5323
|
}
|
|
5311
5324
|
}
|
|
5312
|
-
function
|
|
5325
|
+
function Ah(t) {
|
|
5313
5326
|
return new Worker(
|
|
5314
5327
|
"" + new URL("assets/audio-playback-worker-CVB6ftYO.js", import.meta.url).href,
|
|
5315
5328
|
{
|
|
@@ -5318,7 +5331,7 @@ function Th(t) {
|
|
|
5318
5331
|
}
|
|
5319
5332
|
);
|
|
5320
5333
|
}
|
|
5321
|
-
const
|
|
5334
|
+
const ve = 48e3, x = 2, ys = 1500, zt = 512, Xt = "playback", Rh = 120, bh = 300, Nh = 4, kh = 200, Dh = 100, vh = 8e3, Uh = 10, As = 100, ct = 50, Rs = 128, Oh = 20, Mh = !0, X = 1500, Ph = -20, Lh = -100, Fh = 200, k = L("IkonAudioPlayback"), Bh = () => {
|
|
5322
5335
|
if (typeof navigator > "u" || typeof window > "u")
|
|
5323
5336
|
return !1;
|
|
5324
5337
|
const t = navigator.userAgent, e = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t), n = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
|
|
@@ -5330,19 +5343,19 @@ const De = 48e3, x = 2, ys = 1500, zt = 512, Xt = "playback", wh = 120, Sh = 300
|
|
|
5330
5343
|
function J(t) {
|
|
5331
5344
|
return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
|
|
5332
5345
|
}
|
|
5333
|
-
function
|
|
5346
|
+
function xh(t) {
|
|
5334
5347
|
return `
|
|
5335
5348
|
// Audio buffer constants
|
|
5336
5349
|
const OUTPUT_SAMPLE_RATE_HZ = ${t.outputSampleRateHz};
|
|
5337
5350
|
const DEFAULT_FRAME_SAMPLES_PER_CHANNEL = Math.max(1, Math.round(OUTPUT_SAMPLE_RATE_HZ * 0.02));
|
|
5338
|
-
const BUFFER_TARGET_MIN_MS = ${
|
|
5339
|
-
const BUFFER_TARGET_MAX_MS = ${
|
|
5340
|
-
const JITTER_MULTIPLIER = ${
|
|
5351
|
+
const BUFFER_TARGET_MIN_MS = ${Rh};
|
|
5352
|
+
const BUFFER_TARGET_MAX_MS = ${bh};
|
|
5353
|
+
const JITTER_MULTIPLIER = ${Nh};
|
|
5341
5354
|
const LOCAL_BUFFER_MAX_MS = ${ys};
|
|
5342
|
-
const CONTROL_PERIOD_MS = ${
|
|
5343
|
-
const UNDERRUN_JUMP_MS = ${
|
|
5344
|
-
const STABLE_TIME_TO_DECREASE_MS = ${
|
|
5345
|
-
const DECREASE_STEP_MS = ${
|
|
5355
|
+
const CONTROL_PERIOD_MS = ${kh};
|
|
5356
|
+
const UNDERRUN_JUMP_MS = ${Dh};
|
|
5357
|
+
const STABLE_TIME_TO_DECREASE_MS = ${vh};
|
|
5358
|
+
const DECREASE_STEP_MS = ${Uh};
|
|
5346
5359
|
const DEFAULT_STATS_INTERVAL_SAMPLES = OUTPUT_SAMPLE_RATE_HZ;
|
|
5347
5360
|
|
|
5348
5361
|
// Pre-computed reciprocals for division-free calculations
|
|
@@ -5361,7 +5374,7 @@ const FADE_OUT_INCREMENT = 1.0 / FADE_OUT_DURATION_SAMPLES;
|
|
|
5361
5374
|
const RENDER_QUANTUM_SIZE = ${Rs};
|
|
5362
5375
|
|
|
5363
5376
|
// Buffer reduction crossfade constants (align to quantum boundary to avoid partial quanta)
|
|
5364
|
-
const BUFFER_REDUCTION_CROSSFADE_MS = ${
|
|
5377
|
+
const BUFFER_REDUCTION_CROSSFADE_MS = ${Oh};
|
|
5365
5378
|
const BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW = Math.round(OUTPUT_SAMPLE_RATE_HZ * BUFFER_REDUCTION_CROSSFADE_MS / 1000);
|
|
5366
5379
|
const BUFFER_REDUCTION_CROSSFADE_SAMPLES = Math.ceil(BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW / RENDER_QUANTUM_SIZE) * RENDER_QUANTUM_SIZE;
|
|
5367
5380
|
|
|
@@ -5572,7 +5585,7 @@ class IkonAudioPlayerProcessor extends AudioWorkletProcessor {
|
|
|
5572
5585
|
this.statsIntervalSamples = Math.max(1, Math.round((OUTPUT_SAMPLE_RATE_HZ * statusIntervalMs) / 1000));
|
|
5573
5586
|
|
|
5574
5587
|
// Normalization config (hardcoded)
|
|
5575
|
-
this.normalizationEnabled = ${
|
|
5588
|
+
this.normalizationEnabled = ${Mh};
|
|
5576
5589
|
|
|
5577
5590
|
// Stream states for audio buffer
|
|
5578
5591
|
this.streams = new Map();
|
|
@@ -6302,7 +6315,7 @@ class vt {
|
|
|
6302
6315
|
config;
|
|
6303
6316
|
enabled = !1;
|
|
6304
6317
|
stateUnsubscribe = null;
|
|
6305
|
-
isMobile =
|
|
6318
|
+
isMobile = Bh();
|
|
6306
6319
|
boundVisibilityChange = null;
|
|
6307
6320
|
boundPageHide = null;
|
|
6308
6321
|
unlockHandler = null;
|
|
@@ -6311,7 +6324,7 @@ class vt {
|
|
|
6311
6324
|
/** Timeout for AudioContext.resume() - normally resolves instantly, but some browsers hang indefinitely */
|
|
6312
6325
|
static RESUME_TIMEOUT_MS = 100;
|
|
6313
6326
|
audioContext = null;
|
|
6314
|
-
outputSampleRateHz =
|
|
6327
|
+
outputSampleRateHz = ve;
|
|
6315
6328
|
audioWorkletNode = null;
|
|
6316
6329
|
scriptProcessorNode = null;
|
|
6317
6330
|
scriptDiagnosticsTimer = null;
|
|
@@ -6417,7 +6430,7 @@ class vt {
|
|
|
6417
6430
|
this.stopAudioGraph();
|
|
6418
6431
|
try {
|
|
6419
6432
|
const e = new AudioContext({
|
|
6420
|
-
sampleRate:
|
|
6433
|
+
sampleRate: ve,
|
|
6421
6434
|
latencyHint: Xt
|
|
6422
6435
|
});
|
|
6423
6436
|
this.audioContext = e, this.outputSampleRateHz = e.sampleRate, e.resume(), this.setupAudioGraphAfterRecreate();
|
|
@@ -6514,24 +6527,24 @@ class vt {
|
|
|
6514
6527
|
const o = n - i.playbackStartContextTime;
|
|
6515
6528
|
if (o < 0)
|
|
6516
6529
|
continue;
|
|
6517
|
-
const a = o * r * s, c = i.frames, l = i.count,
|
|
6518
|
-
let d = null,
|
|
6530
|
+
const a = o * r * s, c = i.frames, l = i.count, p = (i.head - l + X) % X;
|
|
6531
|
+
let d = null, m = null;
|
|
6519
6532
|
for (let u = 0; u < l; u++) {
|
|
6520
|
-
const v = (
|
|
6521
|
-
if (C.samplePosition <= a && (d = C), N > a && !
|
|
6533
|
+
const v = (p + u) % X, C = c[v], N = C.samplePosition + Math.max(C.frameSamples, 1);
|
|
6534
|
+
if (C.samplePosition <= a && (d = C), N > a && !m && (m = C, C.samplePosition <= a))
|
|
6522
6535
|
break;
|
|
6523
6536
|
}
|
|
6524
6537
|
if (!d)
|
|
6525
6538
|
continue;
|
|
6526
|
-
const
|
|
6527
|
-
if (a >
|
|
6539
|
+
const S = d.samplePosition + Math.max(d.frameSamples, 1);
|
|
6540
|
+
if (a > S && !m)
|
|
6528
6541
|
continue;
|
|
6529
|
-
if (!
|
|
6542
|
+
if (!m)
|
|
6530
6543
|
return this._visemeResult.mouthOpenY = d.mouthOpenY, this._visemeResult.mouthForm = d.mouthForm, this._visemeResult;
|
|
6531
|
-
const
|
|
6532
|
-
if (d !==
|
|
6533
|
-
const u = Math.min(1, Math.max(0, (a -
|
|
6534
|
-
this._visemeResult.mouthOpenY = d.mouthOpenY + u * (
|
|
6544
|
+
const T = d.samplePosition, E = Math.max(d.frameSamples, 1), h = T + E;
|
|
6545
|
+
if (d !== m && m.samplePosition > d.samplePosition && h > T) {
|
|
6546
|
+
const u = Math.min(1, Math.max(0, (a - T) / (h - T)));
|
|
6547
|
+
this._visemeResult.mouthOpenY = d.mouthOpenY + u * (m.mouthOpenY - d.mouthOpenY), this._visemeResult.mouthForm = d.mouthForm + u * (m.mouthForm - d.mouthForm);
|
|
6535
6548
|
} else
|
|
6536
6549
|
this._visemeResult.mouthOpenY = d.mouthOpenY, this._visemeResult.mouthForm = d.mouthForm;
|
|
6537
6550
|
return this._visemeResult;
|
|
@@ -6556,24 +6569,24 @@ class vt {
|
|
|
6556
6569
|
if (typeof window > "u")
|
|
6557
6570
|
return;
|
|
6558
6571
|
if (!this.audioContext) {
|
|
6559
|
-
const a =
|
|
6572
|
+
const a = ve, c = Xt;
|
|
6560
6573
|
try {
|
|
6561
6574
|
this.audioContext = new AudioContext({ sampleRate: a, latencyHint: c });
|
|
6562
6575
|
} catch (l) {
|
|
6563
6576
|
try {
|
|
6564
6577
|
this.audioContext = new AudioContext({ latencyHint: c });
|
|
6565
|
-
} catch (
|
|
6578
|
+
} catch (f) {
|
|
6566
6579
|
try {
|
|
6567
6580
|
this.audioContext = new AudioContext();
|
|
6568
|
-
} catch (
|
|
6569
|
-
k.warn(`Failed to create AudioContext: ${J(
|
|
6581
|
+
} catch (p) {
|
|
6582
|
+
k.warn(`Failed to create AudioContext: ${J(p)}`), this.audioContext = null;
|
|
6570
6583
|
return;
|
|
6571
6584
|
}
|
|
6572
|
-
k.debug(`AudioContext latencyHint unsupported: ${J(
|
|
6585
|
+
k.debug(`AudioContext latencyHint unsupported: ${J(f)}`);
|
|
6573
6586
|
}
|
|
6574
6587
|
k.debug(`AudioContext sample rate request unsupported: ${J(l)}`);
|
|
6575
6588
|
}
|
|
6576
|
-
this.outputSampleRateHz = this.audioContext.sampleRate ||
|
|
6589
|
+
this.outputSampleRateHz = this.audioContext.sampleRate || ve, this.outputSampleRateHz !== a && k.debug(`AudioContext running at ${this.outputSampleRateHz}Hz (requested ${a}Hz)`), this.attachAudioContextHealthHandlers(this.audioContext);
|
|
6577
6590
|
}
|
|
6578
6591
|
const r = this.audioContext, s = this.resolveDiagnosticsConfig();
|
|
6579
6592
|
if ((this.config.performance?.preferAudioWorklet ?? !0) && gs(r)) {
|
|
@@ -6706,10 +6719,10 @@ class vt {
|
|
|
6706
6719
|
URL.revokeObjectURL(this.workletModuleUrl);
|
|
6707
6720
|
} catch {
|
|
6708
6721
|
}
|
|
6709
|
-
this.workletModuleKey = i, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([
|
|
6722
|
+
this.workletModuleKey = i, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([xh({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: x })], { type: "text/javascript" }));
|
|
6710
6723
|
}
|
|
6711
|
-
this.workletReady || (this.workletReady = e.audioWorklet.addModule(this.workletModuleUrl).catch((
|
|
6712
|
-
throw k.warn(`Failed to load AudioWorklet module, falling back: ${J(
|
|
6724
|
+
this.workletReady || (this.workletReady = e.audioWorklet.addModule(this.workletModuleUrl).catch((f) => {
|
|
6725
|
+
throw k.warn(`Failed to load AudioWorklet module, falling back: ${J(f)}`), f;
|
|
6713
6726
|
}));
|
|
6714
6727
|
try {
|
|
6715
6728
|
await this.workletReady;
|
|
@@ -6718,7 +6731,7 @@ class vt {
|
|
|
6718
6731
|
return;
|
|
6719
6732
|
}
|
|
6720
6733
|
this.stopScriptProcessor();
|
|
6721
|
-
const a = (this.config.performance?.preferSharedArrayBuffer ?? !0) &&
|
|
6734
|
+
const a = (this.config.performance?.preferSharedArrayBuffer ?? !0) && Pe();
|
|
6722
6735
|
this.audioWorkletNode = new AudioWorkletNode(e, "ikon-audio-player", {
|
|
6723
6736
|
numberOfInputs: 0,
|
|
6724
6737
|
numberOfOutputs: 1,
|
|
@@ -6728,31 +6741,31 @@ class vt {
|
|
|
6728
6741
|
useSharedArrayBuffer: a,
|
|
6729
6742
|
outputChannels: x
|
|
6730
6743
|
}
|
|
6731
|
-
}), this.audioWorkletNode.port.onmessage = (
|
|
6732
|
-
const
|
|
6733
|
-
if (!(!
|
|
6734
|
-
if (
|
|
6735
|
-
const d =
|
|
6736
|
-
d.level === "error" ? k.error(`[Worklet]${
|
|
6744
|
+
}), this.audioWorkletNode.port.onmessage = (f) => {
|
|
6745
|
+
const p = f.data;
|
|
6746
|
+
if (!(!p || typeof p != "object")) {
|
|
6747
|
+
if (p.type === "log") {
|
|
6748
|
+
const d = p, m = d.streamId ? ` [stream=${d.streamId.substring(0, 8)}]` : "";
|
|
6749
|
+
d.level === "error" ? k.error(`[Worklet]${m} ${d.message}`) : d.level === "warn" ? k.warn(`[Worklet]${m} ${d.message}`) : k.info(`[Worklet]${m} ${d.message}`);
|
|
6737
6750
|
return;
|
|
6738
6751
|
}
|
|
6739
|
-
if (
|
|
6752
|
+
if (p.type === "stats") {
|
|
6740
6753
|
if (!n.enabled)
|
|
6741
6754
|
return;
|
|
6742
|
-
const d =
|
|
6755
|
+
const d = p;
|
|
6743
6756
|
k.debug(`[Audio] stream=${d.streamId.substring(0, 8)} state=${d.state} buffer=${d.bufferMs.toFixed(0)}ms target=${d.targetMs.toFixed(0)}ms jitter=${d.jitterMs.toFixed(1)}ms underrun=${d.underrunCount} drop=${d.dropCount}`);
|
|
6744
6757
|
return;
|
|
6745
6758
|
}
|
|
6746
|
-
if (
|
|
6747
|
-
const d =
|
|
6759
|
+
if (p.type === "streamDrained" && "streamId" in p && typeof p.streamId == "string") {
|
|
6760
|
+
const d = p.streamId;
|
|
6748
6761
|
this.activeStreams.delete(d), this.activeStreams.size === 0 && this.removeUnlockHandler();
|
|
6749
6762
|
return;
|
|
6750
6763
|
}
|
|
6751
6764
|
}
|
|
6752
6765
|
}, this.audioWorkletNode.connect(e.destination), this.stopScriptProcessorDiagnostics(), await this.resumeAudioContextIfPossible(e, r, s), this.rebindWorkerTransportIfNeeded();
|
|
6753
6766
|
const c = this.pendingWorkletMessages.splice(0);
|
|
6754
|
-
for (const
|
|
6755
|
-
this.postToWorklet(
|
|
6767
|
+
for (const f of c)
|
|
6768
|
+
this.postToWorklet(f);
|
|
6756
6769
|
const l = this.getContextState(e) === "running";
|
|
6757
6770
|
this.notifyPlaybackActive(l);
|
|
6758
6771
|
}
|
|
@@ -6760,63 +6773,63 @@ class vt {
|
|
|
6760
6773
|
if (this.scriptProcessorNode)
|
|
6761
6774
|
return;
|
|
6762
6775
|
this.stopAudioWorklet(), this.pendingWorkletMessages = [];
|
|
6763
|
-
const r = 1024, s = new Float32Array(r * x), i = Math.round(this.outputSampleRateHz * As / 1e3), o = Math.round(this.outputSampleRateHz * ct / 1e3), a = 1 / i, c = 1 / o, l = new Array(x),
|
|
6764
|
-
|
|
6765
|
-
const
|
|
6766
|
-
for (let
|
|
6767
|
-
const u =
|
|
6768
|
-
u.fill(0), l[
|
|
6769
|
-
}
|
|
6770
|
-
let
|
|
6771
|
-
|
|
6772
|
-
for (const [
|
|
6773
|
-
u.totalSamples > 0 && (
|
|
6774
|
-
for (let C = 0; C <
|
|
6776
|
+
const r = 1024, s = new Float32Array(r * x), i = Math.round(this.outputSampleRateHz * As / 1e3), o = Math.round(this.outputSampleRateHz * ct / 1e3), a = 1 / i, c = 1 / o, l = new Array(x), f = [], p = e.createScriptProcessor(r, 0, x);
|
|
6777
|
+
p.onaudioprocess = (d) => {
|
|
6778
|
+
const m = d.outputBuffer, S = m.numberOfChannels, T = m.length;
|
|
6779
|
+
for (let h = 0; h < S; h++) {
|
|
6780
|
+
const u = m.getChannelData(h);
|
|
6781
|
+
u.fill(0), l[h] = u;
|
|
6782
|
+
}
|
|
6783
|
+
let E = 0;
|
|
6784
|
+
f.length = 0;
|
|
6785
|
+
for (const [h, u] of this.fallbackQueues.entries()) {
|
|
6786
|
+
u.totalSamples > 0 && (E += 1), (u.ending || u.inputDrained) && u.fadeDirection !== "out" && u.totalSamples / S * 1e3 / this.outputSampleRateHz <= ct * 2 && (u.fadeDirection = "out"), this.readFromFallbackQueue(u, s), (u.totalSamples > 0 || !u.hasLastOut) && ((!u.lastOut || u.lastOut.length !== s.length) && (u.lastOut = new Float32Array(s.length)), u.lastOut.set(s), u.hasLastOut = !0);
|
|
6787
|
+
for (let C = 0; C < T; C++) {
|
|
6775
6788
|
u.fadeDirection === "in" ? (u.fadeGain = Math.min(1, u.fadeGain + a), u.fadeGain >= 1 && (u.fadeDirection = "none")) : u.fadeDirection === "out" && (u.fadeGain = Math.max(0, u.fadeGain - c), u.fadeGain <= 0 && (u.fadeDirection = "none"));
|
|
6776
|
-
for (let N = 0; N <
|
|
6777
|
-
const I = s[C *
|
|
6789
|
+
for (let N = 0; N < S; N++) {
|
|
6790
|
+
const I = s[C * S + N];
|
|
6778
6791
|
l[N][C] += I * u.fadeGain;
|
|
6779
6792
|
}
|
|
6780
6793
|
}
|
|
6781
6794
|
const v = u.ending || u.inputDrained;
|
|
6782
6795
|
if (v && u.totalSamples <= 0) {
|
|
6783
6796
|
if (u.fadeDirection === "out" && u.fadeGain > 1e-3) {
|
|
6784
|
-
for (let C = 0; C <
|
|
6797
|
+
for (let C = 0; C < T; C++)
|
|
6785
6798
|
if (u.fadeGain = Math.max(0, u.fadeGain - c), u.fadeGain <= 1e-3) {
|
|
6786
6799
|
u.fadeGain = 0, u.fadeDirection = "none";
|
|
6787
6800
|
break;
|
|
6788
6801
|
}
|
|
6789
6802
|
}
|
|
6790
|
-
u.fadeGain <= 1e-3 && u.ending &&
|
|
6803
|
+
u.fadeGain <= 1e-3 && u.ending && f.push(h);
|
|
6791
6804
|
} else if (!v && u.totalSamples <= 0 && u.hasLastOut && u.lastOut && u.fadeGain > 1e-3) {
|
|
6792
6805
|
u.fadeDirection = "out", u.underrunPending = !0;
|
|
6793
|
-
const C = u.lastOut, N =
|
|
6794
|
-
for (let I = 0; I <
|
|
6806
|
+
const C = u.lastOut, N = T - 1;
|
|
6807
|
+
for (let I = 0; I < T; I++) {
|
|
6795
6808
|
u.fadeGain = Math.max(0, u.fadeGain - c), u.fadeGain <= 0 && (u.fadeDirection = "none");
|
|
6796
|
-
for (let z = 0; z <
|
|
6797
|
-
const Ut = C[N *
|
|
6809
|
+
for (let z = 0; z < S; z++) {
|
|
6810
|
+
const Ut = C[N * S + z];
|
|
6798
6811
|
l[z][I] += Ut * u.fadeGain;
|
|
6799
6812
|
}
|
|
6800
6813
|
}
|
|
6801
6814
|
}
|
|
6802
6815
|
}
|
|
6803
|
-
if (
|
|
6804
|
-
for (const
|
|
6805
|
-
this.fallbackQueues.delete(
|
|
6816
|
+
if (f.length > 0) {
|
|
6817
|
+
for (const h of f)
|
|
6818
|
+
this.fallbackQueues.delete(h), this.activeStreams.delete(h);
|
|
6806
6819
|
this.activeStreams.size === 0 && this.removeUnlockHandler();
|
|
6807
6820
|
}
|
|
6808
|
-
if (
|
|
6809
|
-
const
|
|
6810
|
-
for (let u = 0; u <
|
|
6811
|
-
for (let v = 0; v <
|
|
6812
|
-
l[v][u] *=
|
|
6821
|
+
if (E > 1) {
|
|
6822
|
+
const h = 1 / Math.sqrt(E);
|
|
6823
|
+
for (let u = 0; u < T; u++)
|
|
6824
|
+
for (let v = 0; v < S; v++)
|
|
6825
|
+
l[v][u] *= h;
|
|
6813
6826
|
}
|
|
6814
|
-
for (let
|
|
6815
|
-
for (let u = 0; u <
|
|
6816
|
-
const v = l[u][
|
|
6817
|
-
l[u][
|
|
6827
|
+
for (let h = 0; h < T; h++)
|
|
6828
|
+
for (let u = 0; u < S; u++) {
|
|
6829
|
+
const v = l[u][h];
|
|
6830
|
+
l[u][h] = v > 1 ? 1 : v < -1 ? -1 : v;
|
|
6818
6831
|
}
|
|
6819
|
-
},
|
|
6832
|
+
}, p.connect(e.destination), this.scriptProcessorNode = p, this.ensureScriptProcessorDiagnostics(n);
|
|
6820
6833
|
}
|
|
6821
6834
|
compactFallbackQueue(e) {
|
|
6822
6835
|
if (e.headIndex <= 32 || e.headIndex <= e.chunks.length / 2) return;
|
|
@@ -6932,7 +6945,7 @@ class vt {
|
|
|
6932
6945
|
rebindWorkerTransportIfNeeded() {
|
|
6933
6946
|
if (!this.audioWorker || !this.audioContext)
|
|
6934
6947
|
return;
|
|
6935
|
-
const s = (this.config.performance?.preferSharedArrayBuffer ?? !0) && !!this.audioWorkletNode &&
|
|
6948
|
+
const s = (this.config.performance?.preferSharedArrayBuffer ?? !0) && !!this.audioWorkletNode && Pe() ? "sab" : "pcm";
|
|
6936
6949
|
try {
|
|
6937
6950
|
this.audioWorker.postMessage({
|
|
6938
6951
|
type: "rebind",
|
|
@@ -6957,17 +6970,17 @@ class vt {
|
|
|
6957
6970
|
}
|
|
6958
6971
|
this.protocolPort = e;
|
|
6959
6972
|
try {
|
|
6960
|
-
this.audioWorker = new
|
|
6961
|
-
} catch (
|
|
6962
|
-
k.warn(`Failed to create audio worker: ${J(
|
|
6973
|
+
this.audioWorker = new Ah();
|
|
6974
|
+
} catch (p) {
|
|
6975
|
+
k.warn(`Failed to create audio worker: ${J(p)}`), this.protocolPort.close(), this.protocolPort = null;
|
|
6963
6976
|
return;
|
|
6964
6977
|
}
|
|
6965
6978
|
const n = this.audioWorker;
|
|
6966
|
-
n.addEventListener("message", (
|
|
6967
|
-
const d = [
|
|
6979
|
+
n.addEventListener("message", (p) => this.onAudioWorkerMessage(p.data)), n.addEventListener("error", (p) => {
|
|
6980
|
+
const d = [p.message, p.filename, p.lineno, p.colno].filter((m) => m != null && String(m).length > 0);
|
|
6968
6981
|
k.error(`Audio worker failed: ${d.join(" ")}`.trim());
|
|
6969
6982
|
});
|
|
6970
|
-
const s = (this.config.performance?.preferSharedArrayBuffer ?? !0) && !!this.audioWorkletNode &&
|
|
6983
|
+
const s = (this.config.performance?.preferSharedArrayBuffer ?? !0) && !!this.audioWorkletNode && Pe(), i = this.config.performance?.preferWebCodecs ?? !0, o = {
|
|
6971
6984
|
type: "configure",
|
|
6972
6985
|
transport: s ? "sab" : "pcm",
|
|
6973
6986
|
outputSampleRate: this.outputSampleRateHz,
|
|
@@ -6975,8 +6988,8 @@ class vt {
|
|
|
6975
6988
|
preferWebCodecs: i
|
|
6976
6989
|
};
|
|
6977
6990
|
n.postMessage(o), n.postMessage({ type: "attachProtocolPort", port: e.port }, [e.port]);
|
|
6978
|
-
const a = this.audioWorkletNode ? "AudioWorklet" : "ScriptProcessor", c = s ? "SharedArrayBuffer" : "MessagePort",
|
|
6979
|
-
k.debug(`Audio initialized: renderer=${a}, transport=${c}, decoder=${
|
|
6991
|
+
const a = this.audioWorkletNode ? "AudioWorklet" : "ScriptProcessor", c = s ? "SharedArrayBuffer" : "MessagePort", f = i && typeof AudioDecoder < "u" ? "WebCodecs" : "WASM Opus";
|
|
6992
|
+
k.debug(`Audio initialized: renderer=${a}, transport=${c}, decoder=${f}, output=${this.outputSampleRateHz}Hz/${x}ch`);
|
|
6980
6993
|
}
|
|
6981
6994
|
onAudioWorkerMessage(e) {
|
|
6982
6995
|
if (e.type === "streamBegin") {
|
|
@@ -7041,8 +7054,8 @@ class vt {
|
|
|
7041
7054
|
s.epochTimestampSamples = e.timestampInterleavedSamples;
|
|
7042
7055
|
const c = this.audioContext;
|
|
7043
7056
|
if (c) {
|
|
7044
|
-
const l = (c.outputLatency ?? 0) + (c.baseLatency ?? 0),
|
|
7045
|
-
s.playbackStartContextTime = c.currentTime +
|
|
7057
|
+
const l = (c.outputLatency ?? 0) + (c.baseLatency ?? 0), f = Ph + l * 1e3, p = Math.min(Fh, Math.max(Lh, f));
|
|
7058
|
+
s.playbackStartContextTime = c.currentTime + p / 1e3;
|
|
7046
7059
|
}
|
|
7047
7060
|
s.timingEstablished = !0;
|
|
7048
7061
|
}
|
|
@@ -7164,7 +7177,7 @@ class vt {
|
|
|
7164
7177
|
}));
|
|
7165
7178
|
}
|
|
7166
7179
|
}
|
|
7167
|
-
function
|
|
7180
|
+
function Wh(t) {
|
|
7168
7181
|
return new Worker(
|
|
7169
7182
|
"" + new URL("assets/video-playback-worker-DSozRiYd.js", import.meta.url).href,
|
|
7170
7183
|
{
|
|
@@ -7173,11 +7186,11 @@ function Mh(t) {
|
|
|
7173
7186
|
}
|
|
7174
7187
|
);
|
|
7175
7188
|
}
|
|
7176
|
-
const j =
|
|
7189
|
+
const j = L("IkonVideoPlayback");
|
|
7177
7190
|
function ze(t) {
|
|
7178
7191
|
return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
|
|
7179
7192
|
}
|
|
7180
|
-
class
|
|
7193
|
+
class Gh {
|
|
7181
7194
|
client;
|
|
7182
7195
|
config;
|
|
7183
7196
|
enabled = !0;
|
|
@@ -7252,7 +7265,7 @@ class Lh {
|
|
|
7252
7265
|
}
|
|
7253
7266
|
let e;
|
|
7254
7267
|
try {
|
|
7255
|
-
e = new
|
|
7268
|
+
e = new Wh();
|
|
7256
7269
|
} catch (n) {
|
|
7257
7270
|
j.warn(`Failed to create video worker: ${ze(n)}`);
|
|
7258
7271
|
return;
|
|
@@ -7391,11 +7404,11 @@ class Lh {
|
|
|
7391
7404
|
}));
|
|
7392
7405
|
}
|
|
7393
7406
|
}
|
|
7394
|
-
class
|
|
7407
|
+
class Vh {
|
|
7395
7408
|
audio;
|
|
7396
7409
|
video;
|
|
7397
7410
|
constructor(e, n) {
|
|
7398
|
-
this.audio = new vt(e, n?.audio), this.video = new
|
|
7411
|
+
this.audio = new vt(e, n?.audio), this.video = new Gh(e, n?.video), n?.mediaSession && this.audio.setMediaSession(n.mediaSession);
|
|
7399
7412
|
}
|
|
7400
7413
|
/**
|
|
7401
7414
|
* Releases media resources (workers, audio graph, decoders).
|
|
@@ -7406,7 +7419,7 @@ class Ph {
|
|
|
7406
7419
|
this.audio.dispose(), this.video.dispose();
|
|
7407
7420
|
}
|
|
7408
7421
|
}
|
|
7409
|
-
class
|
|
7422
|
+
class Hh {
|
|
7410
7423
|
static getStorageForCapacity(e, n) {
|
|
7411
7424
|
const r = Int32Array.BYTES_PER_ELEMENT * 2, s = n.BYTES_PER_ELEMENT * e;
|
|
7412
7425
|
return new SharedArrayBuffer(r + s);
|
|
@@ -7460,7 +7473,7 @@ class Fh {
|
|
|
7460
7473
|
return r = (r + n) % this.capacity, Atomics.store(this.readWrite, 0, r), n;
|
|
7461
7474
|
}
|
|
7462
7475
|
}
|
|
7463
|
-
function
|
|
7476
|
+
function $h(t) {
|
|
7464
7477
|
return new Worker(
|
|
7465
7478
|
"" + new URL("assets/audio-capture-worker-DuKZS6HJ.js", import.meta.url).href,
|
|
7466
7479
|
{
|
|
@@ -7469,11 +7482,11 @@ function Bh(t) {
|
|
|
7469
7482
|
}
|
|
7470
7483
|
);
|
|
7471
7484
|
}
|
|
7472
|
-
const R =
|
|
7473
|
-
function
|
|
7485
|
+
const R = L("IkonAudioCapture"), Ue = 3, Kh = 200, Yh = 2e3, jh = 5e3, Qt = 3e3;
|
|
7486
|
+
function zh(t) {
|
|
7474
7487
|
return new Promise((e) => setTimeout(e, t));
|
|
7475
7488
|
}
|
|
7476
|
-
function
|
|
7489
|
+
function Xh(t) {
|
|
7477
7490
|
switch (t.name) {
|
|
7478
7491
|
// Transient errors - worth retrying
|
|
7479
7492
|
case "NotReadableError":
|
|
@@ -7498,11 +7511,11 @@ function Hh(t) {
|
|
|
7498
7511
|
return { action: "fail", reason: "unknown", canRetry: !1 };
|
|
7499
7512
|
}
|
|
7500
7513
|
}
|
|
7501
|
-
function
|
|
7514
|
+
function Jh() {
|
|
7502
7515
|
const t = globalThis.crypto;
|
|
7503
7516
|
return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
7504
7517
|
}
|
|
7505
|
-
function
|
|
7518
|
+
function Qh() {
|
|
7506
7519
|
return `
|
|
7507
7520
|
class RingBuffer {
|
|
7508
7521
|
static getStorageForCapacity(capacity, type) {
|
|
@@ -7631,7 +7644,7 @@ class IkonAudioCaptureProcessor extends AudioWorkletProcessor {
|
|
|
7631
7644
|
registerProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);
|
|
7632
7645
|
`;
|
|
7633
7646
|
}
|
|
7634
|
-
class
|
|
7647
|
+
class Zh {
|
|
7635
7648
|
constructor(e, n) {
|
|
7636
7649
|
this.client = e, this.config = n ?? {}, this.setupDeviceChangeListener();
|
|
7637
7650
|
}
|
|
@@ -7722,14 +7735,14 @@ class Yh {
|
|
|
7722
7735
|
if (e.stopped)
|
|
7723
7736
|
return;
|
|
7724
7737
|
const i = Date.now(), o = n.name;
|
|
7725
|
-
if (e.lastErrorReason === r && e.lastErrorName === o && i - e.lastErrorTime <
|
|
7738
|
+
if (e.lastErrorReason === r && e.lastErrorName === o && i - e.lastErrorTime < jh)
|
|
7726
7739
|
return;
|
|
7727
7740
|
e.lastErrorTime = i, e.lastErrorReason = r, e.lastErrorName = o;
|
|
7728
7741
|
const a = this.config.autoRestartPolicy;
|
|
7729
7742
|
if (a?.enabled && s) {
|
|
7730
|
-
const c = a.restartableReasons ?? ["track-ended", "device-disconnected"], l = a.maxRestarts ?? 3,
|
|
7743
|
+
const c = a.restartableReasons ?? ["track-ended", "device-disconnected"], l = a.maxRestarts ?? 3, f = a.backoffMs ?? [500, 1e3, 2e3];
|
|
7731
7744
|
if (i - e.lastStableTime > 3e4 && (e.restartCount = 0), c.includes(r) && e.restartCount < l) {
|
|
7732
|
-
const d =
|
|
7745
|
+
const d = f[Math.min(e.restartCount, f.length - 1)];
|
|
7733
7746
|
if (e.restartCount++, R.info(`Auto-restarting capture (attempt ${e.restartCount}/${l}) in ${d}ms, reason=${r}`), this.emitDiagnostic({
|
|
7734
7747
|
event: "auto-restart",
|
|
7735
7748
|
captureId: e.captureId,
|
|
@@ -7745,7 +7758,7 @@ class Yh {
|
|
|
7745
7758
|
} catch {
|
|
7746
7759
|
}
|
|
7747
7760
|
e.pendingRestartTimer && clearTimeout(e.pendingRestartTimer);
|
|
7748
|
-
const
|
|
7761
|
+
const m = e.restartCount, S = e.onError, T = {
|
|
7749
7762
|
...e.originalRequest,
|
|
7750
7763
|
constraints: e.currentConstraints,
|
|
7751
7764
|
options: e.currentOptions,
|
|
@@ -7753,19 +7766,19 @@ class Yh {
|
|
|
7753
7766
|
onStateChange: e.onStateChange
|
|
7754
7767
|
};
|
|
7755
7768
|
e.pendingRestartTimer = setTimeout(() => {
|
|
7756
|
-
e.pendingRestartTimer = null, !(!e.stopped || e.stoppedReason !== "recoverable-error") && this.startMic(
|
|
7757
|
-
const
|
|
7758
|
-
|
|
7759
|
-
}).catch((
|
|
7760
|
-
R.warn(`Auto-restart failed: ${
|
|
7761
|
-
const
|
|
7769
|
+
e.pendingRestartTimer = null, !(!e.stopped || e.stoppedReason !== "recoverable-error") && this.startMic(T).then((E) => {
|
|
7770
|
+
const h = this.captures.get(E.captureId);
|
|
7771
|
+
h && (h.restartCount = m, h.lastStableTime = Date.now());
|
|
7772
|
+
}).catch((E) => {
|
|
7773
|
+
R.warn(`Auto-restart failed: ${E}`);
|
|
7774
|
+
const h = E instanceof Error ? E : new Error(String(E));
|
|
7762
7775
|
let u = "unknown";
|
|
7763
|
-
if (
|
|
7776
|
+
if (h.name === "NotAllowedError" && (u = "permission-revoked"), S)
|
|
7764
7777
|
try {
|
|
7765
|
-
|
|
7766
|
-
new Error(`Auto-restart failed: ${
|
|
7778
|
+
S(
|
|
7779
|
+
new Error(`Auto-restart failed: ${h.message}`),
|
|
7767
7780
|
u,
|
|
7768
|
-
|
|
7781
|
+
m < l && u !== "permission-revoked"
|
|
7769
7782
|
);
|
|
7770
7783
|
} catch {
|
|
7771
7784
|
}
|
|
@@ -7958,7 +7971,7 @@ class Yh {
|
|
|
7958
7971
|
ensureWorker() {
|
|
7959
7972
|
if (this.worker)
|
|
7960
7973
|
return this.worker;
|
|
7961
|
-
const e = new
|
|
7974
|
+
const e = new $h();
|
|
7962
7975
|
return this.worker = e, e.addEventListener("message", (n) => {
|
|
7963
7976
|
const r = n.data;
|
|
7964
7977
|
if (r?.type === "error") {
|
|
@@ -8038,25 +8051,25 @@ class Yh {
|
|
|
8038
8051
|
*/
|
|
8039
8052
|
async tryGetUserMediaWithRetries(e) {
|
|
8040
8053
|
let n = new Error("No attempts made"), r = { action: "fail", reason: "unknown", canRetry: !1 };
|
|
8041
|
-
for (let s = 0; s <
|
|
8054
|
+
for (let s = 0; s < Ue; s++)
|
|
8042
8055
|
try {
|
|
8043
8056
|
return { stream: await navigator.mediaDevices.getUserMedia({ audio: e }), error: n, errorInfo: r };
|
|
8044
8057
|
} catch (i) {
|
|
8045
|
-
if (n = i instanceof Error ? i : new Error(String(i)), r =
|
|
8046
|
-
`getUserMedia attempt ${s + 1}/${
|
|
8058
|
+
if (n = i instanceof Error ? i : new Error(String(i)), r = Xh(n), R.debug(
|
|
8059
|
+
`getUserMedia attempt ${s + 1}/${Ue} failed: ${n.name} (action: ${r.action})`
|
|
8047
8060
|
), this.emitDiagnostic({
|
|
8048
8061
|
event: "retry",
|
|
8049
8062
|
details: {
|
|
8050
8063
|
attempt: s + 1,
|
|
8051
|
-
maxAttempts:
|
|
8064
|
+
maxAttempts: Ue,
|
|
8052
8065
|
errorName: n.name,
|
|
8053
8066
|
action: r.action
|
|
8054
8067
|
}
|
|
8055
8068
|
}), r.action !== "retry")
|
|
8056
8069
|
break;
|
|
8057
|
-
if (s <
|
|
8058
|
-
const o =
|
|
8059
|
-
R.debug(`Retrying getUserMedia in ${o}ms`), await
|
|
8070
|
+
if (s < Ue - 1) {
|
|
8071
|
+
const o = Kh * (s + 1);
|
|
8072
|
+
R.debug(`Retrying getUserMedia in ${o}ms`), await zh(o);
|
|
8060
8073
|
}
|
|
8061
8074
|
}
|
|
8062
8075
|
return { stream: null, error: n, errorInfo: r };
|
|
@@ -8068,7 +8081,7 @@ class Yh {
|
|
|
8068
8081
|
async ensureWorklet(e) {
|
|
8069
8082
|
if (!gs(e))
|
|
8070
8083
|
throw new Error("AudioWorklet is not supported in this browser");
|
|
8071
|
-
if (this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([
|
|
8084
|
+
if (this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([Qh()], { type: "text/javascript" }))), this.workletReady && this.workletContext === e)
|
|
8072
8085
|
try {
|
|
8073
8086
|
await this.workletReady;
|
|
8074
8087
|
return;
|
|
@@ -8090,7 +8103,7 @@ class Yh {
|
|
|
8090
8103
|
throw new Error("Cannot start audio capture before client is connected");
|
|
8091
8104
|
if (this.client.isWebRtcEnabled)
|
|
8092
8105
|
return this.startMicWebRtc(e);
|
|
8093
|
-
const r =
|
|
8106
|
+
const r = Jh(), s = {
|
|
8094
8107
|
captureId: r,
|
|
8095
8108
|
aborted: !1,
|
|
8096
8109
|
stream: null,
|
|
@@ -8125,58 +8138,58 @@ class Yh {
|
|
|
8125
8138
|
if (!l)
|
|
8126
8139
|
throw a.getTracks().forEach((y) => y.stop()), new Error("No audio track available");
|
|
8127
8140
|
await this.ensureWorklet(o), i();
|
|
8128
|
-
const
|
|
8129
|
-
s.source =
|
|
8141
|
+
const f = this.allocateTrackId(), p = o.createMediaStreamSource(a);
|
|
8142
|
+
s.source = p;
|
|
8130
8143
|
const d = o.createGain();
|
|
8131
8144
|
d.gain.value = 0, d.connect(o.destination), s.gain = d;
|
|
8132
|
-
const
|
|
8133
|
-
let
|
|
8134
|
-
if (
|
|
8145
|
+
const T = Pe() ? "sab" : "pcm";
|
|
8146
|
+
let E;
|
|
8147
|
+
if (T === "sab") {
|
|
8135
8148
|
const y = Math.floor(o.sampleRate * 10);
|
|
8136
|
-
|
|
8149
|
+
E = Hh.getStorageForCapacity(y, Float32Array);
|
|
8137
8150
|
}
|
|
8138
|
-
const
|
|
8151
|
+
const h = "microphone", u = this.ensureWorker(), v = e.onStopped;
|
|
8139
8152
|
u.postMessage({
|
|
8140
8153
|
type: "start",
|
|
8141
8154
|
captureId: r,
|
|
8142
8155
|
streamId: r,
|
|
8143
|
-
sourceType:
|
|
8156
|
+
sourceType: h,
|
|
8144
8157
|
senderId: n,
|
|
8145
|
-
trackId:
|
|
8158
|
+
trackId: f,
|
|
8146
8159
|
sampleRate: o.sampleRate,
|
|
8147
8160
|
channels: 1,
|
|
8148
8161
|
options: {
|
|
8149
8162
|
...e.options,
|
|
8150
8163
|
preferWebCodecs: this.config.performance?.preferWebCodecs
|
|
8151
8164
|
},
|
|
8152
|
-
transport:
|
|
8153
|
-
sharedArrayBuffer:
|
|
8165
|
+
transport: T,
|
|
8166
|
+
sharedArrayBuffer: E
|
|
8154
8167
|
}), await new Promise((y, B) => {
|
|
8155
8168
|
const $ = setTimeout(() => {
|
|
8156
|
-
u.removeEventListener("message",
|
|
8157
|
-
}, 1e4),
|
|
8158
|
-
const
|
|
8159
|
-
if (
|
|
8160
|
-
clearTimeout($), u.removeEventListener("message",
|
|
8161
|
-
else if (
|
|
8162
|
-
clearTimeout($), u.removeEventListener("message",
|
|
8163
|
-
const Ms =
|
|
8169
|
+
u.removeEventListener("message", Re), B(new Error("Audio capture worker start timeout"));
|
|
8170
|
+
}, 1e4), Re = (Os) => {
|
|
8171
|
+
const fe = Os.data;
|
|
8172
|
+
if (fe?.type === "started" && fe.captureId === r)
|
|
8173
|
+
clearTimeout($), u.removeEventListener("message", Re), y();
|
|
8174
|
+
else if (fe?.type === "error" && fe.captureId === r) {
|
|
8175
|
+
clearTimeout($), u.removeEventListener("message", Re);
|
|
8176
|
+
const Ms = fe.error;
|
|
8164
8177
|
B(new Error(Ms?.message ?? "Audio capture failed to start"));
|
|
8165
8178
|
}
|
|
8166
8179
|
};
|
|
8167
|
-
u.addEventListener("message",
|
|
8180
|
+
u.addEventListener("message", Re);
|
|
8168
8181
|
}), i();
|
|
8169
8182
|
const C = new AudioWorkletNode(o, "ikon-audio-capture", {
|
|
8170
8183
|
numberOfInputs: 1,
|
|
8171
8184
|
numberOfOutputs: 1,
|
|
8172
8185
|
outputChannelCount: [1],
|
|
8173
8186
|
processorOptions: {
|
|
8174
|
-
transport:
|
|
8187
|
+
transport: T,
|
|
8175
8188
|
channels: 1,
|
|
8176
|
-
sharedArrayBuffer:
|
|
8189
|
+
sharedArrayBuffer: E
|
|
8177
8190
|
}
|
|
8178
8191
|
});
|
|
8179
|
-
s.worklet = C,
|
|
8192
|
+
s.worklet = C, p.connect(C), C.connect(d), T === "pcm" && (C.port.onmessage = (y) => {
|
|
8180
8193
|
const B = y.data;
|
|
8181
8194
|
if (!(!B || typeof B != "object") && B.type === "pcm" && B.pcm instanceof Float32Array) {
|
|
8182
8195
|
const $ = B.pcm;
|
|
@@ -8185,11 +8198,11 @@ class Yh {
|
|
|
8185
8198
|
});
|
|
8186
8199
|
const N = this.extractDeviceId(e.constraints), I = {
|
|
8187
8200
|
captureId: r,
|
|
8188
|
-
trackId:
|
|
8201
|
+
trackId: f,
|
|
8189
8202
|
stream: a,
|
|
8190
8203
|
track: l,
|
|
8191
8204
|
ctx: o,
|
|
8192
|
-
source:
|
|
8205
|
+
source: p,
|
|
8193
8206
|
worklet: C,
|
|
8194
8207
|
gain: d,
|
|
8195
8208
|
stopped: !1,
|
|
@@ -8231,7 +8244,7 @@ class Yh {
|
|
|
8231
8244
|
}
|
|
8232
8245
|
this.removeAudioContextStateListener(o, I);
|
|
8233
8246
|
try {
|
|
8234
|
-
|
|
8247
|
+
p.disconnect();
|
|
8235
8248
|
} catch {
|
|
8236
8249
|
}
|
|
8237
8250
|
try {
|
|
@@ -8268,7 +8281,7 @@ class Yh {
|
|
|
8268
8281
|
};
|
|
8269
8282
|
this.setupAudioContextStateListener(o, I), this.setupVisibilityChangeListener(I), this.setupBFCacheHandlers(I), I.healthCheckTimer = setInterval(() => {
|
|
8270
8283
|
this.performHealthCheck(I);
|
|
8271
|
-
},
|
|
8284
|
+
}, Yh);
|
|
8272
8285
|
const z = () => {
|
|
8273
8286
|
I.stopped || (R.warn(`Microphone track ended unexpectedly, captureId=${r.substring(0, 8)}`), this.handleRecoverableError(I, new Error("Microphone track ended unexpectedly"), "track-ended"));
|
|
8274
8287
|
};
|
|
@@ -8479,9 +8492,9 @@ class Yh {
|
|
|
8479
8492
|
return !n || n.stopped ? !1 : this.attemptResumeAsync(n, "userGesture", !0);
|
|
8480
8493
|
}
|
|
8481
8494
|
}
|
|
8482
|
-
const
|
|
8483
|
-
async function
|
|
8484
|
-
const n = e.mime ?? bs, r = e.quality ??
|
|
8495
|
+
const Te = 1280, we = 720, qh = 30, bs = "image/jpeg", ef = 0.92;
|
|
8496
|
+
async function tf(t, e) {
|
|
8497
|
+
const n = e.mime ?? bs, r = e.quality ?? ef;
|
|
8485
8498
|
if (typeof OffscreenCanvas < "u" && t instanceof OffscreenCanvas)
|
|
8486
8499
|
try {
|
|
8487
8500
|
return await t.convertToBlob({ type: n, quality: r });
|
|
@@ -8498,11 +8511,11 @@ async function Xh(t, e) {
|
|
|
8498
8511
|
);
|
|
8499
8512
|
});
|
|
8500
8513
|
}
|
|
8501
|
-
class
|
|
8514
|
+
class nf {
|
|
8502
8515
|
async acquireCameraStream(e) {
|
|
8503
8516
|
if (!navigator.mediaDevices)
|
|
8504
8517
|
throw new Error("Media devices are not available in this environment");
|
|
8505
|
-
const n = e.constraints ?? {}, r = e.width ??
|
|
8518
|
+
const n = e.constraints ?? {}, r = e.width ?? Te, s = e.height ?? we, i = {
|
|
8506
8519
|
...n,
|
|
8507
8520
|
width: n.width ?? { ideal: r },
|
|
8508
8521
|
height: n.height ?? { ideal: s }
|
|
@@ -8520,29 +8533,29 @@ class Jh {
|
|
|
8520
8533
|
} catch {
|
|
8521
8534
|
}
|
|
8522
8535
|
try {
|
|
8523
|
-
await new Promise((
|
|
8524
|
-
const
|
|
8525
|
-
s.addEventListener("loadedmetadata",
|
|
8536
|
+
await new Promise((m, S) => {
|
|
8537
|
+
const T = () => m(), E = () => S(new Error("Failed to load video element"));
|
|
8538
|
+
s.addEventListener("loadedmetadata", T, { once: !0 }), s.addEventListener("error", E, { once: !0 });
|
|
8526
8539
|
});
|
|
8527
8540
|
try {
|
|
8528
8541
|
await s.play();
|
|
8529
8542
|
} catch {
|
|
8530
8543
|
}
|
|
8531
|
-
const i = s.videoWidth || (r.getSettings().width ??
|
|
8544
|
+
const i = s.videoWidth || (r.getSettings().width ?? Te), o = s.videoHeight || (r.getSettings().height ?? we), a = e.width ? Math.max(1, Math.floor(e.width)) : i, c = e.height ? Math.max(1, Math.floor(e.height)) : o;
|
|
8532
8545
|
let l;
|
|
8533
8546
|
if (typeof OffscreenCanvas < "u")
|
|
8534
8547
|
l = new OffscreenCanvas(a, c);
|
|
8535
8548
|
else {
|
|
8536
|
-
const
|
|
8537
|
-
|
|
8549
|
+
const m = document.createElement("canvas");
|
|
8550
|
+
m.width = a, m.height = c, l = m;
|
|
8538
8551
|
}
|
|
8539
|
-
const
|
|
8540
|
-
if (!
|
|
8552
|
+
const f = l.getContext("2d", { alpha: !1 });
|
|
8553
|
+
if (!f)
|
|
8541
8554
|
throw new Error("2D canvas context unavailable");
|
|
8542
|
-
|
|
8543
|
-
const
|
|
8555
|
+
f.drawImage(s, 0, 0, a, c);
|
|
8556
|
+
const p = await tf(l, e), d = await p.arrayBuffer();
|
|
8544
8557
|
return {
|
|
8545
|
-
mime:
|
|
8558
|
+
mime: p.type || e.mime || bs,
|
|
8546
8559
|
width: a,
|
|
8547
8560
|
height: c,
|
|
8548
8561
|
data: new Uint8Array(d)
|
|
@@ -8567,7 +8580,7 @@ class Jh {
|
|
|
8567
8580
|
}
|
|
8568
8581
|
}
|
|
8569
8582
|
}
|
|
8570
|
-
function
|
|
8583
|
+
function rf(t) {
|
|
8571
8584
|
return new Worker(
|
|
8572
8585
|
"" + new URL("assets/video-capture-worker-g7UF_osl.js", import.meta.url).href,
|
|
8573
8586
|
{
|
|
@@ -8576,18 +8589,18 @@ function Qh(t) {
|
|
|
8576
8589
|
}
|
|
8577
8590
|
);
|
|
8578
8591
|
}
|
|
8579
|
-
const
|
|
8580
|
-
function
|
|
8592
|
+
const _e = L("IkonVideoCapture");
|
|
8593
|
+
function sf() {
|
|
8581
8594
|
const t = globalThis.crypto;
|
|
8582
8595
|
return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
8583
8596
|
}
|
|
8584
|
-
function
|
|
8597
|
+
function of() {
|
|
8585
8598
|
const t = globalThis.MediaStreamTrackProcessor;
|
|
8586
8599
|
if (!t)
|
|
8587
8600
|
throw new Error("MediaStreamTrackProcessor is not available in this browser");
|
|
8588
8601
|
return t;
|
|
8589
8602
|
}
|
|
8590
|
-
class
|
|
8603
|
+
class af {
|
|
8591
8604
|
constructor(e) {
|
|
8592
8605
|
this.client = e;
|
|
8593
8606
|
}
|
|
@@ -8603,13 +8616,13 @@ class ef {
|
|
|
8603
8616
|
ensureWorker() {
|
|
8604
8617
|
if (this.worker)
|
|
8605
8618
|
return this.worker;
|
|
8606
|
-
const e = new
|
|
8619
|
+
const e = new rf();
|
|
8607
8620
|
return this.worker = e, e.addEventListener("message", (n) => {
|
|
8608
8621
|
const r = n.data;
|
|
8609
8622
|
if (r?.type === "error") {
|
|
8610
8623
|
const s = r.error;
|
|
8611
|
-
|
|
8612
|
-
} else r?.type === "log" ?
|
|
8624
|
+
_e.warn(`Video capture worker error: ${s?.name ?? "Error"} ${s?.message ?? ""}`);
|
|
8625
|
+
} else r?.type === "log" ? _e.info(r.message) : r?.type === "debug" && _e.debug(r.message);
|
|
8613
8626
|
}), e;
|
|
8614
8627
|
}
|
|
8615
8628
|
ensurePorts() {
|
|
@@ -8630,7 +8643,7 @@ class ef {
|
|
|
8630
8643
|
async getMediaStream(e) {
|
|
8631
8644
|
if (!navigator.mediaDevices)
|
|
8632
8645
|
throw new Error("Media devices are not available in this environment");
|
|
8633
|
-
const n = e.constraints ?? {}, r = e.options?.framerate ??
|
|
8646
|
+
const n = e.constraints ?? {}, r = e.options?.framerate ?? qh;
|
|
8634
8647
|
if (e.sourceType === "screen") {
|
|
8635
8648
|
const a = {
|
|
8636
8649
|
...n,
|
|
@@ -8638,7 +8651,7 @@ class ef {
|
|
|
8638
8651
|
};
|
|
8639
8652
|
return navigator.mediaDevices.getDisplayMedia({ video: a, audio: !1 });
|
|
8640
8653
|
}
|
|
8641
|
-
const s = e.options?.width ??
|
|
8654
|
+
const s = e.options?.width ?? Te, i = e.options?.height ?? we, o = {
|
|
8642
8655
|
...n,
|
|
8643
8656
|
frameRate: n.frameRate ?? { ideal: r },
|
|
8644
8657
|
width: n.width ?? { ideal: s },
|
|
@@ -8691,7 +8704,7 @@ class ef {
|
|
|
8691
8704
|
return e.options;
|
|
8692
8705
|
},
|
|
8693
8706
|
async stop() {
|
|
8694
|
-
a && (a = !1, s.getTracks().forEach((
|
|
8707
|
+
a && (a = !1, s.getTracks().forEach((f) => f.stop()), await n.stopScreenCapture(), c?.());
|
|
8695
8708
|
},
|
|
8696
8709
|
async updateOptions() {
|
|
8697
8710
|
}
|
|
@@ -8709,23 +8722,23 @@ class ef {
|
|
|
8709
8722
|
if (this.client.isWebRtcEnabled && e.sourceType === "screen")
|
|
8710
8723
|
return this.startScreenWebRtc(e);
|
|
8711
8724
|
this.ensurePorts();
|
|
8712
|
-
const r =
|
|
8725
|
+
const r = sf(), s = await this.getMediaStream(e), i = s.getVideoTracks()[0];
|
|
8713
8726
|
if (!i)
|
|
8714
|
-
throw s.getTracks().forEach((
|
|
8715
|
-
e.sourceType === "screen" && await new Promise((
|
|
8716
|
-
const o = i.getSettings(), a = e.sourceType === "screen" ? o.width ??
|
|
8717
|
-
|
|
8727
|
+
throw s.getTracks().forEach((h) => h.stop()), new Error("No video track available");
|
|
8728
|
+
e.sourceType === "screen" && await new Promise((h) => setTimeout(h, 200));
|
|
8729
|
+
const o = i.getSettings(), a = e.sourceType === "screen" ? o.width ?? Te : e.options?.width ?? o.width ?? Te, c = e.sourceType === "screen" ? o.height ?? we : e.options?.height ?? o.height ?? we, l = of(), p = new l({ track: i }).readable, d = this.allocateTrackId(), m = this.ensureWorker(), S = e.sourceType, T = e.onStopped;
|
|
8730
|
+
m.postMessage(
|
|
8718
8731
|
{
|
|
8719
8732
|
type: "start",
|
|
8720
8733
|
captureId: r,
|
|
8721
8734
|
streamId: r,
|
|
8722
|
-
sourceType:
|
|
8735
|
+
sourceType: S,
|
|
8723
8736
|
kind: e.sourceType,
|
|
8724
8737
|
senderId: n,
|
|
8725
8738
|
trackId: d,
|
|
8726
8739
|
width: a,
|
|
8727
8740
|
height: c,
|
|
8728
|
-
readable:
|
|
8741
|
+
readable: p,
|
|
8729
8742
|
options: e.options,
|
|
8730
8743
|
trackSettings: {
|
|
8731
8744
|
width: o.width,
|
|
@@ -8733,9 +8746,9 @@ class ef {
|
|
|
8733
8746
|
frameRate: o.frameRate
|
|
8734
8747
|
}
|
|
8735
8748
|
},
|
|
8736
|
-
[
|
|
8749
|
+
[p]
|
|
8737
8750
|
);
|
|
8738
|
-
const
|
|
8751
|
+
const E = {
|
|
8739
8752
|
captureId: r,
|
|
8740
8753
|
trackId: d,
|
|
8741
8754
|
stream: s,
|
|
@@ -8744,44 +8757,44 @@ class ef {
|
|
|
8744
8757
|
stopped: !1,
|
|
8745
8758
|
currentOptions: e.options,
|
|
8746
8759
|
stop: async () => {
|
|
8747
|
-
if (!
|
|
8748
|
-
|
|
8760
|
+
if (!E.stopped) {
|
|
8761
|
+
E.stopped = !0, this.captures.delete(r), E.dimensionCheckInterval && (clearInterval(E.dimensionCheckInterval), E.dimensionCheckInterval = void 0);
|
|
8749
8762
|
try {
|
|
8750
|
-
s.getTracks().forEach((
|
|
8763
|
+
s.getTracks().forEach((h) => h.stop());
|
|
8751
8764
|
} catch {
|
|
8752
8765
|
}
|
|
8753
|
-
if (
|
|
8766
|
+
if (m.postMessage({ type: "stop", captureId: r }), T)
|
|
8754
8767
|
try {
|
|
8755
|
-
|
|
8768
|
+
T();
|
|
8756
8769
|
} catch {
|
|
8757
8770
|
}
|
|
8758
8771
|
}
|
|
8759
8772
|
},
|
|
8760
|
-
updateOptions: async (
|
|
8761
|
-
if (!
|
|
8762
|
-
if (
|
|
8763
|
-
const u =
|
|
8773
|
+
updateOptions: async (h) => {
|
|
8774
|
+
if (!E.stopped) {
|
|
8775
|
+
if (E.sourceType === "camera") {
|
|
8776
|
+
const u = h.width !== void 0 && h.width !== E.currentOptions?.width, v = h.height !== void 0 && h.height !== E.currentOptions?.height, C = h.framerate !== void 0 && h.framerate !== E.currentOptions?.framerate;
|
|
8764
8777
|
if (u || v || C)
|
|
8765
8778
|
try {
|
|
8766
8779
|
const N = {};
|
|
8767
|
-
|
|
8780
|
+
h.width !== void 0 && (N.width = { ideal: h.width }), h.height !== void 0 && (N.height = { ideal: h.height }), h.framerate !== void 0 && (N.frameRate = { ideal: h.framerate }), await i.applyConstraints(N), _e.info(`Camera track constraints updated: ${h.width}x${h.height}@${h.framerate}fps`);
|
|
8768
8781
|
} catch (N) {
|
|
8769
|
-
|
|
8782
|
+
_e.warn(`Failed to apply camera constraints: ${N}`);
|
|
8770
8783
|
}
|
|
8771
8784
|
}
|
|
8772
|
-
|
|
8785
|
+
E.currentOptions = h, m.postMessage({ type: "updateOptions", captureId: r, options: h });
|
|
8773
8786
|
}
|
|
8774
8787
|
}
|
|
8775
8788
|
};
|
|
8776
8789
|
if (e.sourceType === "screen") {
|
|
8777
|
-
let
|
|
8778
|
-
|
|
8779
|
-
if (
|
|
8780
|
-
|
|
8790
|
+
let h = a, u = c;
|
|
8791
|
+
E.dimensionCheckInterval = setInterval(() => {
|
|
8792
|
+
if (E.stopped) {
|
|
8793
|
+
E.dimensionCheckInterval && (clearInterval(E.dimensionCheckInterval), E.dimensionCheckInterval = void 0);
|
|
8781
8794
|
return;
|
|
8782
8795
|
}
|
|
8783
|
-
const v = i.getSettings(), C = v.width ??
|
|
8784
|
-
(C !==
|
|
8796
|
+
const v = i.getSettings(), C = v.width ?? h, N = v.height ?? u;
|
|
8797
|
+
(C !== h || N !== u) && (h = C, u = N, m.postMessage({
|
|
8785
8798
|
type: "updateDimensions",
|
|
8786
8799
|
captureId: r,
|
|
8787
8800
|
width: C,
|
|
@@ -8790,16 +8803,16 @@ class ef {
|
|
|
8790
8803
|
}, 1e3);
|
|
8791
8804
|
}
|
|
8792
8805
|
return i.addEventListener("ended", () => {
|
|
8793
|
-
|
|
8794
|
-
}), this.captures.set(r,
|
|
8806
|
+
E.stop();
|
|
8807
|
+
}), this.captures.set(r, E), {
|
|
8795
8808
|
captureId: r,
|
|
8796
8809
|
streamId: r,
|
|
8797
8810
|
sourceType: e.sourceType,
|
|
8798
8811
|
get currentOptions() {
|
|
8799
|
-
return
|
|
8812
|
+
return E.currentOptions;
|
|
8800
8813
|
},
|
|
8801
|
-
stop:
|
|
8802
|
-
updateOptions:
|
|
8814
|
+
stop: E.stop,
|
|
8815
|
+
updateOptions: E.updateOptions
|
|
8803
8816
|
};
|
|
8804
8817
|
}
|
|
8805
8818
|
async startCamera(e) {
|
|
@@ -8829,31 +8842,31 @@ class ef {
|
|
|
8829
8842
|
this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
|
|
8830
8843
|
}
|
|
8831
8844
|
}
|
|
8832
|
-
class
|
|
8845
|
+
class cf {
|
|
8833
8846
|
audio;
|
|
8834
8847
|
video;
|
|
8835
8848
|
image;
|
|
8836
8849
|
constructor(e, n) {
|
|
8837
|
-
this.audio = new
|
|
8850
|
+
this.audio = new Zh(e, n?.audio), this.video = new af(e), this.image = new nf();
|
|
8838
8851
|
}
|
|
8839
8852
|
dispose() {
|
|
8840
8853
|
this.audio.dispose(), this.video.dispose();
|
|
8841
8854
|
}
|
|
8842
8855
|
}
|
|
8843
|
-
const Ns =
|
|
8844
|
-
let
|
|
8845
|
-
function
|
|
8846
|
-
return
|
|
8856
|
+
const Ns = L("DebugMode");
|
|
8857
|
+
let re = !1;
|
|
8858
|
+
function lf() {
|
|
8859
|
+
return re = Zd(), re && (ls(He.DEBUG), Ns.warn("Debug mode enabled")), re;
|
|
8847
8860
|
}
|
|
8848
|
-
function
|
|
8849
|
-
return
|
|
8861
|
+
function uf() {
|
|
8862
|
+
return re;
|
|
8850
8863
|
}
|
|
8851
|
-
function
|
|
8852
|
-
|
|
8864
|
+
function df() {
|
|
8865
|
+
re || (re = !0, ls(He.DEBUG), Ns.warn("Debug mode enabled"), zd(_s, "true"));
|
|
8853
8866
|
}
|
|
8854
|
-
function
|
|
8867
|
+
function hf(t) {
|
|
8855
8868
|
return new Worker(
|
|
8856
|
-
"" + new URL("assets/protocol-worker-
|
|
8869
|
+
"" + new URL("assets/protocol-worker-BNeN5rOx.js", import.meta.url).href,
|
|
8857
8870
|
{
|
|
8858
8871
|
type: "module",
|
|
8859
8872
|
name: t?.name
|
|
@@ -8865,8 +8878,8 @@ const Zt = {
|
|
|
8865
8878
|
[b.WebSocket]: 1,
|
|
8866
8879
|
[b.WebTransportProxy]: 2,
|
|
8867
8880
|
[b.WebSocketProxy]: 3
|
|
8868
|
-
}, Xe = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), Je = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), qt = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), en = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), Qe = "ikon_endpoint_type",
|
|
8869
|
-
class
|
|
8881
|
+
}, Xe = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), Je = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), qt = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), en = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), Qe = "ikon_endpoint_type", Oe = "ikon_proxy_preferred";
|
|
8882
|
+
class ff {
|
|
8870
8883
|
isLocal;
|
|
8871
8884
|
_proxyMode;
|
|
8872
8885
|
_websocket;
|
|
@@ -8889,7 +8902,7 @@ class af {
|
|
|
8889
8902
|
markProxyPreferred() {
|
|
8890
8903
|
this._proxyPreferred = !0;
|
|
8891
8904
|
try {
|
|
8892
|
-
localStorage.setItem(
|
|
8905
|
+
localStorage.setItem(Oe, "true");
|
|
8893
8906
|
} catch {
|
|
8894
8907
|
}
|
|
8895
8908
|
}
|
|
@@ -8935,13 +8948,13 @@ class af {
|
|
|
8935
8948
|
if (Xe.has(e)) {
|
|
8936
8949
|
this._proxyPreferred = !0;
|
|
8937
8950
|
try {
|
|
8938
|
-
localStorage.setItem(
|
|
8951
|
+
localStorage.setItem(Oe, "true");
|
|
8939
8952
|
} catch {
|
|
8940
8953
|
}
|
|
8941
8954
|
} else if (Je.has(e)) {
|
|
8942
8955
|
this._proxyPreferred = !1;
|
|
8943
8956
|
try {
|
|
8944
|
-
localStorage.removeItem(
|
|
8957
|
+
localStorage.removeItem(Oe);
|
|
8945
8958
|
} catch {
|
|
8946
8959
|
}
|
|
8947
8960
|
}
|
|
@@ -8973,16 +8986,16 @@ class af {
|
|
|
8973
8986
|
}
|
|
8974
8987
|
loadProxyPreference() {
|
|
8975
8988
|
try {
|
|
8976
|
-
this._proxyPreferred = localStorage.getItem(
|
|
8989
|
+
this._proxyPreferred = localStorage.getItem(Oe) === "true";
|
|
8977
8990
|
} catch {
|
|
8978
8991
|
}
|
|
8979
8992
|
}
|
|
8980
8993
|
}
|
|
8981
|
-
const
|
|
8982
|
-
function
|
|
8994
|
+
const _ = L("IkonClient");
|
|
8995
|
+
function pf() {
|
|
8983
8996
|
return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
|
|
8984
8997
|
}
|
|
8985
|
-
class
|
|
8998
|
+
class xf {
|
|
8986
8999
|
channelManager = null;
|
|
8987
9000
|
protocolWorker = null;
|
|
8988
9001
|
workerManagerState = null;
|
|
@@ -9006,6 +9019,7 @@ class Of {
|
|
|
9006
9019
|
boundPageHide = null;
|
|
9007
9020
|
boundVisibilityChange = null;
|
|
9008
9021
|
boundPopstate = null;
|
|
9022
|
+
boundOnline = null;
|
|
9009
9023
|
// GlobalState handling
|
|
9010
9024
|
_globalState = null;
|
|
9011
9025
|
_globalStateReceived = !1;
|
|
@@ -9036,7 +9050,7 @@ class Of {
|
|
|
9036
9050
|
_fullReauthAttempted = !1;
|
|
9037
9051
|
_reauthInProgress = !1;
|
|
9038
9052
|
// External connect URL mode
|
|
9039
|
-
_waitForExternalConnectUrl =
|
|
9053
|
+
_waitForExternalConnectUrl = pf();
|
|
9040
9054
|
_externalConnectUrlCleanup = null;
|
|
9041
9055
|
/**
|
|
9042
9056
|
* SDK-provided media pipelines (audio/video).
|
|
@@ -9115,25 +9129,27 @@ class Of {
|
|
|
9115
9129
|
if (n > 1)
|
|
9116
9130
|
throw new Error('IkonClient accepts only one of: "local", "apiKey", or "sessionToken" configuration');
|
|
9117
9131
|
je() && zu();
|
|
9118
|
-
const r = e.local ? null :
|
|
9119
|
-
this.endpointSelector = new
|
|
9132
|
+
const r = e.local ? null : Xd(), s = r === !0 ? "force-proxy" : r === !1 ? "force-direct" : "auto", i = e.local ? null : Jd(), o = e.local ? null : Qd(), a = i ?? e.websocket, c = o ?? e.webtransport;
|
|
9133
|
+
this.endpointSelector = new ff({
|
|
9120
9134
|
local: e.local,
|
|
9121
9135
|
proxyMode: s,
|
|
9122
9136
|
websocket: a,
|
|
9123
9137
|
webtransport: c
|
|
9124
|
-
}), s !== "auto" ?
|
|
9125
|
-
const l =
|
|
9138
|
+
}), s !== "auto" ? _.info(`Proxy mode: ${s}`) : this.endpointSelector.proxyPreferred && _.info("Proxy preferred (from previous session)"), (a !== void 0 || c !== void 0) && _.info(`Transport filter: websocket=${a ?? "auto"}, webtransport=${c ?? "auto"}`), this._functionRegistry = new ch(), je() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Ad(this._functionRegistry), this.unregisterSoundFunctions = gh(this._functionRegistry));
|
|
9139
|
+
const l = eh(), f = th(), p = nh();
|
|
9140
|
+
this._audioEnabled = l ?? e.audio?.enabled ?? !0, this._videoEnabled = f ?? e.video?.enabled ?? !0;
|
|
9141
|
+
const d = e.audio ? {
|
|
9126
9142
|
performance: e.audio.performance,
|
|
9127
9143
|
background: e.audio.background,
|
|
9128
9144
|
diagnostics: e.audio.diagnostics
|
|
9129
|
-
} : void 0,
|
|
9130
|
-
this._media = new
|
|
9145
|
+
} : void 0, m = e.video ? { performance: e.video.performance } : void 0;
|
|
9146
|
+
this._media = new Vh(this, { audio: d, video: m, mediaSession: e.mediaSession }), (p ?? e.webRtc?.enabled) || (this._audioEnabled && this._media.audio.setEnabled(!0), this._videoEnabled && this._media.video.setEnabled(!0)), je() && (this._mediaCapture = new cf(this, {
|
|
9131
9147
|
audio: {
|
|
9132
9148
|
performance: {
|
|
9133
9149
|
preferWebCodecs: e.audio?.performance?.preferWebCodecs
|
|
9134
9150
|
}
|
|
9135
9151
|
}
|
|
9136
|
-
}), this.unregisterMediaCaptureFunctions =
|
|
9152
|
+
}), this.unregisterMediaCaptureFunctions = ph(this._functionRegistry, this));
|
|
9137
9153
|
}
|
|
9138
9154
|
_lastError = void 0;
|
|
9139
9155
|
/**
|
|
@@ -9178,16 +9194,16 @@ class Of {
|
|
|
9178
9194
|
if (this.currentState !== "idle")
|
|
9179
9195
|
throw new Error(`Cannot connect: already in state ${this.currentState}`);
|
|
9180
9196
|
this.setupLifecycleHandlers();
|
|
9181
|
-
const e =
|
|
9197
|
+
const e = qd();
|
|
9182
9198
|
if (e) {
|
|
9183
|
-
|
|
9199
|
+
_.info("Found external connect URL in query parameter"), await this.executeConnection(() => We(e, this.abortController.signal));
|
|
9184
9200
|
return;
|
|
9185
9201
|
}
|
|
9186
9202
|
if (this._waitForExternalConnectUrl) {
|
|
9187
|
-
|
|
9203
|
+
_.info("Waiting for external connect URL from parent window"), this.setState("waitingForExternalConnectUrl"), this._externalConnectUrlCleanup = this.setupExternalConnectUrlListener();
|
|
9188
9204
|
return;
|
|
9189
9205
|
}
|
|
9190
|
-
|
|
9206
|
+
_.info("Connecting to Ikon server"), await this.executeConnection(() => this.authenticate());
|
|
9191
9207
|
}
|
|
9192
9208
|
/**
|
|
9193
9209
|
* Execute the connection flow with the provided authentication function.
|
|
@@ -9196,22 +9212,22 @@ class Of {
|
|
|
9196
9212
|
this._lastError = void 0, this.abortController = new AbortController(), this.setState("connecting"), this.slowConnectionTimer = setTimeout(() => {
|
|
9197
9213
|
this.currentState === "connecting" && this.setState("connectingSlow");
|
|
9198
9214
|
}, this.slowConnectionThresholdMs), this.connectionTimer = setTimeout(() => {
|
|
9199
|
-
(this.currentState === "connecting" || this.currentState === "connectingSlow") && (
|
|
9215
|
+
(this.currentState === "connecting" || this.currentState === "connectingSlow") && (_.error("Connection timeout"), this.abortController?.abort(), this.setState("offline"), this.config.onError?.(new Error("Connection timeout")));
|
|
9200
9216
|
}, this.connectionTimeoutMs);
|
|
9201
9217
|
try {
|
|
9202
9218
|
const n = await e();
|
|
9203
|
-
this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId,
|
|
9219
|
+
this.authResponse = n.authResponse, this._sessionId = n.authResponse.ClientContext.SessionId, _.info("Authenticated to Ikon server"), await this.connectProtocol(this.authResponse.Entrypoints);
|
|
9204
9220
|
} catch (n) {
|
|
9205
9221
|
if (n instanceof DOMException && n.name === "AbortError")
|
|
9206
9222
|
return;
|
|
9207
|
-
throw
|
|
9223
|
+
throw _.error("Connection failed:", n), this.clearTimers(), this.setState("offline"), this.config.onError?.(n instanceof Error ? n : new Error(String(n))), n;
|
|
9208
9224
|
}
|
|
9209
9225
|
}
|
|
9210
9226
|
/**
|
|
9211
9227
|
* Disconnect from the server.
|
|
9212
9228
|
*/
|
|
9213
9229
|
disconnect() {
|
|
9214
|
-
|
|
9230
|
+
_.info("Disconnecting from Ikon server"), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup && (this._externalConnectUrlCleanup(), this._externalConnectUrlCleanup = null), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions && (this.unregisterMediaCaptureFunctions(), this.unregisterMediaCaptureFunctions = null), this.unregisterSoundFunctions && (this.unregisterSoundFunctions(), this.unregisterSoundFunctions = null), this.unregisterBrowserFunctions && (this.unregisterBrowserFunctions(), this.unregisterBrowserFunctions = null), this.abortController?.abort(), this.abortController = null, this._fullReauthAttempted = !1, this._reauthInProgress = !1, this.releaseKeepaliveLock(), this.disconnectProtocol(), this.authResponse = null, this._sessionId = void 0, this._globalState = null, this._globalStateReceived = !1, this._channelsConnected = !1, this._joinedHandled = !1, this._environmentTrackingSetup = !1;
|
|
9215
9231
|
for (const e of this._webRtcAudioElements.values())
|
|
9216
9232
|
e.srcObject = null, e.remove();
|
|
9217
9233
|
this._webRtcAudioElements.clear(), this._webRtcAudioStreams.clear(), this._webRtcVideoStreams.clear(), this._webRtcTrackMap.clear(), this.removeWebRtcAudioUnlockHandler(), this._webRtcMediaSession.cleanup(), this._functionRegistry.detach(), this.setState("idle");
|
|
@@ -9219,7 +9235,7 @@ class Of {
|
|
|
9219
9235
|
sendActionCall(e, n) {
|
|
9220
9236
|
const r = Xs(
|
|
9221
9237
|
{
|
|
9222
|
-
ActionId:
|
|
9238
|
+
ActionId: w.fromString(e),
|
|
9223
9239
|
PayloadJson: n ?? "{}"
|
|
9224
9240
|
},
|
|
9225
9241
|
this._sessionId ?? 0
|
|
@@ -9245,7 +9261,7 @@ class Of {
|
|
|
9245
9261
|
this.channelManager.sendProtocolMessage(e);
|
|
9246
9262
|
return;
|
|
9247
9263
|
}
|
|
9248
|
-
|
|
9264
|
+
_.warn("Cannot send: not connected");
|
|
9249
9265
|
}
|
|
9250
9266
|
/**
|
|
9251
9267
|
* Send a client context update to the server.
|
|
@@ -9253,7 +9269,7 @@ class Of {
|
|
|
9253
9269
|
*/
|
|
9254
9270
|
sendUpdateClientContext(e) {
|
|
9255
9271
|
if (!this._sessionId) {
|
|
9256
|
-
|
|
9272
|
+
_.warn("Cannot send UpdateClientContext: not connected");
|
|
9257
9273
|
return;
|
|
9258
9274
|
}
|
|
9259
9275
|
const n = Sl(
|
|
@@ -9303,7 +9319,7 @@ class Of {
|
|
|
9303
9319
|
s.start?.();
|
|
9304
9320
|
const i = this.subscribeToProtocolMessages(
|
|
9305
9321
|
(o) => {
|
|
9306
|
-
const a =
|
|
9322
|
+
const a = ae(o), c = o.slice().buffer;
|
|
9307
9323
|
s.postMessage({ type: "protocol", message: c, headers: a }, [c]);
|
|
9308
9324
|
},
|
|
9309
9325
|
{ opcodeGroupsMask: e.opcodeGroupsMask }
|
|
@@ -9358,11 +9374,11 @@ class Of {
|
|
|
9358
9374
|
if (!(!a || typeof a != "object") && !(a.type !== "send" || !(a.message instanceof ArrayBuffer)))
|
|
9359
9375
|
try {
|
|
9360
9376
|
const c = new Uint8Array(a.message);
|
|
9361
|
-
if ((
|
|
9377
|
+
if ((Me(c) & e.opcodeGroupsMask) === 0)
|
|
9362
9378
|
return;
|
|
9363
9379
|
this.channelManager?.sendProtocolMessage(c);
|
|
9364
9380
|
} catch (c) {
|
|
9365
|
-
|
|
9381
|
+
_.warn(`Failed to forward protocol send port message: ${c}`);
|
|
9366
9382
|
}
|
|
9367
9383
|
};
|
|
9368
9384
|
try {
|
|
@@ -9435,15 +9451,15 @@ class Of {
|
|
|
9435
9451
|
handleProtocolMessage(e) {
|
|
9436
9452
|
if (this._webRtcSignaling?.handleProtocolMessage(e))
|
|
9437
9453
|
return;
|
|
9438
|
-
const n =
|
|
9454
|
+
const n = Se(e), r = Me(e);
|
|
9439
9455
|
if (this._functionRegistry.handleProtocolMessage(e, n)) {
|
|
9440
9456
|
this.notifyMessageSubscribers(e, n, r);
|
|
9441
9457
|
return;
|
|
9442
9458
|
}
|
|
9443
9459
|
n === g.CORE_GLOBAL_STATE && Nc(e).then((s) => {
|
|
9444
|
-
this._globalState = s, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(s, this._sessionId), this._globalState.DebugMode &&
|
|
9460
|
+
this._globalState = s, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(s, this._sessionId), this._globalState.DebugMode && df(), uf() && this.protocolWorker && this.protocolWorker.postMessage({ type: "enableDevtools", enabled: !0 }), this._globalStateReceived || (this._globalStateReceived = !0, this.tryHandleJoined());
|
|
9445
9461
|
}).catch((s) => {
|
|
9446
|
-
|
|
9462
|
+
_.error("Failed to parse GlobalState:", s);
|
|
9447
9463
|
}), this.notifyMessageSubscribers(e, n, r);
|
|
9448
9464
|
}
|
|
9449
9465
|
handleDataChannelMessage(e) {
|
|
@@ -9451,7 +9467,7 @@ class Of {
|
|
|
9451
9467
|
const n = new Uint8Array(e);
|
|
9452
9468
|
this.handleProtocolMessage(n);
|
|
9453
9469
|
} catch (n) {
|
|
9454
|
-
|
|
9470
|
+
_.warn("Failed to parse DataChannel message:", n);
|
|
9455
9471
|
}
|
|
9456
9472
|
}
|
|
9457
9473
|
/**
|
|
@@ -9465,17 +9481,17 @@ class Of {
|
|
|
9465
9481
|
const c = i[a];
|
|
9466
9482
|
try {
|
|
9467
9483
|
if (c) {
|
|
9468
|
-
if (c.opcodeGroupsMask !== void 0 && ((r ??
|
|
9484
|
+
if (c.opcodeGroupsMask !== void 0 && ((r ?? Me(e)) & c.opcodeGroupsMask) === 0)
|
|
9469
9485
|
continue;
|
|
9470
9486
|
if (c.opcodes && c.opcodes.length > 0) {
|
|
9471
|
-
const l = n ??
|
|
9487
|
+
const l = n ?? Se(e);
|
|
9472
9488
|
if (!c.opcodes.includes(l))
|
|
9473
9489
|
continue;
|
|
9474
9490
|
}
|
|
9475
9491
|
}
|
|
9476
9492
|
s[a](e);
|
|
9477
9493
|
} catch (l) {
|
|
9478
|
-
|
|
9494
|
+
_.error("Message subscriber error:", l);
|
|
9479
9495
|
}
|
|
9480
9496
|
}
|
|
9481
9497
|
}
|
|
@@ -9492,7 +9508,7 @@ class Of {
|
|
|
9492
9508
|
this.currentState === "connected" && (this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this._functionRegistry.detach(), this.releaseKeepaliveLock(), this.setState("reconnecting"));
|
|
9493
9509
|
break;
|
|
9494
9510
|
case "stopped":
|
|
9495
|
-
|
|
9511
|
+
_.info("Ikon server has stopped"), this.clearTimers(), this.setState("offline");
|
|
9496
9512
|
break;
|
|
9497
9513
|
case "offline":
|
|
9498
9514
|
if (this._reauthInProgress)
|
|
@@ -9525,7 +9541,7 @@ class Of {
|
|
|
9525
9541
|
try {
|
|
9526
9542
|
n(e);
|
|
9527
9543
|
} catch (r) {
|
|
9528
|
-
|
|
9544
|
+
_.error("State subscriber error:", r);
|
|
9529
9545
|
}
|
|
9530
9546
|
this.config.onConnectionStateChange?.(e);
|
|
9531
9547
|
}
|
|
@@ -9535,69 +9551,70 @@ class Of {
|
|
|
9535
9551
|
* Use this for unrecoverable SDK internal errors.
|
|
9536
9552
|
*/
|
|
9537
9553
|
setErrorState(e) {
|
|
9538
|
-
|
|
9554
|
+
_.error("SDK error, going offline:", e), this._lastError = e, this.clearTimers(), this.cleanupLifecycleHandlers(), this.disconnectProtocol(), this.currentState = "offlineError", this.config.onConnectionStateChange?.("offlineError"), this.config.onError?.(e);
|
|
9539
9555
|
}
|
|
9540
|
-
async connectProtocol(e) {
|
|
9556
|
+
async connectProtocol(e, n = !1) {
|
|
9541
9557
|
if (typeof Worker > "u") {
|
|
9542
|
-
await this.connectProtocolOnMainThread(e);
|
|
9558
|
+
await this.connectProtocolOnMainThread(e, n);
|
|
9543
9559
|
return;
|
|
9544
9560
|
}
|
|
9545
|
-
let
|
|
9561
|
+
let r;
|
|
9546
9562
|
try {
|
|
9547
|
-
|
|
9548
|
-
} catch (
|
|
9549
|
-
|
|
9563
|
+
r = new hf();
|
|
9564
|
+
} catch (p) {
|
|
9565
|
+
_.warn(`Failed to create protocol worker, falling back to main thread: ${p}`), await this.connectProtocolOnMainThread(e, n);
|
|
9550
9566
|
return;
|
|
9551
9567
|
}
|
|
9552
|
-
this.channelManager = null, this.protocolWorker =
|
|
9553
|
-
const
|
|
9554
|
-
let
|
|
9555
|
-
const
|
|
9556
|
-
const
|
|
9557
|
-
if (
|
|
9558
|
-
const
|
|
9559
|
-
this.handleProtocolMessage(
|
|
9568
|
+
this.channelManager = null, this.protocolWorker = r, this.workerManagerState = "idle";
|
|
9569
|
+
const s = new Promise((p, d) => {
|
|
9570
|
+
let m = !1;
|
|
9571
|
+
const S = (T) => {
|
|
9572
|
+
const E = T.data;
|
|
9573
|
+
if (E?.type === "protocol" && E.message instanceof ArrayBuffer) {
|
|
9574
|
+
const h = new Uint8Array(E.message);
|
|
9575
|
+
this.handleProtocolMessage(h);
|
|
9560
9576
|
return;
|
|
9561
9577
|
}
|
|
9562
|
-
if (
|
|
9563
|
-
const
|
|
9564
|
-
this.workerManagerState =
|
|
9565
|
-
const
|
|
9566
|
-
|
|
9578
|
+
if (E?.type === "state") {
|
|
9579
|
+
const h = E.state;
|
|
9580
|
+
this.workerManagerState = h;
|
|
9581
|
+
const u = E.activeType;
|
|
9582
|
+
u !== void 0 && this.endpointSelector.rememberWorkingType(u), this.handleChannelManagerStateChange(h), h === "connected" && !m && (m = !0, p());
|
|
9567
9583
|
return;
|
|
9568
9584
|
}
|
|
9569
|
-
if (
|
|
9570
|
-
const
|
|
9571
|
-
|
|
9585
|
+
if (E?.type === "error") {
|
|
9586
|
+
const h = E.error, u = new Error(String(h?.message ?? "Worker error"));
|
|
9587
|
+
u.name = String(h?.name ?? "Error"), d(u);
|
|
9572
9588
|
}
|
|
9573
9589
|
};
|
|
9574
|
-
|
|
9575
|
-
const
|
|
9576
|
-
if (
|
|
9577
|
-
|
|
9590
|
+
r.addEventListener("message", S), r.addEventListener("error", (T) => {
|
|
9591
|
+
const E = [T.message, T.filename, T.lineno, T.colno].filter((h) => h != null && String(h).length > 0);
|
|
9592
|
+
if (m) {
|
|
9593
|
+
_.error("Protocol worker crashed after connect"), this.workerManagerState = "offline", this.handleChannelManagerStateChange("offline");
|
|
9578
9594
|
return;
|
|
9579
9595
|
}
|
|
9580
|
-
|
|
9596
|
+
d(new Error(`Protocol worker failed: ${E.join(" ")}`.trim()));
|
|
9581
9597
|
});
|
|
9582
|
-
}),
|
|
9583
|
-
this.updateWorkerInterestMask(),
|
|
9584
|
-
const
|
|
9585
|
-
|
|
9598
|
+
}), i = this.computeOrderedEndpointTypes(e), o = this.config.timeouts?.keepaliveTimeoutMs ?? xt, a = this.config.timeouts?.reconnectBackoffMs ?? Wt, c = this.config.timeouts?.maxReconnectAttempts ?? Gt;
|
|
9599
|
+
this.updateWorkerInterestMask(), lf() && r.postMessage({ type: "enableDevtools", enabled: !0 });
|
|
9600
|
+
const f = this.config.webRtc?.enabled ?? !1;
|
|
9601
|
+
r.postMessage({
|
|
9586
9602
|
type: "connect",
|
|
9587
9603
|
sessionId: this._sessionId,
|
|
9588
9604
|
entrypoints: e,
|
|
9589
|
-
orderedEndpointTypes:
|
|
9590
|
-
keepaliveTimeoutMs:
|
|
9591
|
-
reconnectBackoffMs:
|
|
9592
|
-
maxReconnectAttempts:
|
|
9593
|
-
webRtcEnabled:
|
|
9605
|
+
orderedEndpointTypes: i,
|
|
9606
|
+
keepaliveTimeoutMs: o,
|
|
9607
|
+
reconnectBackoffMs: a,
|
|
9608
|
+
maxReconnectAttempts: c,
|
|
9609
|
+
webRtcEnabled: f,
|
|
9610
|
+
retry: n
|
|
9594
9611
|
});
|
|
9595
9612
|
try {
|
|
9596
|
-
await
|
|
9597
|
-
} catch (
|
|
9598
|
-
|
|
9613
|
+
await s;
|
|
9614
|
+
} catch (p) {
|
|
9615
|
+
_.warn(`Protocol worker connect failed, falling back to main thread: ${p}`), this.disconnectProtocol(), await this.connectProtocolOnMainThread(e, n);
|
|
9599
9616
|
}
|
|
9600
|
-
|
|
9617
|
+
f && (this._audioEnabled || this._videoEnabled) && await this.setupWebRtcSignaling();
|
|
9601
9618
|
}
|
|
9602
9619
|
async setupWebRtcSignaling() {
|
|
9603
9620
|
let e = g.GROUP_TRACKING;
|
|
@@ -9641,9 +9658,9 @@ class Of {
|
|
|
9641
9658
|
try {
|
|
9642
9659
|
await this._webRtcSignaling.connect((r) => {
|
|
9643
9660
|
this.sendProtocolMessage(r);
|
|
9644
|
-
}),
|
|
9661
|
+
}), _.debug("WebRTC signaling started");
|
|
9645
9662
|
} catch (r) {
|
|
9646
|
-
|
|
9663
|
+
_.error("Failed to setup WebRTC signaling:", r), this._webRtcSignaling = null;
|
|
9647
9664
|
}
|
|
9648
9665
|
}
|
|
9649
9666
|
_webRtcAudioUnlockHandler = null;
|
|
@@ -9655,14 +9672,14 @@ class Of {
|
|
|
9655
9672
|
r && (r.srcObject = null, r.remove());
|
|
9656
9673
|
const s = document.createElement("audio");
|
|
9657
9674
|
s.autoplay = !0, s.srcObject = n, this._webRtcAudioElements.set(e, s), s.play().then(() => {
|
|
9658
|
-
|
|
9675
|
+
_.debug(`WebRTC audio track ${e} playing`), e === 0 && this.setupWebRtcMediaSession();
|
|
9659
9676
|
}).catch(() => {
|
|
9660
|
-
if (
|
|
9677
|
+
if (_.debug(`WebRTC audio track ${e} autoplay blocked, waiting for user interaction`), !this._webRtcAudioUnlockHandler) {
|
|
9661
9678
|
const i = () => {
|
|
9662
9679
|
let o = !0;
|
|
9663
9680
|
for (const [a, c] of this._webRtcAudioElements)
|
|
9664
9681
|
c.play().then(() => {
|
|
9665
|
-
|
|
9682
|
+
_.debug(`WebRTC audio track ${a} playing (after user interaction)`);
|
|
9666
9683
|
}).catch(() => {
|
|
9667
9684
|
o = !1;
|
|
9668
9685
|
});
|
|
@@ -9693,26 +9710,26 @@ class Of {
|
|
|
9693
9710
|
removeWebRtcAudioUnlockHandler() {
|
|
9694
9711
|
this._webRtcAudioUnlockHandler && (document.removeEventListener("click", this._webRtcAudioUnlockHandler), document.removeEventListener("keydown", this._webRtcAudioUnlockHandler), document.removeEventListener("touchstart", this._webRtcAudioUnlockHandler), this._webRtcAudioUnlockHandler = null);
|
|
9695
9712
|
}
|
|
9696
|
-
async connectProtocolOnMainThread(e) {
|
|
9713
|
+
async connectProtocolOnMainThread(e, n = !1) {
|
|
9697
9714
|
this.workerManagerState = null, this.protocolWorker = null;
|
|
9698
|
-
const
|
|
9699
|
-
|
|
9715
|
+
const r = this.config.webRtc?.enabled ?? !1;
|
|
9716
|
+
_.info(`Connecting on main thread (webRtcEnabled=${r}, entrypoints=${e.length})`), this.channelManager = new vu({
|
|
9700
9717
|
sessionId: this._sessionId,
|
|
9701
9718
|
keepaliveTimeoutMs: this.config.timeouts?.keepaliveTimeoutMs ?? xt,
|
|
9702
9719
|
reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? Wt,
|
|
9703
9720
|
maxReconnectAttempts: this.config.timeouts?.maxReconnectAttempts ?? Gt,
|
|
9704
9721
|
endpointSelector: this.endpointSelector,
|
|
9705
|
-
webRtcEnabled:
|
|
9706
|
-
onProtocolMessage: (
|
|
9707
|
-
this.handleProtocolMessage(
|
|
9722
|
+
webRtcEnabled: r,
|
|
9723
|
+
onProtocolMessage: (s) => {
|
|
9724
|
+
this.handleProtocolMessage(s);
|
|
9708
9725
|
},
|
|
9709
|
-
onStateChange: (
|
|
9710
|
-
this.handleChannelManagerStateChange(
|
|
9726
|
+
onStateChange: (s) => {
|
|
9727
|
+
this.handleChannelManagerStateChange(s);
|
|
9711
9728
|
},
|
|
9712
|
-
onError: (
|
|
9713
|
-
this.config.onError?.(
|
|
9729
|
+
onError: (s) => {
|
|
9730
|
+
this.config.onError?.(s);
|
|
9714
9731
|
}
|
|
9715
|
-
}), await this.channelManager.connect(e);
|
|
9732
|
+
}), await this.channelManager.connect(e, { retry: n });
|
|
9716
9733
|
}
|
|
9717
9734
|
disconnectProtocol() {
|
|
9718
9735
|
if (this._webRtcSignaling?.disconnect(), this._webRtcSignaling = null, this.channelManager?.disconnect(), this.channelManager = null, this.protocolWorker) {
|
|
@@ -9771,18 +9788,21 @@ class Of {
|
|
|
9771
9788
|
return !(this._waitForExternalConnectUrl || !this.config.local && !this.config.apiKey && !this.config.sessionToken || !this.abortController || this.abortController.signal.aborted);
|
|
9772
9789
|
}
|
|
9773
9790
|
async attemptFullReauth() {
|
|
9774
|
-
this._fullReauthAttempted = !0, this._reauthInProgress = !0,
|
|
9791
|
+
this._fullReauthAttempted = !0, this._reauthInProgress = !0, _.info("Fast reconnect exhausted, attempting full re-authentication"), this.endpointSelector.clearRememberedType(), this.disconnectProtocol(), this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1;
|
|
9775
9792
|
try {
|
|
9776
9793
|
const e = await this.authenticate();
|
|
9777
|
-
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId,
|
|
9794
|
+
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, _.info("Re-authenticated, connecting to new server"), await this.connectProtocol(this.authResponse.Entrypoints);
|
|
9778
9795
|
} catch (e) {
|
|
9779
9796
|
if (e instanceof DOMException && e.name === "AbortError")
|
|
9780
9797
|
return;
|
|
9781
|
-
|
|
9798
|
+
_.error("Full re-authentication failed:", e), this.clearTimers(), this.setState("offline"), this.config.onError?.(e instanceof Error ? e : new Error(String(e)));
|
|
9782
9799
|
} finally {
|
|
9783
9800
|
this._reauthInProgress = !1;
|
|
9784
9801
|
}
|
|
9785
9802
|
}
|
|
9803
|
+
attemptReconnectOnVisible() {
|
|
9804
|
+
this.currentState === "offline" && (this._reauthInProgress || this.canAttemptFullReauth() && (_.info("Page became visible while offline, attempting reconnection"), this._fullReauthAttempted = !1, this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this.setState("reconnecting"), this.disconnectProtocol(), this.authResponse ? this.connectProtocol(this.authResponse.Entrypoints, !0) : this.attemptFullReauth()));
|
|
9805
|
+
}
|
|
9786
9806
|
/**
|
|
9787
9807
|
* Clear all timers.
|
|
9788
9808
|
*/
|
|
@@ -9793,27 +9813,27 @@ class Of {
|
|
|
9793
9813
|
* Set up browser lifecycle event handlers.
|
|
9794
9814
|
*/
|
|
9795
9815
|
setupLifecycleHandlers() {
|
|
9796
|
-
typeof window > "u" || (this.boundBeforeUnload = () => this.handleBeforeUnload(), window.addEventListener("beforeunload", this.boundBeforeUnload), this.boundPageHide = (e) => this.handlePageHide(e), window.addEventListener("pagehide", this.boundPageHide), this.boundVisibilityChange = () => this.handleVisibilityChange(), document.addEventListener("visibilitychange", this.boundVisibilityChange), this.boundPopstate = () => this.handlePopstate(), window.addEventListener("popstate", this.boundPopstate));
|
|
9816
|
+
typeof window > "u" || (this.boundBeforeUnload = () => this.handleBeforeUnload(), window.addEventListener("beforeunload", this.boundBeforeUnload), this.boundPageHide = (e) => this.handlePageHide(e), window.addEventListener("pagehide", this.boundPageHide), this.boundVisibilityChange = () => this.handleVisibilityChange(), document.addEventListener("visibilitychange", this.boundVisibilityChange), this.boundPopstate = () => this.handlePopstate(), window.addEventListener("popstate", this.boundPopstate), this.boundOnline = () => this.attemptReconnectOnVisible(), window.addEventListener("online", this.boundOnline));
|
|
9797
9817
|
}
|
|
9798
9818
|
/**
|
|
9799
9819
|
* Clean up browser lifecycle event handlers.
|
|
9800
9820
|
*/
|
|
9801
9821
|
cleanupLifecycleHandlers() {
|
|
9802
|
-
typeof window > "u" || (this.boundBeforeUnload && (window.removeEventListener("beforeunload", this.boundBeforeUnload), this.boundBeforeUnload = null), this.boundPageHide && (window.removeEventListener("pagehide", this.boundPageHide), this.boundPageHide = null), this.boundVisibilityChange && (document.removeEventListener("visibilitychange", this.boundVisibilityChange), this.boundVisibilityChange = null), this.boundPopstate && (window.removeEventListener("popstate", this.boundPopstate), this.boundPopstate = null));
|
|
9822
|
+
typeof window > "u" || (this.boundBeforeUnload && (window.removeEventListener("beforeunload", this.boundBeforeUnload), this.boundBeforeUnload = null), this.boundPageHide && (window.removeEventListener("pagehide", this.boundPageHide), this.boundPageHide = null), this.boundVisibilityChange && (document.removeEventListener("visibilitychange", this.boundVisibilityChange), this.boundVisibilityChange = null), this.boundPopstate && (window.removeEventListener("popstate", this.boundPopstate), this.boundPopstate = null), this.boundOnline && (window.removeEventListener("online", this.boundOnline), this.boundOnline = null));
|
|
9803
9823
|
}
|
|
9804
9824
|
/**
|
|
9805
9825
|
* Handle page beforeunload event.
|
|
9806
9826
|
* Close connection cleanly to avoid orphaned connections on the server.
|
|
9807
9827
|
*/
|
|
9808
9828
|
handleBeforeUnload() {
|
|
9809
|
-
|
|
9829
|
+
_.debug("Page unloading, closing connection..."), this.disconnect();
|
|
9810
9830
|
}
|
|
9811
9831
|
/**
|
|
9812
9832
|
* Handle page hide event (mobile-friendly, bfcache compatible).
|
|
9813
9833
|
* Only disconnect if page is actually being unloaded (not persisted).
|
|
9814
9834
|
*/
|
|
9815
9835
|
handlePageHide(e) {
|
|
9816
|
-
e.persisted || (
|
|
9836
|
+
e.persisted || (_.debug("Page hidden (not persisted), closing connection..."), this.disconnect());
|
|
9817
9837
|
}
|
|
9818
9838
|
/**
|
|
9819
9839
|
* Handle visibility change event.
|
|
@@ -9821,7 +9841,7 @@ class Of {
|
|
|
9821
9841
|
*/
|
|
9822
9842
|
handleVisibilityChange() {
|
|
9823
9843
|
const e = !document.hidden;
|
|
9824
|
-
e && (this.checkConnectionHealth(), this.protocolWorker && (this.protocolWorker.postMessage({ type: "checkHealth" }), setTimeout(() => this.checkConnectionHealth(), 500)), this.channelManager && this.channelManager.checkHealth()), this.config.onVisibilityChange?.(e);
|
|
9844
|
+
e && (this.checkConnectionHealth(), this.protocolWorker && (this.protocolWorker.postMessage({ type: "checkHealth" }), setTimeout(() => this.checkConnectionHealth(), 500)), this.channelManager && this.channelManager.checkHealth(), this.attemptReconnectOnVisible()), this.config.onVisibilityChange?.(e);
|
|
9825
9845
|
}
|
|
9826
9846
|
/**
|
|
9827
9847
|
* Handle browser popstate event (back/forward navigation).
|
|
@@ -9842,10 +9862,10 @@ class Of {
|
|
|
9842
9862
|
*/
|
|
9843
9863
|
checkConnectionHealth() {
|
|
9844
9864
|
if (this.protocolWorker) {
|
|
9845
|
-
this.currentState === "connected" && this.workerManagerState !== "connected" && (
|
|
9865
|
+
this.currentState === "connected" && this.workerManagerState !== "connected" && (_.warn("Connection lost while page was backgrounded, reconnecting..."), this.setState("reconnecting"));
|
|
9846
9866
|
return;
|
|
9847
9867
|
}
|
|
9848
|
-
this.channelManager && this.currentState === "connected" && this.channelManager.managerState !== "connected" && (
|
|
9868
|
+
this.channelManager && this.currentState === "connected" && this.channelManager.managerState !== "connected" && (_.warn("Connection lost while page was backgrounded, reconnecting..."), this.setState("reconnecting"));
|
|
9849
9869
|
}
|
|
9850
9870
|
/**
|
|
9851
9871
|
* Try to handle joined state - only proceeds if both channels are connected and GlobalState is received.
|
|
@@ -9863,11 +9883,11 @@ class Of {
|
|
|
9863
9883
|
sendProtocolMessage: (n) => this.sendProtocolMessage(n),
|
|
9864
9884
|
sessionId: this._sessionId
|
|
9865
9885
|
}), this.setupEnvironmentTracking(), await this.config.onJoined?.();
|
|
9866
|
-
const e =
|
|
9886
|
+
const e = Pt(Mt(), this._sessionId ?? 0);
|
|
9867
9887
|
this.sendProtocolMessage(e);
|
|
9868
9888
|
} catch (e) {
|
|
9869
|
-
|
|
9870
|
-
const n =
|
|
9889
|
+
_.error("onJoined callback error:", e);
|
|
9890
|
+
const n = Pt(Mt(), this._sessionId ?? 0);
|
|
9871
9891
|
this.sendProtocolMessage(n);
|
|
9872
9892
|
}
|
|
9873
9893
|
}
|
|
@@ -9891,7 +9911,7 @@ class Of {
|
|
|
9891
9911
|
window.addEventListener("resize", n);
|
|
9892
9912
|
const r = window.matchMedia("(prefers-color-scheme: dark)"), s = () => {
|
|
9893
9913
|
this.sendUpdateClientContext({
|
|
9894
|
-
theme:
|
|
9914
|
+
theme: $e()
|
|
9895
9915
|
});
|
|
9896
9916
|
};
|
|
9897
9917
|
r.addEventListener("change", s);
|
|
@@ -9902,17 +9922,17 @@ class Of {
|
|
|
9902
9922
|
*/
|
|
9903
9923
|
setupExternalConnectUrlListener() {
|
|
9904
9924
|
const e = (n) => {
|
|
9905
|
-
n.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof n.data.serverUrl == "string" && (
|
|
9906
|
-
|
|
9925
|
+
n.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof n.data.serverUrl == "string" && (_.info("Received external connect URL from parent window"), this.handleExternalConnectUrl(n.data.serverUrl).catch((r) => {
|
|
9926
|
+
_.error("Failed to connect with external connect URL:", r), this.config.onError?.(r instanceof Error ? r : new Error(String(r))), this.setState("offlineError");
|
|
9907
9927
|
}));
|
|
9908
9928
|
};
|
|
9909
|
-
if (window.addEventListener("message", e),
|
|
9929
|
+
if (window.addEventListener("message", e), _.debug("External connect URL listener registered"), window.parent && window.parent !== window)
|
|
9910
9930
|
try {
|
|
9911
|
-
window.parent.postMessage({ type: "IKON_CLIENT_READY_FOR_CONNECT_URL" }, "*"),
|
|
9931
|
+
window.parent.postMessage({ type: "IKON_CLIENT_READY_FOR_CONNECT_URL" }, "*"), _.debug("Posted IKON_CLIENT_READY_FOR_CONNECT_URL to parent window");
|
|
9912
9932
|
} catch {
|
|
9913
9933
|
}
|
|
9914
9934
|
return () => {
|
|
9915
|
-
window.removeEventListener("message", e),
|
|
9935
|
+
window.removeEventListener("message", e), _.debug("External connect URL listener removed");
|
|
9916
9936
|
};
|
|
9917
9937
|
}
|
|
9918
9938
|
/**
|
|
@@ -9921,167 +9941,173 @@ class Of {
|
|
|
9921
9941
|
async handleExternalConnectUrl(e) {
|
|
9922
9942
|
if (this.currentState !== "waitingForExternalConnectUrl")
|
|
9923
9943
|
throw new Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
|
|
9924
|
-
|
|
9944
|
+
_.info("Connecting with external connect URL");
|
|
9925
9945
|
try {
|
|
9926
|
-
await this.executeConnection(() =>
|
|
9946
|
+
await this.executeConnection(() => We(e, this.abortController.signal));
|
|
9927
9947
|
} finally {
|
|
9928
9948
|
this._externalConnectUrlCleanup && (this._externalConnectUrlCleanup(), this._externalConnectUrlCleanup = null);
|
|
9929
9949
|
}
|
|
9930
9950
|
}
|
|
9931
9951
|
}
|
|
9932
|
-
function
|
|
9952
|
+
function Wf(t) {
|
|
9933
9953
|
return t === "waitingForExternalConnectUrl" || t === "connecting" || t === "connectingSlow" || t === "reconnecting";
|
|
9934
9954
|
}
|
|
9935
|
-
function
|
|
9955
|
+
function Gf(t) {
|
|
9936
9956
|
return t === "connected";
|
|
9937
9957
|
}
|
|
9938
|
-
function
|
|
9958
|
+
function Vf(t) {
|
|
9939
9959
|
return t === "offline" || t === "offlineError" || t === "idle";
|
|
9940
9960
|
}
|
|
9941
|
-
function
|
|
9961
|
+
function Hf(t) {
|
|
9942
9962
|
return t === "offlineError";
|
|
9943
9963
|
}
|
|
9944
9964
|
const ks = /* @__PURE__ */ new Map();
|
|
9945
9965
|
for (const [t, e] of Object.entries(g))
|
|
9946
9966
|
typeof e == "number" && ks.set(e, t);
|
|
9947
|
-
function
|
|
9967
|
+
function $f(t) {
|
|
9948
9968
|
return ks.get(t) ?? `UNKNOWN_${t}`;
|
|
9949
9969
|
}
|
|
9950
|
-
const Ds = 1e3, vs =
|
|
9970
|
+
const Ds = 1e3, vs = He.INFO;
|
|
9951
9971
|
let H = [], lt = Ds, Us = vs, ut = null;
|
|
9952
|
-
function
|
|
9972
|
+
function mf(t) {
|
|
9953
9973
|
t.level < Us || (H.push(t), H.length > lt && (H = H.slice(-lt)));
|
|
9954
9974
|
}
|
|
9955
|
-
function
|
|
9956
|
-
lt = t?.maxBufferSize ?? Ds, Us = t?.minLevel ?? vs, H = [], Cu(
|
|
9975
|
+
function Ef(t) {
|
|
9976
|
+
lt = t?.maxBufferSize ?? Ds, Us = t?.minLevel ?? vs, H = [], Cu(mf);
|
|
9957
9977
|
}
|
|
9958
|
-
function
|
|
9978
|
+
function Kf(t) {
|
|
9959
9979
|
ut = t;
|
|
9960
9980
|
}
|
|
9961
|
-
function
|
|
9981
|
+
function Yf() {
|
|
9962
9982
|
return H;
|
|
9963
9983
|
}
|
|
9964
|
-
function
|
|
9984
|
+
function If() {
|
|
9965
9985
|
const t = H;
|
|
9966
9986
|
return H = [], t;
|
|
9967
9987
|
}
|
|
9968
|
-
function
|
|
9988
|
+
function jf() {
|
|
9969
9989
|
if (!ut || H.length === 0)
|
|
9970
9990
|
return 0;
|
|
9971
|
-
const t =
|
|
9991
|
+
const t = If();
|
|
9972
9992
|
return ut(t), t.length;
|
|
9973
9993
|
}
|
|
9974
|
-
function
|
|
9994
|
+
function zf() {
|
|
9975
9995
|
H = [];
|
|
9976
9996
|
}
|
|
9977
|
-
function
|
|
9997
|
+
function Xf() {
|
|
9978
9998
|
return H.length;
|
|
9979
9999
|
}
|
|
9980
|
-
|
|
10000
|
+
Ef();
|
|
9981
10001
|
export {
|
|
9982
10002
|
D as AuthenticationError,
|
|
9983
10003
|
Du as Channel,
|
|
9984
10004
|
vu as ChannelManager,
|
|
9985
|
-
|
|
9986
|
-
|
|
10005
|
+
Tf as ChannelNotFoundError,
|
|
10006
|
+
ne as ClientType,
|
|
9987
10007
|
St as ConnectionError,
|
|
9988
|
-
|
|
9989
|
-
|
|
10008
|
+
ue as ContextType,
|
|
10009
|
+
ff as EndpointSelector,
|
|
9990
10010
|
b as EntrypointType,
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
10011
|
+
oh as FunctionCallError,
|
|
10012
|
+
ch as FunctionRegistry,
|
|
10013
|
+
Uf as IKON_AUTH_BASE_URL,
|
|
9994
10014
|
$t as IKON_AUTH_URL_DEV,
|
|
9995
10015
|
Ht as IKON_AUTH_URL_PROD,
|
|
9996
10016
|
ot as IKON_BACKEND_URL_DEV,
|
|
9997
10017
|
it as IKON_BACKEND_URL_PROD,
|
|
10018
|
+
Kd as IKON_PARAM_AUDIO,
|
|
9998
10019
|
_s as IKON_PARAM_DEBUG,
|
|
9999
|
-
|
|
10000
|
-
|
|
10020
|
+
Ff as IKON_PARAM_GIT_BRANCH,
|
|
10021
|
+
Lf as IKON_PARAM_GIT_SOURCE,
|
|
10001
10022
|
Hd as IKON_PARAM_LANG,
|
|
10002
10023
|
Wd as IKON_PARAM_PROXY,
|
|
10003
10024
|
$d as IKON_PARAM_SERVER_URL,
|
|
10025
|
+
Yd as IKON_PARAM_VIDEO,
|
|
10026
|
+
jd as IKON_PARAM_WEBRTC,
|
|
10004
10027
|
Gd as IKON_PARAM_WEBSOCKET,
|
|
10005
10028
|
Vd as IKON_PARAM_WEBTRANSPORT,
|
|
10006
|
-
|
|
10029
|
+
Zh as IkonAudioCapture,
|
|
10007
10030
|
vt as IkonAudioPlayback,
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10031
|
+
xf as IkonClient,
|
|
10032
|
+
nf as IkonImageCapture,
|
|
10033
|
+
Vh as IkonMedia,
|
|
10034
|
+
cf as IkonMediaCapture,
|
|
10035
|
+
af as IkonVideoCapture,
|
|
10036
|
+
Gh as IkonVideoPlayback,
|
|
10014
10037
|
gt as KeepaliveTimeoutError,
|
|
10015
|
-
|
|
10038
|
+
He as LogLevel,
|
|
10016
10039
|
Su as MaxRetriesExceededError,
|
|
10017
|
-
|
|
10040
|
+
Sf as NoChannelsError,
|
|
10018
10041
|
g as Opcode,
|
|
10019
10042
|
gu as ProvisioningTimeoutError,
|
|
10020
|
-
|
|
10043
|
+
wf as SpaceNotFoundError,
|
|
10021
10044
|
Z as TransportError,
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10045
|
+
he as UserType,
|
|
10046
|
+
Nf as WEBRTC_AUDIO_BITRATE,
|
|
10047
|
+
bf as WEBRTC_AUDIO_CHANNELS,
|
|
10048
|
+
Af as WEBRTC_AUDIO_CODEC,
|
|
10026
10049
|
Uu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS,
|
|
10027
|
-
|
|
10028
|
-
|
|
10050
|
+
Rf as WEBRTC_AUDIO_SAMPLE_RATE,
|
|
10051
|
+
Pu as WEBRTC_BUNDLE_POLICY,
|
|
10029
10052
|
Wu as WEBRTC_DATA_CHANNEL_LABEL,
|
|
10030
10053
|
Vu as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS,
|
|
10031
10054
|
Gu as WEBRTC_DATA_CHANNEL_ORDERED,
|
|
10032
10055
|
Fu as WEBRTC_ICE_SERVERS,
|
|
10033
10056
|
Bu as WEBRTC_MAX_AUDIO_TRACKS,
|
|
10034
10057
|
xu as WEBRTC_MAX_VIDEO_TRACKS,
|
|
10035
|
-
|
|
10036
|
-
|
|
10058
|
+
Lu as WEBRTC_RTCP_MUX_POLICY,
|
|
10059
|
+
kf as WEBRTC_VIDEO_CODEC,
|
|
10037
10060
|
Ou as WEBRTC_VIDEO_MAX_BITRATE,
|
|
10038
|
-
|
|
10061
|
+
Df as WEBRTC_VIDEO_MAX_FRAMERATE,
|
|
10039
10062
|
Hu as WebRTCConnection,
|
|
10040
10063
|
$u as WebRTCSignaling,
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10064
|
+
_f as asProtocolMessage,
|
|
10065
|
+
vf as clearDeviceId,
|
|
10066
|
+
zf as clearLogBuffer,
|
|
10067
|
+
Pf as clearSessionParamsFromUrl,
|
|
10068
|
+
L as createLogger,
|
|
10046
10069
|
Nd as deriveAuthUrl,
|
|
10047
|
-
|
|
10070
|
+
Of as deriveBackendType,
|
|
10048
10071
|
bd as deriveBackendUrl,
|
|
10049
10072
|
Rd as extractUserIdFromToken,
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
$
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10073
|
+
jf as flushLogs,
|
|
10074
|
+
eh as getAudioParam,
|
|
10075
|
+
Yf as getBufferedLogs,
|
|
10076
|
+
Zd as getDebugParam,
|
|
10077
|
+
Bf as getLangParam,
|
|
10078
|
+
Xf as getLogBufferSize,
|
|
10079
|
+
gf as getLogLevel,
|
|
10080
|
+
Cf as getLogSink,
|
|
10081
|
+
$f as getOpcodeName,
|
|
10082
|
+
Ke as getOrCreateDeviceId,
|
|
10083
|
+
Xd as getProxyParam,
|
|
10084
|
+
qd as getServerUrlParam,
|
|
10085
|
+
th as getVideoParam,
|
|
10086
|
+
nh as getWebRtcParam,
|
|
10087
|
+
Jd as getWebSocketParam,
|
|
10088
|
+
Qd as getWebTransportParam,
|
|
10089
|
+
lf as initializeDebugMode,
|
|
10090
|
+
Ef as initializeLogSink,
|
|
10065
10091
|
gs as isAudioWorkletSupported,
|
|
10066
10092
|
je as isBrowserEnvironment,
|
|
10067
10093
|
Nt as isCloudEnvironment,
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10094
|
+
Gf as isConnected,
|
|
10095
|
+
Wf as isConnecting,
|
|
10096
|
+
uf as isDebugModeEnabled,
|
|
10097
|
+
Hf as isError,
|
|
10098
|
+
Vf as isOffline,
|
|
10099
|
+
Pe as isSharedArrayBufferSupported,
|
|
10074
10100
|
us as isWebTransportSupported,
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10101
|
+
Mf as parseUrlParams,
|
|
10102
|
+
Se as readOpcode,
|
|
10103
|
+
Me as readOpcodeGroup,
|
|
10104
|
+
ae as readProtocolMessageHeaders,
|
|
10079
10105
|
Ad as registerBrowserFunctions,
|
|
10080
10106
|
ls as setLogLevel,
|
|
10081
10107
|
Cu as setLogSink,
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10108
|
+
zd as setSdkUrlParam,
|
|
10109
|
+
Kf as setSendLogsCallback,
|
|
10110
|
+
yf as subscribeToLogEvents,
|
|
10111
|
+
If as takeBufferedLogs,
|
|
10112
|
+
ih as withResultData
|
|
10087
10113
|
};
|