@ikonai/sdk 1.0.33 → 1.0.35

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.
@@ -2,99 +2,99 @@ const J = {
2
2
  Compressed: 8
3
3
  };
4
4
  function Z(t) {
5
- const e = O(t), r = new DataView(e.buffer, e.byteOffset, e.byteLength);
6
- if (e.length < 27)
5
+ const r = g(t), e = new DataView(r.buffer, r.byteOffset, r.byteLength);
6
+ if (r.length < 27)
7
7
  throw new Error("Protocol payload too short");
8
- const n = r.getUint32(0, !0), s = r.getUint32(4, !0), E = r.getUint32(8, !0), _ = r.getUint32(12, !0), i = r.getUint32(16, !0), N = r.getUint32(20, !0), f = r.getUint8(24), m = r.getUint8(25), Q = r.getUint8(26);
9
- if (27 + N * 4 > e.length)
8
+ const n = e.getUint32(0, !0), s = e.getUint32(4, !0), _ = e.getUint32(8, !0), E = e.getUint32(12, !0), i = e.getUint32(16, !0), N = e.getUint32(20, !0), C = e.getUint8(24), m = e.getUint8(25), Q = e.getUint8(26);
9
+ if (27 + N * 4 > r.length)
10
10
  throw new Error("Protocol header exceeds payload length");
11
11
  const H = [];
12
12
  let K = 27;
13
13
  for (let x = 0; x < N; x++)
14
- H.push(r.getUint32(K, !0)), K += 4;
14
+ H.push(e.getUint32(K, !0)), K += 4;
15
15
  return {
16
16
  length: n,
17
17
  opcode: s,
18
- senderId: E,
19
- trackId: _,
18
+ senderId: _,
19
+ trackId: E,
20
20
  sequenceId: i,
21
21
  targetIds: H,
22
- payloadVersion: f,
22
+ payloadVersion: C,
23
23
  payloadType: m,
24
24
  flags: Q
25
25
  };
26
26
  }
27
- async function k(t, e, r) {
28
- const n = O(t), s = Z(n);
29
- if (e !== void 0 && s.opcode !== e)
27
+ async function k(t, r, e) {
28
+ const n = g(t), s = Z(n);
29
+ if (r !== void 0 && s.opcode !== r)
30
30
  throw new Error(`Unexpected opcode ${s.opcode}`);
31
31
  if (s.payloadType !== 8)
32
32
  throw new Error(`Unexpected payload type ${s.payloadType}`);
33
- const E = 27 + s.targetIds.length * 4;
34
- let _ = n.subarray(E, s.length);
35
- return (s.flags & J.Compressed) !== 0 && (_ = await p(_)), _;
33
+ const _ = 27 + s.targetIds.length * 4;
34
+ let E = n.subarray(_, s.length);
35
+ return (s.flags & J.Compressed) !== 0 && (E = await p(E)), E;
36
36
  }
37
37
  async function p(t) {
38
38
  if (typeof DecompressionStream > "u")
39
39
  throw new Error("DecompressionStream not supported");
40
- const e = new DecompressionStream("gzip"), r = e.writable.getWriter(), n = new Uint8Array(t);
41
- r.write(n), r.close();
42
- const s = e.readable.getReader(), E = [];
43
- let _ = 0;
40
+ const r = new DecompressionStream("gzip"), e = r.writable.getWriter(), n = new Uint8Array(t);
41
+ e.write(n), e.close();
42
+ const s = r.readable.getReader(), _ = [];
43
+ let E = 0;
44
44
  for (; ; ) {
45
- const { done: f, value: m } = await s.read();
46
- if (f) break;
47
- E.push(m), _ += m.length;
45
+ const { done: C, value: m } = await s.read();
46
+ if (C) break;
47
+ _.push(m), E += m.length;
48
48
  }
49
- const i = new Uint8Array(_);
49
+ const i = new Uint8Array(E);
50
50
  let N = 0;
51
- for (let f = 0; f < E.length; f++)
52
- i.set(E[f], N), N += E[f].length;
51
+ for (let C = 0; C < _.length; C++)
52
+ i.set(_[C], N), N += _[C].length;
53
53
  return i;
54
54
  }
55
- var c = /* @__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))(c || {});
56
- const tt = 161, et = 162;
55
+ var l = /* @__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))(l || {});
56
+ const tt = 161, rt = 162;
57
57
  new TextEncoder();
58
- const rt = new TextDecoder("utf-8", { fatal: !0 });
59
- class w {
60
- constructor(e, r, n) {
61
- this.buffer = e, this.version = r, this.offset = n, this.end = e.length - 1;
58
+ const et = new TextDecoder("utf-8", { fatal: !0 });
59
+ class P {
60
+ constructor(r, e, n) {
61
+ this.buffer = r, this.version = e, this.offset = n, this.end = r.length - 1;
62
62
  }
63
63
  offset;
64
64
  end;
65
- static create(e) {
66
- const r = O(e);
67
- if (r.length < 2)
65
+ static create(r) {
66
+ const e = g(r);
67
+ if (e.length < 2)
68
68
  throw new Error("Teleport payload too short");
69
- if (r[0] !== tt || r[r.length - 1] !== et)
69
+ if (e[0] !== tt || e[e.length - 1] !== rt)
70
70
  throw new Error("Teleport object missing markers");
71
- const n = { offset: 1 }, s = T(r, n, "InvalidLength");
72
- return new w(r, s, n.offset);
71
+ const n = { offset: 1 }, s = A(e, n, "InvalidLength");
72
+ return new P(e, s, n.offset);
73
73
  }
74
74
  next() {
75
75
  if (this.offset >= this.end)
76
76
  return null;
77
77
  if (this.offset + 5 > this.buffer.length)
78
78
  throw new Error("Teleport object truncated");
79
- const e = _t(this.buffer, this.offset);
79
+ const r = Et(this.buffer, this.offset);
80
80
  this.offset += 4;
81
- const r = this.buffer[this.offset++], n = r >> 4 & 15;
82
- if ((r & 15) !== 0)
81
+ const e = this.buffer[this.offset++], n = e >> 4 & 15;
82
+ if ((e & 15) !== 0)
83
83
  throw new Error("Teleport field flags must be zero");
84
- const s = U(n);
85
- let E;
84
+ const s = S(n);
85
+ let _;
86
86
  if (s >= 0)
87
- a(this.buffer, this.offset, s), E = this.buffer.subarray(this.offset, this.offset + s), this.offset += s;
87
+ a(this.buffer, this.offset, s), _ = this.buffer.subarray(this.offset, this.offset + s), this.offset += s;
88
88
  else {
89
- const _ = { offset: this.offset }, i = T(this.buffer, _, "InvalidLength");
90
- a(this.buffer, _.offset, i), E = this.buffer.subarray(_.offset, _.offset + i), this.offset = _.offset + i;
89
+ const E = { offset: this.offset }, i = A(this.buffer, E, "InvalidLength");
90
+ a(this.buffer, E.offset, i), _ = this.buffer.subarray(E.offset, E.offset + i), this.offset = E.offset + i;
91
91
  }
92
- return new nt(e, n, E);
92
+ return new nt(r, n, _);
93
93
  }
94
94
  }
95
- class o {
96
- constructor(e, r) {
97
- this.type = e, this.payload = r;
95
+ class f {
96
+ constructor(r, e) {
97
+ this.type = r, this.payload = e;
98
98
  }
99
99
  asInt32() {
100
100
  return this.ensureType(
@@ -154,7 +154,7 @@ class o {
154
154
  return this.ensureType(
155
155
  12
156
156
  /* String */
157
- ), rt.decode(this.payload);
157
+ ), et.decode(this.payload);
158
158
  }
159
159
  asGuid() {
160
160
  return this.ensureType(
@@ -166,7 +166,7 @@ class o {
166
166
  return this.ensureType(
167
167
  11
168
168
  /* Object */
169
- ), w.create(this.payload);
169
+ ), P.create(this.payload);
170
170
  }
171
171
  asArray() {
172
172
  return this.ensureType(
@@ -180,14 +180,14 @@ class o {
180
180
  /* Dict */
181
181
  ), G.create(this.payload);
182
182
  }
183
- ensureType(e) {
184
- if (this.type !== e)
185
- throw new Error(`Teleport value has type ${c[this.type]}, expected ${c[e]}`);
183
+ ensureType(r) {
184
+ if (this.type !== r)
185
+ throw new Error(`Teleport value has type ${l[this.type]}, expected ${l[r]}`);
186
186
  }
187
187
  }
188
- class nt extends o {
189
- constructor(e, r, n) {
190
- super(r, n), this.fieldId = e;
188
+ class nt extends f {
189
+ constructor(r, e, n) {
190
+ super(e, n), this.fieldId = r;
191
191
  }
192
192
  get isNull() {
193
193
  return this.type === 1;
@@ -199,17 +199,17 @@ class V {
199
199
  count;
200
200
  offset;
201
201
  index = 0;
202
- constructor(e) {
203
- if (this.payload = e, e.length === 0)
202
+ constructor(r) {
203
+ if (this.payload = r, r.length === 0)
204
204
  throw new Error("Array payload too short");
205
- const r = e[0];
206
- if (this.elementType = r >> 4 & 15, (r & 15) !== 0)
205
+ const e = r[0];
206
+ if (this.elementType = e >> 4 & 15, (e & 15) !== 0)
207
207
  throw new Error("Array flags must be zero");
208
208
  const n = { offset: 1 };
209
- this.count = T(e, n, "ArrayMalformed"), this.offset = n.offset;
209
+ this.count = A(r, n, "ArrayMalformed"), this.offset = n.offset;
210
210
  }
211
- static create(e) {
212
- return new V(O(e));
211
+ static create(r) {
212
+ return new V(g(r));
213
213
  }
214
214
  next() {
215
215
  if (this.index >= this.count) {
@@ -217,8 +217,8 @@ class V {
217
217
  throw new Error("Array payload contains trailing data");
218
218
  return null;
219
219
  }
220
- const e = this.readValue();
221
- return this.index++, e;
220
+ const r = this.readValue();
221
+ return this.index++, r;
222
222
  }
223
223
  readValue() {
224
224
  switch (this.elementType) {
@@ -230,40 +230,40 @@ class V {
230
230
  case 4:
231
231
  case 6:
232
232
  case 14: {
233
- const e = U(this.elementType);
234
- a(this.payload, this.offset, e);
235
- const r = this.payload.subarray(this.offset, this.offset + e);
236
- return this.offset += e, new D(this.elementType, r);
233
+ const r = S(this.elementType);
234
+ a(this.payload, this.offset, r);
235
+ const e = this.payload.subarray(this.offset, this.offset + r);
236
+ return this.offset += r, new D(this.elementType, e);
237
237
  }
238
238
  case 12:
239
239
  case 13: {
240
- const e = { offset: this.offset }, r = T(this.payload, e, "ArrayMalformed");
241
- a(this.payload, e.offset, r);
242
- const n = this.payload.subarray(e.offset, e.offset + r);
243
- return this.offset = e.offset + r, new D(this.elementType, n);
240
+ const r = { offset: this.offset }, e = A(this.payload, r, "ArrayMalformed");
241
+ a(this.payload, r.offset, e);
242
+ const n = this.payload.subarray(r.offset, r.offset + e);
243
+ return this.offset = r.offset + e, new D(this.elementType, n);
244
244
  }
245
245
  case 11: {
246
- const e = { offset: this.offset }, r = T(this.payload, e, "ArrayMalformed");
247
- a(this.payload, e.offset, r);
248
- const n = this.payload.subarray(e.offset, e.offset + r);
249
- return this.offset = e.offset + r, new D(11, n);
246
+ const r = { offset: this.offset }, e = A(this.payload, r, "ArrayMalformed");
247
+ a(this.payload, r.offset, e);
248
+ const n = this.payload.subarray(r.offset, r.offset + e);
249
+ return this.offset = r.offset + e, new D(11, n);
250
250
  }
251
251
  case 9: {
252
- const e = B(this.payload, this.offset), r = this.payload.subarray(this.offset, this.offset + e);
253
- return this.offset += e, new D(9, r);
252
+ const r = B(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
253
+ return this.offset += r, new D(9, e);
254
254
  }
255
255
  case 10: {
256
- const e = b(this.payload, this.offset), r = this.payload.subarray(this.offset, this.offset + e);
257
- return this.offset += e, new D(10, r);
256
+ const r = b(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
257
+ return this.offset += r, new D(10, e);
258
258
  }
259
259
  default:
260
- throw new Error(`Unsupported array element type ${c[this.elementType]}`);
260
+ throw new Error(`Unsupported array element type ${l[this.elementType]}`);
261
261
  }
262
262
  }
263
263
  }
264
- class D extends o {
265
- constructor(e, r) {
266
- super(e, r);
264
+ class D extends f {
265
+ constructor(r, e) {
266
+ super(r, e);
267
267
  }
268
268
  }
269
269
  class G {
@@ -273,17 +273,17 @@ class G {
273
273
  count;
274
274
  offset;
275
275
  index = 0;
276
- constructor(e) {
277
- if (this.payload = e, e.length < 2)
276
+ constructor(r) {
277
+ if (this.payload = r, r.length < 2)
278
278
  throw new Error("Dictionary payload too short");
279
- if (this.keyType = e[0] >> 4 & 15, this.valueType = e[1] >> 4 & 15, (e[0] & 15) !== 0 || (e[1] & 15) !== 0)
279
+ if (this.keyType = r[0] >> 4 & 15, this.valueType = r[1] >> 4 & 15, (r[0] & 15) !== 0 || (r[1] & 15) !== 0)
280
280
  throw new Error("Dictionary key/value flags must be zero");
281
281
  W(this.keyType);
282
- const r = { offset: 2 };
283
- this.count = T(e, r, "DictMalformed"), this.offset = r.offset;
282
+ const e = { offset: 2 };
283
+ this.count = A(r, e, "DictMalformed"), this.offset = e.offset;
284
284
  }
285
- static create(e) {
286
- return new G(O(e));
285
+ static create(r) {
286
+ return new G(g(r));
287
287
  }
288
288
  next() {
289
289
  if (this.index >= this.count) {
@@ -291,21 +291,21 @@ class G {
291
291
  throw new Error("Dictionary payload contains trailing data");
292
292
  return null;
293
293
  }
294
- const e = this.readKey(), r = this.readValue();
295
- return this.index++, new st(e, r);
294
+ const r = this.readKey(), e = this.readValue();
295
+ return this.index++, new st(r, e);
296
296
  }
297
297
  readKey() {
298
- const e = U(this.keyType);
299
- if (e >= 0) {
300
- a(this.payload, this.offset, e);
301
- const r = this.payload.subarray(this.offset, this.offset + e);
302
- return this.offset += e, new o(this.keyType, r);
298
+ const r = S(this.keyType);
299
+ if (r >= 0) {
300
+ a(this.payload, this.offset, r);
301
+ const e = this.payload.subarray(this.offset, this.offset + r);
302
+ return this.offset += r, new f(this.keyType, e);
303
303
  }
304
304
  if (this.keyType === 12 || this.keyType === 13) {
305
- const r = { offset: this.offset }, n = T(this.payload, r, "DictMalformed");
306
- a(this.payload, r.offset, n);
307
- const s = this.payload.subarray(r.offset, r.offset + n);
308
- return this.offset = r.offset + n, new o(this.keyType, s);
305
+ const e = { offset: this.offset }, n = A(this.payload, e, "DictMalformed");
306
+ a(this.payload, e.offset, n);
307
+ const s = this.payload.subarray(e.offset, e.offset + n);
308
+ return this.offset = e.offset + n, new f(this.keyType, s);
309
309
  }
310
310
  throw new Error("Unsupported dictionary key type");
311
311
  }
@@ -313,24 +313,24 @@ class G {
313
313
  switch (this.valueType) {
314
314
  case 12:
315
315
  case 13: {
316
- const e = { offset: this.offset }, r = T(this.payload, e, "DictMalformed");
317
- a(this.payload, e.offset, r);
318
- const n = this.payload.subarray(e.offset, e.offset + r);
319
- return this.offset = e.offset + r, new o(this.valueType, n);
316
+ const r = { offset: this.offset }, e = A(this.payload, r, "DictMalformed");
317
+ a(this.payload, r.offset, e);
318
+ const n = this.payload.subarray(r.offset, r.offset + e);
319
+ return this.offset = r.offset + e, new f(this.valueType, n);
320
320
  }
321
321
  case 11: {
322
- const e = { offset: this.offset }, r = T(this.payload, e, "DictMalformed");
323
- a(this.payload, e.offset, r);
324
- const n = this.payload.subarray(e.offset, e.offset + r);
325
- return this.offset = e.offset + r, new o(11, n);
322
+ const r = { offset: this.offset }, e = A(this.payload, r, "DictMalformed");
323
+ a(this.payload, r.offset, e);
324
+ const n = this.payload.subarray(r.offset, r.offset + e);
325
+ return this.offset = r.offset + e, new f(11, n);
326
326
  }
327
327
  case 9: {
328
- const e = B(this.payload, this.offset), r = this.payload.subarray(this.offset, this.offset + e);
329
- return this.offset += e, new o(9, r);
328
+ const r = B(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
329
+ return this.offset += r, new f(9, e);
330
330
  }
331
331
  case 10: {
332
- const e = b(this.payload, this.offset), r = this.payload.subarray(this.offset, this.offset + e);
333
- return this.offset += e, new o(10, r);
332
+ const r = b(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
333
+ return this.offset += r, new f(10, e);
334
334
  }
335
335
  case 3:
336
336
  case 5:
@@ -341,111 +341,111 @@ class G {
341
341
  case 6:
342
342
  case 14:
343
343
  case 1: {
344
- const e = U(this.valueType);
345
- a(this.payload, this.offset, e);
346
- const r = this.payload.subarray(this.offset, this.offset + e);
347
- return this.offset += e, new o(this.valueType, r);
344
+ const r = S(this.valueType);
345
+ a(this.payload, this.offset, r);
346
+ const e = this.payload.subarray(this.offset, this.offset + r);
347
+ return this.offset += r, new f(this.valueType, e);
348
348
  }
349
349
  default:
350
- throw new Error(`Unsupported dictionary value type ${c[this.valueType]}`);
350
+ throw new Error(`Unsupported dictionary value type ${l[this.valueType]}`);
351
351
  }
352
352
  }
353
353
  }
354
354
  class st {
355
- constructor(e, r) {
356
- this.key = e, this.value = r;
355
+ constructor(r, e) {
356
+ this.key = r, this.value = e;
357
357
  }
358
358
  }
359
359
  class I {
360
- constructor(e) {
361
- this.bytes = e;
360
+ constructor(r) {
361
+ this.bytes = r;
362
362
  }
363
- static fromString(e) {
364
- if (!e)
363
+ static fromString(r) {
364
+ if (!r)
365
365
  throw new Error("Guid string is empty");
366
- const r = e.replace(/-/g, "");
367
- if (r.length !== 32)
366
+ const e = r.replace(/-/g, "");
367
+ if (e.length !== 32)
368
368
  throw new Error("Guid string must be 32 hex characters");
369
- const n = new Uint8Array(16), s = I.parseHexSlice(r, 0, 8), E = I.parseHexSlice(r, 8, 4), _ = I.parseHexSlice(r, 12, 4);
370
- I.writeUInt32LE(n, 0, s), I.writeUInt16LE(n, 4, E), I.writeUInt16LE(n, 6, _);
369
+ const n = new Uint8Array(16), s = I.parseHexSlice(e, 0, 8), _ = I.parseHexSlice(e, 8, 4), E = I.parseHexSlice(e, 12, 4);
370
+ I.writeUInt32LE(n, 0, s), I.writeUInt16LE(n, 4, _), I.writeUInt16LE(n, 6, E);
371
371
  for (let i = 0; i < 8; i++)
372
- n[8 + i] = I.parseHexSlice(r, 16 + i * 2, 2);
372
+ n[8 + i] = I.parseHexSlice(e, 16 + i * 2, 2);
373
373
  return new I(n);
374
374
  }
375
- static fromBytes(e) {
376
- if (e.length !== 16)
375
+ static fromBytes(r) {
376
+ if (r.length !== 16)
377
377
  throw new Error("Guid byte array must be 16 bytes");
378
- return new I(Uint8Array.from(e));
378
+ return new I(Uint8Array.from(r));
379
379
  }
380
380
  static createZero() {
381
381
  return new I(new Uint8Array(16));
382
382
  }
383
383
  static createRandom() {
384
- const e = new Uint8Array(16), r = globalThis.crypto;
385
- if (r?.getRandomValues)
386
- r.getRandomValues(e);
384
+ const r = new Uint8Array(16), e = globalThis.crypto;
385
+ if (e?.getRandomValues)
386
+ e.getRandomValues(r);
387
387
  else
388
- for (let n = 0; n < e.length; n++)
389
- e[n] = Math.floor(Math.random() * 256);
390
- return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new I(e);
388
+ for (let n = 0; n < r.length; n++)
389
+ r[n] = Math.floor(Math.random() * 256);
390
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, new I(r);
391
391
  }
392
392
  toString() {
393
- const e = this.bytes;
393
+ const r = this.bytes;
394
394
  return [
395
- I.toHex(I.readUInt32LE(e, 0), 8),
396
- I.toHex(I.readUInt16LE(e, 4), 4),
397
- I.toHex(I.readUInt16LE(e, 6), 4),
398
- v(e.subarray(8, 10)),
399
- v(e.subarray(10, 16))
395
+ I.toHex(I.readUInt32LE(r, 0), 8),
396
+ I.toHex(I.readUInt16LE(r, 4), 4),
397
+ I.toHex(I.readUInt16LE(r, 6), 4),
398
+ v(r.subarray(8, 10)),
399
+ v(r.subarray(10, 16))
400
400
  ].join("-");
401
401
  }
402
402
  asBytes() {
403
403
  return this.bytes.slice();
404
404
  }
405
- static parseHexSlice(e, r, n) {
406
- const s = e.substr(r, n), E = Number.parseInt(s, 16);
407
- if (Number.isNaN(E))
405
+ static parseHexSlice(r, e, n) {
406
+ const s = r.substr(e, n), _ = Number.parseInt(s, 16);
407
+ if (Number.isNaN(_))
408
408
  throw new Error("Guid string contains invalid characters");
409
- return E >>> 0;
409
+ return _ >>> 0;
410
410
  }
411
- static writeUInt32LE(e, r, n) {
411
+ static writeUInt32LE(r, e, n) {
412
412
  const s = n >>> 0;
413
- e[r] = s & 255, e[r + 1] = s >>> 8 & 255, e[r + 2] = s >>> 16 & 255, e[r + 3] = s >>> 24 & 255;
413
+ r[e] = s & 255, r[e + 1] = s >>> 8 & 255, r[e + 2] = s >>> 16 & 255, r[e + 3] = s >>> 24 & 255;
414
414
  }
415
- static writeUInt16LE(e, r, n) {
415
+ static writeUInt16LE(r, e, n) {
416
416
  const s = n & 65535;
417
- e[r] = s & 255, e[r + 1] = s >>> 8 & 255;
417
+ r[e] = s & 255, r[e + 1] = s >>> 8 & 255;
418
418
  }
419
- static readUInt32LE(e, r) {
420
- return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
419
+ static readUInt32LE(r, e) {
420
+ return (r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24) >>> 0;
421
421
  }
422
- static readUInt16LE(e, r) {
423
- return (e[r] | e[r + 1] << 8) & 65535;
422
+ static readUInt16LE(r, e) {
423
+ return (r[e] | r[e + 1] << 8) & 65535;
424
424
  }
425
- static toHex(e, r) {
426
- return (e >>> 0).toString(16).padStart(r, "0");
425
+ static toHex(r, e) {
426
+ return (r >>> 0).toString(16).padStart(e, "0");
427
427
  }
428
428
  }
429
- function T(t, e, r) {
430
- if (e.offset >= t.length)
431
- throw new Error(r);
432
- let n = 0, s = 0, E = 0;
433
- for (; e.offset < t.length; ) {
434
- const _ = t[e.offset++];
435
- if (E++, n |= (_ & 127) << s, (_ & 128) === 0) {
436
- if (E !== Et(n))
429
+ function A(t, r, e) {
430
+ if (r.offset >= t.length)
431
+ throw new Error(e);
432
+ let n = 0, s = 0, _ = 0;
433
+ for (; r.offset < t.length; ) {
434
+ const E = t[r.offset++];
435
+ if (_++, n |= (E & 127) << s, (E & 128) === 0) {
436
+ if (_ !== _t(n))
437
437
  throw new Error("Teleport VarUInt is not canonical");
438
438
  return n >>> 0;
439
439
  }
440
440
  if (s += 7, s >= 35)
441
441
  throw new Error("Teleport VarUInt exceeds 32-bit range");
442
442
  }
443
- throw new Error(r);
443
+ throw new Error(e);
444
444
  }
445
- function Et(t) {
445
+ function _t(t) {
446
446
  return t < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5;
447
447
  }
448
- function U(t) {
448
+ function S(t) {
449
449
  switch (t) {
450
450
  case 3:
451
451
  case 5:
@@ -469,203 +469,203 @@ function W(t) {
469
469
  if (t === 9 || t === 11 || t === 10 || t === 1)
470
470
  throw new Error("Dictionary keys must be primitive Teleport types");
471
471
  }
472
- function a(t, e, r) {
473
- if (e < 0 || r < 0 || e + r > t.length)
472
+ function a(t, r, e) {
473
+ if (r < 0 || e < 0 || r + e > t.length)
474
474
  throw new Error("Teleport payload exceeds bounds");
475
475
  }
476
- function _t(t, e) {
477
- return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
476
+ function Et(t, r) {
477
+ return (t[r] | t[r + 1] << 8 | t[r + 2] << 16 | t[r + 3] << 24) >>> 0;
478
478
  }
479
- function B(t, e) {
480
- if (e >= t.length)
479
+ function B(t, r) {
480
+ if (r >= t.length)
481
481
  throw new Error("Array payload exceeds bounds");
482
- const r = t[e], n = r >> 4 & 15;
483
- if ((r & 15) !== 0)
482
+ const e = t[r], n = e >> 4 & 15;
483
+ if ((e & 15) !== 0)
484
484
  throw new Error("Array flags must be zero");
485
- const s = { offset: e + 1 }, E = T(t, s, "ArrayMalformed"), _ = U(n);
486
- if (_ >= 0) {
487
- const N = _ * E;
488
- return a(t, s.offset, N), s.offset + N - e;
485
+ const s = { offset: r + 1 }, _ = A(t, s, "ArrayMalformed"), E = S(n);
486
+ if (E >= 0) {
487
+ const N = E * _;
488
+ return a(t, s.offset, N), s.offset + N - r;
489
489
  }
490
490
  let i = s.offset;
491
- for (let N = 0; N < E; N++)
492
- i = F(n, t, i, "ArrayMalformed");
493
- return i - e;
491
+ for (let N = 0; N < _; N++)
492
+ i = d(n, t, i, "ArrayMalformed");
493
+ return i - r;
494
494
  }
495
- function b(t, e) {
496
- if (e + 2 > t.length)
495
+ function b(t, r) {
496
+ if (r + 2 > t.length)
497
497
  throw new Error("Dictionary payload too short");
498
- const r = t[e] >> 4 & 15, n = t[e + 1] >> 4 & 15;
499
- if ((t[e] & 15) !== 0 || (t[e + 1] & 15) !== 0)
498
+ const e = t[r] >> 4 & 15, n = t[r + 1] >> 4 & 15;
499
+ if ((t[r] & 15) !== 0 || (t[r + 1] & 15) !== 0)
500
500
  throw new Error("Dictionary key/value flags must be zero");
501
- W(r);
502
- const s = { offset: e + 2 }, E = T(t, s, "DictMalformed");
503
- let _ = s.offset;
504
- for (let i = 0; i < E; i++)
505
- _ = F(r, t, _, "DictMalformed"), _ = F(n, t, _, "DictMalformed");
506
- return _ - e;
507
- }
508
- function F(t, e, r, n) {
509
- const s = U(t);
501
+ W(e);
502
+ const s = { offset: r + 2 }, _ = A(t, s, "DictMalformed");
503
+ let E = s.offset;
504
+ for (let i = 0; i < _; i++)
505
+ E = d(e, t, E, "DictMalformed"), E = d(n, t, E, "DictMalformed");
506
+ return E - r;
507
+ }
508
+ function d(t, r, e, n) {
509
+ const s = S(t);
510
510
  if (s >= 0)
511
- return a(e, r, s), r + s;
511
+ return a(r, e, s), e + s;
512
512
  switch (t) {
513
513
  case 12:
514
514
  case 13: {
515
- const E = { offset: r }, _ = T(e, E, n);
516
- return a(e, E.offset, _), E.offset + _;
515
+ const _ = { offset: e }, E = A(r, _, n);
516
+ return a(r, _.offset, E), _.offset + E;
517
517
  }
518
518
  case 11: {
519
- const E = { offset: r }, _ = T(e, E, n);
520
- return a(e, E.offset, _), E.offset + _;
519
+ const _ = { offset: e }, E = A(r, _, n);
520
+ return a(r, _.offset, E), _.offset + E;
521
521
  }
522
522
  case 9:
523
- return r + B(e, r);
523
+ return e + B(r, e);
524
524
  case 10:
525
- return r + b(e, r);
525
+ return e + b(r, e);
526
526
  default:
527
- throw new Error(`Unsupported Teleport type ${c[t]}`);
527
+ throw new Error(`Unsupported Teleport type ${l[t]}`);
528
528
  }
529
529
  }
530
530
  function v(t) {
531
- return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
531
+ return Array.from(t).map((r) => r.toString(16).padStart(2, "0")).join("");
532
532
  }
533
- function O(t) {
533
+ function g(t) {
534
534
  return t instanceof Uint8Array ? t : new Uint8Array(t);
535
535
  }
536
- var h = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(h || {}), L = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(L || {});
537
- const it = 8388609, It = 161083277, at = 164808083, Tt = 1368629611, At = 2745379226, Nt = 2950031986, ot = 3282782683, ft = 3284746250, Ct = 4065070594;
536
+ var h = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(h || {}), L = /* @__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))(L || {});
537
+ const it = 8388609, It = 161083277, at = 164808083, At = 1368629611, Tt = 2745379226, Nt = 2950031986, ft = 3282782683, Ct = 3284746250, ot = 4065070594;
538
538
  function ut(t) {
539
- const e = {};
540
- return X(e), e;
539
+ const r = {};
540
+ return X(r), r;
541
541
  }
542
542
  function X(t) {
543
543
  return t.StreamId = "", t.Description = "", t.SourceType = "", t.Codec = h.H264, t.CodecDetails = "", t.Width = 0, t.Height = 0, t.Framerate = 30, t;
544
544
  }
545
- function Rt(t, e) {
546
- const r = w.create(t);
547
- return ht(r, e);
545
+ function Rt(t, r) {
546
+ const e = P.create(t);
547
+ return ht(e, r);
548
548
  }
549
- function ht(t, e) {
550
- const r = e ?? ut();
551
- return X(r), lt(t, r), r;
549
+ function ht(t, r) {
550
+ const e = r ?? ut();
551
+ return X(e), Ut(t, e), e;
552
552
  }
553
- function lt(t, e) {
554
- let r;
555
- for (; (r = t.next()) !== null; )
556
- switch (r.fieldId) {
553
+ function Ut(t, r) {
554
+ let e;
555
+ for (; (e = t.next()) !== null; )
556
+ switch (e.fieldId) {
557
557
  case It: {
558
- if (r.isNull) throw new Error();
559
- e.StreamId = r.asString();
558
+ if (e.isNull) throw new Error();
559
+ r.StreamId = e.asString();
560
560
  break;
561
561
  }
562
562
  case at: {
563
- if (r.isNull) throw new Error();
564
- e.Framerate = r.asFloat64();
565
- break;
566
- }
567
- case Tt: {
568
- if (r.isNull) throw new Error();
569
- e.Description = r.asString();
563
+ if (e.isNull) throw new Error();
564
+ r.Framerate = e.asFloat64();
570
565
  break;
571
566
  }
572
567
  case At: {
573
- if (r.isNull) throw new Error();
574
- e.CodecDetails = r.asString();
568
+ if (e.isNull) throw new Error();
569
+ r.Description = e.asString();
575
570
  break;
576
571
  }
577
- case Nt: {
578
- if (r.isNull) throw new Error();
579
- e.Height = r.asInt32();
572
+ case Tt: {
573
+ if (e.isNull) throw new Error();
574
+ r.CodecDetails = e.asString();
580
575
  break;
581
576
  }
582
- case ot: {
583
- if (r.isNull) throw new Error();
584
- e.SourceType = r.asString();
577
+ case Nt: {
578
+ if (e.isNull) throw new Error();
579
+ r.Height = e.asInt32();
585
580
  break;
586
581
  }
587
582
  case ft: {
588
- if (r.isNull) throw new Error();
589
- e.Codec = r.asInt32();
583
+ if (e.isNull) throw new Error();
584
+ r.SourceType = e.asString();
590
585
  break;
591
586
  }
592
587
  case Ct: {
593
- if (r.isNull) throw new Error();
594
- e.Width = r.asInt32();
588
+ if (e.isNull) throw new Error();
589
+ r.Codec = e.asInt32();
590
+ break;
591
+ }
592
+ case ot: {
593
+ if (e.isNull) throw new Error();
594
+ r.Width = e.asInt32();
595
595
  break;
596
596
  }
597
597
  }
598
598
  }
599
- async function ct(t, e) {
600
- const r = await k(t, it);
601
- return Rt(r, e);
599
+ async function lt(t, r) {
600
+ const e = await k(t, it);
601
+ return Rt(e, r);
602
602
  }
603
- const Ut = 8388611, St = 271275304, Dt = 2541432218, Lt = 2986785889, yt = 3105403172, gt = 3456383222;
604
- function wt(t) {
605
- const e = {};
606
- return z(e), e;
603
+ const St = 8388611, ct = 271275304, Dt = 2541432218, Lt = 2986785889, yt = 3105403172, Ot = 3456383222;
604
+ function Pt(t) {
605
+ const r = {};
606
+ return z(r), r;
607
607
  }
608
608
  function z(t) {
609
609
  return t.Data = new Uint8Array(0), t.FrameNumber = 0, t.IsKey = !1, t.TimestampInUs = 0n, t.DurationInUs = 0, t;
610
610
  }
611
- function Ot(t, e) {
612
- const r = w.create(t);
613
- return Pt(r, e);
614
- }
615
- function Pt(t, e) {
616
- const r = e ?? wt();
617
- return z(r), mt(t, r), r;
618
- }
619
- function mt(t, e) {
620
- let r;
621
- for (; (r = t.next()) !== null; )
622
- switch (r.fieldId) {
623
- case St: {
624
- if (r.isNull) throw new Error();
625
- e.TimestampInUs = r.asUInt64();
611
+ function gt(t, r) {
612
+ const e = P.create(t);
613
+ return wt(e, r);
614
+ }
615
+ function wt(t, r) {
616
+ const e = r ?? Pt();
617
+ return z(e), mt(t, e), e;
618
+ }
619
+ function mt(t, r) {
620
+ let e;
621
+ for (; (e = t.next()) !== null; )
622
+ switch (e.fieldId) {
623
+ case ct: {
624
+ if (e.isNull) throw new Error();
625
+ r.TimestampInUs = e.asUInt64();
626
626
  break;
627
627
  }
628
628
  case Dt: {
629
- if (r.isNull) throw new Error();
630
- e.DurationInUs = r.asUInt32();
629
+ if (e.isNull) throw new Error();
630
+ r.DurationInUs = e.asUInt32();
631
631
  break;
632
632
  }
633
633
  case Lt: {
634
- if (r.isNull) throw new Error();
635
- e.Data = r.asBinary();
634
+ if (e.isNull) throw new Error();
635
+ r.Data = e.asBinary();
636
636
  break;
637
637
  }
638
638
  case yt: {
639
- if (r.isNull) throw new Error();
640
- e.IsKey = r.asBool();
639
+ if (e.isNull) throw new Error();
640
+ r.IsKey = e.asBool();
641
641
  break;
642
642
  }
643
- case gt: {
644
- if (r.isNull) throw new Error();
645
- e.FrameNumber = r.asInt32();
643
+ case Ot: {
644
+ if (e.isNull) throw new Error();
645
+ r.FrameNumber = e.asInt32();
646
646
  break;
647
647
  }
648
648
  }
649
649
  }
650
- async function dt(t, e) {
651
- const r = await k(t, Ut);
652
- return Ot(r, e);
650
+ async function Ft(t, r) {
651
+ const e = await k(t, St);
652
+ return gt(e, r);
653
653
  }
654
- const Ft = "avc1.42E01E", Mt = "vp8", Vt = "vp09.00.10.08", Gt = "av01.0.04M.08", Bt = 3, S = (t, e) => self.postMessage(t, e ?? []);
655
- let l = null, g = !0;
656
- const A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
654
+ const dt = "avc1.42E01E", Mt = "vp8", Vt = "vp09.00.10.08", Gt = "av01.0.04M.08", Bt = 8, c = (t, r) => self.postMessage(t, r ?? []);
655
+ let U = null, O = !0;
656
+ const T = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
657
657
  function R(t) {
658
- const e = t instanceof Error ? t : new Error(String(t));
659
- S({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
658
+ const r = t instanceof Error ? t : new Error(String(t));
659
+ c({ type: "error", error: { name: r.name, message: r.message, stack: r.stack } });
660
660
  }
661
- function P(t, e) {
662
- return t << 16 | e & 65535;
661
+ function w(t, r) {
662
+ return t << 16 | r & 65535;
663
663
  }
664
664
  function M(t) {
665
- const e = A.get(t);
666
- if (e)
667
- return e;
668
- const r = {
665
+ const r = T.get(t);
666
+ if (r)
667
+ return r;
668
+ const e = {
669
669
  streamId: t,
670
670
  numericKey: 0,
671
671
  watched: !1,
@@ -683,71 +683,71 @@ function M(t) {
683
683
  isReconfiguring: !1,
684
684
  pendingDecodeCount: 0
685
685
  };
686
- return A.set(t, r), r;
686
+ return T.set(t, e), e;
687
687
  }
688
688
  function Y(t) {
689
- if (t === h.H264) return Ft;
689
+ if (t === h.H264) return dt;
690
690
  if (t === h.Vp8) return Mt;
691
691
  if (t === h.Vp9) return Vt;
692
692
  if (t === h.Av1) return Gt;
693
693
  throw new Error(`Unknown codec: ${t}`);
694
694
  }
695
695
  function u(t) {
696
- const e = A.get(t);
697
- if (!e || e.numericKey === 0)
696
+ const r = T.get(t);
697
+ if (!r || r.numericKey === 0)
698
698
  return;
699
- const r = e.numericKey >> 16 & 65535, n = e.numericKey & 65535;
700
- S({ type: "requestIdr", streamId: t, senderId: r, trackId: n });
699
+ const e = r.numericKey >> 16 & 65535, n = r.numericKey & 65535;
700
+ c({ type: "requestIdr", streamId: t, senderId: e, trackId: n });
701
701
  }
702
- async function bt(t, e) {
702
+ async function bt(t, r) {
703
703
  try {
704
- if (!g || !t.watched)
704
+ if (!O || !t.watched)
705
705
  return;
706
706
  if (typeof createImageBitmap == "function") {
707
- const r = await createImageBitmap(e);
708
- S({ type: "frame", streamId: t.streamId, width: t.width, height: t.height, bitmap: r }, [r]);
707
+ const e = await createImageBitmap(r);
708
+ c({ type: "frame", streamId: t.streamId, width: t.width, height: t.height, bitmap: e }, [e]);
709
709
  }
710
- } catch (r) {
711
- R(r);
710
+ } catch (e) {
711
+ R(e);
712
712
  } finally {
713
713
  t.pendingDecodeCount--;
714
714
  try {
715
- e.close();
715
+ r.close();
716
716
  } catch {
717
717
  }
718
718
  }
719
719
  }
720
- async function Ht(t, e, r) {
720
+ async function Ht(t, r, e) {
721
721
  const n = {
722
722
  codec: t,
723
- codedWidth: e > 0 ? e : void 0,
724
- codedHeight: r > 0 ? r : void 0,
723
+ codedWidth: r > 0 ? r : void 0,
724
+ codedHeight: e > 0 ? e : void 0,
725
725
  optimizeForLatency: !0
726
726
  };
727
727
  if (typeof VideoDecoder?.isConfigSupported != "function")
728
728
  return { config: { ...n, hardwareAcceleration: "prefer-hardware" }, isHardwareAccelerated: !0 };
729
729
  const s = { ...n, hardwareAcceleration: "prefer-hardware" };
730
730
  try {
731
- const E = await VideoDecoder.isConfigSupported(s);
732
- if (E.supported)
733
- return { config: E.config ?? s, isHardwareAccelerated: !0 };
731
+ const _ = await VideoDecoder.isConfigSupported(s);
732
+ if (_.supported)
733
+ return { config: _.config ?? s, isHardwareAccelerated: !0 };
734
734
  } catch {
735
735
  }
736
736
  try {
737
- const E = await VideoDecoder.isConfigSupported(n);
738
- if (E.supported)
739
- return { config: E.config ?? n, isHardwareAccelerated: !1 };
737
+ const _ = await VideoDecoder.isConfigSupported(n);
738
+ if (_.supported)
739
+ return { config: _.config ?? n, isHardwareAccelerated: !1 };
740
740
  } catch {
741
741
  }
742
742
  return null;
743
743
  }
744
- function d(t) {
744
+ function F(t) {
745
745
  return new VideoDecoder({
746
- output: (e) => {
747
- if (t.pendingDecodeCount++, !g || !t.watched) {
746
+ output: (r) => {
747
+ if (t.pendingDecodeCount++, !O || !t.watched) {
748
748
  t.pendingDecodeCount--;
749
749
  try {
750
- e.close();
750
+ r.close();
751
751
  } catch {
752
752
  }
753
753
  return;
@@ -755,30 +755,30 @@ function d(t) {
755
755
  if (t.pendingDecodeCount > Bt) {
756
756
  t.pendingDecodeCount--;
757
757
  try {
758
- e.close();
758
+ r.close();
759
759
  } catch {
760
760
  }
761
761
  return;
762
762
  }
763
- const r = t.width, n = t.height;
763
+ const e = t.width, n = t.height;
764
764
  if (t.ctx2d && t.surface) {
765
765
  try {
766
- t.ctx2d.drawImage(e, 0, 0, r, n);
766
+ t.ctx2d.drawImage(r, 0, 0, e, n);
767
767
  } catch (s) {
768
768
  R(s);
769
769
  } finally {
770
770
  t.pendingDecodeCount--;
771
771
  try {
772
- e.close();
772
+ r.close();
773
773
  } catch {
774
774
  }
775
775
  }
776
776
  return;
777
777
  }
778
- bt(t, e);
778
+ bt(t, r);
779
779
  },
780
- error: (e) => {
781
- if (R(e), t.isKeyFrameRequired = !0, t.isReconfiguring = !0, t.decoder && t.decoder.state !== "closed")
780
+ error: (r) => {
781
+ if (R(r), t.isKeyFrameRequired = !0, t.isReconfiguring = !0, t.decoder && t.decoder.state !== "closed")
782
782
  try {
783
783
  t.decoder.close();
784
784
  } catch {
@@ -792,23 +792,23 @@ async function y(t) {
792
792
  t.isReconfiguring = !1;
793
793
  return;
794
794
  }
795
- const e = Y(t.codec);
796
- (!t.decoder || t.decoder.state === "closed") && (t.decoder && (t.decoderCodec = null, t.decoderWidth = 0, t.decoderHeight = 0), t.decoder = d(t));
797
- const r = t.decoderCodec !== null && t.decoderCodec !== e;
798
- if (!(t.decoderCodec !== e || t.decoderWidth !== t.width || t.decoderHeight !== t.height)) {
795
+ const r = Y(t.codec);
796
+ (!t.decoder || t.decoder.state === "closed") && (t.decoder && (t.decoderCodec = null, t.decoderWidth = 0, t.decoderHeight = 0), t.decoder = F(t));
797
+ const e = t.decoderCodec !== null && t.decoderCodec !== r;
798
+ if (!(t.decoderCodec !== r || t.decoderWidth !== t.width || t.decoderHeight !== t.height)) {
799
799
  t.isReconfiguring = !1;
800
800
  return;
801
801
  }
802
- if (t.isReconfiguring = !0, t.decoderCodec = null, r && t.decoder) {
802
+ if (t.isReconfiguring = !0, t.decoderCodec = null, e && t.decoder) {
803
803
  try {
804
804
  t.decoder.close();
805
805
  } catch {
806
806
  }
807
- t.decoder = d(t);
807
+ t.decoder = F(t);
808
808
  }
809
809
  try {
810
- const s = await Ht(e, t.width, t.height);
811
- if (Y(t.codec) !== e) {
810
+ const s = await Ht(r, t.width, t.height);
811
+ if (Y(t.codec) !== r) {
812
812
  if (t.decoder && t.decoder.state !== "closed")
813
813
  try {
814
814
  t.decoder.close();
@@ -818,34 +818,34 @@ async function y(t) {
818
818
  return;
819
819
  }
820
820
  if (!s) {
821
- R(new Error(`Decoder not supported for codec ${e}`));
821
+ R(new Error(`Decoder not supported for codec ${r}`));
822
822
  return;
823
823
  }
824
- (!t.decoder || t.decoder.state === "closed") && (t.decoder = d(t)), t.decoderCodec = e, t.decoderWidth = t.width, t.decoderHeight = t.height;
824
+ (!t.decoder || t.decoder.state === "closed") && (t.decoder = F(t)), t.decoderCodec = r, t.decoderWidth = t.width, t.decoderHeight = t.height;
825
825
  try {
826
826
  t.decoder.configure(s.config), t.isKeyFrameRequired = !0, u(t.streamId);
827
- const _ = s.isHardwareAccelerated ? "hardware" : "software", i = t.framerate > 0 ? `@${Math.round(t.framerate)}fps` : "";
828
- S({ type: "debug", message: `Decoder configured: codec=${e}, ${t.width}x${t.height}${i}, hw=${_}` });
829
- } catch (_) {
830
- R(_);
827
+ const E = s.isHardwareAccelerated ? "hardware" : "software", i = t.framerate > 0 ? `@${Math.round(t.framerate)}fps` : "";
828
+ c({ type: "debug", message: `Decoder configured: codec=${r}, ${t.width}x${t.height}${i}, hw=${E}` });
829
+ } catch (E) {
830
+ R(E);
831
831
  }
832
832
  t.surface && t.ctx2d && t.width > 0 && t.height > 0 && (t.surface.width !== t.width || t.surface.height !== t.height) && (t.surface.width = t.width, t.surface.height = t.height);
833
833
  } finally {
834
834
  t.isReconfiguring = !1;
835
835
  }
836
836
  }
837
- async function Kt(t, e) {
838
- const r = await ct(t), n = r.StreamId, s = P(e.senderId, e.trackId), E = M(n);
839
- E.numericKey = s, E.codec = r.Codec, E.width = r.Width, E.height = r.Height, E.framerate = r.Framerate, C.set(s, n), S({ type: "streamBegin", streamId: n, width: r.Width, height: r.Height, codec: r.Codec }), E.watched ? (E.surface && E.ctx2d && r.Width > 0 && r.Height > 0 && (E.surface.width !== r.Width || E.surface.height !== r.Height) && (E.surface.width = r.Width, E.surface.height = r.Height), y(E)) : E.isReconfiguring = !1;
837
+ async function Kt(t, r) {
838
+ const e = await lt(t), n = e.StreamId, s = w(r.senderId, r.trackId), _ = M(n);
839
+ _.numericKey = s, _.codec = e.Codec, _.width = e.Width, _.height = e.Height, _.framerate = e.Framerate, o.set(s, n), c({ type: "streamBegin", streamId: n, width: e.Width, height: e.Height, codec: e.Codec }), _.watched ? (_.surface && _.ctx2d && e.Width > 0 && e.Height > 0 && (_.surface.width !== e.Width || _.surface.height !== e.Height) && (_.surface.width = e.Width, _.surface.height = e.Height), y(_)) : _.isReconfiguring = !1;
840
840
  }
841
841
  function xt(t) {
842
- const e = P(t.senderId, t.trackId), r = C.get(e);
843
- if (!r)
842
+ const r = w(t.senderId, t.trackId), e = o.get(r);
843
+ if (!e)
844
844
  return;
845
- S({ type: "streamEnd", streamId: r });
846
- const n = A.get(r);
845
+ c({ type: "streamEnd", streamId: e });
846
+ const n = T.get(e);
847
847
  if (!n) {
848
- C.delete(e);
848
+ o.delete(r);
849
849
  return;
850
850
  }
851
851
  if (n.decoder)
@@ -853,36 +853,36 @@ function xt(t) {
853
853
  n.decoder.close();
854
854
  } catch {
855
855
  }
856
- A.delete(r), C.delete(e);
856
+ T.delete(e), o.delete(r);
857
857
  }
858
858
  function $(t) {
859
- const e = A.get(t);
860
- e && (e.surface = null, e.ctx2d = null);
859
+ const r = T.get(t);
860
+ r && (r.surface = null, r.ctx2d = null);
861
861
  }
862
862
  function q(t) {
863
- const e = A.get(t);
864
- if (e) {
865
- if (e.watched = !1, e.isKeyFrameRequired = !0, $(t), e.decoder) {
863
+ const r = T.get(t);
864
+ if (r) {
865
+ if (r.watched = !1, r.isKeyFrameRequired = !0, $(t), r.decoder) {
866
866
  try {
867
- e.decoder.close();
867
+ r.decoder.close();
868
868
  } catch {
869
869
  }
870
- e.decoder = null, e.decoderCodec = null, e.decoderWidth = 0, e.decoderHeight = 0;
870
+ r.decoder = null, r.decoderCodec = null, r.decoderWidth = 0, r.decoderHeight = 0;
871
871
  }
872
- e.isReconfiguring = !1;
872
+ r.isReconfiguring = !1;
873
873
  }
874
874
  }
875
- async function vt(t, e) {
876
- const r = P(e.senderId, e.trackId), n = C.get(r);
875
+ async function vt(t, r) {
876
+ const e = w(r.senderId, r.trackId), n = o.get(e);
877
877
  if (!n)
878
878
  return;
879
- const s = A.get(n);
880
- if (!s || !g || !s.watched || s.isReconfiguring || ((!s.decoder || !s.decoderCodec) && y(s), !s.decoder || !s.decoderCodec))
879
+ const s = T.get(n);
880
+ if (!s || !O || !s.watched || s.isReconfiguring || ((!s.decoder || !s.decoderCodec) && y(s), !s.decoder || !s.decoderCodec))
881
881
  return;
882
- const E = await dt(t);
882
+ const _ = await Ft(t);
883
883
  if (!(s.isReconfiguring || !s.decoder || !s.decoderCodec) && s.decoder.state !== "closed") {
884
884
  if (s.isKeyFrameRequired) {
885
- if (!E.IsKey)
885
+ if (!_.IsKey)
886
886
  return;
887
887
  s.isKeyFrameRequired = !1;
888
888
  }
@@ -891,105 +891,105 @@ async function vt(t, e) {
891
891
  return;
892
892
  s.decoder.decode(
893
893
  new EncodedVideoChunk({
894
- type: E.IsKey ? "key" : "delta",
895
- timestamp: Number(E.TimestampInUs),
896
- duration: E.DurationInUs,
897
- data: E.Data
894
+ type: _.IsKey ? "key" : "delta",
895
+ timestamp: Number(_.TimestampInUs),
896
+ duration: _.DurationInUs,
897
+ data: _.Data
898
898
  })
899
899
  );
900
- } catch (_) {
901
- if (_ instanceof DOMException && _.message.includes("closed"))
900
+ } catch (E) {
901
+ if (E instanceof DOMException && E.message.includes("closed"))
902
902
  return;
903
- s.isKeyFrameRequired = !0, u(s.streamId), R(_);
903
+ s.isKeyFrameRequired = !0, u(s.streamId), R(E);
904
904
  }
905
905
  }
906
906
  }
907
907
  function Yt(t) {
908
- const e = P(t.senderId, t.trackId), r = C.get(e);
909
- if (!r)
908
+ const r = w(t.senderId, t.trackId), e = o.get(r);
909
+ if (!e)
910
910
  return;
911
- const n = A.get(r);
911
+ const n = T.get(e);
912
912
  n && (n.isKeyFrameRequired = !0, n.watched && u(n.streamId));
913
913
  }
914
- function kt(t, e) {
915
- switch (e.opcode) {
914
+ function kt(t, r) {
915
+ switch (r.opcode) {
916
916
  case L.VIDEO_STREAM_BEGIN: {
917
- const r = P(e.senderId, e.trackId), n = C.get(r);
917
+ const e = w(r.senderId, r.trackId), n = o.get(e);
918
918
  if (n) {
919
- const s = A.get(n);
919
+ const s = T.get(n);
920
920
  s && (s.isReconfiguring = !0);
921
921
  }
922
- Kt(t, e);
922
+ Kt(t, r);
923
923
  return;
924
924
  }
925
925
  case L.VIDEO_STREAM_END:
926
- xt(e);
926
+ xt(r);
927
927
  return;
928
928
  case L.VIDEO_FRAME:
929
- vt(t, e);
929
+ vt(t, r);
930
930
  return;
931
931
  case L.VIDEO_INVALIDATE_FRAME:
932
- Yt(e);
932
+ Yt(r);
933
933
  return;
934
934
  default:
935
935
  return;
936
936
  }
937
937
  }
938
938
  function j() {
939
- if (l) {
939
+ if (U) {
940
940
  try {
941
- l.close();
941
+ U.close();
942
942
  } catch {
943
943
  }
944
- l = null;
944
+ U = null;
945
945
  }
946
946
  }
947
947
  function Wt() {
948
948
  j();
949
- for (const t of A.values())
949
+ for (const t of T.values())
950
950
  q(t.streamId);
951
- A.clear(), C.clear();
951
+ T.clear(), o.clear();
952
952
  }
953
953
  self.addEventListener("message", (t) => {
954
- const e = t.data;
955
- if (e.type !== "configure") {
956
- if (e.type === "attachSurface") {
957
- const r = e.streamId, n = M(r);
958
- n.watched = !0, n.surface = e.canvas;
954
+ const r = t.data;
955
+ if (r.type !== "configure") {
956
+ if (r.type === "attachSurface") {
957
+ const e = r.streamId, n = M(e);
958
+ n.watched = !0, n.surface = r.canvas;
959
959
  try {
960
960
  n.ctx2d = n.surface.getContext("2d", { alpha: !1, desynchronized: !0 });
961
961
  } catch (s) {
962
962
  R(s), n.ctx2d = null;
963
963
  }
964
- n.isKeyFrameRequired = !0, y(n), u(r);
964
+ n.isKeyFrameRequired = !0, y(n), u(e);
965
965
  return;
966
966
  }
967
- if (e.type === "detachSurface") {
968
- $(e.streamId);
967
+ if (r.type === "detachSurface") {
968
+ $(r.streamId);
969
969
  return;
970
970
  }
971
- if (e.type === "attachProtocolPort") {
972
- j(), l = e.port, l.addEventListener("message", (r) => {
973
- const n = r.data;
971
+ if (r.type === "attachProtocolPort") {
972
+ j(), U = r.port, U.addEventListener("message", (e) => {
973
+ const n = e.data;
974
974
  n?.type === "protocol" && n.message instanceof ArrayBuffer && n.headers && kt(new Uint8Array(n.message), n.headers);
975
- }), l.start?.();
975
+ }), U.start?.();
976
976
  return;
977
977
  }
978
- if (e.type === "watchStream") {
979
- const r = M(e.streamId);
980
- r.watched = !0, r.isKeyFrameRequired = !0, y(r), u(r.streamId);
978
+ if (r.type === "watchStream") {
979
+ const e = M(r.streamId);
980
+ e.watched = !0, e.isKeyFrameRequired = !0, y(e), u(e.streamId);
981
981
  return;
982
982
  }
983
- if (e.type === "unwatchStream") {
984
- q(e.streamId);
983
+ if (r.type === "unwatchStream") {
984
+ q(r.streamId);
985
985
  return;
986
986
  }
987
- if (e.type === "setEnabled") {
988
- if (g = e.enabled, g)
989
- for (const r of A.values())
990
- r.watched && (r.isKeyFrameRequired = !0, y(r), u(r.streamId));
987
+ if (r.type === "setEnabled") {
988
+ if (O = r.enabled, O)
989
+ for (const e of T.values())
990
+ e.watched && (e.isKeyFrameRequired = !0, y(e), u(e.streamId));
991
991
  return;
992
992
  }
993
- e.type === "dispose" && Wt();
993
+ r.type === "dispose" && Wt();
994
994
  }
995
995
  });