@ikonai/sdk-ui 1.0.79 → 1.1.0

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.
@@ -1,2867 +0,0 @@
1
- const it = {
2
- Compressed: 8
3
- };
4
- function ot(e) {
5
- if (e.length < 8)
6
- throw new Error("Protocol message too short");
7
- return (e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24) >>> 0;
8
- }
9
- function re(e) {
10
- const r = W(e), t = new DataView(r.buffer, r.byteOffset, r.byteLength);
11
- if (r.length < 27)
12
- throw new Error("Protocol payload too short");
13
- const s = t.getUint32(0, !0), n = t.getUint32(4, !0), i = t.getUint32(8, !0), o = t.getUint32(12, !0), a = t.getUint32(16, !0), I = t.getUint32(20, !0), _ = t.getUint8(24), E = t.getUint8(25), l = t.getUint8(26);
14
- if (27 + I * 4 > r.length)
15
- throw new Error("Protocol header exceeds payload length");
16
- const L = [];
17
- let y = 27;
18
- for (let Q = 0; Q < I; Q++)
19
- L.push(t.getUint32(y, !0)), y += 4;
20
- return {
21
- length: s,
22
- opcode: n,
23
- senderId: i,
24
- trackId: o,
25
- sequenceId: a,
26
- targetIds: L,
27
- payloadVersion: _,
28
- payloadType: E,
29
- flags: l
30
- };
31
- }
32
- async function X(e, r, t) {
33
- const s = W(e), n = re(s);
34
- if (r !== void 0 && n.opcode !== r)
35
- throw new Error(`Unexpected opcode ${n.opcode}`);
36
- if (n.payloadType !== 8)
37
- throw new Error(`Unexpected payload type ${n.payloadType}`);
38
- const i = 27 + n.targetIds.length * 4;
39
- let o = s.subarray(i, n.length);
40
- return (n.flags & it.Compressed) !== 0 && (o = await at(o)), o;
41
- }
42
- async function at(e) {
43
- if (typeof DecompressionStream > "u")
44
- throw new Error("DecompressionStream not supported");
45
- const r = new DecompressionStream("gzip"), t = r.writable.getWriter(), s = new Uint8Array(e);
46
- t.write(s), t.close();
47
- const n = r.readable.getReader(), i = [];
48
- let o = 0;
49
- for (; ; ) {
50
- const { done: _, value: E } = await n.read();
51
- if (_) break;
52
- i.push(E), o += E.length;
53
- }
54
- const a = new Uint8Array(o);
55
- let I = 0;
56
- for (let _ = 0; _ < i.length; _++)
57
- a.set(i[_], I), I += i[_].length;
58
- return a;
59
- }
60
- var v = /* @__PURE__ */ ((e) => (e[e.Null = 1] = "Null", e[e.Bool = 2] = "Bool", e[e.Int32 = 3] = "Int32", e[e.Int64 = 4] = "Int64", e[e.UInt32 = 5] = "UInt32", e[e.UInt64 = 6] = "UInt64", e[e.Float32 = 7] = "Float32", e[e.Float64 = 8] = "Float64", e[e.Array = 9] = "Array", e[e.Dict = 10] = "Dict", e[e.Object = 11] = "Object", e[e.String = 12] = "String", e[e.Binary = 13] = "Binary", e[e.Guid = 14] = "Guid", e))(v || {});
61
- const Et = 161, It = 162;
62
- new TextEncoder();
63
- const _t = new TextDecoder("utf-8", { fatal: !0 });
64
- class g {
65
- constructor(r, t, s) {
66
- this.buffer = r, this.version = t, this.offset = s, this.end = r.length - 1;
67
- }
68
- offset;
69
- end;
70
- static create(r) {
71
- const t = W(r);
72
- if (t.length < 2)
73
- throw new Error("Teleport payload too short");
74
- if (t[0] !== Et || t[t.length - 1] !== It)
75
- throw new Error("Teleport object missing markers");
76
- const s = { offset: 1 }, n = S(t, s, "InvalidLength");
77
- return new g(t, n, s.offset);
78
- }
79
- next() {
80
- if (this.offset >= this.end)
81
- return null;
82
- if (this.offset + 5 > this.buffer.length)
83
- throw new Error("Teleport object truncated");
84
- const r = ut(this.buffer, this.offset);
85
- this.offset += 4;
86
- const t = this.buffer[this.offset++], s = t >> 4 & 15;
87
- if ((t & 15) !== 0)
88
- throw new Error("Teleport field flags must be zero");
89
- const n = k(s);
90
- let i;
91
- if (n >= 0)
92
- A(this.buffer, this.offset, n), i = this.buffer.subarray(this.offset, this.offset + n), this.offset += n;
93
- else {
94
- const o = { offset: this.offset }, a = S(this.buffer, o, "InvalidLength");
95
- A(this.buffer, o.offset, a), i = this.buffer.subarray(o.offset, o.offset + a), this.offset = o.offset + a;
96
- }
97
- return new lt(r, s, i);
98
- }
99
- }
100
- class U {
101
- constructor(r, t) {
102
- this.type = r, this.payload = t;
103
- }
104
- asInt32() {
105
- return this.ensureType(
106
- 3
107
- /* Int32 */
108
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getInt32(0, !0);
109
- }
110
- asUInt32() {
111
- return this.ensureType(
112
- 5
113
- /* UInt32 */
114
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getUint32(0, !0);
115
- }
116
- asInt64() {
117
- return this.ensureType(
118
- 4
119
- /* Int64 */
120
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigInt64(0, !0);
121
- }
122
- asUInt64() {
123
- return this.ensureType(
124
- 6
125
- /* UInt64 */
126
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigUint64(0, !0);
127
- }
128
- asFloat32() {
129
- return this.ensureType(
130
- 7
131
- /* Float32 */
132
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getFloat32(0, !0);
133
- }
134
- asFloat64() {
135
- return this.ensureType(
136
- 8
137
- /* Float64 */
138
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getFloat64(0, !0);
139
- }
140
- asBool() {
141
- return this.ensureType(
142
- 2
143
- /* Bool */
144
- ), this.payload.length > 0 && this.payload[0] !== 0;
145
- }
146
- asBinary() {
147
- return this.ensureType(
148
- 13
149
- /* Binary */
150
- ), this.payload;
151
- }
152
- asUtf8() {
153
- return this.ensureType(
154
- 12
155
- /* String */
156
- ), this.payload;
157
- }
158
- asString() {
159
- return this.ensureType(
160
- 12
161
- /* String */
162
- ), _t.decode(this.payload);
163
- }
164
- asGuid() {
165
- return this.ensureType(
166
- 14
167
- /* Guid */
168
- ), h.fromBytes(this.payload);
169
- }
170
- asObject() {
171
- return this.ensureType(
172
- 11
173
- /* Object */
174
- ), g.create(this.payload);
175
- }
176
- asArray() {
177
- return this.ensureType(
178
- 9
179
- /* Array */
180
- ), se.create(this.payload);
181
- }
182
- asDictionary() {
183
- return this.ensureType(
184
- 10
185
- /* Dict */
186
- ), ne.create(this.payload);
187
- }
188
- ensureType(r) {
189
- if (this.type !== r)
190
- throw new Error(`Teleport value has type ${v[this.type]}, expected ${v[r]}`);
191
- }
192
- }
193
- class lt extends U {
194
- constructor(r, t, s) {
195
- super(t, s), this.fieldId = r;
196
- }
197
- get isNull() {
198
- return this.type === 1;
199
- }
200
- }
201
- class se {
202
- payload;
203
- elementType;
204
- count;
205
- offset;
206
- index = 0;
207
- constructor(r) {
208
- if (this.payload = r, r.length === 0)
209
- throw new Error("Array payload too short");
210
- const t = r[0];
211
- if (this.elementType = t >> 4 & 15, (t & 15) !== 0)
212
- throw new Error("Array flags must be zero");
213
- const s = { offset: 1 };
214
- this.count = S(r, s, "ArrayMalformed"), this.offset = s.offset;
215
- }
216
- static create(r) {
217
- return new se(W(r));
218
- }
219
- next() {
220
- if (this.index >= this.count) {
221
- if (this.offset !== this.payload.length)
222
- throw new Error("Array payload contains trailing data");
223
- return null;
224
- }
225
- const r = this.readValue();
226
- return this.index++, r;
227
- }
228
- readValue() {
229
- switch (this.elementType) {
230
- case 3:
231
- case 5:
232
- case 7:
233
- case 8:
234
- case 2:
235
- case 4:
236
- case 6:
237
- case 14: {
238
- const r = k(this.elementType);
239
- A(this.payload, this.offset, r);
240
- const t = this.payload.subarray(this.offset, this.offset + r);
241
- return this.offset += r, new B(this.elementType, t);
242
- }
243
- case 12:
244
- case 13: {
245
- const r = { offset: this.offset }, t = S(this.payload, r, "ArrayMalformed");
246
- A(this.payload, r.offset, t);
247
- const s = this.payload.subarray(r.offset, r.offset + t);
248
- return this.offset = r.offset + t, new B(this.elementType, s);
249
- }
250
- case 11: {
251
- const r = { offset: this.offset }, t = S(this.payload, r, "ArrayMalformed");
252
- A(this.payload, r.offset, t);
253
- const s = this.payload.subarray(r.offset, r.offset + t);
254
- return this.offset = r.offset + t, new B(11, s);
255
- }
256
- case 9: {
257
- const r = ie(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
258
- return this.offset += r, new B(9, t);
259
- }
260
- case 10: {
261
- const r = oe(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
262
- return this.offset += r, new B(10, t);
263
- }
264
- default:
265
- throw new Error(`Unsupported array element type ${v[this.elementType]}`);
266
- }
267
- }
268
- }
269
- class B extends U {
270
- constructor(r, t) {
271
- super(r, t);
272
- }
273
- }
274
- class ne {
275
- payload;
276
- keyType;
277
- valueType;
278
- count;
279
- offset;
280
- index = 0;
281
- constructor(r) {
282
- if (this.payload = r, r.length < 2)
283
- throw new Error("Dictionary payload too short");
284
- if (this.keyType = r[0] >> 4 & 15, this.valueType = r[1] >> 4 & 15, (r[0] & 15) !== 0 || (r[1] & 15) !== 0)
285
- throw new Error("Dictionary key/value flags must be zero");
286
- le(this.keyType);
287
- const t = { offset: 2 };
288
- this.count = S(r, t, "DictMalformed"), this.offset = t.offset;
289
- }
290
- static create(r) {
291
- return new ne(W(r));
292
- }
293
- next() {
294
- if (this.index >= this.count) {
295
- if (this.offset !== this.payload.length)
296
- throw new Error("Dictionary payload contains trailing data");
297
- return null;
298
- }
299
- const r = this.readKey(), t = this.readValue();
300
- return this.index++, new ct(r, t);
301
- }
302
- readKey() {
303
- const r = k(this.keyType);
304
- if (r >= 0) {
305
- A(this.payload, this.offset, r);
306
- const t = this.payload.subarray(this.offset, this.offset + r);
307
- return this.offset += r, new U(this.keyType, t);
308
- }
309
- if (this.keyType === 12 || this.keyType === 13) {
310
- const t = { offset: this.offset }, s = S(this.payload, t, "DictMalformed");
311
- A(this.payload, t.offset, s);
312
- const n = this.payload.subarray(t.offset, t.offset + s);
313
- return this.offset = t.offset + s, new U(this.keyType, n);
314
- }
315
- throw new Error("Unsupported dictionary key type");
316
- }
317
- readValue() {
318
- switch (this.valueType) {
319
- case 12:
320
- case 13: {
321
- const r = { offset: this.offset }, t = S(this.payload, r, "DictMalformed");
322
- A(this.payload, r.offset, t);
323
- const s = this.payload.subarray(r.offset, r.offset + t);
324
- return this.offset = r.offset + t, new U(this.valueType, s);
325
- }
326
- case 11: {
327
- const r = { offset: this.offset }, t = S(this.payload, r, "DictMalformed");
328
- A(this.payload, r.offset, t);
329
- const s = this.payload.subarray(r.offset, r.offset + t);
330
- return this.offset = r.offset + t, new U(11, s);
331
- }
332
- case 9: {
333
- const r = ie(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
334
- return this.offset += r, new U(9, t);
335
- }
336
- case 10: {
337
- const r = oe(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
338
- return this.offset += r, new U(10, t);
339
- }
340
- case 3:
341
- case 5:
342
- case 7:
343
- case 8:
344
- case 2:
345
- case 4:
346
- case 6:
347
- case 14:
348
- case 1: {
349
- const r = k(this.valueType);
350
- A(this.payload, this.offset, r);
351
- const t = this.payload.subarray(this.offset, this.offset + r);
352
- return this.offset += r, new U(this.valueType, t);
353
- }
354
- default:
355
- throw new Error(`Unsupported dictionary value type ${v[this.valueType]}`);
356
- }
357
- }
358
- }
359
- class ct {
360
- constructor(r, t) {
361
- this.key = r, this.value = t;
362
- }
363
- }
364
- class h {
365
- constructor(r) {
366
- this.bytes = r;
367
- }
368
- static fromString(r) {
369
- if (!r)
370
- throw new Error("Guid string is empty");
371
- const t = r.replace(/-/g, "");
372
- if (t.length !== 32)
373
- throw new Error("Guid string must be 32 hex characters");
374
- const s = new Uint8Array(16), n = h.parseHexSlice(t, 0, 8), i = h.parseHexSlice(t, 8, 4), o = h.parseHexSlice(t, 12, 4);
375
- h.writeUInt32LE(s, 0, n), h.writeUInt16LE(s, 4, i), h.writeUInt16LE(s, 6, o);
376
- for (let a = 0; a < 8; a++)
377
- s[8 + a] = h.parseHexSlice(t, 16 + a * 2, 2);
378
- return new h(s);
379
- }
380
- static fromBytes(r) {
381
- if (r.length !== 16)
382
- throw new Error("Guid byte array must be 16 bytes");
383
- return new h(Uint8Array.from(r));
384
- }
385
- static createZero() {
386
- return new h(new Uint8Array(16));
387
- }
388
- static createRandom() {
389
- const r = new Uint8Array(16), t = globalThis.crypto;
390
- if (t?.getRandomValues)
391
- t.getRandomValues(r);
392
- else
393
- for (let s = 0; s < r.length; s++)
394
- r[s] = Math.floor(Math.random() * 256);
395
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, new h(r);
396
- }
397
- toString() {
398
- const r = this.bytes;
399
- return [
400
- h.toHex(h.readUInt32LE(r, 0), 8),
401
- h.toHex(h.readUInt16LE(r, 4), 4),
402
- h.toHex(h.readUInt16LE(r, 6), 4),
403
- Ee(r.subarray(8, 10)),
404
- Ee(r.subarray(10, 16))
405
- ].join("-");
406
- }
407
- asBytes() {
408
- return this.bytes.slice();
409
- }
410
- static parseHexSlice(r, t, s) {
411
- const n = r.substr(t, s), i = Number.parseInt(n, 16);
412
- if (Number.isNaN(i))
413
- throw new Error("Guid string contains invalid characters");
414
- return i >>> 0;
415
- }
416
- static writeUInt32LE(r, t, s) {
417
- const n = s >>> 0;
418
- r[t] = n & 255, r[t + 1] = n >>> 8 & 255, r[t + 2] = n >>> 16 & 255, r[t + 3] = n >>> 24 & 255;
419
- }
420
- static writeUInt16LE(r, t, s) {
421
- const n = s & 65535;
422
- r[t] = n & 255, r[t + 1] = n >>> 8 & 255;
423
- }
424
- static readUInt32LE(r, t) {
425
- return (r[t] | r[t + 1] << 8 | r[t + 2] << 16 | r[t + 3] << 24) >>> 0;
426
- }
427
- static readUInt16LE(r, t) {
428
- return (r[t] | r[t + 1] << 8) & 65535;
429
- }
430
- static toHex(r, t) {
431
- return (r >>> 0).toString(16).padStart(t, "0");
432
- }
433
- }
434
- function S(e, r, t) {
435
- if (r.offset >= e.length)
436
- throw new Error(t);
437
- let s = 0, n = 0, i = 0;
438
- for (; r.offset < e.length; ) {
439
- const o = e[r.offset++];
440
- if (i++, s |= (o & 127) << n, (o & 128) === 0) {
441
- if (i !== ft(s))
442
- throw new Error("Teleport VarUInt is not canonical");
443
- return s >>> 0;
444
- }
445
- if (n += 7, n >= 35)
446
- throw new Error("Teleport VarUInt exceeds 32-bit range");
447
- }
448
- throw new Error(t);
449
- }
450
- function ft(e) {
451
- return e < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5;
452
- }
453
- function k(e) {
454
- switch (e) {
455
- case 3:
456
- case 5:
457
- case 7:
458
- return 4;
459
- case 4:
460
- case 6:
461
- case 8:
462
- return 8;
463
- case 14:
464
- return 16;
465
- case 2:
466
- return 1;
467
- case 1:
468
- return 0;
469
- default:
470
- return -1;
471
- }
472
- }
473
- function le(e) {
474
- if (e === 9 || e === 11 || e === 10 || e === 1)
475
- throw new Error("Dictionary keys must be primitive Teleport types");
476
- }
477
- function A(e, r, t) {
478
- if (r < 0 || t < 0 || r + t > e.length)
479
- throw new Error("Teleport payload exceeds bounds");
480
- }
481
- function ut(e, r) {
482
- return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
483
- }
484
- function ie(e, r) {
485
- if (r >= e.length)
486
- throw new Error("Array payload exceeds bounds");
487
- const t = e[r], s = t >> 4 & 15;
488
- if ((t & 15) !== 0)
489
- throw new Error("Array flags must be zero");
490
- const n = { offset: r + 1 }, i = S(e, n, "ArrayMalformed"), o = k(s);
491
- if (o >= 0) {
492
- const I = o * i;
493
- return A(e, n.offset, I), n.offset + I - r;
494
- }
495
- let a = n.offset;
496
- for (let I = 0; I < i; I++)
497
- a = Z(s, e, a, "ArrayMalformed");
498
- return a - r;
499
- }
500
- function oe(e, r) {
501
- if (r + 2 > e.length)
502
- throw new Error("Dictionary payload too short");
503
- const t = e[r] >> 4 & 15, s = e[r + 1] >> 4 & 15;
504
- if ((e[r] & 15) !== 0 || (e[r + 1] & 15) !== 0)
505
- throw new Error("Dictionary key/value flags must be zero");
506
- le(t);
507
- const n = { offset: r + 2 }, i = S(e, n, "DictMalformed");
508
- let o = n.offset;
509
- for (let a = 0; a < i; a++)
510
- o = Z(t, e, o, "DictMalformed"), o = Z(s, e, o, "DictMalformed");
511
- return o - r;
512
- }
513
- function Z(e, r, t, s) {
514
- const n = k(e);
515
- if (n >= 0)
516
- return A(r, t, n), t + n;
517
- switch (e) {
518
- case 12:
519
- case 13: {
520
- const i = { offset: t }, o = S(r, i, s);
521
- return A(r, i.offset, o), i.offset + o;
522
- }
523
- case 11: {
524
- const i = { offset: t }, o = S(r, i, s);
525
- return A(r, i.offset, o), i.offset + o;
526
- }
527
- case 9:
528
- return t + ie(r, t);
529
- case 10:
530
- return t + oe(r, t);
531
- default:
532
- throw new Error(`Unsupported Teleport type ${v[e]}`);
533
- }
534
- }
535
- function Ee(e) {
536
- return Array.from(e).map((r) => r.toString(16).padStart(2, "0")).join("");
537
- }
538
- function W(e) {
539
- return e instanceof Uint8Array ? e : new Uint8Array(e);
540
- }
541
- var ce = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Opus = 1] = "Opus", e[e.Mp3 = 2] = "Mp3", e[e.RawPcm16 = 3] = "RawPcm16", e))(ce || {}), fe = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.MobileWeb = 1] = "MobileWeb", e[e.MobileApp = 2] = "MobileApp", e[e.DesktopWeb = 3] = "DesktopWeb", e[e.DesktopApp = 4] = "DesktopApp", e))(fe || {}), ue = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Backend = 2] = "Backend", e[e.Server = 4] = "Server", e[e.Plugin = 8] = "Plugin", e[e.Browser = 16] = "Browser", e[e.Native = 32] = "Native", e))(ue || {}), Te = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.MessagePack = 1] = "MessagePack", e[e.MemoryPack = 2] = "MemoryPack", e[e.Json = 4] = "Json", e[e.Teleport = 8] = "Teleport", e[e.All = 15] = "All", e))(Te || {}), he = /* @__PURE__ */ ((e) => (e[e.Face = 0] = "Face", e[e.Hands = 1] = "Hands", e[e.Pose = 2] = "Pose", e[e.All = 3] = "All", e))(he || {}), Ne = /* @__PURE__ */ ((e) => (e[e.Css = 0] = "Css", e[e.Flutter = 1] = "Flutter", e))(Ne || {}), Ae = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Machine = 1] = "Machine", e[e.Human = 2] = "Human", e))(Ae || {}), Se = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.H264 = 1] = "H264", e[e.Vp8 = 2] = "Vp8", e[e.Vp9 = 3] = "Vp9", e[e.Av1 = 4] = "Av1", e))(Se || {}), Ce = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.DotNet = 1] = "DotNet", e[e.TypeScript = 2] = "TypeScript", e[e.Cpp = 3] = "Cpp", e[e.Dart = 4] = "Dart", e[e.Rust = 5] = "Rust", e))(Ce || {}), Re = /* @__PURE__ */ ((e) => (e[e.Local = 0] = "Local", e[e.Cloud = 1] = "Cloud", e))(Re || {}), de = /* @__PURE__ */ ((e) => (e[e.Bundle = 0] = "Bundle", e[e.GitSource = 1] = "GitSource", e))(de || {}), F = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", e[e.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", e[e.GROUP_CORE = 65536] = "GROUP_CORE", e[e.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", e[e.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", e[e.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", e[e.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", e[e.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", e[e.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", e[e.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", e[e.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", e[e.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", e[e.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", e[e.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", e[e.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", e[e.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", e[e.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", e[e.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", e[e.CORE_SERVER_START = 65552] = "CORE_SERVER_START", e[e.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", e[e.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", e[e.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", e[e.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", e[e.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", e[e.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", e[e.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", e[e.CORE_RESET_IDLE = 65560] = "CORE_RESET_IDLE", e[e.CORE_CLIENT_DISCONNECTING = 65561] = "CORE_CLIENT_DISCONNECTING", e[e.CORE_ON_APP_READY = 65562] = "CORE_ON_APP_READY", e[e.CORE_ON_FRONTEND_RELOADED = 65563] = "CORE_ON_FRONTEND_RELOADED", e[e.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", e[e.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", e[e.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", e[e.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", e[e.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", e[e.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", e[e.CORE_WEBRTC_VIDEO_CAPTURE = 65572] = "CORE_WEBRTC_VIDEO_CAPTURE", e[e.CORE_WEBRTC_ICE_SERVERS_REQUEST = 65573] = "CORE_WEBRTC_ICE_SERVERS_REQUEST", e[e.CORE_WEBRTC_ICE_SERVERS_RESPONSE = 65574] = "CORE_WEBRTC_ICE_SERVERS_RESPONSE", e[e.CORE_WEBRTC_CLOSE = 65575] = "CORE_WEBRTC_CLOSE", e[e.CORE_RELAY_AGENT_AUTH = 65576] = "CORE_RELAY_AGENT_AUTH", e[e.CORE_RELAY_AGENT_AUTH_RESULT = 65577] = "CORE_RELAY_AGENT_AUTH_RESULT", e[e.CORE_RELAY_HEARTBEAT = 65578] = "CORE_RELAY_HEARTBEAT", e[e.CORE_RELAY_TCP_CONNECTION_OPENED = 65579] = "CORE_RELAY_TCP_CONNECTION_OPENED", e[e.CORE_RELAY_TCP_CONNECTION_CLOSED = 65580] = "CORE_RELAY_TCP_CONNECTION_CLOSED", e[e.CORE_RELAY_TCP_DATA = 65581] = "CORE_RELAY_TCP_DATA", e[e.CORE_RELAY_UDP_DATA = 65582] = "CORE_RELAY_UDP_DATA", e[e.CORE_RELAY_ADD_TUNNEL = 65583] = "CORE_RELAY_ADD_TUNNEL", e[e.CORE_RELAY_TUNNEL_ADDED = 65584] = "CORE_RELAY_TUNNEL_ADDED", e[e.CORE_RELAY_REMOVE_TUNNEL = 65585] = "CORE_RELAY_REMOVE_TUNNEL", e[e.CORE_IKON_SERVER_ENDPOINT_HOST_INFO = 65586] = "CORE_IKON_SERVER_ENDPOINT_HOST_INFO", e[e.CORE_CLIENT_INITIALIZATION = 65587] = "CORE_CLIENT_INITIALIZATION", e[e.CORE_CLIENT_LIFECYCLE_BATCH = 65588] = "CORE_CLIENT_LIFECYCLE_BATCH", e[e.CORE_APP_CONFIG = 65589] = "CORE_APP_CONFIG", e[e.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", e[e.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", e[e.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", e[e.GROUP_EVENTS = 262144] = "GROUP_EVENTS", e[e.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", e[e.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", e[e.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", e[e.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", e[e.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", e[e.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", e[e.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", e[e.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", e[e.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", e[e.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", e[e.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", e[e.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", e[e.ANALYTICS_IKON_RELAY_SERVER_STATS = 524297] = "ANALYTICS_IKON_RELAY_SERVER_STATS", e[e.ANALYTICS_IKON_TURN_SERVER_STATS = 524298] = "ANALYTICS_IKON_TURN_SERVER_STATS", e[e.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", e[e.ACTION_CALL = 1048577] = "ACTION_CALL", e[e.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", e[e.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", e[e.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", e[e.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", e[e.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", e[e.ACTION_TAP = 1048583] = "ACTION_TAP", e[e.ACTION_PAN = 1048584] = "ACTION_PAN", e[e.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", e[e.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", e[e.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", e[e.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", e[e.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", e[e.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", e[e.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", e[e.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", e[e.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", e[e.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", e[e.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", e[e.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", e[e.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", e[e.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", e[e.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", e[e.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", e[e.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", e[e.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", e[e.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", e[e.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", e[e.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", e[e.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", e[e.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", e[e.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", e[e.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", e[e.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", e[e.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", e[e.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", e[e.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", e[e.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", e[e.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", e[e.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", e[e.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", e[e.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", e[e.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", e[e.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", e[e.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", e[e.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", e[e.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", e[e.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", e[e.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", e[e.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", e[e.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", e[e.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", e[e.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", e[e.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", e[e.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", e[e.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", e[e.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", e[e.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", e[e.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", e[e.ACTION_CALL2 = 1048637] = "ACTION_CALL2", e[e.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", e[e.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", e[e.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", e[e.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", e[e.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", e[e.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", e[e.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", e[e.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", e[e.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", e[e.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", e[e.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", e[e.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", e[e.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", e[e.ACTION_FUNCTION_ENUMERATION_ITEM_BATCH = 1048651] = "ACTION_FUNCTION_ENUMERATION_ITEM_BATCH", e[e.ACTION_CALL_ACK = 1048652] = "ACTION_CALL_ACK", e[e.ACTION_TRIGGER_CRON = 1048653] = "ACTION_TRIGGER_CRON", e[e.ACTION_RESULT = 1048654] = "ACTION_RESULT", e[e.UI_RESYNC_REQUEST = 1048655] = "UI_RESYNC_REQUEST", e[e.GROUP_UI = 2097152] = "GROUP_UI", e[e.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", e[e.UI_STREAM_END = 2097154] = "UI_STREAM_END", e[e.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", e[e.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", e[e.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", e[e.UI_SECTION_END = 2097158] = "UI_SECTION_END", e[e.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", e[e.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", e[e.UI_LIST_END = 2097161] = "UI_LIST_END", e[e.UI_TEXT = 2097162] = "UI_TEXT", e[e.UI_HEADER = 2097163] = "UI_HEADER", e[e.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", e[e.UI_BUTTON = 2097165] = "UI_BUTTON", e[e.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", e[e.UI_IMAGE = 2097167] = "UI_IMAGE", e[e.UI_FILE = 2097168] = "UI_FILE", e[e.UI_BADGE = 2097169] = "UI_BADGE", e[e.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", e[e.UI_MAP = 2097171] = "UI_MAP", e[e.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", e[e.UI_ICON = 2097173] = "UI_ICON", e[e.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", e[e.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", e[e.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", e[e.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", e[e.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", e[e.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", e[e.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", e[e.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", e[e.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", e[e.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", e[e.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", e[e.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", e[e.UI_QS = 2097186] = "UI_QS", e[e.UI_ELEMENT = 2097187] = "UI_ELEMENT", e[e.UI_STYLES = 2097188] = "UI_STYLES", e[e.UI_SVG = 2097189] = "UI_SVG", e[e.UI_UPDATE = 2097190] = "UI_UPDATE", e[e.UI_INIT = 2097191] = "UI_INIT", e[e.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", e[e.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", e[e.GROUP_COMMON = 4128768] = "GROUP_COMMON", e[e.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", e[e.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", e[e.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", e[e.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", e[e.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", e[e.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", e[e.AUDIO_SHAPE_FRAME = 4194310] = "AUDIO_SHAPE_FRAME", e[e.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", e[e.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", e[e.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", e[e.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", e[e.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", e[e.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", e[e.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", e[e.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", e[e.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", e[e.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", e[e.GROUP_SCENE = 33554432] = "GROUP_SCENE", e[e.SCENE_MESH = 33554433] = "SCENE_MESH", e[e.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", e[e.GROUP_ALL = 67043328] = "GROUP_ALL", e[e.GROUP_APP_LOCAL = 1073741824] = "GROUP_APP_LOCAL", e[e.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", e))(F || {});
542
- const Tt = 161083277, ht = 265814330, Nt = 1368629611, At = 2431514951, St = 2514959030, Ct = 2745379226, Rt = 3282782683, dt = 3284746250, Dt = 4101844078;
543
- function De(e) {
544
- const r = {};
545
- return we(r), r;
546
- }
547
- function we(e) {
548
- return e.StreamId = "", e.Description = "", e.SourceType = "", e.Codec = ce.Unknown, e.CodecDetails = "", e.SampleRate = 0, e.Channels = 0, e.ShapeSets = void 0, e.CorrelationId = void 0, e;
549
- }
550
- function wt(e, r) {
551
- const t = r ?? De();
552
- return we(t), yt(e, t), t;
553
- }
554
- function yt(e, r) {
555
- let t;
556
- for (; (t = e.next()) !== null; )
557
- switch (t.fieldId) {
558
- case Tt: {
559
- if (t.isNull) throw new Error();
560
- r.StreamId = t.asString();
561
- break;
562
- }
563
- case ht: {
564
- if (t.isNull) {
565
- r.ShapeSets = void 0;
566
- break;
567
- }
568
- r.ShapeSets = Lt(t.asArray());
569
- break;
570
- }
571
- case Nt: {
572
- if (t.isNull) throw new Error();
573
- r.Description = t.asString();
574
- break;
575
- }
576
- case At: {
577
- if (t.isNull) throw new Error();
578
- r.Channels = t.asInt32();
579
- break;
580
- }
581
- case St: {
582
- if (t.isNull) {
583
- r.CorrelationId = void 0;
584
- break;
585
- }
586
- r.CorrelationId = t.asString();
587
- break;
588
- }
589
- case Ct: {
590
- if (t.isNull) throw new Error();
591
- r.CodecDetails = t.asString();
592
- break;
593
- }
594
- case Rt: {
595
- if (t.isNull) throw new Error();
596
- r.SourceType = t.asString();
597
- break;
598
- }
599
- case dt: {
600
- if (t.isNull) throw new Error();
601
- r.Codec = t.asInt32();
602
- break;
603
- }
604
- case Dt: {
605
- if (t.isNull) throw new Error();
606
- r.SampleRate = t.asInt32();
607
- break;
608
- }
609
- }
610
- }
611
- function Lt(e) {
612
- const r = [];
613
- let t;
614
- for (; (t = e.next()) !== null; )
615
- r.push(gt(t.asObject()));
616
- return r;
617
- }
618
- const Ut = 1107713536, Ot = 1154362099, mt = 1185721362;
619
- function Pt(e) {
620
- const r = {};
621
- return ye(r), r;
622
- }
623
- function ye(e) {
624
- return e.SetId = 0, e.Name = "", e.ShapeNames = [], e;
625
- }
626
- function gt(e, r) {
627
- const t = r ?? Pt();
628
- return ye(t), Ft(e, t), t;
629
- }
630
- function Ft(e, r) {
631
- let t;
632
- for (; (t = e.next()) !== null; )
633
- switch (t.fieldId) {
634
- case Ut: {
635
- if (t.isNull) throw new Error();
636
- r.Name = t.asString();
637
- break;
638
- }
639
- case Ot: {
640
- if (t.isNull) throw new Error();
641
- r.SetId = t.asUInt32();
642
- break;
643
- }
644
- case mt: {
645
- if (t.isNull) throw new Error();
646
- r.ShapeNames = bt(t.asArray());
647
- break;
648
- }
649
- }
650
- }
651
- function bt(e) {
652
- const r = [];
653
- let t;
654
- for (; (t = e.next()) !== null; )
655
- r.push(t.asString());
656
- return r;
657
- }
658
- const Mt = 76337612, vt = 185396121, kt = 250031587, Gt = 388632637, Bt = 417197284, Vt = 425972532, xt = 469070965, Ht = 470595159, pt = 594855258, Yt = 617065367, Kt = 661691032, $t = 781727218, Xt = 834078886, Wt = 1043273762, jt = 1236999138, zt = 1286979607, Jt = 1368629611, Qt = 1437068682, qt = 1668375353, Zt = 1715899485, er = 1942830531, tr = 1999510636, rr = 2033288346, sr = 2079864626, nr = 2142346422, ir = 2228539873, or = 2232517119, ar = 2598291686, Er = 2719718823, Ir = 2810953526, _r = 2840065720, lr = 2885165957, cr = 3542818975, fr = 3586157513, ur = 3717933110, Tr = 4062655306;
659
- function hr(e) {
660
- const r = {};
661
- return Le(r), r;
662
- }
663
- function Le(e) {
664
- return e.ContextType = ue.Unknown, e.UserType = Ae.Unknown, e.PayloadType = Te.Unknown, e.Description = "", e.UserId = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.SessionId = -1, e.IsInternal = !1, e.IsSnapshot = !1, e.IsReady = !1, e.HasInput = !1, e.ChannelLocale = "", e.EmbeddedSpaceId = "", e.AuthSessionId = "", e.ReceiveAllMessages = !1, e.PreciseJoinedAt = 0n, e.UserAgent = "", e.ClientType = fe.Unknown, e.UniqueSessionId = "", e.Parameters = /* @__PURE__ */ Object.create(null), e.SdkType = Ce.Unknown, e.SdkCapability = 0, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.StyleFormat = Ne.Css, e.SupportsCompression = !0, e.IsSoftDisconnected = !1, e.SoftDisconnectAt = 0n, e;
665
- }
666
- function Nr(e, r) {
667
- const t = r ?? hr();
668
- return Le(t), Ar(e, t), t;
669
- }
670
- function Ar(e, r) {
671
- let t;
672
- for (; (t = e.next()) !== null; )
673
- switch (t.fieldId) {
674
- case Mt: {
675
- if (t.isNull) throw new Error();
676
- r.DeviceId = t.asString();
677
- break;
678
- }
679
- case vt: {
680
- if (t.isNull) throw new Error();
681
- r.InstallId = t.asString();
682
- break;
683
- }
684
- case kt: {
685
- if (t.isNull) throw new Error();
686
- r.Theme = t.asString();
687
- break;
688
- }
689
- case Gt: {
690
- if (t.isNull) throw new Error();
691
- r.UserAgent = t.asString();
692
- break;
693
- }
694
- case Bt: {
695
- if (t.isNull) throw new Error();
696
- r.ContextType = t.asInt32();
697
- break;
698
- }
699
- case Vt: {
700
- if (t.isNull) throw new Error();
701
- r.SoftDisconnectAt = t.asUInt64();
702
- break;
703
- }
704
- case xt: {
705
- if (t.isNull) throw new Error();
706
- r.HasInput = t.asBool();
707
- break;
708
- }
709
- case Ht: {
710
- if (t.isNull) throw new Error();
711
- r.UserType = t.asInt32();
712
- break;
713
- }
714
- case pt: {
715
- if (t.isNull) throw new Error();
716
- r.InitialPath = t.asString();
717
- break;
718
- }
719
- case Yt: {
720
- if (t.isNull) throw new Error();
721
- r.IsSoftDisconnected = t.asBool();
722
- break;
723
- }
724
- case Kt: {
725
- if (t.isNull) throw new Error();
726
- r.SupportsCompression = t.asBool();
727
- break;
728
- }
729
- case $t: {
730
- if (t.isNull) throw new Error();
731
- r.UserId = t.asString();
732
- break;
733
- }
734
- case Xt: {
735
- if (t.isNull) throw new Error();
736
- r.ProductId = t.asString();
737
- break;
738
- }
739
- case Wt: {
740
- if (t.isNull) throw new Error();
741
- r.AuthSessionId = t.asString();
742
- break;
743
- }
744
- case jt: {
745
- if (t.isNull) throw new Error();
746
- r.ReceiveAllMessages = t.asBool();
747
- break;
748
- }
749
- case zt: {
750
- if (t.isNull) throw new Error();
751
- r.ViewportHeight = t.asInt32();
752
- break;
753
- }
754
- case Jt: {
755
- if (t.isNull) throw new Error();
756
- r.Description = t.asString();
757
- break;
758
- }
759
- case Qt: {
760
- if (t.isNull) throw new Error();
761
- r.SdkCapability = t.asInt32();
762
- break;
763
- }
764
- case qt: {
765
- if (t.isNull) throw new Error();
766
- r.IsSnapshot = t.asBool();
767
- break;
768
- }
769
- case Zt: {
770
- if (t.isNull) throw new Error();
771
- r.Locale = t.asString();
772
- break;
773
- }
774
- case er: {
775
- if (t.isNull) throw new Error();
776
- r.SdkType = t.asInt32();
777
- break;
778
- }
779
- case tr: {
780
- if (t.isNull) throw new Error();
781
- r.SessionId = t.asInt32();
782
- break;
783
- }
784
- case rr: {
785
- if (t.isNull) throw new Error();
786
- r.ViewportWidth = t.asInt32();
787
- break;
788
- }
789
- case sr: {
790
- if (t.isNull) throw new Error();
791
- r.PreciseJoinedAt = t.asUInt64();
792
- break;
793
- }
794
- case nr: {
795
- if (t.isNull) throw new Error();
796
- r.PayloadType = t.asInt32();
797
- break;
798
- }
799
- case ir: {
800
- if (t.isNull) throw new Error();
801
- r.StyleFormat = t.asInt32();
802
- break;
803
- }
804
- case or: {
805
- if (t.isNull) throw new Error();
806
- r.IsTouchDevice = t.asBool();
807
- break;
808
- }
809
- case ar: {
810
- if (t.isNull) throw new Error();
811
- r.VersionId = t.asString();
812
- break;
813
- }
814
- case Er: {
815
- if (t.isNull) throw new Error();
816
- r.UniqueSessionId = t.asString();
817
- break;
818
- }
819
- case Ir: {
820
- if (t.isNull) throw new Error();
821
- r.ClientType = t.asInt32();
822
- break;
823
- }
824
- case _r: {
825
- if (t.isNull) throw new Error();
826
- r.IsReady = t.asBool();
827
- break;
828
- }
829
- case lr: {
830
- if (t.isNull) throw new Error();
831
- r.Parameters = Sr(t.asDictionary());
832
- break;
833
- }
834
- case cr: {
835
- if (t.isNull) throw new Error();
836
- r.Timezone = t.asString();
837
- break;
838
- }
839
- case fr: {
840
- if (t.isNull) throw new Error();
841
- r.IsInternal = t.asBool();
842
- break;
843
- }
844
- case ur: {
845
- if (t.isNull) throw new Error();
846
- r.ChannelLocale = t.asString();
847
- break;
848
- }
849
- case Tr: {
850
- if (t.isNull) throw new Error();
851
- r.EmbeddedSpaceId = t.asString();
852
- break;
853
- }
854
- }
855
- }
856
- function Sr(e) {
857
- const r = /* @__PURE__ */ Object.create(null);
858
- let t;
859
- for (; (t = e.next()) !== null; ) {
860
- const s = t.key.asString();
861
- r[s] = t.value.asString();
862
- }
863
- return r;
864
- }
865
- const Cr = 703025676, Rr = 814454131, dr = 972460562, Dr = 976255570, wr = 1368629611, yr = 1479280922, Lr = 1533537016, Ur = 1909301063, Or = 2274386296, mr = 2603556958, Pr = 2885165957, gr = 3568439632;
866
- function Fr(e) {
867
- const r = {};
868
- return Ue(r), r;
869
- }
870
- function Ue(e) {
871
- return e.FunctionId = h.fromBytes(new Uint8Array(16)), e.FunctionName = "", e.Parameters = [], e.ResultTypeName = "", e.IsEnumerable = !1, e.EnumerableItemTypeName = "", e.IsCancellable = !1, e.Description = "", e.LlmInlineResult = !1, e.LlmCallOnlyOnce = !1, e.RequiresInstance = !1, e.Versions = [], e;
872
- }
873
- function br(e, r) {
874
- const t = r ?? Fr();
875
- return Ue(t), Mr(e, t), t;
876
- }
877
- function Mr(e, r) {
878
- let t;
879
- for (; (t = e.next()) !== null; )
880
- switch (t.fieldId) {
881
- case Cr: {
882
- if (t.isNull) throw new Error();
883
- r.ResultTypeName = t.asString();
884
- break;
885
- }
886
- case Rr: {
887
- if (t.isNull) throw new Error();
888
- r.FunctionName = t.asString();
889
- break;
890
- }
891
- case dr: {
892
- if (t.isNull) throw new Error();
893
- r.EnumerableItemTypeName = t.asString();
894
- break;
895
- }
896
- case Dr: {
897
- if (t.isNull) throw new Error();
898
- r.FunctionId = t.asGuid();
899
- break;
900
- }
901
- case wr: {
902
- if (t.isNull) throw new Error();
903
- r.Description = t.asString();
904
- break;
905
- }
906
- case yr: {
907
- if (t.isNull) throw new Error();
908
- r.IsCancellable = t.asBool();
909
- break;
910
- }
911
- case Lr: {
912
- if (t.isNull) throw new Error();
913
- r.RequiresInstance = t.asBool();
914
- break;
915
- }
916
- case Ur: {
917
- if (t.isNull) throw new Error();
918
- r.Versions = vr(t.asArray());
919
- break;
920
- }
921
- case Or: {
922
- if (t.isNull) throw new Error();
923
- r.LlmInlineResult = t.asBool();
924
- break;
925
- }
926
- case mr: {
927
- if (t.isNull) throw new Error();
928
- r.IsEnumerable = t.asBool();
929
- break;
930
- }
931
- case Pr: {
932
- if (t.isNull) throw new Error();
933
- r.Parameters = kr(t.asArray());
934
- break;
935
- }
936
- case gr: {
937
- if (t.isNull) throw new Error();
938
- r.LlmCallOnlyOnce = t.asBool();
939
- break;
940
- }
941
- }
942
- }
943
- function vr(e) {
944
- const r = [];
945
- let t;
946
- for (; (t = e.next()) !== null; )
947
- r.push(t.asString());
948
- return r;
949
- }
950
- function kr(e) {
951
- const r = [];
952
- let t;
953
- for (; (t = e.next()) !== null; )
954
- r.push(Wr(t.asObject()));
955
- return r;
956
- }
957
- const Gr = 607861992, Br = 894485888, Vr = 972460562, xr = 1368629611, Hr = 1883521406, pr = 2603556958, Yr = 3609695522, Kr = 4075263697, $r = 4257460908;
958
- function Xr(e) {
959
- const r = {};
960
- return Oe(r), r;
961
- }
962
- function Oe(e) {
963
- return e.ParameterIndex = 0, e.ParameterName = "", e.TypeName = "", e.HasDefaultValue = !1, e.DefaultValueJson = "", e.DefaultValueData = new Uint8Array(0), e.IsEnumerable = !1, e.EnumerableItemTypeName = "", e.Description = "", e;
964
- }
965
- function Wr(e, r) {
966
- const t = r ?? Xr();
967
- return Oe(t), jr(e, t), t;
968
- }
969
- function jr(e, r) {
970
- let t;
971
- for (; (t = e.next()) !== null; )
972
- switch (t.fieldId) {
973
- case Gr: {
974
- if (t.isNull) throw new Error();
975
- r.HasDefaultValue = t.asBool();
976
- break;
977
- }
978
- case Br: {
979
- if (t.isNull) throw new Error();
980
- r.DefaultValueJson = t.asString();
981
- break;
982
- }
983
- case Vr: {
984
- if (t.isNull) throw new Error();
985
- r.EnumerableItemTypeName = t.asString();
986
- break;
987
- }
988
- case xr: {
989
- if (t.isNull) throw new Error();
990
- r.Description = t.asString();
991
- break;
992
- }
993
- case Hr: {
994
- if (t.isNull) throw new Error();
995
- r.DefaultValueData = t.asBinary();
996
- break;
997
- }
998
- case pr: {
999
- if (t.isNull) throw new Error();
1000
- r.IsEnumerable = t.asBool();
1001
- break;
1002
- }
1003
- case Yr: {
1004
- if (t.isNull) throw new Error();
1005
- r.TypeName = t.asString();
1006
- break;
1007
- }
1008
- case Kr: {
1009
- if (t.isNull) throw new Error();
1010
- r.ParameterName = t.asString();
1011
- break;
1012
- }
1013
- case $r: {
1014
- if (t.isNull) throw new Error();
1015
- r.ParameterIndex = t.asInt32();
1016
- break;
1017
- }
1018
- }
1019
- }
1020
- const zr = 3167053791, Jr = 3342364356, Qr = 3612929027;
1021
- function me(e) {
1022
- const r = {};
1023
- return Pe(r), r;
1024
- }
1025
- function Pe(e) {
1026
- return e.Category = "", e.Type = he.Face, e.FaceBlendshapes = [], e;
1027
- }
1028
- function qr(e, r) {
1029
- const t = r ?? me();
1030
- return Pe(t), Zr(e, t), t;
1031
- }
1032
- function Zr(e, r) {
1033
- let t;
1034
- for (; (t = e.next()) !== null; )
1035
- switch (t.fieldId) {
1036
- case zr: {
1037
- if (t.isNull) throw new Error();
1038
- r.Type = t.asInt32();
1039
- break;
1040
- }
1041
- case Jr: {
1042
- if (t.isNull) throw new Error();
1043
- r.FaceBlendshapes = es(t.asArray());
1044
- break;
1045
- }
1046
- case Qr: {
1047
- if (t.isNull) throw new Error();
1048
- r.Category = t.asString();
1049
- break;
1050
- }
1051
- }
1052
- }
1053
- function es(e) {
1054
- const r = [];
1055
- let t;
1056
- for (; (t = e.next()) !== null; )
1057
- r.push(t.asString());
1058
- return r;
1059
- }
1060
- const ts = 1405462580, rs = 2968276160;
1061
- function ss(e) {
1062
- const r = {};
1063
- return ge(r), r;
1064
- }
1065
- function ge(e) {
1066
- return e.MimeType = "", e.Value = new Uint8Array(0), e;
1067
- }
1068
- function ns(e, r) {
1069
- const t = r ?? ss();
1070
- return ge(t), is(e, t), t;
1071
- }
1072
- function is(e, r) {
1073
- let t;
1074
- for (; (t = e.next()) !== null; )
1075
- switch (t.fieldId) {
1076
- case ts: {
1077
- if (t.isNull) throw new Error();
1078
- r.Value = t.asBinary();
1079
- break;
1080
- }
1081
- case rs: {
1082
- if (t.isNull) throw new Error();
1083
- r.MimeType = t.asString();
1084
- break;
1085
- }
1086
- }
1087
- }
1088
- const os = 3612929027;
1089
- function Fe(e) {
1090
- const r = {};
1091
- return be(r), r;
1092
- }
1093
- function be(e) {
1094
- return e.Category = "", e;
1095
- }
1096
- function as(e, r) {
1097
- const t = r ?? Fe();
1098
- return be(t), Es(e, t), t;
1099
- }
1100
- function Es(e, r) {
1101
- let t;
1102
- for (; (t = e.next()) !== null; )
1103
- switch (t.fieldId) {
1104
- case os: {
1105
- if (t.isNull) throw new Error();
1106
- r.Category = t.asString();
1107
- break;
1108
- }
1109
- }
1110
- }
1111
- const Is = 2097188, _s = 979822885, ls = 2374537704;
1112
- function cs(e) {
1113
- const r = {};
1114
- return Me(r), r;
1115
- }
1116
- function Me(e) {
1117
- return e.StyleId = "", e.Style = /* @__PURE__ */ Object.create(null), e;
1118
- }
1119
- function fs(e, r) {
1120
- const t = g.create(e);
1121
- return us(t, r);
1122
- }
1123
- function us(e, r) {
1124
- const t = r ?? cs();
1125
- return Me(t), Ts(e, t), t;
1126
- }
1127
- function Ts(e, r) {
1128
- let t;
1129
- for (; (t = e.next()) !== null; )
1130
- switch (t.fieldId) {
1131
- case _s: {
1132
- if (t.isNull) throw new Error();
1133
- r.StyleId = t.asString();
1134
- break;
1135
- }
1136
- case ls: {
1137
- if (t.isNull) throw new Error();
1138
- r.Style = Ns(t.asDictionary());
1139
- break;
1140
- }
1141
- }
1142
- }
1143
- async function hs(e, r) {
1144
- const t = await X(e, Is);
1145
- return fs(t, r);
1146
- }
1147
- function Ns(e) {
1148
- const r = /* @__PURE__ */ Object.create(null);
1149
- let t;
1150
- for (; (t = e.next()) !== null; ) {
1151
- const s = t.key.asString();
1152
- r[s] = t.value.asString();
1153
- }
1154
- return r;
1155
- }
1156
- const As = 2097192, Ss = 2136687806;
1157
- function Cs(e) {
1158
- const r = {};
1159
- return ve(r), r;
1160
- }
1161
- function ve(e) {
1162
- return e.Styles = [], e;
1163
- }
1164
- function Rs(e, r) {
1165
- const t = g.create(e);
1166
- return ds(t, r);
1167
- }
1168
- function ds(e, r) {
1169
- const t = r ?? Cs();
1170
- return ve(t), Ds(e, t), t;
1171
- }
1172
- function Ds(e, r) {
1173
- let t;
1174
- for (; (t = e.next()) !== null; )
1175
- switch (t.fieldId) {
1176
- case Ss: {
1177
- if (t.isNull) throw new Error();
1178
- r.Styles = ys(t.asArray());
1179
- break;
1180
- }
1181
- }
1182
- }
1183
- async function ws(e, r) {
1184
- const t = await X(e, As);
1185
- return Rs(t, r);
1186
- }
1187
- function ys(e) {
1188
- const r = [];
1189
- let t;
1190
- for (; (t = e.next()) !== null; )
1191
- r.push(ms(t.asObject()));
1192
- return r;
1193
- }
1194
- const Ls = 979822885, Us = 2374537704;
1195
- function Os(e) {
1196
- const r = {};
1197
- return ke(r), r;
1198
- }
1199
- function ke(e) {
1200
- return e.StyleId = "", e.Style = /* @__PURE__ */ Object.create(null), e;
1201
- }
1202
- function ms(e, r) {
1203
- const t = r ?? Os();
1204
- return ke(t), Ps(e, t), t;
1205
- }
1206
- function Ps(e, r) {
1207
- let t;
1208
- for (; (t = e.next()) !== null; )
1209
- switch (t.fieldId) {
1210
- case Ls: {
1211
- if (t.isNull) throw new Error();
1212
- r.StyleId = t.asString();
1213
- break;
1214
- }
1215
- case Us: {
1216
- if (t.isNull) throw new Error();
1217
- r.Style = gs(t.asDictionary());
1218
- break;
1219
- }
1220
- }
1221
- }
1222
- function gs(e) {
1223
- const r = /* @__PURE__ */ Object.create(null);
1224
- let t;
1225
- for (; (t = e.next()) !== null; ) {
1226
- const s = t.key.asString();
1227
- r[s] = t.value.asString();
1228
- }
1229
- return r;
1230
- }
1231
- const Fs = 2097193, bs = 1415642792;
1232
- function Ms(e) {
1233
- const r = {};
1234
- return Ge(r), r;
1235
- }
1236
- function Ge(e) {
1237
- return e.StyleIds = [], e;
1238
- }
1239
- function vs(e, r) {
1240
- const t = g.create(e);
1241
- return ks(t, r);
1242
- }
1243
- function ks(e, r) {
1244
- const t = r ?? Ms();
1245
- return Ge(t), Gs(e, t), t;
1246
- }
1247
- function Gs(e, r) {
1248
- let t;
1249
- for (; (t = e.next()) !== null; )
1250
- switch (t.fieldId) {
1251
- case bs: {
1252
- if (t.isNull) throw new Error();
1253
- r.StyleIds = Vs(t.asArray());
1254
- break;
1255
- }
1256
- }
1257
- }
1258
- async function Bs(e, r) {
1259
- const t = await X(e, Fs);
1260
- return vs(t, r);
1261
- }
1262
- function Vs(e) {
1263
- const r = [];
1264
- let t;
1265
- for (; (t = e.next()) !== null; )
1266
- r.push(t.asString());
1267
- return r;
1268
- }
1269
- const xs = 2097190, Hs = 425183262, ps = 653781469;
1270
- function Ys(e) {
1271
- const r = {};
1272
- return Be(r), r;
1273
- }
1274
- function Be(e) {
1275
- return e.Json = "", e.Payloads = /* @__PURE__ */ Object.create(null), e;
1276
- }
1277
- function Ks(e, r) {
1278
- const t = g.create(e);
1279
- return $s(t, r);
1280
- }
1281
- function $s(e, r) {
1282
- const t = r ?? Ys();
1283
- return Be(t), Xs(e, t), t;
1284
- }
1285
- function Xs(e, r) {
1286
- let t;
1287
- for (; (t = e.next()) !== null; )
1288
- switch (t.fieldId) {
1289
- case Hs: {
1290
- if (t.isNull) throw new Error();
1291
- r.Json = t.asString();
1292
- break;
1293
- }
1294
- case ps: {
1295
- if (t.isNull) throw new Error();
1296
- r.Payloads = js(t.asDictionary());
1297
- break;
1298
- }
1299
- }
1300
- }
1301
- async function Ws(e, r) {
1302
- const t = await X(e, xs);
1303
- return Ks(t, r);
1304
- }
1305
- function js(e) {
1306
- const r = /* @__PURE__ */ Object.create(null);
1307
- let t;
1308
- for (; (t = e.next()) !== null; ) {
1309
- const s = t.key.asString();
1310
- r[s] = ns(t.value.asObject());
1311
- }
1312
- return r;
1313
- }
1314
- const zs = 161083277, Js = 164808083, Qs = 1368629611, qs = 2514959030, Zs = 2745379226, en = 2950031986, tn = 3282782683, rn = 3284746250, sn = 4065070594;
1315
- function Ve(e) {
1316
- const r = {};
1317
- return xe(r), r;
1318
- }
1319
- function xe(e) {
1320
- return e.StreamId = "", e.Description = "", e.SourceType = "", e.Codec = Se.H264, e.CodecDetails = "", e.Width = 0, e.Height = 0, e.Framerate = 30, e.CorrelationId = void 0, e;
1321
- }
1322
- function nn(e, r) {
1323
- const t = r ?? Ve();
1324
- return xe(t), on(e, t), t;
1325
- }
1326
- function on(e, r) {
1327
- let t;
1328
- for (; (t = e.next()) !== null; )
1329
- switch (t.fieldId) {
1330
- case zs: {
1331
- if (t.isNull) throw new Error();
1332
- r.StreamId = t.asString();
1333
- break;
1334
- }
1335
- case Js: {
1336
- if (t.isNull) throw new Error();
1337
- r.Framerate = t.asFloat64();
1338
- break;
1339
- }
1340
- case Qs: {
1341
- if (t.isNull) throw new Error();
1342
- r.Description = t.asString();
1343
- break;
1344
- }
1345
- case qs: {
1346
- if (t.isNull) {
1347
- r.CorrelationId = void 0;
1348
- break;
1349
- }
1350
- r.CorrelationId = t.asString();
1351
- break;
1352
- }
1353
- case Zs: {
1354
- if (t.isNull) throw new Error();
1355
- r.CodecDetails = t.asString();
1356
- break;
1357
- }
1358
- case en: {
1359
- if (t.isNull) throw new Error();
1360
- r.Height = t.asInt32();
1361
- break;
1362
- }
1363
- case tn: {
1364
- if (t.isNull) throw new Error();
1365
- r.SourceType = t.asString();
1366
- break;
1367
- }
1368
- case rn: {
1369
- if (t.isNull) throw new Error();
1370
- r.Codec = t.asInt32();
1371
- break;
1372
- }
1373
- case sn: {
1374
- if (t.isNull) throw new Error();
1375
- r.Width = t.asInt32();
1376
- break;
1377
- }
1378
- }
1379
- }
1380
- const an = 65539, En = 693643444, In = 976837618, _n = 1144553441, ln = 1497620243, cn = 1559330978, fn = 1976546434, un = 2271236852, Tn = 2277643855, hn = 2469008121, Nn = 3042922213, An = 3064612128, Sn = 3219210453, Cn = 3504054055, Rn = 3678477544, dn = 3696445035, Dn = 3707543140, wn = 3712281496, yn = 3895362455, Ln = 3897397815, Un = 3914217035, On = 4225107827;
1381
- function mn(e) {
1382
- const r = {};
1383
- return He(r), r;
1384
- }
1385
- function He(e) {
1386
- return e.Clients = /* @__PURE__ */ Object.create(null), e.Functions = /* @__PURE__ */ Object.create(null), e.UIStreams = /* @__PURE__ */ Object.create(null), e.AudioStreams = /* @__PURE__ */ Object.create(null), e.VideoStreams = /* @__PURE__ */ Object.create(null), e.TrackingStreams = /* @__PURE__ */ Object.create(null), e.SpaceId = "", e.ChannelId = "", e.ServerSessionId = "", e.SessionHash = "", e.ChannelUrl = "", e.SessionChannelUrl = "", e.FirstUserId = "", e.PrimaryUserId = "", e.OrganisationName = "", e.SpaceName = "", e.ChannelName = "", e.ServerRunType = Re.Local, e.AppSourceType = de.Bundle, e.PublicAccess = !1, e.DebugMode = !1, e;
1387
- }
1388
- function Pn(e, r) {
1389
- const t = g.create(e);
1390
- return gn(t, r);
1391
- }
1392
- function gn(e, r) {
1393
- const t = r ?? mn();
1394
- return He(t), Fn(e, t), t;
1395
- }
1396
- function Fn(e, r) {
1397
- let t;
1398
- for (; (t = e.next()) !== null; )
1399
- switch (t.fieldId) {
1400
- case En: {
1401
- if (t.isNull) throw new Error();
1402
- r.FirstUserId = t.asString();
1403
- break;
1404
- }
1405
- case In: {
1406
- if (t.isNull) throw new Error();
1407
- r.SessionHash = t.asString();
1408
- break;
1409
- }
1410
- case _n: {
1411
- if (t.isNull) throw new Error();
1412
- r.Clients = Mn(t.asDictionary());
1413
- break;
1414
- }
1415
- case ln: {
1416
- if (t.isNull) throw new Error();
1417
- r.TrackingStreams = vn(t.asDictionary());
1418
- break;
1419
- }
1420
- case cn: {
1421
- if (t.isNull) throw new Error();
1422
- r.ChannelId = t.asString();
1423
- break;
1424
- }
1425
- case fn: {
1426
- if (t.isNull) throw new Error();
1427
- r.AppSourceType = t.asInt32();
1428
- break;
1429
- }
1430
- case un: {
1431
- if (t.isNull) throw new Error();
1432
- r.SessionChannelUrl = t.asString();
1433
- break;
1434
- }
1435
- case Tn: {
1436
- if (t.isNull) throw new Error();
1437
- r.ChannelUrl = t.asString();
1438
- break;
1439
- }
1440
- case hn: {
1441
- if (t.isNull) throw new Error();
1442
- r.ChannelName = t.asString();
1443
- break;
1444
- }
1445
- case Nn: {
1446
- if (t.isNull) throw new Error();
1447
- r.PublicAccess = t.asBool();
1448
- break;
1449
- }
1450
- case An: {
1451
- if (t.isNull) throw new Error();
1452
- r.ServerRunType = t.asInt32();
1453
- break;
1454
- }
1455
- case Sn: {
1456
- if (t.isNull) throw new Error();
1457
- r.OrganisationName = t.asString();
1458
- break;
1459
- }
1460
- case Cn: {
1461
- if (t.isNull) throw new Error();
1462
- r.DebugMode = t.asBool();
1463
- break;
1464
- }
1465
- case Rn: {
1466
- if (t.isNull) throw new Error();
1467
- r.Functions = kn(t.asDictionary());
1468
- break;
1469
- }
1470
- case dn: {
1471
- if (t.isNull) throw new Error();
1472
- r.UIStreams = Gn(t.asDictionary());
1473
- break;
1474
- }
1475
- case Dn: {
1476
- if (t.isNull) throw new Error();
1477
- r.SpaceId = t.asString();
1478
- break;
1479
- }
1480
- case wn: {
1481
- if (t.isNull) throw new Error();
1482
- r.PrimaryUserId = t.asString();
1483
- break;
1484
- }
1485
- case yn: {
1486
- if (t.isNull) throw new Error();
1487
- r.AudioStreams = Bn(t.asDictionary());
1488
- break;
1489
- }
1490
- case Ln: {
1491
- if (t.isNull) throw new Error();
1492
- r.VideoStreams = Vn(t.asDictionary());
1493
- break;
1494
- }
1495
- case Un: {
1496
- if (t.isNull) throw new Error();
1497
- r.ServerSessionId = t.asString();
1498
- break;
1499
- }
1500
- case On: {
1501
- if (t.isNull) throw new Error();
1502
- r.SpaceName = t.asString();
1503
- break;
1504
- }
1505
- }
1506
- }
1507
- async function bn(e, r) {
1508
- const t = await X(e, an);
1509
- return Pn(t, r);
1510
- }
1511
- function Mn(e) {
1512
- const r = /* @__PURE__ */ Object.create(null);
1513
- let t;
1514
- for (; (t = e.next()) !== null; ) {
1515
- const s = t.key.asInt32();
1516
- r[s] = Nr(t.value.asObject());
1517
- }
1518
- return r;
1519
- }
1520
- function vn(e) {
1521
- const r = /* @__PURE__ */ Object.create(null);
1522
- let t;
1523
- for (; (t = e.next()) !== null; ) {
1524
- const s = t.key.asString();
1525
- r[s] = fi(t.value.asObject());
1526
- }
1527
- return r;
1528
- }
1529
- function kn(e) {
1530
- const r = /* @__PURE__ */ Object.create(null);
1531
- let t;
1532
- for (; (t = e.next()) !== null; ) {
1533
- const s = t.key.asInt32();
1534
- r[s] = xn(t.value.asArray());
1535
- }
1536
- return r;
1537
- }
1538
- function Gn(e) {
1539
- const r = /* @__PURE__ */ Object.create(null);
1540
- let t;
1541
- for (; (t = e.next()) !== null; ) {
1542
- const s = t.key.asString();
1543
- r[s] = Xn(t.value.asObject());
1544
- }
1545
- return r;
1546
- }
1547
- function Bn(e) {
1548
- const r = /* @__PURE__ */ Object.create(null);
1549
- let t;
1550
- for (; (t = e.next()) !== null; ) {
1551
- const s = t.key.asString();
1552
- r[s] = Zn(t.value.asObject());
1553
- }
1554
- return r;
1555
- }
1556
- function Vn(e) {
1557
- const r = /* @__PURE__ */ Object.create(null);
1558
- let t;
1559
- for (; (t = e.next()) !== null; ) {
1560
- const s = t.key.asString();
1561
- r[s] = oi(t.value.asObject());
1562
- }
1563
- return r;
1564
- }
1565
- function xn(e) {
1566
- const r = [];
1567
- let t;
1568
- for (; (t = e.next()) !== null; )
1569
- r.push(br(t.asObject()));
1570
- return r;
1571
- }
1572
- const Hn = 161083277, pn = 325678206, Yn = 3469892363, Kn = 3645544153;
1573
- function $n(e) {
1574
- const r = {};
1575
- return pe(r), r;
1576
- }
1577
- function pe(e) {
1578
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = Fe(), e;
1579
- }
1580
- function Xn(e, r) {
1581
- const t = r ?? $n();
1582
- return pe(t), Wn(e, t), t;
1583
- }
1584
- function Wn(e, r) {
1585
- let t;
1586
- for (; (t = e.next()) !== null; )
1587
- switch (t.fieldId) {
1588
- case Hn: {
1589
- if (t.isNull) throw new Error();
1590
- r.StreamId = t.asString();
1591
- break;
1592
- }
1593
- case pn: {
1594
- if (t.isNull) throw new Error();
1595
- r.ClientSessionId = t.asInt32();
1596
- break;
1597
- }
1598
- case Yn: {
1599
- if (t.isNull) throw new Error();
1600
- r.TrackId = t.asInt32();
1601
- break;
1602
- }
1603
- case Kn: {
1604
- if (t.isNull) throw new Error();
1605
- r.Info = as(t.asObject());
1606
- break;
1607
- }
1608
- }
1609
- }
1610
- const jn = 161083277, zn = 325678206, Jn = 3469892363, Qn = 3645544153;
1611
- function qn(e) {
1612
- const r = {};
1613
- return Ye(r), r;
1614
- }
1615
- function Ye(e) {
1616
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = De(), e;
1617
- }
1618
- function Zn(e, r) {
1619
- const t = r ?? qn();
1620
- return Ye(t), ei(e, t), t;
1621
- }
1622
- function ei(e, r) {
1623
- let t;
1624
- for (; (t = e.next()) !== null; )
1625
- switch (t.fieldId) {
1626
- case jn: {
1627
- if (t.isNull) throw new Error();
1628
- r.StreamId = t.asString();
1629
- break;
1630
- }
1631
- case zn: {
1632
- if (t.isNull) throw new Error();
1633
- r.ClientSessionId = t.asInt32();
1634
- break;
1635
- }
1636
- case Jn: {
1637
- if (t.isNull) throw new Error();
1638
- r.TrackId = t.asInt32();
1639
- break;
1640
- }
1641
- case Qn: {
1642
- if (t.isNull) throw new Error();
1643
- r.Info = wt(t.asObject());
1644
- break;
1645
- }
1646
- }
1647
- }
1648
- const ti = 161083277, ri = 325678206, si = 3469892363, ni = 3645544153;
1649
- function ii(e) {
1650
- const r = {};
1651
- return Ke(r), r;
1652
- }
1653
- function Ke(e) {
1654
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = Ve(), e;
1655
- }
1656
- function oi(e, r) {
1657
- const t = r ?? ii();
1658
- return Ke(t), ai(e, t), t;
1659
- }
1660
- function ai(e, r) {
1661
- let t;
1662
- for (; (t = e.next()) !== null; )
1663
- switch (t.fieldId) {
1664
- case ti: {
1665
- if (t.isNull) throw new Error();
1666
- r.StreamId = t.asString();
1667
- break;
1668
- }
1669
- case ri: {
1670
- if (t.isNull) throw new Error();
1671
- r.ClientSessionId = t.asInt32();
1672
- break;
1673
- }
1674
- case si: {
1675
- if (t.isNull) throw new Error();
1676
- r.TrackId = t.asInt32();
1677
- break;
1678
- }
1679
- case ni: {
1680
- if (t.isNull) throw new Error();
1681
- r.Info = nn(t.asObject());
1682
- break;
1683
- }
1684
- }
1685
- }
1686
- const Ei = 161083277, Ii = 325678206, _i = 3469892363, li = 3645544153;
1687
- function ci(e) {
1688
- const r = {};
1689
- return $e(r), r;
1690
- }
1691
- function $e(e) {
1692
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = me(), e;
1693
- }
1694
- function fi(e, r) {
1695
- const t = r ?? ci();
1696
- return $e(t), ui(e, t), t;
1697
- }
1698
- function ui(e, r) {
1699
- let t;
1700
- for (; (t = e.next()) !== null; )
1701
- switch (t.fieldId) {
1702
- case Ei: {
1703
- if (t.isNull) throw new Error();
1704
- r.StreamId = t.asString();
1705
- break;
1706
- }
1707
- case Ii: {
1708
- if (t.isNull) throw new Error();
1709
- r.ClientSessionId = t.asInt32();
1710
- break;
1711
- }
1712
- case _i: {
1713
- if (t.isNull) throw new Error();
1714
- r.TrackId = t.asInt32();
1715
- break;
1716
- }
1717
- case li: {
1718
- if (t.isNull) throw new Error();
1719
- r.Info = qr(t.asObject());
1720
- break;
1721
- }
1722
- }
1723
- }
1724
- function R(e) {
1725
- return typeof e == "object" && e !== null && !Array.isArray(e);
1726
- }
1727
- function Xe(e) {
1728
- const r = {}, t = Object.keys(e);
1729
- for (let s = 0; s < t.length; s++) {
1730
- const n = t[s];
1731
- r[n] = e[n];
1732
- }
1733
- return r;
1734
- }
1735
- function We(e, r, t, s) {
1736
- if (!(e === void 0 && s)) {
1737
- if (Array.isArray(e)) {
1738
- const n = [];
1739
- for (let i = 0; i < e.length; i++) {
1740
- const o = e[i];
1741
- if (typeof o != "string")
1742
- throw new Error(`Invalid styleIds entry at ${r}.styleIds[${i}] for element ${t}`);
1743
- const a = o.trim();
1744
- a.length !== 0 && n.push(a);
1745
- }
1746
- return n;
1747
- }
1748
- if (e != null)
1749
- throw new Error(`Invalid styleIds for element ${t}`);
1750
- return [];
1751
- }
1752
- }
1753
- function ae(e, r) {
1754
- if (!e || typeof e != "object")
1755
- throw new Error(`Invalid UI node at ${r}`);
1756
- const t = e.Id, s = e.Type, n = e.Props, i = e.Children, o = e.StyleIds;
1757
- if (typeof t != "string")
1758
- throw new Error(`Invalid or missing node id at ${r}`);
1759
- if (typeof s != "string")
1760
- throw new Error(`Invalid or missing node type for ${t}`);
1761
- let a = {};
1762
- if (n != null) {
1763
- if (!R(n))
1764
- throw new Error(`Invalid props for node ${t}`);
1765
- a = Xe(n);
1766
- }
1767
- let I = [];
1768
- Array.isArray(i) && (I = i.map(
1769
- (l, c) => ae(l ?? {}, `${r}.children[${c}]`)
1770
- ));
1771
- const _ = We(o, r, t, !1), E = typeof e.SourceMarker == "string" ? e.SourceMarker : void 0;
1772
- return {
1773
- id: t,
1774
- type: s,
1775
- props: a,
1776
- children: I,
1777
- styleIds: _ ?? [],
1778
- ...E ? { sourceMarker: E } : {}
1779
- };
1780
- }
1781
- function Ti(e, r) {
1782
- if (!R(e))
1783
- throw new Error(`Invalid text delta at ${r}`);
1784
- const t = e.NodeId, s = e.PropertyName, n = e.Start, i = e.End, o = e.InsertedText;
1785
- if (typeof t != "string" || t.length === 0)
1786
- throw new Error(`Invalid text delta node id at ${r}`);
1787
- if (typeof s != "string" || s.length === 0)
1788
- throw new Error(`Invalid text delta property name at ${r}`);
1789
- if (typeof n != "number" || !Number.isFinite(n))
1790
- throw new Error(`Invalid text delta start at ${r}`);
1791
- if (typeof o != "string")
1792
- throw new Error(`Invalid text delta inserted text at ${r}`);
1793
- let a;
1794
- if (typeof i == "number") {
1795
- if (!Number.isFinite(i))
1796
- throw new Error(`Invalid text delta end at ${r}`);
1797
- a = i;
1798
- } else if (i != null)
1799
- throw new Error(`Invalid text delta end at ${r}`);
1800
- return {
1801
- nodeId: t,
1802
- propertyName: s,
1803
- start: n,
1804
- end: a,
1805
- insertedText: o
1806
- };
1807
- }
1808
- function hi(e, r) {
1809
- if (!R(e))
1810
- throw new Error(`Invalid child insert at ${r}`);
1811
- const t = e.Index, s = e.Node;
1812
- if (typeof t != "number" || !Number.isFinite(t))
1813
- throw new Error(`Invalid child insert index at ${r}`);
1814
- if (!R(s))
1815
- throw new Error(`Invalid child insert node at ${r}`);
1816
- return {
1817
- index: t,
1818
- node: ae(s, `${r}.node`)
1819
- };
1820
- }
1821
- function Ni(e, r) {
1822
- if (!R(e))
1823
- throw new Error(`Invalid child move at ${r}`);
1824
- const t = e.NodeId, s = e.FromIndex, n = e.ToIndex;
1825
- if (typeof t != "string" || t.length === 0)
1826
- throw new Error(`Invalid child move nodeId at ${r}`);
1827
- if (typeof s != "number" || !Number.isFinite(s))
1828
- throw new Error(`Invalid child move fromIndex at ${r}`);
1829
- if (typeof n != "number" || !Number.isFinite(n))
1830
- throw new Error(`Invalid child move toIndex at ${r}`);
1831
- return {
1832
- nodeId: t,
1833
- fromIndex: s,
1834
- toIndex: n
1835
- };
1836
- }
1837
- function Ai(e, r) {
1838
- if (!R(e))
1839
- throw new Error(`Invalid child remove at ${r}`);
1840
- const t = e.NodeId, s = e.Index;
1841
- if (typeof t != "string" || t.length === 0)
1842
- throw new Error(`Invalid child remove nodeId at ${r}`);
1843
- if (typeof s != "number" || !Number.isFinite(s))
1844
- throw new Error(`Invalid child remove index at ${r}`);
1845
- return {
1846
- nodeId: t,
1847
- index: s
1848
- };
1849
- }
1850
- function Si(e, r) {
1851
- if (!R(e))
1852
- throw new Error(`Invalid node change at ${r}`);
1853
- const t = e.nodeId;
1854
- if (typeof t != "string" || t.length === 0)
1855
- throw new Error(`Invalid node change nodeId at ${r}`);
1856
- const s = Array.isArray(e.inserts) ? e.inserts.map(
1857
- (E, l) => hi(E ?? {}, `${r}.inserts[${l}]`)
1858
- ) : void 0, n = Array.isArray(e.moves) ? e.moves.map(
1859
- (E, l) => Ni(E ?? {}, `${r}.moves[${l}]`)
1860
- ) : void 0, i = Array.isArray(e.removals) ? e.removals.map(
1861
- (E, l) => Ai(E ?? {}, `${r}.removals[${l}]`)
1862
- ) : void 0;
1863
- let o;
1864
- if (R(e.changedProps)) {
1865
- o = /* @__PURE__ */ new Map();
1866
- for (const [E, l] of Object.entries(e.changedProps)) {
1867
- if (!R(l))
1868
- continue;
1869
- const c = l.New;
1870
- c == null ? o.set(E, void 0) : R(c) ? o.set(E, Xe(c)) : o.set(E, c);
1871
- }
1872
- }
1873
- const a = Array.isArray(e.textUpdates) ? e.textUpdates.map(
1874
- (E, l) => Ti(E ?? {}, `${r}.textUpdates[${l}]`)
1875
- ) : void 0, I = e.styleIds, _ = I !== void 0 ? We(I, r, t, !0) : void 0;
1876
- return {
1877
- nodeId: t,
1878
- ...s && s.length > 0 ? { inserts: s } : {},
1879
- ...n && n.length > 0 ? { moves: n } : {},
1880
- ...i && i.length > 0 ? { removals: i } : {},
1881
- ...o && o.size > 0 ? { changedProps: o } : {},
1882
- ...a && a.length > 0 ? { textUpdates: a } : {},
1883
- ..._ !== void 0 ? { styleIds: _ } : {}
1884
- };
1885
- }
1886
- function Ci(e) {
1887
- const r = /* @__PURE__ */ new Map();
1888
- for (const [t, s] of Object.entries(e))
1889
- r.set(t, s);
1890
- return r;
1891
- }
1892
- function Ri(e, r, t) {
1893
- if (!e || typeof e != "object")
1894
- throw new D("UI update graph is missing");
1895
- const s = ae(e, "graph");
1896
- if (s.type !== "root")
1897
- throw new D('UI update root element must have type "root"');
1898
- const n = Di(s.props, r);
1899
- return {
1900
- type: "full",
1901
- version: t,
1902
- root: s,
1903
- metadata: n
1904
- };
1905
- }
1906
- function di(e, r, t) {
1907
- if (!Array.isArray(e))
1908
- throw new D("UI diff changes must be an array");
1909
- if (!R(r))
1910
- throw new D("UI diff metadata must be an object");
1911
- const s = r.viewId;
1912
- if (typeof s != "string" || s.length === 0)
1913
- throw new D("UI diff metadata is missing viewId");
1914
- const n = e.map(
1915
- (a, I) => Si(a ?? {}, `changes[${I}]`)
1916
- ), i = typeof r.isUpdate == "boolean" ? r.isUpdate : void 0, o = {
1917
- viewId: s,
1918
- ...i !== void 0 ? { isUpdate: i } : {}
1919
- };
1920
- return {
1921
- type: "diff",
1922
- version: t,
1923
- changes: n,
1924
- metadata: o
1925
- };
1926
- }
1927
- function Di(e, r) {
1928
- const t = e.viewId;
1929
- if (typeof t != "string" || t.length === 0)
1930
- throw new D("UI update root is missing viewId");
1931
- let s = t, n = typeof e.isUpdate == "boolean" ? e.isUpdate : void 0;
1932
- return R(r) && (typeof r.viewId == "string" && r.viewId.length > 0 && (s = r.viewId), typeof r.isUpdate == "boolean" && (n = r.isUpdate)), {
1933
- viewId: s,
1934
- ...n !== void 0 ? { isUpdate: n } : {}
1935
- };
1936
- }
1937
- class D extends Error {
1938
- constructor(r, t) {
1939
- super(r), this.causeError = t, this.name = "UiUpdateParseError", t instanceof Error && (this.stack = t.stack);
1940
- }
1941
- }
1942
- function je(e) {
1943
- let r;
1944
- try {
1945
- r = JSON.parse(e.Json);
1946
- } catch (o) {
1947
- throw new D("Failed to parse UIUpdate.Json payload", o);
1948
- }
1949
- if (!r || typeof r != "object")
1950
- throw new D("UI update snapshot must be an object");
1951
- const { type: t, version: s } = r;
1952
- if (t !== "full" && t !== "diff")
1953
- throw new D(`Unknown UI update type: ${String(t)}`);
1954
- if (typeof s != "number")
1955
- throw new D("UI update version must be a number");
1956
- const n = t === "full" ? Ri(r.graph, r.metadata, s) : di(r.changes, r.metadata, s), i = e.Payloads ? Ci(e.Payloads) : /* @__PURE__ */ new Map();
1957
- return {
1958
- snapshot: n,
1959
- payloads: i
1960
- };
1961
- }
1962
- let wi = 1;
1963
- const yi = /* @__PURE__ */ new Map(), Li = {
1964
- 0: "DEBUG",
1965
- 1: "INFO",
1966
- 2: "WARN",
1967
- 3: "ERROR",
1968
- 4: "NONE"
1969
- };
1970
- function Ui(e, r) {
1971
- return `[${e}] ${r}`;
1972
- }
1973
- function j(e, r, t, s) {
1974
- const n = (/* @__PURE__ */ new Date()).toISOString(), i = Li[e], o = {
1975
- timestamp: n,
1976
- level: e,
1977
- levelName: i,
1978
- component: r,
1979
- message: t,
1980
- args: s
1981
- };
1982
- for (const [a, I] of yi) {
1983
- const _ = I?.minLevel ?? 2;
1984
- if (e >= _)
1985
- try {
1986
- a(o);
1987
- } catch {
1988
- }
1989
- }
1990
- if (wi <= e) {
1991
- const a = Ui(r, t);
1992
- switch (e) {
1993
- case 0:
1994
- console.debug(a, ...s);
1995
- break;
1996
- case 1:
1997
- console.info(a, ...s);
1998
- break;
1999
- case 2:
2000
- console.warn(a, ...s);
2001
- break;
2002
- case 3:
2003
- console.error(a, ...s);
2004
- break;
2005
- }
2006
- }
2007
- }
2008
- function Oi(e) {
2009
- return {
2010
- debug(r, ...t) {
2011
- j(0, e, r, t);
2012
- },
2013
- info(r, ...t) {
2014
- j(1, e, r, t);
2015
- },
2016
- warn(r, ...t) {
2017
- j(2, e, r, t);
2018
- },
2019
- error(r, ...t) {
2020
- j(3, e, r, t);
2021
- }
2022
- };
2023
- }
2024
- class mi {
2025
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2026
- cache = /* @__PURE__ */ new Map();
2027
- /**
2028
- * Get a cached void handler (no payload) for a node/action combination.
2029
- * Creates and caches the handler if it doesn't exist.
2030
- */
2031
- getHandler(r, t, s) {
2032
- const n = `${r}:${t}`;
2033
- let i = this.cache.get(n);
2034
- return i || (i = () => s(t), this.cache.set(n, i)), i;
2035
- }
2036
- /**
2037
- * Get a cached handler that accepts a payload.
2038
- * Creates and caches the handler if it doesn't exist.
2039
- */
2040
- getHandlerWithPayload(r, t, s) {
2041
- const n = `${r}:${t}:payload`;
2042
- let i = this.cache.get(n);
2043
- return i || (i = (o) => s(t, o), this.cache.set(n, i)), i;
2044
- }
2045
- /**
2046
- * Get a cached handler for boolean payloads.
2047
- */
2048
- getBooleanHandler(r, t, s) {
2049
- return this.getHandlerWithPayload(r, t, s);
2050
- }
2051
- /**
2052
- * Get a cached handler for string payloads.
2053
- */
2054
- getStringHandler(r, t, s) {
2055
- return this.getHandlerWithPayload(r, t, s);
2056
- }
2057
- /**
2058
- * Get a cached handler for number payloads.
2059
- */
2060
- getNumberHandler(r, t, s) {
2061
- return this.getHandlerWithPayload(r, t, s);
2062
- }
2063
- /**
2064
- * Get a cached handler for number array payloads.
2065
- */
2066
- getNumberArrayHandler(r, t, s) {
2067
- return this.getHandlerWithPayload(r, t, s);
2068
- }
2069
- /**
2070
- * Get a cached handler for nullable boolean payloads.
2071
- */
2072
- getNullableBooleanHandler(r, t, s) {
2073
- const n = `${r}:${t}:nullable-bool`;
2074
- let i = this.cache.get(n);
2075
- return i || (i = (o) => s(t, o ?? null), this.cache.set(n, i)), i;
2076
- }
2077
- /**
2078
- * Invalidate all cached handlers for a specific node.
2079
- * Call this when a node is removed from the tree.
2080
- */
2081
- invalidateNode(r) {
2082
- const t = `${r}:`;
2083
- for (const s of this.cache.keys())
2084
- s.startsWith(t) && this.cache.delete(s);
2085
- }
2086
- /**
2087
- * Invalidate a specific handler.
2088
- */
2089
- invalidateHandler(r, t) {
2090
- this.cache.delete(`${r}:${t}`), this.cache.delete(`${r}:${t}:payload`), this.cache.delete(`${r}:${t}:nullable-bool`);
2091
- }
2092
- /**
2093
- * Clear all cached handlers.
2094
- */
2095
- clear() {
2096
- this.cache.clear();
2097
- }
2098
- /**
2099
- * Get the number of cached handlers (for debugging/testing).
2100
- */
2101
- get size() {
2102
- return this.cache.size;
2103
- }
2104
- }
2105
- const Pi = Oi("UiStreamStore");
2106
- class gi {
2107
- views = /* @__PURE__ */ new Map();
2108
- listeners = /* @__PURE__ */ new Set();
2109
- payloads = /* @__PURE__ */ new Map();
2110
- snapshotMode = !1;
2111
- snapshot = {
2112
- views: /* @__PURE__ */ new Map(),
2113
- payloads: /* @__PURE__ */ new Map(),
2114
- version: -1
2115
- };
2116
- rootViewId;
2117
- // Per-node subscriptions for granular updates
2118
- nodeListeners = /* @__PURE__ */ new Map();
2119
- changedNodeIds = /* @__PURE__ */ new Set();
2120
- nodeVersions = /* @__PURE__ */ new Map();
2121
- structureChanged = !1;
2122
- // Set when a diff is dropped because it can no longer be reconciled against the local tree:
2123
- // its version regressed, it jumped ahead of the local version (a missing intermediate diff),
2124
- // or there is no base tree to apply it to. Consumed by the transport layer, which then asks the
2125
- // server to resync this stream with a full snapshot.
2126
- resyncNeeded = !1;
2127
- // Dirty flags for lazy snapshot rebuilding - start true to ensure first snapshot builds correctly
2128
- viewsDirty = !0;
2129
- payloadsDirty = !0;
2130
- // Handler cache for stable event handlers
2131
- handlerCache = new mi();
2132
- // id -> node lookup index for O(1) getNode. Rebuilt lazily from the committed snapshot's view
2133
- // trees. Node trees are immutable (a change replaces every node on the changed path with a new
2134
- // object and yields a new views Map), so the index is valid exactly while it points at the same
2135
- // views Map instance: comparing that reference is a correct, allocation-free dirty check that
2136
- // covers every mutation path (apply, replaceSnapshot, patchFromOp, clear) without touching them.
2137
- nodeIndex = /* @__PURE__ */ new Map();
2138
- indexedViews;
2139
- apply(r) {
2140
- if (this.snapshotMode) {
2141
- if (r.snapshot.type !== "full")
2142
- return !1;
2143
- this.snapshotMode = !1, this.views.clear(), this.payloads.clear(), this.rootViewId = void 0, this.viewsDirty = !0, this.payloadsDirty = !0, this.snapshot = {
2144
- views: /* @__PURE__ */ new Map(),
2145
- payloads: /* @__PURE__ */ new Map(),
2146
- version: -1
2147
- };
2148
- }
2149
- const { snapshot: t, payloads: s } = r, { metadata: n } = t, { viewId: i } = n;
2150
- let o = this.views.get(i);
2151
- o || (o = {
2152
- version: 0
2153
- }, this.views.set(i, o));
2154
- const a = t.type === "diff" && n.isUpdate === !0;
2155
- if (t.version < o.version)
2156
- return this.resyncNeeded = !0, !1;
2157
- if (t.type === "diff" && t.version > o.version + 1)
2158
- return this.resyncNeeded = !0, !1;
2159
- if (t.version === o.version && !a)
2160
- return !1;
2161
- let I = !1;
2162
- this.rootViewId || (this.rootViewId = i, I = !0, this.structureChanged = !0);
2163
- const _ = o.root;
2164
- if (t.type === "full")
2165
- o.root = t.root, o.version = t.version, I = !0, this.viewsDirty = !0, this.structureChanged = !0, t.root && x(t.root, this.changedNodeIds);
2166
- else {
2167
- if (!_)
2168
- return this.resyncNeeded = !0, !1;
2169
- const E = bi(_, t.changes);
2170
- E !== _ ? (o.root = E, I = !0, this.viewsDirty = !0, q(_, E, this.changedNodeIds)) : o.root = E, o.version = t.version;
2171
- }
2172
- for (const [E, l] of s)
2173
- this.payloads.get(E) !== l && (this.payloads.set(E, l), I = !0, this.payloadsDirty = !0);
2174
- return I ? (this.commitSnapshot(), this.notify(), !0) : (o.version = t.version, !1);
2175
- }
2176
- // Ignore further diffs (keeping the current tree visible) until the next full snapshot arrives,
2177
- // which then replaces the tree wholesale. Used on soft reconnect: the cached tree may be missing
2178
- // diffs lost while the transport was down, so incoming diffs can no longer be trusted — but the
2179
- // tree stays on screen (no blank) until the server's resync full snapshot lands.
2180
- enterSnapshotMode() {
2181
- this.snapshotMode = !0;
2182
- }
2183
- // Returns whether a diff was dropped as unrecoverable since the last call, clearing the flag.
2184
- consumeResyncNeeded() {
2185
- const r = this.resyncNeeded;
2186
- return this.resyncNeeded = !1, r;
2187
- }
2188
- replaceFromWire(r) {
2189
- const t = {
2190
- rootViewId: r.rootViewId,
2191
- views: new Map(r.views),
2192
- payloads: new Map(r.payloads),
2193
- version: r.version
2194
- };
2195
- return this.replaceSnapshot(t);
2196
- }
2197
- patchFromOp(r) {
2198
- this.snapshotMode = !0;
2199
- const t = r.expectedBaseVersion;
2200
- if (t !== void 0 && this.snapshot.version !== t)
2201
- return !1;
2202
- let s = !1, n = null, i = null;
2203
- const o = () => (n || (n = new Map(this.snapshot.views)), n), a = () => (i || (i = new Map(this.snapshot.payloads)), i);
2204
- if (r.deleteViews && r.deleteViews.length > 0)
2205
- for (const E of r.deleteViews)
2206
- o().delete(E) && (s = !0, this.structureChanged = !0);
2207
- if (r.upsertViews && r.upsertViews.length > 0)
2208
- for (const [E, l] of r.upsertViews) {
2209
- const c = o(), L = c.get(E);
2210
- L !== l && (c.set(E, l), s = !0, L ? q(L, l, this.changedNodeIds) : (x(l, this.changedNodeIds), this.structureChanged = !0));
2211
- }
2212
- if (r.deletePayloads && r.deletePayloads.length > 0)
2213
- for (const E of r.deletePayloads)
2214
- a().delete(E) && (s = !0);
2215
- if (r.upsertPayloads && r.upsertPayloads.length > 0)
2216
- for (const [E, l] of r.upsertPayloads) {
2217
- const c = a();
2218
- c.get(E) !== l && (c.set(E, l), s = !0);
2219
- }
2220
- const I = r.rootViewId ?? this.snapshot.rootViewId;
2221
- I !== this.snapshot.rootViewId && (s = !0, this.structureChanged = !0);
2222
- const _ = r.nextVersion;
2223
- if (_ !== this.snapshot.version && (s = !0), !s)
2224
- return this.snapshot = { ...this.snapshot, version: _ }, !1;
2225
- for (const E of this.changedNodeIds)
2226
- this.nodeVersions.set(E, (this.nodeVersions.get(E) ?? 0) + 1);
2227
- return this.snapshot = {
2228
- rootViewId: I,
2229
- views: n ?? new Map(this.snapshot.views),
2230
- payloads: i ?? new Map(this.snapshot.payloads),
2231
- version: _
2232
- }, this.notify(), !0;
2233
- }
2234
- replaceSnapshot(r) {
2235
- this.snapshotMode = !0;
2236
- const t = this.snapshot, s = t.version !== r.version || t.rootViewId !== r.rootViewId || t.views.size !== r.views.size || t.payloads.size !== r.payloads.size;
2237
- (t.rootViewId !== r.rootViewId || t.views.size !== r.views.size) && (this.structureChanged = !0);
2238
- for (const [n, i] of r.views) {
2239
- const o = t.views.get(n);
2240
- o ? q(o, i, this.changedNodeIds) : (x(i, this.changedNodeIds), this.structureChanged = !0);
2241
- }
2242
- for (const n of this.changedNodeIds)
2243
- this.nodeVersions.set(n, (this.nodeVersions.get(n) ?? 0) + 1);
2244
- return this.snapshot = r, s && this.notify(), s;
2245
- }
2246
- clear() {
2247
- (this.snapshot.rootViewId === void 0 || this.snapshot.rootViewId.length === 0) && this.snapshot.views.size === 0 && this.snapshot.payloads.size === 0 || (this.snapshotMode = !0, this.views.clear(), this.payloads.clear(), this.rootViewId = void 0, this.viewsDirty = !0, this.payloadsDirty = !0, this.snapshot = {
2248
- views: /* @__PURE__ */ new Map(),
2249
- payloads: /* @__PURE__ */ new Map(),
2250
- version: -1
2251
- }, this.structureChanged = !0, this.notify());
2252
- }
2253
- getSnapshot() {
2254
- return this.snapshot;
2255
- }
2256
- subscribe(r) {
2257
- return this.listeners.add(r), () => {
2258
- this.listeners.delete(r);
2259
- };
2260
- }
2261
- subscribeNode(r, t) {
2262
- let s = this.nodeListeners.get(r);
2263
- return s || (s = /* @__PURE__ */ new Set(), this.nodeListeners.set(r, s)), s.add(t), () => {
2264
- s && (s.delete(t), s.size === 0 && this.nodeListeners.delete(r));
2265
- };
2266
- }
2267
- getNode(r) {
2268
- const t = this.snapshot.views;
2269
- return this.indexedViews !== t && this.rebuildNodeIndex(t), this.nodeIndex.get(r);
2270
- }
2271
- rebuildNodeIndex(r) {
2272
- this.nodeIndex.clear();
2273
- for (const t of r.values())
2274
- Je(t, this.nodeIndex);
2275
- for (const [t, s] of r)
2276
- this.nodeIndex.set(t, s);
2277
- this.indexedViews = r;
2278
- }
2279
- getNodeVersion(r) {
2280
- return this.nodeVersions.get(r) ?? 0;
2281
- }
2282
- notifyNodes() {
2283
- if (this.changedNodeIds.size === 0 || this.nodeListeners.size === 0) {
2284
- this.changedNodeIds.clear();
2285
- return;
2286
- }
2287
- for (const r of this.changedNodeIds) {
2288
- const t = this.nodeListeners.get(r);
2289
- if (t)
2290
- for (const s of t)
2291
- s();
2292
- }
2293
- this.changedNodeIds.clear();
2294
- }
2295
- commitSnapshot() {
2296
- let r, t;
2297
- if (this.viewsDirty) {
2298
- const n = /* @__PURE__ */ new Map();
2299
- for (const [i, o] of this.views)
2300
- o.root && n.set(i, o.root);
2301
- r = n, this.viewsDirty = !1;
2302
- } else
2303
- r = this.snapshot.views;
2304
- this.payloadsDirty ? (t = new Map(this.payloads), this.payloadsDirty = !1) : t = this.snapshot.payloads;
2305
- let s = this.rootViewId && this.views.has(this.rootViewId) ? this.views.get(this.rootViewId)?.version : void 0;
2306
- if (s === void 0)
2307
- for (const n of this.views.values())
2308
- s = s === void 0 ? n.version : Math.max(s, n.version);
2309
- this.snapshot = {
2310
- rootViewId: this.rootViewId,
2311
- views: r,
2312
- payloads: t,
2313
- version: s
2314
- };
2315
- for (const n of this.changedNodeIds)
2316
- this.nodeVersions.set(n, (this.nodeVersions.get(n) ?? 0) + 1);
2317
- }
2318
- notify() {
2319
- if (this.notifyNodes(), this.structureChanged) {
2320
- this.structureChanged = !1;
2321
- for (const r of this.listeners)
2322
- r();
2323
- }
2324
- }
2325
- }
2326
- class Fi {
2327
- streams = /* @__PURE__ */ new Map();
2328
- listeners = /* @__PURE__ */ new Set();
2329
- apply(r, t) {
2330
- const n = this.getOrCreateStreamEntry(r).store.apply(t);
2331
- return n && this.notify(r), n;
2332
- }
2333
- // Whether the given stream dropped an unrecoverable diff since the last check (clears the flag).
2334
- needsResync(r) {
2335
- const t = this.streams.get(r);
2336
- return t ? t.store.consumeResyncNeeded() : !1;
2337
- }
2338
- applyStoreOp(r) {
2339
- if (r.type === "ReplaceStreamSnapshot") {
2340
- const t = this.getOrCreateStreamEntry(r.snapshot.streamId), s = t.category !== r.snapshot.category;
2341
- return t.category = r.snapshot.category, t.store.replaceFromWire(r.snapshot) || s ? (this.notify(r.snapshot.streamId), !0) : !1;
2342
- }
2343
- if (r.type === "PatchStreamSnapshot") {
2344
- const t = this.getOrCreateStreamEntry(r.streamId), s = r.category !== void 0 && t.category !== r.category;
2345
- return r.category !== void 0 && (t.category = r.category), t.store.patchFromOp(r) || s ? (this.notify(r.streamId), !0) : !1;
2346
- }
2347
- if (r.type === "ClearStream") {
2348
- const t = this.streams.get(r.streamId);
2349
- return t ? (t.store.clear(), this.notify(r.streamId), !0) : !1;
2350
- }
2351
- return r.type === "RemoveStream" ? this.streams.delete(r.streamId) ? (this.notify(r.streamId), !0) : !1 : r.type === "SetStreamCategory" ? (this.setCategory(r.streamId, r.category), !0) : !1;
2352
- }
2353
- applyStoreOps(r) {
2354
- for (const t of r)
2355
- this.applyStoreOp(t);
2356
- }
2357
- clear(r) {
2358
- const t = this.streams.get(r);
2359
- t && (t.store.clear(), this.notify(r));
2360
- }
2361
- remove(r) {
2362
- this.streams.delete(r) && this.notify(r);
2363
- }
2364
- // Puts every existing stream into snapshot mode (see UiStreamStore.enterSnapshotMode) so each one
2365
- // keeps its current tree visible and ignores diffs until the server's next full snapshot resyncs it.
2366
- enterSnapshotModeAll() {
2367
- for (const r of this.streams.values())
2368
- r.store.enterSnapshotMode();
2369
- }
2370
- setCategory(r, t) {
2371
- const s = this.getOrCreateStreamEntry(r);
2372
- s.category !== t && (s.category = t, this.notify(r));
2373
- }
2374
- getSnapshot(r) {
2375
- const t = this.streams.get(r);
2376
- return t ? {
2377
- ...t.store.getSnapshot(),
2378
- streamId: r,
2379
- category: t.category
2380
- } : void 0;
2381
- }
2382
- getSnapshots() {
2383
- const r = [];
2384
- for (const [t, s] of this.streams) {
2385
- const n = s.store.getSnapshot();
2386
- r.push({
2387
- ...n,
2388
- streamId: t,
2389
- category: s.category
2390
- });
2391
- }
2392
- return r;
2393
- }
2394
- subscribe(r) {
2395
- return this.listeners.add(r), () => {
2396
- this.listeners.delete(r);
2397
- };
2398
- }
2399
- getOrCreateStreamEntry(r) {
2400
- let t = this.streams.get(r);
2401
- return t || (t = { store: new gi() }, this.streams.set(r, t)), t;
2402
- }
2403
- notify(r) {
2404
- for (const t of this.listeners)
2405
- t(r);
2406
- }
2407
- }
2408
- function bi(e, r, t) {
2409
- if (r.length === 0)
2410
- return e;
2411
- const s = /* @__PURE__ */ new Map();
2412
- for (const n of r)
2413
- s.set(n.nodeId, n);
2414
- return ze(e, s, t);
2415
- }
2416
- function ze(e, r, t) {
2417
- const s = r.get(e.id);
2418
- let n = e, i = !1;
2419
- if (s?.textUpdates && s.textUpdates.length > 0) {
2420
- const f = Gi(e, s.textUpdates);
2421
- n = f.node, i = f.changed;
2422
- }
2423
- let o = !1, a = n.props;
2424
- if (s?.changedProps && s.changedProps.size > 0)
2425
- for (const [f, C] of s.changedProps.entries()) {
2426
- const d = a[f];
2427
- if (C === void 0)
2428
- (d !== void 0 || f in a) && (o || (a = V(a), o = !0), delete a[f]);
2429
- else if (ee(C)) {
2430
- const u = V(C);
2431
- G(u, d) || (o || (a = V(a), o = !0), a[f] = u);
2432
- } else
2433
- G(C, d) || (o || (a = V(a), o = !0), a[f] = C);
2434
- }
2435
- let I = !1, _ = n.styleIds;
2436
- s?.styleIds !== void 0 && (qe(n.styleIds, s.styleIds) || (_ = s.styleIds, I = !0));
2437
- const E = n.children ?? [];
2438
- let l = E, c = !1;
2439
- if (s?.removals && s.removals.length > 0 || s?.moves && s.moves.length > 0 || s?.inserts && s.inserts.length > 0) {
2440
- const f = l.slice();
2441
- if (s?.removals && s.removals.length > 0) {
2442
- const u = [...s.removals].sort((T, b) => b.index - T.index);
2443
- for (const T of u)
2444
- if (T.index >= 0 && T.index < f.length && f[T.index].id === T.nodeId)
2445
- f.splice(T.index, 1);
2446
- else {
2447
- const b = f.findIndex((nt) => nt.id === T.nodeId);
2448
- b >= 0 && f.splice(b, 1);
2449
- }
2450
- c = !0;
2451
- }
2452
- const C = /* @__PURE__ */ new Map();
2453
- if (s?.moves && s.moves.length > 0) {
2454
- for (const u of s.moves) {
2455
- const T = f.findIndex((b) => b.id === u.nodeId);
2456
- T >= 0 && (C.set(u.nodeId, f[T]), f.splice(T, 1));
2457
- }
2458
- c = !0;
2459
- }
2460
- const d = [];
2461
- if (s?.moves)
2462
- for (const u of s.moves) {
2463
- const T = C.get(u.nodeId);
2464
- T && d.push({ index: u.toIndex, node: T, isInsert: !1 });
2465
- }
2466
- if (s?.inserts) {
2467
- for (const u of s.inserts)
2468
- (f.some((T) => T.id === u.node.id) || C.has(u.node.id)) && Pi.warn(`Duplicate node id '${u.node.id}' (type '${u.node.type}') inserted next to an existing sibling — UI tree diverged from the server`), d.push({ index: u.index, node: u.node, isInsert: !0 });
2469
- c = !0;
2470
- }
2471
- d.sort((u, T) => u.index - T.index);
2472
- for (const u of d) {
2473
- const T = Math.min(u.index, f.length);
2474
- f.splice(T, 0, u.node), u.isInsert;
2475
- }
2476
- l = f;
2477
- }
2478
- let y;
2479
- for (let f = 0; f < l.length; f++) {
2480
- const C = l[f], d = ze(C, r, t);
2481
- d !== C && (y || (y = l.slice()), y[f] = d);
2482
- }
2483
- return y && (l = y, c = !0), i || o || I || c ? !o && !c && !I ? n : {
2484
- id: e.id,
2485
- type: e.type,
2486
- props: o ? a : n.props,
2487
- children: c ? l : E,
2488
- styleIds: I ? _ : n.styleIds,
2489
- ...e.sourceMarker ? { sourceMarker: e.sourceMarker } : {}
2490
- } : e;
2491
- }
2492
- function x(e, r) {
2493
- if (r.add(e.id), e.children)
2494
- for (const t of e.children)
2495
- x(t, r);
2496
- }
2497
- function Je(e, r) {
2498
- if (r.set(e.id, e), e.children)
2499
- for (const t of e.children)
2500
- Je(t, r);
2501
- }
2502
- const z = [];
2503
- function Mi(e) {
2504
- for (; z.length <= e; )
2505
- z.push(/* @__PURE__ */ new Map());
2506
- return z[e].clear(), z[e];
2507
- }
2508
- function q(e, r, t) {
2509
- Qe(e, r, t, 0);
2510
- }
2511
- function Qe(e, r, t, s) {
2512
- if (e === r)
2513
- return;
2514
- (e.type !== r.type || !vi(e.props, r.props) || !qe(e.styleIds, r.styleIds)) && t.add(r.id);
2515
- const i = e.children ?? [], o = r.children ?? [];
2516
- if (i !== o) {
2517
- const a = Mi(s);
2518
- for (const _ of i)
2519
- a.set(_.id, _);
2520
- let I = !1;
2521
- for (let _ = 0; _ < o.length; _++) {
2522
- const E = o[_], l = a.get(E.id);
2523
- l ? (Qe(l, E, t, s + 1), !I && _ < i.length && i[_].id !== E.id && (I = !0)) : (x(E, t), I = !0);
2524
- }
2525
- (i.length !== o.length || I) && t.add(r.id);
2526
- }
2527
- }
2528
- function vi(e, r) {
2529
- return G(e, r);
2530
- }
2531
- function qe(e, r) {
2532
- return G(e, r);
2533
- }
2534
- function ki(e, r) {
2535
- if (r.length === 0)
2536
- return e;
2537
- const t = [...r].sort((i, o) => i.start - o.start);
2538
- let s = e, n = 0;
2539
- for (const i of t) {
2540
- const o = Ie(i.start + n, 0, s.length);
2541
- if (i.end == null) {
2542
- const E = s.slice(o), l = Bi(E, i.insertedText);
2543
- s = s.slice(0, o) + i.insertedText + E.slice(l), n += i.insertedText.length - l;
2544
- continue;
2545
- }
2546
- const a = i.end + n, I = Ie(a, o, s.length), _ = I - o;
2547
- s = s.slice(0, o) + i.insertedText + s.slice(I), n += i.insertedText.length - _;
2548
- }
2549
- return s;
2550
- }
2551
- function Gi(e, r, t) {
2552
- if (r.length === 0)
2553
- return { node: e, changed: !1 };
2554
- const s = /* @__PURE__ */ new Map();
2555
- for (const n of r) {
2556
- const i = s.get(n.nodeId);
2557
- i ? i.push(n) : s.set(n.nodeId, [n]);
2558
- }
2559
- return Ze(e, s);
2560
- }
2561
- function Ze(e, r, t) {
2562
- const s = r.get(e.id) ?? [];
2563
- let n = !1, i = e.props;
2564
- if (s.length > 0) {
2565
- const _ = /* @__PURE__ */ new Map();
2566
- for (const E of s) {
2567
- const l = _.get(E.propertyName);
2568
- l ? l.push(E) : _.set(E.propertyName, [E]);
2569
- }
2570
- for (const [E, l] of _.entries()) {
2571
- const c = i[E], y = ki(typeof c == "string" ? c : "", l);
2572
- n || (i = V(i), n = !0), i[E] = y;
2573
- }
2574
- }
2575
- let o = !1;
2576
- const a = e.children ?? [];
2577
- let I = a;
2578
- if (a.length > 0) {
2579
- let _;
2580
- for (let E = 0; E < a.length; E++) {
2581
- const l = a[E], c = Ze(l, r);
2582
- c.changed && (_ || (_ = [...a]), _[E] = c.node);
2583
- }
2584
- _ && (I = _, o = !0);
2585
- }
2586
- return !n && !o ? { node: e, changed: !1 } : {
2587
- node: {
2588
- id: e.id,
2589
- type: e.type,
2590
- props: n ? i : e.props,
2591
- children: o ? I : a,
2592
- styleIds: e.styleIds,
2593
- ...e.sourceMarker ? { sourceMarker: e.sourceMarker } : {}
2594
- },
2595
- changed: !0
2596
- };
2597
- }
2598
- function Ie(e, r, t) {
2599
- return Math.max(r, Math.min(t, e));
2600
- }
2601
- function Bi(e, r) {
2602
- const t = Math.min(e.length, r.length);
2603
- let s = 0;
2604
- for (; s < t && e.charCodeAt(s) === r.charCodeAt(s); )
2605
- s++;
2606
- return s;
2607
- }
2608
- function V(e) {
2609
- const r = {}, t = Object.keys(e);
2610
- for (let s = 0; s < t.length; s++) {
2611
- const n = t[s];
2612
- r[n] = e[n];
2613
- }
2614
- return r;
2615
- }
2616
- function ee(e) {
2617
- return typeof e == "object" && e !== null && !Array.isArray(e);
2618
- }
2619
- function G(e, r) {
2620
- if (Object.is(e, r))
2621
- return !0;
2622
- if (Array.isArray(e) && Array.isArray(r)) {
2623
- if (e.length !== r.length)
2624
- return !1;
2625
- for (let t = 0; t < e.length; t++)
2626
- if (!G(e[t], r[t]))
2627
- return !1;
2628
- return !0;
2629
- }
2630
- if (ee(e) && ee(r)) {
2631
- const t = Object.keys(e), s = Object.keys(r);
2632
- if (t.length !== s.length)
2633
- return !1;
2634
- for (const n of t)
2635
- if (!G(e[n], r[n]))
2636
- return !1;
2637
- return !0;
2638
- }
2639
- return !1;
2640
- }
2641
- const Vi = 16, xi = 50, N = new Fi(), m = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Set();
2642
- let et = Vi, tt = xi, p = [], Y = null, K = null, O = 0, J = 0;
2643
- const M = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map();
2644
- function Hi() {
2645
- return typeof performance < "u" ? performance.now() : Date.now();
2646
- }
2647
- function pi() {
2648
- try {
2649
- return crypto.randomUUID();
2650
- } catch {
2651
- return `${Date.now()}_${Math.random().toString(16).slice(2)}`;
2652
- }
2653
- }
2654
- function rt(e) {
2655
- const r = [];
2656
- for (const s of e.views)
2657
- r.push(s);
2658
- const t = [];
2659
- for (const s of e.payloads)
2660
- t.push(s);
2661
- return {
2662
- streamId: e.streamId,
2663
- category: e.category,
2664
- version: e.version ?? -1,
2665
- rootViewId: e.rootViewId,
2666
- views: r,
2667
- payloads: t
2668
- };
2669
- }
2670
- function Yi(e, r, t) {
2671
- if (!t || t.version === -1)
2672
- return { type: "ReplaceStreamSnapshot", snapshot: rt(r) };
2673
- let s, n;
2674
- for (const [a, I] of r.views)
2675
- t.views.get(a) !== I && (s ??= []).push([a, I]);
2676
- for (const a of t.views.keys())
2677
- r.views.has(a) || (n ??= []).push(a);
2678
- let i, o;
2679
- for (const [a, I] of r.payloads)
2680
- t.payloads.get(a) !== I && (i ??= []).push([a, I]);
2681
- for (const a of t.payloads.keys())
2682
- r.payloads.has(a) || (o ??= []).push(a);
2683
- return {
2684
- type: "PatchStreamSnapshot",
2685
- streamId: e,
2686
- category: r.category,
2687
- nextVersion: r.version ?? -1,
2688
- expectedBaseVersion: t.version ?? -1,
2689
- rootViewId: r.rootViewId,
2690
- upsertViews: s,
2691
- deleteViews: n,
2692
- upsertPayloads: i,
2693
- deletePayloads: o
2694
- };
2695
- }
2696
- function te() {
2697
- Y || (Y = setTimeout(_e, et)), K || (K = setTimeout(_e, tt));
2698
- }
2699
- function w(e) {
2700
- p.push(e), te();
2701
- }
2702
- function _e() {
2703
- if (Y && (clearTimeout(Y), Y = null), K && (clearTimeout(K), K = null), p.length === 0 && M.size === 0 && $.size === 0) {
2704
- O = 0, J = 0;
2705
- return;
2706
- }
2707
- const e = [];
2708
- for (const [s, n] of M)
2709
- e.push({ trackId: s, version: n.version, senderId: n.senderId });
2710
- const r = [];
2711
- for (const [s, n] of $)
2712
- r.push({ trackId: s, senderId: n });
2713
- const t = {
2714
- batchId: pi(),
2715
- createdAtMs: Hi(),
2716
- ops: p,
2717
- ...e.length > 0 ? { acks: e } : {},
2718
- ...r.length > 0 ? { resyncs: r } : {},
2719
- stats: { uiMessagesConsumed: O, bytesConsumed: J }
2720
- };
2721
- p = [], O = 0, J = 0, M.clear(), $.clear(), self.postMessage(t);
2722
- }
2723
- function st(e) {
2724
- return `${e.senderId}_${e.trackId}`;
2725
- }
2726
- async function Ki(e) {
2727
- const r = await bn(e), t = /* @__PURE__ */ new Set();
2728
- for (const s of Object.values(r.UIStreams ?? {})) {
2729
- const n = s.StreamId;
2730
- t.add(n);
2731
- const i = s.Info?.Category;
2732
- N.getSnapshot(n)?.category !== i && (N.setCategory(n, i), w({ type: "SetStreamCategory", streamId: n, category: i }));
2733
- }
2734
- for (const s of N.getSnapshots())
2735
- H.has(s.streamId) || t.has(s.streamId) || (N.remove(s.streamId), P.delete(s.streamId), w({ type: "RemoveStream", streamId: s.streamId }));
2736
- }
2737
- function $i(e) {
2738
- if (H.size !== 0) {
2739
- for (const r of H)
2740
- r !== e && (N.remove(r), P.delete(r), w({ type: "RemoveStream", streamId: r }));
2741
- H.clear();
2742
- }
2743
- }
2744
- async function Xi(e) {
2745
- const r = re(e), t = st(r), s = await Ws(e), n = je(s), i = M.get(r.trackId);
2746
- (i === void 0 || n.snapshot.version > i.version) && (M.set(r.trackId, { version: n.snapshot.version, senderId: r.senderId }), te());
2747
- const o = N.apply(t, n);
2748
- if (N.needsResync(t) && ($.set(r.trackId, r.senderId), te()), !o)
2749
- return;
2750
- const a = N.getSnapshot(t);
2751
- if (!a)
2752
- return;
2753
- const I = P.get(t);
2754
- P.set(t, a), w(Yi(t, a, I)), $i(t);
2755
- }
2756
- async function Wi(e) {
2757
- const r = await hs(e);
2758
- if (!r.StyleId)
2759
- return;
2760
- const t = {
2761
- styleId: r.StyleId,
2762
- css: r.Style?.css,
2763
- common: r.Style?.common
2764
- }, s = m.get(t.styleId);
2765
- s && s.css === t.css && s.common === t.common || (m.set(t.styleId, t), w({ type: "UpsertUiStyle", style: t }));
2766
- }
2767
- async function ji(e) {
2768
- const r = await ws(e);
2769
- if (r.Styles)
2770
- for (const t of r.Styles) {
2771
- if (!t.StyleId)
2772
- continue;
2773
- const s = {
2774
- styleId: t.StyleId,
2775
- css: t.Style?.css,
2776
- common: t.Style?.common
2777
- }, n = m.get(s.styleId);
2778
- n && n.css === s.css && n.common === s.common || (m.set(s.styleId, s), w({ type: "UpsertUiStyle", style: s }));
2779
- }
2780
- }
2781
- function zi(e) {
2782
- const r = re(e), t = st(r);
2783
- N.clear(t), P.delete(t), w({ type: "ClearStream", streamId: t });
2784
- }
2785
- async function Ji(e) {
2786
- const r = await Bs(e);
2787
- if (!(!r.StyleIds || r.StyleIds.length === 0))
2788
- for (const t of r.StyleIds)
2789
- m.delete(t) && w({ type: "RemoveUiStyle", styleId: t });
2790
- }
2791
- function Qi(e) {
2792
- if (!N.getSnapshots().some((r) => r.rootViewId)) {
2793
- for (const r of e.styles) {
2794
- const t = m.get(r.styleId);
2795
- t && t.css === r.css && t.common === r.common || (m.set(r.styleId, r), w({ type: "UpsertUiStyle", style: r }));
2796
- }
2797
- if (e.bootJson && e.bootStreamId) {
2798
- const r = je({ Json: e.bootJson });
2799
- if (N.apply(e.bootStreamId, r)) {
2800
- const t = N.getSnapshot(e.bootStreamId);
2801
- t && (P.set(e.bootStreamId, t), H.add(e.bootStreamId), w({ type: "ReplaceStreamSnapshot", snapshot: rt(t), fromSeed: !0 }));
2802
- }
2803
- }
2804
- for (const r of e.liveStreams ?? [])
2805
- if (N.applyStoreOp({ type: "ReplaceStreamSnapshot", snapshot: r })) {
2806
- const t = N.getSnapshot(r.streamId);
2807
- t && P.set(r.streamId, t), w({ type: "ReplaceStreamSnapshot", snapshot: r, fromSeed: !0 });
2808
- }
2809
- N.enterSnapshotModeAll();
2810
- }
2811
- }
2812
- async function qi(e) {
2813
- const r = new Uint8Array(e);
2814
- J += r.byteLength;
2815
- const t = r;
2816
- switch (ot(t)) {
2817
- case F.CORE_GLOBAL_STATE:
2818
- await Ki(t), O++;
2819
- return;
2820
- case F.UI_UPDATE:
2821
- try {
2822
- await Xi(t);
2823
- } catch (n) {
2824
- return n instanceof D, void 0;
2825
- } finally {
2826
- O++;
2827
- }
2828
- return;
2829
- case F.UI_STYLES:
2830
- await Wi(t), O++;
2831
- return;
2832
- case F.UI_STYLES_BATCH:
2833
- await ji(t), O++;
2834
- return;
2835
- case F.UI_STYLES_DELETE:
2836
- await Ji(t), O++;
2837
- return;
2838
- case F.ACTION_UI_CLEAR_STREAM:
2839
- zi(t), O++;
2840
- return;
2841
- default:
2842
- return;
2843
- }
2844
- }
2845
- self.addEventListener("message", (e) => {
2846
- const r = e.data;
2847
- if (r.type === "configure") {
2848
- typeof r.flushIntervalMs == "number" && Number.isFinite(r.flushIntervalMs) && r.flushIntervalMs >= 0 && (et = r.flushIntervalMs), typeof r.maxLatencyMs == "number" && Number.isFinite(r.maxLatencyMs) && r.maxLatencyMs >= 0 && (tt = r.maxLatencyMs);
2849
- return;
2850
- }
2851
- if (r.type === "clear") {
2852
- p = [], P.clear(), M.clear(), $.clear(), m.clear();
2853
- for (const t of N.getSnapshots())
2854
- N.remove(t.streamId);
2855
- return;
2856
- }
2857
- if (r.type === "snapshotMode") {
2858
- N.enterSnapshotModeAll();
2859
- return;
2860
- }
2861
- if (r.type === "seed") {
2862
- Qi(r);
2863
- return;
2864
- }
2865
- r.type === "protocol" && qi(r.message).catch(() => {
2866
- });
2867
- });