@ikonai/sdk 0.0.34 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{audio-capture-worker-CiEMOS9I.js → audio-capture-worker-Bnqb8-xb.js} +357 -237
- package/assets/{audio-playback-worker-WI7y4bo8.js → audio-playback-worker-CXmAFv0O.js} +125 -152
- package/assets/index-C-9F_--I.js +186 -0
- package/assets/index-C3ZAK5YF.js +170 -0
- package/assets/libopus-BBY7KH2-.js +169 -0
- package/assets/libopus-simd-CQXMVirP.js +169 -0
- package/client/ikon-client-config.d.ts +54 -55
- package/index.d.ts +3 -3
- package/index.js +498 -468
- package/media/audio-constants.d.ts +5 -0
- package/media/ikon-audio-capture.d.ts +12 -1
- package/media/ikon-audio-playback.d.ts +8 -9
- package/media/ikon-media-capture.d.ts +5 -2
- package/media/ikon-media.d.ts +8 -0
- package/media/index.d.ts +3 -2
- package/package.json +1 -1
- package/assets/index-CvFH-Dkf.js +0 -650
- /package/utils/{logSink.d.ts → log-sink.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function It(t) {
|
|
2
2
|
if (t.length < 8)
|
|
3
3
|
throw new Error("Protocol message too short");
|
|
4
4
|
return (t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24) >>> 0;
|
|
@@ -7,22 +7,22 @@ function q(t) {
|
|
|
7
7
|
const e = F(t), r = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
8
8
|
if (e.length < 27)
|
|
9
9
|
throw new Error("Protocol payload too short");
|
|
10
|
-
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), a = r.getUint32(8, !0), i = r.getUint32(12, !0), o = r.getUint32(16, !0), _ = r.getUint32(20, !0), h = r.getUint8(24),
|
|
10
|
+
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), a = r.getUint32(8, !0), i = r.getUint32(12, !0), o = r.getUint32(16, !0), _ = r.getUint32(20, !0), h = r.getUint8(24), l = r.getUint8(25), E = r.getUint8(26);
|
|
11
11
|
if (27 + _ * 4 > e.length)
|
|
12
12
|
throw new Error("Protocol header exceeds payload length");
|
|
13
|
-
const
|
|
13
|
+
const N = [];
|
|
14
14
|
let O = 27;
|
|
15
15
|
for (let m = 0; m < _; m++)
|
|
16
|
-
|
|
16
|
+
N.push(r.getUint32(O, !0)), O += 4;
|
|
17
17
|
return {
|
|
18
18
|
length: s,
|
|
19
19
|
opcode: n,
|
|
20
20
|
senderId: a,
|
|
21
21
|
trackId: i,
|
|
22
22
|
sequenceId: o,
|
|
23
|
-
targetIds:
|
|
23
|
+
targetIds: N,
|
|
24
24
|
payloadVersion: h,
|
|
25
|
-
payloadType:
|
|
25
|
+
payloadType: l,
|
|
26
26
|
flags: E
|
|
27
27
|
};
|
|
28
28
|
}
|
|
@@ -38,7 +38,7 @@ function tt(t, e, r) {
|
|
|
38
38
|
return s.subarray(a, n.length);
|
|
39
39
|
}
|
|
40
40
|
var D = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(D || {});
|
|
41
|
-
const
|
|
41
|
+
const ht = 161, ft = 162;
|
|
42
42
|
new TextEncoder();
|
|
43
43
|
const ut = new TextDecoder("utf-8", { fatal: !0 });
|
|
44
44
|
class M {
|
|
@@ -51,7 +51,7 @@ class M {
|
|
|
51
51
|
const r = F(e);
|
|
52
52
|
if (r.length < 2)
|
|
53
53
|
throw new Error("Teleport payload too short");
|
|
54
|
-
if (r[0] !==
|
|
54
|
+
if (r[0] !== ht || r[r.length - 1] !== ft)
|
|
55
55
|
throw new Error("Teleport object missing markers");
|
|
56
56
|
const s = { offset: 1 }, n = A(r, s, "InvalidLength");
|
|
57
57
|
return new M(r, n, s.offset);
|
|
@@ -66,7 +66,7 @@ class M {
|
|
|
66
66
|
const r = this.buffer[this.offset++], s = r >> 4 & 15;
|
|
67
67
|
if ((r & 15) !== 0)
|
|
68
68
|
throw new Error("Teleport field flags must be zero");
|
|
69
|
-
const n =
|
|
69
|
+
const n = P(s);
|
|
70
70
|
let a;
|
|
71
71
|
if (n >= 0)
|
|
72
72
|
u(this.buffer, this.offset, n), a = this.buffer.subarray(this.offset, this.offset + n), this.offset += n;
|
|
@@ -145,7 +145,7 @@ class C {
|
|
|
145
145
|
return this.ensureType(
|
|
146
146
|
14
|
|
147
147
|
/* Guid */
|
|
148
|
-
),
|
|
148
|
+
), I.fromBytes(this.payload);
|
|
149
149
|
}
|
|
150
150
|
asObject() {
|
|
151
151
|
return this.ensureType(
|
|
@@ -157,7 +157,7 @@ class C {
|
|
|
157
157
|
return this.ensureType(
|
|
158
158
|
9
|
|
159
159
|
/* Array */
|
|
160
|
-
),
|
|
160
|
+
), p.create(this.payload);
|
|
161
161
|
}
|
|
162
162
|
asDictionary() {
|
|
163
163
|
return this.ensureType(
|
|
@@ -178,7 +178,7 @@ class At extends C {
|
|
|
178
178
|
return this.type === 1;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
class
|
|
181
|
+
class p {
|
|
182
182
|
payload;
|
|
183
183
|
elementType;
|
|
184
184
|
count;
|
|
@@ -194,7 +194,7 @@ class x {
|
|
|
194
194
|
this.count = A(e, s, "ArrayMalformed"), this.offset = s.offset;
|
|
195
195
|
}
|
|
196
196
|
static create(e) {
|
|
197
|
-
return new
|
|
197
|
+
return new p(F(e));
|
|
198
198
|
}
|
|
199
199
|
next() {
|
|
200
200
|
if (this.index >= this.count) {
|
|
@@ -215,7 +215,7 @@ class x {
|
|
|
215
215
|
case 4:
|
|
216
216
|
case 6:
|
|
217
217
|
case 14: {
|
|
218
|
-
const e =
|
|
218
|
+
const e = P(this.elementType);
|
|
219
219
|
u(this.payload, this.offset, e);
|
|
220
220
|
const r = this.payload.subarray(this.offset, this.offset + e);
|
|
221
221
|
return this.offset += e, new w(this.elementType, r);
|
|
@@ -277,10 +277,10 @@ class H {
|
|
|
277
277
|
return null;
|
|
278
278
|
}
|
|
279
279
|
const e = this.readKey(), r = this.readValue();
|
|
280
|
-
return this.index++, new
|
|
280
|
+
return this.index++, new Tt(e, r);
|
|
281
281
|
}
|
|
282
282
|
readKey() {
|
|
283
|
-
const e =
|
|
283
|
+
const e = P(this.keyType);
|
|
284
284
|
if (e >= 0) {
|
|
285
285
|
u(this.payload, this.offset, e);
|
|
286
286
|
const r = this.payload.subarray(this.offset, this.offset + e);
|
|
@@ -326,7 +326,7 @@ class H {
|
|
|
326
326
|
case 6:
|
|
327
327
|
case 14:
|
|
328
328
|
case 1: {
|
|
329
|
-
const e =
|
|
329
|
+
const e = P(this.valueType);
|
|
330
330
|
u(this.payload, this.offset, e);
|
|
331
331
|
const r = this.payload.subarray(this.offset, this.offset + e);
|
|
332
332
|
return this.offset += e, new C(this.valueType, r);
|
|
@@ -336,12 +336,12 @@ class H {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class Tt {
|
|
340
340
|
constructor(e, r) {
|
|
341
341
|
this.key = e, this.value = r;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
class
|
|
344
|
+
class I {
|
|
345
345
|
constructor(e) {
|
|
346
346
|
this.bytes = e;
|
|
347
347
|
}
|
|
@@ -351,19 +351,19 @@ class f {
|
|
|
351
351
|
const r = e.replace(/-/g, "");
|
|
352
352
|
if (r.length !== 32)
|
|
353
353
|
throw new Error("Guid string must be 32 hex characters");
|
|
354
|
-
const s = new Uint8Array(16), n =
|
|
355
|
-
|
|
354
|
+
const s = new Uint8Array(16), n = I.parseHexSlice(r, 0, 8), a = I.parseHexSlice(r, 8, 4), i = I.parseHexSlice(r, 12, 4);
|
|
355
|
+
I.writeUInt32LE(s, 0, n), I.writeUInt16LE(s, 4, a), I.writeUInt16LE(s, 6, i);
|
|
356
356
|
for (let o = 0; o < 8; o++)
|
|
357
|
-
s[8 + o] =
|
|
358
|
-
return new
|
|
357
|
+
s[8 + o] = I.parseHexSlice(r, 16 + o * 2, 2);
|
|
358
|
+
return new I(s);
|
|
359
359
|
}
|
|
360
360
|
static fromBytes(e) {
|
|
361
361
|
if (e.length !== 16)
|
|
362
362
|
throw new Error("Guid byte array must be 16 bytes");
|
|
363
|
-
return new
|
|
363
|
+
return new I(Uint8Array.from(e));
|
|
364
364
|
}
|
|
365
365
|
static createZero() {
|
|
366
|
-
return new
|
|
366
|
+
return new I(new Uint8Array(16));
|
|
367
367
|
}
|
|
368
368
|
static createRandom() {
|
|
369
369
|
const e = new Uint8Array(16), r = globalThis.crypto;
|
|
@@ -372,14 +372,14 @@ class f {
|
|
|
372
372
|
else
|
|
373
373
|
for (let s = 0; s < e.length; s++)
|
|
374
374
|
e[s] = Math.floor(Math.random() * 256);
|
|
375
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new
|
|
375
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new I(e);
|
|
376
376
|
}
|
|
377
377
|
toString() {
|
|
378
378
|
const e = this.bytes;
|
|
379
379
|
return [
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
I.toHex(I.readUInt32LE(e, 0), 8),
|
|
381
|
+
I.toHex(I.readUInt16LE(e, 4), 4),
|
|
382
|
+
I.toHex(I.readUInt16LE(e, 6), 4),
|
|
383
383
|
z(e.subarray(8, 10)),
|
|
384
384
|
z(e.subarray(10, 16))
|
|
385
385
|
].join("-");
|
|
@@ -418,7 +418,7 @@ function A(t, e, r) {
|
|
|
418
418
|
for (; e.offset < t.length; ) {
|
|
419
419
|
const i = t[e.offset++];
|
|
420
420
|
if (a++, s |= (i & 127) << n, (i & 128) === 0) {
|
|
421
|
-
if (a !==
|
|
421
|
+
if (a !== ct(s))
|
|
422
422
|
throw new Error("Teleport VarUInt is not canonical");
|
|
423
423
|
return s >>> 0;
|
|
424
424
|
}
|
|
@@ -427,10 +427,10 @@ function A(t, e, r) {
|
|
|
427
427
|
}
|
|
428
428
|
throw new Error(r);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function ct(t) {
|
|
431
431
|
return t < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function P(t) {
|
|
434
434
|
switch (t) {
|
|
435
435
|
case 3:
|
|
436
436
|
case 5:
|
|
@@ -467,14 +467,14 @@ function Y(t, e) {
|
|
|
467
467
|
const r = t[e], s = r >> 4 & 15;
|
|
468
468
|
if ((r & 15) !== 0)
|
|
469
469
|
throw new Error("Array flags must be zero");
|
|
470
|
-
const n = { offset: e + 1 }, a = A(t, n, "ArrayMalformed"), i =
|
|
470
|
+
const n = { offset: e + 1 }, a = A(t, n, "ArrayMalformed"), i = P(s);
|
|
471
471
|
if (i >= 0) {
|
|
472
472
|
const _ = i * a;
|
|
473
473
|
return u(t, n.offset, _), n.offset + _ - e;
|
|
474
474
|
}
|
|
475
475
|
let o = n.offset;
|
|
476
476
|
for (let _ = 0; _ < a; _++)
|
|
477
|
-
o =
|
|
477
|
+
o = x(s, t, o, "ArrayMalformed");
|
|
478
478
|
return o - e;
|
|
479
479
|
}
|
|
480
480
|
function K(t, e) {
|
|
@@ -487,11 +487,11 @@ function K(t, e) {
|
|
|
487
487
|
const n = { offset: e + 2 }, a = A(t, n, "DictMalformed");
|
|
488
488
|
let i = n.offset;
|
|
489
489
|
for (let o = 0; o < a; o++)
|
|
490
|
-
i =
|
|
490
|
+
i = x(r, t, i, "DictMalformed"), i = x(s, t, i, "DictMalformed");
|
|
491
491
|
return i - e;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
const n =
|
|
493
|
+
function x(t, e, r, s) {
|
|
494
|
+
const n = P(t);
|
|
495
495
|
if (n >= 0)
|
|
496
496
|
return u(e, r, n), r + n;
|
|
497
497
|
switch (t) {
|
|
@@ -519,7 +519,7 @@ function F(t) {
|
|
|
519
519
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
520
520
|
}
|
|
521
521
|
var T = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Opus = 1] = "Opus", t[t.Mp3 = 2] = "Mp3", t[t.RawPcm16 = 3] = "RawPcm16", t))(T || {}), G = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(G || {});
|
|
522
|
-
const Ct = 1, St = 4194309, Rt = 205938238, Ut = 1594075008, mt = 2026534360, Lt = 3409001585, yt = 3466650495, Dt = 4007456593,
|
|
522
|
+
const Ct = 1, St = 4194309, Rt = 205938238, Ut = 1594075008, mt = 2026534360, Lt = 3409001585, yt = 3466650495, Dt = 4007456593, Pt = 4017217601, dt = 4065417427, Ot = 4086360332;
|
|
523
523
|
function wt(t) {
|
|
524
524
|
const e = {};
|
|
525
525
|
return rt(e), e;
|
|
@@ -569,12 +569,12 @@ function Ft(t, e) {
|
|
|
569
569
|
e.FrameSizeInInterleavedSamples = r.asUInt32();
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
|
-
case
|
|
572
|
+
case Pt: {
|
|
573
573
|
if (r.isNull) throw new Error();
|
|
574
574
|
e.IsLast = r.asBool();
|
|
575
575
|
break;
|
|
576
576
|
}
|
|
577
|
-
case
|
|
577
|
+
case dt: {
|
|
578
578
|
if (r.isNull) throw new Error();
|
|
579
579
|
e.Sequence = r.asUInt32();
|
|
580
580
|
break;
|
|
@@ -590,7 +590,7 @@ function Bt(t, e) {
|
|
|
590
590
|
const r = tt(t, St, Ct);
|
|
591
591
|
return gt(r, e);
|
|
592
592
|
}
|
|
593
|
-
const bt = 1, Gt = 4194305, Vt = 1368629611,
|
|
593
|
+
const bt = 1, Gt = 4194305, Vt = 1368629611, vt = 2431514951, kt = 2914494629, xt = 3284746250, pt = 4101844078;
|
|
594
594
|
function Ht(t) {
|
|
595
595
|
const e = {};
|
|
596
596
|
return st(e), e;
|
|
@@ -615,22 +615,22 @@ function Wt(t, e) {
|
|
|
615
615
|
e.Description = r.asString();
|
|
616
616
|
break;
|
|
617
617
|
}
|
|
618
|
-
case
|
|
618
|
+
case vt: {
|
|
619
619
|
if (r.isNull) throw new Error();
|
|
620
620
|
e.Channels = r.asInt32();
|
|
621
621
|
break;
|
|
622
622
|
}
|
|
623
|
-
case
|
|
623
|
+
case kt: {
|
|
624
624
|
if (r.isNull) throw new Error();
|
|
625
625
|
e.BitDepth = r.asInt32();
|
|
626
626
|
break;
|
|
627
627
|
}
|
|
628
|
-
case
|
|
628
|
+
case xt: {
|
|
629
629
|
if (r.isNull) throw new Error();
|
|
630
630
|
e.Codec = r.asInt32();
|
|
631
631
|
break;
|
|
632
632
|
}
|
|
633
|
-
case
|
|
633
|
+
case pt: {
|
|
634
634
|
if (r.isNull) throw new Error();
|
|
635
635
|
e.SampleRate = r.asInt32();
|
|
636
636
|
break;
|
|
@@ -745,13 +745,13 @@ function Jt(t) {
|
|
|
745
745
|
}
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
|
-
const nt = 48e3, it = 2, Zt = 1500, qt = 10, $ = 80, te = 50, Q = 64, ee = Jt("AudioPlaybackWorker"),
|
|
748
|
+
const nt = 48e3, it = 2, Zt = 1500, qt = 10, $ = 80, te = 50, Q = 64, ee = Jt("AudioPlaybackWorker"), d = (t, e) => {
|
|
749
749
|
self.postMessage(t, e ?? []);
|
|
750
750
|
}, re = jt();
|
|
751
751
|
let V = "pcm", at = !0, R = nt, S = it, y = null;
|
|
752
752
|
function L(t, e) {
|
|
753
753
|
const r = t instanceof Error ? t : new Error(String(t));
|
|
754
|
-
|
|
754
|
+
d({ type: "error", error: { name: r.name, message: r.message, stack: r.stack }, streamId: e });
|
|
755
755
|
}
|
|
756
756
|
function W(t) {
|
|
757
757
|
const e = q(t);
|
|
@@ -795,7 +795,7 @@ class se {
|
|
|
795
795
|
if (!(e || this.pcmBatchOffset >= s || this.lastPcmFlushTimeMs > 0 && r - this.lastPcmFlushTimeMs >= te))
|
|
796
796
|
return;
|
|
797
797
|
const a = new Float32Array(this.pcmBatchOffset);
|
|
798
|
-
a.set(this.pcmBatchBuffer.subarray(0, this.pcmBatchOffset)), this.pcmBatchOffset = 0, this.lastPcmFlushTimeMs = r,
|
|
798
|
+
a.set(this.pcmBatchBuffer.subarray(0, this.pcmBatchOffset)), this.pcmBatchOffset = 0, this.lastPcmFlushTimeMs = r, d({ type: "pcm", streamId: this.streamId, pcm: a }, [a.buffer]);
|
|
799
799
|
}
|
|
800
800
|
drainPcm() {
|
|
801
801
|
this.flushPendingPcm(!0);
|
|
@@ -875,33 +875,33 @@ class X {
|
|
|
875
875
|
convertAudioData(e) {
|
|
876
876
|
const r = e.numberOfFrames, s = e.numberOfChannels, n = e.format, a = typeof n == "string" && n.includes("planar"), i = "f32-planar", o = "f32", _ = () => {
|
|
877
877
|
const E = new Array(s);
|
|
878
|
-
for (let
|
|
879
|
-
const
|
|
880
|
-
e.copyTo(
|
|
878
|
+
for (let f = 0; f < s; f++) {
|
|
879
|
+
const N = new Float32Array(r);
|
|
880
|
+
e.copyTo(N, { planeIndex: f, format: i }), E[f] = N;
|
|
881
881
|
}
|
|
882
|
-
return
|
|
882
|
+
return ce(E, r);
|
|
883
883
|
}, h = () => {
|
|
884
884
|
const E = new Float32Array(r * s);
|
|
885
885
|
return e.copyTo(E, { planeIndex: 0, format: o }), E;
|
|
886
886
|
};
|
|
887
|
-
let
|
|
887
|
+
let l;
|
|
888
888
|
if (a)
|
|
889
889
|
try {
|
|
890
|
-
|
|
890
|
+
l = _();
|
|
891
891
|
} catch (E) {
|
|
892
|
-
ee.debug(`Failed to read planar audio data, falling back to interleaved copy: ${E}`),
|
|
892
|
+
ee.debug(`Failed to read planar audio data, falling back to interleaved copy: ${E}`), l = h();
|
|
893
893
|
}
|
|
894
894
|
else
|
|
895
|
-
|
|
896
|
-
return
|
|
895
|
+
l = h();
|
|
896
|
+
return l;
|
|
897
897
|
}
|
|
898
898
|
convertPcmBuffer(e, r, s) {
|
|
899
899
|
if (e.length === 0)
|
|
900
900
|
return e;
|
|
901
901
|
let n = e, a = e.length, i = r;
|
|
902
902
|
if (s !== R) {
|
|
903
|
-
const o = a / i, h = Math.max(1, Math.round(o * R / s)) * i,
|
|
904
|
-
a = Ce(n,
|
|
903
|
+
const o = a / i, h = Math.max(1, Math.round(o * R / s)) * i, l = this.getResampleBuffer(h);
|
|
904
|
+
a = Ce(n, l, i, s, R), n = l;
|
|
905
905
|
}
|
|
906
906
|
if (i !== S) {
|
|
907
907
|
const _ = a / i * S, h = this.getRemixBuffer(_);
|
|
@@ -982,99 +982,72 @@ class _e extends X {
|
|
|
982
982
|
decoder = null;
|
|
983
983
|
isReady = !1;
|
|
984
984
|
decoderSampleRate = 48e3;
|
|
985
|
-
resetTask = null;
|
|
986
985
|
pendingChunks = [];
|
|
987
|
-
resetGeneration = 0;
|
|
988
|
-
// Pre-allocated buffer for packet copies when byteOffset != 0
|
|
989
|
-
packetBuffer = null;
|
|
990
986
|
async initialise(e, r) {
|
|
991
|
-
const { OpusDecoder: s } = await import("./index-
|
|
992
|
-
this.decoderSampleRate = a, this.decoder = new s({ channels: e, sampleRate: this.decoderSampleRate }), await this.decoder.ready, this.isReady = !0;
|
|
993
|
-
}
|
|
994
|
-
scheduleReset() {
|
|
995
|
-
if (!this.decoder || this.resetTask)
|
|
996
|
-
return;
|
|
997
|
-
const e = ++this.resetGeneration;
|
|
998
|
-
this.resetTask = this.decoder.reset().catch(() => {
|
|
999
|
-
}).finally(() => {
|
|
1000
|
-
this.resetGeneration === e && (this.resetTask = null, this.flushPendingChunks());
|
|
1001
|
-
});
|
|
987
|
+
const { OpusDecoder: s } = await import("./index-C3ZAK5YF.js"), a = [8e3, 12e3, 16e3, 24e3, 48e3].reduce((i, o) => Math.abs(o - r) < Math.abs(i - r) ? o : i);
|
|
988
|
+
this.decoderSampleRate = a, this.decoder = new s({ channels: e, sampleRate: this.decoderSampleRate }), await this.decoder.ready, this.isReady = !0, this.flushPendingChunks();
|
|
1002
989
|
}
|
|
1003
990
|
flushPendingChunks() {
|
|
1004
|
-
if (this.resetTask)
|
|
1005
|
-
return;
|
|
1006
991
|
if (!this.isReady || !this.decoder) {
|
|
1007
992
|
this.pendingChunks.length = 0;
|
|
1008
993
|
return;
|
|
1009
994
|
}
|
|
1010
995
|
const e = this.pendingChunks, r = e.length;
|
|
1011
|
-
if (r
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
const a = r - s;
|
|
1017
|
-
for (let i = 0; i < a; i++)
|
|
1018
|
-
e[i] = e[s + i];
|
|
1019
|
-
e.length = a;
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
e.length = 0;
|
|
996
|
+
if (r !== 0) {
|
|
997
|
+
for (let s = 0; s < r; s++)
|
|
998
|
+
this.decodeChunk(e[s]);
|
|
999
|
+
e.length = 0;
|
|
1000
|
+
}
|
|
1023
1001
|
}
|
|
1024
1002
|
reset() {
|
|
1025
1003
|
super.reset();
|
|
1026
1004
|
try {
|
|
1027
|
-
this.
|
|
1005
|
+
this.decoder?.reset();
|
|
1028
1006
|
} catch {
|
|
1029
1007
|
}
|
|
1030
1008
|
}
|
|
1031
1009
|
decodeChunk(e) {
|
|
1032
1010
|
if (!(!this.isReady || !this.decoder))
|
|
1033
1011
|
try {
|
|
1034
|
-
|
|
1035
|
-
if (r === 0)
|
|
1012
|
+
if (e.data.byteLength === 0)
|
|
1036
1013
|
return;
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const n = this.decoder.decodeFrame(s), a = n.channelData, i = n.samplesDecoded, o = a.length;
|
|
1040
|
-
if (!o || !i)
|
|
1014
|
+
const s = this.decoder.decodeFrame(e.data), n = s.channelData, a = s.samplesDecoded, i = n.length;
|
|
1015
|
+
if (!i || !a)
|
|
1041
1016
|
return;
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1044
|
-
const
|
|
1045
|
-
for (let
|
|
1046
|
-
|
|
1047
|
-
} else if (
|
|
1048
|
-
|
|
1017
|
+
const o = a * i, _ = this.getInterleavedBuffer(o);
|
|
1018
|
+
if (i === 2) {
|
|
1019
|
+
const h = n[0], l = n[1];
|
|
1020
|
+
for (let E = 0, f = 0; E < a; E++)
|
|
1021
|
+
_[f++] = h[E], _[f++] = l[E];
|
|
1022
|
+
} else if (i === 1)
|
|
1023
|
+
_.set(n[0].subarray(0, a));
|
|
1049
1024
|
else {
|
|
1050
|
-
let
|
|
1051
|
-
for (let
|
|
1052
|
-
for (let
|
|
1053
|
-
h
|
|
1025
|
+
let h = 0;
|
|
1026
|
+
for (let l = 0; l < a; l++)
|
|
1027
|
+
for (let E = 0; E < i; E++)
|
|
1028
|
+
_[h++] = n[E][l];
|
|
1054
1029
|
}
|
|
1055
|
-
this.writeConvertedPcm(
|
|
1030
|
+
this.writeConvertedPcm(_.subarray(0, o), i, this.decoderSampleRate), e.isLast && this.reset();
|
|
1056
1031
|
} catch (r) {
|
|
1057
|
-
L(r), this.
|
|
1032
|
+
L(r), this.reset();
|
|
1058
1033
|
}
|
|
1059
1034
|
}
|
|
1060
1035
|
feedChunk(e) {
|
|
1061
|
-
if (!
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
return;
|
|
1065
|
-
}
|
|
1066
|
-
this.decodeChunk(e);
|
|
1036
|
+
if (!this.isReady || !this.decoder) {
|
|
1037
|
+
this.pendingChunks.push(e);
|
|
1038
|
+
return;
|
|
1067
1039
|
}
|
|
1040
|
+
e.isFirst && this.reset(), this.decodeChunk(e);
|
|
1068
1041
|
}
|
|
1069
1042
|
close() {
|
|
1070
1043
|
try {
|
|
1071
|
-
this.decoder?.
|
|
1044
|
+
this.decoder?.destroy();
|
|
1072
1045
|
} catch {
|
|
1073
1046
|
}
|
|
1074
|
-
this.decoder = null, this.
|
|
1047
|
+
this.decoder = null, this.pendingChunks.length = 0;
|
|
1075
1048
|
}
|
|
1076
1049
|
}
|
|
1077
|
-
const
|
|
1050
|
+
const c = /* @__PURE__ */ new Map();
|
|
1078
1051
|
async function Ee(t) {
|
|
1079
1052
|
if (t.closed || t.decoder)
|
|
1080
1053
|
return;
|
|
@@ -1136,17 +1109,17 @@ function ot(t, e) {
|
|
|
1136
1109
|
const r = e.Epoch, s = Number(e.TimeStampInInterleavedSamples), n = e.FrameSizeInInterleavedSamples;
|
|
1137
1110
|
if (t.currentEpoch !== r && (t.currentEpoch = r, t.epochSet = !1, t.lastArrivalTimeMs = 0, t.jitterMs = 0, t.sink.flush(), t.decoder.reset()), !t.epochSet) {
|
|
1138
1111
|
t.epochSet = !0;
|
|
1139
|
-
const
|
|
1140
|
-
t.expectedIntervalMs = n * 1e3 /
|
|
1112
|
+
const f = t.inputSampleRate * t.inputChannels;
|
|
1113
|
+
t.expectedIntervalMs = n * 1e3 / f;
|
|
1141
1114
|
}
|
|
1142
1115
|
const a = performance.now();
|
|
1143
1116
|
if (t.lastArrivalTimeMs > 0) {
|
|
1144
|
-
const
|
|
1145
|
-
t.jitterMs = t.jitterMs + (
|
|
1117
|
+
const f = a - t.lastArrivalTimeMs, N = Math.abs(f - t.expectedIntervalMs);
|
|
1118
|
+
t.jitterMs = t.jitterMs + (N - t.jitterMs) / qt;
|
|
1146
1119
|
}
|
|
1147
1120
|
t.lastArrivalTimeMs = a;
|
|
1148
|
-
const i = t.inputSampleRate * t.inputChannels, o = R * S, _ = Math.round(s * o / i), h = Math.round(n * o / i),
|
|
1149
|
-
|
|
1121
|
+
const i = t.inputSampleRate * t.inputChannels, o = R * S, _ = Math.round(s * o / i), h = Math.round(n * o / i), l = Math.round(s * 1e6 / i), E = Math.round(n * 1e6 / i);
|
|
1122
|
+
d({
|
|
1150
1123
|
type: "frame",
|
|
1151
1124
|
streamId: t.streamId,
|
|
1152
1125
|
epoch: r,
|
|
@@ -1159,12 +1132,12 @@ function ot(t, e) {
|
|
|
1159
1132
|
data: e.Samples,
|
|
1160
1133
|
isFirst: e.IsFirst,
|
|
1161
1134
|
isLast: e.IsLast,
|
|
1162
|
-
timestampUs:
|
|
1135
|
+
timestampUs: l,
|
|
1163
1136
|
durationUs: E
|
|
1164
1137
|
});
|
|
1165
1138
|
}
|
|
1166
|
-
function
|
|
1167
|
-
const e = W(t), r = Xt(t), s =
|
|
1139
|
+
function Ie(t) {
|
|
1140
|
+
const e = W(t), r = Xt(t), s = c.get(e);
|
|
1168
1141
|
if (s) {
|
|
1169
1142
|
s.closed = !0, s.pendingFrames.splice(0);
|
|
1170
1143
|
try {
|
|
@@ -1175,7 +1148,7 @@ function he(t) {
|
|
|
1175
1148
|
s.sink.drainPcm(), s.sink.close();
|
|
1176
1149
|
} catch {
|
|
1177
1150
|
}
|
|
1178
|
-
|
|
1151
|
+
c.delete(e);
|
|
1179
1152
|
}
|
|
1180
1153
|
const n = new se(e), a = {
|
|
1181
1154
|
streamId: e,
|
|
@@ -1193,22 +1166,22 @@ function he(t) {
|
|
|
1193
1166
|
jitterMs: 0,
|
|
1194
1167
|
expectedIntervalMs: 20
|
|
1195
1168
|
};
|
|
1196
|
-
|
|
1169
|
+
c.set(e, a), d({
|
|
1197
1170
|
type: "streamBegin",
|
|
1198
1171
|
streamId: e,
|
|
1199
1172
|
sharedArrayBuffer: n.getSharedArrayBuffer()
|
|
1200
1173
|
});
|
|
1201
1174
|
}
|
|
1202
|
-
function
|
|
1203
|
-
for (const t of
|
|
1204
|
-
|
|
1175
|
+
function he() {
|
|
1176
|
+
for (const t of c.values())
|
|
1177
|
+
d({
|
|
1205
1178
|
type: "streamBegin",
|
|
1206
1179
|
streamId: t.streamId,
|
|
1207
1180
|
sharedArrayBuffer: t.sink.getSharedArrayBuffer()
|
|
1208
1181
|
});
|
|
1209
1182
|
}
|
|
1210
1183
|
function fe(t) {
|
|
1211
|
-
const e = W(t), r =
|
|
1184
|
+
const e = W(t), r = c.get(e);
|
|
1212
1185
|
if (r) {
|
|
1213
1186
|
r.closed = !0, r.pendingFrames.splice(0);
|
|
1214
1187
|
try {
|
|
@@ -1219,11 +1192,11 @@ function fe(t) {
|
|
|
1219
1192
|
r.decoder?.close();
|
|
1220
1193
|
} catch {
|
|
1221
1194
|
}
|
|
1222
|
-
r.decoder = null,
|
|
1195
|
+
r.decoder = null, c.delete(e), d({ type: "streamEnd", streamId: e });
|
|
1223
1196
|
}
|
|
1224
1197
|
}
|
|
1225
1198
|
function ue(t) {
|
|
1226
|
-
const e = W(t), r =
|
|
1199
|
+
const e = W(t), r = c.get(e);
|
|
1227
1200
|
if (!r || r.closed)
|
|
1228
1201
|
return;
|
|
1229
1202
|
const s = Bt(t);
|
|
@@ -1236,9 +1209,9 @@ function ue(t) {
|
|
|
1236
1209
|
ot(r, s);
|
|
1237
1210
|
}
|
|
1238
1211
|
function Ae(t) {
|
|
1239
|
-
switch (
|
|
1212
|
+
switch (It(t)) {
|
|
1240
1213
|
case G.AUDIO_STREAM_BEGIN:
|
|
1241
|
-
|
|
1214
|
+
Ie(t);
|
|
1242
1215
|
return;
|
|
1243
1216
|
case G.AUDIO_STREAM_END:
|
|
1244
1217
|
fe(t);
|
|
@@ -1259,9 +1232,9 @@ function _t() {
|
|
|
1259
1232
|
y = null;
|
|
1260
1233
|
}
|
|
1261
1234
|
}
|
|
1262
|
-
function
|
|
1235
|
+
function Te() {
|
|
1263
1236
|
_t();
|
|
1264
|
-
for (const t of
|
|
1237
|
+
for (const t of c.values()) {
|
|
1265
1238
|
try {
|
|
1266
1239
|
t.sink.drainPcm(), t.sink.close();
|
|
1267
1240
|
} catch {
|
|
@@ -1271,7 +1244,7 @@ function ce() {
|
|
|
1271
1244
|
} catch {
|
|
1272
1245
|
}
|
|
1273
1246
|
}
|
|
1274
|
-
|
|
1247
|
+
c.clear();
|
|
1275
1248
|
}
|
|
1276
1249
|
self.addEventListener("message", (t) => {
|
|
1277
1250
|
const e = t.data;
|
|
@@ -1288,15 +1261,15 @@ self.addEventListener("message", (t) => {
|
|
|
1288
1261
|
}
|
|
1289
1262
|
if (e.type === "rebind") {
|
|
1290
1263
|
V = e.transport, typeof e.outputSampleRate == "number" && Number.isFinite(e.outputSampleRate) && e.outputSampleRate > 0 && (R = e.outputSampleRate), typeof e.outputChannels == "number" && Number.isFinite(e.outputChannels) && e.outputChannels > 0 && (S = e.outputChannels);
|
|
1291
|
-
for (const r of
|
|
1264
|
+
for (const r of c.values())
|
|
1292
1265
|
r.sink.setOutputFormat(R, S), r.sink.rebind(V);
|
|
1293
|
-
|
|
1266
|
+
he();
|
|
1294
1267
|
return;
|
|
1295
1268
|
}
|
|
1296
|
-
e.type === "dispose" &&
|
|
1269
|
+
e.type === "dispose" && Te();
|
|
1297
1270
|
});
|
|
1298
1271
|
let U = null;
|
|
1299
|
-
function
|
|
1272
|
+
function ce(t, e) {
|
|
1300
1273
|
const r = t.length;
|
|
1301
1274
|
if (r === 1)
|
|
1302
1275
|
return t[0];
|
|
@@ -1327,21 +1300,21 @@ function Ce(t, e, r, s, n) {
|
|
|
1327
1300
|
if (s === n)
|
|
1328
1301
|
return e.set(t), t.length;
|
|
1329
1302
|
const a = t.length / r, i = Math.max(1, Math.round(a * n / s)), o = s / n, _ = o > 1 ? o : 1, h = Math.ceil(J * _);
|
|
1330
|
-
for (let
|
|
1303
|
+
for (let l = 0; l < r; l++)
|
|
1331
1304
|
for (let E = 0; E < i; E++) {
|
|
1332
|
-
const
|
|
1305
|
+
const f = E * o, N = Math.floor(f);
|
|
1333
1306
|
let O = 0, m = 0;
|
|
1334
|
-
for (let
|
|
1335
|
-
const B =
|
|
1307
|
+
for (let v = -h + 1; v <= h; v++) {
|
|
1308
|
+
const B = N + v;
|
|
1336
1309
|
if (B < 0 || B >= a)
|
|
1337
1310
|
continue;
|
|
1338
|
-
const Et = (
|
|
1339
|
-
if (
|
|
1340
|
-
const lt = t[B * r +
|
|
1341
|
-
O += lt *
|
|
1311
|
+
const Et = (f - B) / _, k = Ne(Et, J);
|
|
1312
|
+
if (k !== 0) {
|
|
1313
|
+
const lt = t[B * r + l] ?? 0;
|
|
1314
|
+
O += lt * k, m += k;
|
|
1342
1315
|
}
|
|
1343
1316
|
}
|
|
1344
|
-
e[E * r +
|
|
1317
|
+
e[E * r + l] = m > 0 ? O / m : 0;
|
|
1345
1318
|
}
|
|
1346
1319
|
return i * r;
|
|
1347
1320
|
}
|