@ikonai/sdk 1.0.38 → 1.0.39
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/RELEASE-NOTES.md +33 -0
- package/assets/{protocol-worker-C3oOno6C.js → protocol-worker-DOmuqDno.js} +309 -284
- package/channel/channel-manager.d.ts +1 -0
- package/channel/channel.d.ts +5 -0
- package/client/endpoint-selector.d.ts +5 -0
- package/client/ikon-client-config.d.ts +2 -2
- package/connection/authenticator.d.ts +7 -1
- package/index.js +2007 -1946
- package/package.json +1 -1
- package/transport/transport.d.ts +5 -0
- package/transport/web-socket-transport.d.ts +1 -0
- package/transport/web-transport-transport.d.ts +1 -0
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Y(t) {
|
|
2
2
|
if (t.length < 8)
|
|
3
3
|
throw new Error("Protocol message too short");
|
|
4
4
|
return (t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24) >>> 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function k(t) {
|
|
7
|
+
return Y(t) & 4294901760;
|
|
8
8
|
}
|
|
9
9
|
function X(t) {
|
|
10
10
|
const e = Et(t), s = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
11
11
|
if (e.length < 27)
|
|
12
12
|
throw new Error("Protocol payload too short");
|
|
13
|
-
const r = s.getUint32(0, !0),
|
|
13
|
+
const r = s.getUint32(0, !0), n = s.getUint32(4, !0), i = s.getUint32(8, !0), a = s.getUint32(12, !0), o = s.getUint32(16, !0), l = s.getUint32(20, !0), T = s.getUint8(24), E = s.getUint8(25), c = s.getUint8(26);
|
|
14
14
|
if (27 + l * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
|
-
const
|
|
16
|
+
const I = [];
|
|
17
17
|
let b = 27;
|
|
18
|
-
for (let
|
|
19
|
-
|
|
18
|
+
for (let D = 0; D < l; D++)
|
|
19
|
+
I.push(s.getUint32(b, !0)), b += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: r,
|
|
22
|
-
opcode:
|
|
23
|
-
senderId:
|
|
22
|
+
opcode: n,
|
|
23
|
+
senderId: i,
|
|
24
24
|
trackId: a,
|
|
25
25
|
sequenceId: o,
|
|
26
|
-
targetIds:
|
|
27
|
-
payloadVersion:
|
|
28
|
-
payloadType:
|
|
29
|
-
flags:
|
|
26
|
+
targetIds: I,
|
|
27
|
+
payloadVersion: T,
|
|
28
|
+
payloadType: E,
|
|
29
|
+
flags: c
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const l = [],
|
|
34
|
-
|
|
32
|
+
function nt(t, e, s, r, n) {
|
|
33
|
+
const l = [], E = 27 + l.length * 4, c = E + e.length, O = new Uint8Array(c), I = new DataView(O.buffer);
|
|
34
|
+
I.setUint32(0, c, !0), I.setUint32(4, t >>> 0, !0), I.setUint32(8, r >>> 0, !0), I.setUint32(12, 0, !0), I.setUint32(16, 0, !0), I.setUint32(20, l.length >>> 0, !0), I.setUint8(24, s & 255), I.setUint8(25, 8), I.setUint8(26, 0);
|
|
35
35
|
let b = 27;
|
|
36
|
-
for (let
|
|
37
|
-
|
|
38
|
-
return O.set(e,
|
|
36
|
+
for (let D = 0; D < l.length; D++)
|
|
37
|
+
I.setUint32(b, l[D] >>> 0, !0), b += 4;
|
|
38
|
+
return O.set(e, E), O;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const
|
|
40
|
+
var g = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(g || {});
|
|
41
|
+
const it = 161, at = 162, p = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
43
|
class B {
|
|
44
44
|
constructor(e = 1) {
|
|
45
|
-
this.version = e, this.buffer.writeByte(
|
|
45
|
+
this.version = e, this.buffer.writeByte(it), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
|
-
buffer = new
|
|
47
|
+
buffer = new m();
|
|
48
48
|
closed = !1;
|
|
49
49
|
cached;
|
|
50
50
|
writeInt32Field(e, s) {
|
|
@@ -69,34 +69,34 @@ class B {
|
|
|
69
69
|
this.writeFixedField(e, 2, () => this.buffer.writeByte(s ? 1 : 0));
|
|
70
70
|
}
|
|
71
71
|
writeGuidField(e, s) {
|
|
72
|
-
const r = s instanceof
|
|
72
|
+
const r = s instanceof h ? s.asBytes() : s;
|
|
73
73
|
if (r.length !== 16)
|
|
74
74
|
throw new Error("Guid payload must be 16 bytes");
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(r));
|
|
76
76
|
}
|
|
77
77
|
writeStringField(e, s) {
|
|
78
|
-
const r =
|
|
78
|
+
const r = p.encode(s ?? "");
|
|
79
79
|
this.writeVariableField(e, 12, r);
|
|
80
80
|
}
|
|
81
81
|
writeBinaryField(e, s) {
|
|
82
82
|
this.writeVariableField(e, 13, s);
|
|
83
83
|
}
|
|
84
84
|
writeObjectField(e, s, r) {
|
|
85
|
-
const
|
|
86
|
-
r(
|
|
87
|
-
const
|
|
88
|
-
this.writeVariableField(e, 11,
|
|
85
|
+
const n = new B(s);
|
|
86
|
+
r(n);
|
|
87
|
+
const i = n.finish();
|
|
88
|
+
this.writeVariableField(e, 11, i);
|
|
89
89
|
}
|
|
90
90
|
writeArrayField(e, s, r) {
|
|
91
|
-
const
|
|
92
|
-
r(
|
|
93
|
-
const
|
|
94
|
-
this.writeVariableField(e, 9,
|
|
95
|
-
}
|
|
96
|
-
writeDictionaryField(e, s, r,
|
|
97
|
-
const
|
|
98
|
-
i
|
|
99
|
-
const a =
|
|
91
|
+
const n = new W(s);
|
|
92
|
+
r(n);
|
|
93
|
+
const i = n.finish();
|
|
94
|
+
this.writeVariableField(e, 9, i);
|
|
95
|
+
}
|
|
96
|
+
writeDictionaryField(e, s, r, n) {
|
|
97
|
+
const i = new Q(s, r);
|
|
98
|
+
n(i);
|
|
99
|
+
const a = i.finish();
|
|
100
100
|
this.writeVariableField(e, 10, a);
|
|
101
101
|
}
|
|
102
102
|
finish() {
|
|
@@ -112,11 +112,11 @@ class B {
|
|
|
112
112
|
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(V(s)), lt(s) && this.buffer.writeVarUInt(r >>> 0);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class W {
|
|
116
116
|
constructor(e) {
|
|
117
117
|
this.elementType = e;
|
|
118
118
|
}
|
|
119
|
-
payload = new
|
|
119
|
+
payload = new m();
|
|
120
120
|
count = 0;
|
|
121
121
|
writeInt32(e) {
|
|
122
122
|
this.ensureElementType(
|
|
@@ -165,7 +165,7 @@ class k {
|
|
|
165
165
|
14
|
|
166
166
|
/* Guid */
|
|
167
167
|
), this.count++;
|
|
168
|
-
const s = e instanceof
|
|
168
|
+
const s = e instanceof h ? e.asBytes() : e;
|
|
169
169
|
if (s.length !== 16)
|
|
170
170
|
throw new Error("Guid payload must be 16 bytes");
|
|
171
171
|
this.payload.writeBytes(s);
|
|
@@ -175,7 +175,7 @@ class k {
|
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const s =
|
|
178
|
+
const s = p.encode(e ?? "");
|
|
179
179
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
@@ -191,43 +191,43 @@ class k {
|
|
|
191
191
|
), this.count++;
|
|
192
192
|
const r = new B(e);
|
|
193
193
|
s(r);
|
|
194
|
-
const
|
|
195
|
-
this.payload.writeVarUInt(
|
|
194
|
+
const n = r.finish();
|
|
195
|
+
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n);
|
|
196
196
|
}
|
|
197
197
|
writeArray(e, s) {
|
|
198
198
|
this.ensureElementType(
|
|
199
199
|
9
|
|
200
200
|
/* Array */
|
|
201
201
|
), this.count++;
|
|
202
|
-
const r = new
|
|
202
|
+
const r = new W(e);
|
|
203
203
|
s(r);
|
|
204
|
-
const
|
|
205
|
-
this.payload.writeBytes(
|
|
204
|
+
const n = r.finish();
|
|
205
|
+
this.payload.writeBytes(n);
|
|
206
206
|
}
|
|
207
207
|
writeDictionary(e, s, r) {
|
|
208
208
|
this.ensureElementType(
|
|
209
209
|
10
|
|
210
210
|
/* Dict */
|
|
211
211
|
), this.count++;
|
|
212
|
-
const
|
|
213
|
-
r(
|
|
214
|
-
const
|
|
215
|
-
this.payload.writeBytes(
|
|
212
|
+
const n = new Q(e, s);
|
|
213
|
+
r(n);
|
|
214
|
+
const i = n.finish();
|
|
215
|
+
this.payload.writeBytes(i);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
|
-
const e = new
|
|
218
|
+
const e = new m();
|
|
219
219
|
return e.writeByte(V(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
220
220
|
}
|
|
221
221
|
ensureElementType(e) {
|
|
222
222
|
if (this.elementType !== e)
|
|
223
|
-
throw new Error(`Array element type is ${
|
|
223
|
+
throw new Error(`Array element type is ${g[this.elementType]}, expected ${g[e]}`);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
class Q {
|
|
227
227
|
constructor(e, s) {
|
|
228
228
|
this.keyType = e, this.valueType = s, ht(e);
|
|
229
229
|
}
|
|
230
|
-
payload = new
|
|
230
|
+
payload = new m();
|
|
231
231
|
count = 0;
|
|
232
232
|
entryOpen = !1;
|
|
233
233
|
beginEntry() {
|
|
@@ -240,13 +240,13 @@ class Q {
|
|
|
240
240
|
finish() {
|
|
241
241
|
if (this.entryOpen)
|
|
242
242
|
throw new Error("Dictionary entry not completed");
|
|
243
|
-
const e = new
|
|
243
|
+
const e = new m();
|
|
244
244
|
return e.writeByte(V(this.keyType)), e.writeByte(V(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
class ot {
|
|
248
|
-
constructor(e, s, r,
|
|
249
|
-
this.keyType = e, this.valueType = s, this.payload = r, this.onComplete =
|
|
248
|
+
constructor(e, s, r, n) {
|
|
249
|
+
this.keyType = e, this.valueType = s, this.payload = r, this.onComplete = n;
|
|
250
250
|
}
|
|
251
251
|
keyWritten = !1;
|
|
252
252
|
valueWritten = !1;
|
|
@@ -298,7 +298,7 @@ class ot {
|
|
|
298
298
|
14
|
|
299
299
|
/* Guid */
|
|
300
300
|
);
|
|
301
|
-
const s = e instanceof
|
|
301
|
+
const s = e instanceof h ? e.asBytes() : e;
|
|
302
302
|
if (s.length !== 16)
|
|
303
303
|
throw new Error("Guid payload must be 16 bytes");
|
|
304
304
|
this.payload.writeBytes(s), this.keyWritten = !0;
|
|
@@ -308,7 +308,7 @@ class ot {
|
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const s =
|
|
311
|
+
const s = p.encode(e ?? "");
|
|
312
312
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
@@ -364,7 +364,7 @@ class ot {
|
|
|
364
364
|
14
|
|
365
365
|
/* Guid */
|
|
366
366
|
);
|
|
367
|
-
const s = e instanceof
|
|
367
|
+
const s = e instanceof h ? e.asBytes() : e;
|
|
368
368
|
if (s.length !== 16)
|
|
369
369
|
throw new Error("Guid payload must be 16 bytes");
|
|
370
370
|
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
@@ -386,7 +386,7 @@ class ot {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const s =
|
|
389
|
+
const s = p.encode(e ?? "");
|
|
390
390
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.valueWritten = !0;
|
|
391
391
|
}
|
|
392
392
|
writeValueObject(e, s) {
|
|
@@ -396,28 +396,28 @@ class ot {
|
|
|
396
396
|
);
|
|
397
397
|
const r = new B(e);
|
|
398
398
|
s(r);
|
|
399
|
-
const
|
|
400
|
-
this.payload.writeVarUInt(
|
|
399
|
+
const n = r.finish();
|
|
400
|
+
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n), this.valueWritten = !0;
|
|
401
401
|
}
|
|
402
402
|
writeValueArray(e, s) {
|
|
403
403
|
this.ensureValueType(
|
|
404
404
|
9
|
|
405
405
|
/* Array */
|
|
406
406
|
);
|
|
407
|
-
const r = new
|
|
407
|
+
const r = new W(e);
|
|
408
408
|
s(r);
|
|
409
|
-
const
|
|
410
|
-
this.payload.writeBytes(
|
|
409
|
+
const n = r.finish();
|
|
410
|
+
this.payload.writeBytes(n), this.valueWritten = !0;
|
|
411
411
|
}
|
|
412
412
|
writeValueDictionary(e, s, r) {
|
|
413
413
|
this.ensureValueType(
|
|
414
414
|
10
|
|
415
415
|
/* Dict */
|
|
416
416
|
);
|
|
417
|
-
const
|
|
418
|
-
r(
|
|
419
|
-
const
|
|
420
|
-
this.payload.writeBytes(
|
|
417
|
+
const n = new Q(e, s);
|
|
418
|
+
r(n);
|
|
419
|
+
const i = n.finish();
|
|
420
|
+
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
421
421
|
}
|
|
422
422
|
complete() {
|
|
423
423
|
if (!this.completed) {
|
|
@@ -428,14 +428,14 @@ class ot {
|
|
|
428
428
|
}
|
|
429
429
|
ensureKeyType(e) {
|
|
430
430
|
if (this.keyType !== e)
|
|
431
|
-
throw new Error(`Dictionary key type is ${
|
|
431
|
+
throw new Error(`Dictionary key type is ${g[this.keyType]}, expected ${g[e]}`);
|
|
432
432
|
}
|
|
433
433
|
ensureValueType(e) {
|
|
434
434
|
if (this.valueType !== e)
|
|
435
|
-
throw new Error(`Dictionary value type is ${
|
|
435
|
+
throw new Error(`Dictionary value type is ${g[this.valueType]}, expected ${g[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
class
|
|
438
|
+
class h {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
this.bytes = e;
|
|
441
441
|
}
|
|
@@ -445,19 +445,19 @@ class E {
|
|
|
445
445
|
const s = e.replace(/-/g, "");
|
|
446
446
|
if (s.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const r = new Uint8Array(16),
|
|
449
|
-
|
|
448
|
+
const r = new Uint8Array(16), n = h.parseHexSlice(s, 0, 8), i = h.parseHexSlice(s, 8, 4), a = h.parseHexSlice(s, 12, 4);
|
|
449
|
+
h.writeUInt32LE(r, 0, n), h.writeUInt16LE(r, 4, i), h.writeUInt16LE(r, 6, a);
|
|
450
450
|
for (let o = 0; o < 8; o++)
|
|
451
|
-
r[8 + o] =
|
|
452
|
-
return new
|
|
451
|
+
r[8 + o] = h.parseHexSlice(s, 16 + o * 2, 2);
|
|
452
|
+
return new h(r);
|
|
453
453
|
}
|
|
454
454
|
static fromBytes(e) {
|
|
455
455
|
if (e.length !== 16)
|
|
456
456
|
throw new Error("Guid byte array must be 16 bytes");
|
|
457
|
-
return new
|
|
457
|
+
return new h(Uint8Array.from(e));
|
|
458
458
|
}
|
|
459
459
|
static createZero() {
|
|
460
|
-
return new
|
|
460
|
+
return new h(new Uint8Array(16));
|
|
461
461
|
}
|
|
462
462
|
static createRandom() {
|
|
463
463
|
const e = new Uint8Array(16), s = globalThis.crypto;
|
|
@@ -466,14 +466,14 @@ class E {
|
|
|
466
466
|
else
|
|
467
467
|
for (let r = 0; r < e.length; r++)
|
|
468
468
|
e[r] = Math.floor(Math.random() * 256);
|
|
469
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new
|
|
469
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new h(e);
|
|
470
470
|
}
|
|
471
471
|
toString() {
|
|
472
472
|
const e = this.bytes;
|
|
473
473
|
return [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
h.toHex(h.readUInt32LE(e, 0), 8),
|
|
475
|
+
h.toHex(h.readUInt16LE(e, 4), 4),
|
|
476
|
+
h.toHex(h.readUInt16LE(e, 6), 4),
|
|
477
477
|
j(e.subarray(8, 10)),
|
|
478
478
|
j(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
@@ -482,18 +482,18 @@ class E {
|
|
|
482
482
|
return this.bytes.slice();
|
|
483
483
|
}
|
|
484
484
|
static parseHexSlice(e, s, r) {
|
|
485
|
-
const
|
|
486
|
-
if (Number.isNaN(
|
|
485
|
+
const n = e.substr(s, r), i = Number.parseInt(n, 16);
|
|
486
|
+
if (Number.isNaN(i))
|
|
487
487
|
throw new Error("Guid string contains invalid characters");
|
|
488
|
-
return
|
|
488
|
+
return i >>> 0;
|
|
489
489
|
}
|
|
490
490
|
static writeUInt32LE(e, s, r) {
|
|
491
|
-
const
|
|
492
|
-
e[s] =
|
|
491
|
+
const n = r >>> 0;
|
|
492
|
+
e[s] = n & 255, e[s + 1] = n >>> 8 & 255, e[s + 2] = n >>> 16 & 255, e[s + 3] = n >>> 24 & 255;
|
|
493
493
|
}
|
|
494
494
|
static writeUInt16LE(e, s, r) {
|
|
495
|
-
const
|
|
496
|
-
e[s] =
|
|
495
|
+
const n = r & 65535;
|
|
496
|
+
e[s] = n & 255, e[s + 1] = n >>> 8 & 255;
|
|
497
497
|
}
|
|
498
498
|
static readUInt32LE(e, s) {
|
|
499
499
|
return (e[s] | e[s + 1] << 8 | e[s + 2] << 16 | e[s + 3] << 24) >>> 0;
|
|
@@ -505,13 +505,13 @@ class E {
|
|
|
505
505
|
return (e >>> 0).toString(16).padStart(s, "0");
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
class
|
|
508
|
+
class m {
|
|
509
509
|
static INITIAL_CAPACITY = 256;
|
|
510
510
|
buffer;
|
|
511
511
|
dataView;
|
|
512
512
|
length = 0;
|
|
513
513
|
constructor() {
|
|
514
|
-
this.buffer = new Uint8Array(
|
|
514
|
+
this.buffer = new Uint8Array(m.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
515
515
|
}
|
|
516
516
|
ensureCapacity(e) {
|
|
517
517
|
const s = this.length + e;
|
|
@@ -520,8 +520,8 @@ class P {
|
|
|
520
520
|
let r = this.buffer.length;
|
|
521
521
|
for (; r < s; )
|
|
522
522
|
r *= 2;
|
|
523
|
-
const
|
|
524
|
-
|
|
523
|
+
const n = new Uint8Array(r);
|
|
524
|
+
n.set(this.buffer.subarray(0, this.length)), this.buffer = n, this.dataView = new DataView(this.buffer.buffer);
|
|
525
525
|
}
|
|
526
526
|
writeByte(e) {
|
|
527
527
|
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
@@ -575,7 +575,7 @@ function j(t) {
|
|
|
575
575
|
function Et(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
578
|
-
var R = /* @__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))(R || {}), m = /* @__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.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", t[t.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", t[t.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", t[t.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", t[t.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", t[t.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", 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))(m || {});
|
|
578
|
+
var C = /* @__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))(C || {}), P = /* @__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.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", t[t.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", t[t.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", t[t.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", t[t.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", t[t.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", 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))(P || {});
|
|
579
579
|
const J = 1, _t = 131074;
|
|
580
580
|
function Z(t) {
|
|
581
581
|
return {};
|
|
@@ -585,40 +585,40 @@ function Tt(t) {
|
|
|
585
585
|
}
|
|
586
586
|
function tt(t, e, s) {
|
|
587
587
|
const r = Tt();
|
|
588
|
-
return
|
|
588
|
+
return nt(_t, r, J, e);
|
|
589
589
|
}
|
|
590
590
|
class et extends Error {
|
|
591
591
|
constructor(e, s) {
|
|
592
592
|
super(e), this.cause = s, this.name = "ConnectionError";
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
class
|
|
595
|
+
class S extends et {
|
|
596
596
|
constructor(e, s) {
|
|
597
597
|
super(e, s), this.name = "TransportError";
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
class z extends
|
|
600
|
+
class z extends S {
|
|
601
601
|
constructor(e) {
|
|
602
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class
|
|
605
|
+
class ct extends et {
|
|
606
606
|
constructor(e) {
|
|
607
607
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function It(t, e) {
|
|
611
611
|
return new Promise((s, r) => {
|
|
612
|
-
const
|
|
613
|
-
clearTimeout(
|
|
614
|
-
},
|
|
615
|
-
e?.removeEventListener("abort",
|
|
612
|
+
const n = () => {
|
|
613
|
+
clearTimeout(i), r(new Error("Aborted"));
|
|
614
|
+
}, i = setTimeout(() => {
|
|
615
|
+
e?.removeEventListener("abort", n), s();
|
|
616
616
|
}, t);
|
|
617
617
|
if (e?.aborted) {
|
|
618
|
-
clearTimeout(
|
|
618
|
+
clearTimeout(i), r(new Error("Aborted"));
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
|
-
e?.addEventListener("abort",
|
|
621
|
+
e?.addEventListener("abort", n, { once: !0 });
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
let ut = 1;
|
|
@@ -632,18 +632,18 @@ const At = /* @__PURE__ */ new Map(), Ct = {
|
|
|
632
632
|
function Nt(t, e) {
|
|
633
633
|
return `[${t}] ${e}`;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
const
|
|
637
|
-
timestamp:
|
|
635
|
+
function G(t, e, s, r) {
|
|
636
|
+
const n = (/* @__PURE__ */ new Date()).toISOString(), i = Ct[t], a = {
|
|
637
|
+
timestamp: n,
|
|
638
638
|
level: t,
|
|
639
|
-
levelName:
|
|
639
|
+
levelName: i,
|
|
640
640
|
component: e,
|
|
641
641
|
message: s,
|
|
642
642
|
args: r
|
|
643
643
|
};
|
|
644
644
|
for (const [o, l] of At) {
|
|
645
|
-
const
|
|
646
|
-
if (t >=
|
|
645
|
+
const T = l?.minLevel ?? 2;
|
|
646
|
+
if (t >= T)
|
|
647
647
|
try {
|
|
648
648
|
o(a);
|
|
649
649
|
} catch {
|
|
@@ -670,20 +670,20 @@ function M(t, e, s, r) {
|
|
|
670
670
|
function F(t) {
|
|
671
671
|
return {
|
|
672
672
|
debug(e, ...s) {
|
|
673
|
-
|
|
673
|
+
G(0, t, e, s);
|
|
674
674
|
},
|
|
675
675
|
info(e, ...s) {
|
|
676
|
-
|
|
676
|
+
G(1, t, e, s);
|
|
677
677
|
},
|
|
678
678
|
warn(e, ...s) {
|
|
679
|
-
|
|
679
|
+
G(2, t, e, s);
|
|
680
680
|
},
|
|
681
681
|
error(e, ...s) {
|
|
682
|
-
|
|
682
|
+
G(3, t, e, s);
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
const
|
|
686
|
+
const d = F("WebSocketTransport"), ft = 1e4;
|
|
687
687
|
class Rt {
|
|
688
688
|
ws = null;
|
|
689
689
|
keepaliveTimeout = null;
|
|
@@ -691,48 +691,51 @@ class Rt {
|
|
|
691
691
|
// Pre-allocated keepalive response message to avoid allocation per keepalive
|
|
692
692
|
keepaliveResponseMessage = null;
|
|
693
693
|
keepaliveTimeoutMs;
|
|
694
|
+
connectionTimeoutMs;
|
|
694
695
|
callbacks;
|
|
695
696
|
sessionId;
|
|
696
697
|
constructor(e) {
|
|
697
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs;
|
|
698
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? ft;
|
|
698
699
|
}
|
|
699
700
|
get isConnected() {
|
|
700
701
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
701
702
|
}
|
|
702
703
|
async connect(e, s) {
|
|
703
|
-
|
|
704
|
+
this.isClosed = !1;
|
|
705
|
+
const r = Date.now();
|
|
706
|
+
return new Promise((n, i) => {
|
|
704
707
|
try {
|
|
705
708
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
706
|
-
} catch (
|
|
707
|
-
i(new
|
|
709
|
+
} catch (E) {
|
|
710
|
+
i(new S(`Failed to create WebSocket: ${E}`, E instanceof Error ? E : void 0));
|
|
708
711
|
return;
|
|
709
712
|
}
|
|
710
|
-
let
|
|
711
|
-
const
|
|
712
|
-
clearTimeout(
|
|
713
|
-
},
|
|
714
|
-
|
|
715
|
-
},
|
|
713
|
+
let a = !1, o = !1;
|
|
714
|
+
const l = () => {
|
|
715
|
+
clearTimeout(T), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
716
|
+
}, T = setTimeout(() => {
|
|
717
|
+
o || (o = !0, l(), this.ws?.close(), d.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), i(new S("WebSocket connection timeout")));
|
|
718
|
+
}, this.connectionTimeoutMs);
|
|
716
719
|
this.ws.onopen = () => {
|
|
717
|
-
|
|
720
|
+
a = !0, clearTimeout(T), this.ws.send(s), this.resetKeepaliveTimeout(), o || (o = !0, d.info(`WebSocket connected in ${Date.now() - r}ms`), n());
|
|
718
721
|
}, this.ws.onerror = () => {
|
|
719
|
-
clearTimeout(
|
|
720
|
-
}, this.ws.onclose = (
|
|
721
|
-
if (this.clearKeepaliveTimeout(), !
|
|
722
|
-
|
|
722
|
+
clearTimeout(T), o || (o = !0, l(), d.warn(`WebSocket connection failed after ${Date.now() - r}ms`), i(new S("WebSocket connection failed")));
|
|
723
|
+
}, this.ws.onclose = (E) => {
|
|
724
|
+
if (this.clearKeepaliveTimeout(), !a && !o) {
|
|
725
|
+
o = !0, l(), i(new S("WebSocket connection closed before opening"));
|
|
723
726
|
return;
|
|
724
727
|
}
|
|
725
728
|
if (this.isClosed)
|
|
726
729
|
return;
|
|
727
|
-
const
|
|
728
|
-
this.callbacks.onClose(
|
|
729
|
-
}, this.ws.onmessage = (
|
|
730
|
-
this.handleProtocolMessage(new Uint8Array(
|
|
730
|
+
const c = E.wasClean && (E.code === 1e3 || E.code === 1001), O = E.code === 1e3 || E.code === 1001, I = E.reason || `code=${E.code}`;
|
|
731
|
+
this.callbacks.onClose(I, c, O);
|
|
732
|
+
}, this.ws.onmessage = (E) => {
|
|
733
|
+
this.handleProtocolMessage(new Uint8Array(E.data));
|
|
731
734
|
};
|
|
732
735
|
});
|
|
733
736
|
}
|
|
734
737
|
send(e) {
|
|
735
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) :
|
|
738
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : d.warn("Cannot send: WebSocket not connected");
|
|
736
739
|
}
|
|
737
740
|
close() {
|
|
738
741
|
this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -745,29 +748,29 @@ class Rt {
|
|
|
745
748
|
}
|
|
746
749
|
handleProtocolMessage(e) {
|
|
747
750
|
try {
|
|
748
|
-
if (X(e).opcode ===
|
|
751
|
+
if (X(e).opcode === P.KEEPALIVE_REQUEST) {
|
|
749
752
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
750
753
|
return;
|
|
751
754
|
}
|
|
752
755
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
753
756
|
} catch (s) {
|
|
754
|
-
|
|
757
|
+
d.error("Failed to process protocol message:", s), this.callbacks.onError(s instanceof Error ? s : new Error(String(s)));
|
|
755
758
|
}
|
|
756
759
|
}
|
|
757
760
|
resetKeepaliveTimeout() {
|
|
758
761
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
759
|
-
|
|
762
|
+
d.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new z(this.keepaliveTimeoutMs)), this.close();
|
|
760
763
|
}, this.keepaliveTimeoutMs);
|
|
761
764
|
}
|
|
762
765
|
clearKeepaliveTimeout() {
|
|
763
766
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
764
767
|
}
|
|
765
768
|
}
|
|
766
|
-
const y = F("WebTransportTransport"), q = 4,
|
|
769
|
+
const y = F("WebTransportTransport"), yt = 1e4, q = 4, St = 65536;
|
|
767
770
|
function st() {
|
|
768
771
|
return typeof WebTransport < "u";
|
|
769
772
|
}
|
|
770
|
-
class
|
|
773
|
+
class Ut {
|
|
771
774
|
transport = null;
|
|
772
775
|
stream = null;
|
|
773
776
|
reader = null;
|
|
@@ -776,7 +779,7 @@ class St {
|
|
|
776
779
|
readLoopActive = !1;
|
|
777
780
|
isClosed = !1;
|
|
778
781
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
779
|
-
receiveBuffer = new Uint8Array(
|
|
782
|
+
receiveBuffer = new Uint8Array(St);
|
|
780
783
|
receiveBufferOffset = 0;
|
|
781
784
|
receiveBufferLength = 0;
|
|
782
785
|
// Cached DataView to avoid allocation per message
|
|
@@ -785,26 +788,43 @@ class St {
|
|
|
785
788
|
// Pre-allocated keepalive response message
|
|
786
789
|
keepaliveResponseMessage = null;
|
|
787
790
|
keepaliveTimeoutMs;
|
|
791
|
+
connectionTimeoutMs;
|
|
788
792
|
callbacks;
|
|
789
793
|
sessionId;
|
|
790
794
|
constructor(e) {
|
|
791
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs;
|
|
795
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? yt;
|
|
792
796
|
}
|
|
793
797
|
get isConnected() {
|
|
794
798
|
return this.transport !== null && this.writer !== null;
|
|
795
799
|
}
|
|
796
800
|
async connect(e, s) {
|
|
797
801
|
if (!st())
|
|
798
|
-
throw new
|
|
802
|
+
throw new S("WebTransport is not supported in this browser");
|
|
799
803
|
this.isClosed = !1;
|
|
804
|
+
const r = Date.now();
|
|
800
805
|
try {
|
|
801
|
-
this.transport = new WebTransport(e)
|
|
806
|
+
this.transport = new WebTransport(e);
|
|
807
|
+
let n;
|
|
808
|
+
const i = new Promise((a, o) => {
|
|
809
|
+
n = setTimeout(
|
|
810
|
+
() => o(new S("WebTransport connection timeout")),
|
|
811
|
+
this.connectionTimeoutMs
|
|
812
|
+
);
|
|
813
|
+
});
|
|
814
|
+
try {
|
|
815
|
+
await Promise.race([this.transport.ready, i]), clearTimeout(n);
|
|
816
|
+
} catch (a) {
|
|
817
|
+
throw clearTimeout(n), a instanceof S && y.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), a;
|
|
818
|
+
}
|
|
819
|
+
y.info(`WebTransport connected in ${Date.now() - r}ms`), this.transport.closed.then(() => {
|
|
802
820
|
this.handleClose("Connection closed", !0);
|
|
803
|
-
}).catch((
|
|
804
|
-
y.error("WebTransport connection closed with error:",
|
|
821
|
+
}).catch((a) => {
|
|
822
|
+
y.error("WebTransport connection closed with error:", a), this.handleClose(a.message || "Connection error", !1);
|
|
805
823
|
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(s), this.resetKeepaliveTimeout(), this.startReadLoop();
|
|
806
|
-
} catch (
|
|
807
|
-
|
|
824
|
+
} catch (n) {
|
|
825
|
+
this.cleanup();
|
|
826
|
+
const i = Date.now() - r;
|
|
827
|
+
throw y.warn(`WebTransport connection failed after ${i}ms: ${n}`), new S(`Failed to connect WebTransport: ${n}`, n instanceof Error ? n : void 0);
|
|
808
828
|
}
|
|
809
829
|
}
|
|
810
830
|
send(e) {
|
|
@@ -846,8 +866,8 @@ class St {
|
|
|
846
866
|
const s = this.receiveBufferLength + e.length, r = this.receiveBufferOffset + this.receiveBufferLength;
|
|
847
867
|
if (r + e.length > this.receiveBuffer.length)
|
|
848
868
|
if (s > this.receiveBuffer.length) {
|
|
849
|
-
const
|
|
850
|
-
|
|
869
|
+
const n = Math.max(s, this.receiveBuffer.length * 2), i = new Uint8Array(n);
|
|
870
|
+
i.set(this.receiveBuffer.subarray(this.receiveBufferOffset, r)), this.receiveBuffer = i, this.receiveBufferOffset = 0, this.receiveDataViewBuffer = null;
|
|
851
871
|
} else
|
|
852
872
|
this.receiveBuffer.copyWithin(0, this.receiveBufferOffset, r), this.receiveBufferOffset = 0;
|
|
853
873
|
this.receiveBuffer.set(e, this.receiveBufferOffset + this.receiveBufferLength), this.receiveBufferLength += e.length;
|
|
@@ -890,7 +910,7 @@ class St {
|
|
|
890
910
|
*/
|
|
891
911
|
handleProtocolMessage(e) {
|
|
892
912
|
try {
|
|
893
|
-
if (X(e).opcode ===
|
|
913
|
+
if (X(e).opcode === P.KEEPALIVE_REQUEST) {
|
|
894
914
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
895
915
|
return;
|
|
896
916
|
}
|
|
@@ -933,7 +953,7 @@ class St {
|
|
|
933
953
|
}
|
|
934
954
|
}
|
|
935
955
|
const K = F("Channel");
|
|
936
|
-
class
|
|
956
|
+
class wt {
|
|
937
957
|
state = "disconnected";
|
|
938
958
|
transport = null;
|
|
939
959
|
config;
|
|
@@ -1008,25 +1028,26 @@ class Ut {
|
|
|
1008
1028
|
const e = this.entrypoint, s = {
|
|
1009
1029
|
sessionId: this.config.sessionId,
|
|
1010
1030
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
1031
|
+
connectionTimeoutMs: this.config.connectionTimeoutMs,
|
|
1011
1032
|
callbacks: {
|
|
1012
1033
|
onProtocolMessage: (r) => this.handleProtocolMessage(r),
|
|
1013
|
-
onClose: (r,
|
|
1034
|
+
onClose: (r, n, i) => this.handleClose(r, n, i),
|
|
1014
1035
|
onError: (r) => this.handleError(r)
|
|
1015
1036
|
}
|
|
1016
1037
|
};
|
|
1017
1038
|
switch (e.Type) {
|
|
1018
|
-
case
|
|
1019
|
-
case
|
|
1039
|
+
case C.WebSocket:
|
|
1040
|
+
case C.WebSocketProxy:
|
|
1020
1041
|
this.transport = new Rt(s);
|
|
1021
1042
|
break;
|
|
1022
|
-
case
|
|
1023
|
-
case
|
|
1043
|
+
case C.WebTransport:
|
|
1044
|
+
case C.WebTransportProxy:
|
|
1024
1045
|
if (!st())
|
|
1025
1046
|
throw new Error("WebTransport is not supported in this browser");
|
|
1026
|
-
this.transport = new
|
|
1047
|
+
this.transport = new Ut(s);
|
|
1027
1048
|
break;
|
|
1028
1049
|
default:
|
|
1029
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1050
|
+
throw new Error(`Unsupported entrypoint type: ${C[e.Type]}`);
|
|
1030
1051
|
}
|
|
1031
1052
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
1032
1053
|
}
|
|
@@ -1036,7 +1057,7 @@ class Ut {
|
|
|
1036
1057
|
handleProtocolMessage(e) {
|
|
1037
1058
|
try {
|
|
1038
1059
|
const s = e;
|
|
1039
|
-
if (
|
|
1060
|
+
if (Y(s) === P.CORE_ON_SERVER_STOPPING) {
|
|
1040
1061
|
K.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
1041
1062
|
return;
|
|
1042
1063
|
}
|
|
@@ -1064,8 +1085,8 @@ class Ut {
|
|
|
1064
1085
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1065
1086
|
}
|
|
1066
1087
|
}
|
|
1067
|
-
const
|
|
1068
|
-
class
|
|
1088
|
+
const _ = F("ChannelManager");
|
|
1089
|
+
class Lt {
|
|
1069
1090
|
channels = /* @__PURE__ */ new Map();
|
|
1070
1091
|
// keyed by opcode group
|
|
1071
1092
|
activeType = null;
|
|
@@ -1077,6 +1098,7 @@ class wt {
|
|
|
1077
1098
|
abortController = null;
|
|
1078
1099
|
demotedTypes = /* @__PURE__ */ new Set();
|
|
1079
1100
|
connectionStable = !1;
|
|
1101
|
+
connectionTimeoutMs;
|
|
1080
1102
|
config;
|
|
1081
1103
|
constructor(e) {
|
|
1082
1104
|
this.config = e;
|
|
@@ -1116,13 +1138,13 @@ class wt {
|
|
|
1116
1138
|
* The opcode group is extracted from the message automatically.
|
|
1117
1139
|
*/
|
|
1118
1140
|
sendProtocolMessage(e) {
|
|
1119
|
-
const s =
|
|
1120
|
-
for (const [r,
|
|
1141
|
+
const s = k(e);
|
|
1142
|
+
for (const [r, n] of this.channels)
|
|
1121
1143
|
if (r & s) {
|
|
1122
|
-
|
|
1144
|
+
n.send(e);
|
|
1123
1145
|
return;
|
|
1124
1146
|
}
|
|
1125
|
-
this.state === "connected" &&
|
|
1147
|
+
this.state === "connected" && _.warn("No channel found for message");
|
|
1126
1148
|
}
|
|
1127
1149
|
/**
|
|
1128
1150
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -1150,38 +1172,40 @@ class wt {
|
|
|
1150
1172
|
this.setState("connecting");
|
|
1151
1173
|
let s = this.entrypoints;
|
|
1152
1174
|
if (this.config.webRtcEnabled) {
|
|
1153
|
-
|
|
1175
|
+
_.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1154
1176
|
for (const a of this.entrypoints)
|
|
1155
|
-
|
|
1156
|
-
const
|
|
1177
|
+
_.debug(` Entrypoint: type=${a.Type} fromServer=0x${a.OpcodeGroupsFromServer.toString(16)} toServer=0x${a.OpcodeGroupsToServer.toString(16)} uri=${a.Uri}`);
|
|
1178
|
+
const i = P.GROUP_AUDIO | P.GROUP_VIDEO;
|
|
1157
1179
|
s = this.entrypoints.filter((a) => {
|
|
1158
|
-
if (a.Type ===
|
|
1159
|
-
return
|
|
1180
|
+
if (a.Type === C.WebRTC)
|
|
1181
|
+
return _.debug(` Filtered out WebRTC entrypoint (type=${a.Type})`), !1;
|
|
1160
1182
|
const o = a.OpcodeGroupsFromServer | a.OpcodeGroupsToServer;
|
|
1161
|
-
return (o & ~
|
|
1162
|
-
}),
|
|
1183
|
+
return (o & ~i) === 0 ? (_.debug(` Filtered out audio/video-only entrypoint (type=${a.Type}, groups=0x${o.toString(16)})`), !1) : !0;
|
|
1184
|
+
}), _.debug(`After filtering: ${s.length} entrypoints remain for WS/WT channels`);
|
|
1163
1185
|
}
|
|
1164
1186
|
const r = this.groupByType(s);
|
|
1165
1187
|
if (r.size === 0)
|
|
1166
1188
|
throw this.setState("offline"), new Error("No entrypoints available");
|
|
1167
|
-
let
|
|
1189
|
+
let n;
|
|
1168
1190
|
if (this.config.orderedEndpointTypes && this.config.orderedEndpointTypes.length > 0) {
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
} else this.config.endpointSelector ?
|
|
1191
|
+
const i = new Set(r.keys());
|
|
1192
|
+
n = this.config.orderedEndpointTypes.filter((a) => i.has(a));
|
|
1193
|
+
} else this.config.endpointSelector ? n = this.config.endpointSelector.getOrderedTypes(r) : n = Array.from(r.keys());
|
|
1172
1194
|
if (this.demotedTypes.size > 0) {
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1195
|
+
const i = n.filter((o) => !this.demotedTypes.has(o)), a = n.filter((o) => this.demotedTypes.has(o));
|
|
1196
|
+
n = [...i, ...a];
|
|
1175
1197
|
}
|
|
1176
|
-
|
|
1198
|
+
this.connectionTimeoutMs = n.length > 1 ? 5e3 : 1e4, _.info(`Endpoint types to try: [${n.map((i) => C[i]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
|
|
1199
|
+
for (const i of n) {
|
|
1177
1200
|
if (!this.shouldReconnect)
|
|
1178
1201
|
return;
|
|
1179
|
-
const a = r.get(
|
|
1202
|
+
const a = r.get(i), o = Date.now();
|
|
1203
|
+
_.info(`Trying ${C[i]} (${a.length} channel(s))`);
|
|
1180
1204
|
try {
|
|
1181
|
-
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(
|
|
1205
|
+
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, this.startStabilityTimer(), _.info(`Connected via ${C[i]} in ${Date.now() - o}ms`), this.setState("connected");
|
|
1182
1206
|
return;
|
|
1183
|
-
} catch (
|
|
1184
|
-
|
|
1207
|
+
} catch (l) {
|
|
1208
|
+
_.warn(`Failed to connect using ${C[i]} after ${Date.now() - o}ms: ${l instanceof Error ? l.message : l}`), this.disconnectAll();
|
|
1185
1209
|
}
|
|
1186
1210
|
}
|
|
1187
1211
|
throw e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
@@ -1192,31 +1216,32 @@ class wt {
|
|
|
1192
1216
|
async connectAllChannels(e) {
|
|
1193
1217
|
if (e.length === 0)
|
|
1194
1218
|
throw new Error("No entrypoints to connect");
|
|
1195
|
-
const r = (await Promise.allSettled(e.map((
|
|
1219
|
+
const r = (await Promise.allSettled(e.map((n) => this.connectChannel(n)))).filter((n) => n.status === "rejected");
|
|
1196
1220
|
if (r.length > 0) {
|
|
1197
|
-
const
|
|
1198
|
-
const a =
|
|
1221
|
+
const n = r.map((i) => {
|
|
1222
|
+
const a = i.reason;
|
|
1199
1223
|
return a instanceof Error ? a.message : String(a);
|
|
1200
1224
|
});
|
|
1201
|
-
throw new Error(
|
|
1225
|
+
throw new Error(n.join(", "));
|
|
1202
1226
|
}
|
|
1203
1227
|
}
|
|
1204
1228
|
/**
|
|
1205
1229
|
* Connect a single channel.
|
|
1206
1230
|
*/
|
|
1207
1231
|
async connectChannel(e) {
|
|
1208
|
-
const s = new
|
|
1232
|
+
const s = new wt({
|
|
1209
1233
|
entrypoint: e,
|
|
1210
1234
|
sessionId: this.config.sessionId,
|
|
1211
1235
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
1236
|
+
connectionTimeoutMs: this.connectionTimeoutMs,
|
|
1212
1237
|
onProtocolMessage: (r) => {
|
|
1213
1238
|
this.config.onProtocolMessage?.(r);
|
|
1214
1239
|
},
|
|
1215
1240
|
onStateChange: (r) => {
|
|
1216
1241
|
this.handleChannelStateChange(e.OpcodeGroupsFromServer, r);
|
|
1217
1242
|
},
|
|
1218
|
-
onClose: (r,
|
|
1219
|
-
this.handleChannelClose(e.OpcodeGroupsFromServer, r,
|
|
1243
|
+
onClose: (r, n, i) => {
|
|
1244
|
+
this.handleChannelClose(e.OpcodeGroupsFromServer, r, n, i);
|
|
1220
1245
|
},
|
|
1221
1246
|
onError: (r) => {
|
|
1222
1247
|
this.config.onError?.(r);
|
|
@@ -1230,8 +1255,8 @@ class wt {
|
|
|
1230
1255
|
groupByType(e) {
|
|
1231
1256
|
const s = /* @__PURE__ */ new Map();
|
|
1232
1257
|
for (const r of e) {
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1258
|
+
const n = s.get(r.Type) ?? [];
|
|
1259
|
+
n.push(r), s.set(r.Type, n);
|
|
1235
1260
|
}
|
|
1236
1261
|
return s;
|
|
1237
1262
|
}
|
|
@@ -1244,13 +1269,13 @@ class wt {
|
|
|
1244
1269
|
/**
|
|
1245
1270
|
* Handle channel close.
|
|
1246
1271
|
*/
|
|
1247
|
-
handleChannelClose(e, s, r,
|
|
1272
|
+
handleChannelClose(e, s, r, n) {
|
|
1248
1273
|
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline") && this.channels.has(e)) {
|
|
1249
|
-
if (
|
|
1250
|
-
|
|
1274
|
+
if (n) {
|
|
1275
|
+
_.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1251
1276
|
return;
|
|
1252
1277
|
}
|
|
1253
|
-
this.state === "connected" && (!this.connectionStable && this.activeType !== null && (
|
|
1278
|
+
this.state === "connected" && (!this.connectionStable && this.activeType !== null && (_.warn(`Demoting unstable type ${C[this.activeType]}`), this.demotedTypes.add(this.activeType)), _.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1254
1279
|
}
|
|
1255
1280
|
}
|
|
1256
1281
|
/**
|
|
@@ -1260,10 +1285,10 @@ class wt {
|
|
|
1260
1285
|
async attemptReconnect() {
|
|
1261
1286
|
if (this.shouldReconnect) {
|
|
1262
1287
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1263
|
-
|
|
1288
|
+
_.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new ct(this.config.maxReconnectAttempts));
|
|
1264
1289
|
return;
|
|
1265
1290
|
}
|
|
1266
|
-
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (
|
|
1291
|
+
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (_.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await It(this.config.reconnectBackoffMs, this.abortController?.signal)) : _.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), !!this.shouldReconnect)
|
|
1267
1292
|
try {
|
|
1268
1293
|
await this.connectInternal(!0);
|
|
1269
1294
|
} catch {
|
|
@@ -1302,77 +1327,77 @@ class wt {
|
|
|
1302
1327
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1303
1328
|
}
|
|
1304
1329
|
}
|
|
1305
|
-
const rt = F("ProtocolWorker"),
|
|
1330
|
+
const rt = F("ProtocolWorker"), L = (t, e) => {
|
|
1306
1331
|
self.postMessage(t, e ?? []);
|
|
1307
1332
|
};
|
|
1308
|
-
let
|
|
1309
|
-
const
|
|
1310
|
-
function
|
|
1333
|
+
let N = null, H, A = null;
|
|
1334
|
+
const w = [], f = [], M = /* @__PURE__ */ new Map(), R = [], u = [], U = /* @__PURE__ */ new Map(), x = [];
|
|
1335
|
+
function $() {
|
|
1311
1336
|
try {
|
|
1312
|
-
|
|
1337
|
+
N?.disconnect();
|
|
1313
1338
|
} catch (t) {
|
|
1314
1339
|
rt.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1315
1340
|
}
|
|
1316
|
-
|
|
1317
|
-
for (let t = 0; t <
|
|
1341
|
+
N = null;
|
|
1342
|
+
for (let t = 0; t < f.length; t++)
|
|
1318
1343
|
try {
|
|
1319
|
-
|
|
1344
|
+
f[t].port.close();
|
|
1320
1345
|
} catch {
|
|
1321
1346
|
}
|
|
1322
|
-
|
|
1323
|
-
for (let t = 0; t <
|
|
1347
|
+
w.length = 0, f.length = 0, M.clear();
|
|
1348
|
+
for (let t = 0; t < u.length; t++)
|
|
1324
1349
|
try {
|
|
1325
|
-
|
|
1350
|
+
u[t].port.close();
|
|
1326
1351
|
} catch {
|
|
1327
1352
|
}
|
|
1328
|
-
|
|
1353
|
+
R.length = 0, u.length = 0, U.clear();
|
|
1329
1354
|
}
|
|
1330
1355
|
function v(t) {
|
|
1331
1356
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1332
|
-
|
|
1357
|
+
L({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1333
1358
|
}
|
|
1334
|
-
function
|
|
1359
|
+
function gt() {
|
|
1335
1360
|
let t = 0;
|
|
1336
|
-
for (let e = 0; e <
|
|
1337
|
-
t |=
|
|
1361
|
+
for (let e = 0; e < f.length; e++)
|
|
1362
|
+
t |= f[e].opcodeGroupsMask;
|
|
1338
1363
|
return t;
|
|
1339
1364
|
}
|
|
1340
|
-
function
|
|
1365
|
+
function mt(t) {
|
|
1341
1366
|
if (H === void 0)
|
|
1342
1367
|
return !0;
|
|
1343
|
-
const e =
|
|
1368
|
+
const e = k(t);
|
|
1344
1369
|
if ((e & H) !== 0)
|
|
1345
1370
|
return !0;
|
|
1346
|
-
const s =
|
|
1371
|
+
const s = gt();
|
|
1347
1372
|
return (e & s) !== 0;
|
|
1348
1373
|
}
|
|
1349
1374
|
function Pt(t) {
|
|
1350
1375
|
x.length = 0;
|
|
1351
|
-
for (let e = 0; e <
|
|
1352
|
-
const s =
|
|
1376
|
+
for (let e = 0; e < f.length; e++) {
|
|
1377
|
+
const s = f[e];
|
|
1353
1378
|
(s.opcodeGroupsMask & t) !== 0 && x.push(s.port);
|
|
1354
1379
|
}
|
|
1355
1380
|
return x;
|
|
1356
1381
|
}
|
|
1357
|
-
function mt(t, e) {
|
|
1358
|
-
return (p(t) & e) !== 0;
|
|
1359
|
-
}
|
|
1360
1382
|
function Ot(t, e) {
|
|
1361
|
-
|
|
1383
|
+
return (k(t) & e) !== 0;
|
|
1384
|
+
}
|
|
1385
|
+
function Dt(t, e) {
|
|
1386
|
+
if (!N || !e || typeof e != "object")
|
|
1362
1387
|
return;
|
|
1363
1388
|
const s = e;
|
|
1364
1389
|
if (!(s.type !== "send" || !(s.message instanceof ArrayBuffer)))
|
|
1365
1390
|
try {
|
|
1366
1391
|
const r = new Uint8Array(s.message);
|
|
1367
|
-
if (!
|
|
1392
|
+
if (!Ot(r, t))
|
|
1368
1393
|
return;
|
|
1369
|
-
|
|
1394
|
+
N.sendProtocolMessage(r), A && A.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1370
1395
|
} catch (r) {
|
|
1371
1396
|
v(r);
|
|
1372
1397
|
}
|
|
1373
1398
|
}
|
|
1374
1399
|
async function dt(t) {
|
|
1375
|
-
|
|
1400
|
+
$(), N = new Lt({
|
|
1376
1401
|
sessionId: t.sessionId,
|
|
1377
1402
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1378
1403
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
@@ -1380,74 +1405,74 @@ async function dt(t) {
|
|
|
1380
1405
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1381
1406
|
webRtcEnabled: t.webRtcEnabled,
|
|
1382
1407
|
onStateChange: (e) => {
|
|
1383
|
-
|
|
1408
|
+
L({ type: "state", state: e, activeType: N?.activeEndpointType ?? void 0 });
|
|
1384
1409
|
},
|
|
1385
1410
|
onRememberWorkingType: () => {
|
|
1386
|
-
|
|
1411
|
+
L({ type: "state", state: N?.managerState ?? "idle", activeType: N?.activeEndpointType ?? void 0 });
|
|
1387
1412
|
},
|
|
1388
1413
|
onError: (e) => {
|
|
1389
1414
|
v(e);
|
|
1390
1415
|
},
|
|
1391
1416
|
onProtocolMessage: (e) => {
|
|
1392
|
-
|
|
1393
|
-
const s =
|
|
1394
|
-
if (!(!r &&
|
|
1417
|
+
A && (A.postMessage({ direction: "received", message: Array.from(e) }), Y(e) === P.ANALYTICS_LOGS && A.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1418
|
+
const s = k(e), r = mt(e), n = Pt(s);
|
|
1419
|
+
if (!(!r && n.length === 0))
|
|
1395
1420
|
try {
|
|
1396
|
-
const
|
|
1397
|
-
if (o && !r &&
|
|
1421
|
+
const i = X(e), a = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, o = n.length > 0;
|
|
1422
|
+
if (o && !r && n.length === 1 && a) {
|
|
1398
1423
|
const l = e.buffer;
|
|
1399
|
-
|
|
1424
|
+
n[0].postMessage({ type: "protocol", message: l, headers: i }, [l]);
|
|
1400
1425
|
return;
|
|
1401
1426
|
}
|
|
1402
1427
|
if (!o && r && a) {
|
|
1403
1428
|
const l = e.buffer;
|
|
1404
|
-
|
|
1429
|
+
L({ type: "protocol", message: l, headers: i }, [l]);
|
|
1405
1430
|
return;
|
|
1406
1431
|
}
|
|
1407
1432
|
if (o && a) {
|
|
1408
1433
|
const l = [];
|
|
1409
|
-
for (let
|
|
1434
|
+
for (let c = 1; c < n.length; c++)
|
|
1410
1435
|
l.push(e.slice().buffer);
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1413
|
-
for (let
|
|
1414
|
-
|
|
1415
|
-
|
|
1436
|
+
const T = r ? e.slice().buffer : null, E = e.buffer;
|
|
1437
|
+
n[0].postMessage({ type: "protocol", message: E, headers: i }, [E]);
|
|
1438
|
+
for (let c = 1; c < n.length; c++)
|
|
1439
|
+
n[c].postMessage({ type: "protocol", message: l[c - 1], headers: i }, [l[c - 1]]);
|
|
1440
|
+
T && L({ type: "protocol", message: T, headers: i }, [T]);
|
|
1416
1441
|
return;
|
|
1417
1442
|
}
|
|
1418
1443
|
if (o)
|
|
1419
|
-
for (const l of
|
|
1420
|
-
const
|
|
1421
|
-
l.postMessage({ type: "protocol", message:
|
|
1444
|
+
for (const l of n) {
|
|
1445
|
+
const T = e.slice().buffer;
|
|
1446
|
+
l.postMessage({ type: "protocol", message: T, headers: i }, [T]);
|
|
1422
1447
|
}
|
|
1423
1448
|
if (r) {
|
|
1424
1449
|
const l = e.slice().buffer;
|
|
1425
|
-
|
|
1450
|
+
L({ type: "protocol", message: l, headers: i }, [l]);
|
|
1426
1451
|
}
|
|
1427
|
-
} catch (
|
|
1428
|
-
v(
|
|
1452
|
+
} catch (i) {
|
|
1453
|
+
v(i);
|
|
1429
1454
|
}
|
|
1430
1455
|
}
|
|
1431
|
-
}), await
|
|
1456
|
+
}), await N.connect(t.entrypoints, { retry: t.retry });
|
|
1432
1457
|
}
|
|
1433
1458
|
self.addEventListener("message", (t) => {
|
|
1434
1459
|
const e = t.data;
|
|
1435
1460
|
if (e.type === "connect") {
|
|
1436
1461
|
dt(e).catch((s) => {
|
|
1437
|
-
rt.error(`Failed to connect: ${s}`), v(s),
|
|
1462
|
+
rt.error(`Failed to connect: ${s}`), v(s), $();
|
|
1438
1463
|
});
|
|
1439
1464
|
return;
|
|
1440
1465
|
}
|
|
1441
1466
|
if (e.type === "disconnect") {
|
|
1442
|
-
|
|
1467
|
+
$(), L({ type: "state", state: "idle" });
|
|
1443
1468
|
return;
|
|
1444
1469
|
}
|
|
1445
1470
|
if (e.type === "send") {
|
|
1446
|
-
if (!
|
|
1471
|
+
if (!N)
|
|
1447
1472
|
return;
|
|
1448
1473
|
try {
|
|
1449
1474
|
const s = new Uint8Array(e.message);
|
|
1450
|
-
|
|
1475
|
+
N.sendProtocolMessage(s), A && A.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1451
1476
|
} catch (s) {
|
|
1452
1477
|
v(s);
|
|
1453
1478
|
}
|
|
@@ -1458,11 +1483,11 @@ self.addEventListener("message", (t) => {
|
|
|
1458
1483
|
return;
|
|
1459
1484
|
}
|
|
1460
1485
|
if (e.type === "enableDevtools") {
|
|
1461
|
-
e.enabled && !
|
|
1486
|
+
e.enabled && !A ? A = new BroadcastChannel("ikon:devtools") : !e.enabled && A && (A.close(), A = null);
|
|
1462
1487
|
return;
|
|
1463
1488
|
}
|
|
1464
1489
|
if (e.type === "checkHealth") {
|
|
1465
|
-
|
|
1490
|
+
N?.checkHealth();
|
|
1466
1491
|
return;
|
|
1467
1492
|
}
|
|
1468
1493
|
if (e.type === "attachPort") {
|
|
@@ -1470,67 +1495,67 @@ self.addEventListener("message", (t) => {
|
|
|
1470
1495
|
e.port.start?.();
|
|
1471
1496
|
} catch {
|
|
1472
1497
|
}
|
|
1473
|
-
const s =
|
|
1474
|
-
|
|
1498
|
+
const s = w.length;
|
|
1499
|
+
w.push(e.portId), f.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), M.set(e.portId, s);
|
|
1475
1500
|
return;
|
|
1476
1501
|
}
|
|
1477
1502
|
if (e.type === "detachPort") {
|
|
1478
|
-
const s =
|
|
1503
|
+
const s = M.get(e.portId);
|
|
1479
1504
|
if (s !== void 0) {
|
|
1480
|
-
const r =
|
|
1505
|
+
const r = f[s];
|
|
1481
1506
|
try {
|
|
1482
1507
|
r.port.close();
|
|
1483
1508
|
} catch {
|
|
1484
1509
|
}
|
|
1485
|
-
const
|
|
1486
|
-
if (s !==
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1510
|
+
const n = w.length - 1;
|
|
1511
|
+
if (s !== n) {
|
|
1512
|
+
const i = w[n];
|
|
1513
|
+
w[s] = i, f[s] = f[n], M.set(i, s);
|
|
1489
1514
|
}
|
|
1490
|
-
|
|
1515
|
+
w.length--, f.length--, M.delete(e.portId);
|
|
1491
1516
|
}
|
|
1492
1517
|
return;
|
|
1493
1518
|
}
|
|
1494
1519
|
if (e.type === "attachSendPort") {
|
|
1495
|
-
const s =
|
|
1520
|
+
const s = U.get(e.portId);
|
|
1496
1521
|
if (s !== void 0) {
|
|
1497
|
-
const
|
|
1522
|
+
const i = u[s];
|
|
1498
1523
|
try {
|
|
1499
|
-
|
|
1524
|
+
i.port.close();
|
|
1500
1525
|
} catch {
|
|
1501
1526
|
}
|
|
1502
|
-
const a =
|
|
1527
|
+
const a = R.length - 1;
|
|
1503
1528
|
if (s !== a) {
|
|
1504
|
-
const o =
|
|
1505
|
-
|
|
1529
|
+
const o = R[a];
|
|
1530
|
+
R[s] = o, u[s] = u[a], U.set(o, s);
|
|
1506
1531
|
}
|
|
1507
|
-
|
|
1532
|
+
R.length--, u.length--, U.delete(e.portId);
|
|
1508
1533
|
}
|
|
1509
|
-
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask },
|
|
1510
|
-
|
|
1534
|
+
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n = R.length;
|
|
1535
|
+
R.push(e.portId), u.push(r), U.set(e.portId, n);
|
|
1511
1536
|
try {
|
|
1512
1537
|
r.port.start?.();
|
|
1513
1538
|
} catch {
|
|
1514
1539
|
}
|
|
1515
|
-
r.port.addEventListener("message", (
|
|
1516
|
-
|
|
1540
|
+
r.port.addEventListener("message", (i) => {
|
|
1541
|
+
Dt(r.opcodeGroupsMask, i.data);
|
|
1517
1542
|
});
|
|
1518
1543
|
return;
|
|
1519
1544
|
}
|
|
1520
1545
|
if (e.type === "detachSendPort") {
|
|
1521
|
-
const s =
|
|
1546
|
+
const s = U.get(e.portId);
|
|
1522
1547
|
if (s !== void 0) {
|
|
1523
|
-
const r =
|
|
1548
|
+
const r = u[s];
|
|
1524
1549
|
try {
|
|
1525
1550
|
r.port.close();
|
|
1526
1551
|
} catch {
|
|
1527
1552
|
}
|
|
1528
|
-
const
|
|
1529
|
-
if (s !==
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1553
|
+
const n = R.length - 1;
|
|
1554
|
+
if (s !== n) {
|
|
1555
|
+
const i = R[n];
|
|
1556
|
+
R[s] = i, u[s] = u[n], U.set(i, s);
|
|
1532
1557
|
}
|
|
1533
|
-
|
|
1558
|
+
R.length--, u.length--, U.delete(e.portId);
|
|
1534
1559
|
}
|
|
1535
1560
|
return;
|
|
1536
1561
|
}
|