@ikonai/sdk 0.0.21 → 0.0.23
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
|
@@ -10,7 +10,7 @@ function ye(e) {
|
|
|
10
10
|
return Ne(e) & 4294901760;
|
|
11
11
|
}
|
|
12
12
|
function U(e) {
|
|
13
|
-
const l =
|
|
13
|
+
const l = Fe(e), i = new DataView(l.buffer, l.byteOffset, l.byteLength);
|
|
14
14
|
if (l.length < 27)
|
|
15
15
|
throw new Error("Protocol payload too short");
|
|
16
16
|
const s = i.getUint32(0, !0), d = i.getUint32(4, !0), a = i.getUint32(8, !0), c = i.getUint32(12, !0), f = i.getUint32(16, !0), w = i.getUint32(20, !0), h = i.getUint8(24), o = i.getUint8(25), r = i.getUint8(26);
|
|
@@ -33,7 +33,7 @@ function U(e) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function M(e, l, i) {
|
|
36
|
-
const s =
|
|
36
|
+
const s = Fe(e), d = U(s);
|
|
37
37
|
if (l !== void 0 && d.opcode !== l)
|
|
38
38
|
throw new Error(`Unexpected opcode ${d.opcode}`);
|
|
39
39
|
if (i !== void 0 && d.payloadVersion !== i)
|
|
@@ -57,7 +57,7 @@ class y {
|
|
|
57
57
|
constructor(l = 1) {
|
|
58
58
|
this.version = l, this.buffer.writeByte(nn), this.buffer.writeVarUInt(l >>> 0);
|
|
59
59
|
}
|
|
60
|
-
buffer = new
|
|
60
|
+
buffer = new pe();
|
|
61
61
|
closed = !1;
|
|
62
62
|
cached;
|
|
63
63
|
writeInt32Field(l, i) {
|
|
@@ -129,7 +129,7 @@ class je {
|
|
|
129
129
|
constructor(l) {
|
|
130
130
|
this.elementType = l;
|
|
131
131
|
}
|
|
132
|
-
payload = new
|
|
132
|
+
payload = new pe();
|
|
133
133
|
count = 0;
|
|
134
134
|
writeInt32(l) {
|
|
135
135
|
this.ensureElementType(
|
|
@@ -228,7 +228,7 @@ class je {
|
|
|
228
228
|
this.payload.writeBytes(a);
|
|
229
229
|
}
|
|
230
230
|
finish() {
|
|
231
|
-
const l = new
|
|
231
|
+
const l = new pe();
|
|
232
232
|
return l.writeByte(Me(this.elementType)), l.writeVarUInt(this.count), l.writeBytes(this.payload.toUint8Array()), l.toUint8Array();
|
|
233
233
|
}
|
|
234
234
|
ensureElementType(l) {
|
|
@@ -240,7 +240,7 @@ class or {
|
|
|
240
240
|
constructor(l, i) {
|
|
241
241
|
this.keyType = l, this.valueType = i, ir(l);
|
|
242
242
|
}
|
|
243
|
-
payload = new
|
|
243
|
+
payload = new pe();
|
|
244
244
|
count = 0;
|
|
245
245
|
entryOpen = !1;
|
|
246
246
|
beginEntry() {
|
|
@@ -253,7 +253,7 @@ class or {
|
|
|
253
253
|
finish() {
|
|
254
254
|
if (this.entryOpen)
|
|
255
255
|
throw new Error("Dictionary entry not completed");
|
|
256
|
-
const l = new
|
|
256
|
+
const l = new pe();
|
|
257
257
|
return l.writeByte(Me(this.keyType)), l.writeByte(Me(this.valueType)), l.writeVarUInt(this.count), l.writeBytes(this.payload.toUint8Array()), l.toUint8Array();
|
|
258
258
|
}
|
|
259
259
|
}
|
|
@@ -455,7 +455,7 @@ class E {
|
|
|
455
455
|
offset;
|
|
456
456
|
end;
|
|
457
457
|
static create(l) {
|
|
458
|
-
const i =
|
|
458
|
+
const i = Fe(l);
|
|
459
459
|
if (i.length < 2)
|
|
460
460
|
throw new Error("Teleport payload too short");
|
|
461
461
|
if (i[0] !== nn || i[i.length - 1] !== ln)
|
|
@@ -601,7 +601,7 @@ class nr {
|
|
|
601
601
|
this.count = G(l, s, "ArrayMalformed"), this.offset = s.offset;
|
|
602
602
|
}
|
|
603
603
|
static create(l) {
|
|
604
|
-
return new nr(
|
|
604
|
+
return new nr(Fe(l));
|
|
605
605
|
}
|
|
606
606
|
next() {
|
|
607
607
|
if (this.index >= this.count) {
|
|
@@ -675,7 +675,7 @@ class lr {
|
|
|
675
675
|
this.count = G(l, i, "DictMalformed"), this.offset = i.offset;
|
|
676
676
|
}
|
|
677
677
|
static create(l) {
|
|
678
|
-
return new lr(
|
|
678
|
+
return new lr(Fe(l));
|
|
679
679
|
}
|
|
680
680
|
next() {
|
|
681
681
|
if (this.index >= this.count) {
|
|
@@ -818,7 +818,7 @@ class D {
|
|
|
818
818
|
return (l >>> 0).toString(16).padStart(i, "0");
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
class
|
|
821
|
+
class pe {
|
|
822
822
|
bytes = [];
|
|
823
823
|
writeByte(l) {
|
|
824
824
|
this.bytes.push(l & 255);
|
|
@@ -971,10 +971,10 @@ function Ye(e, l, i, s) {
|
|
|
971
971
|
function pr(e) {
|
|
972
972
|
return Array.from(e).map((l) => l.toString(16).padStart(2, "0")).join("");
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Fe(e) {
|
|
975
975
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
976
976
|
}
|
|
977
|
-
var
|
|
977
|
+
var he;
|
|
978
978
|
((e) => {
|
|
979
979
|
e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 213871793, e.ActionIdFieldId = 727023925, e.DescriptionFieldId = 1368629611;
|
|
980
980
|
function l(o) {
|
|
@@ -1033,7 +1033,7 @@ var we;
|
|
|
1033
1033
|
return a(t, r);
|
|
1034
1034
|
}
|
|
1035
1035
|
e.fromProtocolMessage = h;
|
|
1036
|
-
})(
|
|
1036
|
+
})(he || (he = {}));
|
|
1037
1037
|
var Tr;
|
|
1038
1038
|
((e) => {
|
|
1039
1039
|
e.TeleportVersion = 2, e.TeleportOpcode = 1048578, e.TeleportLayoutHash = 2972842713, e.DescriptionFieldId = 1368629611, e.IsFinishedFieldId = 4172191587;
|
|
@@ -2443,8 +2443,8 @@ var jr;
|
|
|
2443
2443
|
function I(p, m) {
|
|
2444
2444
|
m.writeInt32Field(r.CallIndexFieldId, p.CallIndex | 0), m.writeStringField(r.FunctionNameFieldId, p.FunctionName), m.writeArrayField(r.ParametersFieldId, C.Object, (P) => {
|
|
2445
2445
|
for (const V of p.Parameters)
|
|
2446
|
-
P.writeObject(
|
|
2447
|
-
|
|
2446
|
+
P.writeObject(q.TeleportVersion, (_) => {
|
|
2447
|
+
q.writeToTeleport(V, _);
|
|
2448
2448
|
});
|
|
2449
2449
|
});
|
|
2450
2450
|
}
|
|
@@ -2487,7 +2487,7 @@ var jr;
|
|
|
2487
2487
|
const m = [];
|
|
2488
2488
|
let P;
|
|
2489
2489
|
for (; (P = p.next()) !== null; )
|
|
2490
|
-
m.push(
|
|
2490
|
+
m.push(q.readFromTeleport(P.asObject()));
|
|
2491
2491
|
return m;
|
|
2492
2492
|
}
|
|
2493
2493
|
})(e.ActionOptimisticClientCall || (e.ActionOptimisticClientCall = {}));
|
|
@@ -5407,8 +5407,8 @@ var Qe;
|
|
|
5407
5407
|
function d(t, n) {
|
|
5408
5408
|
n.writeStringField(e.CertHashFieldId, t.CertHash), n.writeArrayField(e.EntrypointsFieldId, C.Object, (u) => {
|
|
5409
5409
|
for (const I of t.Entrypoints)
|
|
5410
|
-
u.writeObject(
|
|
5411
|
-
|
|
5410
|
+
u.writeObject(Ie.TeleportVersion, (N) => {
|
|
5411
|
+
Ie.writeToTeleport(I, N);
|
|
5412
5412
|
});
|
|
5413
5413
|
}), n.writeStringField(e.ChannelIdFieldId, t.ChannelId), n.writeObjectField(e.ClientContextFieldId, L.TeleportVersion, (u) => {
|
|
5414
5414
|
L.writeToTeleport(t.ClientContext, u);
|
|
@@ -5510,7 +5510,7 @@ var Qe;
|
|
|
5510
5510
|
const n = [];
|
|
5511
5511
|
let u;
|
|
5512
5512
|
for (; (u = t.next()) !== null; )
|
|
5513
|
-
n.push(
|
|
5513
|
+
n.push(Ie.readFromTeleport(u.asObject()));
|
|
5514
5514
|
return n;
|
|
5515
5515
|
}
|
|
5516
5516
|
function r(t) {
|
|
@@ -5885,7 +5885,7 @@ var Ze;
|
|
|
5885
5885
|
return t;
|
|
5886
5886
|
}
|
|
5887
5887
|
})(Ze || (Ze = {}));
|
|
5888
|
-
var
|
|
5888
|
+
var Ie;
|
|
5889
5889
|
((e) => {
|
|
5890
5890
|
e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 2083170344, e.AuthTicketFieldId = 746516514, e.PriorityFieldId = 877841741, e.OpcodeGroupsFromServerFieldId = 1175184220, e.DescriptionFieldId = 1368629611, e.UriFieldId = 2341021724, e.TypeFieldId = 3167053791, e.OpcodeGroupsToServerFieldId = 3686066300;
|
|
5891
5891
|
function l(o) {
|
|
@@ -5974,7 +5974,7 @@ var he;
|
|
|
5974
5974
|
return a(t, r);
|
|
5975
5975
|
}
|
|
5976
5976
|
e.fromProtocolMessage = h;
|
|
5977
|
-
})(
|
|
5977
|
+
})(Ie || (Ie = {}));
|
|
5978
5978
|
var L;
|
|
5979
5979
|
((e) => {
|
|
5980
5980
|
e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 3224759234, e.DeviceIdFieldId = 76337612, e.InstallIdFieldId = 185396121, e.UserAgentFieldId = 388632637, e.ContextTypeFieldId = 417197284, e.HasInputFieldId = 469070965, e.UserTypeFieldId = 470595159, e.UserIdFieldId = 781727218, e.ProductIdFieldId = 834078886, e.AuthSessionIdFieldId = 1043273762, e.ReceiveAllMessagesFieldId = 1236999138, e.DescriptionFieldId = 1368629611, e.LocaleFieldId = 1715899485, e.SdkTypeFieldId = 1942830531, e.SessionIdFieldId = 1999510636, e.PreciseJoinedAtFieldId = 2079864626, e.PayloadTypeFieldId = 2142346422, e.VersionIdFieldId = 2598291686, e.UniqueSessionIdFieldId = 2719718823, e.ClientTypeFieldId = 2810953526, e.IsReadyFieldId = 2840065720, e.ParametersFieldId = 2885165957, e.IsInternalFieldId = 3586157513, e.ChannelLocaleFieldId = 3717933110, e.EmbeddedSpaceIdFieldId = 4062655306;
|
|
@@ -6660,8 +6660,8 @@ var qe;
|
|
|
6660
6660
|
});
|
|
6661
6661
|
}), n.writeStringField(e.FunctionNameFieldId, t.FunctionName), n.writeGuidField(e.FunctionIdFieldId, t.FunctionId), n.writeStringField(e.ClientBackendTokenFieldId, t.ClientBackendToken), n.writeArrayField(e.ParametersFieldId, C.Object, (u) => {
|
|
6662
6662
|
for (const I of t.Parameters)
|
|
6663
|
-
u.writeObject(
|
|
6664
|
-
|
|
6663
|
+
u.writeObject(q.TeleportVersion, (N) => {
|
|
6664
|
+
q.writeToTeleport(I, N);
|
|
6665
6665
|
});
|
|
6666
6666
|
}), n.writeGuidField(e.CallIdFieldId, t.CallId), n.writeGuidField(e.InstanceIdFieldId, t.InstanceId);
|
|
6667
6667
|
}
|
|
@@ -6745,7 +6745,7 @@ var qe;
|
|
|
6745
6745
|
const n = [];
|
|
6746
6746
|
let u;
|
|
6747
6747
|
for (; (u = t.next()) !== null; )
|
|
6748
|
-
n.push(
|
|
6748
|
+
n.push(q.readFromTeleport(u.asObject()));
|
|
6749
6749
|
return n;
|
|
6750
6750
|
}
|
|
6751
6751
|
((t) => {
|
|
@@ -7513,7 +7513,7 @@ var Ce;
|
|
|
7513
7513
|
}
|
|
7514
7514
|
e.fromProtocolMessage = h;
|
|
7515
7515
|
})(Ce || (Ce = {}));
|
|
7516
|
-
var
|
|
7516
|
+
var q;
|
|
7517
7517
|
((e) => {
|
|
7518
7518
|
e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 760727997, e.EnumerationIdFieldId = 467348717, e.EnumerableItemTypeNameFieldId = 972460562, e.ValueJsonFieldId = 1911490601, e.IsEnumerableFieldId = 2603556958, e.TypeNameFieldId = 3609695522, e.ValueDataFieldId = 4094837378, e.ParameterIndexFieldId = 4257460908;
|
|
7519
7519
|
function l(o) {
|
|
@@ -7602,7 +7602,7 @@ var Z;
|
|
|
7602
7602
|
return a(t, r);
|
|
7603
7603
|
}
|
|
7604
7604
|
e.fromProtocolMessage = h;
|
|
7605
|
-
})(
|
|
7605
|
+
})(q || (q = {}));
|
|
7606
7606
|
var te;
|
|
7607
7607
|
((e) => {
|
|
7608
7608
|
e.TeleportVersion = 1, e.TeleportOpcode = 65549, e.TeleportLayoutHash = 4089149075;
|
|
@@ -11187,8 +11187,8 @@ var fo;
|
|
|
11187
11187
|
if (T == null)
|
|
11188
11188
|
continue;
|
|
11189
11189
|
const p = I.beginEntry();
|
|
11190
|
-
p.writeKeyString(b), p.writeValueObject(
|
|
11191
|
-
|
|
11190
|
+
p.writeKeyString(b), p.writeValueObject(B.TeleportVersion, (m) => {
|
|
11191
|
+
B.writeToTeleport(T, m);
|
|
11192
11192
|
}), p.complete();
|
|
11193
11193
|
}
|
|
11194
11194
|
}), u.writeStringField(e.StyleIdFieldId, n.StyleId), u.writeStringField(e.NameFieldId, n.Name), u.writeStringField(e.DescriptionFieldId, n.Description), u.writeInt32Field(e.ElementIdFieldId, n.ElementId | 0), u.writeArrayField(e.LabelsFieldId, C.String, (I) => {
|
|
@@ -11201,8 +11201,8 @@ var fo;
|
|
|
11201
11201
|
if (T == null)
|
|
11202
11202
|
continue;
|
|
11203
11203
|
const p = I.beginEntry();
|
|
11204
|
-
p.writeKeyString(b), p.writeValueObject(
|
|
11205
|
-
|
|
11204
|
+
p.writeKeyString(b), p.writeValueObject(he.TeleportVersion, (m) => {
|
|
11205
|
+
he.writeToTeleport(T, m);
|
|
11206
11206
|
}), p.complete();
|
|
11207
11207
|
}
|
|
11208
11208
|
});
|
|
@@ -11294,7 +11294,7 @@ var fo;
|
|
|
11294
11294
|
let I;
|
|
11295
11295
|
for (; (I = n.next()) !== null; ) {
|
|
11296
11296
|
const N = I.key.asString();
|
|
11297
|
-
u[N] =
|
|
11297
|
+
u[N] = B.readFromTeleport(I.value.asObject());
|
|
11298
11298
|
}
|
|
11299
11299
|
return u;
|
|
11300
11300
|
}
|
|
@@ -11303,7 +11303,7 @@ var fo;
|
|
|
11303
11303
|
let I;
|
|
11304
11304
|
for (; (I = n.next()) !== null; ) {
|
|
11305
11305
|
const N = I.key.asString();
|
|
11306
|
-
u[N] =
|
|
11306
|
+
u[N] = he.readFromTeleport(I.value.asObject());
|
|
11307
11307
|
}
|
|
11308
11308
|
return u;
|
|
11309
11309
|
}
|
|
@@ -12881,7 +12881,7 @@ var ko;
|
|
|
12881
12881
|
return t;
|
|
12882
12882
|
}
|
|
12883
12883
|
})(ko || (ko = {}));
|
|
12884
|
-
var
|
|
12884
|
+
var B;
|
|
12885
12885
|
((e) => {
|
|
12886
12886
|
e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 1537116481, e.ValueFieldId = 1405462580, e.MimeTypeFieldId = 2968276160;
|
|
12887
12887
|
function l(o) {
|
|
@@ -12940,7 +12940,7 @@ var q;
|
|
|
12940
12940
|
return a(t, r);
|
|
12941
12941
|
}
|
|
12942
12942
|
e.fromProtocolMessage = h;
|
|
12943
|
-
})(
|
|
12943
|
+
})(B || (B = {}));
|
|
12944
12944
|
var So;
|
|
12945
12945
|
((e) => {
|
|
12946
12946
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097181, e.TeleportLayoutHash = 393918750, e.PercentageFieldId = 117496938, e.StyleIdFieldId = 979822885, e.ElementIdFieldId = 1753055760, e.LabelsFieldId = 2329079073;
|
|
@@ -14099,8 +14099,8 @@ var Ro;
|
|
|
14099
14099
|
if (F == null)
|
|
14100
14100
|
continue;
|
|
14101
14101
|
const b = n.beginEntry();
|
|
14102
|
-
b.writeKeyString(N), b.writeValueObject(
|
|
14103
|
-
|
|
14102
|
+
b.writeKeyString(N), b.writeValueObject(B.TeleportVersion, (T) => {
|
|
14103
|
+
B.writeToTeleport(F, T);
|
|
14104
14104
|
}), b.complete();
|
|
14105
14105
|
}
|
|
14106
14106
|
});
|
|
@@ -14149,7 +14149,7 @@ var Ro;
|
|
|
14149
14149
|
let n;
|
|
14150
14150
|
for (; (n = r.next()) !== null; ) {
|
|
14151
14151
|
const u = n.key.asString();
|
|
14152
|
-
t[u] =
|
|
14152
|
+
t[u] = B.readFromTeleport(n.value.asObject());
|
|
14153
14153
|
}
|
|
14154
14154
|
return t;
|
|
14155
14155
|
}
|
|
@@ -14510,7 +14510,7 @@ var $o;
|
|
|
14510
14510
|
})($o || ($o = {}));
|
|
14511
14511
|
function Vn(e) {
|
|
14512
14512
|
return new Worker(
|
|
14513
|
-
"" + new URL("assets/protocol-worker-
|
|
14513
|
+
"" + new URL("assets/protocol-worker-DXLojSe-.js", import.meta.url).href,
|
|
14514
14514
|
{
|
|
14515
14515
|
type: "module",
|
|
14516
14516
|
name: e?.name
|
|
@@ -14600,7 +14600,7 @@ const jn = {
|
|
|
14600
14600
|
function Hn(e, l) {
|
|
14601
14601
|
return `[${e}] ${l}`;
|
|
14602
14602
|
}
|
|
14603
|
-
function
|
|
14603
|
+
function me(e, l, i, s) {
|
|
14604
14604
|
const d = (/* @__PURE__ */ new Date()).toISOString(), a = jn[e];
|
|
14605
14605
|
if (Oe && Oe({
|
|
14606
14606
|
timestamp: d,
|
|
@@ -14630,20 +14630,20 @@ function Fe(e, l, i, s) {
|
|
|
14630
14630
|
function z(e) {
|
|
14631
14631
|
return {
|
|
14632
14632
|
debug(l, ...i) {
|
|
14633
|
-
|
|
14633
|
+
me(0, e, l, i);
|
|
14634
14634
|
},
|
|
14635
14635
|
info(l, ...i) {
|
|
14636
|
-
|
|
14636
|
+
me(1, e, l, i);
|
|
14637
14637
|
},
|
|
14638
14638
|
warn(l, ...i) {
|
|
14639
|
-
|
|
14639
|
+
me(2, e, l, i);
|
|
14640
14640
|
},
|
|
14641
14641
|
error(l, ...i) {
|
|
14642
|
-
|
|
14642
|
+
me(3, e, l, i);
|
|
14643
14643
|
}
|
|
14644
14644
|
};
|
|
14645
14645
|
}
|
|
14646
|
-
const
|
|
14646
|
+
const be = z("WebSocketTransport"), xn = 1e4;
|
|
14647
14647
|
class Wn {
|
|
14648
14648
|
ws = null;
|
|
14649
14649
|
keepaliveTimeout = null;
|
|
@@ -14673,21 +14673,21 @@ class Wn {
|
|
|
14673
14673
|
this.ws.onopen = () => {
|
|
14674
14674
|
a = !0, clearTimeout(w), this.ws.send(i), this.resetKeepaliveTimeout(), c || (c = !0, s());
|
|
14675
14675
|
}, this.ws.onerror = () => {
|
|
14676
|
-
clearTimeout(w),
|
|
14676
|
+
clearTimeout(w), be.error("WebSocket error"), c || (c = !0, f(), d(new A("WebSocket connection failed")));
|
|
14677
14677
|
}, this.ws.onclose = (h) => {
|
|
14678
14678
|
if (this.clearKeepaliveTimeout(), !a && !c) {
|
|
14679
14679
|
c = !0, f(), d(new A("WebSocket connection closed before opening"));
|
|
14680
14680
|
return;
|
|
14681
14681
|
}
|
|
14682
|
-
const o = h.wasClean && (h.code === 1e3 || h.code === 1001), r = h.reason || `code=${h.code}`;
|
|
14683
|
-
this.callbacks.onClose(
|
|
14682
|
+
const o = h.wasClean && (h.code === 1e3 || h.code === 1001), r = h.code === 1e3 || h.code === 1001, t = h.reason || `code=${h.code}`;
|
|
14683
|
+
this.callbacks.onClose(t, o, r);
|
|
14684
14684
|
}, this.ws.onmessage = (h) => {
|
|
14685
14685
|
this.handleProtocolMessage(new Uint8Array(h.data));
|
|
14686
14686
|
};
|
|
14687
14687
|
});
|
|
14688
14688
|
}
|
|
14689
14689
|
send(l) {
|
|
14690
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(l) :
|
|
14690
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(l) : be.warn("Cannot send: WebSocket not connected");
|
|
14691
14691
|
}
|
|
14692
14692
|
close() {
|
|
14693
14693
|
this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -14701,12 +14701,12 @@ class Wn {
|
|
|
14701
14701
|
}
|
|
14702
14702
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(l);
|
|
14703
14703
|
} catch (i) {
|
|
14704
|
-
|
|
14704
|
+
be.error("Failed to process protocol message:", i), this.callbacks.onError(i instanceof Error ? i : new Error(String(i)));
|
|
14705
14705
|
}
|
|
14706
14706
|
}
|
|
14707
14707
|
resetKeepaliveTimeout() {
|
|
14708
14708
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
14709
|
-
|
|
14709
|
+
be.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new cr(this.keepaliveTimeoutMs)), this.close();
|
|
14710
14710
|
}, this.keepaliveTimeoutMs);
|
|
14711
14711
|
}
|
|
14712
14712
|
clearKeepaliveTimeout() {
|
|
@@ -14820,7 +14820,7 @@ class Rn {
|
|
|
14820
14820
|
* Handle connection close.
|
|
14821
14821
|
*/
|
|
14822
14822
|
handleClose(l, i) {
|
|
14823
|
-
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(l, i);
|
|
14823
|
+
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(l, i, i);
|
|
14824
14824
|
}
|
|
14825
14825
|
/**
|
|
14826
14826
|
* Reset the keepalive timeout.
|
|
@@ -14849,7 +14849,7 @@ class Rn {
|
|
|
14849
14849
|
}
|
|
14850
14850
|
}
|
|
14851
14851
|
}
|
|
14852
|
-
const
|
|
14852
|
+
const ce = z("Channel");
|
|
14853
14853
|
class Gn {
|
|
14854
14854
|
state = "disconnected";
|
|
14855
14855
|
transport = null;
|
|
@@ -14892,7 +14892,7 @@ class Gn {
|
|
|
14892
14892
|
try {
|
|
14893
14893
|
await this.connectTransport(), this.setState("connected");
|
|
14894
14894
|
} catch (l) {
|
|
14895
|
-
throw
|
|
14895
|
+
throw ce.error("Channel connection failed:", l), this.setState("disconnected"), l;
|
|
14896
14896
|
}
|
|
14897
14897
|
}
|
|
14898
14898
|
/**
|
|
@@ -14906,7 +14906,7 @@ class Gn {
|
|
|
14906
14906
|
*/
|
|
14907
14907
|
send(l) {
|
|
14908
14908
|
if (!this.transport?.isConnected) {
|
|
14909
|
-
|
|
14909
|
+
ce.warn("Cannot send: channel not connected");
|
|
14910
14910
|
return;
|
|
14911
14911
|
}
|
|
14912
14912
|
this.transport.send(l);
|
|
@@ -14920,7 +14920,7 @@ class Gn {
|
|
|
14920
14920
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
14921
14921
|
callbacks: {
|
|
14922
14922
|
onProtocolMessage: (s) => this.handleProtocolMessage(s),
|
|
14923
|
-
onClose: (s, d) => this.handleClose(s, d),
|
|
14923
|
+
onClose: (s, d, a) => this.handleClose(s, d, a),
|
|
14924
14924
|
onError: (s) => this.handleError(s)
|
|
14925
14925
|
}
|
|
14926
14926
|
};
|
|
@@ -14947,25 +14947,25 @@ class Gn {
|
|
|
14947
14947
|
try {
|
|
14948
14948
|
const i = l;
|
|
14949
14949
|
if (Ne(i) === j.CORE_ON_SERVER_STOPPING) {
|
|
14950
|
-
this.setState("stopped"), this.transport?.close();
|
|
14950
|
+
ce.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
14951
14951
|
return;
|
|
14952
14952
|
}
|
|
14953
14953
|
this.config.onProtocolMessage?.(i);
|
|
14954
14954
|
} catch (i) {
|
|
14955
|
-
|
|
14955
|
+
ce.error("Failed to handle protocol message:", i), this.config.onError?.(i instanceof Error ? i : new Error(String(i)));
|
|
14956
14956
|
}
|
|
14957
14957
|
}
|
|
14958
14958
|
/**
|
|
14959
14959
|
* Handle transport close.
|
|
14960
14960
|
*/
|
|
14961
|
-
handleClose(l, i) {
|
|
14962
|
-
this.transport = null, this.config.onClose?.(l, i);
|
|
14961
|
+
handleClose(l, i, s) {
|
|
14962
|
+
this.transport = null, this.config.onClose?.(l, i, s);
|
|
14963
14963
|
}
|
|
14964
14964
|
/**
|
|
14965
14965
|
* Handle transport error.
|
|
14966
14966
|
*/
|
|
14967
14967
|
handleError(l) {
|
|
14968
|
-
|
|
14968
|
+
ce.error("Channel error:", l), this.config.onError?.(l), l instanceof cr && this.handleClose("Keepalive timeout", !1);
|
|
14969
14969
|
}
|
|
14970
14970
|
/**
|
|
14971
14971
|
* Update and notify state change.
|
|
@@ -14974,7 +14974,7 @@ class Gn {
|
|
|
14974
14974
|
this.state !== l && (this.state = l, this.config.onStateChange?.(l));
|
|
14975
14975
|
}
|
|
14976
14976
|
}
|
|
14977
|
-
const
|
|
14977
|
+
const Z = z("ChannelManager");
|
|
14978
14978
|
class Kn {
|
|
14979
14979
|
channels = /* @__PURE__ */ new Map();
|
|
14980
14980
|
// keyed by opcode group
|
|
@@ -15025,7 +15025,7 @@ class Kn {
|
|
|
15025
15025
|
d.send(l);
|
|
15026
15026
|
return;
|
|
15027
15027
|
}
|
|
15028
|
-
|
|
15028
|
+
Z.warn("No channel found for message");
|
|
15029
15029
|
}
|
|
15030
15030
|
/**
|
|
15031
15031
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -15056,10 +15056,10 @@ class Kn {
|
|
|
15056
15056
|
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(d), this.config.onRememberWorkingType?.(d), this.activeType = d, this.reconnectAttempts = 0, this.setState("connected");
|
|
15057
15057
|
return;
|
|
15058
15058
|
} catch (c) {
|
|
15059
|
-
|
|
15059
|
+
Z.warn(`Failed to connect using ${K[d]}: ${c}`), this.disconnectAll();
|
|
15060
15060
|
}
|
|
15061
15061
|
}
|
|
15062
|
-
throw
|
|
15062
|
+
throw Z.error("All endpoint types failed"), l || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
15063
15063
|
}
|
|
15064
15064
|
/**
|
|
15065
15065
|
* Connect all channels for a given endpoint type in parallel.
|
|
@@ -15087,8 +15087,8 @@ class Kn {
|
|
|
15087
15087
|
onStateChange: (s) => {
|
|
15088
15088
|
this.handleChannelStateChange(l.OpcodeGroupsFromServer, s);
|
|
15089
15089
|
},
|
|
15090
|
-
onClose: (s, d) => {
|
|
15091
|
-
this.handleChannelClose(l.OpcodeGroupsFromServer, s, d);
|
|
15090
|
+
onClose: (s, d, a) => {
|
|
15091
|
+
this.handleChannelClose(l.OpcodeGroupsFromServer, s, d, a);
|
|
15092
15092
|
},
|
|
15093
15093
|
onError: (s) => {
|
|
15094
15094
|
this.config.onError?.(s);
|
|
@@ -15116,9 +15116,14 @@ class Kn {
|
|
|
15116
15116
|
/**
|
|
15117
15117
|
* Handle channel close.
|
|
15118
15118
|
*/
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15119
|
+
handleChannelClose(l, i, s, d) {
|
|
15120
|
+
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline")) {
|
|
15121
|
+
if (s || d) {
|
|
15122
|
+
Z.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
15123
|
+
return;
|
|
15124
|
+
}
|
|
15125
|
+
this.state === "connected" && (Z.error("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
15126
|
+
}
|
|
15122
15127
|
}
|
|
15123
15128
|
/**
|
|
15124
15129
|
* Attempt to reconnect with exponential backoff.
|
|
@@ -15127,16 +15132,16 @@ class Kn {
|
|
|
15127
15132
|
if (!this.shouldReconnect)
|
|
15128
15133
|
return;
|
|
15129
15134
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
15130
|
-
|
|
15135
|
+
Z.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Ln(this.config.maxReconnectAttempts));
|
|
15131
15136
|
return;
|
|
15132
15137
|
}
|
|
15133
15138
|
this.setState("reconnecting"), this.reconnectAttempts++;
|
|
15134
15139
|
const l = this.config.reconnectBackoffMs * Math.pow(2, this.reconnectAttempts - 1);
|
|
15135
|
-
if (
|
|
15140
|
+
if (Z.info(`Reconnecting in ${l}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await sn(l, this.abortController?.signal), !!this.shouldReconnect)
|
|
15136
15141
|
try {
|
|
15137
15142
|
await this.connectInternal(!0);
|
|
15138
15143
|
} catch (i) {
|
|
15139
|
-
|
|
15144
|
+
Z.error("Reconnect failed:", i), await this.attemptReconnect();
|
|
15140
15145
|
}
|
|
15141
15146
|
}
|
|
15142
15147
|
/**
|
|
@@ -15772,7 +15777,7 @@ function Ll(e, l) {
|
|
|
15772
15777
|
return !1;
|
|
15773
15778
|
}
|
|
15774
15779
|
}
|
|
15775
|
-
let
|
|
15780
|
+
let ue = null;
|
|
15776
15781
|
const Dl = {
|
|
15777
15782
|
name: "ikon.client.keepScreenAwake",
|
|
15778
15783
|
description: "Prevent or allow the screen to sleep",
|
|
@@ -15783,7 +15788,7 @@ async function vl(e) {
|
|
|
15783
15788
|
if (typeof navigator > "u" || !("wakeLock" in navigator))
|
|
15784
15789
|
return !1;
|
|
15785
15790
|
try {
|
|
15786
|
-
return !!e ?
|
|
15791
|
+
return !!e ? ue || (ue = await navigator.wakeLock.request("screen")) : ue && (await ue.release(), ue = null), !0;
|
|
15787
15792
|
} catch {
|
|
15788
15793
|
return !1;
|
|
15789
15794
|
}
|
|
@@ -15898,7 +15903,7 @@ function ve(e) {
|
|
|
15898
15903
|
};
|
|
15899
15904
|
}
|
|
15900
15905
|
}
|
|
15901
|
-
function
|
|
15906
|
+
function Te(e) {
|
|
15902
15907
|
switch (e.kind) {
|
|
15903
15908
|
case "boolean":
|
|
15904
15909
|
return "System.Boolean";
|
|
@@ -15907,9 +15912,9 @@ function pe(e) {
|
|
|
15907
15912
|
case "string":
|
|
15908
15913
|
return "System.String";
|
|
15909
15914
|
case "array":
|
|
15910
|
-
return `System.Collections.Generic.List\`1[${
|
|
15915
|
+
return `System.Collections.Generic.List\`1[${Te(e.element)}]`;
|
|
15911
15916
|
case "dictionary":
|
|
15912
|
-
return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${
|
|
15917
|
+
return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${Te(e.value)}]`;
|
|
15913
15918
|
default:
|
|
15914
15919
|
return e;
|
|
15915
15920
|
}
|
|
@@ -15951,7 +15956,7 @@ function Xl(e, l) {
|
|
|
15951
15956
|
Description: e.description ?? "",
|
|
15952
15957
|
LlmInlineResult: e.llmInlineResult ?? !1,
|
|
15953
15958
|
LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
|
|
15954
|
-
ResultTypeName:
|
|
15959
|
+
ResultTypeName: Te(s),
|
|
15955
15960
|
IsEnumerable: !1,
|
|
15956
15961
|
EnumerableItemTypeName: "",
|
|
15957
15962
|
IsCancellable: !1,
|
|
@@ -15959,7 +15964,7 @@ function Xl(e, l) {
|
|
|
15959
15964
|
Parameters: i.map((a, c) => ({
|
|
15960
15965
|
ParameterIndex: c,
|
|
15961
15966
|
ParameterName: a.name,
|
|
15962
|
-
TypeName:
|
|
15967
|
+
TypeName: Te(a.descriptor),
|
|
15963
15968
|
HasDefaultValue: a.hasDefaultValue,
|
|
15964
15969
|
DefaultValueJson: a.defaultValueJson,
|
|
15965
15970
|
DefaultValueData: Yl,
|
|
@@ -16112,7 +16117,7 @@ class ql {
|
|
|
16112
16117
|
Ce.create({
|
|
16113
16118
|
CallId: l,
|
|
16114
16119
|
InstanceId: i,
|
|
16115
|
-
ResultTypeName:
|
|
16120
|
+
ResultTypeName: Te(d.returnType),
|
|
16116
16121
|
ResultJson: a,
|
|
16117
16122
|
ResultData: c
|
|
16118
16123
|
}),
|
|
@@ -16260,8 +16265,8 @@ const x = z("IkonAudioPlayback"), li = () => {
|
|
|
16260
16265
|
}, Je = {
|
|
16261
16266
|
enabled: !1,
|
|
16262
16267
|
statusInterval: 5
|
|
16263
|
-
},
|
|
16264
|
-
function
|
|
16268
|
+
}, fe = 48e3, J = 2, si = 2, en = 512;
|
|
16269
|
+
function we(e) {
|
|
16265
16270
|
return e instanceof Error ? `${e.name}: ${e.message}` : String(e);
|
|
16266
16271
|
}
|
|
16267
16272
|
function di(e) {
|
|
@@ -16861,7 +16866,7 @@ class Ir {
|
|
|
16861
16866
|
/** Timeout for AudioContext.resume() - normally resolves instantly, but some browsers hang indefinitely */
|
|
16862
16867
|
static RESUME_TIMEOUT_MS = 100;
|
|
16863
16868
|
audioContext = null;
|
|
16864
|
-
outputSampleRateHz =
|
|
16869
|
+
outputSampleRateHz = fe;
|
|
16865
16870
|
audioWorkletNode = null;
|
|
16866
16871
|
scriptProcessorNode = null;
|
|
16867
16872
|
scriptDiagnosticsTimer = null;
|
|
@@ -16934,17 +16939,17 @@ class Ir {
|
|
|
16934
16939
|
return;
|
|
16935
16940
|
if (!this.audioContext) {
|
|
16936
16941
|
try {
|
|
16937
|
-
this.audioContext = new AudioContext({ sampleRate:
|
|
16942
|
+
this.audioContext = new AudioContext({ sampleRate: fe });
|
|
16938
16943
|
} catch (f) {
|
|
16939
16944
|
try {
|
|
16940
16945
|
this.audioContext = new AudioContext();
|
|
16941
16946
|
} catch (w) {
|
|
16942
|
-
x.warn(`Failed to create AudioContext: ${
|
|
16947
|
+
x.warn(`Failed to create AudioContext: ${we(w)}`), this.audioContext = null;
|
|
16943
16948
|
return;
|
|
16944
16949
|
}
|
|
16945
|
-
x.debug(`AudioContext sample rate request unsupported: ${
|
|
16950
|
+
x.debug(`AudioContext sample rate request unsupported: ${we(f)}`);
|
|
16946
16951
|
}
|
|
16947
|
-
this.outputSampleRateHz = this.audioContext.sampleRate ||
|
|
16952
|
+
this.outputSampleRateHz = this.audioContext.sampleRate || fe, this.outputSampleRateHz !== fe && x.debug(`AudioContext running at ${this.outputSampleRateHz}Hz (requested ${fe}Hz)`), this.attachAudioContextHealthHandlers(this.audioContext);
|
|
16948
16953
|
}
|
|
16949
16954
|
const s = this.audioContext, d = this.resolveOutputConfig();
|
|
16950
16955
|
if ((this.config.threading?.preferAudioWorklet ?? !0) && mn(s)) {
|
|
@@ -17042,7 +17047,7 @@ class Ir {
|
|
|
17042
17047
|
);
|
|
17043
17048
|
}
|
|
17044
17049
|
this.workletReady || (this.workletReady = l.audioWorklet.addModule(this.workletModuleUrl).catch((h) => {
|
|
17045
|
-
throw x.warn(`Failed to load AudioWorklet module, falling back: ${
|
|
17050
|
+
throw x.warn(`Failed to load AudioWorklet module, falling back: ${we(h)}`), h;
|
|
17046
17051
|
}));
|
|
17047
17052
|
try {
|
|
17048
17053
|
await this.workletReady;
|
|
@@ -17187,7 +17192,7 @@ class Ir {
|
|
|
17187
17192
|
try {
|
|
17188
17193
|
await this.resumeWithTimeout(l), this.removeUnlockHandler();
|
|
17189
17194
|
} catch (c) {
|
|
17190
|
-
x.warn(`Failed to resume AudioContext: ${
|
|
17195
|
+
x.warn(`Failed to resume AudioContext: ${we(c)}`), this.addUnlockHandler();
|
|
17191
17196
|
}
|
|
17192
17197
|
}
|
|
17193
17198
|
async recoverAudioContext(l) {
|
|
@@ -17280,7 +17285,7 @@ class Ir {
|
|
|
17280
17285
|
try {
|
|
17281
17286
|
this.audioWorker = new ni();
|
|
17282
17287
|
} catch (r) {
|
|
17283
|
-
x.warn(`Failed to create audio worker: ${
|
|
17288
|
+
x.warn(`Failed to create audio worker: ${we(r)}`), this.protocolPort.close(), this.protocolPort = null;
|
|
17284
17289
|
return;
|
|
17285
17290
|
}
|
|
17286
17291
|
const i = this.audioWorker;
|
|
@@ -18606,10 +18611,7 @@ class Ji {
|
|
|
18606
18611
|
const i = new MessageChannel(), s = i.port2, d = i.port1;
|
|
18607
18612
|
if (this.protocolWorker) {
|
|
18608
18613
|
const c = this.nextProtocolSendPortId++;
|
|
18609
|
-
return this.protocolWorker.postMessage(
|
|
18610
|
-
{ type: "attachSendPort", portId: c, port: d, opcodeGroupsMask: l.opcodeGroupsMask },
|
|
18611
|
-
[d]
|
|
18612
|
-
), {
|
|
18614
|
+
return this.protocolWorker.postMessage({ type: "attachSendPort", portId: c, port: d, opcodeGroupsMask: l.opcodeGroupsMask }, [d]), {
|
|
18613
18615
|
port: s,
|
|
18614
18616
|
close: () => {
|
|
18615
18617
|
try {
|
|
@@ -18738,7 +18740,7 @@ class Ji {
|
|
|
18738
18740
|
this.currentState === "connected" && this.setState("reconnecting");
|
|
18739
18741
|
break;
|
|
18740
18742
|
case "stopped":
|
|
18741
|
-
v.info("Ikon server
|
|
18743
|
+
v.info("Ikon server has stopped"), this.clearTimers(), this.setState("offline");
|
|
18742
18744
|
break;
|
|
18743
18745
|
case "offline":
|
|
18744
18746
|
this.currentState !== "idle" && (this.clearTimers(), this.setState("offline"));
|