@ikonai/sdk 0.0.16 → 0.0.18
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,9 +1,9 @@
|
|
|
1
|
-
function
|
|
1
|
+
function pl(e) {
|
|
2
2
|
if (e.length < 8)
|
|
3
3
|
throw new Error("Protocol message too short");
|
|
4
4
|
return (e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24) >>> 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function al(e) {
|
|
7
7
|
const d = te(e), n = new DataView(d.buffer, d.byteOffset, d.byteLength);
|
|
8
8
|
if (d.length < 27)
|
|
9
9
|
throw new Error("Protocol payload too short");
|
|
@@ -27,7 +27,7 @@ function sl(e) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
function M(e, d, n) {
|
|
30
|
-
const i = te(e), s =
|
|
30
|
+
const i = te(e), s = al(i);
|
|
31
31
|
if (d !== void 0 && s.opcode !== d)
|
|
32
32
|
throw new Error(`Unexpected opcode ${s.opcode}`);
|
|
33
33
|
if (n !== void 0 && s.payloadVersion !== n)
|
|
@@ -46,10 +46,10 @@ function V(e, d, n, i, s) {
|
|
|
46
46
|
return o.set(d, l), o;
|
|
47
47
|
}
|
|
48
48
|
var k = /* @__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))(k || {});
|
|
49
|
-
const
|
|
49
|
+
const ul = 161, cl = 162, se = new TextEncoder(), bl = new TextDecoder("utf-8", { fatal: !0 });
|
|
50
50
|
class m {
|
|
51
51
|
constructor(d = 1) {
|
|
52
|
-
this.version = d, this.buffer.writeByte(
|
|
52
|
+
this.version = d, this.buffer.writeByte(ul), this.buffer.writeVarUInt(d >>> 0);
|
|
53
53
|
}
|
|
54
54
|
buffer = new le();
|
|
55
55
|
closed = !1;
|
|
@@ -107,7 +107,7 @@ class m {
|
|
|
107
107
|
this.writeVariableField(d, 10, u);
|
|
108
108
|
}
|
|
109
109
|
finish() {
|
|
110
|
-
return this.closed || (this.buffer.writeByte(
|
|
110
|
+
return this.closed || (this.buffer.writeByte(cl), this.closed = !0, this.cached = this.buffer.toUint8Array()), this.cached;
|
|
111
111
|
}
|
|
112
112
|
writeFixedField(d, n, i) {
|
|
113
113
|
this.writeFieldHeader(d, n, 0), i();
|
|
@@ -116,7 +116,7 @@ class m {
|
|
|
116
116
|
this.writeFieldHeader(d, n, i.length), this.buffer.writeBytes(i);
|
|
117
117
|
}
|
|
118
118
|
writeFieldHeader(d, n, i) {
|
|
119
|
-
this.buffer.writeUInt32(d >>> 0), this.buffer.writeByte(ae(n)),
|
|
119
|
+
this.buffer.writeUInt32(d >>> 0), this.buffer.writeByte(ae(n)), Ml(n) && this.buffer.writeVarUInt(i >>> 0);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
class ue {
|
|
@@ -240,7 +240,7 @@ class we {
|
|
|
240
240
|
beginEntry() {
|
|
241
241
|
if (this.entryOpen)
|
|
242
242
|
throw new Error("Previous dictionary entry not completed");
|
|
243
|
-
return this.count++, this.entryOpen = !0, new
|
|
243
|
+
return this.count++, this.entryOpen = !0, new ml(this.keyType, this.valueType, this.payload, () => {
|
|
244
244
|
this.entryOpen = !1;
|
|
245
245
|
});
|
|
246
246
|
}
|
|
@@ -251,7 +251,7 @@ class we {
|
|
|
251
251
|
return d.writeByte(ae(this.keyType)), d.writeByte(ae(this.valueType)), d.writeVarUInt(this.count), d.writeBytes(this.payload.toUint8Array()), d.toUint8Array();
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
class
|
|
254
|
+
class ml {
|
|
255
255
|
constructor(d, n, i, s) {
|
|
256
256
|
this.keyType = d, this.valueType = n, this.payload = i, this.onComplete = s;
|
|
257
257
|
}
|
|
@@ -452,7 +452,7 @@ class y {
|
|
|
452
452
|
const n = te(d);
|
|
453
453
|
if (n.length < 2)
|
|
454
454
|
throw new Error("Teleport payload too short");
|
|
455
|
-
if (n[0] !==
|
|
455
|
+
if (n[0] !== ul || n[n.length - 1] !== cl)
|
|
456
456
|
throw new Error("Teleport object missing markers");
|
|
457
457
|
const i = { offset: 1 }, s = G(n, i, "InvalidLength");
|
|
458
458
|
return new y(n, s, i.offset);
|
|
@@ -462,7 +462,7 @@ class y {
|
|
|
462
462
|
return null;
|
|
463
463
|
if (this.offset + 5 > this.buffer.length)
|
|
464
464
|
throw new Error("Teleport object truncated");
|
|
465
|
-
const d =
|
|
465
|
+
const d = Vl(this.buffer, this.offset);
|
|
466
466
|
this.offset += 4;
|
|
467
467
|
const n = this.buffer[this.offset++], i = n >> 4 & 15;
|
|
468
468
|
if ((n & 15) !== 0)
|
|
@@ -475,7 +475,7 @@ class y {
|
|
|
475
475
|
const u = { offset: this.offset }, f = G(this.buffer, u, "InvalidLength");
|
|
476
476
|
H(this.buffer, u.offset, f), a = this.buffer.subarray(u.offset, u.offset + f), this.offset = u.offset + f;
|
|
477
477
|
}
|
|
478
|
-
return new
|
|
478
|
+
return new yl(d, i, a);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
class x {
|
|
@@ -540,7 +540,7 @@ class x {
|
|
|
540
540
|
return this.ensureType(
|
|
541
541
|
12
|
|
542
542
|
/* String */
|
|
543
|
-
),
|
|
543
|
+
), bl.decode(this.payload);
|
|
544
544
|
}
|
|
545
545
|
asGuid() {
|
|
546
546
|
return this.ensureType(
|
|
@@ -571,7 +571,7 @@ class x {
|
|
|
571
571
|
throw new Error(`Teleport value has type ${k[this.type]}, expected ${k[d]}`);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
class
|
|
574
|
+
class yl extends x {
|
|
575
575
|
constructor(d, n, i) {
|
|
576
576
|
super(n, i), this.fieldId = d;
|
|
577
577
|
}
|
|
@@ -678,7 +678,7 @@ class Fe {
|
|
|
678
678
|
return null;
|
|
679
679
|
}
|
|
680
680
|
const d = this.readKey(), n = this.readValue();
|
|
681
|
-
return this.index++, new
|
|
681
|
+
return this.index++, new Nl(d, n);
|
|
682
682
|
}
|
|
683
683
|
readKey() {
|
|
684
684
|
const d = A(this.keyType);
|
|
@@ -737,7 +737,7 @@ class Fe {
|
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
class
|
|
740
|
+
class Nl {
|
|
741
741
|
constructor(d, n) {
|
|
742
742
|
this.key = d, this.value = n;
|
|
743
743
|
}
|
|
@@ -860,7 +860,7 @@ function G(e, d, n) {
|
|
|
860
860
|
for (; d.offset < e.length; ) {
|
|
861
861
|
const u = e[d.offset++];
|
|
862
862
|
if (a++, i |= (u & 127) << s, (u & 128) === 0) {
|
|
863
|
-
if (a !==
|
|
863
|
+
if (a !== El(i))
|
|
864
864
|
throw new Error("Teleport VarUInt is not canonical");
|
|
865
865
|
return i >>> 0;
|
|
866
866
|
}
|
|
@@ -869,7 +869,7 @@ function G(e, d, n) {
|
|
|
869
869
|
}
|
|
870
870
|
throw new Error(n);
|
|
871
871
|
}
|
|
872
|
-
function
|
|
872
|
+
function El(e) {
|
|
873
873
|
return e < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5;
|
|
874
874
|
}
|
|
875
875
|
function ae(e, d = 0) {
|
|
@@ -877,7 +877,7 @@ function ae(e, d = 0) {
|
|
|
877
877
|
throw new Error("Teleport flags must fit into 4 bits");
|
|
878
878
|
return (e & 15) << 4 | d & 15;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function Ml(e) {
|
|
881
881
|
return e === 12 || e === 13 || e === 9 || e === 11 || e === 10;
|
|
882
882
|
}
|
|
883
883
|
function A(e) {
|
|
@@ -908,7 +908,7 @@ function H(e, d, n) {
|
|
|
908
908
|
if (d < 0 || n < 0 || d + n > e.length)
|
|
909
909
|
throw new Error("Teleport payload exceeds bounds");
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function Vl(e, d) {
|
|
912
912
|
return (e[d] | e[d + 1] << 8 | e[d + 2] << 16 | e[d + 3] << 24) >>> 0;
|
|
913
913
|
}
|
|
914
914
|
function he(e, d) {
|
|
@@ -2715,7 +2715,7 @@ var $e;
|
|
|
2715
2715
|
}
|
|
2716
2716
|
e.fromProtocolMessage = T;
|
|
2717
2717
|
})($e || ($e = {}));
|
|
2718
|
-
var
|
|
2718
|
+
var Ze;
|
|
2719
2719
|
((e) => {
|
|
2720
2720
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048607, e.TeleportLayoutHash = 4089149075;
|
|
2721
2721
|
function d(l) {
|
|
@@ -2759,8 +2759,8 @@ var Re;
|
|
|
2759
2759
|
return a(o, r);
|
|
2760
2760
|
}
|
|
2761
2761
|
e.fromProtocolMessage = T;
|
|
2762
|
-
})(
|
|
2763
|
-
var
|
|
2762
|
+
})(Ze || (Ze = {}));
|
|
2763
|
+
var Re;
|
|
2764
2764
|
((e) => {
|
|
2765
2765
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048608, e.TeleportLayoutHash = 3380936216, e.UserIdFieldId = 781727218, e.ProfileIdFieldId = 829573080;
|
|
2766
2766
|
function d(l) {
|
|
@@ -2819,8 +2819,8 @@ var Ze;
|
|
|
2819
2819
|
return a(o, r);
|
|
2820
2820
|
}
|
|
2821
2821
|
e.fromProtocolMessage = T;
|
|
2822
|
-
})(
|
|
2823
|
-
var
|
|
2822
|
+
})(Re || (Re = {}));
|
|
2823
|
+
var Qe;
|
|
2824
2824
|
((e) => {
|
|
2825
2825
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048617, e.TeleportLayoutHash = 741281441, e.ProviderIdFieldId = 3862939506;
|
|
2826
2826
|
function d(l) {
|
|
@@ -2873,8 +2873,8 @@ var qe;
|
|
|
2873
2873
|
return a(o, r);
|
|
2874
2874
|
}
|
|
2875
2875
|
e.fromProtocolMessage = T;
|
|
2876
|
-
})(
|
|
2877
|
-
var
|
|
2876
|
+
})(Qe || (Qe = {}));
|
|
2877
|
+
var qe;
|
|
2878
2878
|
((e) => {
|
|
2879
2879
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048619, e.TeleportLayoutHash = 61919994, e.ContainerIdFieldId = 1545760265;
|
|
2880
2880
|
function d(l) {
|
|
@@ -2927,7 +2927,7 @@ var Qe;
|
|
|
2927
2927
|
return a(o, r);
|
|
2928
2928
|
}
|
|
2929
2929
|
e.fromProtocolMessage = T;
|
|
2930
|
-
})(
|
|
2930
|
+
})(qe || (qe = {}));
|
|
2931
2931
|
var Be;
|
|
2932
2932
|
((e) => {
|
|
2933
2933
|
e.TeleportVersion = 1, e.TeleportOpcode = 1048582, e.TeleportLayoutHash = 2410431510, e.ValueJsonFieldId = 1911490601, e.KeyFieldId = 2727489069, e.TypeNameFieldId = 3609695522;
|
|
@@ -7642,7 +7642,7 @@ var $r;
|
|
|
7642
7642
|
}
|
|
7643
7643
|
e.fromProtocolMessage = T;
|
|
7644
7644
|
})($r || ($r = {}));
|
|
7645
|
-
var
|
|
7645
|
+
var Zr;
|
|
7646
7646
|
((e) => {
|
|
7647
7647
|
e.TeleportVersion = 3, e.TeleportOpcode = 65539, e.TeleportLayoutHash = 2784858855, e.FirstUserIdFieldId = 693643444, e.ClientsFieldId = 1144553441, e.TrackingStreamsFieldId = 1497620243, e.ChannelIdFieldId = 1559330978, e.SessionIdFieldId = 1999510636, e.ChannelUrlFieldId = 2277643855, e.ChannelNameFieldId = 2469008121, e.OrganisationNameFieldId = 3219210453, e.FunctionsFieldId = 3678477544, e.UIStreamsFieldId = 3696445035, e.SpaceIdFieldId = 3707543140, e.PrimaryUserIdFieldId = 3712281496, e.ChannelInstanceIdFieldId = 3823842552, e.AudioStreamsFieldId = 3895362455, e.VideoStreamsFieldId = 3897397815, e.SpaceNameFieldId = 4225107827;
|
|
7648
7648
|
function d(h) {
|
|
@@ -7923,7 +7923,7 @@ var Rr;
|
|
|
7923
7923
|
}
|
|
7924
7924
|
h.create = N;
|
|
7925
7925
|
function F(E) {
|
|
7926
|
-
return E.StreamId = "", E.ClientSessionId = 0, E.TrackId = 0, E.Info =
|
|
7926
|
+
return E.StreamId = "", E.ClientSessionId = 0, E.TrackId = 0, E.Info = R.create(), E;
|
|
7927
7927
|
}
|
|
7928
7928
|
h.reset = F;
|
|
7929
7929
|
function I(E) {
|
|
@@ -7932,8 +7932,8 @@ var Rr;
|
|
|
7932
7932
|
}
|
|
7933
7933
|
h.encode = I;
|
|
7934
7934
|
function b(E, O) {
|
|
7935
|
-
O.writeStringField(h.StreamIdFieldId, E.StreamId), O.writeInt32Field(h.ClientSessionIdFieldId, E.ClientSessionId | 0), O.writeInt32Field(h.TrackIdFieldId, E.TrackId | 0), O.writeObjectField(h.InfoFieldId,
|
|
7936
|
-
|
|
7935
|
+
O.writeStringField(h.StreamIdFieldId, E.StreamId), O.writeInt32Field(h.ClientSessionIdFieldId, E.ClientSessionId | 0), O.writeInt32Field(h.TrackIdFieldId, E.TrackId | 0), O.writeObjectField(h.InfoFieldId, R.TeleportVersion, (g) => {
|
|
7936
|
+
R.writeToTeleport(E.Info, g);
|
|
7937
7937
|
});
|
|
7938
7938
|
}
|
|
7939
7939
|
h.writeToTeleport = b;
|
|
@@ -7972,7 +7972,7 @@ var Rr;
|
|
|
7972
7972
|
case h.InfoFieldId: {
|
|
7973
7973
|
if (g.isNull)
|
|
7974
7974
|
throw new Error("Field Info cannot be null");
|
|
7975
|
-
O.Info =
|
|
7975
|
+
O.Info = R.readFromTeleport(g.asObject());
|
|
7976
7976
|
break;
|
|
7977
7977
|
}
|
|
7978
7978
|
}
|
|
@@ -8164,8 +8164,8 @@ var Rr;
|
|
|
8164
8164
|
}
|
|
8165
8165
|
}
|
|
8166
8166
|
})(e.TrackingStreamState || (e.TrackingStreamState = {}));
|
|
8167
|
-
})(
|
|
8168
|
-
var
|
|
8167
|
+
})(Zr || (Zr = {}));
|
|
8168
|
+
var Rr;
|
|
8169
8169
|
((e) => {
|
|
8170
8170
|
e.TeleportVersion = 1, e.TeleportOpcode = 65555, e.TeleportLayoutHash = 698459242, e.ConfigJsonContentFieldId = 1808036573;
|
|
8171
8171
|
function d(l) {
|
|
@@ -8218,8 +8218,8 @@ var Zr;
|
|
|
8218
8218
|
return a(o, r);
|
|
8219
8219
|
}
|
|
8220
8220
|
e.fromProtocolMessage = T;
|
|
8221
|
-
})(
|
|
8222
|
-
var
|
|
8221
|
+
})(Rr || (Rr = {}));
|
|
8222
|
+
var Qr;
|
|
8223
8223
|
((e) => {
|
|
8224
8224
|
e.TeleportVersion = 6, e.TeleportOpcode = 65550, e.TeleportLayoutHash = 3230966584, e.DisableLegacyDefaultExtensionsFieldId = 36401917, e.DynamicConfigObsoleteFieldId = 150954643, e.ExtensionsFieldId = 202293898, e.TunnelPortsFieldId = 499708033, e.ChannelIdFieldId = 1559330978, e.SessionIdFieldId = 1999510636, e.ChannelUrlFieldId = 2277643855, e.ChannelNameFieldId = 2469008121, e.DynamicConfigJsonContentFieldId = 2471623304, e.SpaceGitRepositoryUrlFieldId = 2523372367, e.TunnelsFieldId = 2523979174, e.IkonBackendUrlFieldId = 3053917910, e.OrganisationNameFieldId = 3219210453, e.PluginsFieldId = 3362547405, e.SpaceIdFieldId = 3707543140, e.PrimaryUserIdFieldId = 3712281496, e.IkonBackendTokenFieldId = 3937688763, e.ChannelTemplateIdFieldId = 4160646707, e.SessionIdentityFieldId = 4187599097, e.SpaceNameFieldId = 4225107827;
|
|
8225
8225
|
function d(p) {
|
|
@@ -8476,8 +8476,8 @@ var qr;
|
|
|
8476
8476
|
function F(_, E) {
|
|
8477
8477
|
E.writeStringField(p.BundleDirectoryPathFieldId, _.BundleDirectoryPath), E.writeBinaryField(p.BundleDirectoryZipContentFieldId, _.BundleDirectoryZipContent), E.writeStringField(p.ConfigJsonContentFieldId, _.ConfigJsonContent), E.writeStringField(p.DllNameFieldId, _.DllName), E.writeStringField(p.ConfigFilePathFieldId, _.ConfigFilePath), E.writeBoolField(p.EnabledFieldId, _.Enabled), E.writeArrayField(p.ExtraConfigsFieldId, k.Object, (O) => {
|
|
8478
8478
|
for (const g of _.ExtraConfigs)
|
|
8479
|
-
O.writeObject(e.ServerPluginInitExtraConfig.TeleportVersion, (
|
|
8480
|
-
e.ServerPluginInitExtraConfig.writeToTeleport(g,
|
|
8479
|
+
O.writeObject(e.ServerPluginInitExtraConfig.TeleportVersion, (hl) => {
|
|
8480
|
+
e.ServerPluginInitExtraConfig.writeToTeleport(g, hl);
|
|
8481
8481
|
});
|
|
8482
8482
|
}), E.writeStringField(p.TypeNameFieldId, _.TypeName);
|
|
8483
8483
|
}
|
|
@@ -8656,8 +8656,8 @@ var qr;
|
|
|
8656
8656
|
}
|
|
8657
8657
|
}
|
|
8658
8658
|
})(e.ServerExtensionInit || (e.ServerExtensionInit = {}));
|
|
8659
|
-
})(
|
|
8660
|
-
var
|
|
8659
|
+
})(Qr || (Qr = {}));
|
|
8660
|
+
var qr;
|
|
8661
8661
|
((e) => {
|
|
8662
8662
|
e.TeleportVersion = 1, e.TeleportOpcode = 65557, e.TeleportLayoutHash = 1731463462, e.SessionIdFieldId = 1999510636, e.SessionIdentityFieldId = 4187599097;
|
|
8663
8663
|
function d(r) {
|
|
@@ -8734,7 +8734,7 @@ var Qr;
|
|
|
8734
8734
|
}
|
|
8735
8735
|
return o;
|
|
8736
8736
|
}
|
|
8737
|
-
})(
|
|
8737
|
+
})(qr || (qr = {}));
|
|
8738
8738
|
var Br;
|
|
8739
8739
|
((e) => {
|
|
8740
8740
|
e.TeleportVersion = 1, e.TeleportOpcode = 65552, e.TeleportLayoutHash = 3513573677, e.HostServerSessionIdFieldId = 1469496005, e.ConfigJsonContentFieldId = 1808036573;
|
|
@@ -13404,7 +13404,7 @@ var $o;
|
|
|
13404
13404
|
return o;
|
|
13405
13405
|
}
|
|
13406
13406
|
})($o || ($o = {}));
|
|
13407
|
-
var
|
|
13407
|
+
var Zo;
|
|
13408
13408
|
((e) => {
|
|
13409
13409
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097189, e.TeleportLayoutHash = 3225070243, e.StyleIdFieldId = 979822885, e.SvgFieldId = 1032553508, e.ElementIdFieldId = 1753055760, e.LabelsFieldId = 2329079073;
|
|
13410
13410
|
function d(r) {
|
|
@@ -13485,8 +13485,8 @@ var Ro;
|
|
|
13485
13485
|
o.push(t.asString());
|
|
13486
13486
|
return o;
|
|
13487
13487
|
}
|
|
13488
|
-
})(
|
|
13489
|
-
var
|
|
13488
|
+
})(Zo || (Zo = {}));
|
|
13489
|
+
var Ro;
|
|
13490
13490
|
((e) => {
|
|
13491
13491
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097162, e.TeleportLayoutHash = 4195353566, e.StyleIdFieldId = 979822885, e.ColorFieldId = 1668824531, e.ElementIdFieldId = 1753055760, e.TextFieldId = 2069861431, e.LabelsFieldId = 2329079073, e.TypeFieldId = 3167053791;
|
|
13492
13492
|
function d(r) {
|
|
@@ -13579,8 +13579,8 @@ var Zo;
|
|
|
13579
13579
|
o.push(t.asString());
|
|
13580
13580
|
return o;
|
|
13581
13581
|
}
|
|
13582
|
-
})(
|
|
13583
|
-
var
|
|
13582
|
+
})(Ro || (Ro = {}));
|
|
13583
|
+
var Qo;
|
|
13584
13584
|
((e) => {
|
|
13585
13585
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097182, e.TeleportLayoutHash = 4089149075;
|
|
13586
13586
|
function d(l) {
|
|
@@ -13624,8 +13624,8 @@ var qo;
|
|
|
13624
13624
|
return a(o, r);
|
|
13625
13625
|
}
|
|
13626
13626
|
e.fromProtocolMessage = T;
|
|
13627
|
-
})(
|
|
13628
|
-
var
|
|
13627
|
+
})(Qo || (Qo = {}));
|
|
13628
|
+
var qo;
|
|
13629
13629
|
((e) => {
|
|
13630
13630
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097183, e.TeleportLayoutHash = 4089149075;
|
|
13631
13631
|
function d(l) {
|
|
@@ -13669,7 +13669,7 @@ var Qo;
|
|
|
13669
13669
|
return a(o, r);
|
|
13670
13670
|
}
|
|
13671
13671
|
e.fromProtocolMessage = T;
|
|
13672
|
-
})(
|
|
13672
|
+
})(qo || (qo = {}));
|
|
13673
13673
|
var Bo;
|
|
13674
13674
|
((e) => {
|
|
13675
13675
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097172, e.TeleportLayoutHash = 3917385670, e.DataJsonFieldId = 896140642, e.StyleIdFieldId = 979822885, e.ElementIdFieldId = 1753055760, e.SpecJsonFieldId = 2277734115, e.LabelsFieldId = 2329079073;
|
|
@@ -13758,7 +13758,7 @@ var Bo;
|
|
|
13758
13758
|
return o;
|
|
13759
13759
|
}
|
|
13760
13760
|
})(Bo || (Bo = {}));
|
|
13761
|
-
var
|
|
13761
|
+
var R;
|
|
13762
13762
|
((e) => {
|
|
13763
13763
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097153, e.TeleportLayoutHash = 2098848026, e.CategoryFieldId = 3612929027;
|
|
13764
13764
|
function d(l) {
|
|
@@ -13811,7 +13811,7 @@ var q;
|
|
|
13811
13811
|
return a(o, r);
|
|
13812
13812
|
}
|
|
13813
13813
|
e.fromProtocolMessage = T;
|
|
13814
|
-
})(
|
|
13814
|
+
})(R || (R = {}));
|
|
13815
13815
|
var Ao;
|
|
13816
13816
|
((e) => {
|
|
13817
13817
|
e.TeleportVersion = 1, e.TeleportOpcode = 2097154, e.TeleportLayoutHash = 4089149075;
|
|
@@ -14556,9 +14556,9 @@ class il {
|
|
|
14556
14556
|
return i = (i + n) % this.capacity, Atomics.store(this.readWrite, 0, i), n;
|
|
14557
14557
|
}
|
|
14558
14558
|
}
|
|
14559
|
-
const
|
|
14560
|
-
function
|
|
14561
|
-
if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" ||
|
|
14559
|
+
const Pl = globalThis;
|
|
14560
|
+
function Ol() {
|
|
14561
|
+
if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" || Pl.crossOriginIsolated === !1)
|
|
14562
14562
|
return !1;
|
|
14563
14563
|
try {
|
|
14564
14564
|
new SharedArrayBuffer(1);
|
|
@@ -14567,13 +14567,13 @@ function Sl() {
|
|
|
14567
14567
|
}
|
|
14568
14568
|
return !0;
|
|
14569
14569
|
}
|
|
14570
|
-
let
|
|
14571
|
-
function
|
|
14570
|
+
let Sl = 1;
|
|
14571
|
+
function kl(e, d) {
|
|
14572
14572
|
return `[${e}] ${d}`;
|
|
14573
14573
|
}
|
|
14574
14574
|
function de(e, d, n, i) {
|
|
14575
|
-
if ((/* @__PURE__ */ new Date()).toISOString(),
|
|
14576
|
-
const s =
|
|
14575
|
+
if ((/* @__PURE__ */ new Date()).toISOString(), Sl <= e) {
|
|
14576
|
+
const s = kl(d, n);
|
|
14577
14577
|
switch (e) {
|
|
14578
14578
|
case 0:
|
|
14579
14579
|
console.debug(s, ...i);
|
|
@@ -14590,7 +14590,7 @@ function de(e, d, n, i) {
|
|
|
14590
14590
|
}
|
|
14591
14591
|
}
|
|
14592
14592
|
}
|
|
14593
|
-
function
|
|
14593
|
+
function _l(e) {
|
|
14594
14594
|
return {
|
|
14595
14595
|
debug(d, ...n) {
|
|
14596
14596
|
de(0, e, d, n);
|
|
@@ -14606,55 +14606,47 @@ function gl(e) {
|
|
|
14606
14606
|
}
|
|
14607
14607
|
};
|
|
14608
14608
|
}
|
|
14609
|
-
const
|
|
14609
|
+
const gl = _l("AudioWorker"), Dl = 2, fl = 48e3, wl = 2, sl = 64, U = (e, d) => {
|
|
14610
14610
|
self.postMessage(e, d ?? []);
|
|
14611
|
-
},
|
|
14612
|
-
let ie = "pcm",
|
|
14613
|
-
function
|
|
14611
|
+
}, Cl = Ol();
|
|
14612
|
+
let ie = "pcm", Il = !0, X = fl, $ = wl, B = null;
|
|
14613
|
+
function q(e, d) {
|
|
14614
14614
|
const n = e instanceof Error ? e : new Error(String(e));
|
|
14615
14615
|
U({ type: "error", error: { name: n.name, message: n.message, stack: n.stack }, streamId: d });
|
|
14616
14616
|
}
|
|
14617
14617
|
function be(e) {
|
|
14618
|
-
const d =
|
|
14618
|
+
const d = al(e);
|
|
14619
14619
|
return `${d.senderId}_${d.trackId}`;
|
|
14620
14620
|
}
|
|
14621
|
-
class
|
|
14621
|
+
class Ll {
|
|
14622
14622
|
mode;
|
|
14623
14623
|
ring = null;
|
|
14624
14624
|
sab = void 0;
|
|
14625
14625
|
streamId;
|
|
14626
|
-
lastWriteTimeMs = 0;
|
|
14627
|
-
jitter = 0;
|
|
14628
|
-
expectedIntervalMs = 20;
|
|
14629
14626
|
outputSampleRate;
|
|
14630
14627
|
outputChannels;
|
|
14631
14628
|
constructor(d) {
|
|
14632
|
-
this.streamId = d, this.mode = "pcm", this.outputSampleRate =
|
|
14629
|
+
this.streamId = d, this.mode = "pcm", this.outputSampleRate = X, this.outputChannels = $, this.rebind(ie);
|
|
14633
14630
|
}
|
|
14634
14631
|
setOutputFormat(d, n) {
|
|
14635
14632
|
this.outputSampleRate = d, this.outputChannels = n;
|
|
14636
14633
|
}
|
|
14637
14634
|
rebind(d) {
|
|
14638
|
-
if (this.mode = d, d === "sab" &&
|
|
14639
|
-
const n = Math.floor(
|
|
14635
|
+
if (this.mode = d, d === "sab" && Cl) {
|
|
14636
|
+
const n = Math.floor(Dl * this.outputSampleRate * this.outputChannels), i = il.getStorageForCapacity(n, Float32Array), s = new il(i, Float32Array);
|
|
14640
14637
|
s.flush(), this.sab = i, this.ring = s;
|
|
14641
14638
|
return;
|
|
14642
14639
|
}
|
|
14643
14640
|
this.sab = void 0, this.ring = null;
|
|
14644
14641
|
}
|
|
14645
14642
|
writePcm(d) {
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
let s = d;
|
|
14654
|
-
const a = Math.max(0, i.capacity - 1);
|
|
14655
|
-
s.length > a && (s = s.subarray(s.length - a));
|
|
14656
|
-
const u = i.availableWrite();
|
|
14657
|
-
s.length > u && i.skip(s.length - u), i.push(s) < s.length && (i.flush(), i.push(s));
|
|
14643
|
+
if (this.mode === "sab" && this.ring) {
|
|
14644
|
+
const n = this.ring;
|
|
14645
|
+
let i = d;
|
|
14646
|
+
const s = Math.max(0, n.capacity - 1);
|
|
14647
|
+
i.length > s && (i = i.subarray(i.length - s));
|
|
14648
|
+
const a = n.availableWrite();
|
|
14649
|
+
i.length > a && n.skip(i.length - a), n.push(i) < i.length && (n.flush(), n.push(i));
|
|
14658
14650
|
return;
|
|
14659
14651
|
}
|
|
14660
14652
|
U({ type: "pcm", streamId: this.streamId, pcm: d }, [d.buffer]);
|
|
@@ -14662,17 +14654,11 @@ class jl {
|
|
|
14662
14654
|
getSharedArrayBuffer() {
|
|
14663
14655
|
return this.sab;
|
|
14664
14656
|
}
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
}
|
|
14668
|
-
resetJitter() {
|
|
14669
|
-
this.lastWriteTimeMs = 0, this.jitter = 0;
|
|
14670
|
-
}
|
|
14671
|
-
setExpectedIntervalMs(d) {
|
|
14672
|
-
this.expectedIntervalMs = d;
|
|
14657
|
+
flush() {
|
|
14658
|
+
this.ring?.flush();
|
|
14673
14659
|
}
|
|
14674
14660
|
}
|
|
14675
|
-
function
|
|
14661
|
+
function jl(e) {
|
|
14676
14662
|
switch (e) {
|
|
14677
14663
|
case K.Opus:
|
|
14678
14664
|
return "opus";
|
|
@@ -14682,7 +14668,7 @@ function Hl(e) {
|
|
|
14682
14668
|
return null;
|
|
14683
14669
|
}
|
|
14684
14670
|
}
|
|
14685
|
-
function
|
|
14671
|
+
function Hl(e) {
|
|
14686
14672
|
const d = new DataView(e.buffer, e.byteOffset, e.byteLength), n = Math.floor(e.byteLength / 2), i = new Float32Array(n);
|
|
14687
14673
|
for (let s = 0; s < n; s++) {
|
|
14688
14674
|
const a = d.getInt16(s * 2, !0);
|
|
@@ -14691,7 +14677,6 @@ function Gl(e) {
|
|
|
14691
14677
|
return i;
|
|
14692
14678
|
}
|
|
14693
14679
|
class me {
|
|
14694
|
-
isKeyFrameRequired = !0;
|
|
14695
14680
|
inputSampleRate;
|
|
14696
14681
|
inputChannels;
|
|
14697
14682
|
sink;
|
|
@@ -14699,7 +14684,6 @@ class me {
|
|
|
14699
14684
|
this.inputSampleRate = d.inputSampleRate, this.inputChannels = d.inputChannels, this.sink = d.sink;
|
|
14700
14685
|
}
|
|
14701
14686
|
reset() {
|
|
14702
|
-
this.isKeyFrameRequired = !0;
|
|
14703
14687
|
}
|
|
14704
14688
|
writeConvertedPcm(d, n, i) {
|
|
14705
14689
|
const s = this.convertPcmBuffer(d, n, i);
|
|
@@ -14722,7 +14706,7 @@ class me {
|
|
|
14722
14706
|
try {
|
|
14723
14707
|
l = w();
|
|
14724
14708
|
} catch (r) {
|
|
14725
|
-
|
|
14709
|
+
gl.debug(`Failed to read planar audio data, falling back to interleaved copy: ${r}`), l = T();
|
|
14726
14710
|
}
|
|
14727
14711
|
else
|
|
14728
14712
|
l = T();
|
|
@@ -14733,23 +14717,19 @@ class me {
|
|
|
14733
14717
|
return d;
|
|
14734
14718
|
let s = d;
|
|
14735
14719
|
const a = n;
|
|
14736
|
-
return i !==
|
|
14720
|
+
return i !== X && (s = Ql(s, a, i, X)), a !== $ && (s = ql(s, a, $)), s;
|
|
14737
14721
|
}
|
|
14738
14722
|
}
|
|
14739
|
-
class
|
|
14723
|
+
class Gl extends me {
|
|
14740
14724
|
feedChunk(d) {
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
return;
|
|
14744
|
-
this.isKeyFrameRequired = !1;
|
|
14745
|
-
}
|
|
14746
|
-
const n = Gl(d.data);
|
|
14725
|
+
d.isFirst && this.reset();
|
|
14726
|
+
const n = Hl(d.data);
|
|
14747
14727
|
this.writeConvertedPcm(n, this.inputChannels, this.inputSampleRate), d.isLast && this.reset();
|
|
14748
14728
|
}
|
|
14749
14729
|
close() {
|
|
14750
14730
|
}
|
|
14751
14731
|
}
|
|
14752
|
-
class
|
|
14732
|
+
class Jl extends me {
|
|
14753
14733
|
decoder;
|
|
14754
14734
|
codec;
|
|
14755
14735
|
constructor(d) {
|
|
@@ -14759,7 +14739,7 @@ class xl extends me {
|
|
|
14759
14739
|
const i = this.convertAudioData(n);
|
|
14760
14740
|
this.writeConvertedPcm(i, n.numberOfChannels, n.sampleRate);
|
|
14761
14741
|
} catch (i) {
|
|
14762
|
-
|
|
14742
|
+
q(i);
|
|
14763
14743
|
} finally {
|
|
14764
14744
|
try {
|
|
14765
14745
|
n.close();
|
|
@@ -14768,22 +14748,17 @@ class xl extends me {
|
|
|
14768
14748
|
}
|
|
14769
14749
|
},
|
|
14770
14750
|
error: (n) => {
|
|
14771
|
-
|
|
14751
|
+
q(n);
|
|
14772
14752
|
}
|
|
14773
14753
|
}), this.decoder.configure({ codec: d.codec, numberOfChannels: d.inputChannels, sampleRate: d.inputSampleRate });
|
|
14774
14754
|
}
|
|
14775
14755
|
feedChunk(d) {
|
|
14776
14756
|
try {
|
|
14777
|
-
if (d.isFirst && this.reset(), this.
|
|
14778
|
-
if (!d.isKey)
|
|
14779
|
-
return;
|
|
14780
|
-
this.isKeyFrameRequired = !1;
|
|
14781
|
-
}
|
|
14782
|
-
if (this.decoder.state !== "configured")
|
|
14757
|
+
if (d.isFirst && this.reset(), this.decoder.state !== "configured")
|
|
14783
14758
|
return;
|
|
14784
14759
|
this.decoder.decode(
|
|
14785
14760
|
new EncodedAudioChunk({
|
|
14786
|
-
type:
|
|
14761
|
+
type: "key",
|
|
14787
14762
|
timestamp: d.timestampUs,
|
|
14788
14763
|
duration: d.durationUs,
|
|
14789
14764
|
data: d.data
|
|
@@ -14791,7 +14766,11 @@ class xl extends me {
|
|
|
14791
14766
|
), d.isLast && this.decoder.flush().catch(() => {
|
|
14792
14767
|
});
|
|
14793
14768
|
} catch (n) {
|
|
14794
|
-
|
|
14769
|
+
q(n);
|
|
14770
|
+
try {
|
|
14771
|
+
this.reset();
|
|
14772
|
+
} catch {
|
|
14773
|
+
}
|
|
14795
14774
|
}
|
|
14796
14775
|
}
|
|
14797
14776
|
reset() {
|
|
@@ -14799,7 +14778,7 @@ class xl extends me {
|
|
|
14799
14778
|
try {
|
|
14800
14779
|
this.decoder.reset(), this.decoder.configure({ codec: this.codec, numberOfChannels: this.inputChannels, sampleRate: this.inputSampleRate });
|
|
14801
14780
|
} catch (d) {
|
|
14802
|
-
|
|
14781
|
+
q(d);
|
|
14803
14782
|
}
|
|
14804
14783
|
}
|
|
14805
14784
|
close() {
|
|
@@ -14809,7 +14788,7 @@ class xl extends me {
|
|
|
14809
14788
|
}
|
|
14810
14789
|
}
|
|
14811
14790
|
}
|
|
14812
|
-
class
|
|
14791
|
+
class xl extends me {
|
|
14813
14792
|
decoder = null;
|
|
14814
14793
|
isReady = !1;
|
|
14815
14794
|
decoderSampleRate = 48e3;
|
|
@@ -14855,11 +14834,6 @@ class Kl extends me {
|
|
|
14855
14834
|
decodeChunk(d) {
|
|
14856
14835
|
if (!(!this.isReady || !this.decoder))
|
|
14857
14836
|
try {
|
|
14858
|
-
if (this.isKeyFrameRequired) {
|
|
14859
|
-
if (!d.isKey)
|
|
14860
|
-
return;
|
|
14861
|
-
this.isKeyFrameRequired = !1;
|
|
14862
|
-
}
|
|
14863
14837
|
if (d.data.byteLength === 0)
|
|
14864
14838
|
return;
|
|
14865
14839
|
const n = d.data.byteOffset === 0 && d.data.byteLength === d.data.buffer.byteLength ? d.data : d.data.slice(), i = this.decoder.decodeFrame(n), s = i.channelData, a = i.samplesDecoded, u = s.length;
|
|
@@ -14873,7 +14847,7 @@ class Kl extends me {
|
|
|
14873
14847
|
}
|
|
14874
14848
|
this.writeConvertedPcm(f, u, this.decoderSampleRate), d.isLast && this.reset();
|
|
14875
14849
|
} catch (n) {
|
|
14876
|
-
this.
|
|
14850
|
+
q(n), this.scheduleReset();
|
|
14877
14851
|
}
|
|
14878
14852
|
}
|
|
14879
14853
|
feedChunk(d) {
|
|
@@ -14894,81 +14868,105 @@ class Kl extends me {
|
|
|
14894
14868
|
}
|
|
14895
14869
|
}
|
|
14896
14870
|
const J = /* @__PURE__ */ new Map();
|
|
14897
|
-
async function
|
|
14898
|
-
if (e.decoder)
|
|
14871
|
+
async function Kl(e) {
|
|
14872
|
+
if (e.closed || e.decoder)
|
|
14899
14873
|
return;
|
|
14900
14874
|
if (e.codec === K.RawPcm16) {
|
|
14901
|
-
e.decoder = new
|
|
14875
|
+
e.decoder = new Gl({ inputChannels: e.inputChannels, inputSampleRate: e.inputSampleRate, sink: e.sink });
|
|
14902
14876
|
return;
|
|
14903
14877
|
}
|
|
14904
14878
|
if (e.codec !== K.Opus && e.codec !== K.Mp3)
|
|
14905
14879
|
throw new Error(`Unsupported audio codec: ${K[e.codec] ?? e.codec}`);
|
|
14906
|
-
const d =
|
|
14907
|
-
if (
|
|
14880
|
+
const d = jl(e.codec);
|
|
14881
|
+
if (Il && typeof AudioDecoder < "u" && d !== null)
|
|
14908
14882
|
try {
|
|
14909
14883
|
if ((await AudioDecoder.isConfigSupported({ codec: d, numberOfChannels: e.inputChannels, sampleRate: e.inputSampleRate })).supported) {
|
|
14910
|
-
|
|
14884
|
+
const s = new Jl({
|
|
14911
14885
|
codec: d,
|
|
14912
14886
|
inputChannels: e.inputChannels,
|
|
14913
14887
|
inputSampleRate: e.inputSampleRate,
|
|
14914
14888
|
sink: e.sink
|
|
14915
14889
|
});
|
|
14890
|
+
if (e.closed) {
|
|
14891
|
+
s.close();
|
|
14892
|
+
return;
|
|
14893
|
+
}
|
|
14894
|
+
e.decoder = s;
|
|
14916
14895
|
return;
|
|
14917
14896
|
}
|
|
14918
14897
|
} catch {
|
|
14919
14898
|
}
|
|
14920
14899
|
if (e.codec === K.Opus) {
|
|
14921
|
-
const i = new
|
|
14922
|
-
await i.initialise(e.inputChannels, e.inputSampleRate), e.
|
|
14900
|
+
const i = new xl({ inputChannels: e.inputChannels, inputSampleRate: e.inputSampleRate, sink: e.sink });
|
|
14901
|
+
if (await i.initialise(e.inputChannels, e.inputSampleRate), e.closed) {
|
|
14902
|
+
i.close();
|
|
14903
|
+
return;
|
|
14904
|
+
}
|
|
14905
|
+
e.decoder = i;
|
|
14923
14906
|
return;
|
|
14924
14907
|
}
|
|
14925
14908
|
throw new Error(`No available decoder for codec: ${K[e.codec] ?? e.codec}`);
|
|
14926
14909
|
}
|
|
14927
|
-
function
|
|
14910
|
+
function Wl(e) {
|
|
14911
|
+
if (e.closed) {
|
|
14912
|
+
e.pendingFrames.splice(0);
|
|
14913
|
+
try {
|
|
14914
|
+
e.decoder?.close();
|
|
14915
|
+
} catch {
|
|
14916
|
+
}
|
|
14917
|
+
e.decoder = null;
|
|
14918
|
+
return;
|
|
14919
|
+
}
|
|
14928
14920
|
if (!e.decoder)
|
|
14929
14921
|
return;
|
|
14930
14922
|
const d = e.pendingFrames.splice(0);
|
|
14931
14923
|
for (const n of d)
|
|
14932
|
-
|
|
14924
|
+
Fl(e, n);
|
|
14933
14925
|
}
|
|
14934
|
-
function
|
|
14935
|
-
if (!e.decoder)
|
|
14926
|
+
function Fl(e, d) {
|
|
14927
|
+
if (e.closed || !e.decoder)
|
|
14936
14928
|
return;
|
|
14937
14929
|
const n = d.Epoch, i = Number(d.TimeStampInInterleavedSamples), s = d.FrameSizeInInterleavedSamples;
|
|
14938
|
-
if (e.currentEpoch !== n && (e.currentEpoch = n, e.epochSet = !1, e.sink.
|
|
14930
|
+
if (e.currentEpoch !== n && (e.currentEpoch = n, e.epochSet = !1, e.lastArrivalTimeMs = 0, e.jitterMs = 0, e.sink.flush(), e.decoder.reset()), !e.epochSet) {
|
|
14939
14931
|
e.epochSet = !0;
|
|
14940
|
-
const
|
|
14941
|
-
e.
|
|
14932
|
+
const o = e.inputSampleRate * e.inputChannels;
|
|
14933
|
+
e.expectedIntervalMs = s * 1e3 / o;
|
|
14942
14934
|
}
|
|
14943
|
-
const a =
|
|
14944
|
-
e.
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
}), U({
|
|
14935
|
+
const a = performance.now();
|
|
14936
|
+
if (e.lastArrivalTimeMs > 0) {
|
|
14937
|
+
const o = a - e.lastArrivalTimeMs, t = Math.abs(o - e.expectedIntervalMs);
|
|
14938
|
+
e.jitterMs = e.jitterMs + (t - e.jitterMs) / 16;
|
|
14939
|
+
}
|
|
14940
|
+
e.lastArrivalTimeMs = a;
|
|
14941
|
+
const u = e.inputSampleRate * e.inputChannels, f = X * $, w = Math.round(i * f / u), T = Math.round(s * f / u), l = Math.round(i * 1e6 / u), r = Math.round(s * 1e6 / u);
|
|
14942
|
+
U({
|
|
14952
14943
|
type: "frame",
|
|
14953
14944
|
streamId: e.streamId,
|
|
14954
14945
|
epoch: n,
|
|
14955
|
-
tsInterleavedSamples:
|
|
14956
|
-
frameSizeInterleavedSamples:
|
|
14946
|
+
tsInterleavedSamples: w,
|
|
14947
|
+
frameSizeInterleavedSamples: T,
|
|
14948
|
+
isFirst: d.IsFirst,
|
|
14949
|
+
isLast: d.IsLast,
|
|
14950
|
+
jitterMs: e.jitterMs
|
|
14951
|
+
}), e.decoder.feedChunk({
|
|
14952
|
+
data: d.Samples,
|
|
14957
14953
|
isFirst: d.IsFirst,
|
|
14958
14954
|
isLast: d.IsLast,
|
|
14959
|
-
|
|
14955
|
+
timestampUs: l,
|
|
14956
|
+
durationUs: r
|
|
14960
14957
|
});
|
|
14961
14958
|
}
|
|
14962
|
-
function
|
|
14959
|
+
function vl(e) {
|
|
14963
14960
|
const d = be(e), n = z.fromProtocolMessage(e), i = J.get(d);
|
|
14964
14961
|
if (i) {
|
|
14962
|
+
i.closed = !0, i.pendingFrames.splice(0);
|
|
14965
14963
|
try {
|
|
14966
14964
|
i.decoder?.close();
|
|
14967
14965
|
} catch {
|
|
14968
14966
|
}
|
|
14969
14967
|
J.delete(d);
|
|
14970
14968
|
}
|
|
14971
|
-
const s = new
|
|
14969
|
+
const s = new Ll(d), a = {
|
|
14972
14970
|
streamId: d,
|
|
14973
14971
|
codec: n.Codec,
|
|
14974
14972
|
inputSampleRate: n.SampleRate,
|
|
@@ -14978,17 +14976,19 @@ function Wl(e) {
|
|
|
14978
14976
|
pendingFrames: [],
|
|
14979
14977
|
initTask: null,
|
|
14980
14978
|
currentEpoch: -1,
|
|
14981
|
-
epochSet: !1
|
|
14979
|
+
epochSet: !1,
|
|
14980
|
+
closed: !1,
|
|
14981
|
+
lastArrivalTimeMs: 0,
|
|
14982
|
+
jitterMs: 0,
|
|
14983
|
+
expectedIntervalMs: 20
|
|
14982
14984
|
};
|
|
14983
14985
|
J.set(d, a), U({
|
|
14984
14986
|
type: "streamBegin",
|
|
14985
14987
|
streamId: d,
|
|
14986
14988
|
sharedArrayBuffer: s.getSharedArrayBuffer()
|
|
14987
|
-
}), a.initTask = Il(a).then(() => Fl(a)).catch((u) => {
|
|
14988
|
-
X(u, d);
|
|
14989
14989
|
});
|
|
14990
14990
|
}
|
|
14991
|
-
function
|
|
14991
|
+
function Yl() {
|
|
14992
14992
|
for (const e of J.values())
|
|
14993
14993
|
U({
|
|
14994
14994
|
type: "streamBegin",
|
|
@@ -14996,39 +14996,46 @@ function vl() {
|
|
|
14996
14996
|
sharedArrayBuffer: e.sink.getSharedArrayBuffer()
|
|
14997
14997
|
});
|
|
14998
14998
|
}
|
|
14999
|
-
function
|
|
14999
|
+
function zl(e) {
|
|
15000
15000
|
const d = be(e), n = J.get(d);
|
|
15001
|
-
|
|
15001
|
+
if (n) {
|
|
15002
|
+
n.closed = !0, n.pendingFrames.splice(0);
|
|
15003
|
+
try {
|
|
15004
|
+
n.decoder?.close();
|
|
15005
|
+
} catch {
|
|
15006
|
+
}
|
|
15007
|
+
n.decoder = null, J.delete(d), U({ type: "streamEnd", streamId: d });
|
|
15008
|
+
}
|
|
15002
15009
|
}
|
|
15003
|
-
function
|
|
15010
|
+
function Xl(e) {
|
|
15004
15011
|
const d = be(e), n = J.get(d);
|
|
15005
|
-
if (!n)
|
|
15012
|
+
if (!n || n.closed)
|
|
15006
15013
|
return;
|
|
15007
15014
|
const i = fe.fromProtocolMessage(e);
|
|
15008
15015
|
if (!n.decoder) {
|
|
15009
|
-
n.pendingFrames.push(i), n.initTask || (n.initTask =
|
|
15010
|
-
|
|
15016
|
+
n.pendingFrames.length >= sl && n.pendingFrames.splice(0, n.pendingFrames.length - sl + 1), n.pendingFrames.push(i), n.initTask || (n.initTask = Kl(n).then(() => Wl(n)).catch((s) => {
|
|
15017
|
+
n.closed || q(s, d);
|
|
15011
15018
|
}));
|
|
15012
15019
|
return;
|
|
15013
15020
|
}
|
|
15014
|
-
|
|
15021
|
+
Fl(n, i);
|
|
15015
15022
|
}
|
|
15016
|
-
function
|
|
15017
|
-
switch (
|
|
15023
|
+
function $l(e) {
|
|
15024
|
+
switch (pl(e)) {
|
|
15018
15025
|
case ne.AUDIO_STREAM_BEGIN:
|
|
15019
|
-
|
|
15026
|
+
vl(e);
|
|
15020
15027
|
return;
|
|
15021
15028
|
case ne.AUDIO_STREAM_END:
|
|
15022
|
-
|
|
15029
|
+
zl(e);
|
|
15023
15030
|
return;
|
|
15024
15031
|
case ne.AUDIO_FRAME2:
|
|
15025
|
-
|
|
15032
|
+
Xl(e);
|
|
15026
15033
|
return;
|
|
15027
15034
|
default:
|
|
15028
15035
|
return;
|
|
15029
15036
|
}
|
|
15030
15037
|
}
|
|
15031
|
-
function
|
|
15038
|
+
function Tl() {
|
|
15032
15039
|
if (B) {
|
|
15033
15040
|
try {
|
|
15034
15041
|
B.close();
|
|
@@ -15037,8 +15044,8 @@ function hl() {
|
|
|
15037
15044
|
B = null;
|
|
15038
15045
|
}
|
|
15039
15046
|
}
|
|
15040
|
-
function
|
|
15041
|
-
|
|
15047
|
+
function Zl() {
|
|
15048
|
+
Tl();
|
|
15042
15049
|
for (const e of J.values())
|
|
15043
15050
|
try {
|
|
15044
15051
|
e.decoder?.close();
|
|
@@ -15049,24 +15056,24 @@ function $l() {
|
|
|
15049
15056
|
self.addEventListener("message", (e) => {
|
|
15050
15057
|
const d = e.data;
|
|
15051
15058
|
if (d.type === "configure") {
|
|
15052
|
-
ie = d.transport,
|
|
15059
|
+
ie = d.transport, Il = d.preferWebCodecs ?? !0, X = Number.isFinite(d.outputSampleRate) && d.outputSampleRate > 0 ? d.outputSampleRate : fl, $ = Number.isFinite(d.outputChannels) && d.outputChannels > 0 ? d.outputChannels : wl;
|
|
15053
15060
|
return;
|
|
15054
15061
|
}
|
|
15055
15062
|
if (d.type === "attachProtocolPort") {
|
|
15056
|
-
|
|
15063
|
+
Tl(), B = d.port, B.start?.(), B.addEventListener("message", (n) => {
|
|
15057
15064
|
const i = n.data;
|
|
15058
|
-
i?.type === "protocol" && i.message instanceof ArrayBuffer &&
|
|
15065
|
+
i?.type === "protocol" && i.message instanceof ArrayBuffer && $l(new Uint8Array(i.message));
|
|
15059
15066
|
});
|
|
15060
15067
|
return;
|
|
15061
15068
|
}
|
|
15062
15069
|
if (d.type === "rebind") {
|
|
15063
|
-
ie = d.transport, typeof d.outputSampleRate == "number" && Number.isFinite(d.outputSampleRate) && d.outputSampleRate > 0 && (
|
|
15070
|
+
ie = d.transport, typeof d.outputSampleRate == "number" && Number.isFinite(d.outputSampleRate) && d.outputSampleRate > 0 && (X = d.outputSampleRate), typeof d.outputChannels == "number" && Number.isFinite(d.outputChannels) && d.outputChannels > 0 && ($ = d.outputChannels);
|
|
15064
15071
|
for (const n of J.values())
|
|
15065
|
-
n.sink.setOutputFormat(
|
|
15066
|
-
|
|
15072
|
+
n.sink.setOutputFormat(X, $), n.sink.rebind(ie);
|
|
15073
|
+
Yl();
|
|
15067
15074
|
return;
|
|
15068
15075
|
}
|
|
15069
|
-
d.type === "dispose" &&
|
|
15076
|
+
d.type === "dispose" && Zl();
|
|
15070
15077
|
});
|
|
15071
15078
|
function Rl(e, d) {
|
|
15072
15079
|
if (e.length === 1)
|
|
@@ -15077,7 +15084,7 @@ function Rl(e, d) {
|
|
|
15077
15084
|
i[s * n + a] = e[a][s] ?? 0;
|
|
15078
15085
|
return i;
|
|
15079
15086
|
}
|
|
15080
|
-
function
|
|
15087
|
+
function Ql(e, d, n, i) {
|
|
15081
15088
|
if (n === i)
|
|
15082
15089
|
return e;
|
|
15083
15090
|
const s = e.length / d, a = Math.max(1, Math.round(s * i / n)), u = new Float32Array(a * d);
|