livekit-client 2.19.1 → 2.19.2

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.
@@ -509,16 +509,15 @@ function int64ToString(lo, hi) {
509
509
  * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
510
510
  */
511
511
  function uInt64ToString(lo, hi) {
512
- ({
513
- lo,
514
- hi
515
- } = toUnsigned(lo, hi));
516
512
  // Skip the expensive conversion if the number is small enough to use the
517
513
  // built-in conversions.
518
514
  // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with
519
515
  // highBits <= 0x1FFFFF can be safely expressed with a double and retain
520
516
  // integer precision.
521
517
  // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.
518
+ var _toUnsigned = toUnsigned(lo, hi);
519
+ lo = _toUnsigned.lo;
520
+ hi = _toUnsigned.hi;
522
521
  if (hi <= 0x1FFFFF) {
523
522
  return String(TWO_PWR_32_DBL * hi + lo);
524
523
  }
@@ -931,20 +930,76 @@ function isScalarZeroValue(type, value) {
931
930
  return value == 0;
932
931
  // Loose comparison matches 0n, 0 and "0"
933
932
  }
934
- }// Copyright 2021-2024 Buf Technologies, Inc.
935
- //
936
- // Licensed under the Apache License, Version 2.0 (the "License");
937
- // you may not use this file except in compliance with the License.
938
- // You may obtain a copy of the License at
939
- //
940
- // http://www.apache.org/licenses/LICENSE-2.0
941
- //
942
- // Unless required by applicable law or agreed to in writing, software
943
- // distributed under the License is distributed on an "AS IS" BASIS,
944
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
945
- // See the License for the specific language governing permissions and
946
- // limitations under the License.
947
- /* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/restrict-plus-operands */
933
+ }function _arrayLikeToArray(r, a) {
934
+ (null == a || a > r.length) && (a = r.length);
935
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
936
+ return n;
937
+ }
938
+ function _arrayWithHoles(r) {
939
+ if (Array.isArray(r)) return r;
940
+ }
941
+ function _defineProperty(e, r, t) {
942
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
943
+ value: t,
944
+ enumerable: true,
945
+ configurable: true,
946
+ writable: true
947
+ }) : e[r] = t, e;
948
+ }
949
+ function _iterableToArrayLimit(r, l) {
950
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
951
+ if (null != t) {
952
+ var e,
953
+ n,
954
+ i,
955
+ u,
956
+ a = [],
957
+ f = true,
958
+ o = false;
959
+ try {
960
+ if (i = (t = t.call(r)).next, 0 === l) {
961
+ if (Object(t) !== t) return;
962
+ f = !1;
963
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
964
+ } catch (r) {
965
+ o = true, n = r;
966
+ } finally {
967
+ try {
968
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
969
+ } finally {
970
+ if (o) throw n;
971
+ }
972
+ }
973
+ return a;
974
+ }
975
+ }
976
+ function _nonIterableRest() {
977
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
978
+ }
979
+ function _slicedToArray(r, e) {
980
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
981
+ }
982
+ function _toPrimitive(t, r) {
983
+ if ("object" != typeof t || !t) return t;
984
+ var e = t[Symbol.toPrimitive];
985
+ if (void 0 !== e) {
986
+ var i = e.call(t, r);
987
+ if ("object" != typeof i) return i;
988
+ throw new TypeError("@@toPrimitive must return a primitive value.");
989
+ }
990
+ return ("string" === r ? String : Number)(t);
991
+ }
992
+ function _toPropertyKey(t) {
993
+ var i = _toPrimitive(t, "string");
994
+ return "symbol" == typeof i ? i : i + "";
995
+ }
996
+ function _unsupportedIterableToArray(r, a) {
997
+ if (r) {
998
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
999
+ var t = {}.toString.call(r).slice(8, -1);
1000
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
1001
+ }
1002
+ }/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/restrict-plus-operands */
948
1003
  /**
949
1004
  * Protobuf binary format wire types.
950
1005
  *
@@ -1256,7 +1311,10 @@ class BinaryReader {
1256
1311
  break;
1257
1312
  case WireType.StartGroup:
1258
1313
  for (;;) {
1259
- const [fn, wt] = this.tag();
1314
+ const _this$tag = this.tag(),
1315
+ _this$tag2 = _slicedToArray(_this$tag, 2),
1316
+ fn = _this$tag2[0],
1317
+ wt = _this$tag2[1];
1260
1318
  if (wt === WireType.EndGroup) {
1261
1319
  if (fieldNo !== undefined && fn !== fieldNo) {
1262
1320
  throw new Error("invalid end group tag");
@@ -1308,7 +1366,10 @@ class BinaryReader {
1308
1366
  * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
1309
1367
  */
1310
1368
  sint64() {
1311
- let [lo, hi] = this.varint64();
1369
+ let _this$varint = this.varint64(),
1370
+ _this$varint2 = _slicedToArray(_this$varint, 2),
1371
+ lo = _this$varint2[0],
1372
+ hi = _this$varint2[1];
1312
1373
  // decode zig zag
1313
1374
  let s = -(lo & 1);
1314
1375
  lo = (lo >>> 1 | (hi & 1) << 31) ^ s;
@@ -1319,7 +1380,10 @@ class BinaryReader {
1319
1380
  * Read a `bool` field, a variant.
1320
1381
  */
1321
1382
  bool() {
1322
- let [lo, hi] = this.varint64();
1383
+ let _this$varint3 = this.varint64(),
1384
+ _this$varint4 = _slicedToArray(_this$varint3, 2),
1385
+ lo = _this$varint4[0],
1386
+ hi = _this$varint4[1];
1323
1387
  return lo !== 0 || hi !== 0;
1324
1388
  }
1325
1389
  /**
@@ -1580,20 +1644,7 @@ const protoBase64 = {
1580
1644
  }
1581
1645
  return base64;
1582
1646
  }
1583
- };// Copyright 2021-2024 Buf Technologies, Inc.
1584
- //
1585
- // Licensed under the Apache License, Version 2.0 (the "License");
1586
- // you may not use this file except in compliance with the License.
1587
- // You may obtain a copy of the License at
1588
- //
1589
- // http://www.apache.org/licenses/LICENSE-2.0
1590
- //
1591
- // Unless required by applicable law or agreed to in writing, software
1592
- // distributed under the License is distributed on an "AS IS" BASIS,
1593
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1594
- // See the License for the specific language governing permissions and
1595
- // limitations under the License.
1596
- /**
1647
+ };/**
1597
1648
  * Retrieve an extension value from a message.
1598
1649
  *
1599
1650
  * The function never returns undefined. Use hasExtension() to check whether an
@@ -1611,7 +1662,10 @@ function getExtension(message, extension, options) {
1611
1662
  assertExtendee(extension, message);
1612
1663
  const opt = extension.runtime.bin.makeReadOptions(options);
1613
1664
  const ufs = filterUnknownFields(message.getType().runtime.bin.listUnknownFields(message), extension.field);
1614
- const [container, get] = createExtensionContainer(extension);
1665
+ const _createExtensionConta = createExtensionContainer(extension),
1666
+ _createExtensionConta2 = _slicedToArray(_createExtensionConta, 2),
1667
+ container = _createExtensionConta2[0],
1668
+ get = _createExtensionConta2[1];
1615
1669
  for (const uf of ufs) {
1616
1670
  extension.runtime.bin.readField(container, opt.readerFactory(uf.data), extension.field, uf.wireType, opt);
1617
1671
  }
@@ -1646,7 +1700,10 @@ function setExtension(message, extension, value, options) {
1646
1700
  extension.runtime.bin.writeField(f, value, writer, writeOpt);
1647
1701
  const reader = readOpt.readerFactory(writer.finish());
1648
1702
  while (reader.pos < reader.len) {
1649
- const [no, wireType] = reader.tag();
1703
+ const _reader$tag = reader.tag(),
1704
+ _reader$tag2 = _slicedToArray(_reader$tag, 2),
1705
+ no = _reader$tag2[0],
1706
+ wireType = _reader$tag2[1];
1650
1707
  const data = reader.skip(wireType, no);
1651
1708
  message.getType().runtime.bin.onUnknownField(message, no, wireType, data);
1652
1709
  }
@@ -1807,20 +1864,7 @@ function wrapField(type, value) {
1807
1864
  "google.protobuf.BoolValue": ScalarType.BOOL,
1808
1865
  "google.protobuf.StringValue": ScalarType.STRING,
1809
1866
  "google.protobuf.BytesValue": ScalarType.BYTES
1810
- });// Copyright 2021-2024 Buf Technologies, Inc.
1811
- //
1812
- // Licensed under the Apache License, Version 2.0 (the "License");
1813
- // you may not use this file except in compliance with the License.
1814
- // You may obtain a copy of the License at
1815
- //
1816
- // http://www.apache.org/licenses/LICENSE-2.0
1817
- //
1818
- // Unless required by applicable law or agreed to in writing, software
1819
- // distributed under the License is distributed on an "AS IS" BASIS,
1820
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1821
- // See the License for the specific language governing permissions and
1822
- // limitations under the License.
1823
- /* eslint-disable no-case-declarations,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
1867
+ });/* eslint-disable no-case-declarations,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
1824
1868
  // Default options for parsing JSON.
1825
1869
  const jsonReadDefaults = {
1826
1870
  ignoreUnknownFields: false
@@ -1851,7 +1895,10 @@ function makeJsonFormat() {
1851
1895
  message = message !== null && message !== void 0 ? message : new type();
1852
1896
  const oneofSeen = new Map();
1853
1897
  const registry = options.typeRegistry;
1854
- for (const [jsonKey, jsonValue] of Object.entries(json)) {
1898
+ for (const _ref of Object.entries(json)) {
1899
+ var _ref2 = _slicedToArray(_ref, 2);
1900
+ const jsonKey = _ref2[0];
1901
+ const jsonValue = _ref2[1];
1855
1902
  const field = type.fields.findJsonName(jsonKey);
1856
1903
  if (field) {
1857
1904
  if (field.oneof) {
@@ -1872,7 +1919,10 @@ function makeJsonFormat() {
1872
1919
  const ext = registry.findExtension(jsonKey.substring(1, jsonKey.length - 1));
1873
1920
  if (ext && ext.extendee.typeName == type.typeName) {
1874
1921
  found = true;
1875
- const [container, get] = createExtensionContainer(ext);
1922
+ const _createExtensionConta = createExtensionContainer(ext),
1923
+ _createExtensionConta2 = _slicedToArray(_createExtensionConta, 2),
1924
+ container = _createExtensionConta2[0],
1925
+ get = _createExtensionConta2[1];
1876
1926
  readField$1(container, jsonValue, ext.field, options, ext);
1877
1927
  // We pass on the options as BinaryReadOptions/BinaryWriteOptions,
1878
1928
  // so that users can bring their own binary reader and writer factories
@@ -2015,7 +2065,10 @@ function readField$1(target, jsonValue, field, options, parentType) {
2015
2065
  throw new Error("cannot decode field ".concat(parentType.typeName, ".").concat(field.name, " from JSON: ").concat(debugJsonValue(jsonValue)));
2016
2066
  }
2017
2067
  const targetMap = target[localName];
2018
- for (const [jsonMapKey, jsonMapValue] of Object.entries(jsonValue)) {
2068
+ for (const _ref3 of Object.entries(jsonValue)) {
2069
+ var _ref4 = _slicedToArray(_ref3, 2);
2070
+ const jsonMapKey = _ref4[0];
2071
+ const jsonMapValue = _ref4[1];
2019
2072
  if (jsonMapValue === null) {
2020
2073
  throw new Error("cannot decode field ".concat(parentType.typeName, ".").concat(field.name, " from JSON: map value null"));
2021
2074
  }
@@ -2270,19 +2323,28 @@ function writeField$1(field, value, options) {
2270
2323
  const entries = Object.entries(value);
2271
2324
  switch (field.V.kind) {
2272
2325
  case "scalar":
2273
- for (const [entryKey, entryValue] of entries) {
2326
+ for (const _ref5 of entries) {
2327
+ var _ref6 = _slicedToArray(_ref5, 2);
2328
+ const entryKey = _ref6[0];
2329
+ const entryValue = _ref6[1];
2274
2330
  jsonObj[entryKey.toString()] = writeScalar$1(field.V.T, entryValue); // JSON standard allows only (double quoted) string as property key
2275
2331
  }
2276
2332
  break;
2277
2333
  case "message":
2278
- for (const [entryKey, entryValue] of entries) {
2334
+ for (const _ref7 of entries) {
2335
+ var _ref8 = _slicedToArray(_ref7, 2);
2336
+ const entryKey = _ref8[0];
2337
+ const entryValue = _ref8[1];
2279
2338
  // JSON standard allows only (double quoted) string as property key
2280
2339
  jsonObj[entryKey.toString()] = entryValue.toJson(options);
2281
2340
  }
2282
2341
  break;
2283
2342
  case "enum":
2284
2343
  const enumType = field.V.T;
2285
- for (const [entryKey, entryValue] of entries) {
2344
+ for (const _ref9 of entries) {
2345
+ var _ref0 = _slicedToArray(_ref9, 2);
2346
+ const entryKey = _ref0[0];
2347
+ const entryValue = _ref0[1];
2286
2348
  // JSON standard allows only (double quoted) string as property key
2287
2349
  jsonObj[entryKey.toString()] = writeEnum(enumType, entryValue, options.enumAsInteger);
2288
2350
  }
@@ -2376,20 +2438,7 @@ function writeScalar$1(type, value) {
2376
2438
  assert(value instanceof Uint8Array);
2377
2439
  return protoBase64.enc(value);
2378
2440
  }
2379
- }// Copyright 2021-2024 Buf Technologies, Inc.
2380
- //
2381
- // Licensed under the Apache License, Version 2.0 (the "License");
2382
- // you may not use this file except in compliance with the License.
2383
- // You may obtain a copy of the License at
2384
- //
2385
- // http://www.apache.org/licenses/LICENSE-2.0
2386
- //
2387
- // Unless required by applicable law or agreed to in writing, software
2388
- // distributed under the License is distributed on an "AS IS" BASIS,
2389
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2390
- // See the License for the specific language governing permissions and
2391
- // limitations under the License.
2392
- /* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return */
2441
+ }/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return */
2393
2442
  const unknownFieldsSymbol = Symbol("@bufbuild/protobuf/unknown-fields");
2394
2443
  // Default options for parsing binary data.
2395
2444
  const readDefaults = {
@@ -2444,7 +2493,10 @@ function makeBinaryFormat() {
2444
2493
  const end = delimitedMessageEncoding ? reader.len : reader.pos + lengthOrEndTagFieldNo;
2445
2494
  let fieldNo, wireType;
2446
2495
  while (reader.pos < end) {
2447
- [fieldNo, wireType] = reader.tag();
2496
+ var _reader$tag = reader.tag();
2497
+ var _reader$tag2 = _slicedToArray(_reader$tag, 2);
2498
+ fieldNo = _reader$tag2[0];
2499
+ wireType = _reader$tag2[1];
2448
2500
  if (delimitedMessageEncoding === true && wireType == WireType.EndGroup) {
2449
2501
  break;
2450
2502
  }
@@ -2497,10 +2549,8 @@ function makeBinaryFormat() {
2497
2549
  function readField(target,
2498
2550
  // eslint-disable-line @typescript-eslint/no-explicit-any -- `any` is the best choice for dynamic access
2499
2551
  reader, field, wireType, options) {
2500
- let {
2501
- repeated,
2502
- localName
2503
- } = field;
2552
+ let repeated = field.repeated,
2553
+ localName = field.localName;
2504
2554
  if (field.oneof) {
2505
2555
  target = target[field.oneof.localName];
2506
2556
  if (target.case != localName) {
@@ -2550,7 +2600,10 @@ reader, field, wireType, options) {
2550
2600
  }
2551
2601
  break;
2552
2602
  case "map":
2553
- let [mapKey, mapVal] = readMapEntry(field, reader, options);
2603
+ let _readMapEntry = readMapEntry(field, reader, options),
2604
+ _readMapEntry2 = _slicedToArray(_readMapEntry, 2),
2605
+ mapKey = _readMapEntry2[0],
2606
+ mapVal = _readMapEntry2[1];
2554
2607
  // safe to assume presence of map object, oneof cannot contain repeated values
2555
2608
  target[localName][mapKey] = mapVal;
2556
2609
  break;
@@ -2572,7 +2625,9 @@ function readMapEntry(field, reader, options) {
2572
2625
  end = reader.pos + length;
2573
2626
  let key, val;
2574
2627
  while (reader.pos < end) {
2575
- const [fieldNo] = reader.tag();
2628
+ const _reader$tag3 = reader.tag(),
2629
+ _reader$tag4 = _slicedToArray(_reader$tag3, 1),
2630
+ fieldNo = _reader$tag4[0];
2576
2631
  switch (fieldNo) {
2577
2632
  case 1:
2578
2633
  key = readScalar(reader, field.K);
@@ -2686,7 +2741,10 @@ function writeField(field, value, writer, options) {
2686
2741
  break;
2687
2742
  case "map":
2688
2743
  assert(typeof value == "object" && value != null);
2689
- for (const [key, val] of Object.entries(value)) {
2744
+ for (const _ref of Object.entries(value)) {
2745
+ var _ref2 = _slicedToArray(_ref, 2);
2746
+ const key = _ref2[0];
2747
+ const val = _ref2[1];
2690
2748
  writeMapEntry(writer, options, field, key, val);
2691
2749
  }
2692
2750
  break;
@@ -2737,7 +2795,10 @@ function writeMessageField(writer, options, field, value) {
2737
2795
  }
2738
2796
  function writeScalar(writer, type, fieldNo, value) {
2739
2797
  assert(value !== undefined);
2740
- let [wireType, method] = scalarTypeInfo(type);
2798
+ let _scalarTypeInfo = scalarTypeInfo(type),
2799
+ _scalarTypeInfo2 = _slicedToArray(_scalarTypeInfo, 2),
2800
+ wireType = _scalarTypeInfo2[0],
2801
+ method = _scalarTypeInfo2[1];
2741
2802
  writer.tag(fieldNo, wireType)[method](value);
2742
2803
  }
2743
2804
  function writePacked(writer, type, fieldNo, value) {
@@ -2745,7 +2806,9 @@ function writePacked(writer, type, fieldNo, value) {
2745
2806
  return;
2746
2807
  }
2747
2808
  writer.tag(fieldNo, WireType.LengthDelimited).fork();
2748
- let [, method] = scalarTypeInfo(type);
2809
+ let _scalarTypeInfo3 = scalarTypeInfo(type),
2810
+ _scalarTypeInfo4 = _slicedToArray(_scalarTypeInfo3, 2),
2811
+ method = _scalarTypeInfo4[1];
2749
2812
  for (let i = 0; i < value.length; i++) {
2750
2813
  writer[method](value[i]);
2751
2814
  }
@@ -2783,20 +2846,7 @@ function scalarTypeInfo(type) {
2783
2846
  }
2784
2847
  const method = ScalarType[type].toLowerCase();
2785
2848
  return [wireType, method];
2786
- }// Copyright 2021-2024 Buf Technologies, Inc.
2787
- //
2788
- // Licensed under the Apache License, Version 2.0 (the "License");
2789
- // you may not use this file except in compliance with the License.
2790
- // You may obtain a copy of the License at
2791
- //
2792
- // http://www.apache.org/licenses/LICENSE-2.0
2793
- //
2794
- // Unless required by applicable law or agreed to in writing, software
2795
- // distributed under the License is distributed on an "AS IS" BASIS,
2796
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2797
- // See the License for the specific language governing permissions and
2798
- // limitations under the License.
2799
- /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
2849
+ }/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
2800
2850
  function makeUtilCommon() {
2801
2851
  return {
2802
2852
  setEnumType,
@@ -2844,7 +2894,10 @@ function makeUtilCommon() {
2844
2894
  case "scalar":
2845
2895
  case "enum":
2846
2896
  if (member.V.T === ScalarType.BYTES) {
2847
- for (const [k, v] of Object.entries(s[localName])) {
2897
+ for (const _ref of Object.entries(s[localName])) {
2898
+ var _ref2 = _slicedToArray(_ref, 2);
2899
+ const k = _ref2[0];
2900
+ const v = _ref2[1];
2848
2901
  t[localName][k] = toU8Arr(v);
2849
2902
  }
2850
2903
  } else {
@@ -2976,7 +3029,10 @@ function makeUtilCommon() {
2976
3029
  copy = source.map(cloneSingularField);
2977
3030
  } else if (member.kind == "map") {
2978
3031
  copy = any[member.localName];
2979
- for (const [key, v] of Object.entries(source)) {
3032
+ for (const _ref3 of Object.entries(source)) {
3033
+ var _ref4 = _slicedToArray(_ref3, 2);
3034
+ const key = _ref4[0];
3035
+ const v = _ref4[1];
2980
3036
  copy[key] = cloneSingularField(v);
2981
3037
  }
2982
3038
  } else if (member.kind == "oneof") {
@@ -8874,9 +8930,7 @@ function detectBrowser(window) {
8874
8930
  result.browser = 'Not a browser.';
8875
8931
  return result;
8876
8932
  }
8877
- const {
8878
- navigator
8879
- } = window;
8933
+ const navigator = window.navigator;
8880
8934
 
8881
8935
  // Prefer navigator.userAgentData.
8882
8936
  if (navigator.userAgentData && navigator.userAgentData.brands) {
@@ -9868,7 +9922,10 @@ function shimGetStats(window, browserDetails) {
9868
9922
  };
9869
9923
  const nativeGetStats = window.RTCPeerConnection.prototype.getStats;
9870
9924
  window.RTCPeerConnection.prototype.getStats = function getStats() {
9871
- const [selector, onSucc, onErr] = arguments;
9925
+ const _arguments = Array.prototype.slice.call(arguments),
9926
+ selector = _arguments[0],
9927
+ onSucc = _arguments[1],
9928
+ onErr = _arguments[2];
9872
9929
  if (this.signalingState === 'closed') {
9873
9930
  // No longer required in FF151+
9874
9931
  return Promise.resolve(new Map());
@@ -10015,9 +10072,7 @@ function shimAddTransceiver(window) {
10015
10072
  // Also note that after the createoffer we are not 100% sure that
10016
10073
  // the params were asynchronously applied so we might miss the
10017
10074
  // opportunity to recreate offer.
10018
- const {
10019
- sender
10020
- } = transceiver;
10075
+ const sender = transceiver.sender;
10021
10076
  const params = sender.getParameters();
10022
10077
  if (!('encodings' in params) ||
10023
10078
  // Avoid being fooled by patched getParameters() below.
@@ -11324,9 +11379,8 @@ function shimMaxMessageSize(window, browserDetails) {
11324
11379
  // As usual, adapter.js has to do an 'ugly worakaround'
11325
11380
  // to cover up the mess.
11326
11381
  if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {
11327
- const {
11328
- sdpSemantics
11329
- } = this.getConfiguration();
11382
+ const _this$getConfiguratio = this.getConfiguration(),
11383
+ sdpSemantics = _this$getConfiguratio.sdpSemantics;
11330
11384
  if (sdpSemantics === 'plan-b') {
11331
11385
  Object.defineProperty(this, 'sctp', {
11332
11386
  get() {
@@ -11580,9 +11634,8 @@ function shimParameterlessSetLocalDescription(window, browserDetails) {
11580
11634
 
11581
11635
  // Shimming starts here.
11582
11636
  function adapterFactory() {
11583
- let {
11584
- window
11585
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11637
+ let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
11638
+ window = _ref.window;
11586
11639
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
11587
11640
  shimChrome: true,
11588
11641
  shimFirefox: true,
@@ -11742,9 +11795,7 @@ function getBrowser(userAgent) {
11742
11795
  const ua = (userAgent !== null && userAgent !== void 0 ? userAgent : navigator.userAgent).toLowerCase();
11743
11796
  if (browserDetails === undefined || force) {
11744
11797
  const browser = browsersList.find(_ref => {
11745
- let {
11746
- test
11747
- } = _ref;
11798
+ let test = _ref.test;
11748
11799
  return test.test(ua);
11749
11800
  });
11750
11801
  browserDetails = browser === null || browser === void 0 ? void 0 : browser.describe(ua);
@@ -11793,7 +11844,7 @@ function getMatch(exp, ua) {
11793
11844
  }
11794
11845
  function getOSVersion(ua) {
11795
11846
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11796
- }var version$1 = "2.19.1";const version = version$1;
11847
+ }var version$1 = "2.19.2";const version = version$1;
11797
11848
  const protocolVersion = 17;
11798
11849
  /** Initial client protocol. */
11799
11850
  const CLIENT_PROTOCOL_DEFAULT = 0;
@@ -12765,11 +12816,10 @@ const ScreenSharePresets = {
12765
12816
  };function mergeDefaultOptions(options, audioDefaults, videoDefaults) {
12766
12817
  var _a, _b;
12767
12818
  var _c, _d;
12768
- const {
12769
- optionsWithoutProcessor,
12770
- audioProcessor,
12771
- videoProcessor
12772
- } = extractProcessorsFromOptions(options !== null && options !== void 0 ? options : {});
12819
+ const _extractProcessorsFro = extractProcessorsFromOptions(options !== null && options !== void 0 ? options : {}),
12820
+ optionsWithoutProcessor = _extractProcessorsFro.optionsWithoutProcessor,
12821
+ audioProcessor = _extractProcessorsFro.audioProcessor,
12822
+ videoProcessor = _extractProcessorsFro.videoProcessor;
12773
12823
  const defaultAudioProcessor = audioDefaults === null || audioDefaults === void 0 ? void 0 : audioDefaults.processor;
12774
12824
  const defaultVideoProcessor = videoDefaults === null || videoDefaults === void 0 ? void 0 : videoDefaults.processor;
12775
12825
  const clonedOptions = optionsWithoutProcessor !== null && optionsWithoutProcessor !== void 0 ? optionsWithoutProcessor : {};
@@ -13769,7 +13819,9 @@ function createDummyVideoStreamTrack() {
13769
13819
  }
13770
13820
  // @ts-ignore
13771
13821
  const dummyStream = canvas.captureStream();
13772
- const [dummyTrack] = dummyStream.getTracks();
13822
+ const _dummyStream$getTrack = dummyStream.getTracks(),
13823
+ _dummyStream$getTrack2 = _slicedToArray(_dummyStream$getTrack, 1),
13824
+ dummyTrack = _dummyStream$getTrack2[0];
13773
13825
  if (!dummyTrack) {
13774
13826
  throw Error('Could not get empty media stream video track');
13775
13827
  }
@@ -13788,7 +13840,9 @@ function getEmptyAudioStreamTrack() {
13788
13840
  oscillator.connect(gain);
13789
13841
  gain.connect(dst);
13790
13842
  oscillator.start();
13791
- [emptyAudioStreamTrack] = dst.stream.getAudioTracks();
13843
+ var _dst$stream$getAudioT = dst.stream.getAudioTracks();
13844
+ var _dst$stream$getAudioT2 = _slicedToArray(_dst$stream$getAudioT, 1);
13845
+ emptyAudioStreamTrack = _dst$stream$getAudioT2[0];
13792
13846
  if (!emptyAudioStreamTrack) {
13793
13847
  throw Error('Could not get empty media stream audio track');
13794
13848
  }
@@ -13911,14 +13965,12 @@ function toHttpUrl(url) {
13911
13965
  }
13912
13966
  function extractTranscriptionSegments(transcription, firstReceivedTimesMap) {
13913
13967
  return transcription.segments.map(_ref => {
13914
- let {
13915
- id,
13916
- text,
13917
- language,
13918
- startTime,
13919
- endTime,
13920
- final
13921
- } = _ref;
13968
+ let id = _ref.id,
13969
+ text = _ref.text,
13970
+ language = _ref.language,
13971
+ startTime = _ref.startTime,
13972
+ endTime = _ref.endTime,
13973
+ final = _ref.final;
13922
13974
  var _a;
13923
13975
  const firstReceivedTime = (_a = firstReceivedTimesMap.get(id)) !== null && _a !== void 0 ? _a : Date.now();
13924
13976
  const lastReceivedTime = Date.now();
@@ -13940,12 +13992,10 @@ function extractTranscriptionSegments(transcription, firstReceivedTimesMap) {
13940
13992
  });
13941
13993
  }
13942
13994
  function extractChatMessage(msg) {
13943
- const {
13944
- id,
13945
- timestamp,
13946
- message,
13947
- editTimestamp
13948
- } = msg;
13995
+ const id = msg.id,
13996
+ timestamp = msg.timestamp,
13997
+ message = msg.message,
13998
+ editTimestamp = msg.editTimestamp;
13949
13999
  return {
13950
14000
  id,
13951
14001
  timestamp: Number.parseInt(timestamp.toString()),
@@ -14486,9 +14536,7 @@ function debounce(func) {
14486
14536
  callback && callback(result);
14487
14537
  // biome-ignore lint/suspicious/useIterableCallbackReturn: vendored code
14488
14538
  promises.forEach(_ref => {
14489
- let {
14490
- resolve
14491
- } = _ref;
14539
+ let resolve = _ref.resolve;
14492
14540
  return resolve(result);
14493
14541
  });
14494
14542
  promises = [];
@@ -14516,9 +14564,7 @@ function debounce(func) {
14516
14564
  }
14517
14565
  // biome-ignore lint/suspicious/useIterableCallbackReturn: vendored code
14518
14566
  promises.forEach(_ref2 => {
14519
- let {
14520
- reject
14521
- } = _ref2;
14567
+ let reject = _ref2.reject;
14522
14568
  return reject(reason);
14523
14569
  });
14524
14570
  promises = [];
@@ -14648,10 +14694,8 @@ function computeBitrate(currentStats, prevStats) {
14648
14694
  this.timeSyncHandle = requestAnimationFrame(() => loop());
14649
14695
  const sources = (_a = this.receiver) === null || _a === void 0 ? void 0 : _a.getSynchronizationSources()[0];
14650
14696
  if (sources) {
14651
- const {
14652
- timestamp,
14653
- rtpTimestamp
14654
- } = sources;
14697
+ const timestamp = sources.timestamp,
14698
+ rtpTimestamp = sources.rtpTimestamp;
14655
14699
  if (rtpTimestamp && this.rtpTimestamp !== rtpTimestamp) {
14656
14700
  this.emit(TrackEvent.TimeSyncUpdate, {
14657
14701
  timestamp,
@@ -14697,9 +14741,7 @@ class RemoteVideoTrack extends RemoteTrack {
14697
14741
  *
14698
14742
  */
14699
14743
  lookupFrameMetadata(_ref) {
14700
- let {
14701
- rtpTimestamp
14702
- } = _ref;
14744
+ let rtpTimestamp = _ref.rtpTimestamp;
14703
14745
  var _a;
14704
14746
  return (_a = this.packetTrailerExtractor) === null || _a === void 0 ? void 0 : _a.lookupMetadata(rtpTimestamp);
14705
14747
  }
@@ -14931,10 +14973,8 @@ class HTMLElementInfo {
14931
14973
  constructor(element, visible) {
14932
14974
  this.onVisibilityChanged = entry => {
14933
14975
  var _a;
14934
- const {
14935
- target,
14936
- isIntersecting
14937
- } = entry;
14976
+ const target = entry.target,
14977
+ isIntersecting = entry.isIntersecting;
14938
14978
  if (target === this.element) {
14939
14979
  this.isIntersecting = isIntersecting;
14940
14980
  this.isPiP = isElementInPiP(this.element);
@@ -15013,12 +15053,10 @@ function isElementInViewport(el, win) {
15013
15053
  let left = el.offsetLeft;
15014
15054
  const width = el.offsetWidth;
15015
15055
  const height = el.offsetHeight;
15016
- const {
15017
- hidden
15018
- } = el;
15019
- const {
15020
- display
15021
- } = getComputedStyle(el);
15056
+ const _el = el,
15057
+ hidden = _el.hidden;
15058
+ const _getComputedStyle = getComputedStyle(el),
15059
+ display = _getComputedStyle.display;
15022
15060
  while (el.offsetParent) {
15023
15061
  el = el.offsetParent;
15024
15062
  top += el.offsetTop;
@@ -15035,10 +15073,9 @@ class E2EEManager extends eventsExports.EventEmitter {
15035
15073
  this.encryptDataRequests = new Map();
15036
15074
  this.onWorkerMessage = ev => {
15037
15075
  var _a, _b;
15038
- const {
15039
- kind,
15040
- data
15041
- } = ev.data;
15076
+ const _ev$data = ev.data,
15077
+ kind = _ev$data.kind,
15078
+ data = _ev$data.data;
15042
15079
  switch (kind) {
15043
15080
  case 'error':
15044
15081
  livekitLogger.error(data.error.message);
@@ -15298,11 +15335,9 @@ class E2EEManager extends eventsExports.EventEmitter {
15298
15335
  this.worker.postMessage(msg);
15299
15336
  }
15300
15337
  postKey(_ref, updateCurrentKeyIndex) {
15301
- let {
15302
- key,
15303
- participantIdentity,
15304
- keyIndex
15305
- } = _ref;
15338
+ let key = _ref.key,
15339
+ participantIdentity = _ref.participantIdentity,
15340
+ keyIndex = _ref.keyIndex;
15306
15341
  var _a;
15307
15342
  if (!this.worker) {
15308
15343
  throw Error('could not set key, worker is missing');
@@ -16152,10 +16187,9 @@ class WebSocketStream {
16152
16187
  ws.binaryType = 'arraybuffer';
16153
16188
  this.ws = ws;
16154
16189
  const closeWithInfo = function () {
16155
- let {
16156
- closeCode: code,
16157
- reason
16158
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16190
+ let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16191
+ code = _ref.closeCode,
16192
+ reason = _ref.reason;
16159
16193
  return ws.close(code, reason);
16160
16194
  };
16161
16195
  this.opened = new TypedPromise((resolve, reject) => {
@@ -16166,10 +16200,8 @@ class WebSocketStream {
16166
16200
  resolve({
16167
16201
  readable: new ReadableStream({
16168
16202
  start(controller) {
16169
- ws.onmessage = _ref => {
16170
- let {
16171
- data
16172
- } = _ref;
16203
+ ws.onmessage = _ref2 => {
16204
+ let data = _ref2.data;
16173
16205
  return controller.enqueue(data);
16174
16206
  };
16175
16207
  ws.onerror = e => controller.error(e);
@@ -16211,11 +16243,9 @@ class WebSocketStream {
16211
16243
  resolve(reason);
16212
16244
  }
16213
16245
  });
16214
- ws.onclose = _ref2 => {
16215
- let {
16216
- code,
16217
- reason
16218
- } = _ref2;
16246
+ ws.onclose = _ref3 => {
16247
+ let code = _ref3.code,
16248
+ reason = _ref3.reason;
16219
16249
  resolve({
16220
16250
  closeCode: code,
16221
16251
  reason
@@ -16486,10 +16516,9 @@ class SignalClient {
16486
16516
  if (this.signalLatency) {
16487
16517
  yield sleep(this.signalLatency);
16488
16518
  }
16489
- const {
16490
- done,
16491
- value
16492
- } = yield signalReader.read();
16519
+ const _yield$signalReader$r = yield signalReader.read(),
16520
+ done = _yield$signalReader$r.done,
16521
+ value = _yield$signalReader$r.value;
16493
16522
  if (done) {
16494
16523
  break;
16495
16524
  }
@@ -17138,10 +17167,9 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
17138
17167
  const chunks = [];
17139
17168
  const reader = stream.readable.getReader();
17140
17169
  while (true) {
17141
- const {
17142
- done,
17143
- value
17144
- } = yield reader.read();
17170
+ const _yield$reader$read = yield reader.read(),
17171
+ done = _yield$reader$read.done,
17172
+ value = _yield$reader$read.value;
17145
17173
  if (done) break;
17146
17174
  chunks.push(value);
17147
17175
  }
@@ -17258,7 +17286,10 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
17258
17286
  }
17259
17287
  cleanup() {
17260
17288
  const now = Date.now();
17261
- for (const [key, entry] of this._map.entries()) {
17289
+ for (const _ref of this._map.entries()) {
17290
+ var _ref2 = _slicedToArray(_ref, 2);
17291
+ const key = _ref2[0];
17292
+ const entry = _ref2[1];
17262
17293
  if (entry.expiresAt < now) {
17263
17294
  this._map.delete(key);
17264
17295
  }
@@ -17271,7 +17302,10 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
17271
17302
  }
17272
17303
  forEach(callback) {
17273
17304
  this.cleanup();
17274
- for (const [key, entry] of this._map.entries()) {
17305
+ for (const _ref3 of this._map.entries()) {
17306
+ var _ref4 = _slicedToArray(_ref3, 2);
17307
+ const key = _ref4[0];
17308
+ const entry = _ref4[1];
17275
17309
  if (entry.expiresAt >= Date.now()) {
17276
17310
  callback(entry.value, key, this.asValueMap());
17277
17311
  }
@@ -17281,14 +17315,20 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
17281
17315
  this.cleanup();
17282
17316
  const result = [];
17283
17317
  const valueMap = this.asValueMap();
17284
- for (const [key, value] of valueMap.entries()) {
17318
+ for (const _ref5 of valueMap.entries()) {
17319
+ var _ref6 = _slicedToArray(_ref5, 2);
17320
+ const key = _ref6[0];
17321
+ const value = _ref6[1];
17285
17322
  result.push(callback(value, key, valueMap));
17286
17323
  }
17287
17324
  return result;
17288
17325
  }
17289
17326
  asValueMap() {
17290
17327
  const result = new Map();
17291
- for (const [key, entry] of this._map.entries()) {
17328
+ for (const _ref7 of this._map.entries()) {
17329
+ var _ref8 = _slicedToArray(_ref7, 2);
17330
+ const key = _ref8[0];
17331
+ const entry = _ref8[1];
17292
17332
  if (entry.expiresAt >= Date.now()) {
17293
17333
  result.set(key, entry.value);
17294
17334
  }
@@ -17740,7 +17780,7 @@ function requireGrammar() {
17740
17780
  function requireParser() {
17741
17781
  if (hasRequiredParser) return parser;
17742
17782
  hasRequiredParser = 1;
17743
- (function (exports$1) {
17783
+ (function (exports) {
17744
17784
  var toIntIfInt = function (v) {
17745
17785
  return String(Number(v)) === v ? Number(v) : v;
17746
17786
  };
@@ -17773,7 +17813,7 @@ function requireParser() {
17773
17813
  };
17774
17814
  var grammar = requireGrammar();
17775
17815
  var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
17776
- exports$1.parse = function (sdp) {
17816
+ exports.parse = function (sdp) {
17777
17817
  var session = {},
17778
17818
  media = [],
17779
17819
  location = session; // points at where properties go under (one of the above)
@@ -17808,16 +17848,16 @@ function requireParser() {
17808
17848
  }
17809
17849
  return acc;
17810
17850
  };
17811
- exports$1.parseParams = function (str) {
17851
+ exports.parseParams = function (str) {
17812
17852
  return str.split(/;\s?/).reduce(paramReducer, {});
17813
17853
  };
17814
17854
 
17815
17855
  // For backward compatibility - alias will be removed in 3.0.0
17816
- exports$1.parseFmtpConfig = exports$1.parseParams;
17817
- exports$1.parsePayloads = function (str) {
17856
+ exports.parseFmtpConfig = exports.parseParams;
17857
+ exports.parsePayloads = function (str) {
17818
17858
  return str.toString().split(' ').map(Number);
17819
17859
  };
17820
- exports$1.parseRemoteCandidates = function (str) {
17860
+ exports.parseRemoteCandidates = function (str) {
17821
17861
  var candidates = [];
17822
17862
  var parts = str.split(' ').map(toIntIfInt);
17823
17863
  for (var i = 0; i < parts.length; i += 3) {
@@ -17829,12 +17869,12 @@ function requireParser() {
17829
17869
  }
17830
17870
  return candidates;
17831
17871
  };
17832
- exports$1.parseImageAttributes = function (str) {
17872
+ exports.parseImageAttributes = function (str) {
17833
17873
  return str.split(' ').map(function (item) {
17834
17874
  return item.substring(1, item.length - 1).split(',').reduce(paramReducer, {});
17835
17875
  });
17836
17876
  };
17837
- exports$1.parseSimulcastStreamList = function (str) {
17877
+ exports.parseSimulcastStreamList = function (str) {
17838
17878
  return str.split(';').map(function (stream) {
17839
17879
  return stream.split(',').map(function (format) {
17840
17880
  var scid,
@@ -18113,10 +18153,9 @@ class PCTransport extends eventsExports.EventEmitter {
18113
18153
  }
18114
18154
  let mungedSDP = undefined;
18115
18155
  if (sd.type === 'offer') {
18116
- let {
18117
- stereoMids,
18118
- nackMids
18119
- } = extractStereoAndNackAudioFromOffer(sd);
18156
+ let _extractStereoAndNack = extractStereoAndNackAudioFromOffer(sd),
18157
+ stereoMids = _extractStereoAndNack.stereoMids,
18158
+ nackMids = _extractStereoAndNack.nackMids;
18120
18159
  this.remoteStereoMids = stereoMids;
18121
18160
  this.remoteNackMids = nackMids;
18122
18161
  } else if (sd.type === 'answer') {
@@ -19123,10 +19162,9 @@ class LocalTrack extends Track {
19123
19162
  if (this.kind !== Track.Kind.Video) {
19124
19163
  return undefined;
19125
19164
  }
19126
- const {
19127
- width,
19128
- height
19129
- } = this._mediaStreamTrack.getSettings();
19165
+ const _this$_mediaStreamTra = this._mediaStreamTrack.getSettings(),
19166
+ width = _this$_mediaStreamTra.width,
19167
+ height = _this$_mediaStreamTra.height;
19130
19168
  if (width && height) {
19131
19169
  return {
19132
19170
  width,
@@ -19277,10 +19315,9 @@ class LocalTrack extends Track {
19277
19315
  if (_this2.source === Track.Source.ScreenShare) {
19278
19316
  return;
19279
19317
  }
19280
- const {
19281
- deviceId,
19282
- groupId
19283
- } = _this2._mediaStreamTrack.getSettings();
19318
+ const _this2$_mediaStreamTr = _this2._mediaStreamTrack.getSettings(),
19319
+ deviceId = _this2$_mediaStreamTr.deviceId,
19320
+ groupId = _this2$_mediaStreamTr.groupId;
19284
19321
  const kind = _this2.kind === Track.Kind.Audio ? 'audioinput' : 'videoinput';
19285
19322
  return normalize ? DeviceManager.getInstance().normalizeDeviceId(kind, deviceId, groupId) : deviceId;
19286
19323
  }();
@@ -19348,10 +19385,9 @@ class LocalTrack extends Track {
19348
19385
  if (!constraints) {
19349
19386
  constraints = this._constraints;
19350
19387
  }
19351
- const {
19352
- deviceId,
19353
- facingMode
19354
- } = constraints,
19388
+ const _constraints = constraints,
19389
+ deviceId = _constraints.deviceId,
19390
+ facingMode = _constraints.facingMode,
19355
19391
  otherConstraints = __rest(constraints, ["deviceId", "facingMode"]);
19356
19392
  this.log.debug('restarting track with constraints', Object.assign(Object.assign({}, this.logContext), {
19357
19393
  constraints
@@ -20033,7 +20069,9 @@ function computeVideoEncodings(isScreenShare, width, height, options) {
20033
20069
  if (presets.length > 0) {
20034
20070
  const lowPreset = presets[0];
20035
20071
  if (presets.length > 1) {
20036
- [, midPreset] = presets;
20072
+ var _presets = presets;
20073
+ var _presets2 = _slicedToArray(_presets, 2);
20074
+ midPreset = _presets2[1];
20037
20075
  }
20038
20076
  // NOTE:
20039
20077
  // 1. Ordering of these encodings is important. Chrome seems
@@ -20083,9 +20121,7 @@ function computeTrackBackupEncodings(track, videoCodec, opts) {
20083
20121
  /* @internal */
20084
20122
  function determineAppropriateEncoding(isScreenShare, width, height, codec) {
20085
20123
  const presets = presetsForResolution(isScreenShare, width, height);
20086
- let {
20087
- encoding
20088
- } = presets[0];
20124
+ let encoding = presets[0].encoding;
20089
20125
  // handle portrait by swapping dimensions
20090
20126
  const size = Math.max(width, height);
20091
20127
  for (let i = 0; i < presets.length; i += 1) {
@@ -20131,10 +20167,8 @@ function defaultSimulcastLayers(isScreenShare, original) {
20131
20167
  if (isScreenShare) {
20132
20168
  return computeDefaultScreenShareSimulcastPresets(original);
20133
20169
  }
20134
- const {
20135
- width,
20136
- height
20137
- } = original;
20170
+ const width = original.width,
20171
+ height = original.height;
20138
20172
  const aspect = width > height ? width / height : height / width;
20139
20173
  if (Math.abs(aspect - 16.0 / 9) < Math.abs(aspect - 4.0 / 3)) {
20140
20174
  return defaultSimulcastPresets169;
@@ -20198,12 +20232,8 @@ function encodingsFromPresets(width, height, presets, sourceFramerate) {
20198
20232
  function sortPresets(presets) {
20199
20233
  if (!presets) return;
20200
20234
  return presets.sort((a, b) => {
20201
- const {
20202
- encoding: aEnc
20203
- } = a;
20204
- const {
20205
- encoding: bEnc
20206
- } = b;
20235
+ const aEnc = a.encoding;
20236
+ const bEnc = b.encoding;
20207
20237
  if (aEnc.maxBitrate > bEnc.maxBitrate) {
20208
20238
  return 1;
20209
20239
  }
@@ -20596,7 +20626,10 @@ class LocalVideoTrack extends LocalTrack {
20596
20626
  yield this.applyEncodingsToSender(this.sender, newEncodings);
20597
20627
  this.encodings = newEncodings;
20598
20628
  this.lastEncodedDimensions = dims;
20599
- for (const [codec, sc] of this.simulcastCodecs) {
20629
+ for (const _ref of this.simulcastCodecs) {
20630
+ var _ref2 = _slicedToArray(_ref, 2);
20631
+ const codec = _ref2[0];
20632
+ const sc = _ref2[1];
20600
20633
  if (!sc.sender || ((_a = sc.sender.transport) === null || _a === void 0 ? void 0 : _a.state) === 'closed') {
20601
20634
  continue;
20602
20635
  }
@@ -20878,9 +20911,7 @@ function setPublishingLayersForSender(sender, senderEncodings, qualities, sender
20878
20911
  }));
20879
20912
  try {
20880
20913
  const params = sender.getParameters();
20881
- const {
20882
- encodings
20883
- } = params;
20914
+ const encodings = params.encodings;
20884
20915
  if (!encodings) {
20885
20916
  return;
20886
20917
  }
@@ -21078,9 +21109,7 @@ class RTCEngine extends eventsExports.EventEmitter {
21078
21109
  this.bufferStatusLowClosingFuture = new Future();
21079
21110
  this.handleDataChannel = _a => __awaiter(this, [_a], void 0, function (_ref) {
21080
21111
  var _this = this;
21081
- let {
21082
- channel
21083
- } = _ref;
21112
+ let channel = _ref.channel;
21084
21113
  return function* () {
21085
21114
  if (!channel) {
21086
21115
  return;
@@ -21178,9 +21207,7 @@ class RTCEngine extends eventsExports.EventEmitter {
21178
21207
  const channel = event.currentTarget;
21179
21208
  const channelKind = channel.maxRetransmits === 0 ? 'lossy' : 'reliable';
21180
21209
  if (event instanceof ErrorEvent && event.error) {
21181
- const {
21182
- error
21183
- } = event.error;
21210
+ const error = event.error.error;
21184
21211
  this.log.error("DataChannel error on ".concat(channelKind, ": ").concat(event.message), {
21185
21212
  error
21186
21213
  });
@@ -21267,6 +21294,16 @@ class RTCEngine extends eventsExports.EventEmitter {
21267
21294
  return dc.bufferedAmount <= dc.bufferedAmountLowThreshold;
21268
21295
  }
21269
21296
  };
21297
+ this.onRtpMapAvailable = rtpTypes => {
21298
+ const rtpMap = new Map();
21299
+ rtpTypes.forEach(rtp => {
21300
+ const codec = rtp.codec.toLowerCase();
21301
+ if (isVideoCodec(codec)) {
21302
+ rtpMap.set(rtp.payload, codec);
21303
+ }
21304
+ });
21305
+ this.emit(EngineEvent.RTPVideoMapUpdate, rtpMap);
21306
+ };
21270
21307
  this.handleBrowserOnLine = () => __awaiter(this, void 0, void 0, function* () {
21271
21308
  if (!this.url) {
21272
21309
  return;
@@ -21359,12 +21396,20 @@ class RTCEngine extends eventsExports.EventEmitter {
21359
21396
  try {
21360
21397
  _this2.joinAttempts += 1;
21361
21398
  _this2.setupSignalClientCallbacks();
21399
+ // Whether the initial publisher offer is bundled with the join request. Computed once and
21400
+ // reused after the join below. Only the (non-Firefox) offer-with-join path does this.
21401
+ const sendOfferWithJoin = !useV0Path && isPublisherOfferWithJoinSupported();
21362
21402
  let offerProto;
21363
- if (!useV0Path && isPublisherOfferWithJoinSupported()) {
21403
+ if (sendOfferWithJoin) {
21364
21404
  if (!_this2.pcManager) {
21405
+ // Firefox is excluded from offer-with-join (see isPublisherOfferWithJoinSupported):
21406
+ // customers reported ICE connectivity problems for FF on this path (#1919) that we were
21407
+ // never able to reproduce, so out of caution FF stays on the deferred path below. The
21408
+ // exact cause is unknown — note that ICE gathering does not actually start here, since
21409
+ // createInitialOffer() defers setLocalDescription (via pendingInitialOffer) until the
21410
+ // answer is applied, after updateConfiguration() has set the server's TURN servers.
21365
21411
  yield _this2.configure();
21366
- _this2.createDataChannels();
21367
- _this2.addMediaSections(initialMediaSectionsAudio, initialMediaSectionsVideo);
21412
+ _this2.applyInitialPublisherLayout();
21368
21413
  }
21369
21414
  const offer = yield (_a = _this2.pcManager) === null || _a === void 0 ? void 0 : _a.publisher.createInitialOffer();
21370
21415
  if (offer) {
@@ -21383,11 +21428,20 @@ class RTCEngine extends eventsExports.EventEmitter {
21383
21428
  _this2.latestJoinResponse = joinResponse;
21384
21429
  _this2.participantSid = (_b = joinResponse.participant) === null || _b === void 0 ? void 0 : _b.sid;
21385
21430
  _this2.subscriberPrimary = joinResponse.subscriberPrimary;
21386
- if (!useV0Path && isPublisherOfferWithJoinSupported()) {
21431
+ if (sendOfferWithJoin) {
21387
21432
  (_c = _this2.pcManager) === null || _c === void 0 ? void 0 : _c.updateConfiguration(_this2.makeRTCConfiguration(joinResponse));
21388
21433
  } else {
21389
21434
  if (!_this2.pcManager) {
21435
+ // Deferred path (Firefox, and V0): configure with the join response so the PC picks up
21436
+ // the server's ICE servers and topology, then negotiate separately rather than bundling
21437
+ // the offer with the join.
21390
21438
  yield _this2.configure(joinResponse, !useV0Path);
21439
+ if (!useV0Path) {
21440
+ // The V1 first offer must carry the media layout so Firefox binds receive decoders for
21441
+ // subscribed tracks — without it, subscribed audio/video arrive as RTP but
21442
+ // never decode. V0 (legacy dual-PC) keeps its original lazy behavior.
21443
+ _this2.applyInitialPublisherLayout();
21444
+ }
21391
21445
  }
21392
21446
  // create offer
21393
21447
  if (!_this2.subscriberPrimary || joinResponse.fastPublish) {
@@ -21407,7 +21461,9 @@ class RTCEngine extends eventsExports.EventEmitter {
21407
21461
  };
21408
21462
  }
21409
21463
  _this2.log.info("connected to Livekit Server ".concat(Object.entries(serverInfo).map(_ref2 => {
21410
- let [key, value] = _ref2;
21464
+ let _ref3 = _slicedToArray(_ref2, 2),
21465
+ key = _ref3[0],
21466
+ value = _ref3[1];
21411
21467
  return "".concat(key, ": ").concat(value);
21412
21468
  }).join(', ')));
21413
21469
  return {
@@ -21542,9 +21598,7 @@ class RTCEngine extends eventsExports.EventEmitter {
21542
21598
  */
21543
21599
  removeTrack(sender) {
21544
21600
  if (sender.track && this.pendingTrackResolvers[sender.track.id]) {
21545
- const {
21546
- reject
21547
- } = this.pendingTrackResolvers[sender.track.id];
21601
+ const reject = this.pendingTrackResolvers[sender.track.id].reject;
21548
21602
  if (reject) {
21549
21603
  reject();
21550
21604
  }
@@ -21683,9 +21737,7 @@ class RTCEngine extends eventsExports.EventEmitter {
21683
21737
  });
21684
21738
  return;
21685
21739
  }
21686
- const {
21687
- resolve
21688
- } = this.pendingTrackResolvers[res.cid];
21740
+ const resolve = this.pendingTrackResolvers[res.cid].resolve;
21689
21741
  delete this.pendingTrackResolvers[res.cid];
21690
21742
  resolve(res.track);
21691
21743
  };
@@ -21793,6 +21845,16 @@ class RTCEngine extends eventsExports.EventEmitter {
21793
21845
  }
21794
21846
  return rtcConfig;
21795
21847
  }
21848
+ /**
21849
+ * Populate the publisher PC so its first offer carries the data channels + recvonly media
21850
+ * sections. Required for every V1 connection: Firefox only binds receive decoders for media
21851
+ * present in that first offer, and the offer-with-join path needs the sections to
21852
+ * build a meaningful initial offer. Must be called on a configured pcManager.
21853
+ */
21854
+ applyInitialPublisherLayout() {
21855
+ this.createDataChannels();
21856
+ this.addMediaSections(initialMediaSectionsAudio, initialMediaSectionsVideo);
21857
+ }
21796
21858
  addMediaSections(numAudios, numVideos) {
21797
21859
  var _a, _b;
21798
21860
  const transceiverInit = {
@@ -21919,10 +21981,9 @@ class RTCEngine extends eventsExports.EventEmitter {
21919
21981
  return;
21920
21982
  }
21921
21983
  // @ts-ignore
21922
- const {
21923
- readable,
21924
- writable
21925
- } = sender.createEncodedStreams();
21984
+ const _sender$createEncoded = sender.createEncodedStreams(),
21985
+ readable = _sender$createEncoded.readable,
21986
+ writable = _sender$createEncoded.writable;
21926
21987
  if (hasPacketTrailer) {
21927
21988
  this.options.packetTrailer.worker.postMessage({
21928
21989
  kind: 'encode',
@@ -22428,16 +22489,8 @@ class RTCEngine extends eventsExports.EventEmitter {
22428
22489
  }
22429
22490
  this.on(EngineEvent.Closing, handleClosed);
22430
22491
  this.on(EngineEvent.Restarting, handleClosed);
22431
- this.pcManager.publisher.once(PCEvents.RTPVideoPayloadTypes, rtpTypes => {
22432
- const rtpMap = new Map();
22433
- rtpTypes.forEach(rtp => {
22434
- const codec = rtp.codec.toLowerCase();
22435
- if (isVideoCodec(codec)) {
22436
- rtpMap.set(rtp.payload, codec);
22437
- }
22438
- });
22439
- this.emit(EngineEvent.RTPVideoMapUpdate, rtpMap);
22440
- });
22492
+ this.pcManager.publisher.off(PCEvents.RTPVideoPayloadTypes, this.onRtpMapAvailable);
22493
+ this.pcManager.publisher.once(PCEvents.RTPVideoPayloadTypes, this.onRtpMapAvailable);
22441
22494
  try {
22442
22495
  yield this.pcManager.negotiate(abortController);
22443
22496
  resolve();
@@ -22601,8 +22654,9 @@ class RTCEngine extends eventsExports.EventEmitter {
22601
22654
  var _a;
22602
22655
  const mid = (_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.getMidForReceiver(receiver);
22603
22656
  if (mid) {
22604
- const match = Object.entries(this.midToTrackId).find(_ref3 => {
22605
- let [key] = _ref3;
22657
+ const match = Object.entries(this.midToTrackId).find(_ref4 => {
22658
+ let _ref5 = _slicedToArray(_ref4, 1),
22659
+ key = _ref5[0];
22606
22660
  return key === mid;
22607
22661
  });
22608
22662
  if (match) {
@@ -23101,10 +23155,9 @@ class TextStreamReader extends BaseStreamReader {
23101
23155
  flushBufferedPackets() {
23102
23156
  const packets = this.bufferedPackets;
23103
23157
  this.bufferedPackets = [];
23104
- for (const {
23105
- packet,
23106
- encryptionType
23107
- } of packets) {
23158
+ for (const _ref of packets) {
23159
+ const packet = _ref.packet;
23160
+ const encryptionType = _ref.encryptionType;
23108
23161
  this.handleDataStreamPacket(packet, encryptionType);
23109
23162
  }
23110
23163
  }
@@ -23137,11 +23190,17 @@ class TextStreamReader extends BaseStreamReader {
23137
23190
  const byteStreamsBeingSentByDisconnectingParticipant = Array.from(this.byteStreamControllers.entries()).filter(entry => entry[1].sendingParticipantIdentity === participantIdentity);
23138
23191
  if (textStreamsBeingSentByDisconnectingParticipant.length > 0 || byteStreamsBeingSentByDisconnectingParticipant.length > 0) {
23139
23192
  const abnormalEndError = new DataStreamError("Participant ".concat(participantIdentity, " unexpectedly disconnected in the middle of sending data"), DataStreamErrorReason.AbnormalEnd);
23140
- for (const [id, controller] of byteStreamsBeingSentByDisconnectingParticipant) {
23193
+ for (const _ref2 of byteStreamsBeingSentByDisconnectingParticipant) {
23194
+ var _ref3 = _slicedToArray(_ref2, 2);
23195
+ const id = _ref3[0];
23196
+ const controller = _ref3[1];
23141
23197
  controller.controller.error(abnormalEndError);
23142
23198
  this.byteStreamControllers.delete(id);
23143
23199
  }
23144
- for (const [id, controller] of textStreamsBeingSentByDisconnectingParticipant) {
23200
+ for (const _ref4 of textStreamsBeingSentByDisconnectingParticipant) {
23201
+ var _ref5 = _slicedToArray(_ref4, 2);
23202
+ const id = _ref5[0];
23203
+ const controller = _ref5[1];
23145
23204
  controller.controller.error(abnormalEndError);
23146
23205
  this.textStreamControllers.delete(id);
23147
23206
  }
@@ -23471,10 +23530,9 @@ class OutgoingDataStreamManager {
23471
23530
  });
23472
23531
  const reader = file.stream().getReader();
23473
23532
  while (true) {
23474
- const {
23475
- done,
23476
- value
23477
- } = yield reader.read();
23533
+ const _yield$reader$read = yield reader.read(),
23534
+ done = _yield$reader$read.done,
23535
+ value = _yield$reader$read.value;
23478
23536
  if (done) {
23479
23537
  break;
23480
23538
  }
@@ -23938,7 +23996,10 @@ const DataTrackSymbol = Symbol.for('lk.data-track');class RemoteDataTrack {
23938
23996
  */
23939
23997
  subscribe(options) {
23940
23998
  try {
23941
- const [stream, sfuSubscriptionComplete] = this.manager.openSubscriptionStream(this.info.sid, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.bufferSize);
23999
+ const _this$manager$openSub = this.manager.openSubscriptionStream(this.info.sid, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.bufferSize),
24000
+ _this$manager$openSub2 = _slicedToArray(_this$manager$openSub, 2),
24001
+ stream = _this$manager$openSub2[0],
24002
+ sfuSubscriptionComplete = _this$manager$openSub2[1];
23942
24003
  // Prevent uncaught promise rejections from bubbling up if rejections occur after the
23943
24004
  // readable stream is discarded.
23944
24005
  sfuSubscriptionComplete.catch(() => {});
@@ -23977,10 +24038,9 @@ class DataTrackPacketHeader extends Serializable {
23977
24038
  };
23978
24039
  }
23979
24040
  toBinaryLengthBytes() {
23980
- const {
23981
- lengthBytes: extLengthBytes,
23982
- paddingLengthBytes: extPaddingLengthBytes
23983
- } = this.extensionsMetrics();
24041
+ const _this$extensionsMetri = this.extensionsMetrics(),
24042
+ extLengthBytes = _this$extensionsMetri.lengthBytes,
24043
+ extPaddingLengthBytes = _this$extensionsMetri.paddingLengthBytes;
23984
24044
  let totalLengthBytes = BASE_HEADER_LEN;
23985
24045
  if (extLengthBytes > 0) {
23986
24046
  totalLengthBytes += EXT_WORDS_INDICATOR_SIZE + extLengthBytes + extPaddingLengthBytes;
@@ -24008,11 +24068,10 @@ class DataTrackPacketHeader extends Serializable {
24008
24068
  break;
24009
24069
  }
24010
24070
  initial |= marker << FRAME_MARKER_SHIFT;
24011
- const {
24012
- lengthBytes: extensionsLengthBytes,
24013
- lengthWords: extensionsLengthWords,
24014
- paddingLengthBytes: extensionsPaddingLengthBytes
24015
- } = this.extensionsMetrics();
24071
+ const _this$extensionsMetri2 = this.extensionsMetrics(),
24072
+ extensionsLengthBytes = _this$extensionsMetri2.lengthBytes,
24073
+ extensionsLengthWords = _this$extensionsMetri2.lengthWords,
24074
+ extensionsPaddingLengthBytes = _this$extensionsMetri2.paddingLengthBytes;
24016
24075
  if (extensionsLengthBytes > 0) {
24017
24076
  initial |= 1 << EXT_FLAG_SHIFT;
24018
24077
  }
@@ -24115,7 +24174,10 @@ class DataTrackPacketHeader extends Serializable {
24115
24174
  throw DataTrackDeserializeError.headerOverrun();
24116
24175
  }
24117
24176
  let extensionDataView = new DataView(dataView.buffer, dataView.byteOffset + byteIndex, extensionLengthBytes);
24118
- const [result, readBytes] = DataTrackExtensions.fromBinary(extensionDataView);
24177
+ const _DataTrackExtensions$ = DataTrackExtensions.fromBinary(extensionDataView),
24178
+ _DataTrackExtensions$2 = _slicedToArray(_DataTrackExtensions$, 2),
24179
+ result = _DataTrackExtensions$2[0],
24180
+ readBytes = _DataTrackExtensions$2[1];
24119
24181
  extensions = result;
24120
24182
  byteIndex += readBytes;
24121
24183
  }
@@ -24181,7 +24243,10 @@ class DataTrackPacket extends Serializable {
24181
24243
  }
24182
24244
  static fromBinary(input) {
24183
24245
  const dataView = coerceToDataView(input);
24184
- const [header, headerByteLength] = DataTrackPacketHeader.fromBinary(dataView);
24246
+ const _DataTrackPacketHeade = DataTrackPacketHeader.fromBinary(dataView),
24247
+ _DataTrackPacketHeade2 = _slicedToArray(_DataTrackPacketHeade, 2),
24248
+ header = _DataTrackPacketHeade2[0],
24249
+ headerByteLength = _DataTrackPacketHeade2[1];
24185
24250
  const payload = dataView.buffer.slice(dataView.byteOffset + headerByteLength, dataView.byteOffset + dataView.byteLength);
24186
24251
  return [new DataTrackPacket(header, new Uint8Array(payload)), dataView.byteLength];
24187
24252
  }
@@ -24783,7 +24848,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24783
24848
  * subscription. Used when the subscription is being torn down by the manager (unsubscribe,
24784
24849
  * unpublish, or shutdown). */
24785
24850
  closeStreamControllers(streamControllers, sid) {
24786
- for (const [controller, detachSignal] of streamControllers) {
24851
+ for (const _ref of streamControllers) {
24852
+ var _ref2 = _slicedToArray(_ref, 2);
24853
+ const controller = _ref2[0];
24854
+ const detachSignal = _ref2[1];
24787
24855
  // Detach before close so we don't leak a listener on the user's AbortSignal.
24788
24856
  detachSignal();
24789
24857
  try {
@@ -24812,7 +24880,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24812
24880
  }
24813
24881
  // Detect published track
24814
24882
  const publisherParticipantToSidsInUpdate = new Map();
24815
- for (const [publisherIdentity, infos] of updates.entries()) {
24883
+ for (const _ref3 of updates.entries()) {
24884
+ var _ref4 = _slicedToArray(_ref3, 2);
24885
+ const publisherIdentity = _ref4[0];
24886
+ const infos = _ref4[1];
24816
24887
  const sidsInUpdate = new Set();
24817
24888
  for (const info of infos) {
24818
24889
  sidsInUpdate.add(info.sid);
@@ -24824,12 +24895,18 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24824
24895
  publisherParticipantToSidsInUpdate.set(publisherIdentity, sidsInUpdate);
24825
24896
  }
24826
24897
  // Detect unpublished tracks
24827
- for (const [publisherIdentity, sidsInUpdate] of publisherParticipantToSidsInUpdate.entries()) {
24828
- const descriptorsForPublisher = Array.from(this.descriptors.entries()).filter(_ref => {
24829
- let [_sid, descriptor] = _ref;
24898
+ for (const _ref5 of publisherParticipantToSidsInUpdate.entries()) {
24899
+ var _ref6 = _slicedToArray(_ref5, 2);
24900
+ const publisherIdentity = _ref6[0];
24901
+ const sidsInUpdate = _ref6[1];
24902
+ const descriptorsForPublisher = Array.from(this.descriptors.entries()).filter(_ref7 => {
24903
+ let _ref8 = _slicedToArray(_ref7, 2);
24904
+ _ref8[0];
24905
+ let descriptor = _ref8[1];
24830
24906
  return descriptor.publisherIdentity === publisherIdentity;
24831
- }).map(_ref2 => {
24832
- let [sid] = _ref2;
24907
+ }).map(_ref9 => {
24908
+ let _ref0 = _slicedToArray(_ref9, 1),
24909
+ sid = _ref0[0];
24833
24910
  return sid;
24834
24911
  });
24835
24912
  let unpublishedSids = descriptorsForPublisher.filter(sid => !sidsInUpdate.has(sid));
@@ -24891,7 +24968,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24891
24968
  /** Mapping between track handles attached to incoming packets to the
24892
24969
  * track SIDs they belong to. */
24893
24970
  mapping) {
24894
- for (const [handle, sid] of mapping.entries()) {
24971
+ for (const _ref1 of mapping.entries()) {
24972
+ var _ref10 = _slicedToArray(_ref1, 2);
24973
+ const handle = _ref10[0];
24974
+ const sid = _ref10[1];
24895
24975
  this.registerSubscriberHandle(handle, sid);
24896
24976
  }
24897
24977
  }
@@ -24941,7 +25021,9 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24941
25021
  return __awaiter(this, void 0, void 0, function* () {
24942
25022
  let packet;
24943
25023
  try {
24944
- [packet] = DataTrackPacket.fromBinary(bytes);
25024
+ var _DataTrackPacket$from = DataTrackPacket.fromBinary(bytes);
25025
+ var _DataTrackPacket$from2 = _slicedToArray(_DataTrackPacket$from, 1);
25026
+ packet = _DataTrackPacket$from2[0];
24945
25027
  } catch (err) {
24946
25028
  log$1.error("Failed to deserialize packet: ".concat(err));
24947
25029
  return;
@@ -24982,7 +25064,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
24982
25064
  * tracks are subscribed to locally.
24983
25065
  */
24984
25066
  resendSubscriptionUpdates() {
24985
- for (const [sid, descriptor] of this.descriptors) {
25067
+ for (const _ref11 of this.descriptors) {
25068
+ var _ref12 = _slicedToArray(_ref11, 2);
25069
+ const sid = _ref12[0];
25070
+ const descriptor = _ref12[1];
24986
25071
  if (descriptor.subscription.type === 'none') {
24987
25072
  continue;
24988
25073
  }
@@ -25091,7 +25176,8 @@ class DataTrackPacketizer {
25091
25176
  }
25092
25177
  const maxPayloadSizeBytes = this.mtuSizeBytes - headerSerializedLengthBytes;
25093
25178
  const packetCount = Math.ceil(frame.payload.byteLength / maxPayloadSizeBytes);
25094
- for (let index = 0, indexBytes = 0; indexBytes < frame.payload.byteLength; [index, indexBytes] = [index + 1, indexBytes + maxPayloadSizeBytes]) {
25179
+ for (let index = 0, indexBytes = 0; indexBytes < frame.payload.byteLength; _ref = [index + 1, indexBytes + maxPayloadSizeBytes], index = _ref[0], indexBytes = _ref[1], _ref) {
25180
+ var _ref;
25095
25181
  const sequence = this.sequence.getThenIncrement();
25096
25182
  const packetHeader = new DataTrackPacketHeader(Object.assign(Object.assign({}, headerParams), {
25097
25183
  marker: DataTrackPacketizer.computeFrameMarker(index, packetCount),
@@ -25699,7 +25785,10 @@ class OutgoingDataTrackManager extends eventsExports.EventEmitter {
25699
25785
  */
25700
25786
  sfuWillRepublishTracks() {
25701
25787
  var _a, _b;
25702
- for (const [handle, descriptor] of this.descriptors.entries()) {
25788
+ for (const _ref of this.descriptors.entries()) {
25789
+ var _ref2 = _slicedToArray(_ref, 2);
25790
+ const handle = _ref2[0];
25791
+ const descriptor = _ref2[1];
25703
25792
  switch (descriptor.type) {
25704
25793
  case 'pending':
25705
25794
  // TODO: support republish for pending publications
@@ -25902,12 +25991,11 @@ class RpcClientManager extends EventEmitter {
25902
25991
  performRpc(_a) {
25903
25992
  return __awaiter(this, arguments, void 0, function (_ref) {
25904
25993
  var _this = this;
25905
- let {
25906
- destinationIdentity,
25907
- method,
25908
- payload,
25909
- responseTimeout: responseTimeoutMs = 15000
25910
- } = _ref;
25994
+ let destinationIdentity = _ref.destinationIdentity,
25995
+ method = _ref.method,
25996
+ payload = _ref.payload,
25997
+ _ref$responseTimeout = _ref.responseTimeout,
25998
+ responseTimeoutMs = _ref$responseTimeout === void 0 ? 15000 : _ref$responseTimeout;
25911
25999
  return function* () {
25912
26000
  const maxRoundTripLatencyMs = 7000;
25913
26001
  const minEffectiveTimeoutMs = maxRoundTripLatencyMs + 1000;
@@ -25924,12 +26012,15 @@ class RpcClientManager extends EventEmitter {
25924
26012
  const effectiveTimeoutMs = Math.max(responseTimeoutMs, minEffectiveTimeoutMs);
25925
26013
  const id = crypto.randomUUID();
25926
26014
  const completionFuture = new Future();
26015
+ let responseTimeoutId = null;
25927
26016
  const ackTimeoutId = setTimeout(() => {
25928
26017
  var _a;
25929
26018
  _this.pendingAcks.delete(id);
25930
26019
  (_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('CONNECTION_TIMEOUT'));
25931
26020
  _this.pendingResponses.delete(id);
25932
- clearTimeout(responseTimeoutId);
26021
+ if (responseTimeoutId !== null) {
26022
+ clearTimeout(responseTimeoutId);
26023
+ }
25933
26024
  }, maxRoundTripLatencyMs);
25934
26025
  _this.pendingAcks.set(id, {
25935
26026
  resolve: () => {
@@ -25942,7 +26033,7 @@ class RpcClientManager extends EventEmitter {
25942
26033
  participantIdentity: destinationIdentity
25943
26034
  });
25944
26035
  yield _this.publishRpcRequest(destinationIdentity, id, method, payload, effectiveTimeoutMs, remoteClientProtocol);
25945
- const responseTimeoutId = setTimeout(() => {
26036
+ responseTimeoutId = setTimeout(() => {
25946
26037
  var _a;
25947
26038
  _this.pendingResponses.delete(id);
25948
26039
  (_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('RESPONSE_TIMEOUT'));
@@ -26062,17 +26153,20 @@ class RpcClientManager extends EventEmitter {
26062
26153
  /** @internal */
26063
26154
  handleParticipantDisconnected(participantIdentity) {
26064
26155
  var _a;
26065
- for (const [id, {
26066
- participantIdentity: pendingIdentity
26067
- }] of this.pendingAcks) {
26156
+ for (const _ref2 of this.pendingAcks) {
26157
+ var _ref3 = _slicedToArray(_ref2, 2);
26158
+ const id = _ref3[0];
26159
+ const pendingIdentity = _ref3[1].participantIdentity;
26068
26160
  if (pendingIdentity === participantIdentity) {
26069
26161
  this.pendingAcks.delete(id);
26070
26162
  }
26071
26163
  }
26072
- for (const [id, {
26073
- participantIdentity: pendingIdentity,
26074
- completionFuture
26075
- }] of this.pendingResponses) {
26164
+ for (const _ref4 of this.pendingResponses) {
26165
+ var _ref5 = _slicedToArray(_ref4, 2);
26166
+ const id = _ref5[0];
26167
+ var _ref5$ = _ref5[1];
26168
+ const pendingIdentity = _ref5$.participantIdentity;
26169
+ const completionFuture = _ref5$.completionFuture;
26076
26170
  if (pendingIdentity === participantIdentity) {
26077
26171
  (_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('RECIPIENT_DISCONNECTED'));
26078
26172
  this.pendingResponses.delete(id);
@@ -26681,11 +26775,10 @@ function createLocalTracks(options, loggerOptions) {
26681
26775
  return __awaiter(this, void 0, void 0, function* () {
26682
26776
  options !== null && options !== void 0 ? options : options = {};
26683
26777
  let attemptExactMatch = false;
26684
- const {
26685
- audioProcessor,
26686
- videoProcessor,
26687
- optionsWithoutProcessor: internalOptions
26688
- } = extractProcessorsFromOptions(options);
26778
+ const _extractProcessorsFro = extractProcessorsFromOptions(options),
26779
+ audioProcessor = _extractProcessorsFro.audioProcessor,
26780
+ videoProcessor = _extractProcessorsFro.videoProcessor,
26781
+ internalOptions = _extractProcessorsFro.optionsWithoutProcessor;
26689
26782
  let retryAudioOptions = internalOptions.audio;
26690
26783
  let retryVideoOptions = internalOptions.video;
26691
26784
  if (audioProcessor && typeof internalOptions.audio === 'object') {
@@ -26927,7 +27020,9 @@ class Participant extends eventsExports.EventEmitter {
26927
27020
  * the user's camera track with getTrackBySource(Track.Source.Camera).
26928
27021
  */
26929
27022
  getTrackPublication(source) {
26930
- for (const [, pub] of this.trackPublications) {
27023
+ for (const _ref of this.trackPublications) {
27024
+ var _ref2 = _slicedToArray(_ref, 2);
27025
+ const pub = _ref2[1];
26931
27026
  if (pub.source === source) {
26932
27027
  return pub;
26933
27028
  }
@@ -26937,7 +27032,9 @@ class Participant extends eventsExports.EventEmitter {
26937
27032
  * Finds the first track that matches the track's name.
26938
27033
  */
26939
27034
  getTrackPublicationByName(name) {
26940
- for (const [, pub] of this.trackPublications) {
27035
+ for (const _ref3 of this.trackPublications) {
27036
+ var _ref4 = _slicedToArray(_ref3, 2);
27037
+ const pub = _ref4[1];
26941
27038
  if (pub.trackName === name) {
26942
27039
  return pub;
26943
27040
  }
@@ -27180,11 +27277,9 @@ class Participant extends eventsExports.EventEmitter {
27180
27277
  (_b = (_a = this.signalConnectedFuture).resolve) === null || _b === void 0 ? void 0 : _b.call(_a);
27181
27278
  };
27182
27279
  this.handleSignalRequestResponse = response => {
27183
- const {
27184
- requestId,
27185
- reason,
27186
- message
27187
- } = response;
27280
+ const requestId = response.requestId,
27281
+ reason = response.reason,
27282
+ message = response.message;
27188
27283
  const targetRequest = this.pendingSignalRequests.get(requestId);
27189
27284
  if (targetRequest) {
27190
27285
  if (reason !== RequestResponse_Reason.OK) {
@@ -27460,11 +27555,9 @@ class Participant extends eventsExports.EventEmitter {
27460
27555
  requestMetadataUpdate(_a) {
27461
27556
  return __awaiter(this, arguments, void 0, function (_ref) {
27462
27557
  var _this = this;
27463
- let {
27464
- metadata,
27465
- name,
27466
- attributes
27467
- } = _ref;
27558
+ let metadata = _ref.metadata,
27559
+ name = _ref.name,
27560
+ attributes = _ref.attributes;
27468
27561
  return function* () {
27469
27562
  return new TypedPromise((resolve, reject) => __awaiter(_this, void 0, void 0, function* () {
27470
27563
  var _a, _b;
@@ -27486,7 +27579,9 @@ class Participant extends eventsExports.EventEmitter {
27486
27579
  });
27487
27580
  while (performance.now() - startTime < 5000 && !isRejected) {
27488
27581
  if ((!name || this.name === name) && (!metadata || this.metadata === metadata) && (!attributes || Object.entries(attributes).every(_ref2 => {
27489
- let [key, value] = _ref2;
27582
+ let _ref3 = _slicedToArray(_ref2, 2),
27583
+ key = _ref3[0],
27584
+ value = _ref3[1];
27490
27585
  return this.attributes[key] === value || value === '' && !this.attributes[key];
27491
27586
  }))) {
27492
27587
  this.pendingSignalRequests.delete(requestId);
@@ -27619,7 +27714,8 @@ class Participant extends eventsExports.EventEmitter {
27619
27714
  const publishedTracks = yield Promise.all(publishPromises);
27620
27715
  // for screen share publications including audio, this will only return the screen share publication, not the screen share audio one
27621
27716
  // revisit if we want to return an array of tracks instead for v2
27622
- [track] = publishedTracks;
27717
+ var _publishedTracks = _slicedToArray(publishedTracks, 1);
27718
+ track = _publishedTracks[0];
27623
27719
  } catch (e) {
27624
27720
  localTracks === null || localTracks === void 0 ? void 0 : localTracks.forEach(tr => {
27625
27721
  tr.stop();
@@ -27647,7 +27743,9 @@ class Participant extends eventsExports.EventEmitter {
27647
27743
  if (screenAudioTrack && screenAudioTrack.track) {
27648
27744
  unpublishPromises.push(this.unpublishTrack(screenAudioTrack.track));
27649
27745
  }
27650
- [track] = yield Promise.all(unpublishPromises);
27746
+ var _yield$Promise$all = yield Promise.all(unpublishPromises);
27747
+ var _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
27748
+ track = _yield$Promise$all2[0];
27651
27749
  } else {
27652
27750
  yield track.mute();
27653
27751
  }
@@ -27970,10 +28068,9 @@ class Participant extends eventsExports.EventEmitter {
27970
28068
  this.log.warn('no permissions present for publishing track', getLogContextFromTrack(track));
27971
28069
  return false;
27972
28070
  }
27973
- const {
27974
- canPublish,
27975
- canPublishSources
27976
- } = this.permissions;
28071
+ const _this$permissions = this.permissions,
28072
+ canPublish = _this$permissions.canPublish,
28073
+ canPublishSources = _this$permissions.canPublishSources;
27977
28074
  if (canPublish && (canPublishSources.length === 0 || canPublishSources.map(source => getTrackSourceFromProto(source)).includes(track.source))) {
27978
28075
  return true;
27979
28076
  }
@@ -28479,7 +28576,9 @@ class Participant extends eventsExports.EventEmitter {
28479
28576
  negotiationNeeded = true;
28480
28577
  }
28481
28578
  if (isLocalVideoTrack(track)) {
28482
- for (const [, trackInfo] of track.simulcastCodecs) {
28579
+ for (const _ref4 of track.simulcastCodecs) {
28580
+ var _ref5 = _slicedToArray(_ref4, 2);
28581
+ const trackInfo = _ref5[1];
28483
28582
  if (trackInfo.sender) {
28484
28583
  try {
28485
28584
  negotiationNeeded = this.engine.removeTrack(trackInfo.sender);
@@ -28720,8 +28819,10 @@ class Participant extends eventsExports.EventEmitter {
28720
28819
  * @throws Error on failure. Details in `message`.
28721
28820
  */
28722
28821
  performRpc(params) {
28723
- return this.rpcClientManager.performRpc(params).then(_ref3 => {
28724
- let [_id, completionPromise] = _ref3;
28822
+ return this.rpcClientManager.performRpc(params).then(_ref6 => {
28823
+ let _ref7 = _slicedToArray(_ref6, 2);
28824
+ _ref7[0];
28825
+ let completionPromise = _ref7[1];
28725
28826
  return completionPromise;
28726
28827
  });
28727
28828
  }
@@ -28837,8 +28938,9 @@ class Participant extends eventsExports.EventEmitter {
28837
28938
  const waitForPendingTimeout = 10000;
28838
28939
  const startTime = Date.now();
28839
28940
  while (Date.now() < startTime + waitForPendingTimeout) {
28840
- const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(_ref4 => {
28841
- let [pendingTrack] = _ref4;
28941
+ const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(_ref8 => {
28942
+ let _ref9 = _slicedToArray(_ref8, 1),
28943
+ pendingTrack = _ref9[0];
28842
28944
  return pendingTrack.source === source;
28843
28945
  });
28844
28946
  if (publishPromiseEntry) {
@@ -29447,9 +29549,7 @@ class DeferrableMap extends Map {
29447
29549
  return;
29448
29550
  }
29449
29551
  // also send unsubscribe, if track is actively subscribed
29450
- const {
29451
- track
29452
- } = publication;
29552
+ const track = publication.track;
29453
29553
  if (track) {
29454
29554
  track.stop();
29455
29555
  publication.setTrack(undefined);
@@ -29491,7 +29591,10 @@ class DeferrableMap extends Map {
29491
29591
  }
29492
29592
  /** @internal */
29493
29593
  removeRemoteDataTrack(remoteDataTrackSid) {
29494
- for (const [name, dataTrack] of this.dataTracks.entries()) {
29594
+ for (const _ref of this.dataTracks.entries()) {
29595
+ var _ref2 = _slicedToArray(_ref, 2);
29596
+ const name = _ref2[0];
29597
+ const dataTrack = _ref2[1];
29495
29598
  if (remoteDataTrackSid === dataTrack.info.sid) {
29496
29599
  this.dataTracks.delete(name);
29497
29600
  }
@@ -29661,17 +29764,16 @@ class Room extends eventsExports.EventEmitter {
29661
29764
  return this.connectFuture.promise;
29662
29765
  });
29663
29766
  this.connectSignal = (url, token, engine, connectOptions, roomOptions, abortController) => __awaiter(this, void 0, void 0, function* () {
29664
- const {
29665
- joinResponse,
29666
- serverInfo
29667
- } = yield engine.join(url, token, {
29668
- autoSubscribe: connectOptions.autoSubscribe,
29669
- adaptiveStream: typeof roomOptions.adaptiveStream === 'object' ? true : roomOptions.adaptiveStream,
29670
- clientInfoCapabilities: isPacketTrailerSupported(roomOptions.packetTrailer) || !!this.e2eeManager ? [ClientInfo_Capability.CAP_PACKET_TRAILER] : undefined,
29671
- maxRetries: connectOptions.maxRetries,
29672
- e2eeEnabled: !!this.e2eeManager,
29673
- websocketTimeout: connectOptions.websocketTimeout
29674
- }, abortController.signal, !roomOptions.singlePeerConnection);
29767
+ const _yield$engine$join = yield engine.join(url, token, {
29768
+ autoSubscribe: connectOptions.autoSubscribe,
29769
+ adaptiveStream: typeof roomOptions.adaptiveStream === 'object' ? true : roomOptions.adaptiveStream,
29770
+ clientInfoCapabilities: isPacketTrailerSupported(roomOptions.packetTrailer) || !!this.e2eeManager ? [ClientInfo_Capability.CAP_PACKET_TRAILER] : undefined,
29771
+ maxRetries: connectOptions.maxRetries,
29772
+ e2eeEnabled: !!this.e2eeManager,
29773
+ websocketTimeout: connectOptions.websocketTimeout
29774
+ }, abortController.signal, !roomOptions.singlePeerConnection),
29775
+ joinResponse = _yield$engine$join.joinResponse,
29776
+ serverInfo = _yield$engine$join.serverInfo;
29675
29777
  this.serverInfo = serverInfo;
29676
29778
  if (!serverInfo.version) {
29677
29779
  throw new UnsupportedServer('unknown server version');
@@ -30330,10 +30432,8 @@ class Room extends eventsExports.EventEmitter {
30330
30432
  }).on('trackUnpublished', event => {
30331
30433
  this.emit(RoomEvent.LocalDataTrackUnpublished, event.sid);
30332
30434
  }).on('packetAvailable', _ref => {
30333
- let {
30334
- handle,
30335
- bytes
30336
- } = _ref;
30435
+ let handle = _ref.handle,
30436
+ bytes = _ref.bytes;
30337
30437
  this.engine.sendLossyBytes(bytes, DataChannelKind.DATA_TRACK_LOSSY, 'wait').finally(() => this.outgoingDataTrackManager.handlePacketSendComplete(handle));
30338
30438
  });
30339
30439
  this.registerRpcDataStreamHandler();
@@ -30342,17 +30442,13 @@ class Room extends eventsExports.EventEmitter {
30342
30442
  return (_b = (_a = this.engine.latestJoinResponse) === null || _a === void 0 ? void 0 : _a.serverInfo) === null || _b === void 0 ? void 0 : _b.version;
30343
30443
  });
30344
30444
  this.rpcClientManager.on('sendDataPacket', _ref2 => {
30345
- let {
30346
- packet
30347
- } = _ref2;
30445
+ let packet = _ref2.packet;
30348
30446
  var _a;
30349
30447
  (_a = this.engine) === null || _a === void 0 ? void 0 : _a.sendDataPacket(packet, DataChannelKind.RELIABLE);
30350
30448
  });
30351
30449
  this.rpcServerManager = new RpcServerManager(this.log, this.outgoingDataStreamManager, this.getRemoteParticipantClientProtocol);
30352
30450
  this.rpcServerManager.on('sendDataPacket', _ref3 => {
30353
- let {
30354
- packet
30355
- } = _ref3;
30451
+ let packet = _ref3.packet;
30356
30452
  var _a;
30357
30453
  (_a = this.engine) === null || _a === void 0 ? void 0 : _a.sendDataPacket(packet, DataChannelKind.RELIABLE);
30358
30454
  });
@@ -30640,7 +30736,9 @@ class Room extends eventsExports.EventEmitter {
30640
30736
  this.outgoingDataTrackManager.receivedSfuUnpublishResponse(event.info.pubHandle);
30641
30737
  }).on(EngineEvent.DataTrackSubscriberHandles, event => {
30642
30738
  const handleToSidMapping = new Map(Object.entries(event.subHandles).map(_ref4 => {
30643
- let [key, value] = _ref4;
30739
+ let _ref5 = _slicedToArray(_ref4, 2),
30740
+ key = _ref5[0],
30741
+ value = _ref5[1];
30644
30742
  return [parseInt(key, 10), value.trackSid];
30645
30743
  }));
30646
30744
  this.incomingDataTrackManager.receivedSfuSubscriberHandles(handleToSidMapping);
@@ -31094,10 +31192,8 @@ class Room extends eventsExports.EventEmitter {
31094
31192
  }
31095
31193
  }
31096
31194
  handleLocalTrackSubscribed(subscribedSid) {
31097
- const findPublication = () => this.localParticipant.getTrackPublications().find(_ref5 => {
31098
- let {
31099
- trackSid
31100
- } = _ref5;
31195
+ const findPublication = () => this.localParticipant.getTrackPublications().find(_ref6 => {
31196
+ let trackSid = _ref6.trackSid;
31101
31197
  return trackSid === subscribedSid;
31102
31198
  });
31103
31199
  const trackPublication = findPublication();
@@ -31422,22 +31518,18 @@ class Room extends eventsExports.EventEmitter {
31422
31518
  }
31423
31519
  }
31424
31520
  registerRpcDataStreamHandler() {
31425
- this.incomingDataStreamManager.registerTextStreamHandler(RPC_REQUEST_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref6) {
31521
+ this.incomingDataStreamManager.registerTextStreamHandler(RPC_REQUEST_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref7) {
31426
31522
  var _this4 = this;
31427
- let {
31428
- identity
31429
- } = _ref6;
31523
+ let identity = _ref7.identity;
31430
31524
  return function* () {
31431
31525
  var _b;
31432
31526
  const attributes = (_b = reader.info.attributes) !== null && _b !== void 0 ? _b : {};
31433
31527
  yield _this4.rpcServerManager.handleIncomingDataStream(reader, identity, attributes);
31434
31528
  }();
31435
31529
  }));
31436
- this.incomingDataStreamManager.registerTextStreamHandler(RPC_RESPONSE_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref7) {
31530
+ this.incomingDataStreamManager.registerTextStreamHandler(RPC_RESPONSE_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref8) {
31437
31531
  var _this5 = this;
31438
- let {
31439
- identity
31440
- } = _ref7;
31532
+ let identity = _ref8.identity;
31441
31533
  return function* () {
31442
31534
  var _b;
31443
31535
  const attributes = (_b = reader.info.attributes) !== null && _b !== void 0 ? _b : {};
@@ -31490,8 +31582,10 @@ class Room extends eventsExports.EventEmitter {
31490
31582
  return true;
31491
31583
  }
31492
31584
  emitBufferedEvents() {
31493
- this.bufferedEvents.forEach(_ref8 => {
31494
- let [ev, args] = _ref8;
31585
+ this.bufferedEvents.forEach(_ref9 => {
31586
+ let _ref0 = _slicedToArray(_ref9, 2),
31587
+ ev = _ref0[0],
31588
+ args = _ref0[1];
31495
31589
  this.emit(ev, ...args);
31496
31590
  });
31497
31591
  this.bufferedEvents = [];
@@ -32444,28 +32538,7 @@ class TokenSourceFixed {}
32444
32538
  * A few common downstream implementers are {@link TokenSourceEndpoint}
32445
32539
  * and {@link TokenSourceCustom}.
32446
32540
  */
32447
- class TokenSourceConfigurable {}function _defineProperty(e, r, t) {
32448
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
32449
- value: t,
32450
- enumerable: true,
32451
- configurable: true,
32452
- writable: true
32453
- }) : e[r] = t, e;
32454
- }
32455
- function _toPrimitive(t, r) {
32456
- if ("object" != typeof t || !t) return t;
32457
- var e = t[Symbol.toPrimitive];
32458
- if (void 0 !== e) {
32459
- var i = e.call(t, r);
32460
- if ("object" != typeof i) return i;
32461
- throw new TypeError("@@toPrimitive must return a primitive value.");
32462
- }
32463
- return ("string" === r ? String : Number)(t);
32464
- }
32465
- function _toPropertyKey(t) {
32466
- var i = _toPrimitive(t, "string");
32467
- return "symbol" == typeof i ? i : i + "";
32468
- }new TextEncoder();
32541
+ class TokenSourceConfigurable {}new TextEncoder();
32469
32542
  const decoder = new TextDecoder();function decodeBase64(encoded) {
32470
32543
  if (Uint8Array.fromBase64) {
32471
32544
  return Uint8Array.fromBase64(encoded);
@@ -32653,10 +32726,9 @@ function isObject(input) {
32653
32726
  return Object.getPrototypeOf(input) === proto;
32654
32727
  }function decodeJwt(jwt) {
32655
32728
  if (typeof jwt !== 'string') throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');
32656
- const {
32657
- 1: payload,
32658
- length
32659
- } = jwt.split('.');
32729
+ const _jwt$split = jwt.split('.'),
32730
+ payload = _jwt$split[1],
32731
+ length = _jwt$split.length;
32660
32732
  if (length === 5) throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');
32661
32733
  if (length !== 3) throw new JWTInvalid('Invalid JWT');
32662
32734
  if (!payload) throw new JWTInvalid('JWTs must contain a payload');
@@ -32691,10 +32763,8 @@ function isResponseTokenValid(response) {
32691
32763
  /** Given a LiveKit generated participant token, decodes and returns the associated {@link TokenPayload} data. */
32692
32764
  function decodeTokenPayload(token) {
32693
32765
  const payload = decodeJwt(token);
32694
- const {
32695
- roomConfig
32696
- } = payload,
32697
- rest = __rest(payload, ["roomConfig"]);
32766
+ payload.roomConfig;
32767
+ const rest = __rest(payload, ["roomConfig"]);
32698
32768
  const mappedPayload = Object.assign(Object.assign({}, rest), {
32699
32769
  roomConfig: payload.roomConfig ? RoomConfiguration.fromJson(payload.roomConfig, {
32700
32770
  ignoreUnknownFields: true
@@ -32904,9 +32974,8 @@ class TokenSourceEndpoint extends TokenSourceCached {
32904
32974
  }
32905
32975
  class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
32906
32976
  constructor(sandboxId, options) {
32907
- const {
32908
- baseUrl = 'https://cloud-api.livekit.io'
32909
- } = options,
32977
+ const _options$baseUrl = options.baseUrl,
32978
+ baseUrl = _options$baseUrl === void 0 ? 'https://cloud-api.livekit.io' : _options$baseUrl,
32910
32979
  rest = __rest(options, ["baseUrl"]);
32911
32980
  super("".concat(baseUrl, "/api/v2/sandbox/connection-details"), Object.assign(Object.assign({}, rest), {
32912
32981
  headers: {
@@ -33024,7 +33093,8 @@ function facingModeFromDeviceLabel(deviceLabel) {
33024
33093
  }
33025
33094
  // Can we match against sections of the device label.
33026
33095
  return (_a = Array.from(knownDeviceLabelSections.entries()).find(_ref => {
33027
- let [section] = _ref;
33096
+ let _ref2 = _slicedToArray(_ref, 1),
33097
+ section = _ref2[0];
33028
33098
  return label.includes(section);
33029
33099
  })) === null || _a === void 0 ? void 0 : _a[1];
33030
33100
  }