cogito-client 1.0.30 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useState as Mt, useRef as xi, useEffect as Xn, useCallback as Ce } from "react";
1
+ import { useState as Ot, useRef as xi, useEffect as Xn, useCallback as Ce } from "react";
2
2
  function Ha(n, e) {
3
3
  return e.forEach(function(t) {
4
4
  t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(i) {
@@ -17,7 +17,7 @@ var za = Object.defineProperty, Qa = (n, e, t) => e in n ? za(n, e, {
17
17
  writable: !0,
18
18
  value: t
19
19
  }) : n[e] = t, $n = (n, e, t) => Qa(n, typeof e != "symbol" ? e + "" : e, t);
20
- class he {
20
+ class ue {
21
21
  constructor() {
22
22
  $n(this, "_locking"), $n(this, "_locks"), this._locking = Promise.resolve(), this._locks = 0;
23
23
  }
@@ -394,11 +394,11 @@ var S;
394
394
  (function(n) {
395
395
  n[n.DOUBLE = 1] = "DOUBLE", n[n.FLOAT = 2] = "FLOAT", n[n.INT64 = 3] = "INT64", n[n.UINT64 = 4] = "UINT64", n[n.INT32 = 5] = "INT32", n[n.FIXED64 = 6] = "FIXED64", n[n.FIXED32 = 7] = "FIXED32", n[n.BOOL = 8] = "BOOL", n[n.STRING = 9] = "STRING", n[n.BYTES = 12] = "BYTES", n[n.UINT32 = 13] = "UINT32", n[n.SFIXED32 = 15] = "SFIXED32", n[n.SFIXED64 = 16] = "SFIXED64", n[n.SINT32 = 17] = "SINT32", n[n.SINT64 = 18] = "SINT64";
396
396
  })(S || (S = {}));
397
- var nt;
397
+ var it;
398
398
  (function(n) {
399
399
  n[n.BIGINT = 0] = "BIGINT", n[n.STRING = 1] = "STRING";
400
- })(nt || (nt = {}));
401
- function Qe(n, e, t) {
400
+ })(it || (it = {}));
401
+ function ze(n, e, t) {
402
402
  if (e === t)
403
403
  return !0;
404
404
  if (n == S.BYTES) {
@@ -419,7 +419,7 @@ function Qe(n, e, t) {
419
419
  }
420
420
  return !1;
421
421
  }
422
- function _t(n, e) {
422
+ function Pt(n, e) {
423
423
  switch (n) {
424
424
  case S.BOOL:
425
425
  return !1;
@@ -452,10 +452,10 @@ function ur(n, e) {
452
452
  return e == 0;
453
453
  }
454
454
  }
455
- var te;
455
+ var ee;
456
456
  (function(n) {
457
457
  n[n.Varint = 0] = "Varint", n[n.Bit64 = 1] = "Bit64", n[n.LengthDelimited = 2] = "LengthDelimited", n[n.StartGroup = 3] = "StartGroup", n[n.EndGroup = 4] = "EndGroup", n[n.Bit32 = 5] = "Bit32";
458
- })(te || (te = {}));
458
+ })(ee || (ee = {}));
459
459
  class lo {
460
460
  constructor(e) {
461
461
  this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
@@ -636,27 +636,27 @@ class uo {
636
636
  skip(e, t) {
637
637
  let i = this.pos;
638
638
  switch (e) {
639
- case te.Varint:
639
+ case ee.Varint:
640
640
  for (; this.buf[this.pos++] & 128; )
641
641
  ;
642
642
  break;
643
643
  // eslint-disable-next-line
644
644
  // @ts-ignore TS7029: Fallthrough case in switch
645
- case te.Bit64:
645
+ case ee.Bit64:
646
646
  this.pos += 4;
647
647
  // eslint-disable-next-line
648
648
  // @ts-ignore TS7029: Fallthrough case in switch
649
- case te.Bit32:
649
+ case ee.Bit32:
650
650
  this.pos += 4;
651
651
  break;
652
- case te.LengthDelimited:
652
+ case ee.LengthDelimited:
653
653
  let s = this.uint32();
654
654
  this.pos += s;
655
655
  break;
656
- case te.StartGroup:
656
+ case ee.StartGroup:
657
657
  for (; ; ) {
658
658
  const [r, o] = this.tag();
659
- if (o === te.EndGroup) {
659
+ if (o === ee.EndGroup) {
660
660
  if (t !== void 0 && r !== t)
661
661
  throw new Error("invalid end group tag");
662
662
  break;
@@ -793,7 +793,7 @@ function fo(n) {
793
793
  case "enum":
794
794
  return e.T.values[0].no;
795
795
  case "scalar":
796
- return _t(e.T, e.L);
796
+ return Pt(e.T, e.L);
797
797
  case "message":
798
798
  const t = e.T, i = new t();
799
799
  return t.fieldWrapper ? t.fieldWrapper.unwrapField(i) : i;
@@ -810,10 +810,10 @@ function mo(n, e) {
810
810
  }
811
811
  return n.filter((t) => t.no === e.no);
812
812
  }
813
- let We = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Ci = [];
814
- for (let n = 0; n < We.length; n++) Ci[We[n].charCodeAt(0)] = n;
815
- Ci[45] = We.indexOf("+");
816
- Ci[95] = We.indexOf("/");
813
+ let qe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Ci = [];
814
+ for (let n = 0; n < qe.length; n++) Ci[qe[n].charCodeAt(0)] = n;
815
+ Ci[45] = qe.indexOf("+");
816
+ Ci[95] = qe.indexOf("/");
817
817
  const fr = {
818
818
  /**
819
819
  * Decodes a base64 string to a byte array.
@@ -874,16 +874,16 @@ const fr = {
874
874
  for (let r = 0; r < n.length; r++)
875
875
  switch (i = n[r], t) {
876
876
  case 0:
877
- e += We[i >> 2], s = (i & 3) << 4, t = 1;
877
+ e += qe[i >> 2], s = (i & 3) << 4, t = 1;
878
878
  break;
879
879
  case 1:
880
- e += We[s | i >> 4], s = (i & 15) << 2, t = 2;
880
+ e += qe[s | i >> 4], s = (i & 15) << 2, t = 2;
881
881
  break;
882
882
  case 2:
883
- e += We[s | i >> 6], e += We[i & 63], t = 0;
883
+ e += qe[s | i >> 6], e += qe[i & 63], t = 0;
884
884
  break;
885
885
  }
886
- return t && (e += We[s], e += "=", t == 1 && (e += "=")), e;
886
+ return t && (e += qe[s], e += "=", t == 1 && (e += "=")), e;
887
887
  }
888
888
  };
889
889
  function po(n, e, t) {
@@ -953,21 +953,21 @@ function is(n, e) {
953
953
  e[t] = i ? n.T.values[0].no : void 0;
954
954
  break;
955
955
  case "scalar":
956
- e[t] = i ? _t(n.T, n.L) : void 0;
956
+ e[t] = i ? Pt(n.T, n.L) : void 0;
957
957
  break;
958
958
  case "message":
959
959
  e[t] = void 0;
960
960
  break;
961
961
  }
962
962
  }
963
- function Ke(n, e) {
963
+ function We(n, e) {
964
964
  if (n === null || typeof n != "object" || !Object.getOwnPropertyNames(Pn.prototype).every((i) => i in n && typeof n[i] == "function"))
965
965
  return !1;
966
966
  const t = n.getType();
967
967
  return t === null || typeof t != "function" || !("typeName" in t) || typeof t.typeName != "string" ? !1 : e === void 0 ? !0 : t.typeName == e.typeName;
968
968
  }
969
969
  function vr(n, e) {
970
- return Ke(e) || !n.fieldWrapper ? e : n.fieldWrapper.wrapField(e);
970
+ return We(e) || !n.fieldWrapper ? e : n.fieldWrapper.wrapField(e);
971
971
  }
972
972
  S.DOUBLE, S.FLOAT, S.INT64, S.UINT64, S.INT32, S.UINT32, S.BOOL, S.STRING, S.BYTES;
973
973
  const ns = {
@@ -991,7 +991,7 @@ function yo() {
991
991
  makeWriteOptions: bo,
992
992
  readMessage(n, e, t, i) {
993
993
  if (e == null || Array.isArray(e) || typeof e != "object")
994
- throw new Error("cannot decode message ".concat(n.typeName, " from JSON: ").concat(Ne(e)));
994
+ throw new Error("cannot decode message ".concat(n.typeName, " from JSON: ").concat(xe(e)));
995
995
  i = i ?? new n();
996
996
  const s = /* @__PURE__ */ new Map(), r = t.typeRegistry;
997
997
  for (const [o, a] of Object.entries(e)) {
@@ -1052,16 +1052,16 @@ function yo() {
1052
1052
  return i;
1053
1053
  },
1054
1054
  readScalar(n, e, t) {
1055
- return Vt(n, e, t ?? nt.BIGINT, !0);
1055
+ return jt(n, e, t ?? it.BIGINT, !0);
1056
1056
  },
1057
1057
  writeScalar(n, e, t) {
1058
1058
  if (e !== void 0 && (t || ur(n, e)))
1059
1059
  return ii(n, e);
1060
1060
  },
1061
- debug: Ne
1061
+ debug: xe
1062
1062
  };
1063
1063
  }
1064
- function Ne(n) {
1064
+ function xe(n) {
1065
1065
  if (n === null)
1066
1066
  return "null";
1067
1067
  switch (typeof n) {
@@ -1079,11 +1079,11 @@ function rs(n, e, t, i, s) {
1079
1079
  if (X(t.kind != "map"), e === null)
1080
1080
  return;
1081
1081
  if (!Array.isArray(e))
1082
- throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(e)));
1082
+ throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e)));
1083
1083
  const o = n[r];
1084
1084
  for (const a of e) {
1085
1085
  if (a === null)
1086
- throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(a)));
1086
+ throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(a)));
1087
1087
  switch (t.kind) {
1088
1088
  case "message":
1089
1089
  o.push(t.T.fromJson(a, i));
@@ -1094,9 +1094,9 @@ function rs(n, e, t, i, s) {
1094
1094
  break;
1095
1095
  case "scalar":
1096
1096
  try {
1097
- o.push(Vt(t.T, a, t.L, !0));
1097
+ o.push(jt(t.T, a, t.L, !0));
1098
1098
  } catch (d) {
1099
- let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(a));
1099
+ let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(a));
1100
1100
  throw d instanceof Error && d.message.length > 0 && (l += ": ".concat(d.message)), new Error(l);
1101
1101
  }
1102
1102
  break;
@@ -1106,7 +1106,7 @@ function rs(n, e, t, i, s) {
1106
1106
  if (e === null)
1107
1107
  return;
1108
1108
  if (typeof e != "object" || Array.isArray(e))
1109
- throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(e)));
1109
+ throw new Error("cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e)));
1110
1110
  const o = n[r];
1111
1111
  for (const [a, c] of Object.entries(e)) {
1112
1112
  if (c === null)
@@ -1115,7 +1115,7 @@ function rs(n, e, t, i, s) {
1115
1115
  try {
1116
1116
  d = ko(t.K, a);
1117
1117
  } catch (l) {
1118
- let u = "cannot decode map key for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(e));
1118
+ let u = "cannot decode map key for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
1119
1119
  throw l instanceof Error && l.message.length > 0 && (u += ": ".concat(l.message)), new Error(u);
1120
1120
  }
1121
1121
  switch (t.V.kind) {
@@ -1128,9 +1128,9 @@ function rs(n, e, t, i, s) {
1128
1128
  break;
1129
1129
  case "scalar":
1130
1130
  try {
1131
- o[d] = Vt(t.V.T, c, nt.BIGINT, !0);
1131
+ o[d] = jt(t.V.T, c, it.BIGINT, !0);
1132
1132
  } catch (u) {
1133
- let h = "cannot decode map value for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(e));
1133
+ let h = "cannot decode map value for field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
1134
1134
  throw u instanceof Error && u.message.length > 0 && (h += ": ".concat(u.message)), new Error(h);
1135
1135
  }
1136
1136
  break;
@@ -1145,7 +1145,7 @@ function rs(n, e, t, i, s) {
1145
1145
  if (e === null && o.typeName != "google.protobuf.Value")
1146
1146
  return;
1147
1147
  let a = n[r];
1148
- Ke(a) ? a.fromJson(e, i) : (n[r] = a = o.fromJson(e, i), o.fieldWrapper && !t.oneof && (n[r] = o.fieldWrapper.unwrapField(a)));
1148
+ We(a) ? a.fromJson(e, i) : (n[r] = a = o.fromJson(e, i), o.fieldWrapper && !t.oneof && (n[r] = o.fieldWrapper.unwrapField(a)));
1149
1149
  break;
1150
1150
  case "enum":
1151
1151
  const c = Ni(t.T, e, i.ignoreUnknownFields, !1);
@@ -1162,10 +1162,10 @@ function rs(n, e, t, i, s) {
1162
1162
  break;
1163
1163
  case "scalar":
1164
1164
  try {
1165
- const d = Vt(t.T, e, t.L, !1);
1165
+ const d = jt(t.T, e, t.L, !1);
1166
1166
  d === hi ? is(t, n) : n[r] = d;
1167
1167
  } catch (d) {
1168
- let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(Ne(e));
1168
+ let l = "cannot decode field ".concat(s.typeName, ".").concat(t.name, " from JSON: ").concat(xe(e));
1169
1169
  throw d instanceof Error && d.message.length > 0 && (l += ": ".concat(d.message)), new Error(l);
1170
1170
  }
1171
1171
  break;
@@ -1181,11 +1181,11 @@ function ko(n, e) {
1181
1181
  e = !1;
1182
1182
  break;
1183
1183
  }
1184
- return Vt(n, e, nt.BIGINT, !0).toString();
1184
+ return jt(n, e, it.BIGINT, !0).toString();
1185
1185
  }
1186
- function Vt(n, e, t, i) {
1186
+ function jt(n, e, t, i) {
1187
1187
  if (e === null)
1188
- return i ? _t(n, t) : hi;
1188
+ return i ? Pt(n, t) : hi;
1189
1189
  switch (n) {
1190
1190
  // float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
1191
1191
  // Either numbers or strings are accepted. Exponent notation is also accepted.
@@ -1260,7 +1260,7 @@ function Ni(n, e, t, i) {
1260
1260
  return ti;
1261
1261
  break;
1262
1262
  }
1263
- throw new Error("cannot decode enum ".concat(n.typeName, " from JSON: ").concat(Ne(e)));
1263
+ throw new Error("cannot decode enum ".concat(n.typeName, " from JSON: ").concat(xe(e)));
1264
1264
  }
1265
1265
  function To(n) {
1266
1266
  return n.repeated || n.kind == "map" ? !0 : !(n.oneof || n.kind == "message" || n.opt || n.req);
@@ -1357,7 +1357,7 @@ function ii(n, e) {
1357
1357
  return X(e instanceof Uint8Array), fr.enc(e);
1358
1358
  }
1359
1359
  }
1360
- const mt = /* @__PURE__ */ Symbol("@bufbuild/protobuf/unknown-fields"), os = {
1360
+ const ht = /* @__PURE__ */ Symbol("@bufbuild/protobuf/unknown-fields"), os = {
1361
1361
  readUnknownFields: !0,
1362
1362
  readerFactory: (n) => new uo(n)
1363
1363
  }, cs = {
@@ -1376,20 +1376,20 @@ function Eo() {
1376
1376
  makeWriteOptions: Co,
1377
1377
  listUnknownFields(n) {
1378
1378
  var e;
1379
- return (e = n[mt]) !== null && e !== void 0 ? e : [];
1379
+ return (e = n[ht]) !== null && e !== void 0 ? e : [];
1380
1380
  },
1381
1381
  discardUnknownFields(n) {
1382
- delete n[mt];
1382
+ delete n[ht];
1383
1383
  },
1384
1384
  writeUnknownFields(n, e) {
1385
- const i = n[mt];
1385
+ const i = n[ht];
1386
1386
  if (i)
1387
1387
  for (const s of i)
1388
1388
  e.tag(s.no, s.wireType).raw(s.data);
1389
1389
  },
1390
1390
  onUnknownField(n, e, t, i) {
1391
1391
  const s = n;
1392
- Array.isArray(s[mt]) || (s[mt] = []), s[mt].push({
1392
+ Array.isArray(s[ht]) || (s[ht] = []), s[ht].push({
1393
1393
  no: e,
1394
1394
  wireType: t,
1395
1395
  data: i
@@ -1398,7 +1398,7 @@ function Eo() {
1398
1398
  readMessage(n, e, t, i, s) {
1399
1399
  const r = n.getType(), o = s ? e.len : e.pos + t;
1400
1400
  let a, c;
1401
- for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == te.EndGroup)); ) {
1401
+ for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == ee.EndGroup)); ) {
1402
1402
  const d = r.fields.find(a);
1403
1403
  if (!d) {
1404
1404
  const l = e.skip(c, a);
@@ -1408,7 +1408,7 @@ function Eo() {
1408
1408
  ds(n, e, d, c, i);
1409
1409
  }
1410
1410
  if (s && // eslint-disable-line @typescript-eslint/strict-boolean-expressions
1411
- (c != te.EndGroup || a !== t))
1411
+ (c != ee.EndGroup || a !== t))
1412
1412
  throw new Error("invalid end group tag");
1413
1413
  },
1414
1414
  readField: ds,
@@ -1442,7 +1442,7 @@ function ds(n, e, t, i, s) {
1442
1442
  let c = fi;
1443
1443
  if (t.kind == "scalar" && t.L > 0 && (c = Ro), r) {
1444
1444
  let h = n[o];
1445
- if (i == te.LengthDelimited && a != S.STRING && a != S.BYTES) {
1445
+ if (i == ee.LengthDelimited && a != S.STRING && a != S.BYTES) {
1446
1446
  let v = e.uint32() + e.pos;
1447
1447
  for (; e.pos < v; )
1448
1448
  h.push(c(e, a));
@@ -1453,7 +1453,7 @@ function ds(n, e, t, i, s) {
1453
1453
  break;
1454
1454
  case "message":
1455
1455
  const d = t.T;
1456
- r ? n[o].push(ni(e, new d(), s, t)) : Ke(n[o]) ? ni(e, n[o], s, t) : (n[o] = ni(e, new d(), s, t), d.fieldWrapper && !t.oneof && !t.repeated && (n[o] = d.fieldWrapper.unwrapField(n[o])));
1456
+ r ? n[o].push(ni(e, new d(), s, t)) : We(n[o]) ? ni(e, n[o], s, t) : (n[o] = ni(e, new d(), s, t), d.fieldWrapper && !t.oneof && !t.repeated && (n[o] = d.fieldWrapper.unwrapField(n[o])));
1457
1457
  break;
1458
1458
  case "map":
1459
1459
  let [l, u] = Po(t, e, s);
@@ -1496,10 +1496,10 @@ function Po(n, e, t) {
1496
1496
  break;
1497
1497
  }
1498
1498
  }
1499
- if (r === void 0 && (r = _t(n.K, nt.BIGINT)), typeof r != "string" && typeof r != "number" && (r = r.toString()), o === void 0)
1499
+ if (r === void 0 && (r = Pt(n.K, it.BIGINT)), typeof r != "string" && typeof r != "number" && (r = r.toString()), o === void 0)
1500
1500
  switch (n.V.kind) {
1501
1501
  case "scalar":
1502
- o = _t(n.V.T, nt.BIGINT);
1502
+ o = Pt(n.V.T, it.BIGINT);
1503
1503
  break;
1504
1504
  case "enum":
1505
1505
  o = n.V.T.values[0].no;
@@ -1560,9 +1560,9 @@ function ls(n, e, t, i) {
1560
1560
  wo(t, r, n.no, e);
1561
1561
  else
1562
1562
  for (const o of e)
1563
- qt(t, r, n.no, o);
1563
+ Bt(t, r, n.no, o);
1564
1564
  else
1565
- qt(t, r, n.no, e);
1565
+ Bt(t, r, n.no, e);
1566
1566
  break;
1567
1567
  case "message":
1568
1568
  if (s) {
@@ -1580,7 +1580,7 @@ function ls(n, e, t, i) {
1580
1580
  }
1581
1581
  }
1582
1582
  function _o(n, e, t, i, s) {
1583
- n.tag(t.no, te.LengthDelimited), n.fork();
1583
+ n.tag(t.no, ee.LengthDelimited), n.fork();
1584
1584
  let r = i;
1585
1585
  switch (t.K) {
1586
1586
  case S.INT32:
@@ -1594,24 +1594,24 @@ function _o(n, e, t, i, s) {
1594
1594
  X(i == "true" || i == "false"), r = i == "true";
1595
1595
  break;
1596
1596
  }
1597
- switch (qt(n, t.K, 1, r), t.V.kind) {
1597
+ switch (Bt(n, t.K, 1, r), t.V.kind) {
1598
1598
  case "scalar":
1599
- qt(n, t.V.T, 2, s);
1599
+ Bt(n, t.V.T, 2, s);
1600
1600
  break;
1601
1601
  case "enum":
1602
- qt(n, S.INT32, 2, s);
1602
+ Bt(n, S.INT32, 2, s);
1603
1603
  break;
1604
1604
  case "message":
1605
- X(s !== void 0), n.tag(2, te.LengthDelimited).bytes(s.toBinary(e));
1605
+ X(s !== void 0), n.tag(2, ee.LengthDelimited).bytes(s.toBinary(e));
1606
1606
  break;
1607
1607
  }
1608
1608
  n.join();
1609
1609
  }
1610
1610
  function us(n, e, t, i) {
1611
1611
  const s = vr(t.T, i);
1612
- t.delimited ? n.tag(t.no, te.StartGroup).raw(s.toBinary(e)).tag(t.no, te.EndGroup) : n.tag(t.no, te.LengthDelimited).bytes(s.toBinary(e));
1612
+ t.delimited ? n.tag(t.no, ee.StartGroup).raw(s.toBinary(e)).tag(t.no, ee.EndGroup) : n.tag(t.no, ee.LengthDelimited).bytes(s.toBinary(e));
1613
1613
  }
1614
- function qt(n, e, t, i) {
1614
+ function Bt(n, e, t, i) {
1615
1615
  X(i !== void 0);
1616
1616
  let [s, r] = br(e);
1617
1617
  n.tag(t, s)[r](i);
@@ -1619,28 +1619,28 @@ function qt(n, e, t, i) {
1619
1619
  function wo(n, e, t, i) {
1620
1620
  if (!i.length)
1621
1621
  return;
1622
- n.tag(t, te.LengthDelimited).fork();
1622
+ n.tag(t, ee.LengthDelimited).fork();
1623
1623
  let [, s] = br(e);
1624
1624
  for (let r = 0; r < i.length; r++)
1625
1625
  n[s](i[r]);
1626
1626
  n.join();
1627
1627
  }
1628
1628
  function br(n) {
1629
- let e = te.Varint;
1629
+ let e = ee.Varint;
1630
1630
  switch (n) {
1631
1631
  case S.BYTES:
1632
1632
  case S.STRING:
1633
- e = te.LengthDelimited;
1633
+ e = ee.LengthDelimited;
1634
1634
  break;
1635
1635
  case S.DOUBLE:
1636
1636
  case S.FIXED64:
1637
1637
  case S.SFIXED64:
1638
- e = te.Bit64;
1638
+ e = ee.Bit64;
1639
1639
  break;
1640
1640
  case S.FIXED32:
1641
1641
  case S.SFIXED32:
1642
1642
  case S.FLOAT:
1643
- e = te.Bit32;
1643
+ e = ee.Bit32;
1644
1644
  break;
1645
1645
  }
1646
1646
  const t = S[n].toLowerCase();
@@ -1663,7 +1663,7 @@ function Io() {
1663
1663
  continue;
1664
1664
  const c = i.findField(a);
1665
1665
  let d = o[s].value;
1666
- c && c.kind == "message" && !Ke(d, c.T) ? d = new c.T(d) : c && c.kind === "scalar" && c.T === S.BYTES && (d = xt(d)), r[s] = {
1666
+ c && c.kind == "message" && !We(d, c.T) ? d = new c.T(d) : c && c.kind === "scalar" && c.T === S.BYTES && (d = Dt(d)), r[s] = {
1667
1667
  case: a,
1668
1668
  value: d
1669
1669
  };
@@ -1671,7 +1671,7 @@ function Io() {
1671
1671
  case "scalar":
1672
1672
  case "enum":
1673
1673
  let l = o[s];
1674
- i.T === S.BYTES && (l = i.repeated ? l.map(xt) : xt(l)), r[s] = l;
1674
+ i.T === S.BYTES && (l = i.repeated ? l.map(Dt) : Dt(l)), r[s] = l;
1675
1675
  break;
1676
1676
  case "map":
1677
1677
  switch (i.V.kind) {
@@ -1679,7 +1679,7 @@ function Io() {
1679
1679
  case "enum":
1680
1680
  if (i.V.T === S.BYTES)
1681
1681
  for (const [m, v] of Object.entries(o[s]))
1682
- r[s][m] = xt(v);
1682
+ r[s][m] = Dt(v);
1683
1683
  else
1684
1684
  Object.assign(r[s], o[s]);
1685
1685
  break;
@@ -1695,10 +1695,10 @@ function Io() {
1695
1695
  case "message":
1696
1696
  const u = i.T;
1697
1697
  if (i.repeated)
1698
- r[s] = o[s].map((h) => Ke(h, u) ? h : new u(h));
1698
+ r[s] = o[s].map((h) => We(h, u) ? h : new u(h));
1699
1699
  else {
1700
1700
  const h = o[s];
1701
- u.fieldWrapper ? /* We can't use BytesValue.typeName as that will create a circular import */ u.typeName === "google.protobuf.BytesValue" ? r[s] = xt(h) : r[s] = h : r[s] = Ke(h, u) ? h : new u(h);
1701
+ u.fieldWrapper ? /* We can't use BytesValue.typeName as that will create a circular import */ u.typeName === "google.protobuf.BytesValue" ? r[s] = Dt(h) : r[s] = h : r[s] = We(h, u) ? h : new u(h);
1702
1702
  }
1703
1703
  break;
1704
1704
  }
@@ -1715,20 +1715,20 @@ function Io() {
1715
1715
  case "message":
1716
1716
  return s.every((o, a) => i.T.equals(o, r[a]));
1717
1717
  case "scalar":
1718
- return s.every((o, a) => Qe(i.T, o, r[a]));
1718
+ return s.every((o, a) => ze(i.T, o, r[a]));
1719
1719
  case "enum":
1720
- return s.every((o, a) => Qe(S.INT32, o, r[a]));
1720
+ return s.every((o, a) => ze(S.INT32, o, r[a]));
1721
1721
  }
1722
1722
  throw new Error("repeated cannot contain ".concat(i.kind));
1723
1723
  }
1724
1724
  switch (i.kind) {
1725
1725
  case "message":
1726
1726
  let o = s, a = r;
1727
- return i.T.fieldWrapper && (o !== void 0 && !Ke(o) && (o = i.T.fieldWrapper.wrapField(o)), a !== void 0 && !Ke(a) && (a = i.T.fieldWrapper.wrapField(a))), i.T.equals(o, a);
1727
+ return i.T.fieldWrapper && (o !== void 0 && !We(o) && (o = i.T.fieldWrapper.wrapField(o)), a !== void 0 && !We(a) && (a = i.T.fieldWrapper.wrapField(a))), i.T.equals(o, a);
1728
1728
  case "enum":
1729
- return Qe(S.INT32, s, r);
1729
+ return ze(S.INT32, s, r);
1730
1730
  case "scalar":
1731
- return Qe(i.T, s, r);
1731
+ return ze(i.T, s, r);
1732
1732
  case "oneof":
1733
1733
  if (s.case !== r.case)
1734
1734
  return !1;
@@ -1739,9 +1739,9 @@ function Io() {
1739
1739
  case "message":
1740
1740
  return c.T.equals(s.value, r.value);
1741
1741
  case "enum":
1742
- return Qe(S.INT32, s.value, r.value);
1742
+ return ze(S.INT32, s.value, r.value);
1743
1743
  case "scalar":
1744
- return Qe(c.T, s.value, r.value);
1744
+ return ze(c.T, s.value, r.value);
1745
1745
  }
1746
1746
  throw new Error("oneof cannot contain ".concat(c.kind));
1747
1747
  case "map":
@@ -1751,10 +1751,10 @@ function Io() {
1751
1751
  const l = i.V.T;
1752
1752
  return d.every((h) => l.equals(s[h], r[h]));
1753
1753
  case "enum":
1754
- return d.every((h) => Qe(S.INT32, s[h], r[h]));
1754
+ return d.every((h) => ze(S.INT32, s[h], r[h]));
1755
1755
  case "scalar":
1756
1756
  const u = i.V.T;
1757
- return d.every((h) => Qe(u, s[h], r[h]));
1757
+ return d.every((h) => ze(u, s[h], r[h]));
1758
1758
  }
1759
1759
  break;
1760
1760
  }
@@ -1789,7 +1789,7 @@ function Io() {
1789
1789
  function Xt(n) {
1790
1790
  if (n === void 0)
1791
1791
  return n;
1792
- if (Ke(n))
1792
+ if (We(n))
1793
1793
  return n.clone();
1794
1794
  if (n instanceof Uint8Array) {
1795
1795
  const e = new Uint8Array(n.byteLength);
@@ -1797,7 +1797,7 @@ function Xt(n) {
1797
1797
  }
1798
1798
  return n;
1799
1799
  }
1800
- function xt(n) {
1800
+ function Dt(n) {
1801
1801
  return n instanceof Uint8Array ? n : new Uint8Array(n);
1802
1802
  }
1803
1803
  function Oo(n, e, t) {
@@ -1937,7 +1937,7 @@ function jo(n, e) {
1937
1937
  let d;
1938
1938
  for (const l of typeof n == "function" ? n() : n) {
1939
1939
  const u = l;
1940
- if (u.localName = yr(l.name, l.oneof !== void 0), u.jsonName = (t = l.jsonName) !== null && t !== void 0 ? t : xo(l.name), u.repeated = (i = l.repeated) !== null && i !== void 0 ? i : !1, l.kind == "scalar" && (u.L = (s = l.L) !== null && s !== void 0 ? s : nt.BIGINT), u.delimited = (r = l.delimited) !== null && r !== void 0 ? r : !1, u.req = (o = l.req) !== null && o !== void 0 ? o : !1, u.opt = (a = l.opt) !== null && a !== void 0 ? a : !1, l.packed === void 0 && (u.packed = l.kind == "enum" || l.kind == "scalar" && l.T != S.BYTES && l.T != S.STRING), l.oneof !== void 0) {
1940
+ if (u.localName = yr(l.name, l.oneof !== void 0), u.jsonName = (t = l.jsonName) !== null && t !== void 0 ? t : xo(l.name), u.repeated = (i = l.repeated) !== null && i !== void 0 ? i : !1, l.kind == "scalar" && (u.L = (s = l.L) !== null && s !== void 0 ? s : it.BIGINT), u.delimited = (r = l.delimited) !== null && r !== void 0 ? r : !1, u.req = (o = l.req) !== null && o !== void 0 ? o : !1, u.opt = (a = l.opt) !== null && a !== void 0 ? a : !1, l.packed === void 0 && (u.packed = l.kind == "enum" || l.kind == "scalar" && l.T != S.BYTES && l.T != S.STRING), l.oneof !== void 0) {
1941
1941
  const h = typeof l.oneof == "string" ? l.oneof : l.oneof.name;
1942
1942
  (!d || d.name != h) && (d = new Fo(h)), u.oneof = d, d.addField(u);
1943
1943
  }
@@ -1971,7 +1971,7 @@ const g = Oo(
1971
1971
  i[t] = {};
1972
1972
  break;
1973
1973
  case "scalar":
1974
- i[t] = _t(e.T, e.L);
1974
+ i[t] = Pt(e.T, e.L);
1975
1975
  break;
1976
1976
  }
1977
1977
  }
@@ -2222,7 +2222,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2222
2222
  }, {
2223
2223
  no: 3,
2224
2224
  name: "OFF"
2225
- }]), jt = /* @__PURE__ */ g.makeEnum("livekit.ConnectionQuality", [{
2225
+ }]), Ut = /* @__PURE__ */ g.makeEnum("livekit.ConnectionQuality", [{
2226
2226
  no: 0,
2227
2227
  name: "POOR"
2228
2228
  }, {
@@ -2234,7 +2234,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2234
2234
  }, {
2235
2235
  no: 3,
2236
2236
  name: "LOST"
2237
- }]), Gt = /* @__PURE__ */ g.makeEnum("livekit.ClientConfigSetting", [{
2237
+ }]), Wt = /* @__PURE__ */ g.makeEnum("livekit.ClientConfigSetting", [{
2238
2238
  no: 0,
2239
2239
  name: "UNSET"
2240
2240
  }, {
@@ -2291,7 +2291,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2291
2291
  }, {
2292
2292
  no: 15,
2293
2293
  name: "MEDIA_FAILURE"
2294
- }]), ot = /* @__PURE__ */ g.makeEnum("livekit.ReconnectReason", [{
2294
+ }]), at = /* @__PURE__ */ g.makeEnum("livekit.ReconnectReason", [{
2295
2295
  no: 0,
2296
2296
  name: "RR_UNKNOWN"
2297
2297
  }, {
@@ -2485,7 +2485,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2485
2485
  kind: "scalar",
2486
2486
  T: 8
2487
2487
  /* ScalarType.BOOL */
2488
- }]), dt = /* @__PURE__ */ g.makeMessageType("livekit.ParticipantInfo", () => [{
2488
+ }]), ct = /* @__PURE__ */ g.makeMessageType("livekit.ParticipantInfo", () => [{
2489
2489
  no: 1,
2490
2490
  name: "sid",
2491
2491
  kind: "scalar",
@@ -2501,12 +2501,12 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2501
2501
  no: 3,
2502
2502
  name: "state",
2503
2503
  kind: "enum",
2504
- T: g.getEnumType(yt)
2504
+ T: g.getEnumType(vt)
2505
2505
  }, {
2506
2506
  no: 4,
2507
2507
  name: "tracks",
2508
2508
  kind: "message",
2509
- T: gt,
2509
+ T: mt,
2510
2510
  repeated: !0
2511
2511
  }, {
2512
2512
  no: 5,
@@ -2559,7 +2559,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2559
2559
  no: 14,
2560
2560
  name: "kind",
2561
2561
  kind: "enum",
2562
- T: g.getEnumType(wt)
2562
+ T: g.getEnumType(Rt)
2563
2563
  }, {
2564
2564
  no: 15,
2565
2565
  name: "attributes",
@@ -2581,7 +2581,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2581
2581
  kind: "enum",
2582
2582
  T: g.getEnumType(Jo),
2583
2583
  repeated: !0
2584
- }]), yt = /* @__PURE__ */ g.makeEnum("livekit.ParticipantInfo.State", [{
2584
+ }]), vt = /* @__PURE__ */ g.makeEnum("livekit.ParticipantInfo.State", [{
2585
2585
  no: 0,
2586
2586
  name: "JOINING"
2587
2587
  }, {
@@ -2593,7 +2593,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2593
2593
  }, {
2594
2594
  no: 3,
2595
2595
  name: "DISCONNECTED"
2596
- }]), wt = /* @__PURE__ */ g.makeEnum("livekit.ParticipantInfo.Kind", [{
2596
+ }]), Rt = /* @__PURE__ */ g.makeEnum("livekit.ParticipantInfo.Kind", [{
2597
2597
  no: 0,
2598
2598
  name: "STANDARD"
2599
2599
  }, {
@@ -2648,7 +2648,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2648
2648
  no: 4,
2649
2649
  name: "layers",
2650
2650
  kind: "message",
2651
- T: et,
2651
+ T: Ze,
2652
2652
  repeated: !0
2653
2653
  }, {
2654
2654
  no: 5,
@@ -2661,7 +2661,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2661
2661
  kind: "scalar",
2662
2662
  T: 9
2663
2663
  /* ScalarType.STRING */
2664
- }]), gt = /* @__PURE__ */ g.makeMessageType("livekit.TrackInfo", () => [{
2664
+ }]), mt = /* @__PURE__ */ g.makeMessageType("livekit.TrackInfo", () => [{
2665
2665
  no: 1,
2666
2666
  name: "sid",
2667
2667
  kind: "scalar",
@@ -2717,7 +2717,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2717
2717
  no: 10,
2718
2718
  name: "layers",
2719
2719
  kind: "message",
2720
- T: et,
2720
+ T: Ze,
2721
2721
  repeated: !0
2722
2722
  }, {
2723
2723
  no: 11,
@@ -2776,7 +2776,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2776
2776
  name: "backup_codec_policy",
2777
2777
  kind: "enum",
2778
2778
  T: g.getEnumType(Sr)
2779
- }]), et = /* @__PURE__ */ g.makeMessageType("livekit.VideoLayer", () => [{
2779
+ }]), Ze = /* @__PURE__ */ g.makeMessageType("livekit.VideoLayer", () => [{
2780
2780
  no: 1,
2781
2781
  name: "quality",
2782
2782
  kind: "enum",
@@ -2829,7 +2829,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
2829
2829
  }, {
2830
2830
  no: 3,
2831
2831
  name: "ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"
2832
- }]), ue = /* @__PURE__ */ g.makeMessageType("livekit.DataPacket", () => [{
2832
+ }]), le = /* @__PURE__ */ g.makeMessageType("livekit.DataPacket", () => [{
2833
2833
  no: 1,
2834
2834
  name: "kind",
2835
2835
  kind: "enum",
@@ -3454,7 +3454,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3454
3454
  no: 3,
3455
3455
  name: "resume_connection",
3456
3456
  kind: "enum",
3457
- T: g.getEnumType(Gt)
3457
+ T: g.getEnumType(Wt)
3458
3458
  }, {
3459
3459
  no: 4,
3460
3460
  name: "disabled_codecs",
@@ -3464,12 +3464,12 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3464
3464
  no: 5,
3465
3465
  name: "force_relay",
3466
3466
  kind: "enum",
3467
- T: g.getEnumType(Gt)
3467
+ T: g.getEnumType(Wt)
3468
3468
  }]), hs = /* @__PURE__ */ g.makeMessageType("livekit.VideoConfiguration", () => [{
3469
3469
  no: 1,
3470
3470
  name: "hardware_encoder",
3471
3471
  kind: "enum",
3472
- T: g.getEnumType(Gt)
3472
+ T: g.getEnumType(Wt)
3473
3473
  }]), Xo = /* @__PURE__ */ g.makeMessageType("livekit.DisabledCodecs", () => [{
3474
3474
  no: 1,
3475
3475
  name: "codecs",
@@ -3697,13 +3697,13 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3697
3697
  no: 1,
3698
3698
  name: "offer",
3699
3699
  kind: "message",
3700
- T: st,
3700
+ T: nt,
3701
3701
  oneof: "message"
3702
3702
  }, {
3703
3703
  no: 2,
3704
3704
  name: "answer",
3705
3705
  kind: "message",
3706
- T: st,
3706
+ T: nt,
3707
3707
  oneof: "message"
3708
3708
  }, {
3709
3709
  no: 3,
@@ -3715,7 +3715,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3715
3715
  no: 4,
3716
3716
  name: "add_track",
3717
3717
  kind: "message",
3718
- T: Jt,
3718
+ T: Kt,
3719
3719
  oneof: "message"
3720
3720
  }, {
3721
3721
  no: 5,
@@ -3763,7 +3763,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3763
3763
  no: 13,
3764
3764
  name: "simulate",
3765
3765
  kind: "message",
3766
- T: Ae,
3766
+ T: Me,
3767
3767
  oneof: "message"
3768
3768
  }, {
3769
3769
  no: 14,
@@ -3805,13 +3805,13 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3805
3805
  no: 2,
3806
3806
  name: "answer",
3807
3807
  kind: "message",
3808
- T: st,
3808
+ T: nt,
3809
3809
  oneof: "message"
3810
3810
  }, {
3811
3811
  no: 3,
3812
3812
  name: "offer",
3813
3813
  kind: "message",
3814
- T: st,
3814
+ T: nt,
3815
3815
  oneof: "message"
3816
3816
  }, {
3817
3817
  no: 4,
@@ -3961,14 +3961,14 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
3961
3961
  no: 4,
3962
3962
  name: "layers",
3963
3963
  kind: "message",
3964
- T: et,
3964
+ T: Ze,
3965
3965
  repeated: !0
3966
3966
  }, {
3967
3967
  no: 5,
3968
3968
  name: "video_layer_mode",
3969
3969
  kind: "enum",
3970
3970
  T: g.getEnumType(Cr)
3971
- }]), Jt = /* @__PURE__ */ g.makeMessageType("livekit.AddTrackRequest", () => [{
3971
+ }]), Kt = /* @__PURE__ */ g.makeMessageType("livekit.AddTrackRequest", () => [{
3972
3972
  no: 1,
3973
3973
  name: "cid",
3974
3974
  kind: "scalar",
@@ -4018,7 +4018,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4018
4018
  no: 9,
4019
4019
  name: "layers",
4020
4020
  kind: "message",
4021
- T: et,
4021
+ T: Ze,
4022
4022
  repeated: !0
4023
4023
  }, {
4024
4024
  no: 10,
@@ -4104,12 +4104,12 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4104
4104
  no: 2,
4105
4105
  name: "participant",
4106
4106
  kind: "message",
4107
- T: dt
4107
+ T: ct
4108
4108
  }, {
4109
4109
  no: 3,
4110
4110
  name: "other_participants",
4111
4111
  kind: "message",
4112
- T: dt,
4112
+ T: ct,
4113
4113
  repeated: !0
4114
4114
  }, {
4115
4115
  no: 4,
@@ -4213,14 +4213,14 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4213
4213
  no: 2,
4214
4214
  name: "track",
4215
4215
  kind: "message",
4216
- T: gt
4216
+ T: mt
4217
4217
  }]), nc = /* @__PURE__ */ g.makeMessageType("livekit.TrackUnpublishedResponse", () => [{
4218
4218
  no: 1,
4219
4219
  name: "track_sid",
4220
4220
  kind: "scalar",
4221
4221
  T: 9
4222
4222
  /* ScalarType.STRING */
4223
- }]), st = /* @__PURE__ */ g.makeMessageType("livekit.SessionDescription", () => [{
4223
+ }]), nt = /* @__PURE__ */ g.makeMessageType("livekit.SessionDescription", () => [{
4224
4224
  no: 1,
4225
4225
  name: "type",
4226
4226
  kind: "scalar",
@@ -4252,7 +4252,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4252
4252
  no: 1,
4253
4253
  name: "participants",
4254
4254
  kind: "message",
4255
- T: dt,
4255
+ T: ct,
4256
4256
  repeated: !0
4257
4257
  }]), _i = /* @__PURE__ */ g.makeMessageType("livekit.UpdateSubscription", () => [{
4258
4258
  no: 1,
@@ -4358,13 +4358,13 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4358
4358
  no: 3,
4359
4359
  name: "action",
4360
4360
  kind: "enum",
4361
- T: g.getEnumType(kt)
4361
+ T: g.getEnumType(bt)
4362
4362
  }, {
4363
4363
  no: 4,
4364
4364
  name: "regions",
4365
4365
  kind: "message",
4366
4366
  T: vc
4367
- }]), kt = /* @__PURE__ */ g.makeEnum("livekit.LeaveRequest.Action", [{
4367
+ }]), bt = /* @__PURE__ */ g.makeEnum("livekit.LeaveRequest.Action", [{
4368
4368
  no: 0,
4369
4369
  name: "DISCONNECT"
4370
4370
  }, {
@@ -4383,7 +4383,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4383
4383
  no: 2,
4384
4384
  name: "layers",
4385
4385
  kind: "message",
4386
- T: et,
4386
+ T: Ze,
4387
4387
  repeated: !0
4388
4388
  }]), An = /* @__PURE__ */ g.makeMessageType("livekit.UpdateParticipantMetadata", () => [{
4389
4389
  no: 1,
@@ -4452,7 +4452,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4452
4452
  no: 2,
4453
4453
  name: "quality",
4454
4454
  kind: "enum",
4455
- T: g.getEnumType(jt)
4455
+ T: g.getEnumType(Ut)
4456
4456
  }, {
4457
4457
  no: 3,
4458
4458
  name: "score",
@@ -4610,18 +4610,18 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4610
4610
  no: 3,
4611
4611
  name: "participant",
4612
4612
  kind: "message",
4613
- T: dt
4613
+ T: ct
4614
4614
  }, {
4615
4615
  no: 4,
4616
4616
  name: "other_participants",
4617
4617
  kind: "message",
4618
- T: dt,
4618
+ T: ct,
4619
4619
  repeated: !0
4620
4620
  }]), Ln = /* @__PURE__ */ g.makeMessageType("livekit.SyncState", () => [{
4621
4621
  no: 1,
4622
4622
  name: "answer",
4623
4623
  kind: "message",
4624
- T: st
4624
+ T: nt
4625
4625
  }, {
4626
4626
  no: 2,
4627
4627
  name: "subscription",
@@ -4643,7 +4643,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4643
4643
  no: 5,
4644
4644
  name: "offer",
4645
4645
  kind: "message",
4646
- T: st
4646
+ T: nt
4647
4647
  }, {
4648
4648
  no: 6,
4649
4649
  name: "track_sids_disabled",
@@ -4685,7 +4685,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4685
4685
  name: "target",
4686
4686
  kind: "enum",
4687
4687
  T: g.getEnumType(_e)
4688
- }]), Ae = /* @__PURE__ */ g.makeMessageType("livekit.SimulateScenario", () => [{
4688
+ }]), Me = /* @__PURE__ */ g.makeMessageType("livekit.SimulateScenario", () => [{
4689
4689
  no: 1,
4690
4690
  name: "speaker_update",
4691
4691
  kind: "scalar",
@@ -4825,7 +4825,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4825
4825
  no: 5,
4826
4826
  name: "add_track",
4827
4827
  kind: "message",
4828
- T: Jt,
4828
+ T: Kt,
4829
4829
  oneof: "request"
4830
4830
  }, {
4831
4831
  no: 6,
@@ -4932,13 +4932,13 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4932
4932
  no: 5,
4933
4933
  name: "add_track_requests",
4934
4934
  kind: "message",
4935
- T: Jt,
4935
+ T: Kt,
4936
4936
  repeated: !0
4937
4937
  }, {
4938
4938
  no: 6,
4939
4939
  name: "publisher_offer",
4940
4940
  kind: "message",
4941
- T: st
4941
+ T: nt
4942
4942
  }, {
4943
4943
  no: 7,
4944
4944
  name: "reconnect",
@@ -4949,7 +4949,7 @@ const Bo = /* @__PURE__ */ g.makeMessageType("livekit.MetricsBatch", () => [{
4949
4949
  no: 8,
4950
4950
  name: "reconnect_reason",
4951
4951
  kind: "enum",
4952
- T: g.getEnumType(ot)
4952
+ T: g.getEnumType(at)
4953
4953
  }, {
4954
4954
  no: 9,
4955
4955
  name: "participant_sid",
@@ -5140,11 +5140,11 @@ var Oe;
5140
5140
  let F = Ii.getLogger("livekit");
5141
5141
  Object.values(Oe).map((n) => Ii.getLogger(n));
5142
5142
  F.setDefaultLevel(sn.info);
5143
- function He(n) {
5143
+ function Je(n) {
5144
5144
  const e = Ii.getLogger(n);
5145
5145
  return e.setDefaultLevel(F.getLevel()), e;
5146
5146
  }
5147
- const Ic = Ii.getLogger("lk-e2ee"), At = 7e3, Oc = [0, 300, 4 * 300, 9 * 300, 16 * 300, At, At, At, At, At];
5147
+ const Ic = Ii.getLogger("lk-e2ee"), Mt = 7e3, Oc = [0, 300, 4 * 300, 9 * 300, 16 * 300, Mt, Mt, Mt, Mt, Mt];
5148
5148
  class Dc {
5149
5149
  constructor(e) {
5150
5150
  this._retryDelays = e !== void 0 ? [...e] : Oc;
@@ -5200,7 +5200,7 @@ function ps(n) {
5200
5200
  };
5201
5201
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
5202
5202
  }
5203
- function Ge(n) {
5203
+ function Ke(n) {
5204
5204
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5205
5205
  var e = n[Symbol.asyncIterator], t;
5206
5206
  return e ? e.call(n) : (n = typeof ps == "function" ? ps(n) : n[Symbol.iterator](), t = {}, i("next"), i("throw"), i("return"), t[Symbol.asyncIterator] = function() {
@@ -5426,13 +5426,13 @@ function xc() {
5426
5426
  }
5427
5427
  return $t.exports;
5428
5428
  }
5429
- var je = xc();
5429
+ var Ue = xc();
5430
5430
  let zr = !0, Qr = !0;
5431
- function Bt(n, e, t) {
5431
+ function Ft(n, e, t) {
5432
5432
  const i = n.match(e);
5433
5433
  return i && i.length >= t && parseFloat(i[t], 10);
5434
5434
  }
5435
- function ht(n, e, t) {
5435
+ function ut(n, e, t) {
5436
5436
  if (!n.RTCPeerConnection)
5437
5437
  return;
5438
5438
  const i = n.RTCPeerConnection.prototype, s = i.addEventListener;
@@ -5499,11 +5499,11 @@ function Lc(n) {
5499
5499
  };
5500
5500
  }
5501
5501
  if (t.mozGetUserMedia)
5502
- e.browser = "firefox", e.version = parseInt(Bt(t.userAgent, /Firefox\/(\d+)\./, 1));
5502
+ e.browser = "firefox", e.version = parseInt(Ft(t.userAgent, /Firefox\/(\d+)\./, 1));
5503
5503
  else if (t.webkitGetUserMedia || n.isSecureContext === !1 && n.webkitRTCPeerConnection)
5504
- e.browser = "chrome", e.version = parseInt(Bt(t.userAgent, /Chrom(e|ium)\/(\d+)\./, 2));
5504
+ e.browser = "chrome", e.version = parseInt(Ft(t.userAgent, /Chrom(e|ium)\/(\d+)\./, 2));
5505
5505
  else if (n.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./))
5506
- e.browser = "safari", e.version = parseInt(Bt(t.userAgent, /AppleWebKit\/(\d+)\./, 1)), e.supportsUnifiedPlan = n.RTCRtpTransceiver && "currentDirection" in n.RTCRtpTransceiver.prototype, e._safariVersion = Bt(t.userAgent, /Version\/(\d+(\.?\d+))/, 1);
5506
+ e.browser = "safari", e.version = parseInt(Ft(t.userAgent, /AppleWebKit\/(\d+)\./, 1)), e.supportsUnifiedPlan = n.RTCRtpTransceiver && "currentDirection" in n.RTCRtpTransceiver.prototype, e._safariVersion = Ft(t.userAgent, /Version\/(\d+(\.?\d+))/, 1);
5507
5507
  else
5508
5508
  return e.browser = "Not a supported browser.", e;
5509
5509
  return e;
@@ -5680,7 +5680,7 @@ function ea(n) {
5680
5680
  }, this.addEventListener("addstream", this._ontrackpoly)), e.apply(this, arguments);
5681
5681
  };
5682
5682
  } else
5683
- ht(n, "track", (e) => (e.transceiver || Object.defineProperty(e, "transceiver", {
5683
+ ut(n, "track", (e) => (e.transceiver || Object.defineProperty(e, "transceiver", {
5684
5684
  value: {
5685
5685
  receiver: e.receiver
5686
5686
  }
@@ -5767,7 +5767,7 @@ function ia(n) {
5767
5767
  t && (n.RTCPeerConnection.prototype.getReceivers = function() {
5768
5768
  const s = t.apply(this, []);
5769
5769
  return s.forEach((r) => r._pc = this), s;
5770
- }), ht(n, "track", (i) => (i.receiver._pc = i.srcElement, i)), n.RTCRtpReceiver.prototype.getStats = function() {
5770
+ }), ut(n, "track", (i) => (i.receiver._pc = i.srcElement, i)), n.RTCRtpReceiver.prototype.getStats = function() {
5771
5771
  const s = this;
5772
5772
  return this._pc.getStats().then((r) => bs(r, s.track, !1));
5773
5773
  };
@@ -5934,7 +5934,7 @@ function an(n, e) {
5934
5934
  });
5935
5935
  }
5936
5936
  function ra(n, e) {
5937
- ht(n, "negotiationneeded", (t) => {
5937
+ ut(n, "negotiationneeded", (t) => {
5938
5938
  const i = t.target;
5939
5939
  if (!((e.version < 72 || i.getConfiguration && i.getConfiguration().sdpSemantics === "plan-b") && i.signalingState !== "stable"))
5940
5940
  return t;
@@ -6048,7 +6048,7 @@ function da(n) {
6048
6048
  e && (n.RTCPeerConnection.prototype.getReceivers = function() {
6049
6049
  const i = e.apply(this, []);
6050
6050
  return i.forEach((s) => s._pc = this), i;
6051
- }), ht(n, "track", (t) => (t.receiver._pc = t.srcElement, t)), n.RTCRtpReceiver.prototype.getStats = function() {
6051
+ }), ut(n, "track", (t) => (t.receiver._pc = t.srcElement, t)), n.RTCRtpReceiver.prototype.getStats = function() {
6052
6052
  return this._pc.getStats(this.track);
6053
6053
  };
6054
6054
  }
@@ -6647,14 +6647,14 @@ t=0 0\r
6647
6647
  }, n.exports = e;
6648
6648
  })(Ui)), Ui.exports;
6649
6649
  }
6650
- var Pa = Fc(), Tt = /* @__PURE__ */ Rc(Pa), jc = /* @__PURE__ */ Ha({ __proto__: null, default: Tt }, [Pa]);
6650
+ var Pa = Fc(), yt = /* @__PURE__ */ Rc(Pa), jc = /* @__PURE__ */ Ha({ __proto__: null, default: yt }, [Pa]);
6651
6651
  function ri(n) {
6652
6652
  if (!n.RTCIceCandidate || n.RTCIceCandidate && "foundation" in n.RTCIceCandidate.prototype)
6653
6653
  return;
6654
6654
  const e = n.RTCIceCandidate;
6655
6655
  n.RTCIceCandidate = function(i) {
6656
6656
  if (typeof i == "object" && i.candidate && i.candidate.indexOf("a=") === 0 && (i = JSON.parse(JSON.stringify(i)), i.candidate = i.candidate.substring(2)), i.candidate && i.candidate.length) {
6657
- const s = new e(i), r = Tt.parseCandidate(i.candidate);
6657
+ const s = new e(i), r = yt.parseCandidate(i.candidate);
6658
6658
  for (const o in r)
6659
6659
  o in s || Object.defineProperty(s, o, {
6660
6660
  value: r[o]
@@ -6669,15 +6669,15 @@ function ri(n) {
6669
6669
  }, s;
6670
6670
  }
6671
6671
  return new e(i);
6672
- }, n.RTCIceCandidate.prototype = e.prototype, ht(n, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
6672
+ }, n.RTCIceCandidate.prototype = e.prototype, ut(n, "icecandidate", (t) => (t.candidate && Object.defineProperty(t, "candidate", {
6673
6673
  value: new n.RTCIceCandidate(t.candidate),
6674
6674
  writable: "false"
6675
6675
  }), t));
6676
6676
  }
6677
6677
  function cn(n) {
6678
- !n.RTCIceCandidate || n.RTCIceCandidate && "relayProtocol" in n.RTCIceCandidate.prototype || ht(n, "icecandidate", (e) => {
6678
+ !n.RTCIceCandidate || n.RTCIceCandidate && "relayProtocol" in n.RTCIceCandidate.prototype || ut(n, "icecandidate", (e) => {
6679
6679
  if (e.candidate) {
6680
- const t = Tt.parseCandidate(e.candidate.candidate);
6680
+ const t = yt.parseCandidate(e.candidate.candidate);
6681
6681
  t.type === "relay" && (e.candidate.relayProtocol = {
6682
6682
  0: "tls",
6683
6683
  1: "tcp",
@@ -6698,9 +6698,9 @@ function ai(n, e) {
6698
6698
  const t = function(a) {
6699
6699
  if (!a || !a.sdp)
6700
6700
  return !1;
6701
- const c = Tt.splitSections(a.sdp);
6701
+ const c = yt.splitSections(a.sdp);
6702
6702
  return c.shift(), c.some((d) => {
6703
- const l = Tt.parseMLine(d);
6703
+ const l = yt.parseMLine(d);
6704
6704
  return l && l.kind === "application" && l.protocol.indexOf("SCTP") !== -1;
6705
6705
  });
6706
6706
  }, i = function(a) {
@@ -6715,7 +6715,7 @@ function ai(n, e) {
6715
6715
  }, r = function(a, c) {
6716
6716
  let d = 65536;
6717
6717
  e.browser === "firefox" && e.version === 57 && (d = 65535);
6718
- const l = Tt.matchPrefix(a.sdp, "a=max-message-size:");
6718
+ const l = yt.matchPrefix(a.sdp, "a=max-message-size:");
6719
6719
  return l.length > 0 ? d = parseInt(l[0].substring(19), 10) : e.browser === "firefox" && c !== -1 && (d = 2147483637), d;
6720
6720
  }, o = n.RTCPeerConnection.prototype.setRemoteDescription;
6721
6721
  n.RTCPeerConnection.prototype.setRemoteDescription = function() {
@@ -6761,7 +6761,7 @@ function oi(n) {
6761
6761
  n.RTCPeerConnection.prototype.createDataChannel = function() {
6762
6762
  const s = t.apply(this, arguments);
6763
6763
  return e(s, this), s;
6764
- }, ht(n, "datachannel", (i) => (e(i.channel, i.target), i));
6764
+ }, ut(n, "datachannel", (i) => (e(i.channel, i.target), i));
6765
6765
  }
6766
6766
  function dn(n) {
6767
6767
  if (!n.RTCPeerConnection || "connectionState" in n.RTCPeerConnection.prototype)
@@ -6863,7 +6863,7 @@ function Vc() {
6863
6863
  const t = Yr, i = Lc(n), s = {
6864
6864
  browserDetails: i,
6865
6865
  commonShim: Bc,
6866
- extractVersion: Bt,
6866
+ extractVersion: Ft,
6867
6867
  disableLog: Ac,
6868
6868
  disableWarnings: Nc,
6869
6869
  // Expose sdp as a convenience. For production apps include directly.
@@ -6978,7 +6978,7 @@ function ji(n) {
6978
6978
  }
6979
6979
  var Kc = "2.17.0";
6980
6980
  const Gc = Kc, Jc = 16;
6981
- class Be extends Error {
6981
+ class Fe extends Error {
6982
6982
  constructor(e, t) {
6983
6983
  super(t || "an error has occured"), this.name = "LiveKitError", this.code = e;
6984
6984
  }
@@ -6987,7 +6987,7 @@ var H;
6987
6987
  (function(n) {
6988
6988
  n[n.NotAllowed = 0] = "NotAllowed", n[n.ServerUnreachable = 1] = "ServerUnreachable", n[n.InternalError = 2] = "InternalError", n[n.Cancelled = 3] = "Cancelled", n[n.LeaveRequest = 4] = "LeaveRequest", n[n.Timeout = 5] = "Timeout", n[n.WebSocket = 6] = "WebSocket", n[n.ServiceNotFound = 7] = "ServiceNotFound";
6989
6989
  })(H || (H = {}));
6990
- class L extends Be {
6990
+ class L extends Fe {
6991
6991
  constructor(e, t, i, s) {
6992
6992
  super(1, e), this.name = "ConnectionError", this.status = i, this.reason = t, this.context = s, this.reasonName = H[t];
6993
6993
  }
@@ -7016,51 +7016,51 @@ class L extends Be {
7016
7016
  return new L(e, H.ServiceNotFound, void 0, t);
7017
7017
  }
7018
7018
  }
7019
- class jn extends Be {
7019
+ class jn extends Fe {
7020
7020
  constructor(e) {
7021
7021
  super(21, e ?? "device is unsupported"), this.name = "DeviceUnsupportedError";
7022
7022
  }
7023
7023
  }
7024
- class Je extends Be {
7024
+ class Ge extends Fe {
7025
7025
  constructor(e) {
7026
7026
  super(20, e ?? "track is invalid"), this.name = "TrackInvalidError";
7027
7027
  }
7028
7028
  }
7029
- class Hc extends Be {
7029
+ class Hc extends Fe {
7030
7030
  constructor(e) {
7031
7031
  super(10, e ?? "unsupported server"), this.name = "UnsupportedServer";
7032
7032
  }
7033
7033
  }
7034
- class ee extends Be {
7034
+ class Z extends Fe {
7035
7035
  constructor(e) {
7036
7036
  super(12, e ?? "unexpected connection state"), this.name = "UnexpectedConnectionState";
7037
7037
  }
7038
7038
  }
7039
- class St extends Be {
7039
+ class kt extends Fe {
7040
7040
  constructor(e) {
7041
7041
  super(13, e ?? "unable to negotiate"), this.name = "NegotiationError";
7042
7042
  }
7043
7043
  }
7044
- class Es extends Be {
7044
+ class Es extends Fe {
7045
7045
  constructor(e, t) {
7046
7046
  super(15, e), this.name = "PublishTrackError", this.status = t;
7047
7047
  }
7048
7048
  }
7049
- class Ps extends Be {
7049
+ class Ps extends Fe {
7050
7050
  constructor(e, t) {
7051
7051
  super(15, e), this.name = "SignalRequestError", this.reason = t, this.reasonName = typeof t == "string" ? t : Un[t];
7052
7052
  }
7053
7053
  }
7054
- var le;
7054
+ var de;
7055
7055
  (function(n) {
7056
7056
  n[n.AlreadyOpened = 0] = "AlreadyOpened", n[n.AbnormalEnd = 1] = "AbnormalEnd", n[n.DecodeFailed = 2] = "DecodeFailed", n[n.LengthExceeded = 3] = "LengthExceeded", n[n.Incomplete = 4] = "Incomplete", n[n.HandlerAlreadyRegistered = 7] = "HandlerAlreadyRegistered", n[n.EncryptionTypeMismatch = 8] = "EncryptionTypeMismatch";
7057
- })(le || (le = {}));
7058
- class Te extends Be {
7057
+ })(de || (de = {}));
7058
+ class Te extends Fe {
7059
7059
  constructor(e, t) {
7060
- super(16, e), this.name = "DataStreamError", this.reason = t, this.reasonName = le[t];
7060
+ super(16, e), this.name = "DataStreamError", this.reason = t, this.reasonName = de[t];
7061
7061
  }
7062
7062
  }
7063
- class pt extends Be {
7063
+ class ft extends Fe {
7064
7064
  constructor(e) {
7065
7065
  super(18, e), this.name = "SignalReconnectError";
7066
7066
  }
@@ -7161,7 +7161,7 @@ var un;
7161
7161
  maxBitrate: 128e3
7162
7162
  };
7163
7163
  })(un || (un = {}));
7164
- const Ht = {
7164
+ const Gt = {
7165
7165
  h90: new G(160, 90, 9e4, 20),
7166
7166
  h180: new G(320, 180, 16e4, 20),
7167
7167
  h216: new G(384, 216, 18e4, 20),
@@ -7292,7 +7292,7 @@ function mn(n) {
7292
7292
  function ed(n) {
7293
7293
  var e, t;
7294
7294
  let i = (e = n.video) !== null && e !== void 0 ? e : !0;
7295
- return n.resolution && n.resolution.width > 0 && n.resolution.height > 0 && (i = typeof i == "boolean" ? {} : i, ut() ? i = Object.assign(Object.assign({}, i), {
7295
+ return n.resolution && n.resolution.width > 0 && n.resolution.height > 0 && (i = typeof i == "boolean" ? {} : i, lt() ? i = Object.assign(Object.assign({}, i), {
7296
7296
  width: {
7297
7297
  max: n.resolution.width
7298
7298
  },
@@ -7319,7 +7319,7 @@ function ed(n) {
7319
7319
  preferCurrentTab: n.preferCurrentTab
7320
7320
  };
7321
7321
  }
7322
- function Wt(n) {
7322
+ function Vt(n) {
7323
7323
  return n.split("/")[1].toLowerCase();
7324
7324
  }
7325
7325
  function td(n) {
@@ -7398,12 +7398,12 @@ function rd(n, e) {
7398
7398
  var t;
7399
7399
  return (t = n.layers) === null || t === void 0 ? void 0 : t.find((i) => i.quality === e);
7400
7400
  }
7401
- const ad = 5e3, Nt = [];
7401
+ const ad = 5e3, xt = [];
7402
7402
  var ye;
7403
7403
  (function(n) {
7404
7404
  n[n.LOW = 0] = "LOW", n[n.MEDIUM = 1] = "MEDIUM", n[n.HIGH = 2] = "HIGH";
7405
7405
  })(ye || (ye = {}));
7406
- class T extends je.EventEmitter {
7406
+ class T extends Ue.EventEmitter {
7407
7407
  /**
7408
7408
  * indicates current state of stream, it'll indicate `paused` if the track
7409
7409
  * has been paused by congestion controller
@@ -7420,7 +7420,7 @@ class T extends je.EventEmitter {
7420
7420
  var s;
7421
7421
  super(), this.attachedElements = [], this.isMuted = !1, this._streamState = T.StreamState.Active, this.isInBackground = !1, this._currentBitrate = 0, this.log = F, this.appVisibilityChangedListener = () => {
7422
7422
  this.backgroundTimeout && clearTimeout(this.backgroundTimeout), document.visibilityState === "hidden" ? this.backgroundTimeout = setTimeout(() => this.handleAppVisibilityChanged(), ad) : this.handleAppVisibilityChanged();
7423
- }, this.log = He((s = i.loggerName) !== null && s !== void 0 ? s : Oe.Track), this.loggerContextCb = i.loggerContextCb, this.setMaxListeners(100), this.kind = t, this._mediaStreamTrack = e, this._mediaStreamID = e.id, this.source = T.Source.Unknown;
7423
+ }, this.log = Je((s = i.loggerName) !== null && s !== void 0 ? s : Oe.Track), this.loggerContextCb = i.loggerContextCb, this.setMaxListeners(100), this.kind = t, this._mediaStreamTrack = e, this._mediaStreamID = e.id, this.source = T.Source.Unknown;
7424
7424
  }
7425
7425
  get logContext() {
7426
7426
  var e;
@@ -7443,9 +7443,9 @@ class T extends je.EventEmitter {
7443
7443
  }
7444
7444
  attach(e) {
7445
7445
  let t = "audio";
7446
- this.kind === T.Kind.Video && (t = "video"), this.attachedElements.length === 0 && this.kind === T.Kind.Video && this.addAppVisibilityListener(), e || (t === "audio" && (Nt.forEach((r) => {
7446
+ this.kind === T.Kind.Video && (t = "video"), this.attachedElements.length === 0 && this.kind === T.Kind.Video && this.addAppVisibilityListener(), e || (t === "audio" && (xt.forEach((r) => {
7447
7447
  r.parentElement === null && !e && (e = r);
7448
- }), e && Nt.splice(Nt.indexOf(e), 1)), e || (e = document.createElement(t))), this.attachedElements.includes(e) || this.attachedElements.push(e), vt(this.mediaStreamTrack, e);
7448
+ }), e && xt.splice(xt.indexOf(e), 1)), e || (e = document.createElement(t))), this.attachedElements.includes(e) || this.attachedElements.push(e), pt(this.mediaStreamTrack, e);
7449
7449
  const i = e.srcObject.getTracks(), s = i.some((r) => r.kind === "audio");
7450
7450
  return e.play().then(() => {
7451
7451
  this.emit(s ? R.AudioPlaybackStarted : R.VideoPlaybackStarted);
@@ -7457,13 +7457,13 @@ class T extends je.EventEmitter {
7457
7457
  detach(e) {
7458
7458
  try {
7459
7459
  if (e) {
7460
- Ct(this.mediaStreamTrack, e);
7460
+ Tt(this.mediaStreamTrack, e);
7461
7461
  const i = this.attachedElements.indexOf(e);
7462
7462
  return i >= 0 && (this.attachedElements.splice(i, 1), this.recycleElement(e), this.emit(R.ElementDetached, e)), e;
7463
7463
  }
7464
7464
  const t = [];
7465
7465
  return this.attachedElements.forEach((i) => {
7466
- Ct(this.mediaStreamTrack, i), t.push(i), this.recycleElement(i), this.emit(R.ElementDetached, i);
7466
+ Tt(this.mediaStreamTrack, i), t.push(i), this.recycleElement(i), this.emit(R.ElementDetached, i);
7467
7467
  }), this.attachedElements = [], t;
7468
7468
  } finally {
7469
7469
  this.attachedElements.length === 0 && this.removeAppVisibilityListener();
@@ -7484,14 +7484,14 @@ class T extends je.EventEmitter {
7484
7484
  }
7485
7485
  /** @internal */
7486
7486
  updateLoggerOptions(e) {
7487
- e.loggerName && (this.log = He(e.loggerName)), e.loggerContextCb && (this.loggerContextCb = e.loggerContextCb);
7487
+ e.loggerName && (this.log = Je(e.loggerName)), e.loggerContextCb && (this.loggerContextCb = e.loggerContextCb);
7488
7488
  }
7489
7489
  recycleElement(e) {
7490
7490
  if (e instanceof HTMLAudioElement) {
7491
7491
  let t = !0;
7492
- e.pause(), Nt.forEach((i) => {
7492
+ e.pause(), xt.forEach((i) => {
7493
7493
  i.parentElement || (t = !1);
7494
- }), t && Nt.push(e);
7494
+ }), t && xt.push(e);
7495
7495
  }
7496
7496
  }
7497
7497
  handleAppVisibilityChanged() {
@@ -7507,18 +7507,18 @@ class T extends je.EventEmitter {
7507
7507
  ge() && document.removeEventListener("visibilitychange", this.appVisibilityChangedListener);
7508
7508
  }
7509
7509
  }
7510
- function vt(n, e) {
7510
+ function pt(n, e) {
7511
7511
  let t;
7512
7512
  e.srcObject instanceof MediaStream ? t = e.srcObject : t = new MediaStream();
7513
7513
  let i;
7514
7514
  n.kind === "audio" ? i = t.getAudioTracks() : i = t.getVideoTracks(), i.includes(n) || (i.forEach((s) => {
7515
7515
  t.removeTrack(s);
7516
- }), t.addTrack(n)), (!ut() || !(e instanceof HTMLVideoElement)) && (e.autoplay = !0), e.muted = t.getAudioTracks().length === 0, e instanceof HTMLVideoElement && (e.playsInline = !0), e.srcObject !== t && (e.srcObject = t, (ut() || lt()) && e instanceof HTMLVideoElement && setTimeout(() => {
7516
+ }), t.addTrack(n)), (!lt() || !(e instanceof HTMLVideoElement)) && (e.autoplay = !0), e.muted = t.getAudioTracks().length === 0, e instanceof HTMLVideoElement && (e.playsInline = !0), e.srcObject !== t && (e.srcObject = t, (lt() || dt()) && e instanceof HTMLVideoElement && setTimeout(() => {
7517
7517
  e.srcObject = t, e.play().catch(() => {
7518
7518
  });
7519
7519
  }, 0));
7520
7520
  }
7521
- function Ct(n, e) {
7521
+ function Tt(n, e) {
7522
7522
  if (e.srcObject instanceof MediaStream) {
7523
7523
  const t = e.srcObject;
7524
7524
  t.removeTrack(n), t.getTracks().length > 0 ? e.srcObject = t : e.srcObject = null;
@@ -7616,7 +7616,7 @@ function gn() {
7616
7616
  return "addTrack" in RTCPeerConnection.prototype;
7617
7617
  }
7618
7618
  function dd() {
7619
- if (!("getCapabilities" in RTCRtpSender) || ut() || lt())
7619
+ if (!("getCapabilities" in RTCRtpSender) || lt() || dt())
7620
7620
  return !1;
7621
7621
  const n = RTCRtpSender.getCapabilities("video");
7622
7622
  let e = !1;
@@ -7630,11 +7630,11 @@ function dd() {
7630
7630
  return e;
7631
7631
  }
7632
7632
  function ld() {
7633
- if (!("getCapabilities" in RTCRtpSender) || lt())
7633
+ if (!("getCapabilities" in RTCRtpSender) || dt())
7634
7634
  return !1;
7635
- if (ut()) {
7635
+ if (lt()) {
7636
7636
  const t = ve();
7637
- if (t?.version && Fe(t.version, "16") < 0 || t?.os === "iOS" && t?.osVersion && Fe(t.osVersion, "16") < 0)
7637
+ if (t?.version && Le(t.version, "16") < 0 || t?.os === "iOS" && t?.osVersion && Le(t.osVersion, "16") < 0)
7638
7638
  return !1;
7639
7639
  }
7640
7640
  const n = RTCRtpSender.getCapabilities("video");
@@ -7652,12 +7652,12 @@ function we(n) {
7652
7652
  return n === "av1" || n === "vp9";
7653
7653
  }
7654
7654
  function vn(n) {
7655
- return !document || zt() ? !1 : (n || (n = document.createElement("audio")), "setSinkId" in n);
7655
+ return !document || Jt() ? !1 : (n || (n = document.createElement("audio")), "setSinkId" in n);
7656
7656
  }
7657
7657
  function ud() {
7658
7658
  return typeof RTCPeerConnection > "u" ? !1 : pn() || gn();
7659
7659
  }
7660
- function lt() {
7660
+ function dt() {
7661
7661
  var n;
7662
7662
  return ((n = ve()) === null || n === void 0 ? void 0 : n.name) === "Firefox";
7663
7663
  }
@@ -7665,20 +7665,20 @@ function Is() {
7665
7665
  const n = ve();
7666
7666
  return !!n && n.name === "Chrome" && n.os !== "iOS";
7667
7667
  }
7668
- function ut() {
7668
+ function lt() {
7669
7669
  var n;
7670
7670
  return ((n = ve()) === null || n === void 0 ? void 0 : n.name) === "Safari";
7671
7671
  }
7672
- function zt() {
7672
+ function Jt() {
7673
7673
  const n = ve();
7674
7674
  return n?.name === "Safari" || n?.os === "iOS";
7675
7675
  }
7676
7676
  function hd() {
7677
7677
  const n = ve();
7678
- return n?.name === "Safari" && n.version.startsWith("17.") || n?.os === "iOS" && !!n?.osVersion && Fe(n.osVersion, "17") >= 0;
7678
+ return n?.name === "Safari" && n.version.startsWith("17.") || n?.os === "iOS" && !!n?.osVersion && Le(n.osVersion, "17") >= 0;
7679
7679
  }
7680
7680
  function fd(n) {
7681
- return n || (n = ve()), n?.name === "Safari" && Fe(n.version, "18.3") > 0 || n?.os === "iOS" && !!n?.osVersion && Fe(n.osVersion, "18.3") > 0;
7681
+ return n || (n = ve()), n?.name === "Safari" && Le(n.version, "18.3") > 0 || n?.os === "iOS" && !!n?.osVersion && Le(n.osVersion, "18.3") > 0;
7682
7682
  }
7683
7683
  function Oa() {
7684
7684
  var n, e;
@@ -7690,26 +7690,26 @@ function Oa() {
7690
7690
  function md() {
7691
7691
  const n = ve(), e = "17.2";
7692
7692
  if (n)
7693
- return n.name !== "Safari" && n.os !== "iOS" || n.os === "iOS" && n.osVersion && Fe(n.osVersion, e) >= 0 ? !0 : n.name === "Safari" && Fe(n.version, e) >= 0;
7693
+ return n.name !== "Safari" && n.os !== "iOS" || n.os === "iOS" && n.osVersion && Le(n.osVersion, e) >= 0 ? !0 : n.name === "Safari" && Le(n.version, e) >= 0;
7694
7694
  }
7695
7695
  function ge() {
7696
7696
  return typeof document < "u";
7697
7697
  }
7698
- function Ue() {
7698
+ function Ne() {
7699
7699
  return navigator.product == "ReactNative";
7700
7700
  }
7701
- function It(n) {
7701
+ function _t(n) {
7702
7702
  return n.hostname.endsWith(".livekit.cloud") || n.hostname.endsWith(".livekit.run");
7703
7703
  }
7704
7704
  function Bi(n) {
7705
- return It(n) ? n.hostname.split(".")[0] : null;
7705
+ return _t(n) ? n.hostname.split(".")[0] : null;
7706
7706
  }
7707
7707
  function Da() {
7708
7708
  if (global && global.LiveKitReactNativeGlobal)
7709
7709
  return global.LiveKitReactNativeGlobal;
7710
7710
  }
7711
7711
  function Ma() {
7712
- if (!Ue())
7712
+ if (!Ne())
7713
7713
  return;
7714
7714
  let n = Da();
7715
7715
  if (n)
@@ -7718,14 +7718,14 @@ function Ma() {
7718
7718
  function Os() {
7719
7719
  if (ge())
7720
7720
  return window.devicePixelRatio;
7721
- if (Ue()) {
7721
+ if (Ne()) {
7722
7722
  let n = Da();
7723
7723
  if (n)
7724
7724
  return n.devicePixelRatio;
7725
7725
  }
7726
7726
  return 1;
7727
7727
  }
7728
- function Fe(n, e) {
7728
+ function Le(n, e) {
7729
7729
  const t = n.split("."), i = e.split("."), s = Math.min(t.length, i.length);
7730
7730
  for (let r = 0; r < s; ++r) {
7731
7731
  const o = parseInt(t[r], 10), a = parseInt(i[r], 10);
@@ -7757,7 +7757,7 @@ function vd() {
7757
7757
  protocol: Jc,
7758
7758
  version: Gc
7759
7759
  });
7760
- return Ue() && (e.os = (n = Ma()) !== null && n !== void 0 ? n : ""), e;
7760
+ return Ne() && (e.os = (n = Ma()) !== null && n !== void 0 ? n : ""), e;
7761
7761
  }
7762
7762
  function xs() {
7763
7763
  let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 16, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 16, t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
@@ -7770,17 +7770,17 @@ function xs() {
7770
7770
  throw Error("Could not get empty media stream video track");
7771
7771
  return a.enabled = t, a;
7772
7772
  }
7773
- let Lt;
7773
+ let At;
7774
7774
  function Wi() {
7775
- if (!Lt) {
7775
+ if (!At) {
7776
7776
  const n = new AudioContext(), e = n.createOscillator(), t = n.createGain();
7777
7777
  t.gain.setValueAtTime(0, 0);
7778
7778
  const i = n.createMediaStreamDestination();
7779
- if (e.connect(t), t.connect(i), e.start(), [Lt] = i.stream.getAudioTracks(), !Lt)
7779
+ if (e.connect(t), t.connect(i), e.start(), [At] = i.stream.getAudioTracks(), !At)
7780
7780
  throw Error("Could not get empty media stream audio track");
7781
- Lt.enabled = !1;
7781
+ At.enabled = !1;
7782
7782
  }
7783
- return Lt.clone();
7783
+ return At.clone();
7784
7784
  }
7785
7785
  class Se {
7786
7786
  get isResolved() {
@@ -7798,7 +7798,7 @@ class Se {
7798
7798
  function bd(n) {
7799
7799
  return Yc.includes(n);
7800
7800
  }
7801
- function tt(n) {
7801
+ function et(n) {
7802
7802
  if (typeof n == "string" || typeof n == "number")
7803
7803
  return n;
7804
7804
  if (Array.isArray(n))
@@ -7812,7 +7812,7 @@ function tt(n) {
7812
7812
  function yd(n) {
7813
7813
  return n.startsWith("http") ? n.replace(/^(http)/, "ws") : n;
7814
7814
  }
7815
- function Qt(n) {
7815
+ function Ht(n) {
7816
7816
  return n.startsWith("ws") ? n.replace(/^(ws)/, "http") : n;
7817
7817
  }
7818
7818
  function kd(n, e) {
@@ -7870,23 +7870,23 @@ function As(n) {
7870
7870
  function ui(n) {
7871
7871
  return n !== void 0 ? Number(n) : void 0;
7872
7872
  }
7873
- function ct(n) {
7873
+ function ot(n) {
7874
7874
  return n !== void 0 ? BigInt(n) : void 0;
7875
7875
  }
7876
- function Et(n) {
7876
+ function St(n) {
7877
7877
  return !!n && !(n instanceof MediaStreamTrack) && n.isLocal;
7878
7878
  }
7879
- function Le(n) {
7879
+ function Ae(n) {
7880
7880
  return !!n && n.kind == T.Kind.Audio;
7881
7881
  }
7882
- function rt(n) {
7882
+ function st(n) {
7883
7883
  return !!n && n.kind == T.Kind.Video;
7884
7884
  }
7885
- function Ye(n) {
7886
- return Et(n) && rt(n);
7885
+ function Qe(n) {
7886
+ return St(n) && st(n);
7887
7887
  }
7888
- function Ve(n) {
7889
- return Et(n) && Le(n);
7888
+ function Be(n) {
7889
+ return St(n) && Ae(n);
7890
7890
  }
7891
7891
  function bn(n) {
7892
7892
  return !!n && !n.isLocal;
@@ -7895,7 +7895,7 @@ function Sd(n) {
7895
7895
  return !!n && !n.isLocal;
7896
7896
  }
7897
7897
  function Ki(n) {
7898
- return bn(n) && rt(n);
7898
+ return bn(n) && st(n);
7899
7899
  }
7900
7900
  function Cd(n) {
7901
7901
  return n.isLocal;
@@ -7936,7 +7936,7 @@ function _d(n, e) {
7936
7936
  }), qn(t, "rtc");
7937
7937
  }
7938
7938
  function wd(n) {
7939
- const e = new URL(Qt(n));
7939
+ const e = new URL(Ht(n));
7940
7940
  return qn(e, "validate");
7941
7941
  }
7942
7942
  function xa(n) {
@@ -7968,25 +7968,25 @@ function Id(n) {
7968
7968
  return "toString" in t ? t.toString() : e;
7969
7969
  }
7970
7970
  }
7971
- const Od = 10, Ut = "lk_e2ee", Dd = "LKFrameEncryptionKey", Md = {
7971
+ const Od = 10, Nt = "lk_e2ee", Dd = "LKFrameEncryptionKey", Md = {
7972
7972
  sharedKey: !1,
7973
7973
  ratchetSalt: Dd,
7974
7974
  ratchetWindowSize: 8,
7975
7975
  failureTolerance: Od,
7976
7976
  keyringSize: 16
7977
7977
  };
7978
- var it;
7978
+ var tt;
7979
7979
  (function(n) {
7980
7980
  n.SetKey = "setKey", n.RatchetRequest = "ratchetRequest", n.KeyRatcheted = "keyRatcheted";
7981
- })(it || (it = {}));
7981
+ })(tt || (tt = {}));
7982
7982
  var Ls;
7983
7983
  (function(n) {
7984
7984
  n.KeyRatcheted = "keyRatcheted";
7985
7985
  })(Ls || (Ls = {}));
7986
- var Ze;
7986
+ var $e;
7987
7987
  (function(n) {
7988
7988
  n.ParticipantEncryptionStatusChanged = "participantEncryptionStatusChanged", n.EncryptionError = "encryptionError";
7989
- })(Ze || (Ze = {}));
7989
+ })($e || ($e = {}));
7990
7990
  var Us;
7991
7991
  (function(n) {
7992
7992
  n.Error = "cryptorError";
@@ -8008,7 +8008,7 @@ function Nd(n) {
8008
8008
  value: n.value
8009
8009
  });
8010
8010
  }
8011
- class pu extends je.EventEmitter {
8011
+ class pu extends Ue.EventEmitter {
8012
8012
  constructor() {
8013
8013
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8014
8014
  super(), this.onKeyRatcheted = (t, i, s) => {
@@ -8017,7 +8017,7 @@ class pu extends je.EventEmitter {
8017
8017
  participantId: i,
8018
8018
  keyIndex: s
8019
8019
  });
8020
- }, this.keyInfoMap = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, Md), e), this.on(it.KeyRatcheted, this.onKeyRatcheted);
8020
+ }, this.keyInfoMap = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, Md), e), this.on(tt.KeyRatcheted, this.onKeyRatcheted);
8021
8021
  }
8022
8022
  /**
8023
8023
  * callback to invoke once a key has been set for a participant
@@ -8033,7 +8033,7 @@ class pu extends je.EventEmitter {
8033
8033
  };
8034
8034
  if (!this.options.sharedKey && !t)
8035
8035
  throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");
8036
- this.keyInfoMap.set("".concat(t ?? "shared", "-").concat(i ?? 0), s), this.emit(it.SetKey, s);
8036
+ this.keyInfoMap.set("".concat(t ?? "shared", "-").concat(i ?? 0), s), this.emit(tt.SetKey, s);
8037
8037
  }
8038
8038
  getKeys() {
8039
8039
  return Array.from(this.keyInfoMap.values());
@@ -8042,14 +8042,14 @@ class pu extends je.EventEmitter {
8042
8042
  return this.options;
8043
8043
  }
8044
8044
  ratchetKey(e, t) {
8045
- this.emit(it.RatchetRequest, e, t);
8045
+ this.emit(tt.RatchetRequest, e, t);
8046
8046
  }
8047
8047
  }
8048
8048
  var Fs;
8049
8049
  (function(n) {
8050
8050
  n[n.InvalidKey = 0] = "InvalidKey", n[n.MissingKey = 1] = "MissingKey", n[n.InternalError = 2] = "InternalError";
8051
8051
  })(Fs || (Fs = {}));
8052
- class Ld extends je.EventEmitter {
8052
+ class Ld extends Ue.EventEmitter {
8053
8053
  constructor(e, t) {
8054
8054
  super(), this.decryptDataRequests = /* @__PURE__ */ new Map(), this.encryptDataRequests = /* @__PURE__ */ new Map(), this.onWorkerMessage = (i) => {
8055
8055
  var s, r;
@@ -8071,7 +8071,7 @@ class Ld extends je.EventEmitter {
8071
8071
  break;
8072
8072
  }
8073
8073
  }
8074
- this.emit(Ze.EncryptionError, a.error, a.participantIdentity);
8074
+ this.emit($e.EncryptionError, a.error, a.participantIdentity);
8075
8075
  break;
8076
8076
  case "initAck":
8077
8077
  a.enabled && this.keyProvider.getKeys().forEach((l) => {
@@ -8082,16 +8082,16 @@ class Ld extends je.EventEmitter {
8082
8082
  if (a.enabled && this.keyProvider.getKeys().forEach((l) => {
8083
8083
  this.postKey(l);
8084
8084
  }), this.encryptionEnabled !== a.enabled && a.participantIdentity === ((s = this.room) === null || s === void 0 ? void 0 : s.localParticipant.identity))
8085
- this.emit(Ze.ParticipantEncryptionStatusChanged, a.enabled, this.room.localParticipant), this.encryptionEnabled = a.enabled;
8085
+ this.emit($e.ParticipantEncryptionStatusChanged, a.enabled, this.room.localParticipant), this.encryptionEnabled = a.enabled;
8086
8086
  else if (a.participantIdentity) {
8087
8087
  const l = (r = this.room) === null || r === void 0 ? void 0 : r.getParticipantByIdentity(a.participantIdentity);
8088
8088
  if (!l)
8089
8089
  throw TypeError("couldn't set encryption status, participant not found".concat(a.participantIdentity));
8090
- this.emit(Ze.ParticipantEncryptionStatusChanged, a.enabled, l);
8090
+ this.emit($e.ParticipantEncryptionStatusChanged, a.enabled, l);
8091
8091
  }
8092
8092
  break;
8093
8093
  case "ratchetKey":
8094
- this.keyProvider.emit(it.KeyRatcheted, a.ratchetResult, a.participantIdentity, a.keyIndex);
8094
+ this.keyProvider.emit(tt.KeyRatcheted, a.ratchetResult, a.participantIdentity, a.keyIndex);
8095
8095
  break;
8096
8096
  case "decryptDataResponse":
8097
8097
  const c = this.decryptDataRequests.get(a.uuid);
@@ -8105,7 +8105,7 @@ class Ld extends je.EventEmitter {
8105
8105
  }, this.onWorkerError = (i) => {
8106
8106
  F.error("e2ee worker encountered an error:", {
8107
8107
  error: i.error
8108
- }), this.emit(Ze.EncryptionError, i.error, void 0);
8108
+ }), this.emit($e.EncryptionError, i.error, void 0);
8109
8109
  }, this.keyProvider = e.keyProvider, this.worker = e.worker, this.encryptionEnabled = !1, this.dataChannelEncryptionEnabled = t;
8110
8110
  }
8111
8111
  get isEnabled() {
@@ -8179,18 +8179,18 @@ class Ld extends je.EventEmitter {
8179
8179
  }), e.localParticipant.on(I.LocalSenderCreated, (i, s) => f(this, void 0, void 0, function* () {
8180
8180
  this.setupE2EESender(s, i);
8181
8181
  })), e.localParticipant.on(I.LocalTrackPublished, (i) => {
8182
- if (!rt(i.track) || !zt())
8182
+ if (!st(i.track) || !Jt())
8183
8183
  return;
8184
8184
  const s = {
8185
8185
  kind: "updateCodec",
8186
8186
  data: {
8187
8187
  trackId: i.track.mediaStreamID,
8188
- codec: Wt(i.trackInfo.codecs[0].mimeType),
8188
+ codec: Vt(i.trackInfo.codecs[0].mimeType),
8189
8189
  participantIdentity: this.room.localParticipant.identity
8190
8190
  }
8191
8191
  };
8192
8192
  this.worker.postMessage(s);
8193
- }), t.on(it.SetKey, (i) => this.postKey(i)).on(it.RatchetRequest, (i, s) => this.postRatchetRequest(i, s));
8193
+ }), t.on(tt.SetKey, (i) => this.postKey(i)).on(tt.RatchetRequest, (i, s) => this.postRatchetRequest(i, s));
8194
8194
  }
8195
8195
  encryptData(e) {
8196
8196
  return f(this, void 0, void 0, function* () {
@@ -8301,11 +8301,11 @@ class Ld extends je.EventEmitter {
8301
8301
  if (e.receiver) {
8302
8302
  if (!i?.mimeType || i.mimeType === "")
8303
8303
  throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");
8304
- this.handleReceiver(e.receiver, e.mediaStreamID, t, e.kind === "video" ? Wt(i.mimeType) : void 0);
8304
+ this.handleReceiver(e.receiver, e.mediaStreamID, t, e.kind === "video" ? Vt(i.mimeType) : void 0);
8305
8305
  }
8306
8306
  }
8307
8307
  setupE2EESender(e, t) {
8308
- if (!Et(e) || !t) {
8308
+ if (!St(e) || !t) {
8309
8309
  t || F.warn("early return because sender is not ready");
8310
8310
  return;
8311
8311
  }
@@ -8330,7 +8330,7 @@ class Ld extends je.EventEmitter {
8330
8330
  };
8331
8331
  e.transform = new RTCRtpScriptTransform(this.worker, r);
8332
8332
  } else {
8333
- if (Ut in e && s) {
8333
+ if (Nt in e && s) {
8334
8334
  const c = {
8335
8335
  kind: "updateCodec",
8336
8336
  data: {
@@ -8355,12 +8355,12 @@ class Ld extends je.EventEmitter {
8355
8355
  trackId: t,
8356
8356
  codec: s,
8357
8357
  participantIdentity: i,
8358
- isReuse: Ut in e
8358
+ isReuse: Nt in e
8359
8359
  }
8360
8360
  };
8361
8361
  this.worker.postMessage(a, [o, r]);
8362
8362
  }
8363
- e[Ut] = !0;
8363
+ e[Nt] = !0;
8364
8364
  }
8365
8365
  });
8366
8366
  }
@@ -8371,7 +8371,7 @@ class Ld extends je.EventEmitter {
8371
8371
  */
8372
8372
  handleSender(e, t, i) {
8373
8373
  var s;
8374
- if (!(Ut in e || !this.worker)) {
8374
+ if (!(Nt in e || !this.worker)) {
8375
8375
  if (!(!((s = this.room) === null || s === void 0) && s.localParticipant.identity) || this.room.localParticipant.identity === "")
8376
8376
  throw TypeError("local identity needs to be known in order to set up encrypted sender");
8377
8377
  if (yn() && // Chrome occasionally throws an `InvalidState` error when using script transforms directly after introducing this API in 141.
@@ -8400,18 +8400,18 @@ class Ld extends je.EventEmitter {
8400
8400
  };
8401
8401
  this.worker.postMessage(o, [r.readable, r.writable]);
8402
8402
  }
8403
- e[Ut] = !0;
8403
+ e[Nt] = !0;
8404
8404
  }
8405
8405
  }
8406
8406
  }
8407
8407
  const Ud = 500, Fd = 15e3;
8408
- class Pt {
8408
+ class Ct {
8409
8409
  // eslint-disable-next-line @typescript-eslint/no-empty-function
8410
8410
  constructor() {
8411
8411
  this.failedConnectionAttempts = /* @__PURE__ */ new Map(), this.backOffPromises = /* @__PURE__ */ new Map();
8412
8412
  }
8413
8413
  static getInstance() {
8414
- return this._instance || (this._instance = new Pt()), this._instance;
8414
+ return this._instance || (this._instance = new Ct()), this._instance;
8415
8415
  }
8416
8416
  addFailedConnectionAttempt(e) {
8417
8417
  var t;
@@ -8433,7 +8433,7 @@ class Pt {
8433
8433
  this.backOffPromises.clear(), this.failedConnectionAttempts.clear();
8434
8434
  }
8435
8435
  }
8436
- Pt._instance = null;
8436
+ Ct._instance = null;
8437
8437
  const Gi = "default";
8438
8438
  class re {
8439
8439
  constructor() {
@@ -8461,7 +8461,7 @@ class re {
8461
8461
  }
8462
8462
  let o = yield navigator.mediaDevices.enumerateDevices();
8463
8463
  if (s && // for safari we need to skip this check, as otherwise it will re-acquire user media and fail on iOS https://bugs.webkit.org/show_bug.cgi?id=179363
8464
- !(ut() && i.hasDeviceInUse(t)) && (o.filter((c) => c.kind === t).length === 0 || o.some((c) => {
8464
+ !(lt() && i.hasDeviceInUse(t)) && (o.filter((c) => c.kind === t).length === 0 || o.some((c) => {
8465
8465
  const d = c.label === "", l = t ? c.kind === t : !0;
8466
8466
  return d && l;
8467
8467
  }))) {
@@ -8504,27 +8504,27 @@ class re {
8504
8504
  }
8505
8505
  re.mediaDeviceKinds = ["audioinput", "audiooutput", "videoinput"];
8506
8506
  re.userMediaPromiseMap = /* @__PURE__ */ new Map();
8507
- var Kt;
8507
+ var qt;
8508
8508
  (function(n) {
8509
8509
  n[n.WAITING = 0] = "WAITING", n[n.RUNNING = 1] = "RUNNING", n[n.COMPLETED = 2] = "COMPLETED";
8510
- })(Kt || (Kt = {}));
8510
+ })(qt || (qt = {}));
8511
8511
  class jd {
8512
8512
  constructor() {
8513
- this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new he(), this.nextTaskIndex = 0;
8513
+ this.pendingTasks = /* @__PURE__ */ new Map(), this.taskMutex = new ue(), this.nextTaskIndex = 0;
8514
8514
  }
8515
8515
  run(e) {
8516
8516
  return f(this, void 0, void 0, function* () {
8517
8517
  const t = {
8518
8518
  id: this.nextTaskIndex++,
8519
8519
  enqueuedAt: Date.now(),
8520
- status: Kt.WAITING
8520
+ status: qt.WAITING
8521
8521
  };
8522
8522
  this.pendingTasks.set(t.id, t);
8523
8523
  const i = yield this.taskMutex.lock();
8524
8524
  try {
8525
- return t.executedAt = Date.now(), t.status = Kt.RUNNING, yield e();
8525
+ return t.executedAt = Date.now(), t.status = qt.RUNNING, yield e();
8526
8526
  } finally {
8527
- t.status = Kt.COMPLETED, this.pendingTasks.delete(t.id), i();
8527
+ t.status = qt.COMPLETED, this.pendingTasks.delete(t.id), i();
8528
8528
  }
8529
8529
  });
8530
8530
  }
@@ -8642,7 +8642,7 @@ class Wn {
8642
8642
  var i;
8643
8643
  this.rtt = 0, this.state = J.DISCONNECTED, this.log = F, this._requestId = 0, this.useV0SignalPath = !1, this.resetCallbacks = () => {
8644
8644
  this.onAnswer = void 0, this.onLeave = void 0, this.onLocalTrackPublished = void 0, this.onLocalTrackUnpublished = void 0, this.onNegotiateRequested = void 0, this.onOffer = void 0, this.onRemoteMuteChanged = void 0, this.onSubscribedQualityUpdate = void 0, this.onTokenRefresh = void 0, this.onTrickle = void 0, this.onClose = void 0, this.onMediaSectionsRequirement = void 0;
8645
- }, this.log = He((i = t.loggerName) !== null && i !== void 0 ? i : Oe.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new jd(), this.queuedRequests = [], this.closingLock = new he(), this.connectionLock = new he(), this.state = J.DISCONNECTED;
8645
+ }, this.log = Je((i = t.loggerName) !== null && i !== void 0 ? i : Oe.Signal), this.loggerContextCb = t.loggerContextCb, this.useJSON = e, this.requestQueue = new jd(), this.queuedRequests = [], this.closingLock = new ue(), this.connectionLock = new ue(), this.state = J.DISCONNECTED;
8646
8646
  }
8647
8647
  get logContext() {
8648
8648
  var e, t;
@@ -8705,21 +8705,21 @@ class Wn {
8705
8705
  }, this.logContext)), this.ws && (yield this.close(!1)), this.ws = new Bd(v);
8706
8706
  try {
8707
8707
  this.ws.closed.then((Q) => {
8708
- var be;
8708
+ var fe;
8709
8709
  this.isEstablishingConnection && k(L.internal("Websocket got closed during a (re)connection attempt: ".concat(Q.reason))), Q.closeCode !== 1e3 && (this.log.warn("websocket closed", Object.assign(Object.assign({}, this.logContext), {
8710
8710
  reason: Q.reason,
8711
8711
  code: Q.closeCode,
8712
8712
  wasClean: Q.closeCode === 1e3,
8713
8713
  state: this.state
8714
- })), this.state === J.CONNECTED && this.handleOnClose((be = Q.reason) !== null && be !== void 0 ? be : "Unexpected WS error"));
8714
+ })), this.state === J.CONNECTED && this.handleOnClose((fe = Q.reason) !== null && fe !== void 0 ? fe : "Unexpected WS error"));
8715
8715
  }).catch((Q) => {
8716
8716
  this.isEstablishingConnection && k(L.internal("Websocket error during a (re)connection attempt: ".concat(Q)));
8717
8717
  });
8718
8718
  const D = yield this.ws.opened.catch((Q) => f(this, void 0, void 0, function* () {
8719
8719
  if (this.state !== J.CONNECTED) {
8720
8720
  this.state = J.DISCONNECTED, clearTimeout(x);
8721
- const be = yield this.handleConnectionError(Q, p);
8722
- k(be);
8721
+ const fe = yield this.handleConnectionError(Q, p);
8722
+ k(fe);
8723
8723
  return;
8724
8724
  }
8725
8725
  this.handleWSError(Q), k(Q);
@@ -8740,8 +8740,8 @@ class Wn {
8740
8740
  timeout: this.pingTimeoutDuration,
8741
8741
  interval: this.pingIntervalDuration
8742
8742
  })));
8743
- const Z = ce.shouldProcessFirstMessage ? W : void 0;
8744
- N(D, Z), P(ce.response);
8743
+ const te = ce.shouldProcessFirstMessage ? W : void 0;
8744
+ N(D, te), P(ce.response);
8745
8745
  } catch (D) {
8746
8746
  k(D);
8747
8747
  } finally {
@@ -8804,7 +8804,7 @@ class Wn {
8804
8804
  offerSdp: e.sdp
8805
8805
  })), this.sendRequest({
8806
8806
  case: "offer",
8807
- value: bt(e, t)
8807
+ value: gt(e, t)
8808
8808
  });
8809
8809
  }
8810
8810
  // answer a server-initiated offer
@@ -8813,7 +8813,7 @@ class Wn {
8813
8813
  answerSdp: e.sdp
8814
8814
  })), this.sendRequest({
8815
8815
  case: "answer",
8816
- value: bt(e, t)
8816
+ value: gt(e, t)
8817
8817
  });
8818
8818
  }
8819
8819
  sendIceCandidate(e, t) {
@@ -8929,7 +8929,7 @@ class Wn {
8929
8929
  value: new wi({
8930
8930
  reason: Ie.CLIENT_INITIATED,
8931
8931
  // server doesn't process this field, keeping it here to indicate the intent of a full disconnect
8932
- action: kt.DISCONNECT
8932
+ action: bt.DISCONNECT
8933
8933
  })
8934
8934
  });
8935
8935
  }
@@ -9124,8 +9124,8 @@ function js(n) {
9124
9124
  }
9125
9125
  return e;
9126
9126
  }
9127
- function bt(n, e) {
9128
- return new st({
9127
+ function gt(n, e) {
9128
+ return new nt({
9129
9129
  sdp: n.sdp,
9130
9130
  type: n.type,
9131
9131
  id: e
@@ -9134,7 +9134,7 @@ function bt(n, e) {
9134
9134
  function Kd(n, e, t) {
9135
9135
  var i;
9136
9136
  const s = new URLSearchParams();
9137
- return s.set("access_token", n), t.reconnect && (s.set("reconnect", "1"), t.sid && s.set("sid", t.sid)), s.set("auto_subscribe", t.autoSubscribe ? "1" : "0"), s.set("sdk", Ue() ? "reactnative" : "js"), s.set("version", e.version), s.set("protocol", e.protocol.toString()), e.deviceModel && s.set("device_model", e.deviceModel), e.os && s.set("os", e.os), e.osVersion && s.set("os_version", e.osVersion), e.browser && s.set("browser", e.browser), e.browserVersion && s.set("browser_version", e.browserVersion), t.adaptiveStream && s.set("adaptive_stream", "1"), t.reconnectReason && s.set("reconnect_reason", t.reconnectReason.toString()), !((i = navigator.connection) === null || i === void 0) && i.type && s.set("network", navigator.connection.type), s;
9137
+ return s.set("access_token", n), t.reconnect && (s.set("reconnect", "1"), t.sid && s.set("sid", t.sid)), s.set("auto_subscribe", t.autoSubscribe ? "1" : "0"), s.set("sdk", Ne() ? "reactnative" : "js"), s.set("version", e.version), s.set("protocol", e.protocol.toString()), e.deviceModel && s.set("device_model", e.deviceModel), e.os && s.set("os", e.os), e.osVersion && s.set("os_version", e.osVersion), e.browser && s.set("browser", e.browser), e.browserVersion && s.set("browser_version", e.browserVersion), t.adaptiveStream && s.set("adaptive_stream", "1"), t.reconnectReason && s.set("reconnect_reason", t.reconnectReason.toString()), !((i = navigator.connection) === null || i === void 0) && i.type && s.set("network", navigator.connection.type), s;
9138
9138
  }
9139
9139
  function Gd(n, e, t) {
9140
9140
  const i = new URLSearchParams();
@@ -9838,7 +9838,7 @@ function Qd() {
9838
9838
  var n = Hd(), e = zd(), t = Kn();
9839
9839
  return Ee.grammar = t, Ee.write = e, Ee.parse = n.parse, Ee.parseParams = n.parseParams, Ee.parseFmtpConfig = n.parseFmtpConfig, Ee.parsePayloads = n.parsePayloads, Ee.parseRemoteCandidates = n.parseRemoteCandidates, Ee.parseImageAttributes = n.parseImageAttributes, Ee.parseSimulcastStreamList = n.parseSimulcastStreamList, Ee;
9840
9840
  }
9841
- var Xe = Qd();
9841
+ var Ye = Qd();
9842
9842
  function Gn(n, e, t) {
9843
9843
  var i, s, r;
9844
9844
  e === void 0 && (e = 50), t === void 0 && (t = {});
@@ -9877,12 +9877,12 @@ function Gn(n, e, t) {
9877
9877
  }), l = [];
9878
9878
  }, h;
9879
9879
  }
9880
- const Yd = 0.7, Xd = 20, Rt = {
9880
+ const Yd = 0.7, Xd = 20, Et = {
9881
9881
  NegotiationStarted: "negotiationStarted",
9882
9882
  NegotiationComplete: "negotiationComplete",
9883
9883
  RTPVideoPayloadTypes: "rtpVideoPayloadTypes"
9884
9884
  };
9885
- class Gs extends je.EventEmitter {
9885
+ class Gs extends Ue.EventEmitter {
9886
9886
  get pc() {
9887
9887
  return this._pc || (this._pc = this.createPC()), this._pc;
9888
9888
  }
@@ -9890,7 +9890,7 @@ class Gs extends je.EventEmitter {
9890
9890
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
9891
9891
  var i;
9892
9892
  super(), this.log = F, this.ddExtID = 0, this.latestOfferId = 0, this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate = !1, this.trackBitrates = [], this.remoteStereoMids = [], this.remoteNackMids = [], this.negotiate = Gn((s) => f(this, void 0, void 0, function* () {
9893
- this.emit(Rt.NegotiationStarted);
9893
+ this.emit(Et.NegotiationStarted);
9894
9894
  try {
9895
9895
  yield this.createAndSendOffer();
9896
9896
  } catch (r) {
@@ -9901,7 +9901,7 @@ class Gs extends je.EventEmitter {
9901
9901
  }
9902
9902
  }), Xd), this.close = () => {
9903
9903
  this._pc && (this._pc.close(), this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, this._pc.onicegatheringstatechange = null, this._pc.ondatachannel = null, this._pc.onnegotiationneeded = null, this._pc.onsignalingstatechange = null, this._pc.onicecandidate = null, this._pc.ondatachannel = null, this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.oniceconnectionstatechange = null, this._pc = null);
9904
- }, this.log = He((i = t.loggerName) !== null && i !== void 0 ? i : Oe.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new he();
9904
+ }, this.log = Je((i = t.loggerName) !== null && i !== void 0 ? i : Oe.PCTransport), this.loggerOptions = t, this.config = e, this._pc = this.createPC(), this.offerLock = new ue();
9905
9905
  }
9906
9906
  createPC() {
9907
9907
  const e = new RTCPeerConnection(this.config);
@@ -9958,7 +9958,7 @@ class Gs extends je.EventEmitter {
9958
9958
  } = $d(e);
9959
9959
  this.remoteStereoMids = r, this.remoteNackMids = o;
9960
9960
  } else if (e.type === "answer") {
9961
- const r = Xe.parse((i = e.sdp) !== null && i !== void 0 ? i : "");
9961
+ const r = Ye.parse((i = e.sdp) !== null && i !== void 0 ? i : "");
9962
9962
  r.media.forEach((o) => {
9963
9963
  const a = Jn(o.mid);
9964
9964
  o.type === "audio" && this.trackBitrates.some((c) => {
@@ -9978,12 +9978,12 @@ class Gs extends je.EventEmitter {
9978
9978
  config: "maxaveragebitrate=".concat(c.maxbr * 1e3)
9979
9979
  }), !0;
9980
9980
  });
9981
- }), s = Xe.write(r);
9981
+ }), s = Ye.write(r);
9982
9982
  }
9983
9983
  return yield this.setMungedSDP(e, s, !0), this.pendingCandidates.forEach((r) => {
9984
9984
  this.pc.addIceCandidate(r);
9985
- }), this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate ? (this.renegotiate = !1, yield this.createAndSendOffer()) : e.type === "answer" && (this.emit(Rt.NegotiationComplete), e.sdp && Xe.parse(e.sdp).media.forEach((o) => {
9986
- o.type === "video" && this.emit(Rt.RTPVideoPayloadTypes, o.rtp);
9985
+ }), this.pendingCandidates = [], this.restartingIce = !1, this.renegotiate ? (this.renegotiate = !1, yield this.createAndSendOffer()) : e.type === "answer" && (this.emit(Et.NegotiationComplete), e.sdp && Ye.parse(e.sdp).media.forEach((o) => {
9986
+ o.type === "video" && this.emit(Et.RTPVideoPayloadTypes, o.rtp);
9987
9987
  })), !0;
9988
9988
  });
9989
9989
  }
@@ -10013,13 +10013,13 @@ class Gs extends je.EventEmitter {
10013
10013
  this.log.debug("original offer", Object.assign({
10014
10014
  sdp: r.sdp
10015
10015
  }, this.logContext));
10016
- const o = Xe.parse((t = r.sdp) !== null && t !== void 0 ? t : "");
10016
+ const o = Ye.parse((t = r.sdp) !== null && t !== void 0 ? t : "");
10017
10017
  if (o.media.forEach((a) => {
10018
10018
  Hs(a), a.type === "audio" ? Js(a, ["all"], []) : a.type === "video" && this.trackBitrates.some((c) => {
10019
10019
  if (!a.msid || !c.cid || !a.msid.includes(c.cid))
10020
10020
  return !1;
10021
10021
  let d = 0;
10022
- if (a.rtp.some((u) => u.codec.toUpperCase() === c.codec.toUpperCase() ? (d = u.payload, !0) : !1), d === 0 || (we(c.codec) && !ut() && this.ensureVideoDDExtensionForSVC(a, o), !we(c.codec)))
10022
+ if (a.rtp.some((u) => u.codec.toUpperCase() === c.codec.toUpperCase() ? (d = u.payload, !0) : !1), d === 0 || (we(c.codec) && !lt() && this.ensureVideoDDExtensionForSVC(a, o), !we(c.codec)))
10023
10023
  return !0;
10024
10024
  const l = Math.round(c.maxbr * Yd);
10025
10025
  for (const u of a.fmtp)
@@ -10036,7 +10036,7 @@ class Gs extends je.EventEmitter {
10036
10036
  }));
10037
10037
  return;
10038
10038
  }
10039
- yield this.setMungedSDP(r, Xe.write(o)), this.onOffer(r, this.latestOfferId);
10039
+ yield this.setMungedSDP(r, Ye.write(o)), this.onOffer(r, this.latestOfferId);
10040
10040
  } finally {
10041
10041
  i();
10042
10042
  }
@@ -10045,10 +10045,10 @@ class Gs extends je.EventEmitter {
10045
10045
  createAndSetAnswer() {
10046
10046
  return f(this, void 0, void 0, function* () {
10047
10047
  var e;
10048
- const t = yield this.pc.createAnswer(), i = Xe.parse((e = t.sdp) !== null && e !== void 0 ? e : "");
10048
+ const t = yield this.pc.createAnswer(), i = Ye.parse((e = t.sdp) !== null && e !== void 0 ? e : "");
10049
10049
  return i.media.forEach((s) => {
10050
10050
  Hs(s), s.type === "audio" && Js(s, this.remoteStereoMids, this.remoteNackMids);
10051
- }), yield this.setMungedSDP(t, Xe.write(i)), t;
10051
+ }), yield this.setMungedSDP(t, Ye.write(i)), t;
10052
10052
  });
10053
10053
  }
10054
10054
  createDataChannel(e, t) {
@@ -10062,7 +10062,7 @@ class Gs extends je.EventEmitter {
10062
10062
  }
10063
10063
  addTrack(e) {
10064
10064
  if (!this._pc)
10065
- throw new ee("PC closed, cannot add track");
10065
+ throw new Z("PC closed, cannot add track");
10066
10066
  return this._pc.addTrack(e);
10067
10067
  }
10068
10068
  setTrackCodecBitrate(e) {
@@ -10071,7 +10071,7 @@ class Gs extends je.EventEmitter {
10071
10071
  setConfiguration(e) {
10072
10072
  var t;
10073
10073
  if (!this._pc)
10074
- throw new ee("PC closed, cannot configure");
10074
+ throw new Z("PC closed, cannot configure");
10075
10075
  return (t = this._pc) === null || t === void 0 ? void 0 : t.setConfiguration(e);
10076
10076
  }
10077
10077
  canRemoveTrack() {
@@ -10165,7 +10165,7 @@ class Gs extends je.EventEmitter {
10165
10165
  };
10166
10166
  throw !i && this.pc.remoteDescription && (o.remoteSdp = this.pc.remoteDescription), this.log.error("unable to set ".concat(e.type), Object.assign(Object.assign({}, this.logContext), {
10167
10167
  fields: o
10168
- })), new St(r);
10168
+ })), new kt(r);
10169
10169
  }
10170
10170
  });
10171
10171
  }
@@ -10198,7 +10198,7 @@ function Js(n, e, t) {
10198
10198
  }
10199
10199
  function $d(n) {
10200
10200
  var e;
10201
- const t = [], i = [], s = Xe.parse((e = n.sdp) !== null && e !== void 0 ? e : "");
10201
+ const t = [], i = [], s = Ye.parse((e = n.sdp) !== null && e !== void 0 ? e : "");
10202
10202
  let r = 0;
10203
10203
  return s.media.forEach((o) => {
10204
10204
  var a;
@@ -10241,7 +10241,7 @@ const kn = "vp8", Zd = {
10241
10241
  deviceId: {
10242
10242
  ideal: "default"
10243
10243
  },
10244
- resolution: Ht.h720.resolution
10244
+ resolution: Gt.h720.resolution
10245
10245
  }, el = {
10246
10246
  adaptiveStream: !1,
10247
10247
  dynacast: !1,
@@ -10279,7 +10279,7 @@ class tl {
10279
10279
  var r, o;
10280
10280
  const a = this.state, c = this.requiredTransports.map((d) => d.getConnectionState());
10281
10281
  c.every((d) => d === "connected") ? this.state = Y.CONNECTED : c.some((d) => d === "failed") ? this.state = Y.FAILED : c.some((d) => d === "connecting") ? this.state = Y.CONNECTING : c.every((d) => d === "closed") ? this.state = Y.CLOSED : c.some((d) => d === "closed") ? this.state = Y.CLOSING : c.every((d) => d === "new") && (this.state = Y.NEW), a !== this.state && (this.log.debug("pc state change: from ".concat(Y[a], " to ").concat(Y[this.state]), this.logContext), (r = this.onStateChange) === null || r === void 0 || r.call(this, this.state, this.publisher.getConnectionState(), (o = this.subscriber) === null || o === void 0 ? void 0 : o.getConnectionState()));
10282
- }, this.log = He((s = i.loggerName) !== null && s !== void 0 ? s : Oe.PCManager), this.loggerOptions = i, this.isPublisherConnectionRequired = t !== "subscriber-primary", this.isSubscriberConnectionRequired = t === "subscriber-primary", this.publisher = new Gs(e, i), this._mode = t, t !== "publisher-only" && (this.subscriber = new Gs(e, i), this.subscriber.onConnectionStateChange = this.updateState, this.subscriber.onIceConnectionStateChange = this.updateState, this.subscriber.onSignalingStatechange = this.updateState, this.subscriber.onIceCandidate = (r) => {
10282
+ }, this.log = Je((s = i.loggerName) !== null && s !== void 0 ? s : Oe.PCManager), this.loggerOptions = i, this.isPublisherConnectionRequired = t !== "subscriber-primary", this.isSubscriberConnectionRequired = t === "subscriber-primary", this.publisher = new Gs(e, i), this._mode = t, t !== "publisher-only" && (this.subscriber = new Gs(e, i), this.subscriber.onConnectionStateChange = this.updateState, this.subscriber.onIceConnectionStateChange = this.updateState, this.subscriber.onSignalingStatechange = this.updateState, this.subscriber.onIceCandidate = (r) => {
10283
10283
  var o;
10284
10284
  (o = this.onIceCandidate) === null || o === void 0 || o.call(this, r, _e.SUBSCRIBER);
10285
10285
  }, this.subscriber.onDataChannel = (r) => {
@@ -10297,7 +10297,7 @@ class tl {
10297
10297
  }, this.publisher.onOffer = (r, o) => {
10298
10298
  var a;
10299
10299
  (a = this.onPublisherOffer) === null || a === void 0 || a.call(this, r, o);
10300
- }, this.state = Y.NEW, this.connectionLock = new he(), this.remoteOfferLock = new he();
10300
+ }, this.state = Y.NEW, this.connectionLock = new ue(), this.remoteOfferLock = new ue();
10301
10301
  }
10302
10302
  get logContext() {
10303
10303
  var e, t;
@@ -10381,12 +10381,12 @@ class tl {
10381
10381
  return f(this, void 0, void 0, function* () {
10382
10382
  return new pe((t, i) => f(this, void 0, void 0, function* () {
10383
10383
  const s = setTimeout(() => {
10384
- i(new St("negotiation timed out"));
10384
+ i(new kt("negotiation timed out"));
10385
10385
  }, this.peerConnectionTimeout), r = () => {
10386
- clearTimeout(s), i(new St("negotiation aborted"));
10386
+ clearTimeout(s), i(new kt("negotiation aborted"));
10387
10387
  };
10388
- e.signal.addEventListener("abort", r), this.publisher.once(Rt.NegotiationStarted, () => {
10389
- e.signal.aborted || this.publisher.once(Rt.NegotiationComplete, () => {
10388
+ e.signal.addEventListener("abort", r), this.publisher.once(Et.NegotiationStarted, () => {
10389
+ e.signal.aborted || this.publisher.once(Et.NegotiationComplete, () => {
10390
10390
  clearTimeout(s), t();
10391
10391
  });
10392
10392
  }), yield this.publisher.negotiate((o) => {
@@ -10531,7 +10531,7 @@ class q {
10531
10531
  this.token = e;
10532
10532
  }
10533
10533
  isCloud() {
10534
- return It(this.serverUrl);
10534
+ return _t(this.serverUrl);
10535
10535
  }
10536
10536
  getServerUrl() {
10537
10537
  return this.serverUrl;
@@ -10566,7 +10566,7 @@ class q {
10566
10566
  q.cache = /* @__PURE__ */ new Map();
10567
10567
  q.settingsTimeouts = /* @__PURE__ */ new Map();
10568
10568
  q.connectionTrackers = /* @__PURE__ */ new Map();
10569
- q.fetchLock = new he();
10569
+ q.fetchLock = new ue();
10570
10570
  function nl(n) {
10571
10571
  return "".concat(n.protocol.replace("ws", "http"), "//").concat(n.host, "/settings");
10572
10572
  }
@@ -10728,7 +10728,7 @@ class Fa extends T {
10728
10728
  this.debouncedTrackMuteHandler.cancel("unmute"), yield this.resumeUpstream();
10729
10729
  }), this.handleEnded = () => {
10730
10730
  this.isInBackground && (this.reacquireTrack = !0), this._mediaStreamTrack.removeEventListener("mute", this.handleTrackMuteEvent), this._mediaStreamTrack.removeEventListener("unmute", this.handleTrackUnmuteEvent), this.emit(R.Ended, this);
10731
- }, this.reacquireTrack = !1, this.providedByUser = s, this.muteLock = new he(), this.pauseUpstreamLock = new he(), this.trackChangeLock = new he(), this.trackChangeLock.lock().then((o) => f(this, void 0, void 0, function* () {
10731
+ }, this.reacquireTrack = !1, this.providedByUser = s, this.muteLock = new ue(), this.pauseUpstreamLock = new ue(), this.trackChangeLock = new ue(), this.trackChangeLock.lock().then((o) => f(this, void 0, void 0, function* () {
10732
10732
  try {
10733
10733
  yield this.setMediaStreamTrack(e, !0);
10734
10734
  } finally {
@@ -10778,20 +10778,20 @@ class Fa extends T {
10778
10778
  if (e === this._mediaStreamTrack && !t)
10779
10779
  return;
10780
10780
  this._mediaStreamTrack && (this.attachedElements.forEach((r) => {
10781
- Ct(this._mediaStreamTrack, r);
10781
+ Tt(this._mediaStreamTrack, r);
10782
10782
  }), this.debouncedTrackMuteHandler.cancel("new-track"), this._mediaStreamTrack.removeEventListener("ended", this.handleEnded), this._mediaStreamTrack.removeEventListener("mute", this.handleTrackMuteEvent), this._mediaStreamTrack.removeEventListener("unmute", this.handleTrackUnmuteEvent)), this.mediaStream = new MediaStream([e]), e && (e.addEventListener("ended", this.handleEnded), e.addEventListener("mute", this.handleTrackMuteEvent), e.addEventListener("unmute", this.handleTrackUnmuteEvent), this._constraints = e.getConstraints());
10783
10783
  let s;
10784
10784
  if (this.processor && e) {
10785
10785
  if (this.log.debug("restarting processor", this.logContext), this.kind === "unknown")
10786
10786
  throw TypeError("cannot set processor on track of unknown kind");
10787
- this.processorElement && (vt(e, this.processorElement), this.processorElement.muted = !0), yield this.processor.restart({
10787
+ this.processorElement && (pt(e, this.processorElement), this.processorElement.muted = !0), yield this.processor.restart({
10788
10788
  track: e,
10789
10789
  kind: this.kind,
10790
10790
  element: this.processorElement
10791
10791
  }), s = this.processor.processedTrack;
10792
10792
  }
10793
10793
  this.sender && ((i = this.sender.transport) === null || i === void 0 ? void 0 : i.state) !== "closed" && (yield this.sender.replaceTrack(s ?? e)), !this.providedByUser && this._mediaStreamTrack !== e && this._mediaStreamTrack.stop(), this._mediaStreamTrack = e, e && (this._mediaStreamTrack.enabled = !this.isMuted, yield this.resumeUpstream(), this.attachedElements.forEach((r) => {
10794
- vt(s ?? e, r);
10794
+ pt(s ?? e, r);
10795
10795
  }));
10796
10796
  });
10797
10797
  }
@@ -10811,13 +10811,13 @@ class Fa extends T {
10811
10811
  return r;
10812
10812
  yield oe(50);
10813
10813
  }
10814
- throw new Je("unable to get track dimensions after timeout");
10814
+ throw new Ge("unable to get track dimensions after timeout");
10815
10815
  })();
10816
10816
  });
10817
10817
  }
10818
10818
  setDeviceId(e) {
10819
10819
  return f(this, void 0, void 0, function* () {
10820
- return this._constraints.deviceId === e && this._mediaStreamTrack.getSettings().deviceId === tt(e) || (this._constraints.deviceId = e, this.isMuted) ? !0 : (yield this.restartTrack(), tt(e) === this._mediaStreamTrack.getSettings().deviceId);
10820
+ return this._constraints.deviceId === e && this._mediaStreamTrack.getSettings().deviceId === et(e) || (this._constraints.deviceId = e, this.isMuted) ? !0 : (yield this.restartTrack(), et(e) === this._mediaStreamTrack.getSettings().deviceId);
10821
10821
  });
10822
10822
  }
10823
10823
  /**
@@ -10853,7 +10853,7 @@ class Fa extends T {
10853
10853
  const i = yield this.trackChangeLock.lock();
10854
10854
  try {
10855
10855
  if (!this.sender)
10856
- throw new Je("unable to replace an unpublished track");
10856
+ throw new Ge("unable to replace an unpublished track");
10857
10857
  let s, r;
10858
10858
  return typeof t == "boolean" ? s = t : t !== void 0 && (s = t.userProvidedTrack, r = t.stopProcessor), this.providedByUser = s ?? !0, this.log.debug("replace MediaStreamTrack", this.logContext), yield this.setMediaStreamTrack(e), r && this.processor && (yield this.internalStopProcessor()), this;
10859
10859
  } finally {
@@ -10884,7 +10884,7 @@ class Fa extends T {
10884
10884
  } : !0 : o.audio = i ? Object.assign({
10885
10885
  deviceId: i
10886
10886
  }, r) : !0, this.attachedElements.forEach((d) => {
10887
- Ct(this.mediaStreamTrack, d);
10887
+ Tt(this.mediaStreamTrack, d);
10888
10888
  }), this._mediaStreamTrack.removeEventListener("ended", this.handleEnded), this._mediaStreamTrack.stop();
10889
10889
  const c = (yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];
10890
10890
  return this.kind === T.Kind.Video && (yield c.applyConstraints(r)), c.addEventListener("ended", this.handleEnded), this.log.debug("re-acquired MediaStreamTrack", this.logContext), yield this.setMediaStreamTrack(c), this._constraints = e, this.emit(R.Restarted, this), this.manuallyStopped && (this.log.warn("track was stopped during a restart, stopping restarted track", this.logContext), this.stop()), this;
@@ -10932,7 +10932,7 @@ class Fa extends T {
10932
10932
  }
10933
10933
  this._isUpstreamPaused = !0, this.emit(R.UpstreamPaused, this);
10934
10934
  const i = ve();
10935
- if (i?.name === "Safari" && Fe(i.version, "12.0") < 0)
10935
+ if (i?.name === "Safari" && Le(i.version, "12.0") < 0)
10936
10936
  throw new jn("pauseUpstream is not supported on Safari < 12.");
10937
10937
  ((e = this.sender.transport) === null || e === void 0 ? void 0 : e.state) !== "closed" && (yield this.sender.replaceTrack(null));
10938
10938
  } finally {
@@ -10994,7 +10994,7 @@ class Fa extends T {
10994
10994
  };
10995
10995
  if (yield t.init(c), i.log.debug("processor initialized", i.logContext), i.processor && (yield i.internalStopProcessor()), i.kind === "unknown")
10996
10996
  throw TypeError("cannot set processor on track of unknown kind");
10997
- if (vt(i._mediaStreamTrack, a), a.muted = !0, a.play().catch((d) => {
10997
+ if (pt(i._mediaStreamTrack, a), a.muted = !0, a.play().catch((d) => {
10998
10998
  d instanceof DOMException && d.name === "AbortError" ? (i.log.warn("failed to play processor element, retrying", Object.assign(Object.assign({}, i.logContext), {
10999
10999
  error: d
11000
11000
  })), setTimeout(() => {
@@ -11008,7 +11008,7 @@ class Fa extends T {
11008
11008
  }));
11009
11009
  }), i.processor = t, i.processorElement = a, i.processor.processedTrack) {
11010
11010
  for (const d of i.attachedElements)
11011
- d !== i.processorElement && s && (Ct(i._mediaStreamTrack, d), vt(i.processor.processedTrack, d));
11011
+ d !== i.processorElement && s && (Tt(i._mediaStreamTrack, d), pt(i.processor.processedTrack, d));
11012
11012
  yield (r = i.sender) === null || r === void 0 ? void 0 : r.replaceTrack(i.processor.processedTrack);
11013
11013
  }
11014
11014
  i.emit(R.TrackProcessorUpdate, i.processor);
@@ -11151,7 +11151,7 @@ class ki extends Fa {
11151
11151
  try {
11152
11152
  if (!this.isMuted)
11153
11153
  return this.log.debug("Track already unmuted", this.logContext), this;
11154
- const i = this._constraints.deviceId && this._mediaStreamTrack.getSettings().deviceId !== tt(this._constraints.deviceId);
11154
+ const i = this._constraints.deviceId && this._mediaStreamTrack.getSettings().deviceId !== et(this._constraints.deviceId);
11155
11155
  return this.source === T.Source.Microphone && (this.stopOnMute || this._mediaStreamTrack.readyState === "ended" || i) && !this.isUserProvided && (this.log.debug("reacquiring mic track", this.logContext), yield this.restartTrack()), yield e.unmute.call(this), this;
11156
11156
  } finally {
11157
11157
  t();
@@ -11192,7 +11192,7 @@ class ki extends Fa {
11192
11192
  var t;
11193
11193
  const i = yield this.trackChangeLock.lock();
11194
11194
  try {
11195
- if (!Ue() && !this.audioContext)
11195
+ if (!Ne() && !this.audioContext)
11196
11196
  throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");
11197
11197
  this.processor && (yield this.internalStopProcessor());
11198
11198
  const s = {
@@ -11249,10 +11249,10 @@ function ll(n, e, t) {
11249
11249
  case "video":
11250
11250
  return new Ti(n, e, !1, t);
11251
11251
  default:
11252
- throw new Je("unsupported track type: ".concat(n.kind));
11252
+ throw new Ge("unsupported track type: ".concat(n.kind));
11253
11253
  }
11254
11254
  }
11255
- const ul = Object.values(Ht), hl = Object.values(hn), fl = Object.values(Bn), ml = [Ht.h180, Ht.h360], pl = [hn.h180, hn.h360], gl = (n) => [{
11255
+ const ul = Object.values(Gt), hl = Object.values(hn), fl = Object.values(Bn), ml = [Gt.h180, Gt.h360], pl = [hn.h180, hn.h360], gl = (n) => [{
11256
11256
  scaleResolutionDownBy: 2,
11257
11257
  fps: n.encoding.maxFramerate
11258
11258
  }].map((t) => {
@@ -11273,10 +11273,10 @@ function Sn(n, e, t, i) {
11273
11273
  if (v.spatial > 3)
11274
11274
  throw new Error("unsupported scalabilityMode: ".concat(c));
11275
11275
  const P = ve();
11276
- if (zt() || // Even tho RN runs M114, it does not produce SVC layers when a single encoding
11276
+ if (Jt() || // Even tho RN runs M114, it does not produce SVC layers when a single encoding
11277
11277
  // is provided. So we'll use the legacy SVC specification for now.
11278
11278
  // TODO: when we upstream libwebrtc, this will need additional verification
11279
- Ue() || P?.name === "Chrome" && Fe(P?.version, "113") < 0) {
11279
+ Ne() || P?.name === "Chrome" && Le(P?.version, "113") < 0) {
11280
11280
  const k = v.suffix == "h" ? 2 : 3, O = fd(P);
11281
11281
  for (let M = 0; M < v.spatial; M += 1)
11282
11282
  p.push({
@@ -11373,9 +11373,9 @@ function Qi(n, e, t, i) {
11373
11373
  maxBitrate: r.encoding.maxBitrate
11374
11374
  }, l = i && r.encoding.maxFramerate ? Math.min(i, r.encoding.maxFramerate) : r.encoding.maxFramerate;
11375
11375
  l && (d.maxFramerate = l);
11376
- const u = lt() || o === 0;
11376
+ const u = dt() || o === 0;
11377
11377
  r.encoding.priority && u && (d.priority = r.encoding.priority, d.networkPriority = r.encoding.priority), s.push(d);
11378
- }), Ue() && Ma() === "ios") {
11378
+ }), Ne() && Ma() === "ios") {
11379
11379
  let r;
11380
11380
  s.forEach((a) => {
11381
11381
  r ? a.maxFramerate && a.maxFramerate > r && (r = a.maxFramerate) : r = a.maxFramerate;
@@ -11418,7 +11418,7 @@ class ja {
11418
11418
  }
11419
11419
  }
11420
11420
  function kl(n) {
11421
- return n.source === T.Source.ScreenShare || n.constraints.height && tt(n.constraints.height) >= 1080 ? "maintain-resolution" : "balanced";
11421
+ return n.source === T.Source.ScreenShare || n.constraints.height && et(n.constraints.height) >= 1080 ? "maintain-resolution" : "balanced";
11422
11422
  }
11423
11423
  const Tl = 5e3;
11424
11424
  class Ti extends Fa {
@@ -11460,7 +11460,7 @@ class Ti extends Fa {
11460
11460
  }), this._currentBitrate = c;
11461
11461
  }
11462
11462
  this.prevStats = o;
11463
- }), this.senderLock = new he();
11463
+ }), this.senderLock = new ue();
11464
11464
  }
11465
11465
  get isSimulcast() {
11466
11466
  return !!(this.sender && this.sender.getParameters().encodings.length > 1);
@@ -11490,7 +11490,7 @@ class Ti extends Fa {
11490
11490
  var t, i, s, r, o;
11491
11491
  yield e.pauseUpstream.call(this);
11492
11492
  try {
11493
- for (var a = !0, c = Ge(this.simulcastCodecs.values()), d; d = yield c.next(), t = d.done, !t; a = !0)
11493
+ for (var a = !0, c = Ke(this.simulcastCodecs.values()), d; d = yield c.next(), t = d.done, !t; a = !0)
11494
11494
  r = d.value, a = !1, yield (o = r.sender) === null || o === void 0 ? void 0 : o.replaceTrack(null);
11495
11495
  } catch (l) {
11496
11496
  i = {
@@ -11515,7 +11515,7 @@ class Ti extends Fa {
11515
11515
  var t, i, s, r, o;
11516
11516
  yield e.resumeUpstream.call(this);
11517
11517
  try {
11518
- for (var a = !0, c = Ge(this.simulcastCodecs.values()), d; d = yield c.next(), t = d.done, !t; a = !0) {
11518
+ for (var a = !0, c = Ke(this.simulcastCodecs.values()), d; d = yield c.next(), t = d.done, !t; a = !0) {
11519
11519
  r = d.value, a = !1;
11520
11520
  const l = r;
11521
11521
  yield (o = l.sender) === null || o === void 0 ? void 0 : o.replaceTrack(l.mediaStreamTrack);
@@ -11626,7 +11626,7 @@ class Ti extends Fa {
11626
11626
  }
11627
11627
  yield this.restart(a), this.isCpuConstrained = !1;
11628
11628
  try {
11629
- for (var c = !0, d = Ge(this.simulcastCodecs.values()), l; l = yield d.next(), t = l.done, !t; c = !0) {
11629
+ for (var c = !0, d = Ke(this.simulcastCodecs.values()), l; l = yield d.next(), t = l.done, !t; c = !0) {
11630
11630
  r = l.value, c = !1;
11631
11631
  const u = r;
11632
11632
  u.sender && ((o = u.sender.transport) === null || o === void 0 ? void 0 : o.state) !== "closed" && (u.mediaStreamTrack = this.mediaStreamTrack.clone(), yield u.sender.replaceTrack(u.mediaStreamTrack));
@@ -11657,7 +11657,7 @@ class Ti extends Fa {
11657
11657
  var o, a, c, d, l, u;
11658
11658
  if (yield t.setProcessor.call(s, i, r), !((l = s.processor) === null || l === void 0) && l.processedTrack)
11659
11659
  try {
11660
- for (var h = !0, m = Ge(s.simulcastCodecs.values()), v; v = yield m.next(), o = v.done, !o; h = !0)
11660
+ for (var h = !0, m = Ke(s.simulcastCodecs.values()), v; v = yield m.next(), o = v.done, !o; h = !0)
11661
11661
  d = v.value, h = !1, yield (u = d.sender) === null || u === void 0 ? void 0 : u.replaceTrack(s.processor.processedTrack);
11662
11662
  } catch (p) {
11663
11663
  a = {
@@ -11722,7 +11722,7 @@ class Ti extends Fa {
11722
11722
  this.subscribedCodecs = e;
11723
11723
  const d = [];
11724
11724
  try {
11725
- for (t = !0, i = Ge(e); s = yield i.next(), r = s.done, !r; t = !0) {
11725
+ for (t = !0, i = Ke(e); s = yield i.next(), r = s.done, !r; t = !0) {
11726
11726
  c = s.value, t = !1;
11727
11727
  const l = c;
11728
11728
  if (!this.codec || this.codec === l.codec)
@@ -11842,7 +11842,7 @@ function Xs(n, e, t, i, s, r, o) {
11842
11842
  let p = (v = h.rid) !== null && v !== void 0 ? v : "";
11843
11843
  p === "" && (p = "q");
11844
11844
  const P = Ba(p), k = t.find((O) => O.quality === P);
11845
- k && h.active !== k.enabled && (l = !0, h.active = k.enabled, r.debug("setting layer ".concat(k.quality, " to ").concat(h.active ? "enabled" : "disabled"), o), lt() && (k.enabled ? (h.scaleResolutionDownBy = e[m].scaleResolutionDownBy, h.maxBitrate = e[m].maxBitrate, h.maxFrameRate = e[m].maxFrameRate) : (h.scaleResolutionDownBy = 4, h.maxBitrate = 10, h.maxFrameRate = 2)));
11845
+ k && h.active !== k.enabled && (l = !0, h.active = k.enabled, r.debug("setting layer ".concat(k.quality, " to ").concat(h.active ? "enabled" : "disabled"), o), dt() && (k.enabled ? (h.scaleResolutionDownBy = e[m].scaleResolutionDownBy, h.maxBitrate = e[m].maxBitrate, h.maxFrameRate = e[m].maxFrameRate) : (h.scaleResolutionDownBy = 4, h.maxBitrate = 10, h.maxFrameRate = 2)));
11846
11846
  })), l && (c.encodings = d, r.debug("setting encodings", Object.assign(Object.assign({}, o), {
11847
11847
  encodings: c.encodings
11848
11848
  })), yield n.setParameters(c));
@@ -11865,7 +11865,7 @@ function Ba(n) {
11865
11865
  }
11866
11866
  function $s(n, e, t, i) {
11867
11867
  if (!t)
11868
- return [new et({
11868
+ return [new Ze({
11869
11869
  quality: ye.HIGH,
11870
11870
  width: n,
11871
11871
  height: e,
@@ -11875,7 +11875,7 @@ function $s(n, e, t, i) {
11875
11875
  if (i) {
11876
11876
  const s = t[0].scalabilityMode, r = new ja(s), o = [], a = r.suffix == "h" ? 1.5 : 2, c = r.suffix == "h" ? 2 : 3;
11877
11877
  for (let d = 0; d < r.spatial; d += 1)
11878
- o.push(new et({
11878
+ o.push(new Ze({
11879
11879
  quality: Math.min(ye.HIGH, r.spatial - 1) - d,
11880
11880
  width: Math.ceil(n / Math.pow(a, d)),
11881
11881
  height: Math.ceil(e / Math.pow(a, d)),
@@ -11888,7 +11888,7 @@ function $s(n, e, t, i) {
11888
11888
  var r, o, a;
11889
11889
  const c = (r = s.scaleResolutionDownBy) !== null && r !== void 0 ? r : 1;
11890
11890
  let d = Ba((o = s.rid) !== null && o !== void 0 ? o : "");
11891
- return new et({
11891
+ return new Ze({
11892
11892
  quality: d,
11893
11893
  width: Math.ceil(n / c),
11894
11894
  height: Math.ceil(e / c),
@@ -11902,7 +11902,7 @@ var ke;
11902
11902
  (function(n) {
11903
11903
  n[n.New = 0] = "New", n[n.Connected = 1] = "Connected", n[n.Disconnected = 2] = "Disconnected", n[n.Reconnecting = 3] = "Reconnecting", n[n.Closed = 4] = "Closed";
11904
11904
  })(ke || (ke = {}));
11905
- class Rl extends je.EventEmitter {
11905
+ class Rl extends Ue.EventEmitter {
11906
11906
  get isClosed() {
11907
11907
  return this._isClosed;
11908
11908
  }
@@ -11942,7 +11942,7 @@ class Rl extends je.EventEmitter {
11942
11942
  }));
11943
11943
  return;
11944
11944
  }
11945
- const u = ue.fromBinary(new Uint8Array(l));
11945
+ const u = le.fromBinary(new Uint8Array(l));
11946
11946
  if (u.sequence > 0 && u.participantSid !== "") {
11947
11947
  const h = this.reliableReceivedState.get(u.participantSid);
11948
11948
  if (h && u.sequence <= h)
@@ -11956,7 +11956,7 @@ class Rl extends je.EventEmitter {
11956
11956
  this.log.error("Received encrypted packet but E2EE not set up", this.logContext);
11957
11957
  return;
11958
11958
  }
11959
- const h = yield (o = this.e2eeManager) === null || o === void 0 ? void 0 : o.handleEncryptedData(u.value.value.encryptedValue, u.value.value.iv, u.participantIdentity, u.value.value.keyIndex), m = Pr.fromBinary(h.payload), v = new ue({
11959
+ const h = yield (o = this.e2eeManager) === null || o === void 0 ? void 0 : o.handleEncryptedData(u.value.value.encryptedValue, u.value.value.iv, u.participantIdentity, u.value.value.keyIndex), m = Pr.fromBinary(h.payload), v = new le({
11960
11960
  value: m.value,
11961
11961
  participantIdentity: u.participantIdentity,
11962
11962
  participantSid: u.participantSid
@@ -12019,16 +12019,16 @@ class Rl extends je.EventEmitter {
12019
12019
  if (s)
12020
12020
  return s.bufferedAmount <= s.bufferedAmountLowThreshold;
12021
12021
  }, this.handleBrowserOnLine = () => f(this, void 0, void 0, function* () {
12022
- !this.url || !(yield fetch(Qt(this.url), {
12022
+ !this.url || !(yield fetch(Ht(this.url), {
12023
12023
  method: "HEAD"
12024
12024
  }).then((s) => s.ok).catch(() => !1)) || (this.log.info("detected network reconnected"), // in case the engine is currently reconnecting, attempt a reconnect immediately after the browser state has changed to 'onLine'
12025
12025
  (this.client.currentState === J.RECONNECTING || // also if the browser went offline before and the engine still thinks it's in a connected state, treat it as a network interruption that we haven't noticed yet
12026
- this.isWaitingForNetworkReconnect && this.client.currentState === J.CONNECTED) && (this.clearReconnectTimeout(), this.attemptReconnect(ot.RR_SIGNAL_DISCONNECTED), this.isWaitingForNetworkReconnect = !1));
12026
+ this.isWaitingForNetworkReconnect && this.client.currentState === J.CONNECTED) && (this.clearReconnectTimeout(), this.attemptReconnect(at.RR_SIGNAL_DISCONNECTED), this.isWaitingForNetworkReconnect = !1));
12027
12027
  }), this.handleBrowserOffline = () => f(this, void 0, void 0, function* () {
12028
12028
  if (this.url)
12029
12029
  try {
12030
12030
  yield Promise.race([
12031
- fetch(Qt(this.url), {
12031
+ fetch(Ht(this.url), {
12032
12032
  method: "HEAD"
12033
12033
  }),
12034
12034
  // if there's no internet connection the fetch rejects immediately, so we only use a short timeout here
@@ -12037,10 +12037,10 @@ class Rl extends je.EventEmitter {
12037
12037
  } catch {
12038
12038
  window.navigator.onLine === !1 && (this.log.info("detected network interruption"), this.isWaitingForNetworkReconnect = !0);
12039
12039
  }
12040
- }), this.log = He((t = e.loggerName) !== null && t !== void 0 ? t : Oe.Engine), this.loggerOptions = {
12040
+ }), this.log = Je((t = e.loggerName) !== null && t !== void 0 ? t : Oe.Engine), this.loggerOptions = {
12041
12041
  loggerName: e.loggerName,
12042
12042
  loggerContextCb: () => this.logContext
12043
- }, this.client = new Wn(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new he(), this.dataProcessLock = new he(), this.dcBufferStatus = /* @__PURE__ */ new Map([[j.LOSSY, !0], [j.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(w.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(w.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(w.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(w.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(w.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(w.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(w.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(w.SignalRequestResponse, i);
12043
+ }, this.client = new Wn(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new ue(), this.dataProcessLock = new ue(), this.dcBufferStatus = /* @__PURE__ */ new Map([[j.LOSSY, !0], [j.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(w.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(w.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(w.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(w.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(w.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(w.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(w.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(w.SignalRequestResponse, i);
12044
12044
  }
12045
12045
  /** @internal */
12046
12046
  get logContext() {
@@ -12111,7 +12111,7 @@ class Rl extends je.EventEmitter {
12111
12111
  }
12112
12112
  addTrack(e) {
12113
12113
  if (this.pendingTrackResolvers[e.cid])
12114
- throw new Je("a track with the same ID has already been published");
12114
+ throw new Ge("a track with the same ID has already been published");
12115
12115
  return new Promise((t, i) => {
12116
12116
  const s = setTimeout(() => {
12117
12117
  delete this.pendingTrackResolvers[e.cid], i(L.timeout("publication of local track timed out, no response from server"));
@@ -12180,7 +12180,7 @@ class Rl extends je.EventEmitter {
12180
12180
  if (this.log.debug("primary PC state changed ".concat(o), this.logContext), ["closed", "disconnected", "failed"].includes(a) && (this.publisherConnectionPromise = void 0), o === Y.CONNECTED) {
12181
12181
  const u = this.pcState === ke.New;
12182
12182
  this.pcState = ke.Connected, u && this.emit(w.Connected, e);
12183
- } else o === Y.FAILED && (this.pcState === ke.Connected || this.pcState === ke.Reconnecting) && (this.pcState = ke.Disconnected, this.handleDisconnect("peerconnection failed", c === "failed" ? ot.RR_SUBSCRIBER_FAILED : ot.RR_PUBLISHER_FAILED));
12183
+ } else o === Y.FAILED && (this.pcState === ke.Connected || this.pcState === ke.Reconnecting) && (this.pcState = ke.Disconnected, this.handleDisconnect("peerconnection failed", c === "failed" ? at.RR_SUBSCRIBER_FAILED : at.RR_PUBLISHER_FAILED));
12184
12184
  const d = this.client.isDisconnected || this.client.currentState === J.RECONNECTING, l = [Y.FAILED, Y.CLOSING, Y.CLOSED].includes(o);
12185
12185
  d && l && !this._isClosed && this.emit(w.Offline);
12186
12186
  }), this.pcManager.onTrack = (o) => {
@@ -12246,7 +12246,7 @@ class Rl extends je.EventEmitter {
12246
12246
  (i = this.pcManager) === null || i === void 0 || i.addPublisherTransceiverOfKind("video", s);
12247
12247
  this.negotiate();
12248
12248
  }, this.client.onClose = () => {
12249
- this.handleDisconnect("signal", ot.RR_SIGNAL_DISCONNECTED);
12249
+ this.handleDisconnect("signal", at.RR_SIGNAL_DISCONNECTED);
12250
12250
  }, this.client.onLeave = (e) => {
12251
12251
  switch (this.log.debug("client leave request", Object.assign(Object.assign({}, this.logContext), {
12252
12252
  reason: e?.reason
@@ -12255,13 +12255,13 @@ class Rl extends je.EventEmitter {
12255
12255
  maxAgeInMs: La,
12256
12256
  regionSettings: e.regions
12257
12257
  })), e.action) {
12258
- case kt.DISCONNECT:
12258
+ case bt.DISCONNECT:
12259
12259
  this.emit(w.Disconnected, e?.reason), this.close();
12260
12260
  break;
12261
- case kt.RECONNECT:
12261
+ case bt.RECONNECT:
12262
12262
  this.fullReconnectOnNext = !0, this.handleDisconnect(Yi);
12263
12263
  break;
12264
- case kt.RESUME:
12264
+ case bt.RESUME:
12265
12265
  this.handleDisconnect(Yi);
12266
12266
  }
12267
12267
  };
@@ -12278,7 +12278,7 @@ class Rl extends je.EventEmitter {
12278
12278
  r.username && (o.username = r.username), r.credential && (o.credential = r.credential), s.push(o);
12279
12279
  }), i.iceServers = s;
12280
12280
  }
12281
- return e.clientConfiguration && e.clientConfiguration.forceRelay === Gt.ENABLED && (i.iceTransportPolicy = "relay"), i.sdpSemantics = "unified-plan", i.continualGatheringPolicy = "gather_continually", i;
12281
+ return e.clientConfiguration && e.clientConfiguration.forceRelay === Wt.ENABLED && (i.iceTransportPolicy = "relay"), i.sdpSemantics = "unified-plan", i.continualGatheringPolicy = "gather_continually", i;
12282
12282
  }
12283
12283
  createDataChannels() {
12284
12284
  this.pcManager && (this.lossyDC && (this.lossyDC.onmessage = null, this.lossyDC.onerror = null), this.reliableDC && (this.reliableDC.onmessage = null, this.reliableDC.onerror = null), this.lossyDC = this.pcManager.createPublisherDataChannel(Zs, {
@@ -12301,7 +12301,7 @@ class Rl extends je.EventEmitter {
12301
12301
  return yield this.createTransceiverRTCRtpSender(e, t, i);
12302
12302
  if (gn())
12303
12303
  return this.log.warn("using add-track fallback", this.logContext), yield this.createRTCRtpSender(e.mediaStreamTrack);
12304
- throw new ee("Required webRTC APIs not supported on this device");
12304
+ throw new Z("Required webRTC APIs not supported on this device");
12305
12305
  });
12306
12306
  }
12307
12307
  createSimulcastSender(e, t, i, s) {
@@ -12310,15 +12310,15 @@ class Rl extends je.EventEmitter {
12310
12310
  return this.createSimulcastTransceiverSender(e, t, i, s);
12311
12311
  if (gn())
12312
12312
  return this.log.debug("using add-track fallback", this.logContext), this.createRTCRtpSender(e.mediaStreamTrack);
12313
- throw new ee("Cannot stream on this device");
12313
+ throw new Z("Cannot stream on this device");
12314
12314
  });
12315
12315
  }
12316
12316
  createTransceiverRTCRtpSender(e, t, i) {
12317
12317
  return f(this, void 0, void 0, function* () {
12318
12318
  if (!this.pcManager)
12319
- throw new ee("publisher is closed");
12319
+ throw new Z("publisher is closed");
12320
12320
  const s = [];
12321
- e.mediaStream && s.push(e.mediaStream), rt(e) && (e.codec = t.videoCodec);
12321
+ e.mediaStream && s.push(e.mediaStream), st(e) && (e.codec = t.videoCodec);
12322
12322
  const r = {
12323
12323
  direction: "sendonly",
12324
12324
  streams: s
@@ -12329,7 +12329,7 @@ class Rl extends je.EventEmitter {
12329
12329
  createSimulcastTransceiverSender(e, t, i, s) {
12330
12330
  return f(this, void 0, void 0, function* () {
12331
12331
  if (!this.pcManager)
12332
- throw new ee("publisher is closed");
12332
+ throw new Z("publisher is closed");
12333
12333
  const r = {
12334
12334
  direction: "sendonly"
12335
12335
  };
@@ -12342,7 +12342,7 @@ class Rl extends je.EventEmitter {
12342
12342
  createRTCRtpSender(e) {
12343
12343
  return f(this, void 0, void 0, function* () {
12344
12344
  if (!this.pcManager)
12345
- throw new ee("publisher is closed");
12345
+ throw new Z("publisher is closed");
12346
12346
  return this.pcManager.addPublisherTrack(e);
12347
12347
  });
12348
12348
  }
@@ -12354,7 +12354,7 @@ class Rl extends je.EventEmitter {
12354
12354
  F.warn("already attempting reconnect, returning early", this.logContext);
12355
12355
  return;
12356
12356
  }
12357
- (((t = this.clientConfiguration) === null || t === void 0 ? void 0 : t.resumeConnection) === Gt.DISABLED || // signaling state could change to closed due to hardware sleep
12357
+ (((t = this.clientConfiguration) === null || t === void 0 ? void 0 : t.resumeConnection) === Wt.DISABLED || // signaling state could change to closed due to hardware sleep
12358
12358
  // those connections cannot be resumed
12359
12359
  ((s = (i = this.pcManager) === null || i === void 0 ? void 0 : i.currentState) !== null && s !== void 0 ? s : Y.NEW) === Y.NEW) && (this.fullReconnectOnNext = !0);
12360
12360
  try {
@@ -12362,9 +12362,9 @@ class Rl extends je.EventEmitter {
12362
12362
  } catch (r) {
12363
12363
  this.reconnectAttempts += 1;
12364
12364
  let o = !0;
12365
- r instanceof ee ? (this.log.debug("received unrecoverable error", Object.assign(Object.assign({}, this.logContext), {
12365
+ r instanceof Z ? (this.log.debug("received unrecoverable error", Object.assign(Object.assign({}, this.logContext), {
12366
12366
  error: r
12367
- })), o = !1) : r instanceof pt || (this.fullReconnectOnNext = !0), o ? this.handleDisconnect("reconnect", ot.RR_UNKNOWN) : (this.log.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"), this.logContext), this.emit(w.Disconnected), yield this.close());
12367
+ })), o = !1) : r instanceof ft || (this.fullReconnectOnNext = !0), o ? this.handleDisconnect("reconnect", at.RR_UNKNOWN) : (this.log.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"), this.logContext), this.emit(w.Disconnected), yield this.close());
12368
12368
  } finally {
12369
12369
  this.attemptingReconnect = !1;
12370
12370
  }
@@ -12386,20 +12386,20 @@ class Rl extends je.EventEmitter {
12386
12386
  var t, i, s;
12387
12387
  try {
12388
12388
  if (!this.url || !this.token)
12389
- throw new ee("could not reconnect, url or token not saved");
12389
+ throw new Z("could not reconnect, url or token not saved");
12390
12390
  this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts), this.logContext), this.emit(w.Restarting), this.client.isDisconnected || (yield this.client.sendLeave()), yield this.cleanupPeerConnections(), yield this.cleanupClient();
12391
12391
  let r;
12392
12392
  try {
12393
12393
  if (!this.signalOpts)
12394
- throw this.log.warn("attempted connection restart, without signal options present", this.logContext), new pt();
12394
+ throw this.log.warn("attempted connection restart, without signal options present", this.logContext), new ft();
12395
12395
  r = yield this.join(e ?? this.url, this.token, this.signalOpts, void 0, !this.options.singlePeerConnection);
12396
12396
  } catch (o) {
12397
- throw o instanceof L && o.reason === H.NotAllowed ? new ee("could not reconnect, token might be expired") : new pt();
12397
+ throw o instanceof L && o.reason === H.NotAllowed ? new Z("could not reconnect, token might be expired") : new ft();
12398
12398
  }
12399
12399
  if (this.shouldFailNext)
12400
12400
  throw this.shouldFailNext = !1, new Error("simulated failure");
12401
12401
  if (this.client.setReconnected(), this.emit(w.SignalRestarted, r), yield this.waitForPCReconnected(), this.client.currentState !== J.CONNECTED)
12402
- throw new pt("Signal connection got severed during reconnect");
12402
+ throw new ft("Signal connection got severed during reconnect");
12403
12403
  (t = this.regionUrlProvider) === null || t === void 0 || t.resetAttempts(), this.emit(w.Restarted);
12404
12404
  } catch (r) {
12405
12405
  const o = yield (i = this.regionUrlProvider) === null || i === void 0 ? void 0 : i.getNextBestRegionUrl();
@@ -12415,9 +12415,9 @@ class Rl extends je.EventEmitter {
12415
12415
  return f(this, void 0, void 0, function* () {
12416
12416
  var t;
12417
12417
  if (!this.url || !this.token)
12418
- throw new ee("could not reconnect, url or token not saved");
12418
+ throw new Z("could not reconnect, url or token not saved");
12419
12419
  if (!this.pcManager)
12420
- throw new ee("publisher and subscriber connections unset");
12420
+ throw new Z("publisher and subscriber connections unset");
12421
12421
  this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts), this.logContext), this.emit(w.Resuming);
12422
12422
  let i;
12423
12423
  try {
@@ -12426,7 +12426,7 @@ class Rl extends je.EventEmitter {
12426
12426
  let r = "";
12427
12427
  throw s instanceof Error && (r = s.message, this.log.error(s.message, Object.assign(Object.assign({}, this.logContext), {
12428
12428
  error: s
12429
- }))), s instanceof L && s.reason === H.NotAllowed ? new ee("could not reconnect, token might be expired") : s instanceof L && s.reason === H.LeaveRequest ? s : new pt(r);
12429
+ }))), s instanceof L && s.reason === H.NotAllowed ? new Z("could not reconnect, token might be expired") : s instanceof L && s.reason === H.LeaveRequest ? s : new ft(r);
12430
12430
  }
12431
12431
  if (this.emit(w.SignalResumed), i) {
12432
12432
  const s = this.makeRTCConfiguration(i);
@@ -12436,14 +12436,14 @@ class Rl extends je.EventEmitter {
12436
12436
  if (this.shouldFailNext)
12437
12437
  throw this.shouldFailNext = !1, new Error("simulated failure");
12438
12438
  if (yield this.pcManager.triggerIceRestart(), yield this.waitForPCReconnected(), this.client.currentState !== J.CONNECTED)
12439
- throw new pt("Signal connection got severed during reconnect");
12439
+ throw new ft("Signal connection got severed during reconnect");
12440
12440
  this.client.setReconnected(), ((t = this.reliableDC) === null || t === void 0 ? void 0 : t.readyState) === "open" && this.reliableDC.id === null && this.createDataChannels(), i?.lastMessageSeq && this.resendReliableMessagesForResume(i.lastMessageSeq), this.emit(w.Resumed);
12441
12441
  });
12442
12442
  }
12443
12443
  waitForPCInitialConnection(e, t) {
12444
12444
  return f(this, void 0, void 0, function* () {
12445
12445
  if (!this.pcManager)
12446
- throw new ee("PC manager is closed");
12446
+ throw new Z("PC manager is closed");
12447
12447
  yield this.pcManager.ensurePCTransportConnection(t, e);
12448
12448
  });
12449
12449
  }
@@ -12452,7 +12452,7 @@ class Rl extends je.EventEmitter {
12452
12452
  this.pcState = ke.Reconnecting, this.log.debug("waiting for peer connection to reconnect", this.logContext);
12453
12453
  try {
12454
12454
  if (yield oe(Sl), !this.pcManager)
12455
- throw new ee("PC manager is closed");
12455
+ throw new Z("PC manager is closed");
12456
12456
  yield this.pcManager.ensurePCTransportConnection(void 0, this.peerConnectionTimeout), this.pcState = ke.Connected;
12457
12457
  } catch (e) {
12458
12458
  throw this.pcState = ke.Disconnected, L.internal("could not establish PC connection, ".concat(e.message));
@@ -12462,7 +12462,7 @@ class Rl extends je.EventEmitter {
12462
12462
  /** @internal */
12463
12463
  publishRpcResponse(e, t, i, s) {
12464
12464
  return f(this, void 0, void 0, function* () {
12465
- const r = new ue({
12465
+ const r = new le({
12466
12466
  destinationIdentities: [e],
12467
12467
  kind: j.RELIABLE,
12468
12468
  value: {
@@ -12485,7 +12485,7 @@ class Rl extends je.EventEmitter {
12485
12485
  /** @internal */
12486
12486
  publishRpcAck(e, t) {
12487
12487
  return f(this, void 0, void 0, function* () {
12488
- const i = new ue({
12488
+ const i = new le({
12489
12489
  destinationIdentities: [e],
12490
12490
  kind: j.RELIABLE,
12491
12491
  value: {
@@ -12551,7 +12551,7 @@ class Rl extends je.EventEmitter {
12551
12551
  if (this.isBufferStatusLow(e))
12552
12552
  t();
12553
12553
  else {
12554
- const s = () => i(new ee("engine closed"));
12554
+ const s = () => i(new Z("engine closed"));
12555
12555
  for (this.once(w.Closing, s); !this.dcBufferStatus.get(e); )
12556
12556
  yield oe(10);
12557
12557
  this.off(w.Closing, s), t();
@@ -12568,7 +12568,7 @@ class Rl extends je.EventEmitter {
12568
12568
  return (function* () {
12569
12569
  var r;
12570
12570
  if (!i.pcManager)
12571
- throw new ee("PC manager is closed");
12571
+ throw new Z("PC manager is closed");
12572
12572
  const o = s ? i.pcManager.subscriber : i.pcManager.publisher, a = s ? "Subscriber" : "Publisher";
12573
12573
  if (!o)
12574
12574
  throw L.internal("".concat(a, " connection not set"));
@@ -12603,14 +12603,14 @@ class Rl extends je.EventEmitter {
12603
12603
  return f(this, void 0, void 0, function* () {
12604
12604
  return new pe((e, t) => f(this, void 0, void 0, function* () {
12605
12605
  if (!this.pcManager) {
12606
- t(new St("PC manager is closed"));
12606
+ t(new kt("PC manager is closed"));
12607
12607
  return;
12608
12608
  }
12609
12609
  this.pcManager.requirePublisher(), this.pcManager.publisher.getTransceivers().length == 0 && !this.lossyDC && !this.reliableDC && this.createDataChannels();
12610
12610
  const i = new AbortController(), s = () => {
12611
12611
  i.abort(), this.log.debug("engine disconnected while negotiation was ongoing", this.logContext), e();
12612
12612
  };
12613
- this.isClosed && t(new St("cannot negotiate on closed engine")), this.on(w.Closing, s), this.pcManager.publisher.once(Rt.RTPVideoPayloadTypes, (r) => {
12613
+ this.isClosed && t(new kt("cannot negotiate on closed engine")), this.on(w.Closing, s), this.pcManager.publisher.once(Et.RTPVideoPayloadTypes, (r) => {
12614
12614
  const o = /* @__PURE__ */ new Map();
12615
12615
  r.forEach((a) => {
12616
12616
  const c = a.codec.toLowerCase();
@@ -12620,7 +12620,7 @@ class Rl extends je.EventEmitter {
12620
12620
  try {
12621
12621
  yield this.pcManager.negotiate(i), e();
12622
12622
  } catch (r) {
12623
- r instanceof St && (this.fullReconnectOnNext = !0), this.handleDisconnect("negotiation", ot.RR_UNKNOWN), r instanceof Error ? t(r) : t(new Error(String(r)));
12623
+ r instanceof kt && (this.fullReconnectOnNext = !0), this.handleDisconnect("negotiation", at.RR_UNKNOWN), r instanceof Error ? t(r) : t(new Error(String(r)));
12624
12624
  } finally {
12625
12625
  this.off(w.Closing, s);
12626
12626
  }
@@ -12651,17 +12651,17 @@ class Rl extends je.EventEmitter {
12651
12651
  e.forEach((v) => {
12652
12652
  v.isDesired !== u && h.push(v.trackSid), v.isEnabled || m.push(v.trackSid);
12653
12653
  }), this.client.sendSyncState(new Ln({
12654
- answer: this.pcManager.mode === "publisher-only" ? c ? bt({
12654
+ answer: this.pcManager.mode === "publisher-only" ? c ? gt({
12655
12655
  sdp: c.sdp,
12656
12656
  type: c.type
12657
- }) : void 0 : l ? bt({
12657
+ }) : void 0 : l ? gt({
12658
12658
  sdp: l.sdp,
12659
12659
  type: l.type
12660
12660
  }) : void 0,
12661
- offer: this.pcManager.mode === "publisher-only" ? a ? bt({
12661
+ offer: this.pcManager.mode === "publisher-only" ? a ? gt({
12662
12662
  sdp: a.sdp,
12663
12663
  type: a.type
12664
- }) : void 0 : d ? bt({
12664
+ }) : void 0 : d ? gt({
12665
12665
  sdp: d.sdp,
12666
12666
  type: d.type
12667
12667
  }) : void 0,
@@ -12736,9 +12736,9 @@ class Va {
12736
12736
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
12737
12737
  if (!(typeof this.totalByteSize != "number" || this.totalByteSize === 0)) {
12738
12738
  if (e && this.bytesReceived < this.totalByteSize)
12739
- throw new Te("Not enough chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, only received ").concat(this.bytesReceived, " bytes"), le.Incomplete);
12739
+ throw new Te("Not enough chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, only received ").concat(this.bytesReceived, " bytes"), de.Incomplete);
12740
12740
  if (this.bytesReceived > this.totalByteSize)
12741
- throw new Te("Extra chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, received ").concat(this.bytesReceived, " bytes"), le.LengthExceeded);
12741
+ throw new Te("Extra chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, received ").concat(this.bytesReceived, " bytes"), de.LengthExceeded);
12742
12742
  }
12743
12743
  }
12744
12744
  constructor(e, t, i, s) {
@@ -12822,7 +12822,7 @@ class wl extends Va {
12822
12822
  let a = /* @__PURE__ */ new Set();
12823
12823
  const c = t.signal ? e.withAbortSignal(t.signal) : e;
12824
12824
  try {
12825
- for (var d = !0, l = Ge(c), u; u = yield l.next(), i = u.done, !i; d = !0) {
12825
+ for (var d = !0, l = Ke(c), u; u = yield l.next(), i = u.done, !i; d = !0) {
12826
12826
  o = u.value, d = !1;
12827
12827
  const h = o;
12828
12828
  a.add(h);
@@ -12906,7 +12906,7 @@ class Il extends Va {
12906
12906
  try {
12907
12907
  u = t.decode(l.content);
12908
12908
  } catch (h) {
12909
- throw new Te("Cannot decode datastream chunk ".concat(l.chunkIndex, " as text: ").concat(h), le.DecodeFailed);
12909
+ throw new Te("Cannot decode datastream chunk ".concat(l.chunkIndex, " as text: ").concat(h), de.DecodeFailed);
12910
12910
  }
12911
12911
  return {
12912
12912
  done: !1,
@@ -12948,7 +12948,7 @@ class Il extends Va {
12948
12948
  let a = "";
12949
12949
  const c = t.signal ? e.withAbortSignal(t.signal) : e;
12950
12950
  try {
12951
- for (var d = !0, l = Ge(c), u; u = yield l.next(), i = u.done, !i; d = !0)
12951
+ for (var d = !0, l = Ke(c), u; u = yield l.next(), i = u.done, !i; d = !0)
12952
12952
  o = u.value, d = !1, a += o;
12953
12953
  } catch (h) {
12954
12954
  s = {
@@ -12972,7 +12972,7 @@ class Ol {
12972
12972
  }
12973
12973
  registerTextStreamHandler(e, t) {
12974
12974
  if (this.textStreamHandlers.has(e))
12975
- throw new Te('A text stream handler for topic "'.concat(e, '" has already been set.'), le.HandlerAlreadyRegistered);
12975
+ throw new Te('A text stream handler for topic "'.concat(e, '" has already been set.'), de.HandlerAlreadyRegistered);
12976
12976
  this.textStreamHandlers.set(e, t);
12977
12977
  }
12978
12978
  unregisterTextStreamHandler(e) {
@@ -12980,7 +12980,7 @@ class Ol {
12980
12980
  }
12981
12981
  registerByteStreamHandler(e, t) {
12982
12982
  if (this.byteStreamHandlers.has(e))
12983
- throw new Te('A byte stream handler for topic "'.concat(e, '" has already been set.'), le.HandlerAlreadyRegistered);
12983
+ throw new Te('A byte stream handler for topic "'.concat(e, '" has already been set.'), de.HandlerAlreadyRegistered);
12984
12984
  this.byteStreamHandlers.set(e, t);
12985
12985
  }
12986
12986
  unregisterByteStreamHandler(e) {
@@ -12993,7 +12993,7 @@ class Ol {
12993
12993
  var t, i, s, r;
12994
12994
  const o = Array.from(this.textStreamControllers.entries()).filter((c) => c[1].sendingParticipantIdentity === e), a = Array.from(this.byteStreamControllers.entries()).filter((c) => c[1].sendingParticipantIdentity === e);
12995
12995
  if (o.length > 0 || a.length > 0) {
12996
- const c = new Te("Participant ".concat(e, " unexpectedly disconnected in the middle of sending data"), le.AbnormalEnd);
12996
+ const c = new Te("Participant ".concat(e, " unexpectedly disconnected in the middle of sending data"), de.AbnormalEnd);
12997
12997
  for (const [d, l] of a)
12998
12998
  (i = (t = l.outOfBandFailureRejectingFuture).reject) === null || i === void 0 || i.call(t, c), this.byteStreamControllers.delete(d);
12999
12999
  for (const [d, l] of o)
@@ -13040,7 +13040,7 @@ class Ol {
13040
13040
  }, d = new ReadableStream({
13041
13041
  start: (l) => {
13042
13042
  if (o = l, this.textStreamControllers.has(e.streamId))
13043
- throw new Te("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), le.AlreadyOpened);
13043
+ throw new Te("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), de.AlreadyOpened);
13044
13044
  this.byteStreamControllers.set(e.streamId, {
13045
13045
  info: c,
13046
13046
  controller: o,
@@ -13075,7 +13075,7 @@ class Ol {
13075
13075
  }, d = new ReadableStream({
13076
13076
  start: (l) => {
13077
13077
  if (o = l, this.textStreamControllers.has(e.streamId))
13078
- throw new Te("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), le.AlreadyOpened);
13078
+ throw new Te("A data stream read is already in progress for a stream with id ".concat(e.streamId, "."), de.AlreadyOpened);
13079
13079
  this.textStreamControllers.set(e.streamId, {
13080
13080
  info: c,
13081
13081
  controller: o,
@@ -13093,15 +13093,15 @@ class Ol {
13093
13093
  }
13094
13094
  handleStreamChunk(e, t) {
13095
13095
  const i = this.byteStreamControllers.get(e.streamId);
13096
- i && (i.info.encryptionType !== t ? (i.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), le.EncryptionTypeMismatch)), this.byteStreamControllers.delete(e.streamId)) : e.content.length > 0 && i.controller.enqueue(e));
13096
+ i && (i.info.encryptionType !== t ? (i.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), de.EncryptionTypeMismatch)), this.byteStreamControllers.delete(e.streamId)) : e.content.length > 0 && i.controller.enqueue(e));
13097
13097
  const s = this.textStreamControllers.get(e.streamId);
13098
- s && (s.info.encryptionType !== t ? (s.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), le.EncryptionTypeMismatch)), this.textStreamControllers.delete(e.streamId)) : e.content.length > 0 && s.controller.enqueue(e));
13098
+ s && (s.info.encryptionType !== t ? (s.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), de.EncryptionTypeMismatch)), this.textStreamControllers.delete(e.streamId)) : e.content.length > 0 && s.controller.enqueue(e));
13099
13099
  }
13100
13100
  handleStreamTrailer(e, t) {
13101
13101
  const i = this.textStreamControllers.get(e.streamId);
13102
- i && (i.info.encryptionType !== t ? i.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), le.EncryptionTypeMismatch)) : (i.info.attributes = Object.assign(Object.assign({}, i.info.attributes), e.attributes), i.controller.close(), this.textStreamControllers.delete(e.streamId)));
13102
+ i && (i.info.encryptionType !== t ? i.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(i.info.encryptionType), de.EncryptionTypeMismatch)) : (i.info.attributes = Object.assign(Object.assign({}, i.info.attributes), e.attributes), i.controller.close(), this.textStreamControllers.delete(e.streamId)));
13103
13103
  const s = this.byteStreamControllers.get(e.streamId);
13104
- s && (s.info.encryptionType !== t ? s.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), le.EncryptionTypeMismatch)) : (s.info.attributes = Object.assign(Object.assign({}, s.info.attributes), e.attributes), s.controller.close()), this.byteStreamControllers.delete(e.streamId));
13104
+ s && (s.info.encryptionType !== t ? s.controller.error(new Te("Encryption type mismatch for stream ".concat(e.streamId, ". Expected ").concat(t, ", got ").concat(s.info.encryptionType), de.EncryptionTypeMismatch)) : (s.info.attributes = Object.assign(Object.assign({}, s.info.attributes), e.attributes), s.controller.close()), this.byteStreamControllers.delete(e.streamId));
13105
13105
  }
13106
13106
  }
13107
13107
  class qa {
@@ -13176,8 +13176,8 @@ class xl {
13176
13176
  streamId: r,
13177
13177
  mimeType: o.mimeType,
13178
13178
  topic: o.topic,
13179
- timestamp: ct(o.timestamp),
13180
- totalLength: ct(e?.totalSize),
13179
+ timestamp: ot(o.timestamp),
13180
+ totalLength: ot(e?.totalSize),
13181
13181
  attributes: o.attributes,
13182
13182
  contentHeader: {
13183
13183
  case: "textHeader",
@@ -13188,7 +13188,7 @@ class xl {
13188
13188
  operationType: e?.type === "update" ? en.UPDATE : en.CREATE
13189
13189
  })
13190
13190
  }
13191
- }), c = e?.destinationIdentities, d = new ue({
13191
+ }), c = e?.destinationIdentities, d = new le({
13192
13192
  destinationIdentities: c,
13193
13193
  value: {
13194
13194
  case: "streamHeader",
@@ -13205,8 +13205,8 @@ class xl {
13205
13205
  const k = new vi({
13206
13206
  content: P,
13207
13207
  streamId: r,
13208
- chunkIndex: ct(l)
13209
- }), O = new ue({
13208
+ chunkIndex: ot(l)
13209
+ }), O = new le({
13210
13210
  destinationIdentities: c,
13211
13211
  value: {
13212
13212
  case: "streamChunk",
@@ -13221,7 +13221,7 @@ class xl {
13221
13221
  return f(this, void 0, void 0, function* () {
13222
13222
  const p = new bi({
13223
13223
  streamId: r
13224
- }), P = new ue({
13224
+ }), P = new le({
13225
13225
  destinationIdentities: c,
13226
13226
  value: {
13227
13227
  case: "streamTrailer",
@@ -13287,11 +13287,11 @@ class xl {
13287
13287
  name: (r = e?.name) !== null && r !== void 0 ? r : "unknown",
13288
13288
  encryptionType: !((o = this.engine.e2eeManager) === null || o === void 0) && o.isDataChannelEncryptionEnabled ? ne.GCM : ne.NONE
13289
13289
  }, u = new gi({
13290
- totalLength: ct((a = l.size) !== null && a !== void 0 ? a : 0),
13290
+ totalLength: ot((a = l.size) !== null && a !== void 0 ? a : 0),
13291
13291
  mimeType: l.mimeType,
13292
13292
  streamId: c,
13293
13293
  topic: l.topic,
13294
- timestamp: ct(Date.now()),
13294
+ timestamp: ot(Date.now()),
13295
13295
  attributes: l.attributes,
13296
13296
  contentHeader: {
13297
13297
  case: "byteHeader",
@@ -13299,7 +13299,7 @@ class xl {
13299
13299
  name: l.name
13300
13300
  })
13301
13301
  }
13302
- }), h = new ue({
13302
+ }), h = new le({
13303
13303
  destinationIdentities: d,
13304
13304
  value: {
13305
13305
  case: "streamHeader",
@@ -13308,21 +13308,21 @@ class xl {
13308
13308
  });
13309
13309
  yield this.engine.sendDataPacket(h, j.RELIABLE);
13310
13310
  let m = 0;
13311
- const v = new he(), p = this.engine, P = this.log, k = new WritableStream({
13311
+ const v = new ue(), p = this.engine, P = this.log, k = new WritableStream({
13312
13312
  write(M) {
13313
13313
  return f(this, void 0, void 0, function* () {
13314
13314
  const b = yield v.lock();
13315
13315
  let y = 0;
13316
13316
  try {
13317
13317
  for (; y < M.byteLength; ) {
13318
- const C = M.slice(y, y + ir), x = new ue({
13318
+ const C = M.slice(y, y + ir), x = new le({
13319
13319
  destinationIdentities: d,
13320
13320
  value: {
13321
13321
  case: "streamChunk",
13322
13322
  value: new vi({
13323
13323
  content: C,
13324
13324
  streamId: c,
13325
- chunkIndex: ct(m)
13325
+ chunkIndex: ot(m)
13326
13326
  })
13327
13327
  }
13328
13328
  });
@@ -13337,7 +13337,7 @@ class xl {
13337
13337
  return f(this, void 0, void 0, function* () {
13338
13338
  const M = new bi({
13339
13339
  streamId: c
13340
- }), b = new ue({
13340
+ }), b = new le({
13341
13341
  destinationIdentities: d,
13342
13342
  value: {
13343
13343
  case: "streamTrailer",
@@ -13453,7 +13453,7 @@ class Al extends Wa {
13453
13453
  var t;
13454
13454
  for (const i of this.attachedElements)
13455
13455
  this.audioContext ? (t = this.gainNode) === null || t === void 0 || t.gain.setTargetAtTime(e, 0, 0.1) : i.volume = e;
13456
- Ue() && this._mediaStreamTrack._setVolume(e), this.elementVolume = e;
13456
+ Ne() && this._mediaStreamTrack._setVolume(e), this.elementVolume = e;
13457
13457
  }
13458
13458
  /**
13459
13459
  * gets the volume of attached audio elements (loudest)
@@ -13461,7 +13461,7 @@ class Al extends Wa {
13461
13461
  getVolume() {
13462
13462
  if (this.elementVolume)
13463
13463
  return this.elementVolume;
13464
- if (Ue())
13464
+ if (Ne())
13465
13465
  return 1;
13466
13466
  let e = 0;
13467
13467
  return this.attachedElements.forEach((t) => {
@@ -13573,7 +13573,7 @@ class Nl extends Wa {
13573
13573
  /** @internal */
13574
13574
  setMuted(e) {
13575
13575
  super.setMuted(e), this.attachedElements.forEach((t) => {
13576
- e ? Ct(this._mediaStreamTrack, t) : vt(this._mediaStreamTrack, t);
13576
+ e ? Tt(this._mediaStreamTrack, t) : pt(this._mediaStreamTrack, t);
13577
13577
  });
13578
13578
  }
13579
13579
  attach(e) {
@@ -13713,14 +13713,14 @@ class Ll {
13713
13713
  target: r,
13714
13714
  isIntersecting: o
13715
13715
  } = i;
13716
- r === this.element && (this.isIntersecting = o, this.isPiP = Ft(this.element), this.visibilityChangedAt = Date.now(), (s = this.handleVisibilityChanged) === null || s === void 0 || s.call(this));
13716
+ r === this.element && (this.isIntersecting = o, this.isPiP = Lt(this.element), this.visibilityChangedAt = Date.now(), (s = this.handleVisibilityChanged) === null || s === void 0 || s.call(this));
13717
13717
  }, this.onEnterPiP = () => {
13718
13718
  var i, s, r;
13719
- (s = (i = window.documentPictureInPicture) === null || i === void 0 ? void 0 : i.window) === null || s === void 0 || s.addEventListener("pagehide", this.onLeavePiP), this.isPiP = Ft(this.element), (r = this.handleVisibilityChanged) === null || r === void 0 || r.call(this);
13719
+ (s = (i = window.documentPictureInPicture) === null || i === void 0 ? void 0 : i.window) === null || s === void 0 || s.addEventListener("pagehide", this.onLeavePiP), this.isPiP = Lt(this.element), (r = this.handleVisibilityChanged) === null || r === void 0 || r.call(this);
13720
13720
  }, this.onLeavePiP = () => {
13721
13721
  var i;
13722
- this.isPiP = Ft(this.element), (i = this.handleVisibilityChanged) === null || i === void 0 || i.call(this);
13723
- }, this.element = e, this.isIntersecting = t ?? Cn(e), this.isPiP = ge() && Ft(e), this.visibilityChangedAt = 0;
13722
+ this.isPiP = Lt(this.element), (i = this.handleVisibilityChanged) === null || i === void 0 || i.call(this);
13723
+ }, this.element = e, this.isIntersecting = t ?? Cn(e), this.isPiP = ge() && Lt(e), this.visibilityChangedAt = 0;
13724
13724
  }
13725
13725
  width() {
13726
13726
  return this.element.clientWidth;
@@ -13730,7 +13730,7 @@ class Ll {
13730
13730
  }
13731
13731
  observe() {
13732
13732
  var e, t, i;
13733
- this.isIntersecting = Cn(this.element), this.isPiP = Ft(this.element), this.element.handleResize = () => {
13733
+ this.isIntersecting = Cn(this.element), this.isPiP = Lt(this.element), this.element.handleResize = () => {
13734
13734
  var s;
13735
13735
  (s = this.handleResize) === null || s === void 0 || s.call(this);
13736
13736
  }, this.element.handleVisibilityChanged = this.onVisibilityChanged, Ms().observe(this.element), Ds().observe(this.element), this.element.addEventListener("enterpictureinpicture", this.onEnterPiP), this.element.addEventListener("leavepictureinpicture", this.onLeavePiP), (e = window.documentPictureInPicture) === null || e === void 0 || e.addEventListener("enter", this.onEnterPiP), (i = (t = window.documentPictureInPicture) === null || t === void 0 ? void 0 : t.window) === null || i === void 0 || i.addEventListener("pagehide", this.onLeavePiP);
@@ -13740,7 +13740,7 @@ class Ll {
13740
13740
  (e = Ms()) === null || e === void 0 || e.unobserve(this.element), (t = Ds()) === null || t === void 0 || t.unobserve(this.element), this.element.removeEventListener("enterpictureinpicture", this.onEnterPiP), this.element.removeEventListener("leavepictureinpicture", this.onLeavePiP), (i = window.documentPictureInPicture) === null || i === void 0 || i.removeEventListener("enter", this.onEnterPiP), (r = (s = window.documentPictureInPicture) === null || s === void 0 ? void 0 : s.window) === null || r === void 0 || r.removeEventListener("pagehide", this.onLeavePiP);
13741
13741
  }
13742
13742
  }
13743
- function Ft(n) {
13743
+ function Lt(n) {
13744
13744
  var e, t;
13745
13745
  return document.pictureInPictureElement === n ? !0 : !((e = window.documentPictureInPicture) === null || e === void 0) && e.window ? Cn(n, (t = window.documentPictureInPicture) === null || t === void 0 ? void 0 : t.window) : !1;
13746
13746
  }
@@ -13756,14 +13756,14 @@ function Cn(n, e) {
13756
13756
  n = n.offsetParent, i += n.offsetTop, s += n.offsetLeft;
13757
13757
  return i < t.pageYOffset + t.innerHeight && s < t.pageXOffset + t.innerWidth && i + o > t.pageYOffset && s + r > t.pageXOffset && !a && c !== "none";
13758
13758
  }
13759
- class qe extends je.EventEmitter {
13759
+ class Ve extends Ue.EventEmitter {
13760
13760
  constructor(e, t, i, s) {
13761
13761
  var r;
13762
13762
  super(), this.metadataMuted = !1, this.encryption = ne.NONE, this.log = F, this.handleMuted = () => {
13763
13763
  this.emit(R.Muted);
13764
13764
  }, this.handleUnmuted = () => {
13765
13765
  this.emit(R.Unmuted);
13766
- }, this.log = He((r = s?.loggerName) !== null && r !== void 0 ? r : Oe.Publication), this.loggerContextCb = this.loggerContextCb, this.setMaxListeners(100), this.kind = e, this.trackSid = t, this.trackName = i, this.source = T.Source.Unknown;
13766
+ }, this.log = Je((r = s?.loggerName) !== null && r !== void 0 ? r : Oe.Publication), this.loggerContextCb = this.loggerContextCb, this.setMaxListeners(100), this.kind = e, this.trackSid = t, this.trackName = i, this.source = T.Source.Unknown;
13767
13767
  }
13768
13768
  /** @internal */
13769
13769
  setTrack(e) {
@@ -13789,14 +13789,14 @@ class qe extends je.EventEmitter {
13789
13789
  * an [AudioTrack] if this publication holds an audio track
13790
13790
  */
13791
13791
  get audioTrack() {
13792
- if (Le(this.track))
13792
+ if (Ae(this.track))
13793
13793
  return this.track;
13794
13794
  }
13795
13795
  /**
13796
13796
  * an [VideoTrack] if this publication holds a video track
13797
13797
  */
13798
13798
  get videoTrack() {
13799
- if (rt(this.track))
13799
+ if (st(this.track))
13800
13800
  return this.track;
13801
13801
  }
13802
13802
  /** @internal */
@@ -13815,8 +13815,8 @@ class qe extends je.EventEmitter {
13815
13815
  })(n.SubscriptionStatus || (n.SubscriptionStatus = {})), (function(e) {
13816
13816
  e.Allowed = "allowed", e.NotAllowed = "not_allowed";
13817
13817
  })(n.PermissionStatus || (n.PermissionStatus = {}));
13818
- })(qe || (qe = {}));
13819
- class En extends qe {
13818
+ })(Ve || (Ve = {}));
13819
+ class En extends Ve {
13820
13820
  get isUpstreamPaused() {
13821
13821
  var e;
13822
13822
  return (e = this.track) === null || e === void 0 ? void 0 : e.isUpstreamPaused;
@@ -13825,7 +13825,7 @@ class En extends qe {
13825
13825
  super(e, t.sid, t.name, s), this.track = void 0, this.handleTrackEnded = () => {
13826
13826
  this.emit(R.Ended);
13827
13827
  }, this.handleCpuConstrained = () => {
13828
- this.track && rt(this.track) && this.emit(R.CpuConstrained, this.track);
13828
+ this.track && st(this.track) && this.emit(R.CpuConstrained, this.track);
13829
13829
  }, this.updateInfo(t), this.setTrack(i);
13830
13830
  }
13831
13831
  setTrack(e) {
@@ -13884,7 +13884,7 @@ class En extends qe {
13884
13884
  }
13885
13885
  getTrackFeatures() {
13886
13886
  var e;
13887
- if (Le(this.track)) {
13887
+ if (Ae(this.track)) {
13888
13888
  const t = this.track.getSourceTrackSettings(), i = /* @__PURE__ */ new Set();
13889
13889
  return t.autoGainControl && i.add(se.TF_AUTO_GAIN_CONTROL), t.echoCancellation && i.add(se.TF_ECHO_CANCELLATION), t.noiseSuppression && i.add(se.TF_NOISE_SUPPRESSION), t.channelCount && t.channelCount > 1 && i.add(se.TF_STEREO), !((e = this.options) === null || e === void 0) && e.dtx || i.add(se.TF_NO_DTX), this.track.enhancedNoiseCancellation && i.add(se.TF_ENHANCED_NOISE_CANCELLATION), Array.from(i.values());
13890
13890
  } else return [];
@@ -13939,11 +13939,11 @@ function Di(n, e) {
13939
13939
  const P = m ? d.audio : d.video;
13940
13940
  typeof P != "boolean" && (p = P);
13941
13941
  const k = h.getSettings().deviceId;
13942
- p?.deviceId && tt(p.deviceId) !== k ? p.deviceId = k : p || (p = {
13942
+ p?.deviceId && et(p.deviceId) !== k ? p.deviceId = k : p || (p = {
13943
13943
  deviceId: k
13944
13944
  });
13945
13945
  const O = ll(h, p, e);
13946
- return O.kind === T.Kind.Video ? O.source = T.Source.Camera : O.kind === T.Kind.Audio && (O.source = T.Source.Microphone), O.mediaStream = u, Le(O) && i ? yield O.setProcessor(i) : rt(O) && s && (yield O.setProcessor(s)), O;
13946
+ return O.kind === T.Kind.Video ? O.source = T.Source.Camera : O.kind === T.Kind.Audio && (O.source = T.Source.Microphone), O.mediaStream = u, Ae(O) && i ? yield O.setProcessor(i) : st(O) && s && (yield O.setProcessor(s)), O;
13947
13947
  })));
13948
13948
  } catch (u) {
13949
13949
  if (!t)
@@ -13971,25 +13971,25 @@ function Ka(n) {
13971
13971
  }))[0];
13972
13972
  });
13973
13973
  }
13974
- var $e;
13974
+ var Xe;
13975
13975
  (function(n) {
13976
13976
  n.Excellent = "excellent", n.Good = "good", n.Poor = "poor", n.Lost = "lost", n.Unknown = "unknown";
13977
- })($e || ($e = {}));
13977
+ })(Xe || (Xe = {}));
13978
13978
  function Fl(n) {
13979
13979
  switch (n) {
13980
- case jt.EXCELLENT:
13981
- return $e.Excellent;
13982
- case jt.GOOD:
13983
- return $e.Good;
13984
- case jt.POOR:
13985
- return $e.Poor;
13986
- case jt.LOST:
13987
- return $e.Lost;
13980
+ case Ut.EXCELLENT:
13981
+ return Xe.Excellent;
13982
+ case Ut.GOOD:
13983
+ return Xe.Good;
13984
+ case Ut.POOR:
13985
+ return Xe.Poor;
13986
+ case Ut.LOST:
13987
+ return Xe.Lost;
13988
13988
  default:
13989
- return $e.Unknown;
13989
+ return Xe.Unknown;
13990
13990
  }
13991
13991
  }
13992
- class Ga extends je.EventEmitter {
13992
+ class Ga extends Ue.EventEmitter {
13993
13993
  get logContext() {
13994
13994
  var e, t;
13995
13995
  return Object.assign({}, (t = (e = this.loggerOptions) === null || e === void 0 ? void 0 : e.loggerContextCb) === null || t === void 0 ? void 0 : t.call(e));
@@ -13999,11 +13999,11 @@ class Ga extends je.EventEmitter {
13999
13999
  }
14000
14000
  get isAgent() {
14001
14001
  var e;
14002
- return ((e = this.permissions) === null || e === void 0 ? void 0 : e.agent) || this.kind === wt.AGENT;
14002
+ return ((e = this.permissions) === null || e === void 0 ? void 0 : e.agent) || this.kind === Rt.AGENT;
14003
14003
  }
14004
14004
  get isActive() {
14005
14005
  var e;
14006
- return ((e = this.participantInfo) === null || e === void 0 ? void 0 : e.state) === yt.ACTIVE;
14006
+ return ((e = this.participantInfo) === null || e === void 0 ? void 0 : e.state) === vt.ACTIVE;
14007
14007
  }
14008
14008
  get kind() {
14009
14009
  return this._kind;
@@ -14014,9 +14014,9 @@ class Ga extends je.EventEmitter {
14014
14014
  }
14015
14015
  /** @internal */
14016
14016
  constructor(e, t, i, s, r, o) {
14017
- let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : wt.STANDARD;
14017
+ let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : Rt.STANDARD;
14018
14018
  var c;
14019
- super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = $e.Unknown, this.log = F, this.log = He((c = o?.loggerName) !== null && c !== void 0 ? c : Oe.Participant), this.loggerOptions = o, this.setMaxListeners(100), this.sid = e, this.identity = t, this.name = i, this.metadata = s, this.audioTrackPublications = /* @__PURE__ */ new Map(), this.videoTrackPublications = /* @__PURE__ */ new Map(), this.trackPublications = /* @__PURE__ */ new Map(), this._kind = a, this._attributes = r ?? {};
14019
+ super(), this.audioLevel = 0, this.isSpeaking = !1, this._connectionQuality = Xe.Unknown, this.log = F, this.log = Je((c = o?.loggerName) !== null && c !== void 0 ? c : Oe.Participant), this.loggerOptions = o, this.setMaxListeners(100), this.sid = e, this.identity = t, this.name = i, this.metadata = s, this.audioTrackPublications = /* @__PURE__ */ new Map(), this.videoTrackPublications = /* @__PURE__ */ new Map(), this.trackPublications = /* @__PURE__ */ new Map(), this._kind = a, this._attributes = r ?? {};
14020
14020
  }
14021
14021
  getTrackPublications() {
14022
14022
  return Array.from(this.trackPublications.values());
@@ -14074,7 +14074,7 @@ class Ga extends je.EventEmitter {
14074
14074
  /** @internal */
14075
14075
  updateInfo(e) {
14076
14076
  var t;
14077
- return this.participantInfo && this.participantInfo.sid === e.sid && this.participantInfo.version > e.version ? !1 : (this.identity = e.identity, this.sid = e.sid, this._setName(e.name), this._setMetadata(e.metadata), this._setAttributes(e.attributes), e.state === yt.ACTIVE && ((t = this.participantInfo) === null || t === void 0 ? void 0 : t.state) !== yt.ACTIVE && this.emit(I.Active), e.permission && this.setPermissions(e.permission), this.participantInfo = e, !0);
14077
+ return this.participantInfo && this.participantInfo.sid === e.sid && this.participantInfo.version > e.version ? !1 : (this.identity = e.identity, this.sid = e.sid, this._setName(e.name), this._setMetadata(e.metadata), this._setAttributes(e.attributes), e.state === vt.ACTIVE && ((t = this.participantInfo) === null || t === void 0 ? void 0 : t.state) !== vt.ACTIVE && this.emit(I.Active), e.permission && this.setPermissions(e.permission), this.participantInfo = e, !0);
14078
14078
  }
14079
14079
  /**
14080
14080
  * Updates metadata from server
@@ -14123,7 +14123,7 @@ class Ga extends je.EventEmitter {
14123
14123
  * @internal
14124
14124
  */
14125
14125
  setAudioContext(e) {
14126
- this.audioContext = e, this.audioTrackPublications.forEach((t) => Le(t.track) && t.track.setAudioContext(e));
14126
+ this.audioContext = e, this.audioTrackPublications.forEach((t) => Ae(t.track) && t.track.setAudioContext(e));
14127
14127
  }
14128
14128
  addTrackPublication(e) {
14129
14129
  e.on(R.Muted, () => {
@@ -14229,7 +14229,7 @@ class Bl extends Ga {
14229
14229
  return;
14230
14230
  const v = yield m.videoTrack.setPublishingCodecs(a.subscribedCodecs);
14231
14231
  try {
14232
- for (var p = !0, P = Ge(v), k; k = yield P.next(), c = k.done, !c; p = !0) {
14232
+ for (var p = !0, P = Ke(v), k; k = yield P.next(), c = k.done, !c; p = !0) {
14233
14233
  u = k.value, p = !1;
14234
14234
  const O = u;
14235
14235
  $c(O) && (this.log.debug("publish ".concat(O, " for ").concat(m.videoTrack.sid), Object.assign(Object.assign({}, this.logContext), B(m))), yield this.publishAdditionalCodecForTrack(m.videoTrack, O, m.options));
@@ -14259,7 +14259,7 @@ class Bl extends Ga {
14259
14259
  this.log.debug("unpublishing local track due to TrackEnded", Object.assign(Object.assign({}, this.logContext), B(a))), this.unpublishTrack(a);
14260
14260
  else if (a.isUserProvided)
14261
14261
  yield a.mute();
14262
- else if (Ve(a) || Ye(a))
14262
+ else if (Be(a) || Qe(a))
14263
14263
  try {
14264
14264
  if (ge())
14265
14265
  try {
@@ -14274,7 +14274,7 @@ class Bl extends Ga {
14274
14274
  }, new Error("GetUserMedia Permission denied");
14275
14275
  } catch {
14276
14276
  }
14277
- a.isMuted || (this.log.debug("track ended, attempting to use a different device", Object.assign(Object.assign({}, this.logContext), B(a))), Ve(a) ? yield a.restartTrack({
14277
+ a.isMuted || (this.log.debug("track ended, attempting to use a different device", Object.assign(Object.assign({}, this.logContext), B(a))), Be(a) ? yield a.restartTrack({
14278
14278
  deviceId: "default"
14279
14279
  }) : yield a.restartTrack());
14280
14280
  } catch {
@@ -14459,7 +14459,7 @@ class Bl extends Ga {
14459
14459
  c = yield this.createScreenTracks(Object.assign({}, i));
14460
14460
  break;
14461
14461
  default:
14462
- throw new Je(e);
14462
+ throw new Ge(e);
14463
14463
  }
14464
14464
  } catch (d) {
14465
14465
  throw c?.forEach((l) => {
@@ -14468,7 +14468,7 @@ class Bl extends Ga {
14468
14468
  }
14469
14469
  for (const d of c) {
14470
14470
  const l = Object.assign(Object.assign({}, this.roomOptions.publishDefaults), i);
14471
- e === T.Source.Microphone && Le(d) && l.preConnectBuffer && (this.log.info("starting preconnect buffer for microphone", Object.assign({}, this.logContext)), d.startPreConnectBuffer());
14471
+ e === T.Source.Microphone && Ae(d) && l.preConnectBuffer && (this.log.info("starting preconnect buffer for microphone", Object.assign({}, this.logContext)), d.startPreConnectBuffer());
14472
14472
  }
14473
14473
  try {
14474
14474
  const d = [];
@@ -14529,7 +14529,7 @@ class Bl extends Ga {
14529
14529
  return (yield Di(s, {
14530
14530
  loggerName: this.roomOptions.loggerName,
14531
14531
  loggerContextCb: () => this.logContext
14532
- })).map((a) => (Le(a) && (this.microphoneError = void 0, a.setAudioContext(this.audioContext), a.source = T.Source.Microphone, this.emit(I.AudioStreamAcquired)), rt(a) && (this.cameraError = void 0, a.source = T.Source.Camera), a));
14532
+ })).map((a) => (Ae(a) && (this.microphoneError = void 0, a.setAudioContext(this.audioContext), a.source = T.Source.Microphone, this.emit(I.AudioStreamAcquired)), st(a) && (this.cameraError = void 0, a.source = T.Source.Camera), a));
14533
14533
  } catch (r) {
14534
14534
  throw r instanceof Error && (e.audio && (this.microphoneError = r), e.video && (this.cameraError = r)), r;
14535
14535
  }
@@ -14547,7 +14547,7 @@ class Bl extends Ga {
14547
14547
  e.resolution === void 0 && !hd() && (e.resolution = Bn.h1080fps30.resolution);
14548
14548
  const t = ed(e), i = yield navigator.mediaDevices.getDisplayMedia(t), s = i.getVideoTracks();
14549
14549
  if (s.length === 0)
14550
- throw new Je("no video track found");
14550
+ throw new Ge("no video track found");
14551
14551
  const r = new Ti(s[0], void 0, !1, {
14552
14552
  loggerName: this.roomOptions.loggerName,
14553
14553
  loggerContextCb: () => this.logContext
@@ -14581,7 +14581,7 @@ class Bl extends Ga {
14581
14581
  let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
14582
14582
  return (function* () {
14583
14583
  var a, c, d, l;
14584
- Ve(i) && i.setAudioContext(r.audioContext), yield (a = r.reconnectFuture) === null || a === void 0 ? void 0 : a.promise, r.republishPromise && !o && (yield r.republishPromise), Et(i) && r.pendingPublishPromises.has(i) && (yield r.pendingPublishPromises.get(i));
14584
+ Be(i) && i.setAudioContext(r.audioContext), yield (a = r.reconnectFuture) === null || a === void 0 ? void 0 : a.promise, r.republishPromise && !o && (yield r.republishPromise), St(i) && r.pendingPublishPromises.has(i) && (yield r.pendingPublishPromises.get(i));
14585
14585
  let u;
14586
14586
  if (i instanceof MediaStreamTrack)
14587
14587
  u = i.getConstraints();
@@ -14614,7 +14614,7 @@ class Bl extends Ga {
14614
14614
  });
14615
14615
  break;
14616
14616
  default:
14617
- throw new Je("unsupported MediaStreamTrack kind ".concat(i.kind));
14617
+ throw new Ge("unsupported MediaStreamTrack kind ".concat(i.kind));
14618
14618
  }
14619
14619
  else
14620
14620
  i.updateLoggerOptions({
@@ -14682,12 +14682,12 @@ class Bl extends Ga {
14682
14682
  var s, r, o, a, c, d, l, u, h, m;
14683
14683
  if (!this.hasPermissionsToPublish(e))
14684
14684
  throw new Es("failed to publish track, insufficient permissions", 403);
14685
- Array.from(this.trackPublications.values()).find((A) => Et(e) && A.source === e.source) && e.source !== T.Source.Unknown && this.log.info("publishing a second track with the same source: ".concat(e.source), Object.assign(Object.assign({}, this.logContext), B(e))), t.stopMicTrackOnMute && Le(e) && (e.stopOnMute = !0), e.source === T.Source.ScreenShare && lt() && (t.simulcast = !1), t.videoCodec === "av1" && !dd() && (t.videoCodec = void 0), t.videoCodec === "vp9" && !ld() && (t.videoCodec = void 0), t.videoCodec === void 0 && (t.videoCodec = kn), this.enabledPublishVideoCodecs.length > 0 && (this.enabledPublishVideoCodecs.some((A) => t.videoCodec === Wt(A.mime)) || (t.videoCodec = Wt(this.enabledPublishVideoCodecs[0].mime)));
14685
+ Array.from(this.trackPublications.values()).find((A) => St(e) && A.source === e.source) && e.source !== T.Source.Unknown && this.log.info("publishing a second track with the same source: ".concat(e.source), Object.assign(Object.assign({}, this.logContext), B(e))), t.stopMicTrackOnMute && Ae(e) && (e.stopOnMute = !0), e.source === T.Source.ScreenShare && dt() && (t.simulcast = !1), t.videoCodec === "av1" && !dd() && (t.videoCodec = void 0), t.videoCodec === "vp9" && !ld() && (t.videoCodec = void 0), t.videoCodec === void 0 && (t.videoCodec = kn), this.enabledPublishVideoCodecs.length > 0 && (this.enabledPublishVideoCodecs.some((A) => t.videoCodec === Vt(A.mime)) || (t.videoCodec = Vt(this.enabledPublishVideoCodecs[0].mime)));
14686
14686
  const p = t.videoCodec;
14687
14687
  e.on(R.Muted, this.onTrackMuted), e.on(R.Unmuted, this.onTrackUnmuted), e.on(R.Ended, this.handleTrackEnded), e.on(R.UpstreamPaused, this.onTrackUpstreamPaused), e.on(R.UpstreamResumed, this.onTrackUpstreamResumed), e.on(R.AudioTrackFeatureUpdate, this.onTrackFeatureUpdate);
14688
14688
  const P = [], k = !(!((s = t.dtx) !== null && s !== void 0) || s), O = e.getSourceTrackSettings();
14689
- O.autoGainControl && P.push(se.TF_AUTO_GAIN_CONTROL), O.echoCancellation && P.push(se.TF_ECHO_CANCELLATION), O.noiseSuppression && P.push(se.TF_NOISE_SUPPRESSION), O.channelCount && O.channelCount > 1 && P.push(se.TF_STEREO), k && P.push(se.TF_NO_DTX), Ve(e) && e.hasPreConnectBuffer && P.push(se.TF_PRECONNECT_BUFFER);
14690
- const M = new Jt({
14689
+ O.autoGainControl && P.push(se.TF_AUTO_GAIN_CONTROL), O.echoCancellation && P.push(se.TF_ECHO_CANCELLATION), O.noiseSuppression && P.push(se.TF_NOISE_SUPPRESSION), O.channelCount && O.channelCount > 1 && P.push(se.TF_STEREO), k && P.push(se.TF_NO_DTX), Be(e) && e.hasPreConnectBuffer && P.push(se.TF_PRECONNECT_BUFFER);
14690
+ const M = new Kt({
14691
14691
  // get local track id for use during publishing
14692
14692
  cid: e.mediaStreamTrack.id,
14693
14693
  name: t.name,
@@ -14711,7 +14711,7 @@ class Bl extends Ga {
14711
14711
  try {
14712
14712
  A = yield e.waitForDimensions();
14713
14713
  } catch {
14714
- const _ = (a = (o = this.roomOptions.videoCaptureDefaults) === null || o === void 0 ? void 0 : o.resolution) !== null && a !== void 0 ? a : Ht.h720.resolution;
14714
+ const _ = (a = (o = this.roomOptions.videoCaptureDefaults) === null || o === void 0 ? void 0 : o.resolution) !== null && a !== void 0 ? a : Gt.h720.resolution;
14715
14715
  A = {
14716
14716
  width: _.width,
14717
14717
  height: _.height
@@ -14719,7 +14719,7 @@ class Bl extends Ga {
14719
14719
  dims: A
14720
14720
  }));
14721
14721
  }
14722
- M.width = A.width, M.height = A.height, Ye(e) && (we(p) && (e.source === T.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), B(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), M.simulcastCodecs = [new nn({
14722
+ M.width = A.width, M.height = A.height, Qe(e) && (we(p) && (e.source === T.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), B(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), M.simulcastCodecs = [new nn({
14723
14723
  codec: p,
14724
14724
  cid: e.mediaStreamTrack.id
14725
14725
  })], t.backupCodec === !0 && (t.backupCodec = {
@@ -14735,13 +14735,13 @@ class Bl extends Ga {
14735
14735
  networkPriority: (m = (h = t.audioPreset) === null || h === void 0 ? void 0 : h.priority) !== null && m !== void 0 ? m : "high"
14736
14736
  }]);
14737
14737
  if (!this.engine || this.engine.isClosed)
14738
- throw new ee("cannot publish track when not connected");
14738
+ throw new Z("cannot publish track when not connected");
14739
14739
  const y = () => f(this, void 0, void 0, function* () {
14740
14740
  var A, D, _;
14741
14741
  if (!this.engine.pcManager)
14742
- throw new ee("pcManager is not ready");
14743
- if (e.sender = yield this.engine.createSender(e, t, b), this.emit(I.LocalSenderCreated, e.sender, e), Ye(e) && ((A = t.degradationPreference) !== null && A !== void 0 || (t.degradationPreference = kl(e)), e.setDegradationPreference(t.degradationPreference)), b)
14744
- if (lt() && e.kind === T.Kind.Audio) {
14742
+ throw new Z("pcManager is not ready");
14743
+ if (e.sender = yield this.engine.createSender(e, t, b), this.emit(I.LocalSenderCreated, e.sender, e), Qe(e) && ((A = t.degradationPreference) !== null && A !== void 0 || (t.degradationPreference = kl(e)), e.setDegradationPreference(t.degradationPreference)), b)
14744
+ if (dt() && e.kind === T.Kind.Audio) {
14745
14745
  let U;
14746
14746
  for (const W of this.engine.pcManager.publisher.getTransceivers())
14747
14747
  if (W.sender === e.sender) {
@@ -14781,7 +14781,7 @@ class Bl extends Ga {
14781
14781
  if (C.codecs.forEach((D) => {
14782
14782
  A === void 0 && (A = D.mimeType);
14783
14783
  }), A && e.kind === T.Kind.Video) {
14784
- const D = Wt(A);
14784
+ const D = Vt(A);
14785
14785
  D !== p && (this.log.debug("falling back to server selected codec", Object.assign(Object.assign(Object.assign({}, this.logContext), B(e)), {
14786
14786
  codec: D
14787
14787
  })), t.videoCodec = D, b = Sn(e.source === T.Source.ScreenShare, M.width, M.height, t));
@@ -14795,7 +14795,7 @@ class Bl extends Ga {
14795
14795
  if (N.on(R.CpuConstrained, (A) => this.onTrackCpuConstrained(A, N)), N.options = t, e.sid = C.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
14796
14796
  encodings: b,
14797
14797
  trackInfo: C
14798
- })), Ye(e) ? e.startMonitor(this.engine.client) : Ve(e) && e.startMonitor(), this.addTrackPublication(N), this.emit(I.LocalTrackPublished, N), Ve(e) && C.audioFeatures.includes(se.TF_PRECONNECT_BUFFER)) {
14798
+ })), Qe(e) ? e.startMonitor(this.engine.client) : Be(e) && e.startMonitor(), this.addTrackPublication(N), this.emit(I.LocalTrackPublished, N), Be(e) && C.audioFeatures.includes(se.TF_PRECONNECT_BUFFER)) {
14799
14799
  const A = e.getPreConnectBuffer(), D = e.getPreConnectBufferMimeType();
14800
14800
  this.on(I.LocalTrackSubscribed, (_) => {
14801
14801
  if (_.trackSid === C.sid) {
@@ -14806,44 +14806,44 @@ class Bl extends Ga {
14806
14806
  this.log.debug("finished recording preconnect buffer", Object.assign(Object.assign({}, this.logContext), B(e))), e.stopPreConnectBuffer();
14807
14807
  }
14808
14808
  }), A && new Promise((U, W) => f(this, void 0, void 0, function* () {
14809
- var ce, Z, Q, be, De, ze;
14809
+ var ce, te, Q, fe, De, zt;
14810
14810
  try {
14811
14811
  this.log.debug("waiting for agent", Object.assign(Object.assign({}, this.logContext), B(e)));
14812
- const xe = setTimeout(() => {
14812
+ const He = setTimeout(() => {
14813
14813
  W(new Error("agent not active within 10 seconds"));
14814
- }, 1e4), ft = yield this.waitUntilActiveAgentPresent();
14815
- clearTimeout(xe), this.log.debug("sending preconnect buffer", Object.assign(Object.assign({}, this.logContext), B(e)));
14814
+ }, 1e4), Qt = yield this.waitUntilActiveAgentPresent();
14815
+ clearTimeout(He), this.log.debug("sending preconnect buffer", Object.assign(Object.assign({}, this.logContext), B(e)));
14816
14816
  const Yt = yield this.streamBytes({
14817
14817
  name: "preconnect-buffer",
14818
14818
  mimeType: D,
14819
14819
  topic: "lk.agent.pre-connect-audio-buffer",
14820
- destinationIdentities: [ft.identity],
14820
+ destinationIdentities: [Qt.identity],
14821
14821
  attributes: {
14822
14822
  trackId: N.trackSid,
14823
14823
  sampleRate: String((De = O.sampleRate) !== null && De !== void 0 ? De : "48000"),
14824
- channels: String((ze = O.channelCount) !== null && ze !== void 0 ? ze : "1")
14824
+ channels: String((zt = O.channelCount) !== null && zt !== void 0 ? zt : "1")
14825
14825
  }
14826
14826
  });
14827
14827
  try {
14828
- for (var Dt = !0, de = Ge(A), Me; Me = yield de.next(), ce = Me.done, !ce; Dt = !0) {
14829
- be = Me.value, Dt = !1;
14830
- const Mi = be;
14828
+ for (var It = !0, be = Ke(A), je; je = yield be.next(), ce = je.done, !ce; It = !0) {
14829
+ fe = je.value, It = !1;
14830
+ const Mi = fe;
14831
14831
  yield Yt.write(Mi);
14832
14832
  }
14833
14833
  } catch (Mi) {
14834
- Z = {
14834
+ te = {
14835
14835
  error: Mi
14836
14836
  };
14837
14837
  } finally {
14838
14838
  try {
14839
- !Dt && !ce && (Q = de.return) && (yield Q.call(de));
14839
+ !It && !ce && (Q = be.return) && (yield Q.call(be));
14840
14840
  } finally {
14841
- if (Z) throw Z.error;
14841
+ if (te) throw te.error;
14842
14842
  }
14843
14843
  }
14844
14844
  yield Yt.close(), U();
14845
- } catch (xe) {
14846
- W(xe);
14845
+ } catch (He) {
14846
+ W(He);
14847
14847
  }
14848
14848
  })).then(() => {
14849
14849
  this.log.debug("preconnect buffer sent successfully", Object.assign(Object.assign({}, this.logContext), B(e)));
@@ -14871,9 +14871,9 @@ class Bl extends Ga {
14871
14871
  if (this.trackPublications.forEach((m) => {
14872
14872
  m.track && m.track === e && (r = m);
14873
14873
  }), !r)
14874
- throw new Je("track is not published");
14875
- if (!Ye(e))
14876
- throw new Je("track is not a video track");
14874
+ throw new Ge("track is not published");
14875
+ if (!Qe(e))
14876
+ throw new Ge("track is not a video track");
14877
14877
  const o = Object.assign(Object.assign({}, (s = this.roomOptions) === null || s === void 0 ? void 0 : s.publishDefaults), i), a = vl(e, t, o);
14878
14878
  if (!a) {
14879
14879
  this.log.info("backup codec has been disabled, ignoring request to add additional codec for track", Object.assign(Object.assign({}, this.logContext), B(e)));
@@ -14882,7 +14882,7 @@ class Bl extends Ga {
14882
14882
  const c = e.addSimulcastTrack(t, a);
14883
14883
  if (!c)
14884
14884
  return;
14885
- const d = new Jt({
14885
+ const d = new Kt({
14886
14886
  cid: c.mediaStreamTrack.id,
14887
14887
  type: T.kindToProto(e.kind),
14888
14888
  muted: e.isMuted,
@@ -14894,7 +14894,7 @@ class Bl extends Ga {
14894
14894
  }]
14895
14895
  });
14896
14896
  if (d.layers = $s(d.width, d.height, a), !this.engine || this.engine.isClosed)
14897
- throw new ee("cannot publish track when not connected");
14897
+ throw new Z("cannot publish track when not connected");
14898
14898
  const l = () => f(this, void 0, void 0, function* () {
14899
14899
  yield this.engine.createSimulcastSender(e, c, o, a), yield this.engine.negotiate();
14900
14900
  }), h = (yield Promise.all([this.engine.addTrack(d), l()]))[0];
@@ -14907,7 +14907,7 @@ class Bl extends Ga {
14907
14907
  unpublishTrack(e, t) {
14908
14908
  return f(this, void 0, void 0, function* () {
14909
14909
  var i, s;
14910
- if (Et(e)) {
14910
+ if (St(e)) {
14911
14911
  const d = this.pendingPublishPromises.get(e);
14912
14912
  d && (this.log.info("awaiting publish promise before attempting to unpublish", Object.assign(Object.assign({}, this.logContext), B(e))), yield d);
14913
14913
  }
@@ -14923,7 +14923,7 @@ class Bl extends Ga {
14923
14923
  try {
14924
14924
  for (const d of this.engine.pcManager.publisher.getTransceivers())
14925
14925
  d.sender === c && (d.direction = "inactive", a = !0);
14926
- if (this.engine.removeTrack(c) && (a = !0), Ye(e)) {
14926
+ if (this.engine.removeTrack(c) && (a = !0), Qe(e)) {
14927
14927
  for (const [, d] of e.simulcastCodecs)
14928
14928
  d.sender && (this.engine.removeTrack(d.sender) && (a = !0), d.sender = void 0);
14929
14929
  e.simulcastCodecs.clear();
@@ -14961,7 +14961,7 @@ class Bl extends Ga {
14961
14961
  c.track && (t && (c.options = Object.assign(Object.assign({}, c.options), t)), a.push(c));
14962
14962
  }), yield Promise.all(a.map((c) => f(this, void 0, void 0, function* () {
14963
14963
  const d = c.track;
14964
- yield this.unpublishTrack(d, !1), s && !d.isMuted && d.source !== T.Source.ScreenShare && d.source !== T.Source.ScreenShareAudio && (Ve(d) || Ye(d)) && !d.isUserProvided && (this.log.debug("restarting existing track", Object.assign(Object.assign({}, this.logContext), {
14964
+ yield this.unpublishTrack(d, !1), s && !d.isMuted && d.source !== T.Source.ScreenShare && d.source !== T.Source.ScreenShareAudio && (Be(d) || Qe(d)) && !d.isUserProvided && (this.log.debug("restarting existing track", Object.assign(Object.assign({}, this.logContext), {
14965
14965
  track: c.trackSid
14966
14966
  })), yield d.restartTrack()), yield this.publishOrRepublishTrack(d, c.options, !0);
14967
14967
  }))), r();
@@ -14993,7 +14993,7 @@ class Bl extends Ga {
14993
14993
  destinationIdentities: o,
14994
14994
  topic: a
14995
14995
  });
14996
- const d = new ue({
14996
+ const d = new le({
14997
14997
  kind: r,
14998
14998
  value: {
14999
14999
  case: "user",
@@ -15012,7 +15012,7 @@ class Bl extends Ga {
15012
15012
  */
15013
15013
  publishDtmf(e, t) {
15014
15014
  return f(this, void 0, void 0, function* () {
15015
- const i = new ue({
15015
+ const i = new le({
15016
15016
  kind: j.RELIABLE,
15017
15017
  value: {
15018
15018
  case: "sipDtmf",
@@ -15033,7 +15033,7 @@ class Bl extends Ga {
15033
15033
  message: e,
15034
15034
  timestamp: Date.now(),
15035
15035
  attachedFiles: t?.attachments
15036
- }, s = new ue({
15036
+ }, s = new le({
15037
15037
  value: {
15038
15038
  case: "chatMessage",
15039
15039
  value: new pi(Object.assign(Object.assign({}, i), {
@@ -15050,7 +15050,7 @@ class Bl extends Ga {
15050
15050
  const i = Object.assign(Object.assign({}, t), {
15051
15051
  message: e,
15052
15052
  editTimestamp: Date.now()
15053
- }), s = new ue({
15053
+ }), s = new le({
15054
15054
  value: {
15055
15055
  case: "chatMessage",
15056
15056
  value: new pi(Object.assign(Object.assign({}, i), {
@@ -15129,7 +15129,7 @@ class Bl extends Ga {
15129
15129
  d($.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));
15130
15130
  return;
15131
15131
  }
15132
- if (!((u = (l = this.engine.latestJoinResponse) === null || l === void 0 ? void 0 : l.serverInfo) === null || u === void 0) && u.version && Fe((m = (h = this.engine.latestJoinResponse) === null || h === void 0 ? void 0 : h.serverInfo) === null || m === void 0 ? void 0 : m.version, "1.8.0") < 0) {
15132
+ if (!((u = (l = this.engine.latestJoinResponse) === null || l === void 0 ? void 0 : l.serverInfo) === null || u === void 0) && u.version && Le((m = (h = this.engine.latestJoinResponse) === null || h === void 0 ? void 0 : h.serverInfo) === null || m === void 0 ? void 0 : m.version, "1.8.0") < 0) {
15133
15133
  d($.builtIn("UNSUPPORTED_SERVER"));
15134
15134
  return;
15135
15135
  }
@@ -15199,7 +15199,7 @@ class Bl extends Ga {
15199
15199
  /** @internal */
15200
15200
  publishRpcRequest(e, t, i, s, r) {
15201
15201
  return f(this, void 0, void 0, function* () {
15202
- const o = new ue({
15202
+ const o = new le({
15203
15203
  destinationIdentities: [e],
15204
15204
  kind: j.RELIABLE,
15205
15205
  value: {
@@ -15257,7 +15257,7 @@ class Bl extends Ga {
15257
15257
  let t;
15258
15258
  return this.trackPublications.forEach((i) => {
15259
15259
  const s = i.track;
15260
- s && (e instanceof MediaStreamTrack ? (Ve(s) || Ye(s)) && s.mediaStreamTrack === e && (t = i) : e === s && (t = i));
15260
+ s && (e instanceof MediaStreamTrack ? (Be(s) || Qe(s)) && s.mediaStreamTrack === e && (t = i) : e === s && (t = i));
15261
15261
  }), t;
15262
15262
  }
15263
15263
  waitForPendingPublicationOfSource(e) {
@@ -15275,7 +15275,7 @@ class Bl extends Ga {
15275
15275
  });
15276
15276
  }
15277
15277
  }
15278
- class Vl extends qe {
15278
+ class Vl extends Ve {
15279
15279
  constructor(e, t, i, s) {
15280
15280
  super(e, t.sid, t.name, s), this.track = void 0, this.allowed = !0, this.requestedDisabled = void 0, this.visible = !0, this.handleEnded = (r) => {
15281
15281
  this.setTrack(void 0), this.emit(R.Ended, r);
@@ -15305,10 +15305,10 @@ class Vl extends qe {
15305
15305
  this.emit(R.UpdateSubscription, s), this.emitSubscriptionUpdateIfChanged(t), this.emitPermissionUpdateIfChanged(i);
15306
15306
  }
15307
15307
  get subscriptionStatus() {
15308
- return this.subscribed === !1 ? qe.SubscriptionStatus.Unsubscribed : super.isSubscribed ? qe.SubscriptionStatus.Subscribed : qe.SubscriptionStatus.Desired;
15308
+ return this.subscribed === !1 ? Ve.SubscriptionStatus.Unsubscribed : super.isSubscribed ? Ve.SubscriptionStatus.Subscribed : Ve.SubscriptionStatus.Desired;
15309
15309
  }
15310
15310
  get permissionStatus() {
15311
- return this.allowed ? qe.PermissionStatus.Allowed : qe.PermissionStatus.NotAllowed;
15311
+ return this.allowed ? Ve.PermissionStatus.Allowed : Ve.PermissionStatus.NotAllowed;
15312
15312
  }
15313
15313
  /**
15314
15314
  * Returns true if track is subscribed, and ready for playback
@@ -15435,7 +15435,7 @@ class Si extends Ga {
15435
15435
  }
15436
15436
  /** @internal */
15437
15437
  constructor(e, t, i, s, r, o, a) {
15438
- let c = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : wt.STANDARD;
15438
+ let c = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : Rt.STANDARD;
15439
15439
  super(t, i || "", s, r, o, a, c), this.signalClient = e, this.trackPublications = /* @__PURE__ */ new Map(), this.audioTrackPublications = /* @__PURE__ */ new Map(), this.videoTrackPublications = /* @__PURE__ */ new Map(), this.volumeMap = /* @__PURE__ */ new Map();
15440
15440
  }
15441
15441
  addTrackPublication(e) {
@@ -15512,7 +15512,7 @@ class Si extends Ga {
15512
15512
  }
15513
15513
  const c = e.kind === "video";
15514
15514
  let d;
15515
- return c ? d = new Nl(e, t, s, r) : d = new Al(e, t, s, this.audioContext, this.audioOutput), d.source = a.source, d.isMuted = a.isMuted, d.setMediaStream(i), d.start(), a.setTrack(d), this.volumeMap.has(a.source) && bn(d) && Le(d) && d.setVolume(this.volumeMap.get(a.source)), a;
15515
+ return c ? d = new Nl(e, t, s, r) : d = new Al(e, t, s, this.audioContext, this.audioOutput), d.source = a.source, d.isMuted = a.isMuted, d.setMediaStream(i), d.start(), a.setTrack(d), this.volumeMap.has(a.source) && bn(d) && Ae(d) && d.setVolume(this.volumeMap.get(a.source)), a;
15516
15516
  }
15517
15517
  /** @internal */
15518
15518
  get hasMetadata() {
@@ -15582,7 +15582,7 @@ class Si extends Ga {
15582
15582
  const t = [];
15583
15583
  this.audioTrackPublications.forEach((i) => {
15584
15584
  var s;
15585
- Le(i.track) && bn(i.track) && t.push(i.track.setSinkId((s = e.deviceId) !== null && s !== void 0 ? s : "default"));
15585
+ Ae(i.track) && bn(i.track) && t.push(i.track.setSinkId((s = e.deviceId) !== null && s !== void 0 ? s : "default"));
15586
15586
  }), yield Promise.all(t);
15587
15587
  });
15588
15588
  }
@@ -15601,7 +15601,7 @@ var K;
15601
15601
  n.Disconnected = "disconnected", n.Connecting = "connecting", n.Connected = "connected", n.Reconnecting = "reconnecting", n.SignalReconnecting = "signalReconnecting";
15602
15602
  })(K || (K = {}));
15603
15603
  const ql = 4 * 1e3;
15604
- class Ot extends je.EventEmitter {
15604
+ class wt extends Ue.EventEmitter {
15605
15605
  get hasE2EESetup() {
15606
15606
  return this.e2eeManager !== void 0;
15607
15607
  }
@@ -15614,13 +15614,13 @@ class Ot extends je.EventEmitter {
15614
15614
  if (super(), t = this, this.state = K.Disconnected, this.activeSpeakers = [], this.isE2EEEnabled = !1, this.audioEnabled = !0, this.isVideoPlaybackBlocked = !1, this.log = F, this.bufferedEvents = [], this.isResuming = !1, this.rpcHandlers = /* @__PURE__ */ new Map(), this.connect = (a, c, d) => f(this, void 0, void 0, function* () {
15615
15615
  var l;
15616
15616
  if (!ud())
15617
- throw Ue() ? Error("WebRTC isn't detected, have you called registerGlobals?") : Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");
15617
+ throw Ne() ? Error("WebRTC isn't detected, have you called registerGlobals?") : Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");
15618
15618
  const u = yield this.disconnectLock.lock();
15619
15619
  if (this.state === K.Connected)
15620
15620
  return this.log.info("already connected to room ".concat(this.name), this.logContext), u(), Promise.resolve();
15621
15621
  if (this.connectFuture)
15622
15622
  return u(), this.connectFuture.promise;
15623
- this.setAndEmitConnectionState(K.Connecting), ((l = this.regionUrlProvider) === null || l === void 0 ? void 0 : l.getServerUrl().toString()) !== xa(a) && (this.regionUrl = void 0, this.regionUrlProvider = void 0), It(new URL(a)) && (this.regionUrlProvider === void 0 ? this.regionUrlProvider = new q(a, c) : this.regionUrlProvider.updateToken(c), this.regionUrlProvider.fetchRegionSettings().then((v) => {
15623
+ this.setAndEmitConnectionState(K.Connecting), ((l = this.regionUrlProvider) === null || l === void 0 ? void 0 : l.getServerUrl().toString()) !== xa(a) && (this.regionUrl = void 0, this.regionUrlProvider = void 0), _t(new URL(a)) && (this.regionUrlProvider === void 0 ? this.regionUrlProvider = new q(a, c) : this.regionUrlProvider.updateToken(c), this.regionUrlProvider.fetchRegionSettings().then((v) => {
15624
15624
  var p;
15625
15625
  (p = this.regionUrlProvider) === null || p === void 0 || p.setServerReportedRegions(v);
15626
15626
  }).catch((v) => {
@@ -15634,7 +15634,7 @@ class Ot extends je.EventEmitter {
15634
15634
  const M = new AbortController();
15635
15635
  this.abortController = M, u?.();
15636
15636
  try {
15637
- if (yield Pt.getInstance().getBackOffPromise(a), M.signal.aborted)
15637
+ if (yield Ct.getInstance().getBackOffPromise(a), M.signal.aborted)
15638
15638
  throw L.cancelled("Connection attempt aborted");
15639
15639
  yield this.attemptConnection(P ?? a, c, d, M), this.abortController = void 0, v();
15640
15640
  } catch (b) {
@@ -15649,7 +15649,7 @@ class Ot extends je.EventEmitter {
15649
15649
  }
15650
15650
  }
15651
15651
  // making sure we only register failed attempts on things we actually care about
15652
- [H.InternalError, H.ServerUnreachable, H.Timeout].includes(b.reason) && (this.log.debug("Adding failed connection attempt to back off"), Pt.getInstance().addFailedConnectionAttempt(a)), y && !(!((O = this.abortController) === null || O === void 0) && O.signal.aborted) ? (this.log.info("Initial connection failed with ConnectionError: ".concat(b.message, ". Retrying with another region: ").concat(y), this.logContext), this.recreateEngine(), yield h(v, p, y)) : (this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, As(b)), p(b));
15652
+ [H.InternalError, H.ServerUnreachable, H.Timeout].includes(b.reason) && (this.log.debug("Adding failed connection attempt to back off"), Ct.getInstance().addFailedConnectionAttempt(a)), y && !(!((O = this.abortController) === null || O === void 0) && O.signal.aborted) ? (this.log.info("Initial connection failed with ConnectionError: ".concat(b.message, ". Retrying with another region: ").concat(y), this.logContext), this.recreateEngine(), yield h(v, p, y)) : (this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, As(b)), p(b));
15653
15653
  } else {
15654
15654
  let y = Ie.UNKNOWN_REASON;
15655
15655
  b instanceof L && (y = As(b)), this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, y), p(b);
@@ -15715,7 +15715,7 @@ class Ot extends je.EventEmitter {
15715
15715
  } catch (m) {
15716
15716
  throw yield this.engine.close(), this.recreateEngine(), m;
15717
15717
  }
15718
- ge() && this.options.disconnectOnPageLeave && (window.addEventListener("pagehide", this.onPageLeave), window.addEventListener("beforeunload", this.onPageLeave)), ge() && window.addEventListener("freeze", this.onPageLeave), this.setAndEmitConnectionState(K.Connected), this.emit(E.Connected), Pt.getInstance().resetFailedConnectionAttempts(a), this.registerConnectionReconcile(), this.regionUrlProvider && this.regionUrlProvider.notifyConnected();
15718
+ ge() && this.options.disconnectOnPageLeave && (window.addEventListener("pagehide", this.onPageLeave), window.addEventListener("beforeunload", this.onPageLeave)), ge() && window.addEventListener("freeze", this.onPageLeave), this.setAndEmitConnectionState(K.Connected), this.emit(E.Connected), Ct.getInstance().resetFailedConnectionAttempts(a), this.registerConnectionReconcile(), this.regionUrlProvider && this.regionUrlProvider.notifyConnected();
15719
15719
  }), this.disconnect = function() {
15720
15720
  for (var a = arguments.length, c = new Array(a), d = 0; d < a; d++)
15721
15721
  c[d] = arguments[d];
@@ -15819,7 +15819,7 @@ class Ot extends je.EventEmitter {
15819
15819
  }
15820
15820
  c.identity === "" && (c.identity = (d = this.sidToIdentity.get(c.sid)) !== null && d !== void 0 ? d : "");
15821
15821
  let l = this.remoteParticipants.get(c.identity);
15822
- c.state === yt.DISCONNECTED ? this.handleParticipantDisconnected(c.identity, l) : l = this.getOrCreateParticipant(c.identity, c);
15822
+ c.state === vt.DISCONNECTED ? this.handleParticipantDisconnected(c.identity, l) : l = this.getOrCreateParticipant(c.identity, c);
15823
15823
  });
15824
15824
  }, this.handleActiveSpeakersUpdate = (a) => {
15825
15825
  const c = [], d = {};
@@ -15939,7 +15939,7 @@ class Ot extends je.EventEmitter {
15939
15939
  (c = a?.onPublish) === null || c === void 0 || c.call(a, this);
15940
15940
  }, this.onLocalTrackPublished = (a) => f(this, void 0, void 0, function* () {
15941
15941
  var c, d, l, u, h, m;
15942
- (c = a.track) === null || c === void 0 || c.on(R.TrackProcessorUpdate, this.onTrackProcessorUpdate), (d = a.track) === null || d === void 0 || d.on(R.Restarted, this.onLocalTrackRestarted), (h = (u = (l = a.track) === null || l === void 0 ? void 0 : l.getProcessor()) === null || u === void 0 ? void 0 : u.onPublish) === null || h === void 0 || h.call(u, this), this.emit(E.LocalTrackPublished, a, this.localParticipant), Ve(a.track) && (yield a.track.checkForSilence()) && this.emit(E.LocalAudioSilenceDetected, a);
15942
+ (c = a.track) === null || c === void 0 || c.on(R.TrackProcessorUpdate, this.onTrackProcessorUpdate), (d = a.track) === null || d === void 0 || d.on(R.Restarted, this.onLocalTrackRestarted), (h = (u = (l = a.track) === null || l === void 0 ? void 0 : l.getProcessor()) === null || u === void 0 ? void 0 : u.onPublish) === null || h === void 0 || h.call(u, this), this.emit(E.LocalTrackPublished, a, this.localParticipant), Be(a.track) && (yield a.track.checkForSilence()) && this.emit(E.LocalAudioSilenceDetected, a);
15943
15943
  const v = yield (m = a.track) === null || m === void 0 ? void 0 : m.getDeviceId(!1), p = mn(a.source);
15944
15944
  p && v && v !== this.localParticipant.activeDeviceMap.get(p) && (this.localParticipant.activeDeviceMap.set(p, v), this.emit(E.ActiveDeviceChanged, p, v));
15945
15945
  }), this.onLocalTrackUnpublished = (a) => {
@@ -15956,11 +15956,11 @@ class Ot extends je.EventEmitter {
15956
15956
  this.emit(E.ParticipantPermissionsChanged, a, this.localParticipant);
15957
15957
  }, this.onLocalChatMessageSent = (a) => {
15958
15958
  this.emit(E.ChatMessage, a, this.localParticipant);
15959
- }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, el), e), this.log = He((i = this.options.loggerName) !== null && i !== void 0 ? i : Oe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Aa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, Na), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, Zd), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Ol(), this.outgoingDataStreamManager = new xl(this.engine, this.log), this.disconnectLock = new he(), this.localParticipant = new Bl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", tt(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", tt(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", tt(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), ge()) {
15959
+ }, this.setMaxListeners(100), this.remoteParticipants = /* @__PURE__ */ new Map(), this.sidToIdentity = /* @__PURE__ */ new Map(), this.options = Object.assign(Object.assign({}, el), e), this.log = Je((i = this.options.loggerName) !== null && i !== void 0 ? i : Oe.Room), this.transcriptionReceivedTimes = /* @__PURE__ */ new Map(), this.options.audioCaptureDefaults = Object.assign(Object.assign({}, Aa), e?.audioCaptureDefaults), this.options.videoCaptureDefaults = Object.assign(Object.assign({}, Na), e?.videoCaptureDefaults), this.options.publishDefaults = Object.assign(Object.assign({}, Zd), e?.publishDefaults), this.maybeCreateEngine(), this.incomingDataStreamManager = new Ol(), this.outgoingDataStreamManager = new xl(this.engine, this.log), this.disconnectLock = new ue(), this.localParticipant = new Bl("", "", this.engine, this.options, this.rpcHandlers, this.outgoingDataStreamManager), (this.options.e2ee || this.options.encryption) && this.setupE2EE(), this.engine.e2eeManager = this.e2eeManager, this.options.videoCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("videoinput", et(this.options.videoCaptureDefaults.deviceId)), this.options.audioCaptureDefaults.deviceId && this.localParticipant.activeDeviceMap.set("audioinput", et(this.options.audioCaptureDefaults.deviceId)), !((s = this.options.audioOutput) === null || s === void 0) && s.deviceId && this.switchActiveDevice("audiooutput", et(this.options.audioOutput.deviceId)).catch((a) => this.log.warn("Could not set audio output: ".concat(a.message), this.logContext)), ge()) {
15960
15960
  const a = new AbortController();
15961
15961
  (o = (r = navigator.mediaDevices) === null || r === void 0 ? void 0 : r.addEventListener) === null || o === void 0 || o.call(r, "devicechange", this.handleDeviceChange, {
15962
15962
  signal: a.signal
15963
- }), Ot.cleanupRegistry && Ot.cleanupRegistry.register(this, () => {
15963
+ }), wt.cleanupRegistry && wt.cleanupRegistry.register(this, () => {
15964
15964
  a.abort();
15965
15965
  });
15966
15966
  }
@@ -16030,9 +16030,9 @@ class Ot extends je.EventEmitter {
16030
16030
  setupE2EE() {
16031
16031
  var e;
16032
16032
  const t = !!this.options.encryption, i = this.options.encryption || this.options.e2ee;
16033
- i && ("e2eeManager" in i ? (this.e2eeManager = i.e2eeManager, this.e2eeManager.isDataChannelEncryptionEnabled = t) : this.e2eeManager = new Ld(i, t), this.e2eeManager.on(Ze.ParticipantEncryptionStatusChanged, (s, r) => {
16033
+ i && ("e2eeManager" in i ? (this.e2eeManager = i.e2eeManager, this.e2eeManager.isDataChannelEncryptionEnabled = t) : this.e2eeManager = new Ld(i, t), this.e2eeManager.on($e.ParticipantEncryptionStatusChanged, (s, r) => {
16034
16034
  Cd(r) && (this.isE2EEEnabled = s), this.emit(E.ParticipantEncryptionStatusChanged, s, r);
16035
- }), this.e2eeManager.on(Ze.EncryptionError, (s, r) => {
16035
+ }), this.e2eeManager.on($e.EncryptionError, (s, r) => {
16036
16036
  const o = r ? this.getParticipantByIdentity(r) : void 0;
16037
16037
  this.emit(E.EncryptionError, s, o);
16038
16038
  }), (e = this.e2eeManager) === null || e === void 0 || e.setup(this));
@@ -16063,7 +16063,7 @@ class Ot extends je.EventEmitter {
16063
16063
  s.sid !== "" && (this.engine.off(w.RoomUpdate, i), e(s.sid));
16064
16064
  };
16065
16065
  this.engine.on(w.RoomUpdate, i), this.once(E.Disconnected, () => {
16066
- this.engine.off(w.RoomUpdate, i), t(new ee("Room disconnected before room server id was available"));
16066
+ this.engine.off(w.RoomUpdate, i), t(new Z("Room disconnected before room server id was available"));
16067
16067
  });
16068
16068
  });
16069
16069
  }
@@ -16143,14 +16143,14 @@ class Ot extends je.EventEmitter {
16143
16143
  if (this.state === K.Disconnected) {
16144
16144
  this.log.debug("prepareConnection to ".concat(e), this.logContext);
16145
16145
  try {
16146
- if (It(new URL(e)) && t) {
16146
+ if (_t(new URL(e)) && t) {
16147
16147
  this.regionUrlProvider = new q(e, t);
16148
16148
  const i = yield this.regionUrlProvider.getNextBestRegionUrl();
16149
- i && this.state === K.Disconnected && (this.regionUrl = i, yield fetch(Qt(i), {
16149
+ i && this.state === K.Disconnected && (this.regionUrl = i, yield fetch(Ht(i), {
16150
16150
  method: "HEAD"
16151
16151
  }), this.log.debug("prepared connection to ".concat(i), this.logContext));
16152
16152
  } else
16153
- yield fetch(Qt(e), {
16153
+ yield fetch(Ht(e), {
16154
16154
  method: "HEAD"
16155
16155
  });
16156
16156
  } catch (i) {
@@ -16184,7 +16184,7 @@ class Ot extends je.EventEmitter {
16184
16184
  yield this.engine.client.handleOnClose("simulate disconnect");
16185
16185
  break;
16186
16186
  case "speaker":
16187
- s = new Ae({
16187
+ s = new Me({
16188
16188
  scenario: {
16189
16189
  case: "speakerUpdate",
16190
16190
  value: 3
@@ -16192,7 +16192,7 @@ class Ot extends je.EventEmitter {
16192
16192
  });
16193
16193
  break;
16194
16194
  case "node-failure":
16195
- s = new Ae({
16195
+ s = new Me({
16196
16196
  scenario: {
16197
16197
  case: "nodeFailure",
16198
16198
  value: !0
@@ -16200,7 +16200,7 @@ class Ot extends je.EventEmitter {
16200
16200
  });
16201
16201
  break;
16202
16202
  case "server-leave":
16203
- s = new Ae({
16203
+ s = new Me({
16204
16204
  scenario: {
16205
16205
  case: "serverLeave",
16206
16206
  value: !0
@@ -16208,7 +16208,7 @@ class Ot extends je.EventEmitter {
16208
16208
  });
16209
16209
  break;
16210
16210
  case "migration":
16211
- s = new Ae({
16211
+ s = new Me({
16212
16212
  scenario: {
16213
16213
  case: "migration",
16214
16214
  value: !0
@@ -16221,7 +16221,7 @@ class Ot extends je.EventEmitter {
16221
16221
  case "disconnect-signal-on-resume":
16222
16222
  i = () => f(this, void 0, void 0, function* () {
16223
16223
  yield this.engine.client.handleOnClose("simulate resume-disconnect");
16224
- }), s = new Ae({
16224
+ }), s = new Me({
16225
16225
  scenario: {
16226
16226
  case: "disconnectSignalOnResume",
16227
16227
  value: !0
@@ -16231,7 +16231,7 @@ class Ot extends je.EventEmitter {
16231
16231
  case "disconnect-signal-on-resume-no-messages":
16232
16232
  i = () => f(this, void 0, void 0, function* () {
16233
16233
  yield this.engine.client.handleOnClose("simulate resume-disconnect");
16234
- }), s = new Ae({
16234
+ }), s = new Me({
16235
16235
  scenario: {
16236
16236
  case: "disconnectSignalOnResumeNoMessages",
16237
16237
  value: !0
@@ -16243,7 +16243,7 @@ class Ot extends je.EventEmitter {
16243
16243
  break;
16244
16244
  case "force-tcp":
16245
16245
  case "force-tls":
16246
- s = new Ae({
16246
+ s = new Me({
16247
16247
  scenario: {
16248
16248
  case: "switchCandidateProtocol",
16249
16249
  value: e === "force-tls" ? 2 : 1
@@ -16252,22 +16252,22 @@ class Ot extends je.EventEmitter {
16252
16252
  const r = this.engine.client.onLeave;
16253
16253
  r && r(new wi({
16254
16254
  reason: Ie.CLIENT_INITIATED,
16255
- action: kt.RECONNECT
16255
+ action: bt.RECONNECT
16256
16256
  }));
16257
16257
  });
16258
16258
  break;
16259
16259
  case "subscriber-bandwidth":
16260
16260
  if (t === void 0 || typeof t != "number")
16261
16261
  throw new Error("subscriber-bandwidth requires a number as argument");
16262
- s = new Ae({
16262
+ s = new Me({
16263
16263
  scenario: {
16264
16264
  case: "subscriberBandwidth",
16265
- value: ct(t)
16265
+ value: ot(t)
16266
16266
  }
16267
16267
  });
16268
16268
  break;
16269
16269
  case "leave-full-reconnect":
16270
- s = new Ae({
16270
+ s = new Me({
16271
16271
  scenario: {
16272
16272
  case: "leaveRequestFullReconnect",
16273
16273
  value: !0
@@ -16497,8 +16497,8 @@ class Ot extends je.EventEmitter {
16497
16497
  yield this.switchActiveDevice(c, u[0].deviceId);
16498
16498
  continue;
16499
16499
  }
16500
- c === "audioinput" && !zt() || c === "videoinput" || u.length > 0 && !u.find((m) => m.deviceId === this.getActiveDevice(c)) && // avoid switching audio output on safari without explicit user action as it leads to slowed down audio playback
16501
- (c !== "audiooutput" || !zt()) && (yield this.switchActiveDevice(c, u[0].deviceId));
16500
+ c === "audioinput" && !Jt() || c === "videoinput" || u.length > 0 && !u.find((m) => m.deviceId === this.getActiveDevice(c)) && // avoid switching audio output on safari without explicit user action as it leads to slowed down audio playback
16501
+ (c !== "audiooutput" || !Jt()) && (yield this.switchActiveDevice(c, u[0].deviceId));
16502
16502
  }
16503
16503
  });
16504
16504
  }
@@ -16563,7 +16563,7 @@ class Ot extends je.EventEmitter {
16563
16563
  }).on(I.TrackSubscriptionPermissionChanged, (s, r) => {
16564
16564
  this.emitWhenConnected(E.TrackSubscriptionPermissionChanged, s, r, i);
16565
16565
  }).on(I.Active, () => {
16566
- this.emitWhenConnected(E.ParticipantActive, i), i.kind === wt.AGENT && this.localParticipant.setActiveAgent(i);
16566
+ this.emitWhenConnected(E.ParticipantActive, i), i.kind === Rt.AGENT && this.localParticipant.setActiveAgent(i);
16567
16567
  }), t && i.updateInfo(t), i;
16568
16568
  }
16569
16569
  sendSyncState() {
@@ -16651,11 +16651,11 @@ class Ot extends je.EventEmitter {
16651
16651
  turnPassword: "",
16652
16652
  enabledCodecs: [],
16653
16653
  activeRecording: !1
16654
- }), this.localParticipant.updateInfo(new dt({
16654
+ }), this.localParticipant.updateInfo(new ct({
16655
16655
  identity: "simulated-local",
16656
16656
  name: "local-name"
16657
16657
  })), this.setupLocalParticipantEvents(), this.emit(E.SignalConnected), this.emit(E.Connected), this.setAndEmitConnectionState(K.Connected), o.video) {
16658
- const c = new En(T.Kind.Video, new gt({
16658
+ const c = new En(T.Kind.Video, new mt({
16659
16659
  source: ie.CAMERA,
16660
16660
  sid: Math.floor(Math.random() * 1e4).toString(),
16661
16661
  type: Re.AUDIO,
@@ -16672,7 +16672,7 @@ class Ot extends je.EventEmitter {
16672
16672
  this.localParticipant.addTrackPublication(c), this.localParticipant.emit(I.LocalTrackPublished, c);
16673
16673
  }
16674
16674
  if (o.audio) {
16675
- const c = new En(T.Kind.Audio, new gt({
16675
+ const c = new En(T.Kind.Audio, new mt({
16676
16676
  source: ie.MICROPHONE,
16677
16677
  sid: Math.floor(Math.random() * 1e4).toString(),
16678
16678
  type: Re.AUDIO
@@ -16688,16 +16688,16 @@ class Ot extends je.EventEmitter {
16688
16688
  this.localParticipant.addTrackPublication(c), this.localParticipant.emit(I.LocalTrackPublished, c);
16689
16689
  }
16690
16690
  for (let c = 0; c < a.count - 1; c += 1) {
16691
- let d = new dt({
16691
+ let d = new ct({
16692
16692
  sid: Math.floor(Math.random() * 1e4).toString(),
16693
16693
  identity: "simulated-".concat(c),
16694
- state: yt.ACTIVE,
16694
+ state: vt.ACTIVE,
16695
16695
  tracks: [],
16696
16696
  joinedAt: z.parse(Date.now())
16697
16697
  });
16698
16698
  const l = this.getOrCreateParticipant(d.identity, d);
16699
16699
  if (a.video) {
16700
- const u = xs(160 * ((r = a.aspectRatios[c % a.aspectRatios.length]) !== null && r !== void 0 ? r : 1), 160, !1, !0), h = new gt({
16700
+ const u = xs(160 * ((r = a.aspectRatios[c % a.aspectRatios.length]) !== null && r !== void 0 ? r : 1), 160, !1, !0), h = new mt({
16701
16701
  source: ie.CAMERA,
16702
16702
  sid: Math.floor(Math.random() * 1e4).toString(),
16703
16703
  type: Re.AUDIO
@@ -16705,7 +16705,7 @@ class Ot extends je.EventEmitter {
16705
16705
  l.addSubscribedMediaTrack(u, h.sid, new MediaStream([u]), new RTCRtpReceiver()), d.tracks = [...d.tracks, h];
16706
16706
  }
16707
16707
  if (a.audio) {
16708
- const u = Wi(), h = new gt({
16708
+ const u = Wi(), h = new mt({
16709
16709
  source: ie.MICROPHONE,
16710
16710
  sid: Math.floor(Math.random() * 1e4).toString(),
16711
16711
  type: Re.AUDIO
@@ -16733,7 +16733,7 @@ class Ot extends je.EventEmitter {
16733
16733
  return super.emit(e, ...i);
16734
16734
  }
16735
16735
  }
16736
- Ot.cleanupRegistry = typeof FinalizationRegistry < "u" && new FinalizationRegistry((n) => {
16736
+ wt.cleanupRegistry = typeof FinalizationRegistry < "u" && new FinalizationRegistry((n) => {
16737
16737
  n();
16738
16738
  });
16739
16739
  function Ja(n) {
@@ -16746,10 +16746,10 @@ var Pe;
16746
16746
  (function(n) {
16747
16747
  n[n.IDLE = 0] = "IDLE", n[n.RUNNING = 1] = "RUNNING", n[n.SKIPPED = 2] = "SKIPPED", n[n.SUCCESS = 3] = "SUCCESS", n[n.FAILED = 4] = "FAILED";
16748
16748
  })(Pe || (Pe = {}));
16749
- class at extends je.EventEmitter {
16749
+ class rt extends Ue.EventEmitter {
16750
16750
  constructor(e, t) {
16751
16751
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
16752
- super(), this.status = Pe.IDLE, this.logs = [], this.options = {}, this.url = e, this.token = t, this.name = this.constructor.name, this.room = new Ot(i.roomOptions), this.connectOptions = i.connectOptions, this.options = i;
16752
+ super(), this.status = Pe.IDLE, this.logs = [], this.options = {}, this.url = e, this.token = t, this.name = this.constructor.name, this.room = new wt(i.roomOptions), this.connectOptions = i.connectOptions, this.options = i;
16753
16753
  }
16754
16754
  run(e) {
16755
16755
  return f(this, void 0, void 0, function* () {
@@ -16832,7 +16832,7 @@ class at extends je.EventEmitter {
16832
16832
  };
16833
16833
  }
16834
16834
  }
16835
- class Wl extends at {
16835
+ class Wl extends rt {
16836
16836
  get description() {
16837
16837
  return "Cloud regions";
16838
16838
  }
@@ -16888,7 +16888,7 @@ class Wl extends at {
16888
16888
  }
16889
16889
  }
16890
16890
  const $i = 1e4;
16891
- class Kl extends at {
16891
+ class Kl extends rt {
16892
16892
  get description() {
16893
16893
  return "Connection via UDP vs TCP";
16894
16894
  }
@@ -16942,7 +16942,7 @@ class Kl extends at {
16942
16942
  });
16943
16943
  }
16944
16944
  }
16945
- class Gl extends at {
16945
+ class Gl extends rt {
16946
16946
  get description() {
16947
16947
  return "Can publish audio";
16948
16948
  }
@@ -16965,7 +16965,7 @@ class Gl extends at {
16965
16965
  });
16966
16966
  }
16967
16967
  }
16968
- class Jl extends at {
16968
+ class Jl extends rt {
16969
16969
  get description() {
16970
16970
  return "Can publish video";
16971
16971
  }
@@ -17012,7 +17012,7 @@ class Jl extends at {
17012
17012
  });
17013
17013
  }
17014
17014
  }
17015
- class Hl extends at {
17015
+ class Hl extends rt {
17016
17016
  get description() {
17017
17017
  return "Resuming connection after interruption";
17018
17018
  }
@@ -17037,14 +17037,14 @@ class Hl extends at {
17037
17037
  });
17038
17038
  }
17039
17039
  }
17040
- class zl extends at {
17040
+ class zl extends rt {
17041
17041
  get description() {
17042
17042
  return "Can connect via TURN";
17043
17043
  }
17044
17044
  perform() {
17045
17045
  return f(this, void 0, void 0, function* () {
17046
17046
  var e, t, i;
17047
- It(new URL(this.url)) && (this.appendMessage("Using region specific url"), this.url = (e = yield new q(this.url, this.token).getNextBestRegionUrl()) !== null && e !== void 0 ? e : this.url);
17047
+ _t(new URL(this.url)) && (this.appendMessage("Using region specific url"), this.url = (e = yield new q(this.url, this.token).getNextBestRegionUrl()) !== null && e !== void 0 ? e : this.url);
17048
17048
  const s = new Wn(), r = yield s.join(this.url, this.token, {
17049
17049
  autoSubscribe: !0,
17050
17050
  maxRetries: 0,
@@ -17063,7 +17063,7 @@ class zl extends at {
17063
17063
  });
17064
17064
  }
17065
17065
  }
17066
- class Ql extends at {
17066
+ class Ql extends rt {
17067
17067
  get description() {
17068
17068
  return "Establishing WebRTC connection";
17069
17069
  }
@@ -17108,7 +17108,7 @@ function Yl(n) {
17108
17108
  }
17109
17109
  return !1;
17110
17110
  }
17111
- class Xl extends at {
17111
+ class Xl extends rt {
17112
17112
  get description() {
17113
17113
  return "Connecting to signal connection via WebSocket";
17114
17114
  }
@@ -17125,7 +17125,7 @@ class Xl extends at {
17125
17125
  websocketTimeout: 15e3
17126
17126
  }, void 0, !0);
17127
17127
  } catch (o) {
17128
- if (It(new URL(this.url))) {
17128
+ if (_t(new URL(this.url))) {
17129
17129
  this.appendMessage("Initial connection failed with error ".concat(o.message, ". Retrying with region fallback"));
17130
17130
  const c = yield new q(this.url, this.token).getNextBestRegionUrl();
17131
17131
  c && (r = yield s.join(c, this.token, {
@@ -17140,7 +17140,7 @@ class Xl extends at {
17140
17140
  });
17141
17141
  }
17142
17142
  }
17143
- class gu extends je.EventEmitter {
17143
+ class gu extends Ue.EventEmitter {
17144
17144
  constructor(e, t) {
17145
17145
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
17146
17146
  super(), this.options = {}, this.checkResults = /* @__PURE__ */ new Map(), this.url = e, this.token = t, this.options = i;
@@ -17243,14 +17243,14 @@ function Zl(n) {
17243
17243
  }
17244
17244
  new TextEncoder();
17245
17245
  new TextDecoder();
17246
- class fe extends Error {
17246
+ class he extends Error {
17247
17247
  constructor(e, t) {
17248
17248
  var i;
17249
17249
  super(e, t), V(this, "code", "ERR_JOSE_GENERIC"), this.name = this.constructor.name, (i = Error.captureStackTrace) === null || i === void 0 || i.call(Error, this, this.constructor);
17250
17250
  }
17251
17251
  }
17252
- V(fe, "code", "ERR_JOSE_GENERIC");
17253
- class eu extends fe {
17252
+ V(he, "code", "ERR_JOSE_GENERIC");
17253
+ class eu extends he {
17254
17254
  constructor(e, t) {
17255
17255
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "unspecified", s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "unspecified";
17256
17256
  super(e, {
@@ -17263,7 +17263,7 @@ class eu extends fe {
17263
17263
  }
17264
17264
  }
17265
17265
  V(eu, "code", "ERR_JWT_CLAIM_VALIDATION_FAILED");
17266
- class tu extends fe {
17266
+ class tu extends he {
17267
17267
  constructor(e, t) {
17268
17268
  let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "unspecified", s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "unspecified";
17269
17269
  super(e, {
@@ -17276,77 +17276,77 @@ class tu extends fe {
17276
17276
  }
17277
17277
  }
17278
17278
  V(tu, "code", "ERR_JWT_EXPIRED");
17279
- class iu extends fe {
17279
+ class iu extends he {
17280
17280
  constructor() {
17281
17281
  super(...arguments), V(this, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
17282
17282
  }
17283
17283
  }
17284
17284
  V(iu, "code", "ERR_JOSE_ALG_NOT_ALLOWED");
17285
- class nu extends fe {
17285
+ class nu extends he {
17286
17286
  constructor() {
17287
17287
  super(...arguments), V(this, "code", "ERR_JOSE_NOT_SUPPORTED");
17288
17288
  }
17289
17289
  }
17290
17290
  V(nu, "code", "ERR_JOSE_NOT_SUPPORTED");
17291
- class su extends fe {
17291
+ class su extends he {
17292
17292
  constructor() {
17293
17293
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "decryption operation failed", t = arguments.length > 1 ? arguments[1] : void 0;
17294
17294
  super(e, t), V(this, "code", "ERR_JWE_DECRYPTION_FAILED");
17295
17295
  }
17296
17296
  }
17297
17297
  V(su, "code", "ERR_JWE_DECRYPTION_FAILED");
17298
- class ru extends fe {
17298
+ class ru extends he {
17299
17299
  constructor() {
17300
17300
  super(...arguments), V(this, "code", "ERR_JWE_INVALID");
17301
17301
  }
17302
17302
  }
17303
17303
  V(ru, "code", "ERR_JWE_INVALID");
17304
- class au extends fe {
17304
+ class au extends he {
17305
17305
  constructor() {
17306
17306
  super(...arguments), V(this, "code", "ERR_JWS_INVALID");
17307
17307
  }
17308
17308
  }
17309
17309
  V(au, "code", "ERR_JWS_INVALID");
17310
- class ou extends fe {
17310
+ class ou extends he {
17311
17311
  constructor() {
17312
17312
  super(...arguments), V(this, "code", "ERR_JWT_INVALID");
17313
17313
  }
17314
17314
  }
17315
17315
  V(ou, "code", "ERR_JWT_INVALID");
17316
- class cu extends fe {
17316
+ class cu extends he {
17317
17317
  constructor() {
17318
17318
  super(...arguments), V(this, "code", "ERR_JWK_INVALID");
17319
17319
  }
17320
17320
  }
17321
17321
  V(cu, "code", "ERR_JWK_INVALID");
17322
- class du extends fe {
17322
+ class du extends he {
17323
17323
  constructor() {
17324
17324
  super(...arguments), V(this, "code", "ERR_JWKS_INVALID");
17325
17325
  }
17326
17326
  }
17327
17327
  V(du, "code", "ERR_JWKS_INVALID");
17328
- class lu extends fe {
17328
+ class lu extends he {
17329
17329
  constructor() {
17330
17330
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "no applicable key found in the JSON Web Key Set", t = arguments.length > 1 ? arguments[1] : void 0;
17331
17331
  super(e, t), V(this, "code", "ERR_JWKS_NO_MATCHING_KEY");
17332
17332
  }
17333
17333
  }
17334
17334
  V(lu, "code", "ERR_JWKS_NO_MATCHING_KEY");
17335
- class uu extends fe {
17335
+ class uu extends he {
17336
17336
  constructor() {
17337
17337
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "multiple matching keys found in the JSON Web Key Set", t = arguments.length > 1 ? arguments[1] : void 0;
17338
17338
  super(e, t), V(this, Symbol.asyncIterator, void 0), V(this, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
17339
17339
  }
17340
17340
  }
17341
17341
  V(uu, "code", "ERR_JWKS_MULTIPLE_MATCHING_KEYS");
17342
- class hu extends fe {
17342
+ class hu extends he {
17343
17343
  constructor() {
17344
17344
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "request timed out", t = arguments.length > 1 ? arguments[1] : void 0;
17345
17345
  super(e, t), V(this, "code", "ERR_JWKS_TIMEOUT");
17346
17346
  }
17347
17347
  }
17348
17348
  V(hu, "code", "ERR_JWKS_TIMEOUT");
17349
- class fu extends fe {
17349
+ class fu extends he {
17350
17350
  constructor() {
17351
17351
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "signature verification failed", t = arguments.length > 1 ? arguments[1] : void 0;
17352
17352
  super(e, t), V(this, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
@@ -17355,7 +17355,7 @@ class fu extends fe {
17355
17355
  V(fu, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
17356
17356
  const nr = "lk.cogito";
17357
17357
  function vu({ mode: n, server: e, configuration: t }) {
17358
- const [i, s] = Mt([]), [r, o] = Mt("disconnected"), [a, c] = Mt(!1), [d, l] = Mt(""), [u, h] = Mt(""), m = xi(null), v = xi(!1), p = xi(null);
17358
+ const [i, s] = Ot([]), [r, o] = Ot("disconnected"), [a, c] = Ot(!1), [d, l] = Ot(""), [u, h] = Ot(""), m = xi(null), v = xi(!1), p = xi(null);
17359
17359
  Xn(function() {
17360
17360
  return function() {
17361
17361
  P(), o("disconnected");
@@ -17379,46 +17379,43 @@ function vu({ mode: n, server: e, configuration: t }) {
17379
17379
  })
17380
17380
  });
17381
17381
  if (!_.ok) {
17382
- const Z = await _.text();
17383
- throw new Error(Z);
17382
+ const te = await _.text();
17383
+ throw new Error(te);
17384
17384
  }
17385
17385
  const U = await _.json();
17386
17386
  localStorage.setItem("cogitoConversationId", U.conversationId);
17387
- const W = new Ot();
17387
+ const W = new wt();
17388
17388
  m.current = W;
17389
- const ce = (Z, Q, be, De) => {
17389
+ const ce = (te, Q, fe, De) => {
17390
17390
  if (De !== nr) return;
17391
- const Dt = new TextDecoder().decode(Z);
17391
+ const It = new TextDecoder().decode(te);
17392
17392
  try {
17393
- const de = JSON.parse(Dt);
17394
- if (console.log("Received from agent:", de), de.type === "ready")
17395
- de.messages && de.messages.length > 0 && s(de.messages), o("connected"), v.current = !1;
17396
- else if (de.type === "message") {
17397
- const Me = de;
17398
- s(function(xe) {
17399
- const ft = xe.findIndex((Yt) => Yt.id === Me.message.id);
17400
- return ft >= 0 ? xe[ft] = Me.message : xe.push(Me.message), [...xe];
17401
- }), Me.message.role === "assistant" && h(""), c(!1);
17402
- } else if (de.type === "transcript") {
17403
- const { role: Me, text: xe, final: ft } = de;
17404
- Me === "user" && l(ft ? "" : xe);
17393
+ const be = JSON.parse(It);
17394
+ if (console.log("Received from agent:", be), be.type === "ready")
17395
+ be.messages && be.messages.length > 0 && s(be.messages), o("connected"), v.current = !1;
17396
+ else if (be.type === "message") {
17397
+ const je = be;
17398
+ s(function(He) {
17399
+ const Qt = He.findIndex((Yt) => Yt.id === je.message.id);
17400
+ return Qt >= 0 ? He[Qt] = je.message : He.push(je.message), [...He];
17401
+ }), je.message.role === "assistant" ? h("") : je.message.role === "user" && l(""), c(!1);
17405
17402
  }
17406
- } catch (de) {
17407
- console.error("Failed to parse agent message:", de);
17403
+ } catch (be) {
17404
+ console.error("Failed to parse agent message:", be);
17408
17405
  }
17409
17406
  };
17410
- W.on(E.DataReceived, ce), W.on(E.TrackSubscribed, (Z, Q, be) => {
17411
- if (Z.kind === T.Kind.Audio) {
17407
+ W.on(E.DataReceived, ce), W.on(E.TrackSubscribed, (te, Q, fe) => {
17408
+ if (te.kind === T.Kind.Audio) {
17412
17409
  console.log("[voice] Remote audio track subscribed, attaching to DOM");
17413
- const De = Z.attach();
17414
- De.id = `lk-audio-${Z.sid}`, document.body.appendChild(De);
17410
+ const De = te.attach();
17411
+ De.id = `lk-audio-${te.sid}`, document.body.appendChild(De);
17415
17412
  }
17416
- }), W.on(E.TrackUnsubscribed, (Z) => {
17417
- Z.kind === T.Kind.Audio && (console.log("[voice] Remote audio track unsubscribed, detaching"), Z.detach().forEach((Q) => Q.remove()));
17418
- }), W.on(E.TranscriptionReceived, (Z, Q) => {
17419
- if (!Q || Q.kind !== wt.AGENT) return;
17420
- const be = Z.map((ze) => ze.text).join(""), De = Z.every((ze) => ze.final);
17421
- be && h(De ? "" : be);
17413
+ }), W.on(E.TrackUnsubscribed, (te) => {
17414
+ te.kind === T.Kind.Audio && (console.log("[voice] Remote audio track unsubscribed, detaching"), te.detach().forEach((Q) => Q.remove()));
17415
+ }), W.on(E.TranscriptionReceived, (te, Q) => {
17416
+ if (!Q) return;
17417
+ const fe = te.map((De) => De.text).join("");
17418
+ fe && (Q.kind === Rt.AGENT ? h(fe) : l(fe));
17422
17419
  }), await W.connect(U.serverURL, U.participantToken), console.log("Connected to LiveKit room");
17423
17420
  } catch (_) {
17424
17421
  console.error("Failed to initialize LiveKit room:", _), o("error"), v.current = !1;