@ikonai/sdk 0.0.21 → 0.0.22

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.
@@ -7,7 +7,7 @@ function Ie(e) {
7
7
  return Fl(e) & 4294901760;
8
8
  }
9
9
  function Fe(e) {
10
- const d = ie(e), n = new DataView(d.buffer, d.byteOffset, d.byteLength);
10
+ const d = se(e), n = new DataView(d.buffer, d.byteOffset, d.byteLength);
11
11
  if (d.length < 27)
12
12
  throw new Error("Protocol payload too short");
13
13
  const i = n.getUint32(0, !0), s = n.getUint32(4, !0), a = n.getUint32(8, !0), c = n.getUint32(12, !0), w = n.getUint32(16, !0), f = n.getUint32(20, !0), I = n.getUint8(24), l = n.getUint8(25), r = n.getUint8(26);
@@ -30,7 +30,7 @@ function Fe(e) {
30
30
  };
31
31
  }
32
32
  function M(e, d, n) {
33
- const i = ie(e), s = Fe(i);
33
+ const i = se(e), s = Fe(i);
34
34
  if (d !== void 0 && s.opcode !== d)
35
35
  throw new Error(`Unexpected opcode ${s.opcode}`);
36
36
  if (n !== void 0 && s.payloadVersion !== n)
@@ -54,7 +54,7 @@ class y {
54
54
  constructor(d = 1) {
55
55
  this.version = d, this.buffer.writeByte(Tl), this.buffer.writeVarUInt(d >>> 0);
56
56
  }
57
- buffer = new de();
57
+ buffer = new ne();
58
58
  closed = !1;
59
59
  cached;
60
60
  writeInt32Field(d, n) {
@@ -126,7 +126,7 @@ class Te {
126
126
  constructor(d) {
127
127
  this.elementType = d;
128
128
  }
129
- payload = new de();
129
+ payload = new ne();
130
130
  count = 0;
131
131
  writeInt32(d) {
132
132
  this.ensureElementType(
@@ -225,7 +225,7 @@ class Te {
225
225
  this.payload.writeBytes(a);
226
226
  }
227
227
  finish() {
228
- const d = new de();
228
+ const d = new ne();
229
229
  return d.writeByte(we(this.elementType)), d.writeVarUInt(this.count), d.writeBytes(this.payload.toUint8Array()), d.toUint8Array();
230
230
  }
231
231
  ensureElementType(d) {
@@ -237,7 +237,7 @@ class me {
237
237
  constructor(d, n) {
238
238
  this.keyType = d, this.valueType = n, Me(d);
239
239
  }
240
- payload = new de();
240
+ payload = new ne();
241
241
  count = 0;
242
242
  entryOpen = !1;
243
243
  beginEntry() {
@@ -250,7 +250,7 @@ class me {
250
250
  finish() {
251
251
  if (this.entryOpen)
252
252
  throw new Error("Dictionary entry not completed");
253
- const d = new de();
253
+ const d = new ne();
254
254
  return d.writeByte(we(this.keyType)), d.writeByte(we(this.valueType)), d.writeVarUInt(this.count), d.writeBytes(this.payload.toUint8Array()), d.toUint8Array();
255
255
  }
256
256
  }
@@ -452,7 +452,7 @@ class m {
452
452
  offset;
453
453
  end;
454
454
  static create(d) {
455
- const n = ie(d);
455
+ const n = se(d);
456
456
  if (n.length < 2)
457
457
  throw new Error("Teleport payload too short");
458
458
  if (n[0] !== Tl || n[n.length - 1] !== hl)
@@ -598,7 +598,7 @@ class Ne {
598
598
  this.count = G(d, i, "ArrayMalformed"), this.offset = i.offset;
599
599
  }
600
600
  static create(d) {
601
- return new Ne(ie(d));
601
+ return new Ne(se(d));
602
602
  }
603
603
  next() {
604
604
  if (this.index >= this.count) {
@@ -672,7 +672,7 @@ class Ee {
672
672
  this.count = G(d, n, "DictMalformed"), this.offset = n.offset;
673
673
  }
674
674
  static create(d) {
675
- return new Ee(ie(d));
675
+ return new Ee(se(d));
676
676
  }
677
677
  next() {
678
678
  if (this.index >= this.count) {
@@ -815,7 +815,7 @@ class D {
815
815
  return (d >>> 0).toString(16).padStart(n, "0");
816
816
  }
817
817
  }
818
- class de {
818
+ class ne {
819
819
  bytes = [];
820
820
  writeByte(d) {
821
821
  this.bytes.push(d & 255);
@@ -968,10 +968,10 @@ function pe(e, d, n, i) {
968
968
  function ke(e) {
969
969
  return Array.from(e).map((d) => d.toString(16).padStart(2, "0")).join("");
970
970
  }
971
- function ie(e) {
971
+ function se(e) {
972
972
  return e instanceof Uint8Array ? e : new Uint8Array(e);
973
973
  }
974
- var le;
974
+ var te;
975
975
  ((e) => {
976
976
  e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 213871793, e.ActionIdFieldId = 727023925, e.DescriptionFieldId = 1368629611;
977
977
  function d(l) {
@@ -1030,7 +1030,7 @@ var le;
1030
1030
  return a(o, r);
1031
1031
  }
1032
1032
  e.fromProtocolMessage = I;
1033
- })(le || (le = {}));
1033
+ })(te || (te = {}));
1034
1034
  var ge;
1035
1035
  ((e) => {
1036
1036
  e.TeleportVersion = 2, e.TeleportOpcode = 1048578, e.TeleportLayoutHash = 2972842713, e.DescriptionFieldId = 1368629611, e.IsFinishedFieldId = 4172191587;
@@ -1810,7 +1810,7 @@ var Je;
1810
1810
  }
1811
1811
  e.fromProtocolMessage = I;
1812
1812
  })(Je || (Je = {}));
1813
- var Ke;
1813
+ var ve;
1814
1814
  ((e) => {
1815
1815
  e.TeleportVersion = 1, e.TeleportOpcode = 1048622, e.TeleportLayoutHash = 4089149075;
1816
1816
  function d(l) {
@@ -1854,8 +1854,8 @@ var Ke;
1854
1854
  return a(o, r);
1855
1855
  }
1856
1856
  e.fromProtocolMessage = I;
1857
- })(Ke || (Ke = {}));
1858
- var ve;
1857
+ })(ve || (ve = {}));
1858
+ var Ke;
1859
1859
  ((e) => {
1860
1860
  e.TeleportVersion = 1, e.TeleportOpcode = 1048588, e.TeleportLayoutHash = 1782036768, e.ActionIdFieldId = 727023925, e.SequenceIdFieldId = 3442222250;
1861
1861
  function d(l) {
@@ -1914,7 +1914,7 @@ var ve;
1914
1914
  return a(o, r);
1915
1915
  }
1916
1916
  e.fromProtocolMessage = I;
1917
- })(ve || (ve = {}));
1917
+ })(Ke || (Ke = {}));
1918
1918
  var We;
1919
1919
  ((e) => {
1920
1920
  e.TeleportVersion = 1, e.TeleportOpcode = 1048586, e.TeleportLayoutHash = 1094216080, e.FileNameFieldId = 330663152, e.HashFieldId = 377324326, e.ActionIdFieldId = 727023925, e.CheckHashFieldId = 2495084284, e.MimeFieldId = 2697635005, e.ByteCountFieldId = 3499993226;
@@ -2440,8 +2440,8 @@ var qe;
2440
2440
  function p(F, b) {
2441
2441
  b.writeInt32Field(r.CallIndexFieldId, F.CallIndex | 0), b.writeStringField(r.FunctionNameFieldId, F.FunctionName), b.writeArrayField(r.ParametersFieldId, g.Object, (k) => {
2442
2442
  for (const C of F.Parameters)
2443
- k.writeObject(W.TeleportVersion, (S) => {
2444
- W.writeToTeleport(C, S);
2443
+ k.writeObject(z.TeleportVersion, (S) => {
2444
+ z.writeToTeleport(C, S);
2445
2445
  });
2446
2446
  });
2447
2447
  }
@@ -2484,7 +2484,7 @@ var qe;
2484
2484
  const b = [];
2485
2485
  let k;
2486
2486
  for (; (k = F.next()) !== null; )
2487
- b.push(W.readFromTeleport(k.asObject()));
2487
+ b.push(z.readFromTeleport(k.asObject()));
2488
2488
  return b;
2489
2489
  }
2490
2490
  })(e.ActionOptimisticClientCall || (e.ActionOptimisticClientCall = {}));
@@ -5404,8 +5404,8 @@ var jr;
5404
5404
  function s(o, t) {
5405
5405
  t.writeStringField(e.CertHashFieldId, o.CertHash), t.writeArrayField(e.EntrypointsFieldId, g.Object, (u) => {
5406
5406
  for (const p of o.Entrypoints)
5407
- u.writeObject(te.TeleportVersion, (P) => {
5408
- te.writeToTeleport(p, P);
5407
+ u.writeObject(de.TeleportVersion, (P) => {
5408
+ de.writeToTeleport(p, P);
5409
5409
  });
5410
5410
  }), t.writeStringField(e.ChannelIdFieldId, o.ChannelId), t.writeObjectField(e.ClientContextFieldId, L.TeleportVersion, (u) => {
5411
5411
  L.writeToTeleport(o.ClientContext, u);
@@ -5507,7 +5507,7 @@ var jr;
5507
5507
  const t = [];
5508
5508
  let u;
5509
5509
  for (; (u = o.next()) !== null; )
5510
- t.push(te.readFromTeleport(u.asObject()));
5510
+ t.push(de.readFromTeleport(u.asObject()));
5511
5511
  return t;
5512
5512
  }
5513
5513
  function r(o) {
@@ -5882,7 +5882,7 @@ var xr;
5882
5882
  return o;
5883
5883
  }
5884
5884
  })(xr || (xr = {}));
5885
- var te;
5885
+ var de;
5886
5886
  ((e) => {
5887
5887
  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;
5888
5888
  function d(l) {
@@ -5971,7 +5971,7 @@ var te;
5971
5971
  return a(o, r);
5972
5972
  }
5973
5973
  e.fromProtocolMessage = I;
5974
- })(te || (te = {}));
5974
+ })(de || (de = {}));
5975
5975
  var L;
5976
5976
  ((e) => {
5977
5977
  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;
@@ -6227,7 +6227,7 @@ var $ = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.WebSocket = 1] = "W
6227
6227
  }
6228
6228
  e.fromProtocolMessage = I;
6229
6229
  })(Jr || (Jr = {}));
6230
- var Kr;
6230
+ var vr;
6231
6231
  ((e) => {
6232
6232
  e.TeleportVersion = 1, e.TeleportOpcode = 262145, e.TeleportLayoutHash = 625383550, e.UserIdFieldId = 781727218, e.ValuesAsJsonFieldId = 4097414582;
6233
6233
  function d(l) {
@@ -6286,8 +6286,8 @@ var Kr;
6286
6286
  return a(o, r);
6287
6287
  }
6288
6288
  e.fromProtocolMessage = I;
6289
- })(Kr || (Kr = {}));
6290
- var vr;
6289
+ })(vr || (vr = {}));
6290
+ var Kr;
6291
6291
  ((e) => {
6292
6292
  e.TeleportVersion = 1, e.TeleportOpcode = 262147, e.TeleportLayoutHash = 4089149075;
6293
6293
  function d(l) {
@@ -6331,7 +6331,7 @@ var vr;
6331
6331
  return a(o, r);
6332
6332
  }
6333
6333
  e.fromProtocolMessage = I;
6334
- })(vr || (vr = {}));
6334
+ })(Kr || (Kr = {}));
6335
6335
  var Wr;
6336
6336
  ((e) => {
6337
6337
  e.TeleportVersion = 1, e.TeleportOpcode = 1048632, e.TeleportLayoutHash = 1508754766, e.CallIdFieldId = 3748161056, e.InstanceIdFieldId = 4289118421;
@@ -6657,8 +6657,8 @@ var Xr;
6657
6657
  });
6658
6658
  }), t.writeStringField(e.FunctionNameFieldId, o.FunctionName), t.writeGuidField(e.FunctionIdFieldId, o.FunctionId), t.writeStringField(e.ClientBackendTokenFieldId, o.ClientBackendToken), t.writeArrayField(e.ParametersFieldId, g.Object, (u) => {
6659
6659
  for (const p of o.Parameters)
6660
- u.writeObject(W.TeleportVersion, (P) => {
6661
- W.writeToTeleport(p, P);
6660
+ u.writeObject(z.TeleportVersion, (P) => {
6661
+ z.writeToTeleport(p, P);
6662
6662
  });
6663
6663
  }), t.writeGuidField(e.CallIdFieldId, o.CallId), t.writeGuidField(e.InstanceIdFieldId, o.InstanceId);
6664
6664
  }
@@ -6742,7 +6742,7 @@ var Xr;
6742
6742
  const t = [];
6743
6743
  let u;
6744
6744
  for (; (u = o.next()) !== null; )
6745
- t.push(W.readFromTeleport(u.asObject()));
6745
+ t.push(z.readFromTeleport(u.asObject()));
6746
6746
  return t;
6747
6747
  }
6748
6748
  ((o) => {
@@ -7149,7 +7149,7 @@ var Br;
7149
7149
  }
7150
7150
  e.fromProtocolMessage = I;
7151
7151
  })(Br || (Br = {}));
7152
- var v;
7152
+ var W;
7153
7153
  ((e) => {
7154
7154
  e.TeleportVersion = 1, e.TeleportOpcode = 1048600, e.TeleportLayoutHash = 3557470753, e.ResultTypeNameFieldId = 703025676, e.FunctionNameFieldId = 814454131, e.EnumerableItemTypeNameFieldId = 972460562, e.FunctionIdFieldId = 976255570, e.DescriptionFieldId = 1368629611, e.IsCancellableFieldId = 1479280922, e.RequiresInstanceFieldId = 1533537016, e.LlmInlineResultFieldId = 2274386296, e.IsEnumerableFieldId = 2603556958, e.ParametersFieldId = 2885165957, e.LlmCallOnlyOnceFieldId = 3568439632;
7155
7155
  function d(r) {
@@ -7365,7 +7365,7 @@ var v;
7365
7365
  }
7366
7366
  }
7367
7367
  })(e.FunctionRegisterParameter || (e.FunctionRegisterParameter = {}));
7368
- })(v || (v = {}));
7368
+ })(W || (W = {}));
7369
7369
  var Ar;
7370
7370
  ((e) => {
7371
7371
  e.TeleportVersion = 1, e.TeleportOpcode = 1048638, e.TeleportLayoutHash = 1547364789, e.FunctionsFieldId = 3678477544;
@@ -7386,8 +7386,8 @@ var Ar;
7386
7386
  function s(r, o) {
7387
7387
  o.writeArrayField(e.FunctionsFieldId, g.Object, (t) => {
7388
7388
  for (const u of r.Functions)
7389
- t.writeObject(v.TeleportVersion, (p) => {
7390
- v.writeToTeleport(u, p);
7389
+ t.writeObject(W.TeleportVersion, (p) => {
7390
+ W.writeToTeleport(u, p);
7391
7391
  });
7392
7392
  });
7393
7393
  }
@@ -7428,7 +7428,7 @@ var Ar;
7428
7428
  const o = [];
7429
7429
  let t;
7430
7430
  for (; (t = r.next()) !== null; )
7431
- o.push(v.readFromTeleport(t.asObject()));
7431
+ o.push(W.readFromTeleport(t.asObject()));
7432
7432
  return o;
7433
7433
  }
7434
7434
  })(Ar || (Ar = {}));
@@ -7510,7 +7510,7 @@ var Ur;
7510
7510
  }
7511
7511
  e.fromProtocolMessage = I;
7512
7512
  })(Ur || (Ur = {}));
7513
- var W;
7513
+ var z;
7514
7514
  ((e) => {
7515
7515
  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;
7516
7516
  function d(l) {
@@ -7599,7 +7599,7 @@ var W;
7599
7599
  return a(o, r);
7600
7600
  }
7601
7601
  e.fromProtocolMessage = I;
7602
- })(W || (W = {}));
7602
+ })(z || (z = {}));
7603
7603
  var eo;
7604
7604
  ((e) => {
7605
7605
  e.TeleportVersion = 1, e.TeleportOpcode = 65549, e.TeleportLayoutHash = 4089149075;
@@ -7694,8 +7694,8 @@ var ro;
7694
7694
  const S = T.beginEntry();
7695
7695
  S.writeKeyInt32(k | 0), S.writeValueArray(g.Object, (E) => {
7696
7696
  for (const O of C)
7697
- E.writeObject(v.TeleportVersion, (_) => {
7698
- v.writeToTeleport(O, _);
7697
+ E.writeObject(W.TeleportVersion, (_) => {
7698
+ W.writeToTeleport(O, _);
7699
7699
  });
7700
7700
  }), S.complete();
7701
7701
  }
@@ -7915,7 +7915,7 @@ var ro;
7915
7915
  const N = [];
7916
7916
  let T;
7917
7917
  for (; (T = h.next()) !== null; )
7918
- N.push(v.readFromTeleport(T.asObject()));
7918
+ N.push(W.readFromTeleport(T.asObject()));
7919
7919
  return N;
7920
7920
  }
7921
7921
  ((h) => {
@@ -11184,8 +11184,8 @@ var Do;
11184
11184
  if (T == null)
11185
11185
  continue;
11186
11186
  const F = p.beginEntry();
11187
- F.writeKeyString(N), F.writeValueObject(z.TeleportVersion, (b) => {
11188
- z.writeToTeleport(T, b);
11187
+ F.writeKeyString(N), F.writeValueObject(Y.TeleportVersion, (b) => {
11188
+ Y.writeToTeleport(T, b);
11189
11189
  }), F.complete();
11190
11190
  }
11191
11191
  }), u.writeStringField(e.StyleIdFieldId, t.StyleId), u.writeStringField(e.NameFieldId, t.Name), u.writeStringField(e.DescriptionFieldId, t.Description), u.writeInt32Field(e.ElementIdFieldId, t.ElementId | 0), u.writeArrayField(e.LabelsFieldId, g.String, (p) => {
@@ -11198,8 +11198,8 @@ var Do;
11198
11198
  if (T == null)
11199
11199
  continue;
11200
11200
  const F = p.beginEntry();
11201
- F.writeKeyString(N), F.writeValueObject(le.TeleportVersion, (b) => {
11202
- le.writeToTeleport(T, b);
11201
+ F.writeKeyString(N), F.writeValueObject(te.TeleportVersion, (b) => {
11202
+ te.writeToTeleport(T, b);
11203
11203
  }), F.complete();
11204
11204
  }
11205
11205
  });
@@ -11291,7 +11291,7 @@ var Do;
11291
11291
  let p;
11292
11292
  for (; (p = t.next()) !== null; ) {
11293
11293
  const P = p.key.asString();
11294
- u[P] = z.readFromTeleport(p.value.asObject());
11294
+ u[P] = Y.readFromTeleport(p.value.asObject());
11295
11295
  }
11296
11296
  return u;
11297
11297
  }
@@ -11300,7 +11300,7 @@ var Do;
11300
11300
  let p;
11301
11301
  for (; (p = t.next()) !== null; ) {
11302
11302
  const P = p.key.asString();
11303
- u[P] = le.readFromTeleport(p.value.asObject());
11303
+ u[P] = te.readFromTeleport(p.value.asObject());
11304
11304
  }
11305
11305
  return u;
11306
11306
  }
@@ -11849,7 +11849,7 @@ var Jo;
11849
11849
  return o;
11850
11850
  }
11851
11851
  })(Jo || (Jo = {}));
11852
- var Ko;
11852
+ var vo;
11853
11853
  ((e) => {
11854
11854
  e.TeleportVersion = 1, e.TeleportOpcode = 2097166, e.TeleportLayoutHash = 3055446470, e.IconFieldId = 59431001, e.DropActionIdFieldId = 125663982, e.DragOverActionIdFieldId = 397939120, e.DragEndActionIdFieldId = 604708310, e.DragLeaveActionIdFieldId = 807214320, e.StyleIdFieldId = 979822885, e.PressStartActionIdFieldId = 1115189793, e.PressChangeActionIdFieldId = 1297223534, e.PressEndActionIdFieldId = 1604349297, e.ColorFieldId = 1668824531, e.ElementIdFieldId = 1753055760, e.DragStartActionIdFieldId = 2069639306, e.LabelsFieldId = 2329079073, e.ClickActionIdFieldId = 2904763197, e.DragEnterActionIdFieldId = 3852067844, e.PressUpActionIdFieldId = 4113077146;
11855
11855
  function d(r) {
@@ -12002,8 +12002,8 @@ var Ko;
12002
12002
  o.push(t.asString());
12003
12003
  return o;
12004
12004
  }
12005
- })(Ko || (Ko = {}));
12006
- var vo;
12005
+ })(vo || (vo = {}));
12006
+ var Ko;
12007
12007
  ((e) => {
12008
12008
  e.TeleportVersion = 1, e.TeleportOpcode = 2097167, e.TeleportLayoutHash = 902326874, e.DropActionIdFieldId = 125663982, e.DragOverActionIdFieldId = 397939120, e.DragEndActionIdFieldId = 604708310, e.DragLeaveActionIdFieldId = 807214320, e.StyleIdFieldId = 979822885, e.NameFieldId = 1107713536, e.PressStartActionIdFieldId = 1115189793, e.PressChangeActionIdFieldId = 1297223534, e.PressEndActionIdFieldId = 1604349297, e.ElementIdFieldId = 1753055760, e.DragStartActionIdFieldId = 2069639306, e.LabelsFieldId = 2329079073, e.UrlFieldId = 2643541312, e.MimeFieldId = 2697635005, e.ClickActionIdFieldId = 2904763197, e.DataFieldId = 2986785889, e.DragEnterActionIdFieldId = 3852067844, e.PressUpActionIdFieldId = 4113077146;
12009
12009
  function d(r) {
@@ -12168,7 +12168,7 @@ var vo;
12168
12168
  o.push(t.asString());
12169
12169
  return o;
12170
12170
  }
12171
- })(vo || (vo = {}));
12171
+ })(Ko || (Ko = {}));
12172
12172
  var Wo;
12173
12173
  ((e) => {
12174
12174
  e.TeleportVersion = 1, e.TeleportOpcode = 2097191, e.TeleportLayoutHash = 2491188219, e.ModulesFieldId = 2824693793;
@@ -12878,7 +12878,7 @@ var Qo;
12878
12878
  return o;
12879
12879
  }
12880
12880
  })(Qo || (Qo = {}));
12881
- var z;
12881
+ var Y;
12882
12882
  ((e) => {
12883
12883
  e.TeleportVersion = 1, e.TeleportOpcode = 0, e.TeleportLayoutHash = 1537116481, e.ValueFieldId = 1405462580, e.MimeTypeFieldId = 2968276160;
12884
12884
  function d(l) {
@@ -12937,7 +12937,7 @@ var z;
12937
12937
  return a(o, r);
12938
12938
  }
12939
12939
  e.fromProtocolMessage = I;
12940
- })(z || (z = {}));
12940
+ })(Y || (Y = {}));
12941
12941
  var qo;
12942
12942
  ((e) => {
12943
12943
  e.TeleportVersion = 1, e.TeleportOpcode = 2097181, e.TeleportLayoutHash = 393918750, e.PercentageFieldId = 117496938, e.StyleIdFieldId = 979822885, e.ElementIdFieldId = 1753055760, e.LabelsFieldId = 2329079073;
@@ -14096,8 +14096,8 @@ var sl;
14096
14096
  if (h == null)
14097
14097
  continue;
14098
14098
  const N = t.beginEntry();
14099
- N.writeKeyString(P), N.writeValueObject(z.TeleportVersion, (T) => {
14100
- z.writeToTeleport(h, T);
14099
+ N.writeKeyString(P), N.writeValueObject(Y.TeleportVersion, (T) => {
14100
+ Y.writeToTeleport(h, T);
14101
14101
  }), N.complete();
14102
14102
  }
14103
14103
  });
@@ -14146,7 +14146,7 @@ var sl;
14146
14146
  let t;
14147
14147
  for (; (t = r.next()) !== null; ) {
14148
14148
  const u = t.key.asString();
14149
- o[u] = z.readFromTeleport(t.value.asObject());
14149
+ o[u] = Y.readFromTeleport(t.value.asObject());
14150
14150
  }
14151
14151
  return o;
14152
14152
  }
@@ -14543,7 +14543,7 @@ let _l = 1;
14543
14543
  function Cl(e, d) {
14544
14544
  return `[${e}] ${d}`;
14545
14545
  }
14546
- function ae(e, d, n, i) {
14546
+ function ce(e, d, n, i) {
14547
14547
  if ((/* @__PURE__ */ new Date()).toISOString(), _l <= e) {
14548
14548
  const s = Cl(d, n);
14549
14549
  switch (e) {
@@ -14562,23 +14562,23 @@ function ae(e, d, n, i) {
14562
14562
  }
14563
14563
  }
14564
14564
  }
14565
- function se(e) {
14565
+ function ae(e) {
14566
14566
  return {
14567
14567
  debug(d, ...n) {
14568
- ae(0, e, d, n);
14568
+ ce(0, e, d, n);
14569
14569
  },
14570
14570
  info(d, ...n) {
14571
- ae(1, e, d, n);
14571
+ ce(1, e, d, n);
14572
14572
  },
14573
14573
  warn(d, ...n) {
14574
- ae(2, e, d, n);
14574
+ ce(2, e, d, n);
14575
14575
  },
14576
14576
  error(d, ...n) {
14577
- ae(3, e, d, n);
14577
+ ce(3, e, d, n);
14578
14578
  }
14579
14579
  };
14580
14580
  }
14581
- const ce = se("WebSocketTransport"), Ll = 1e4;
14581
+ const ue = ae("WebSocketTransport"), Ll = 1e4;
14582
14582
  class Dl {
14583
14583
  ws = null;
14584
14584
  keepaliveTimeout = null;
@@ -14608,21 +14608,21 @@ class Dl {
14608
14608
  this.ws.onopen = () => {
14609
14609
  a = !0, clearTimeout(f), this.ws.send(n), this.resetKeepaliveTimeout(), c || (c = !0, i());
14610
14610
  }, this.ws.onerror = () => {
14611
- clearTimeout(f), ce.error("WebSocket error"), c || (c = !0, w(), s(new Q("WebSocket connection failed")));
14611
+ clearTimeout(f), ue.error("WebSocket error"), c || (c = !0, w(), s(new Q("WebSocket connection failed")));
14612
14612
  }, this.ws.onclose = (I) => {
14613
14613
  if (this.clearKeepaliveTimeout(), !a && !c) {
14614
14614
  c = !0, w(), s(new Q("WebSocket connection closed before opening"));
14615
14615
  return;
14616
14616
  }
14617
- const l = I.wasClean && (I.code === 1e3 || I.code === 1001), r = I.reason || `code=${I.code}`;
14618
- this.callbacks.onClose(r, l);
14617
+ const l = I.wasClean && (I.code === 1e3 || I.code === 1001), r = I.code === 1e3 || I.code === 1001, o = I.reason || `code=${I.code}`;
14618
+ this.callbacks.onClose(o, l, r);
14619
14619
  }, this.ws.onmessage = (I) => {
14620
14620
  this.handleProtocolMessage(new Uint8Array(I.data));
14621
14621
  };
14622
14622
  });
14623
14623
  }
14624
14624
  send(d) {
14625
- this.ws?.readyState === WebSocket.OPEN ? this.ws.send(d) : ce.warn("Cannot send: WebSocket not connected");
14625
+ this.ws?.readyState === WebSocket.OPEN ? this.ws.send(d) : ue.warn("Cannot send: WebSocket not connected");
14626
14626
  }
14627
14627
  close() {
14628
14628
  this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
@@ -14636,19 +14636,19 @@ class Dl {
14636
14636
  }
14637
14637
  this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(d);
14638
14638
  } catch (n) {
14639
- ce.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14639
+ ue.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14640
14640
  }
14641
14641
  }
14642
14642
  resetKeepaliveTimeout() {
14643
14643
  this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
14644
- ce.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new Oe(this.keepaliveTimeoutMs)), this.close();
14644
+ ue.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new Oe(this.keepaliveTimeoutMs)), this.close();
14645
14645
  }, this.keepaliveTimeoutMs);
14646
14646
  }
14647
14647
  clearKeepaliveTimeout() {
14648
14648
  this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
14649
14649
  }
14650
14650
  }
14651
- const K = se("WebTransportTransport"), Il = 4;
14651
+ const v = ae("WebTransportTransport"), Il = 4;
14652
14652
  function bl() {
14653
14653
  return typeof WebTransport < "u";
14654
14654
  }
@@ -14673,10 +14673,10 @@ class jl {
14673
14673
  if (!bl())
14674
14674
  throw new Q("WebTransport is not supported in this browser");
14675
14675
  try {
14676
- this.transport = new WebTransport(d), await this.transport.ready, K.debug(`Connected to WebTransport entrypoint: ${d}`), this.transport.closed.then(() => {
14676
+ this.transport = new WebTransport(d), await this.transport.ready, v.debug(`Connected to WebTransport entrypoint: ${d}`), this.transport.closed.then(() => {
14677
14677
  this.handleClose("Connection closed", !0);
14678
14678
  }).catch((i) => {
14679
- K.error("WebTransport connection closed with error:", i), this.handleClose(i.message || "Connection error", !1);
14679
+ v.error("WebTransport connection closed with error:", i), this.handleClose(i.message || "Connection error", !1);
14680
14680
  }), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(n), this.resetKeepaliveTimeout(), this.startReadLoop();
14681
14681
  } catch (i) {
14682
14682
  throw this.cleanup(), new Q(`Failed to connect WebTransport: ${i}`, i instanceof Error ? i : void 0);
@@ -14684,11 +14684,11 @@ class jl {
14684
14684
  }
14685
14685
  send(d) {
14686
14686
  if (!this.writer) {
14687
- K.warn("Cannot send: WebTransport not connected");
14687
+ v.warn("Cannot send: WebTransport not connected");
14688
14688
  return;
14689
14689
  }
14690
14690
  this.writer.write(d).catch((n) => {
14691
- K.error("Failed to send protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14691
+ v.error("Failed to send protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14692
14692
  });
14693
14693
  }
14694
14694
  close() {
@@ -14708,7 +14708,7 @@ class jl {
14708
14708
  d && (this.appendToBuffer(d), this.processBufferedMessages());
14709
14709
  }
14710
14710
  } catch (d) {
14711
- this.readLoopActive && (K.error("Read loop error:", d), this.callbacks.onError(d instanceof Error ? d : new Error(String(d))));
14711
+ this.readLoopActive && (v.error("Read loop error:", d), this.callbacks.onError(d instanceof Error ? d : new Error(String(d))));
14712
14712
  }
14713
14713
  }
14714
14714
  }
@@ -14727,7 +14727,7 @@ class jl {
14727
14727
  for (; this.receiveBuffer.length >= Il; ) {
14728
14728
  const n = new DataView(this.receiveBuffer.buffer, this.receiveBuffer.byteOffset, this.receiveBuffer.byteLength).getUint32(0, !0);
14729
14729
  if (n < Il) {
14730
- K.error(`Invalid message length: ${n}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${n}`)), this.receiveBuffer = new Uint8Array(0);
14730
+ v.error(`Invalid message length: ${n}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${n}`)), this.receiveBuffer = new Uint8Array(0);
14731
14731
  return;
14732
14732
  }
14733
14733
  if (this.receiveBuffer.length < n)
@@ -14748,21 +14748,21 @@ class jl {
14748
14748
  }
14749
14749
  this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(d);
14750
14750
  } catch (n) {
14751
- K.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14751
+ v.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
14752
14752
  }
14753
14753
  }
14754
14754
  /**
14755
14755
  * Handle connection close.
14756
14756
  */
14757
14757
  handleClose(d, n) {
14758
- this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(d, n);
14758
+ this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(d, n, n);
14759
14759
  }
14760
14760
  /**
14761
14761
  * Reset the keepalive timeout.
14762
14762
  */
14763
14763
  resetKeepaliveTimeout() {
14764
14764
  this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
14765
- K.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new Oe(this.keepaliveTimeoutMs)), this.close();
14765
+ v.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new Oe(this.keepaliveTimeoutMs)), this.close();
14766
14766
  }, this.keepaliveTimeoutMs);
14767
14767
  }
14768
14768
  /**
@@ -14784,7 +14784,7 @@ class jl {
14784
14784
  }
14785
14785
  }
14786
14786
  }
14787
- const ue = se("Channel");
14787
+ const le = ae("Channel");
14788
14788
  class Hl {
14789
14789
  state = "disconnected";
14790
14790
  transport = null;
@@ -14827,7 +14827,7 @@ class Hl {
14827
14827
  try {
14828
14828
  await this.connectTransport(), this.setState("connected");
14829
14829
  } catch (d) {
14830
- throw ue.error("Channel connection failed:", d), this.setState("disconnected"), d;
14830
+ throw le.error("Channel connection failed:", d), this.setState("disconnected"), d;
14831
14831
  }
14832
14832
  }
14833
14833
  /**
@@ -14841,7 +14841,7 @@ class Hl {
14841
14841
  */
14842
14842
  send(d) {
14843
14843
  if (!this.transport?.isConnected) {
14844
- ue.warn("Cannot send: channel not connected");
14844
+ le.warn("Cannot send: channel not connected");
14845
14845
  return;
14846
14846
  }
14847
14847
  this.transport.send(d);
@@ -14855,7 +14855,7 @@ class Hl {
14855
14855
  keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
14856
14856
  callbacks: {
14857
14857
  onProtocolMessage: (i) => this.handleProtocolMessage(i),
14858
- onClose: (i, s) => this.handleClose(i, s),
14858
+ onClose: (i, s, a) => this.handleClose(i, s, a),
14859
14859
  onError: (i) => this.handleError(i)
14860
14860
  }
14861
14861
  };
@@ -14882,25 +14882,25 @@ class Hl {
14882
14882
  try {
14883
14883
  const n = d;
14884
14884
  if (Fl(n) === he.CORE_ON_SERVER_STOPPING) {
14885
- this.setState("stopped"), this.transport?.close();
14885
+ le.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
14886
14886
  return;
14887
14887
  }
14888
14888
  this.config.onProtocolMessage?.(n);
14889
14889
  } catch (n) {
14890
- ue.error("Failed to handle protocol message:", n), this.config.onError?.(n instanceof Error ? n : new Error(String(n)));
14890
+ le.error("Failed to handle protocol message:", n), this.config.onError?.(n instanceof Error ? n : new Error(String(n)));
14891
14891
  }
14892
14892
  }
14893
14893
  /**
14894
14894
  * Handle transport close.
14895
14895
  */
14896
- handleClose(d, n) {
14897
- this.transport = null, this.config.onClose?.(d, n);
14896
+ handleClose(d, n, i) {
14897
+ this.transport = null, this.config.onClose?.(d, n, i);
14898
14898
  }
14899
14899
  /**
14900
14900
  * Handle transport error.
14901
14901
  */
14902
14902
  handleError(d) {
14903
- ue.error("Channel error:", d), this.config.onError?.(d), d instanceof Oe && this.handleClose("Keepalive timeout", !1);
14903
+ le.error("Channel error:", d), this.config.onError?.(d), d instanceof Oe && this.handleClose("Keepalive timeout", !1);
14904
14904
  }
14905
14905
  /**
14906
14906
  * Update and notify state change.
@@ -14909,7 +14909,7 @@ class Hl {
14909
14909
  this.state !== d && (this.state = d, this.config.onStateChange?.(d));
14910
14910
  }
14911
14911
  }
14912
- const Y = se("ChannelManager");
14912
+ const K = ae("ChannelManager");
14913
14913
  class Gl {
14914
14914
  channels = /* @__PURE__ */ new Map();
14915
14915
  // keyed by opcode group
@@ -14960,7 +14960,7 @@ class Gl {
14960
14960
  s.send(d);
14961
14961
  return;
14962
14962
  }
14963
- Y.warn(`No channel found for opcode group 0x${n.toString(16)}`);
14963
+ K.warn("No channel found for message");
14964
14964
  }
14965
14965
  /**
14966
14966
  * Send a protocol message to all channels (for broadcast messages).
@@ -14991,10 +14991,10 @@ class Gl {
14991
14991
  await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(s), this.config.onRememberWorkingType?.(s), this.activeType = s, this.reconnectAttempts = 0, this.setState("connected");
14992
14992
  return;
14993
14993
  } catch (c) {
14994
- Y.warn(`Failed to connect using ${$[s]}: ${c}`), this.disconnectAll();
14994
+ K.warn(`Failed to connect using ${$[s]}: ${c}`), this.disconnectAll();
14995
14995
  }
14996
14996
  }
14997
- throw Y.error("All endpoint types failed"), d || this.setState("offline"), new Error("Failed to connect using any endpoint type");
14997
+ throw K.error("All endpoint types failed"), d || this.setState("offline"), new Error("Failed to connect using any endpoint type");
14998
14998
  }
14999
14999
  /**
15000
15000
  * Connect all channels for a given endpoint type in parallel.
@@ -15022,8 +15022,8 @@ class Gl {
15022
15022
  onStateChange: (i) => {
15023
15023
  this.handleChannelStateChange(d.OpcodeGroupsFromServer, i);
15024
15024
  },
15025
- onClose: (i, s) => {
15026
- this.handleChannelClose(d.OpcodeGroupsFromServer, i, s);
15025
+ onClose: (i, s, a) => {
15026
+ this.handleChannelClose(d.OpcodeGroupsFromServer, i, s, a);
15027
15027
  },
15028
15028
  onError: (i) => {
15029
15029
  this.config.onError?.(i);
@@ -15051,9 +15051,14 @@ class Gl {
15051
15051
  /**
15052
15052
  * Handle channel close.
15053
15053
  */
15054
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
15055
- handleChannelClose(d, n, i) {
15056
- this.state === "idle" || this.state === "stopped" || this.state === "offline" || this.state === "connected" && (Y.error(`Channel for opcode groups 0x${d.toString(16)} closed unexpectedly, attempting reconnect`), this.disconnectAll(), this.attemptReconnect());
15054
+ handleChannelClose(d, n, i, s) {
15055
+ if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline")) {
15056
+ if (i || s) {
15057
+ K.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
15058
+ return;
15059
+ }
15060
+ this.state === "connected" && (K.error("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
15061
+ }
15057
15062
  }
15058
15063
  /**
15059
15064
  * Attempt to reconnect with exponential backoff.
@@ -15062,16 +15067,16 @@ class Gl {
15062
15067
  if (!this.shouldReconnect)
15063
15068
  return;
15064
15069
  if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
15065
- Y.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new gl(this.config.maxReconnectAttempts));
15070
+ K.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new gl(this.config.maxReconnectAttempts));
15066
15071
  return;
15067
15072
  }
15068
15073
  this.setState("reconnecting"), this.reconnectAttempts++;
15069
15074
  const d = this.config.reconnectBackoffMs * Math.pow(2, this.reconnectAttempts - 1);
15070
- if (Y.info(`Reconnecting in ${d}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await Sl(d, this.abortController?.signal), !!this.shouldReconnect)
15075
+ if (K.info(`Reconnecting in ${d}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await Sl(d, this.abortController?.signal), !!this.shouldReconnect)
15071
15076
  try {
15072
15077
  await this.connectInternal(!0);
15073
15078
  } catch (n) {
15074
- Y.error("Reconnect failed:", n), await this.attemptReconnect();
15079
+ K.error("Reconnect failed:", n), await this.attemptReconnect();
15075
15080
  }
15076
15081
  }
15077
15082
  /**
@@ -15089,7 +15094,7 @@ class Gl {
15089
15094
  this.state !== d && (this.state = d, this.config.onStateChange?.(d));
15090
15095
  }
15091
15096
  }
15092
- const yl = se("ProtocolWorker"), X = (e, d) => {
15097
+ const yl = ae("ProtocolWorker"), X = (e, d) => {
15093
15098
  self.postMessage(e, d ?? []);
15094
15099
  };
15095
15100
  let x = null, be;
@@ -15114,7 +15119,7 @@ function ye() {
15114
15119
  }
15115
15120
  Z.clear();
15116
15121
  }
15117
- function ne(e) {
15122
+ function ie(e) {
15118
15123
  const d = e instanceof Error ? e : new Error(String(e));
15119
15124
  X({ type: "error", error: { name: d.name, message: d.message, stack: d.stack } });
15120
15125
  }
@@ -15127,21 +15132,21 @@ function Jl(e) {
15127
15132
  (n.opcodeGroupsMask & e) !== 0 && d.push(n.port);
15128
15133
  return d;
15129
15134
  }
15130
- function Kl(e, d) {
15135
+ function vl(e, d) {
15131
15136
  return (Ie(e) & d) !== 0;
15132
15137
  }
15133
- function vl(e, d) {
15138
+ function Kl(e, d) {
15134
15139
  if (!x || !d || typeof d != "object")
15135
15140
  return;
15136
15141
  const n = d;
15137
15142
  if (!(n.type !== "send" || !(n.message instanceof ArrayBuffer)))
15138
15143
  try {
15139
15144
  const i = new Uint8Array(n.message);
15140
- if (!Kl(i, e))
15145
+ if (!vl(i, e))
15141
15146
  return;
15142
15147
  x.sendProtocolMessage(i);
15143
15148
  } catch (i) {
15144
- ne(i);
15149
+ ie(i);
15145
15150
  }
15146
15151
  }
15147
15152
  async function Wl(e) {
@@ -15158,7 +15163,7 @@ async function Wl(e) {
15158
15163
  X({ type: "state", state: x?.managerState ?? "idle", activeType: x?.activeEndpointType ?? void 0 });
15159
15164
  },
15160
15165
  onError: (d) => {
15161
- ne(d);
15166
+ ie(d);
15162
15167
  },
15163
15168
  onProtocolMessage: (d) => {
15164
15169
  const n = Ie(d), i = xl(d), s = Jl(n);
@@ -15198,7 +15203,7 @@ async function Wl(e) {
15198
15203
  X({ type: "protocol", message: f, headers: a }, [f]);
15199
15204
  }
15200
15205
  } catch (a) {
15201
- ne(a);
15206
+ ie(a);
15202
15207
  }
15203
15208
  }
15204
15209
  }), await x.connect(e.entrypoints);
@@ -15207,7 +15212,7 @@ self.addEventListener("message", (e) => {
15207
15212
  const d = e.data;
15208
15213
  if (d.type === "connect") {
15209
15214
  Wl(d).catch((n) => {
15210
- yl.error(`Failed to connect: ${n}`), ne(n), ye();
15215
+ yl.error(`Failed to connect: ${n}`), ie(n), ye();
15211
15216
  });
15212
15217
  return;
15213
15218
  }
@@ -15222,7 +15227,7 @@ self.addEventListener("message", (e) => {
15222
15227
  const n = new Uint8Array(d.message);
15223
15228
  x.sendProtocolMessage(n);
15224
15229
  } catch (n) {
15225
- ne(n);
15230
+ ie(n);
15226
15231
  }
15227
15232
  return;
15228
15233
  }
@@ -15265,7 +15270,7 @@ self.addEventListener("message", (e) => {
15265
15270
  } catch {
15266
15271
  }
15267
15272
  i.port.addEventListener("message", (s) => {
15268
- vl(i.opcodeGroupsMask, s.data);
15273
+ Kl(i.opcodeGroupsMask, s.data);
15269
15274
  });
15270
15275
  return;
15271
15276
  }