@vindral/web-sdk 4.1.5 → 4.1.6

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.
@@ -5,7 +5,7 @@ var wu = Object.prototype.hasOwnProperty, bu = Object.prototype.propertyIsEnumer
5
5
  var dt = (s, e) => (e = Symbol[s]) ? e : Symbol.for("Symbol." + s), Bt = (s) => {
6
6
  throw TypeError(s);
7
7
  };
8
- var $a = (s, e, t) => e in s ? Wc(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, S = (s, e) => {
8
+ var $a = (s, e, t) => e in s ? Wc(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, v = (s, e) => {
9
9
  for (var t in e || (e = {}))
10
10
  wu.call(e, t) && $a(s, t, e[t]);
11
11
  if (Ja)
@@ -22,21 +22,21 @@ var yu = (s, e) => {
22
22
  e.indexOf(i) < 0 && bu.call(s, i) && (t[i] = s[i]);
23
23
  return t;
24
24
  };
25
- var Ci = (s) => {
25
+ var ki = (s) => {
26
26
  var e;
27
27
  return [, , , rm((e = s == null ? void 0 : s[dt("metadata")]) != null ? e : null)];
28
- }, Su = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Yn = (s) => s !== void 0 && typeof s != "function" ? Bt("Function expected") : s, hm = (s, e, t, i, n) => ({ kind: Su[s], name: e, metadata: i, addInitializer: (o) => t._ ? Bt("Already initialized") : n.push(Yn(o || null)) }), Zt = (s, e) => $a(e, dt("metadata"), s[3]), ki = (s, e, t, i) => {
28
+ }, vu = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Kn = (s) => s !== void 0 && typeof s != "function" ? Bt("Function expected") : s, hm = (s, e, t, i, n) => ({ kind: vu[s], name: e, metadata: i, addInitializer: (o) => t._ ? Bt("Already initialized") : n.push(Kn(o || null)) }), Zt = (s, e) => $a(e, dt("metadata"), s[3]), Bi = (s, e, t, i) => {
29
29
  for (var n = 0, o = s[e >> 1], c = o && o.length; n < c; n++) e & 1 ? o[n].call(t) : i = o[n].call(t, i);
30
30
  return i;
31
31
  }, ye = (s, e, t, i, n, o) => {
32
- var c, h, u, m, p, g = e & 7, w = !!(e & 8), b = !!(e & 16), v = g > 3 ? s.length + 1 : g ? w ? 1 : 2 : 0, I = Su[g + 5], k = g > 3 && (s[v - 1] = []), D = s[v] || (s[v] = []), T = g && (!b && !w && (n = n.prototype), g < 5 && (g > 3 || !b) && om(g < 4 ? n : { get [t]() {
32
+ var c, h, u, m, p, g = e & 7, w = !!(e & 8), b = !!(e & 16), S = g > 3 ? s.length + 1 : g ? w ? 1 : 2 : 0, I = vu[g + 5], k = g > 3 && (s[S - 1] = []), L = s[S] || (s[S] = []), T = g && (!b && !w && (n = n.prototype), g < 5 && (g > 3 || !b) && om(g < 4 ? n : { get [t]() {
33
33
  return a(this, o);
34
34
  }, set [t](R) {
35
35
  return l(this, o, R);
36
36
  } }, t));
37
37
  g ? b && g < 4 && Au(o, (g > 2 ? "set " : g > 1 ? "get " : "") + t) : Au(n, t);
38
38
  for (var P = i.length - 1; P >= 0; P--)
39
- m = hm(g, t, u = {}, s[3], D), g && (m.static = w, m.private = b, p = m.access = { has: b ? (R) => um(n, R) : (R) => t in R }, g ^ 3 && (p.get = b ? (R) => (g ^ 1 ? a : A)(R, n, g ^ 4 ? o : T.get) : (R) => R[t]), g > 2 && (p.set = b ? (R, X) => l(R, n, X, g ^ 4 ? o : T.set) : (R, X) => R[t] = X)), h = (0, i[P])(g ? g < 4 ? b ? o : T[I] : g > 4 ? void 0 : { get: T.get, set: T.set } : n, m), u._ = 1, g ^ 4 || h === void 0 ? Yn(h) && (g > 4 ? k.unshift(h) : g ? b ? o = h : T[I] = h : n = h) : typeof h != "object" || h === null ? Bt("Object expected") : (Yn(c = h.get) && (T.get = c), Yn(c = h.set) && (T.set = c), Yn(c = h.init) && k.unshift(c));
39
+ m = hm(g, t, u = {}, s[3], L), g && (m.static = w, m.private = b, p = m.access = { has: b ? (R) => um(n, R) : (R) => t in R }, g ^ 3 && (p.get = b ? (R) => (g ^ 1 ? a : A)(R, n, g ^ 4 ? o : T.get) : (R) => R[t]), g > 2 && (p.set = b ? (R, X) => l(R, n, X, g ^ 4 ? o : T.set) : (R, X) => R[t] = X)), h = (0, i[P])(g ? g < 4 ? b ? o : T[I] : g > 4 ? void 0 : { get: T.get, set: T.set } : n, m), u._ = 1, g ^ 4 || h === void 0 ? Kn(h) && (g > 4 ? k.unshift(h) : g ? b ? o = h : T[I] = h : n = h) : typeof h != "object" || h === null ? Bt("Object expected") : (Kn(c = h.get) && (T.get = c), Kn(c = h.set) && (T.set = c), Kn(c = h.init) && k.unshift(c));
40
40
  return g || Zt(s, n), T && Wc(n, t, T), b ? g ^ 4 ? o : T : n;
41
41
  }, r = (s, e, t) => $a(s, typeof e != "symbol" ? e + "" : e, t), zc = (s, e, t) => e.has(s) || Bt("Cannot " + t), um = (s, e) => Object(e) !== e ? Bt('Cannot use the "in" operator on this value') : s.has(e), a = (s, e, t) => (zc(s, e, "read from private field"), t ? t.call(s) : e.get(s)), d = (s, e, t) => e.has(s) ? Bt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), l = (s, e, t, i) => (zc(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), A = (s, e, t) => (zc(s, e, "access private method"), t);
42
42
  var Je = (s, e, t, i) => ({
@@ -120,9 +120,9 @@ var Ve = (s, e, t) => {
120
120
  };
121
121
  return o();
122
122
  };
123
- import { E as Ei } from "./Bx7s5QdT.js";
124
- import { a as Xe, p as Sd, i as vd, c as dm, b as lm, A as mm, d as fm, t as pm, e as gm } from "./CPEMXA01.js";
125
- class vu {
123
+ import { E as Ti } from "./Bx7s5QdT.js";
124
+ import { a as Xe, p as vd, i as Sd, c as dm, b as lm, A as mm, d as fm, t as pm, e as gm } from "./CPEMXA01.js";
125
+ class Su {
126
126
  constructor(e) {
127
127
  r(this, "maxSize", 0);
128
128
  r(this, "size", 0);
@@ -354,13 +354,13 @@ const iu = (s, e, t) => {
354
354
  i = i * 256 + s[n];
355
355
  return i;
356
356
  };
357
- var se, xt, ti;
357
+ var se, xt, ii;
358
358
  class qn {
359
359
  constructor(e) {
360
360
  d(this, se);
361
361
  d(this, xt);
362
- d(this, ti);
363
- l(this, xt, e), l(this, ti, new DataView(e.buffer, e.byteOffset, e.byteLength)), l(this, se, 0);
362
+ d(this, ii);
363
+ l(this, xt, e), l(this, ii, new DataView(e.buffer, e.byteOffset, e.byteLength)), l(this, se, 0);
364
364
  }
365
365
  position() {
366
366
  return a(this, se);
@@ -375,19 +375,19 @@ class qn {
375
375
  return a(this, xt).length - a(this, se);
376
376
  }
377
377
  readUint8() {
378
- const e = a(this, ti).getUint8(a(this, se));
378
+ const e = a(this, ii).getUint8(a(this, se));
379
379
  return l(this, se, a(this, se) + 1), e;
380
380
  }
381
381
  readUint24() {
382
- const e = a(this, ti).getUint32(a(this, se)) >> 8 & 16777215;
382
+ const e = a(this, ii).getUint32(a(this, se)) >> 8 & 16777215;
383
383
  return l(this, se, a(this, se) + 3), e;
384
384
  }
385
385
  readUint16() {
386
- const e = a(this, ti).getUint16(a(this, se));
386
+ const e = a(this, ii).getUint16(a(this, se));
387
387
  return l(this, se, a(this, se) + 2), e;
388
388
  }
389
389
  readUint32() {
390
- const e = a(this, ti).getUint32(a(this, se));
390
+ const e = a(this, ii).getUint32(a(this, se));
391
391
  return l(this, se, a(this, se) + 4), e;
392
392
  }
393
393
  readUint64() {
@@ -409,7 +409,7 @@ class qn {
409
409
  return new TextDecoder().decode(new Uint8Array(e));
410
410
  }
411
411
  }
412
- se = new WeakMap(), xt = new WeakMap(), ti = new WeakMap();
412
+ se = new WeakMap(), xt = new WeakMap(), ii = new WeakMap();
413
413
  class Am {
414
414
  constructor(e = 100, t = 100) {
415
415
  r(this, "resizeSteps");
@@ -486,14 +486,14 @@ function Td(s) {
486
486
  t[i] = e.charCodeAt(i);
487
487
  return t.buffer;
488
488
  }
489
- function Rr() {
489
+ function Zn() {
490
490
  const s = self.MediaSource, e = self.ManagedMediaSource;
491
491
  return s != null ? s : e;
492
492
  }
493
493
  const wm = /(android|bbd+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows ce|xda|xiino\/i.test(a)||\/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-\//i, Ee = navigator.userAgent.toLowerCase(), bm = wm.test(Ee), ym = () => {
494
494
  const s = document.createElement("video");
495
495
  return s.canPlayType("application/vnd.apple.mpegURL") !== "" || s.canPlayType("audio/mpegurl") !== "";
496
- }, Sm = () => {
496
+ }, vm = () => {
497
497
  try {
498
498
  if (typeof WebAssembly == "object" && typeof WebAssembly.instantiate == "function") {
499
499
  const s = new WebAssembly.Module(Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0));
@@ -503,9 +503,9 @@ const wm = /(android|bbd+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal
503
503
  return !1;
504
504
  }
505
505
  return !1;
506
- }, vm = () => Ee.indexOf("CrKey") !== -1, Id = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Fc = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Em = () => Ee.indexOf("iphone") >= 0 && Ee.indexOf("like iphone") < 0 || Ee.indexOf("ipad") >= 0 && Ee.indexOf("like ipad") < 0 || Ee.indexOf("ipod") >= 0 && Ee.indexOf("like ipod") < 0 || Fc(), Tm = () => {
506
+ }, Sm = () => Ee.indexOf("CrKey") !== -1, Id = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, Fc = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Em = () => Ee.indexOf("iphone") >= 0 && Ee.indexOf("like iphone") < 0 || Ee.indexOf("ipad") >= 0 && Ee.indexOf("like ipad") < 0 || Ee.indexOf("ipod") >= 0 && Ee.indexOf("like ipod") < 0 || Fc(), Tm = () => {
507
507
  var s, e;
508
- return Fc() ? !1 : (e = (s = Rr()) == null ? void 0 : s.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
508
+ return Fc() ? !1 : (e = (s = Zn()) == null ? void 0 : s.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
509
509
  }, gw = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Im = () => /^(?!.*chrome).*safari/i.test(Ee);
510
510
  function Cm() {
511
511
  var s, e;
@@ -519,14 +519,14 @@ function km() {
519
519
  }
520
520
  const Cd = () => {
521
521
  var t, i;
522
- const s = !!Rr();
522
+ const s = !!Zn();
523
523
  let e = !1;
524
524
  return s && (e = Tm()), {
525
525
  isMobile: bm,
526
526
  supportsMp4Opus: e,
527
527
  supportsMediaSource: s,
528
528
  supportsHls: ym(),
529
- supportsWebAssembly: Sm(),
529
+ supportsWebAssembly: vm(),
530
530
  platform: {
531
531
  iosVersion: (t = Cm()) != null ? t : Number.MAX_SAFE_INTEGER,
532
532
  safariVersion: (i = km()) != null ? i : Number.MAX_SAFE_INTEGER,
@@ -667,7 +667,7 @@ function Pe(s) {
667
667
  return function(i, n) {
668
668
  const o = String(n.name);
669
669
  function c(...h) {
670
- s.enter && e[s.enter](`Enter '${o}'`, S({}, h));
670
+ s.enter && e[s.enter](`Enter '${o}'`, v({}, h));
671
671
  try {
672
672
  const u = i.call(this, ...h);
673
673
  return u instanceof Promise ? u.then((m) => {
@@ -796,7 +796,7 @@ class Ie {
796
796
  }
797
797
  je = new WeakMap(), et = new WeakMap();
798
798
  const Tu = (s, e) => {
799
- const t = S({}, s);
799
+ const t = v({}, s);
800
800
  return typeof t != "object" || e.forEach((i) => {
801
801
  delete t[i];
802
802
  }), t;
@@ -829,14 +829,14 @@ const Tu = (s, e) => {
829
829
  };
830
830
  r(Wo, "create", () => new Wo());
831
831
  let Ae = Wo;
832
- const Ui = (s, e = Date.now()) => {
832
+ const Pi = (s, e = Date.now()) => {
833
833
  const t = s.length;
834
834
  if (t > 0) {
835
835
  const i = t - 1, n = s[i];
836
836
  n.end || (n.end = e);
837
837
  }
838
838
  }, ks = (s, e = Date.now()) => {
839
- Ui(s), s.push({ start: e });
839
+ Pi(s), s.push({ start: e });
840
840
  }, Bs = (s) => s.reduce((e, t) => {
841
841
  var i;
842
842
  return e + (((i = t.end) != null ? i : Date.now()) - t.start);
@@ -855,13 +855,13 @@ function Bd(s) {
855
855
  const Cu = () => {
856
856
  const s = [...Array(256).keys()].map((t) => t.toString(16).padStart(2, "0")), e = crypto.getRandomValues(new Uint8Array(16));
857
857
  return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, [...e.entries()].map(([t, i]) => [4, 6, 8, 10].includes(t) ? `-${s[i]}` : s[i]).join("");
858
- }, Ti = (s) => f(null, null, function* () {
858
+ }, Ii = (s) => f(null, null, function* () {
859
859
  return new Promise((e) => setTimeout(e, s));
860
860
  }), su = (t, ...i) => f(null, [t, ...i], function* (s, e = new Error("Timeout")) {
861
861
  return new Promise((n, o) => setTimeout(() => o(e), s));
862
862
  }), Lm = (s, e) => f(null, null, function* () {
863
863
  throw yield s, new Error(e);
864
- }), ws = (s) => "width" in s && typeof s.width == "number", bs = (s) => "sampleRate" in s && typeof s.sampleRate == "number", Oi = (s) => {
864
+ }), ws = (s) => "width" in s && typeof s.width == "number", bs = (s) => "sampleRate" in s && typeof s.sampleRate == "number", ti = (s) => {
865
865
  switch (s.codec) {
866
866
  case "opus":
867
867
  return 'audio/mp4; codecs="opus"';
@@ -876,7 +876,7 @@ const Cu = () => {
876
876
  case "av1":
877
877
  return s.codecString ? `video/mp4; codecs="${s.codecString}"` : "video/mp4";
878
878
  }
879
- }, vi = () => Number.MAX_SAFE_INTEGER, lo = () => ({
879
+ }, Ei = () => Number.MAX_SAFE_INTEGER, lo = () => ({
880
880
  width: Number.MAX_SAFE_INTEGER,
881
881
  height: Number.MAX_SAFE_INTEGER
882
882
  }), ku = (s) => !(typeof s != "object" || s === null || !("type" in s)), Dm = "connection_failed", Om = "connection_failed_will_not_attempt_again", Mm = "authentication_error", Fm = "authentication_expired", _m = "channel_not_found", Nm = "no_incoming_data_error", Vm = "connection_inactivity", Gm = "missing_init_segment", jm = "no_track_context", Wm = "invalid_track_context_state", zm = "disconnected_by_edge", Hm = "decoder_error", Qm = "audio_player_error", Xm = "media_source_error", qm = "webgl_context_lost_error", Zm = "access_forbidden", Jm = "channel_switch_failed", $m = "drm_error";
@@ -910,7 +910,7 @@ class x extends Error {
910
910
  r(this, "toStringifiable", () => {
911
911
  var n;
912
912
  const t = this.source(), i = t instanceof Error ? t.stack : this.stack;
913
- return M(S({}, this.extra), {
913
+ return M(v({}, this.extra), {
914
914
  code: this.props.code,
915
915
  isFatal: this.props.isFatal,
916
916
  type: this.props.type,
@@ -945,7 +945,7 @@ const Ym = (s, e) => new x(
945
945
  code: Wm,
946
946
  type: "internal"
947
947
  }
948
- ), sf = () => new x("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), Kn = (s) => new x("Disconnected From Edge Server", {
948
+ ), sf = () => new x("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), er = (s) => new x("Disconnected From Edge Server", {
949
949
  type: "external",
950
950
  source: s,
951
951
  isFatal: !1,
@@ -963,14 +963,15 @@ const Ym = (s, e) => new x(
963
963
  abrEnabled: !0,
964
964
  burstEnabled: !1,
965
965
  mseEnabled: !0,
966
- mseOpusEnabled: !1,
966
+ mseOpusEnabled: !0,
967
967
  muted: !1,
968
+ volume: 1,
968
969
  minBufferTime: 1500,
969
970
  maxBufferTime: 1500,
970
971
  logLevel: Um.OFF,
971
972
  maxSize: lo(),
972
- maxVideoBitRate: vi(),
973
- maxAudioBitRate: vi(),
973
+ maxVideoBitRate: Ei(),
974
+ maxAudioBitRate: Ei(),
974
975
  maxInitialBitRate: 2.5 * 1e3 * 1e3,
975
976
  // 2.5 Mbps
976
977
  tags: [],
@@ -1024,7 +1025,7 @@ class _c {
1024
1025
  const i = yield fetch(t, {
1025
1026
  method: "POST",
1026
1027
  body: e,
1027
- headers: S({
1028
+ headers: v({
1028
1029
  "Content-Type": "application/octet-stream"
1029
1030
  }, this.headers)
1030
1031
  });
@@ -1131,7 +1132,7 @@ const Pu = {
1131
1132
  }), xu = (s, e, t, i, n, o) => f(null, null, function* () {
1132
1133
  let c;
1133
1134
  for (const h of i) {
1134
- const u = t == null ? void 0 : t.map((p) => M(S({}, p), {
1135
+ const u = t == null ? void 0 : t.map((p) => M(v({}, p), {
1135
1136
  robustness: h,
1136
1137
  contentType: o ? `${n === "audioCapabilities" ? "audio/mp4" : "video/mp4"}; codecs="${o}"` : p.contentType
1137
1138
  }));
@@ -1188,8 +1189,8 @@ const Af = (s) => {
1188
1189
  if (i) {
1189
1190
  const g = i.getElementsByTagName("name"), w = i.getElementsByTagName("value");
1190
1191
  for (let b = 0; b < g.length; b++) {
1191
- const v = (h = g[b]) == null ? void 0 : h.childNodes[0], I = (u = w[b]) == null ? void 0 : u.childNodes[0];
1192
- v != null && v.nodeValue && I && I.nodeValue && (n[v.nodeValue] = I.nodeValue);
1192
+ const S = (h = g[b]) == null ? void 0 : h.childNodes[0], I = (u = w[b]) == null ? void 0 : u.childNodes[0];
1193
+ S != null && S.nodeValue && I && I.nodeValue && (n[S.nodeValue] = I.nodeValue);
1193
1194
  }
1194
1195
  }
1195
1196
  const o = t.getElementsByTagName("Challenge")[0];
@@ -1214,7 +1215,7 @@ class wf extends _c {
1214
1215
  t.searchParams.append(o, c);
1215
1216
  const i = Af(e), n = yield fetch(t, {
1216
1217
  method: "POST",
1217
- headers: S(S({}, i.headers), this.headers),
1218
+ headers: v(v({}, i.headers), this.headers),
1218
1219
  body: i.message
1219
1220
  });
1220
1221
  if (!n.ok)
@@ -1229,7 +1230,7 @@ class bf extends _c {
1229
1230
  }
1230
1231
  }
1231
1232
  const yf = 5e3;
1232
- var V, ji, Lt, tt, ft, de, ii, si, zo, qs, _r, Nr, re, Od, Md, Fd, _d, Ho, Qo, Nd, ir, Xo, Vd, Gd;
1233
+ var V, ji, Lt, tt, ft, de, si, ni, zo, qs, _r, Nr, re, Od, Md, Fd, _d, Ho, Qo, Nd, sr, Xo, Vd, Gd;
1233
1234
  class Lu {
1234
1235
  constructor(e, t, i = {}) {
1235
1236
  d(this, re);
@@ -1239,8 +1240,8 @@ class Lu {
1239
1240
  d(this, tt, new z());
1240
1241
  d(this, ft);
1241
1242
  d(this, de);
1242
- d(this, ii, /* @__PURE__ */ new Map());
1243
- d(this, si);
1243
+ d(this, si, /* @__PURE__ */ new Map());
1244
+ d(this, ni);
1244
1245
  d(this, zo, Cd());
1245
1246
  /**
1246
1247
  * Timeout to wait for new drm data when channel switch happens
@@ -1260,7 +1261,7 @@ class Lu {
1260
1261
  var o, c;
1261
1262
  a(this, V).debug("Session message received", { event: e });
1262
1263
  const t = e.target, i = e.message;
1263
- if (!a(this, ii).get(t)) {
1264
+ if (!a(this, si).get(t)) {
1264
1265
  a(this, V).error("No active session found for event", { event: e });
1265
1266
  return;
1266
1267
  }
@@ -1269,10 +1270,10 @@ class Lu {
1269
1270
  licenseServerUrl: (o = a(this, de)) == null ? void 0 : o.licenseServerUrl
1270
1271
  }), (c = a(this, de)) == null || c.requestLicense(i).then((h) => {
1271
1272
  a(this, V).debug("License received for session", { sessionId: t.sessionId }), t.update(h).catch((u) => {
1272
- A(this, re, ir).call(this, { message: "Failed to update session with license", isFatal: !1, error: u });
1273
+ A(this, re, sr).call(this, { message: "Failed to update session with license", isFatal: !1, error: u });
1273
1274
  });
1274
1275
  }).catch((h) => {
1275
- A(this, re, ir).call(this, { message: "Failed to request license", isFatal: !1, error: h });
1276
+ A(this, re, sr).call(this, { message: "Failed to request license", isFatal: !1, error: h });
1276
1277
  });
1277
1278
  });
1278
1279
  d(this, Qo, (e) => {
@@ -1309,13 +1310,13 @@ class Lu {
1309
1310
  }
1310
1311
  getStatistics() {
1311
1312
  var e, t;
1312
- return !a(this, tt).resolved && !((e = a(this, de)) != null && e.statistics) ? null : S(S({}, a(this, tt).resolved), (t = a(this, de)) == null ? void 0 : t.statistics);
1313
+ return !a(this, tt).resolved && !((e = a(this, de)) != null && e.statistics) ? null : v(v({}, a(this, tt).resolved), (t = a(this, de)) == null ? void 0 : t.statistics);
1313
1314
  }
1314
1315
  unload() {
1315
1316
  var e;
1316
- a(this, V).info("Unloading EncryptedMediaExtensions"), a(this, ji).off("received drm data", a(this, _r)), (e = a(this, Lt)) == null || e.removeEventListener("encrypted", a(this, Nr)), a(this, ii).forEach((t, i) => {
1317
+ a(this, V).info("Unloading EncryptedMediaExtensions"), a(this, ji).off("received drm data", a(this, _r)), (e = a(this, Lt)) == null || e.removeEventListener("encrypted", a(this, Nr)), a(this, si).forEach((t, i) => {
1317
1318
  i.close();
1318
- }), a(this, ii).clear(), l(this, si, void 0), l(this, de, void 0);
1319
+ }), a(this, si).clear(), l(this, ni, void 0), l(this, de, void 0);
1319
1320
  }
1320
1321
  set headers(e) {
1321
1322
  a(this, ft).headers = e, a(this, de) && (a(this, de).headers = e);
@@ -1328,7 +1329,7 @@ class Lu {
1328
1329
  a(this, V).debug("DRM is not used, skipping channel switch handling");
1329
1330
  return;
1330
1331
  }
1331
- Im() && a(this, zo).platform.safariVersion < 18 && A(this, re, ir).call(this, {
1332
+ Im() && a(this, zo).platform.safariVersion < 18 && A(this, re, sr).call(this, {
1332
1333
  message: "DRM channel switch not supported on Safari < 18",
1333
1334
  isFatal: !0
1334
1335
  }), window.clearTimeout(a(this, qs));
@@ -1338,12 +1339,12 @@ class Lu {
1338
1339
  }, yf));
1339
1340
  }
1340
1341
  }
1341
- V = new WeakMap(), ji = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ft = new WeakMap(), de = new WeakMap(), ii = new WeakMap(), si = new WeakMap(), zo = new WeakMap(), qs = new WeakMap(), _r = new WeakMap(), Nr = new WeakMap(), re = new WeakSet(), Od = function(e) {
1342
+ V = new WeakMap(), ji = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ft = new WeakMap(), de = new WeakMap(), si = new WeakMap(), ni = new WeakMap(), zo = new WeakMap(), qs = new WeakMap(), _r = new WeakMap(), Nr = new WeakMap(), re = new WeakSet(), Od = function(e) {
1342
1343
  return f(this, null, function* () {
1343
1344
  try {
1344
1345
  yield A(this, re, Md).call(this), a(this, V).debug("Media keys initialization completed"), yield A(this, re, Fd).call(this, e.initData, e.initDataType);
1345
1346
  } catch (t) {
1346
- A(this, re, ir).call(this, { message: "Failed to handle encrypted event", isFatal: !0, error: t });
1347
+ A(this, re, sr).call(this, { message: "Failed to handle encrypted event", isFatal: !0, error: t });
1347
1348
  }
1348
1349
  });
1349
1350
  }, Md = function() {
@@ -1355,16 +1356,16 @@ V = new WeakMap(), ji = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), f
1355
1356
  a(this, V).debug("Media keys already set on media element");
1356
1357
  return;
1357
1358
  }
1358
- if (a(this, si)) {
1359
- a(this, V).debug("Media keys initialization already in progress, waiting for completion"), yield a(this, si);
1359
+ if (a(this, ni)) {
1360
+ a(this, V).debug("Media keys initialization already in progress, waiting for completion"), yield a(this, ni);
1360
1361
  return;
1361
1362
  }
1362
- l(this, si, f(this, null, function* () {
1363
+ l(this, ni, f(this, null, function* () {
1363
1364
  const i = yield a(this, Xo).call(this, e);
1364
1365
  a(this, V).debug("CDM obtained", { cdm: i }), Xe(a(this, Lt), "No media element found"), Xe(i, "No CDM found");
1365
1366
  const n = yield i.getMediaKeys();
1366
1367
  i.certificate && (yield A(this, re, Nd).call(this, n, i.certificate)), a(this, V).debug("Setting media keys on media element"), yield a(this, Lt).setMediaKeys(n), l(this, de, i);
1367
- })), yield a(this, si);
1368
+ })), yield a(this, ni);
1368
1369
  });
1369
1370
  }, Fd = function(e, t) {
1370
1371
  return f(this, null, function* () {
@@ -1377,10 +1378,10 @@ V = new WeakMap(), ji = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), f
1377
1378
  const n = i.createSession();
1378
1379
  a(this, V).debug("Creating new session", { session: n }), n.addEventListener("keystatuseschange", a(this, Qo)), n.closed.then((o) => {
1379
1380
  a(this, V).info("Session is closed", { reason: o });
1380
- }), n.addEventListener("message", a(this, Ho)), a(this, ii).set(n, e), a(this, V).debug("Generating request for session", { session: n, initDataType: t, initData: e }), yield n.generateRequest(t, e);
1381
+ }), n.addEventListener("message", a(this, Ho)), a(this, si).set(n, e), a(this, V).debug("Generating request for session", { session: n, initDataType: t, initData: e }), yield n.generateRequest(t, e);
1381
1382
  });
1382
1383
  }, _d = function(e) {
1383
- for (const [t, i] of a(this, ii))
1384
+ for (const [t, i] of a(this, si))
1384
1385
  if (df(e, i)) return !1;
1385
1386
  return !0;
1386
1387
  }, Ho = new WeakMap(), Qo = new WeakMap(), Nd = function(e, t) {
@@ -1391,7 +1392,7 @@ V = new WeakMap(), ji = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), f
1391
1392
  a(this, V).error("Failed to set server certificate", { error: i });
1392
1393
  }
1393
1394
  });
1394
- }, ir = function(e) {
1395
+ }, sr = function(e) {
1395
1396
  const { message: t, isFatal: i, error: n } = e;
1396
1397
  a(this, V).error(t, { error: n }), a(this, ji).emit("error", xd(t, i, n));
1397
1398
  }, Xo = new WeakMap(), /**
@@ -1411,7 +1412,7 @@ Vd = function(e) {
1411
1412
  clearkey: void 0
1412
1413
  };
1413
1414
  };
1414
- const Sf = 7, vf = 8, Ef = (s) => {
1415
+ const vf = 7, Sf = 8, Ef = (s) => {
1415
1416
  const e = s.getUint32(0, !1), t = s.getUint8(0) << 16 | s.getUint16(1, !1);
1416
1417
  let i = 0;
1417
1418
  return t === 1 ? i += 3 : e === 1 && (i += 4), i;
@@ -1453,17 +1454,17 @@ const Sf = 7, vf = 8, Ef = (s) => {
1453
1454
  return Cf(s, (i) => {
1454
1455
  const n = i.byteOffset + i.byteLength;
1455
1456
  switch (If(i.getUint8(0))) {
1456
- case vf:
1457
+ case Sf:
1457
1458
  t.push(i.buffer.slice(i.byteOffset, n));
1458
1459
  break;
1459
- case Sf:
1460
+ case vf:
1460
1461
  e.push(i.buffer.slice(i.byteOffset, n));
1461
1462
  break;
1462
1463
  }
1463
1464
  return !0;
1464
1465
  }), { sequenceParameterSets: e, pictureParameterSets: t };
1465
1466
  }, kf = (s) => {
1466
- var v;
1467
+ var S;
1467
1468
  const e = new DataView(s), t = e.getUint8(1), i = e.getUint8(2), n = e.getUint8(3), o = new Ed(s, 32);
1468
1469
  o.readUnsignedExpGolomb();
1469
1470
  let c = 1;
@@ -1502,14 +1503,14 @@ const Sf = 7, vf = 8, Ef = (s) => {
1502
1503
  p === 0 && o.readBit(), o.readBit();
1503
1504
  let g = u + 1, w = m + 1;
1504
1505
  if (w *= 2 - p, w *= 16, g *= 16, o.readBit()) {
1505
- const I = c == 1 ? 1 : 0, D = 1 << (c == 1 || c == 2 ? 1 : 0), T = 2 - p << I, P = o.readUnsignedExpGolomb() * D, R = o.readUnsignedExpGolomb() * D, X = o.readUnsignedExpGolomb() * T, Q = o.readUnsignedExpGolomb() * T;
1506
+ const I = c == 1 ? 1 : 0, L = 1 << (c == 1 || c == 2 ? 1 : 0), T = 2 - p << I, P = o.readUnsignedExpGolomb() * L, R = o.readUnsignedExpGolomb() * L, X = o.readUnsignedExpGolomb() * T, Q = o.readUnsignedExpGolomb() * T;
1506
1507
  g -= P + R, w -= X + Q;
1507
1508
  }
1508
1509
  let b = {
1509
1510
  numerator: 1,
1510
1511
  denumerator: 1
1511
1512
  };
1512
- return o.readBit() && o.readBit() && (b = (v = Bf[o.readBits(8)]) != null ? v : { numerator: 0, denumerator: 0 }), {
1513
+ return o.readBit() && o.readBit() && (b = (S = Bf[o.readBits(8)]) != null ? S : { numerator: 0, denumerator: 0 }), {
1513
1514
  width: g,
1514
1515
  height: w,
1515
1516
  pixelAspectRatio: b,
@@ -1649,22 +1650,22 @@ const Os = class Os {
1649
1650
  };
1650
1651
  r(Os, "type", "emsg");
1651
1652
  let fo = Os;
1652
- const hr = class hr {
1653
+ const ur = class ur {
1653
1654
  constructor(e) {
1654
- r(this, "type", hr.type);
1655
+ r(this, "type", ur.type);
1655
1656
  r(this, "data");
1656
1657
  this.data = e;
1657
1658
  }
1658
1659
  static decodeData(e) {
1659
1660
  const t = e.readRemaining();
1660
- return new hr(t);
1661
+ return new ur(t);
1661
1662
  }
1662
1663
  };
1663
- r(hr, "type", "mdat");
1664
- let po = hr;
1665
- const ur = class ur {
1664
+ r(ur, "type", "mdat");
1665
+ let po = ur;
1666
+ const dr = class dr {
1666
1667
  constructor(e, t, i) {
1667
- r(this, "type", ur.type);
1668
+ r(this, "type", dr.type);
1668
1669
  r(this, "extra");
1669
1670
  /**
1670
1671
  * The byte offset of the baseMediaDecodeTime field
@@ -1676,14 +1677,14 @@ const ur = class ur {
1676
1677
  static decodeData(e) {
1677
1678
  const t = qt(e), i = e.byteOffset();
1678
1679
  let n = 0;
1679
- return t.version === 1 ? n = e.readUint64() : n = e.readUint32(), new ur(t, i, n);
1680
+ return t.version === 1 ? n = e.readUint64() : n = e.readUint32(), new dr(t, i, n);
1680
1681
  }
1681
1682
  };
1682
- r(ur, "type", "tfdt");
1683
- let go = ur;
1684
- const Mf = 1, Ff = 2, _f = 8, Nf = 16, Vf = 32, dr = class dr {
1683
+ r(dr, "type", "tfdt");
1684
+ let go = dr;
1685
+ const Mf = 1, Ff = 2, _f = 8, Nf = 16, Vf = 32, lr = class lr {
1685
1686
  constructor(e, t, i, n) {
1686
- r(this, "type", dr.type);
1687
+ r(this, "type", lr.type);
1687
1688
  r(this, "extra");
1688
1689
  r(this, "defaultSampleDuration");
1689
1690
  r(this, "defaultSampleSize");
@@ -1693,11 +1694,11 @@ const Mf = 1, Ff = 2, _f = 8, Nf = 16, Vf = 32, dr = class dr {
1693
1694
  static decodeData(e) {
1694
1695
  const t = qt(e);
1695
1696
  let i, n, o;
1696
- return e.readUint32(), (t.flags & Mf) > 0 && e.readUint64(), (t.flags & Ff) > 0 && e.readUint32(), (t.flags & _f) > 0 && (i = e.readUint32()), (t.flags & Nf) > 0 && (n = e.readUint32()), (t.flags & Vf) > 0 && (o = e.readUint32()), new dr(t, i, n, o);
1697
+ return e.readUint32(), (t.flags & Mf) > 0 && e.readUint64(), (t.flags & Ff) > 0 && e.readUint32(), (t.flags & _f) > 0 && (i = e.readUint32()), (t.flags & Nf) > 0 && (n = e.readUint32()), (t.flags & Vf) > 0 && (o = e.readUint32()), new lr(t, i, n, o);
1697
1698
  }
1698
1699
  };
1699
- r(dr, "type", "tfhd");
1700
- let Ao = dr;
1700
+ r(lr, "type", "tfhd");
1701
+ let Ao = lr;
1701
1702
  const Y = class Y {
1702
1703
  constructor(e, t, i) {
1703
1704
  r(this, "type", Y.type);
@@ -1729,9 +1730,9 @@ const Y = class Y {
1729
1730
  };
1730
1731
  r(Y, "TRUN_DATA_OFFSET", 1), r(Y, "TRUN_FIRST_SAMPLE_FLAGS", 4), r(Y, "SAMPLE_DURATION", 256), r(Y, "SAMPLE_SIZE", 512), r(Y, "SAMPLE_FLAGS", 1024), r(Y, "SAMPLE_CTS", 2048), r(Y, "FLAG_SAMPLE_FLAG_IS_NON_SYNC", 65536), r(Y, "FLAG_SAMPLE_DEPENDS_NO", 33554432), r(Y, "FLAG_SAMPLE_DEPENDS_YES", 16777216), r(Y, "type", "trun");
1731
1732
  let Ur = Y;
1732
- const lr = class lr {
1733
+ const mr = class mr {
1733
1734
  constructor(e, t, i) {
1734
- r(this, "type", lr.type);
1735
+ r(this, "type", mr.type);
1735
1736
  r(this, "tfhd");
1736
1737
  r(this, "tfdt");
1737
1738
  r(this, "trun");
@@ -1743,14 +1744,14 @@ const lr = class lr {
1743
1744
  const o = ct(e);
1744
1745
  o instanceof Ao && (t = o), o instanceof go && (i = o), o instanceof Ur && (n = o);
1745
1746
  }
1746
- return new lr(t, i, n);
1747
+ return new mr(t, i, n);
1747
1748
  }
1748
1749
  };
1749
- r(lr, "type", "traf");
1750
- let wo = lr;
1751
- const mr = class mr {
1750
+ r(mr, "type", "traf");
1751
+ let wo = mr;
1752
+ const fr = class fr {
1752
1753
  constructor(e) {
1753
- r(this, "type", mr.type);
1754
+ r(this, "type", fr.type);
1754
1755
  r(this, "traf");
1755
1756
  this.traf = e;
1756
1757
  }
@@ -1762,24 +1763,24 @@ const mr = class mr {
1762
1763
  }
1763
1764
  if (!t)
1764
1765
  throw new Error("No traf found");
1765
- return new mr(t);
1766
+ return new fr(t);
1766
1767
  }
1767
1768
  };
1768
- r(mr, "type", "moof");
1769
- let bo = mr;
1770
- const fr = class fr {
1769
+ r(fr, "type", "moof");
1770
+ let bo = fr;
1771
+ const pr = class pr {
1771
1772
  constructor() {
1772
- r(this, "type", fr.type);
1773
+ r(this, "type", pr.type);
1773
1774
  }
1774
1775
  static decodeData(e) {
1775
- return new fr();
1776
+ return new pr();
1776
1777
  }
1777
1778
  };
1778
- r(fr, "type", "mvhd");
1779
- let yo = fr;
1780
- const pr = class pr {
1779
+ r(pr, "type", "mvhd");
1780
+ let yo = pr;
1781
+ const gr = class gr {
1781
1782
  constructor(e) {
1782
- r(this, "type", pr.type);
1783
+ r(this, "type", gr.type);
1783
1784
  r(this, "fourCC");
1784
1785
  this.fourCC = e;
1785
1786
  }
@@ -1798,11 +1799,11 @@ const pr = class pr {
1798
1799
  static decodeData(e) {
1799
1800
  qt(e), e.readUint32();
1800
1801
  const t = String.fromCharCode(...e.readBytes(4));
1801
- return new pr(t);
1802
+ return new gr(t);
1802
1803
  }
1803
1804
  };
1804
- r(pr, "type", "hdlr");
1805
- let So = pr;
1805
+ r(gr, "type", "hdlr");
1806
+ let vo = gr;
1806
1807
  const Ms = class Ms {
1807
1808
  constructor(e, t, i, n) {
1808
1809
  r(this, "type", Ms.type);
@@ -1823,10 +1824,10 @@ const Ms = class Ms {
1823
1824
  }
1824
1825
  };
1825
1826
  r(Ms, "type", "mdhd");
1826
- let vo = Ms;
1827
- const gr = class gr {
1827
+ let So = Ms;
1828
+ const Ar = class Ar {
1828
1829
  constructor(e, t, i, n) {
1829
- r(this, "type", gr.type);
1830
+ r(this, "type", Ar.type);
1830
1831
  r(this, "av01");
1831
1832
  r(this, "avc1");
1832
1833
  r(this, "opus");
@@ -1866,14 +1867,14 @@ const gr = class gr {
1866
1867
  break;
1867
1868
  }
1868
1869
  }
1869
- return new gr(n, c, o, i);
1870
+ return new Ar(n, c, o, i);
1870
1871
  }
1871
1872
  };
1872
- r(gr, "type", "stsd");
1873
- let Eo = gr;
1874
- const Ar = class Ar {
1873
+ r(Ar, "type", "stsd");
1874
+ let Eo = Ar;
1875
+ const wr = class wr {
1875
1876
  constructor(e) {
1876
- r(this, "type", Ar.type);
1877
+ r(this, "type", wr.type);
1877
1878
  r(this, "stsd");
1878
1879
  this.stsd = e;
1879
1880
  }
@@ -1885,14 +1886,14 @@ const Ar = class Ar {
1885
1886
  }
1886
1887
  if (!t)
1887
1888
  throw new Error("No stsd found");
1888
- return new Ar(t);
1889
+ return new wr(t);
1889
1890
  }
1890
1891
  };
1891
- r(Ar, "type", "stbl");
1892
- let To = Ar;
1893
- const wr = class wr {
1892
+ r(wr, "type", "stbl");
1893
+ let To = wr;
1894
+ const br = class br {
1894
1895
  constructor(e) {
1895
- r(this, "type", wr.type);
1896
+ r(this, "type", br.type);
1896
1897
  r(this, "stbl");
1897
1898
  this.stbl = e;
1898
1899
  }
@@ -1904,14 +1905,14 @@ const wr = class wr {
1904
1905
  }
1905
1906
  if (!t)
1906
1907
  throw new Error("No stbl found");
1907
- return new wr(t);
1908
+ return new br(t);
1908
1909
  }
1909
1910
  };
1910
- r(wr, "type", "minf");
1911
- let Io = wr;
1912
- const br = class br {
1911
+ r(br, "type", "minf");
1912
+ let Io = br;
1913
+ const yr = class yr {
1913
1914
  constructor(e, t, i) {
1914
- r(this, "type", br.type);
1915
+ r(this, "type", yr.type);
1915
1916
  r(this, "hdlr");
1916
1917
  r(this, "minf");
1917
1918
  r(this, "mdhd");
@@ -1921,7 +1922,7 @@ const br = class br {
1921
1922
  let t, i, n;
1922
1923
  for (; e.remaining() > 0; ) {
1923
1924
  const o = ct(e);
1924
- o instanceof So && (t = o), o instanceof Io && (i = o), o instanceof vo && (n = o);
1925
+ o instanceof vo && (t = o), o instanceof Io && (i = o), o instanceof So && (n = o);
1925
1926
  }
1926
1927
  if (!t)
1927
1928
  throw new Error("No hdlr found");
@@ -1929,14 +1930,14 @@ const br = class br {
1929
1930
  throw new Error("No minf found");
1930
1931
  if (!n)
1931
1932
  throw new Error("No mdhd found");
1932
- return new br(t, i, n);
1933
+ return new yr(t, i, n);
1933
1934
  }
1934
1935
  };
1935
- r(br, "type", "mdia");
1936
- let Co = br;
1937
- const yr = class yr {
1936
+ r(yr, "type", "mdia");
1937
+ let Co = yr;
1938
+ const vr = class vr {
1938
1939
  constructor(e, t, i, n, o, c, h, u) {
1939
- r(this, "type", yr.type);
1940
+ r(this, "type", vr.type);
1940
1941
  r(this, "modificationTime");
1941
1942
  r(this, "creationTime");
1942
1943
  r(this, "trackId");
@@ -1960,11 +1961,11 @@ const yr = class yr {
1960
1961
  const m = e.readUint16();
1961
1962
  e.readUint16();
1962
1963
  const p = e.readUint16();
1963
- return e.readUint16(), new yr(i, n, o, c, h, u, m, p);
1964
+ return e.readUint16(), new vr(i, n, o, c, h, u, m, p);
1964
1965
  }
1965
1966
  };
1966
- r(yr, "type", "tkhd");
1967
- let ko = yr;
1967
+ r(vr, "type", "tkhd");
1968
+ let ko = vr;
1968
1969
  const Sr = class Sr {
1969
1970
  constructor(e, t) {
1970
1971
  r(this, "type", Sr.type);
@@ -1987,9 +1988,9 @@ const Sr = class Sr {
1987
1988
  };
1988
1989
  r(Sr, "type", "trak");
1989
1990
  let Bo = Sr;
1990
- const vr = class vr {
1991
+ const Er = class Er {
1991
1992
  constructor(e, t) {
1992
- r(this, "type", vr.type);
1993
+ r(this, "type", Er.type);
1993
1994
  r(this, "mvhd");
1994
1995
  r(this, "traks");
1995
1996
  this.mvhd = e, this.traks = t;
@@ -2003,14 +2004,14 @@ const vr = class vr {
2003
2004
  }
2004
2005
  if (!t)
2005
2006
  throw new Error("No mvhd found");
2006
- return new vr(t, i);
2007
+ return new Er(t, i);
2007
2008
  }
2008
2009
  };
2009
- r(vr, "type", "moov");
2010
- let Ro = vr;
2011
- const Er = class Er {
2010
+ r(Er, "type", "moov");
2011
+ let Ro = Er;
2012
+ const Tr = class Tr {
2012
2013
  constructor(e, t, i, n, o, c, h, u) {
2013
- r(this, "type", Er.type);
2014
+ r(this, "type", Tr.type);
2014
2015
  r(this, "configurationVersion");
2015
2016
  r(this, "avcProfileIndication");
2016
2017
  r(this, "profileCompatibility");
@@ -2032,7 +2033,7 @@ const Er = class Er {
2032
2033
  const b = e.readBytes(e.readUint16());
2033
2034
  g.push(b);
2034
2035
  }
2035
- return new Er(
2036
+ return new Tr(
2036
2037
  i,
2037
2038
  n,
2038
2039
  o,
@@ -2044,11 +2045,11 @@ const Er = class Er {
2044
2045
  );
2045
2046
  }
2046
2047
  };
2047
- r(Er, "type", "avcC");
2048
- let ch = Er;
2049
- const Tr = class Tr {
2048
+ r(Tr, "type", "avcC");
2049
+ let ch = Tr;
2050
+ const Ir = class Ir {
2050
2051
  constructor(e, t, i, n, o) {
2051
- r(this, "type", Tr.type);
2052
+ r(this, "type", Ir.type);
2052
2053
  r(this, "avcC");
2053
2054
  r(this, "width");
2054
2055
  r(this, "height");
@@ -2071,24 +2072,24 @@ const Tr = class Tr {
2071
2072
  }
2072
2073
  if (!c)
2073
2074
  throw new Error("no avcC");
2074
- return new Tr(c, t, i, n, o);
2075
+ return new Ir(c, t, i, n, o);
2075
2076
  }
2076
2077
  };
2077
- r(Tr, "type", "avc1");
2078
- let hh = Tr;
2079
- const Ir = class Ir {
2078
+ r(Ir, "type", "avc1");
2079
+ let hh = Ir;
2080
+ const Cr = class Cr {
2080
2081
  constructor() {
2081
- r(this, "type", Ir.type);
2082
+ r(this, "type", Cr.type);
2082
2083
  }
2083
2084
  static decodeData(e) {
2084
- return new Ir();
2085
+ return new Cr();
2085
2086
  }
2086
2087
  };
2087
- r(Ir, "type", "dOps");
2088
- let uh = Ir;
2089
- const Cr = class Cr {
2088
+ r(Cr, "type", "dOps");
2089
+ let uh = Cr;
2090
+ const kr = class kr {
2090
2091
  constructor(e, t, i) {
2091
- r(this, "type", Cr.type);
2092
+ r(this, "type", kr.type);
2092
2093
  r(this, "dops");
2093
2094
  r(this, "channelCount");
2094
2095
  r(this, "sampleRate");
@@ -2103,11 +2104,11 @@ const Cr = class Cr {
2103
2104
  const n = e.readUint16();
2104
2105
  e.readUint16(), t === 1 && (e.readUint64(), e.readUint64());
2105
2106
  const o = Of(uh, e);
2106
- return new Cr(o, i, n);
2107
+ return new kr(o, i, n);
2107
2108
  }
2108
2109
  };
2109
- r(Cr, "type", "Opus");
2110
- let dh = Cr;
2110
+ r(kr, "type", "Opus");
2111
+ let dh = kr;
2111
2112
  const Fs = class Fs {
2112
2113
  constructor(e, t) {
2113
2114
  r(this, "type", Fs.type);
@@ -2160,10 +2161,10 @@ const jf = {
2160
2161
  trun: Ur,
2161
2162
  mdat: po,
2162
2163
  mdia: Co,
2163
- hdlr: So,
2164
+ hdlr: vo,
2164
2165
  minf: Io,
2165
2166
  stbl: To,
2166
- mdhd: vo,
2167
+ mdhd: So,
2167
2168
  stsd: Eo,
2168
2169
  prft: Uo,
2169
2170
  avc1: hh,
@@ -2235,13 +2236,13 @@ class Hf {
2235
2236
  }
2236
2237
  }
2237
2238
  jr = new WeakMap(), Wr = new WeakMap();
2238
- var Se, Re, H;
2239
+ var ve, Re, H;
2239
2240
  const hu = class hu {
2240
2241
  constructor(e, t) {
2241
- d(this, Se);
2242
+ d(this, ve);
2242
2243
  d(this, Re);
2243
2244
  d(this, H);
2244
- l(this, Se, t), l(this, Re, e), l(this, H, zf(t));
2245
+ l(this, ve, t), l(this, Re, e), l(this, H, zf(t));
2245
2246
  }
2246
2247
  /**
2247
2248
  * @returns a new fragment with a clone of the raw bytes
@@ -2249,7 +2250,7 @@ const hu = class hu {
2249
2250
  clone() {
2250
2251
  return new hu(
2251
2252
  a(this, Re),
2252
- new Uint8Array(a(this, Se).buffer.slice(a(this, Se).byteOffset, a(this, Se).byteOffset + a(this, Se).byteLength))
2253
+ new Uint8Array(a(this, ve).buffer.slice(a(this, ve).byteOffset, a(this, ve).byteOffset + a(this, ve).byteLength))
2253
2254
  );
2254
2255
  }
2255
2256
  /**
@@ -2257,13 +2258,13 @@ const hu = class hu {
2257
2258
  * @param baseMediaDecodeTime
2258
2259
  */
2259
2260
  updateBaseMediaDecodeTime(e) {
2260
- const t = new DataView(a(this, Se).buffer, a(this, Se).byteOffset, a(this, Se).byteLength);
2261
+ const t = new DataView(a(this, ve).buffer, a(this, ve).byteOffset, a(this, ve).byteLength);
2261
2262
  if (a(this, H).moof.traf.tfdt)
2262
2263
  if (a(this, H).moof.traf.tfdt.baseMediaDecodeTime = e, a(this, H).moof.traf.tfdt.extra.version === 1) {
2263
2264
  const i = Math.floor(e / 4294967296), n = (e & 4294967295) >>> 0;
2264
- t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, Se).byteOffset, i), t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, Se).byteOffset + 4, n);
2265
+ t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, ve).byteOffset, i), t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, ve).byteOffset + 4, n);
2265
2266
  } else
2266
- t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, Se).byteOffset, e);
2267
+ t.setUint32(a(this, H).moof.traf.tfdt.byteOffset - a(this, ve).byteOffset, e);
2267
2268
  }
2268
2269
  producerReferenceTime() {
2269
2270
  if (a(this, H).prft)
@@ -2318,11 +2319,11 @@ const hu = class hu {
2318
2319
  return ((e = a(this, H).moof.traf.trun) == null ? void 0 : e.samplesCount) || 0;
2319
2320
  }
2320
2321
  sample(e) {
2321
- var v, I, k, D, T, P, R, X, Q, Fe, te, Ze, ht, Be, y;
2322
- const t = (v = a(this, Re).init().moov.traks[0]) == null ? void 0 : v.mdia.minf.stbl.stsd.codec, i = ((I = a(this, H).moof.traf.trun) == null ? void 0 : I.samplesCount) || 0, n = (k = a(this, H).moof.traf.tfdt) == null ? void 0 : k.baseMediaDecodeTime;
2322
+ var S, I, k, L, T, P, R, X, Q, Fe, te, Ze, ht, Be, y;
2323
+ const t = (S = a(this, Re).init().moov.traks[0]) == null ? void 0 : S.mdia.minf.stbl.stsd.codec, i = ((I = a(this, H).moof.traf.trun) == null ? void 0 : I.samplesCount) || 0, n = (k = a(this, H).moof.traf.tfdt) == null ? void 0 : k.baseMediaDecodeTime;
2323
2324
  if (e >= i || typeof n == "undefined" || !t)
2324
2325
  return;
2325
- const o = this.compositionTimeOffset(e), c = ((D = a(this, H).moof.traf.trun) == null ? void 0 : D.sampleDurations[e]) || 0, h = ((T = a(this, H).moof.traf.trun) == null ? void 0 : T.sampleDurations.slice(0, e).reduce((E, F) => E + F, 0)) || 0, u = n + h, m = ((P = a(this, Re).init().moov.traks[0]) == null ? void 0 : P.mdia.mdhd.timescale) || 1e3, p = ((R = a(this, H).moof.traf.trun) == null ? void 0 : R.sampleSizes[e]) || a(this, H).mdat.data.byteLength, g = ((X = a(this, H).moof.traf.trun) == null ? void 0 : X.sampleSizes.slice(0, e).reduce((E, F) => E + F, 0)) || 0, w = a(this, H).mdat.data.subarray(g, g + p), b = ((Q = a(this, H).moof.traf.trun) == null ? void 0 : Q.is_sync_sample(e)) || !1;
2326
+ const o = this.compositionTimeOffset(e), c = ((L = a(this, H).moof.traf.trun) == null ? void 0 : L.sampleDurations[e]) || 0, h = ((T = a(this, H).moof.traf.trun) == null ? void 0 : T.sampleDurations.slice(0, e).reduce((E, F) => E + F, 0)) || 0, u = n + h, m = ((P = a(this, Re).init().moov.traks[0]) == null ? void 0 : P.mdia.mdhd.timescale) || 1e3, p = ((R = a(this, H).moof.traf.trun) == null ? void 0 : R.sampleSizes[e]) || a(this, H).mdat.data.byteLength, g = ((X = a(this, H).moof.traf.trun) == null ? void 0 : X.sampleSizes.slice(0, e).reduce((E, F) => E + F, 0)) || 0, w = a(this, H).mdat.data.subarray(g, g + p), b = ((Q = a(this, H).moof.traf.trun) == null ? void 0 : Q.is_sync_sample(e)) || !1;
2326
2327
  if (this.mediaType() === "video") {
2327
2328
  const E = ((Fe = a(this, Re).init().moov.traks[0]) == null ? void 0 : Fe.tkhd.width) || 0, F = ((te = a(this, Re).init().moov.traks[0]) == null ? void 0 : te.tkhd.height) || 0;
2328
2329
  return {
@@ -2355,10 +2356,10 @@ const hu = class hu {
2355
2356
  * @returns the raw bytes of the cmaf fragment
2356
2357
  */
2357
2358
  rawBytes() {
2358
- return a(this, Se);
2359
+ return a(this, ve);
2359
2360
  }
2360
2361
  };
2361
- Se = new WeakMap(), Re = new WeakMap(), H = new WeakMap();
2362
+ ve = new WeakMap(), Re = new WeakMap(), H = new WeakMap();
2362
2363
  let lh = hu;
2363
2364
  var Zs;
2364
2365
  class Ou {
@@ -2543,9 +2544,9 @@ const ne = (s, e, t) => {
2543
2544
  0,
2544
2545
  0
2545
2546
  ])), s.writer.writeUint32(2);
2546
- }, Hd = (s) => "sequenceParameterSets" in s, mh = (s) => "sequenceHeader" in s, ys = (s) => s.type == "video", or = (s) => s.type == "audio", ep = (s, e, t) => {
2547
+ }, Hd = (s) => "sequenceParameterSets" in s, mh = (s) => "sequenceHeader" in s, ys = (s) => s.type == "video", cr = (s) => s.type == "audio", ep = (s, e, t) => {
2547
2548
  const i = s.writer.position();
2548
- ae(s, j.tkhd, 0, 0, 3), s.writer.writeUint32(0), s.writer.writeUint32(0), s.writer.writeUint32(e.trackId), s.writer.writeUint32(0), s.writer.writeUint32(e.duration * t / e.timescale), s.writer.writeUint32(0), s.writer.writeUint32(0), s.writer.writeUint16(0), s.writer.writeUint16(or(e) ? 1 : 0), s.writer.writeUint16(or(e) ? 256 : 0), s.writer.writeUint16(0), s.writer.writeBytes(new Uint8Array(
2549
+ ae(s, j.tkhd, 0, 0, 3), s.writer.writeUint32(0), s.writer.writeUint32(0), s.writer.writeUint32(e.trackId), s.writer.writeUint32(0), s.writer.writeUint32(e.duration * t / e.timescale), s.writer.writeUint32(0), s.writer.writeUint32(0), s.writer.writeUint16(0), s.writer.writeUint16(cr(e) ? 1 : 0), s.writer.writeUint16(cr(e) ? 256 : 0), s.writer.writeUint16(0), s.writer.writeBytes(new Uint8Array(
2549
2550
  [
2550
2551
  0,
2551
2552
  1,
@@ -2584,7 +2585,7 @@ const ne = (s, e, t) => {
2584
2585
  0,
2585
2586
  0
2586
2587
  ]
2587
- )), ys(e) ? (s.writer.writeUint32(e.width * 65536), s.writer.writeUint32(e.height * 65536)) : or(e) && (s.writer.writeUint32(0), s.writer.writeUint32(0)), s.writer.writeUint32At(i, s.writer.position() - i);
2588
+ )), ys(e) ? (s.writer.writeUint32(e.width * 65536), s.writer.writeUint32(e.height * 65536)) : cr(e) && (s.writer.writeUint32(0), s.writer.writeUint32(0)), s.writer.writeUint32At(i, s.writer.position() - i);
2588
2589
  }, tp = (s, e) => {
2589
2590
  ae(s, j.mdhd, 20, 0, 0), s.writer.writeUint32(0), s.writer.writeUint32(0), s.writer.writeUint32(e.timescale), s.writer.writeUint32(e.duration);
2590
2591
  const t = e.lang || "und", i = (t.charCodeAt(0) & 31) << 10 | (t.charCodeAt(1) & 31) << 5 | t.charCodeAt(2) & 31;
@@ -2652,10 +2653,10 @@ const ne = (s, e, t) => {
2652
2653
  const t = s.writer.position();
2653
2654
  ne(s, j.stbl, 0);
2654
2655
  const i = s.writer.position();
2655
- ae(s, j.stsd, 0, 0, 0), s.writer.writeUint32(1), ys(e) ? ap(s, e) : or(e) && up(s, e), s.writer.writeUint32At(i, s.writer.position() - i), ae(s, B("stts"), 4, 0, 0), s.writer.writeUint32(0), ae(s, B("stsc"), 4, 0, 0), s.writer.writeUint32(0), ae(s, B("stsz"), 8, 0, 0), s.writer.writeUint32(0), s.writer.writeUint32(0), ae(s, B("stco"), 4, 0, 0), s.writer.writeUint32(0), s.writer.writeUint32At(t, s.writer.position() - t);
2656
+ ae(s, j.stsd, 0, 0, 0), s.writer.writeUint32(1), ys(e) ? ap(s, e) : cr(e) && up(s, e), s.writer.writeUint32At(i, s.writer.position() - i), ae(s, B("stts"), 4, 0, 0), s.writer.writeUint32(0), ae(s, B("stsc"), 4, 0, 0), s.writer.writeUint32(0), ae(s, B("stsz"), 8, 0, 0), s.writer.writeUint32(0), s.writer.writeUint32(0), ae(s, B("stco"), 4, 0, 0), s.writer.writeUint32(0), s.writer.writeUint32At(t, s.writer.position() - t);
2656
2657
  }, lp = (s, e) => {
2657
2658
  const t = s.writer.position();
2658
- ne(s, j.minf, 0), ys(e) ? (ae(s, j.vmhd, 8, 0, 1), s.writer.writeUint32(0), s.writer.writeUint32(0)) : or(e) && (ae(s, j.smhd, 4, 0, 0), s.writer.writeUint16(0), s.writer.writeUint16(0)), sp(s), dp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
2659
+ ne(s, j.minf, 0), ys(e) ? (ae(s, j.vmhd, 8, 0, 1), s.writer.writeUint32(0), s.writer.writeUint32(0)) : cr(e) && (ae(s, j.smhd, 4, 0, 0), s.writer.writeUint16(0), s.writer.writeUint16(0)), sp(s), dp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
2659
2660
  }, mp = (s, e) => {
2660
2661
  const t = s.writer.position();
2661
2662
  ne(s, j.mdia, 0), tp(s, e), ip(s, e), lp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
@@ -2691,14 +2692,14 @@ const ne = (s, e, t) => {
2691
2692
  for (const u of e.samples)
2692
2693
  n && (s.writer.writeUint32(u.duration), s.writer.writeUint32(u.data.byteLength), s.writer.writeUint32(qc(u))), t && s.writer.writeUint32(u.compositionTimeOffset || 0);
2693
2694
  s.writer.writeUint32At(h, s.writer.position() - s.moofOffset + 8), s.writer.writeUint32At(c, s.writer.position() - c);
2694
- }, qc = (s) => s.isSync ? 33554432 : 16842752, Sp = (s, e) => {
2695
+ }, qc = (s) => s.isSync ? 33554432 : 16842752, vp = (s, e) => {
2695
2696
  const t = s.writer.position();
2696
2697
  ne(s, j.traf, 0), wp(s, e), bp(s, e), yp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
2697
- }, vp = (s, e) => {
2698
+ }, Sp = (s, e) => {
2698
2699
  ae(s, j.mfhd, 4, 0, 0), s.writer.writeUint32(e);
2699
2700
  }, Ep = (s, e) => {
2700
2701
  const t = s.writer.position();
2701
- ne(s, j.moof, 0), vp(s, e.sequenceNumber), Sp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
2702
+ ne(s, j.moof, 0), Sp(s, e.sequenceNumber), vp(s, e), s.writer.writeUint32At(t, s.writer.position() - t);
2702
2703
  }, Tp = (s, e) => {
2703
2704
  const t = e.samples.reduce((i, n) => i + n.data.byteLength, 0);
2704
2705
  ne(s, j.mdat, t), e.samples.forEach((i) => s.writer.writeBytes(i.data));
@@ -2710,7 +2711,7 @@ const ne = (s, e, t) => {
2710
2711
  const e = new zd();
2711
2712
  return ((t = s.samples[0]) == null ? void 0 : t.producerReferenceTime) !== void 0 && Yf(e, s.trackId, s.samples[0].producerReferenceTime, s.timestamp), e.moofOffset = e.writer.position(), Ep(e, s), Tp(e, s), e.writer.buffer();
2712
2713
  }, Ip = (s, e) => {
2713
- const t = s.map((c) => M(S({}, c), {
2714
+ const t = s.map((c) => M(v({}, c), {
2714
2715
  data: new Uint8Array(c.data)
2715
2716
  }));
2716
2717
  if (!t[0])
@@ -2742,7 +2743,7 @@ const ne = (s, e, t) => {
2742
2743
  throw new Error("No sps or pps provided");
2743
2744
  return kf(i);
2744
2745
  }, kp = (s, e) => {
2745
- const t = s.map((h) => M(S({}, h), {
2746
+ const t = s.map((h) => M(v({}, h), {
2746
2747
  data: new Uint8Array(h.data)
2747
2748
  }));
2748
2749
  if (!t[0])
@@ -2783,7 +2784,7 @@ const ne = (s, e, t) => {
2783
2784
  sampleRate: 48e3
2784
2785
  }
2785
2786
  ]), Up = (s, e) => {
2786
- const t = s.map((c) => M(S({}, c), {
2787
+ const t = s.map((c) => M(v({}, c), {
2787
2788
  data: new Uint8Array(c.data)
2788
2789
  }));
2789
2790
  if (!t[0])
@@ -2854,13 +2855,13 @@ const ne = (s, e, t) => {
2854
2855
  u && s.readBit() !== 0 && s.readBits(4), g.push({ tier: _e, operatingPointIdc: J, seqLevelIdx: ce });
2855
2856
  }
2856
2857
  }
2857
- const w = s.readBits(4) + 1, b = s.readBits(4) + 1, v = s.readBits(w) + 1, I = s.readBits(b) + 1;
2858
+ const w = s.readBits(4) + 1, b = s.readBits(4) + 1, S = s.readBits(w) + 1, I = s.readBits(b) + 1;
2858
2859
  let k = !1;
2859
2860
  n ? k = !1 : k = s.readBit() !== 0, k && (m = s.readBits(4) + 2, p = s.readBits(3) + 1);
2860
- const D = s.readBit() !== 0, T = s.readBit() !== 0, P = s.readBit() !== 0;
2861
+ const L = s.readBit() !== 0, T = s.readBit() !== 0, P = s.readBit() !== 0;
2861
2862
  let R = !1, X = !1, Q = !1, Fe = !1, te = !1, Ze = !1, ht = !1, Be = Fu, y = Zc, E = 0;
2862
2863
  n || (R = s.readBit() !== 0, X = s.readBit() !== 0, Q = s.readBit() !== 0, Fe = s.readBit() !== 0, te = s.readBit() !== 0, te && (Ze = s.readBit() !== 0, ht = s.readBit() !== 0), s.readBit() !== 0 ? Be = Fu : Be = s.readBit(), Be > 0 ? s.readBit() > 0 ? y = Zc : y = s.readBit() : y = Zc, te ? E = s.readBits(3) : E = 0);
2863
- const F = s.readBit() !== 0, G = s.readBit() !== 0, L = s.readBit() !== 0;
2864
+ const F = s.readBit() !== 0, G = s.readBit() !== 0, D = s.readBit() !== 0;
2864
2865
  return {
2865
2866
  seqProfile: e,
2866
2867
  stillPicture: i,
@@ -2877,12 +2878,12 @@ const ne = (s, e, t) => {
2877
2878
  operatingPoints: g,
2878
2879
  frameWidthBits: w,
2879
2880
  frameHeightBits: b,
2880
- maxFrameWidth: v,
2881
+ maxFrameWidth: S,
2881
2882
  maxFrameHeight: I,
2882
2883
  frameIdNumbersPresentFlag: k,
2883
2884
  deltaFrameIdLength: m,
2884
2885
  additionalFrameIdLength: p,
2885
- use_128x128Superblock: D,
2886
+ use_128x128Superblock: L,
2886
2887
  enableFilterIntra: T,
2887
2888
  enableIntraEdgeFilter: P,
2888
2889
  enableInterintraCompound: R,
@@ -2897,7 +2898,7 @@ const ne = (s, e, t) => {
2897
2898
  orderHintBits: E,
2898
2899
  enableSuperres: F,
2899
2900
  enableCdef: G,
2900
- enableRestoration: L,
2901
+ enableRestoration: D,
2901
2902
  colorConfig: jp(s, e),
2902
2903
  filmGrainParamsPresent: s.readBit() !== 0
2903
2904
  };
@@ -2906,8 +2907,8 @@ const ne = (s, e, t) => {
2906
2907
  let i = 8, n = !1;
2907
2908
  e === 2 && t ? i = s.readBit() !== 0 ? 12 : 10 : e <= 2 && (i = t ? 10 : 8), e === 1 ? n = !1 : n = s.readBit() !== 0;
2908
2909
  const o = n ? 1 : 3, c = s.readBit() !== 0;
2909
- let h = Mp, u = Fp, m = Vp, p = !1, g = 0, w = 0, b = _u, v = !1;
2910
- return c && (h = s.readBits(8), u = s.readBits(8), m = s.readBits(8)), n ? (p = s.readBit() !== 0, g = 1, w = 1, b = _u, v = !1, {
2910
+ let h = Mp, u = Fp, m = Vp, p = !1, g = 0, w = 0, b = _u, S = !1;
2911
+ return c && (h = s.readBits(8), u = s.readBits(8), m = s.readBits(8)), n ? (p = s.readBit() !== 0, g = 1, w = 1, b = _u, S = !1, {
2911
2912
  highBitDepth: t,
2912
2913
  bitDepth: i,
2913
2914
  monoChrome: n,
@@ -2916,7 +2917,7 @@ const ne = (s, e, t) => {
2916
2917
  colorRange: p,
2917
2918
  matrixCoefficients: m,
2918
2919
  numPlanes: o,
2919
- separateUvDeltaQ: v,
2920
+ separateUvDeltaQ: S,
2920
2921
  subsamplingX: g,
2921
2922
  subsamplingY: w,
2922
2923
  transferCharacteristics: u
@@ -2929,11 +2930,11 @@ const ne = (s, e, t) => {
2929
2930
  colorRange: p,
2930
2931
  matrixCoefficients: m,
2931
2932
  numPlanes: o,
2932
- separateUvDeltaQ: v,
2933
+ separateUvDeltaQ: S,
2933
2934
  subsamplingX: g,
2934
2935
  subsamplingY: w,
2935
2936
  transferCharacteristics: u
2936
- }) : (p = s.readBit() !== 0, e === 0 ? (g = 1, w = 1) : e === 1 ? (g = 0, w = 0) : i === 12 ? (g = s.readBit(), g !== 0 ? w = s.readBit() : w = 0) : (g = 1, w = 0), g !== 0 && w !== 0 && (b = s.readBits(2)), v = s.readBit() !== 0, {
2937
+ }) : (p = s.readBit() !== 0, e === 0 ? (g = 1, w = 1) : e === 1 ? (g = 0, w = 0) : i === 12 ? (g = s.readBit(), g !== 0 ? w = s.readBit() : w = 0) : (g = 1, w = 0), g !== 0 && w !== 0 && (b = s.readBits(2)), S = s.readBit() !== 0, {
2937
2938
  highBitDepth: t,
2938
2939
  bitDepth: i,
2939
2940
  monoChrome: n,
@@ -2942,7 +2943,7 @@ const ne = (s, e, t) => {
2942
2943
  colorRange: p,
2943
2944
  matrixCoefficients: m,
2944
2945
  numPlanes: o,
2945
- separateUvDeltaQ: v,
2946
+ separateUvDeltaQ: S,
2946
2947
  subsamplingX: g,
2947
2948
  subsamplingY: w,
2948
2949
  transferCharacteristics: u
@@ -2955,7 +2956,7 @@ const ne = (s, e, t) => {
2955
2956
  height: e.maxFrameHeight
2956
2957
  };
2957
2958
  }, zp = (s, e) => {
2958
- const t = s.map((h) => M(S({}, h), {
2959
+ const t = s.map((h) => M(v({}, h), {
2959
2960
  data: new Uint8Array(h.data)
2960
2961
  }));
2961
2962
  if (!t[0])
@@ -3022,7 +3023,7 @@ const ne = (s, e, t) => {
3022
3023
  default:
3023
3024
  throw new Error(`Unsupported codec ${s[0].codec}`);
3024
3025
  }
3025
- }, cr = (s) => !!(s & 1), Kp = (s) => !!(s & 2), eg = (s) => !!(s & 4), tg = (s) => !!(s & 8), ig = (s) => !!(s & 16), sg = (s) => {
3026
+ }, hr = (s) => !!(s & 1), Kp = (s) => !!(s & 2), eg = (s) => !!(s & 4), tg = (s) => !!(s & 8), ig = (s) => !!(s & 16), sg = (s) => {
3026
3027
  const e = new DataView(s, 0), t = e.getUint8(0), i = e.getUint16(1), n = e.getUint8(3), o = e.getUint8(4), c = iu(new Uint8Array(s), 5, 12), h = e.getUint32(13), u = ig(n) ? e.getInt16(17) : void 0, m = s.slice(i);
3027
3028
  return { version: t, renditionId: o, flags: n, timestamp: c, timescale: h, payload: m, compositionTimeOffset: u };
3028
3029
  }, ng = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw", eo = () => "wakeLock" in navigator && window.navigator.userAgent.indexOf("Samsung") === -1;
@@ -3082,25 +3083,25 @@ class rg {
3082
3083
  }
3083
3084
  }
3084
3085
  const ag = /\r\n|\r|\n/;
3085
- var ni, Dt;
3086
+ var ri, Dt;
3086
3087
  class Nu {
3087
3088
  constructor(e) {
3088
- d(this, ni);
3089
+ d(this, ri);
3089
3090
  d(this, Dt);
3090
- l(this, ni, e), l(this, Dt, 0);
3091
+ l(this, ri, e), l(this, Dt, 0);
3091
3092
  }
3092
3093
  skipEmptyLines() {
3093
3094
  let e = 0;
3094
- for (; a(this, ni)[a(this, Dt)] === ""; )
3095
+ for (; a(this, ri)[a(this, Dt)] === ""; )
3095
3096
  Je(this, Dt)._++, e++;
3096
3097
  return e;
3097
3098
  }
3098
3099
  readLine() {
3099
- return a(this, ni)[Je(this, Dt)._++];
3100
+ return a(this, ri)[Je(this, Dt)._++];
3100
3101
  }
3101
3102
  takeUntilEmptyLine() {
3102
3103
  const e = [];
3103
- for (; a(this, ni)[a(this, Dt)] !== ""; ) {
3104
+ for (; a(this, ri)[a(this, Dt)] !== ""; ) {
3104
3105
  const t = this.readLine();
3105
3106
  if (t === void 0)
3106
3107
  break;
@@ -3109,14 +3110,14 @@ class Nu {
3109
3110
  return e;
3110
3111
  }
3111
3112
  linesLeft() {
3112
- return a(this, ni).length - a(this, Dt);
3113
+ return a(this, ri).length - a(this, Dt);
3113
3114
  }
3114
3115
  }
3115
- ni = new WeakMap(), Dt = new WeakMap();
3116
- var Ss, Zd, fh;
3116
+ ri = new WeakMap(), Dt = new WeakMap();
3117
+ var vs, Zd, fh;
3117
3118
  class qd {
3118
3119
  constructor() {
3119
- d(this, Ss);
3120
+ d(this, vs);
3120
3121
  }
3121
3122
  parse(e) {
3122
3123
  const t = [], i = e.split(ag), n = new Nu(i), o = n.readLine();
@@ -3125,13 +3126,13 @@ class qd {
3125
3126
  for (; n.readLine() !== ""; )
3126
3127
  ;
3127
3128
  for (; n.linesLeft() > 0; ) {
3128
- const c = A(this, Ss, Zd).call(this, n);
3129
+ const c = A(this, vs, Zd).call(this, n);
3129
3130
  c && t.push(c), n.skipEmptyLines();
3130
3131
  }
3131
3132
  return t;
3132
3133
  }
3133
3134
  }
3134
- Ss = new WeakSet(), Zd = function(e) {
3135
+ vs = new WeakSet(), Zd = function(e) {
3135
3136
  e.skipEmptyLines();
3136
3137
  const t = e.takeUntilEmptyLine(), i = new Nu(t);
3137
3138
  let n = i.readLine(), o;
@@ -3148,7 +3149,7 @@ Ss = new WeakSet(), Zd = function(e) {
3148
3149
  const p = i.readLine();
3149
3150
  if (!p)
3150
3151
  throw new Error("missing text");
3151
- const g = A(this, Ss, fh).call(this, c), w = A(this, Ss, fh).call(this, u);
3152
+ const g = A(this, vs, fh).call(this, c), w = A(this, vs, fh).call(this, u);
3152
3153
  return {
3153
3154
  id: o,
3154
3155
  startTime: g,
@@ -3168,8 +3169,8 @@ const og = (s) => {
3168
3169
  const e = window;
3169
3170
  e.vindralInstances = e.vindralInstances || {}, e.vindralInstances[s.getStatistics().clientId.substring(0, 8)] = s;
3170
3171
  };
3171
- class ph extends Ei {
3172
- constructor({ type: t, autoplay: i, muted: n, logger: o, poster: c }) {
3172
+ class ph extends Ti {
3173
+ constructor({ type: t, autoplay: i, muted: n, volume: o, logger: c, poster: h }) {
3173
3174
  super();
3174
3175
  r(this, "element");
3175
3176
  r(this, "logger");
@@ -3280,11 +3281,11 @@ class ph extends Ei {
3280
3281
  r(this, "onSeekEnd", () => {
3281
3282
  this.seekStartTime && (this.seekTimes.push(Date.now() - this.seekStartTime), this.seekStartTime = void 0);
3282
3283
  });
3283
- this.logger = o, this._userProvidedMuted = n, this.element = document.createElement(t), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = i, this.element.muted = n, this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute(
3284
+ this.logger = c, this._userProvidedMuted = n, this.element = document.createElement(t), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = i, this.element.muted = n, o !== void 0 && (this.element.volume = o), this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute(
3284
3285
  "poster",
3285
3286
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg=="
3286
3287
  ), this.onPlayPause(), setTimeout(() => {
3287
- !this.element || !c || this.element.setAttribute("poster", c);
3288
+ !this.element || !h || this.element.setAttribute("poster", h);
3288
3289
  }, 0), this.element.addEventListener("stalled", this.onEvent), this.element.addEventListener("canplay", this.onEvent), this.element.addEventListener("loadeddata", this.onEvent), this.element.addEventListener("loadedmetadata", this.onEvent), this.element.addEventListener("canplaythrough", this.onEvent), this.element.addEventListener("waiting", this.onEvent), this.element.addEventListener("playing", this.onPlayPause), this.element.addEventListener("pause", this.onPlayPause), this.element.addEventListener("seeked", this.onSeekEnd), this.element.addEventListener("seeking", this.onSeekStart), this.element.addEventListener("volumechange", this.onVolumeChange), this.element.addEventListener("timeupdate", this.onBufferStateChange), this.element.addEventListener("progress", this.onBufferStateChange);
3289
3290
  }
3290
3291
  get seekTime() {
@@ -3333,7 +3334,7 @@ const cg = (s) => {
3333
3334
  return bs(s) ? e = {
3334
3335
  type: "media-source",
3335
3336
  audio: {
3336
- contentType: Oi(s),
3337
+ contentType: ti(s),
3337
3338
  bitrate: s.bitRate,
3338
3339
  channels: s.channels.toString(),
3339
3340
  samplerate: s.sampleRate
@@ -3341,7 +3342,7 @@ const cg = (s) => {
3341
3342
  } : e = {
3342
3343
  type: "media-source",
3343
3344
  video: {
3344
- contentType: Oi(s),
3345
+ contentType: ti(s),
3345
3346
  bitrate: s.bitRate,
3346
3347
  width: s.width,
3347
3348
  height: s.height,
@@ -3420,7 +3421,7 @@ const cg = (s) => {
3420
3421
  const { bufferFullness: t, general: i } = this.qualityOfServiceSource.getMetrics(), n = this.qualityOfServiceSource.getBufferFullnessRegression();
3421
3422
  if (!n)
3422
3423
  return;
3423
- const o = 10 * 1e3, c = 30 * 1e3, { slope: h } = n, u = n.predict(Jc), m = h < 0, p = n.predict(Jc) < Vu && n.slope < 0, g = n.predict(Jc) > lg, w = this.qualityOfServiceSource.timeSpentBufferingLast(c), b = this.qualityOfServiceSource.timeSpentActiveLast(c), v = this.qualityOfServiceSource.bufferingEventsLast(c), I = b > 0 ? w / b : 0, k = this.qualityOfServiceSource.getTargetBufferTime();
3424
+ const o = 10 * 1e3, c = 30 * 1e3, { slope: h } = n, u = n.predict(Jc), m = h < 0, p = n.predict(Jc) < Vu && n.slope < 0, g = n.predict(Jc) > lg, w = this.qualityOfServiceSource.timeSpentBufferingLast(c), b = this.qualityOfServiceSource.timeSpentActiveLast(c), S = this.qualityOfServiceSource.bufferingEventsLast(c), I = b > 0 ? w / b : 0, k = this.qualityOfServiceSource.getTargetBufferTime();
3424
3425
  if (t < 0.15 && I > 0.8) {
3425
3426
  this.adaptLevel("reconnect");
3426
3427
  return;
@@ -3434,7 +3435,7 @@ const cg = (s) => {
3434
3435
  return;
3435
3436
  }
3436
3437
  if (k < 1e3) {
3437
- e.playbackState === "buffering" && (v > 5 || I > 0.3) && this.adaptLevel("downgrade");
3438
+ e.playbackState === "buffering" && (S > 5 || I > 0.3) && this.adaptLevel("downgrade");
3438
3439
  return;
3439
3440
  }
3440
3441
  (p || t < hg) && m && t < Vu && u < ug && this.adaptLevel(e.playbackState === "buffering" ? "double downgrade" : "downgrade");
@@ -3443,7 +3444,7 @@ const cg = (s) => {
3443
3444
  this.reset();
3444
3445
  });
3445
3446
  r(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e));
3446
- this.qualityOfServiceSource = i, this.config = S(S({}, mg), n), this.emitter = e, this.logger = t;
3447
+ this.qualityOfServiceSource = i, this.config = v(v({}, mg), n), this.emitter = e, this.logger = t;
3447
3448
  }
3448
3449
  tooMuchTimeBuffering(e) {
3449
3450
  const t = this.qualityOfServiceSource.timeSpentActiveLast(e);
@@ -3508,10 +3509,10 @@ const fg = {
3508
3509
  this.targetBufferTimeTarget.targetBufferTime + m
3509
3510
  ), this.bufferTimeAdjustmentCount++, this.reset());
3510
3511
  });
3511
- this.qualityOfServiceSource = i, this.targetBufferTimeTarget = n, this.config = S(S({}, fg), o), this.emitter = e, this.logger = t;
3512
+ this.qualityOfServiceSource = i, this.targetBufferTimeTarget = n, this.config = v(v({}, fg), o), this.emitter = e, this.logger = t;
3512
3513
  }
3513
3514
  updateConfig(e) {
3514
- this.config = S(S({}, this.config), e);
3515
+ this.config = v(v({}, this.config), e);
3515
3516
  }
3516
3517
  };
3517
3518
  r(Yt, "BUFFER_TIME_STEP_SIZE", 500), r(Yt, "BUFFER_TIME_MAX_STEPS", 3), r(Yt, "create", (e, t, i, n, o = {}) => new Yt(e, t, i, n, o));
@@ -3599,10 +3600,10 @@ class pg {
3599
3600
  }
3600
3601
  }
3601
3602
  pt = new WeakMap(), Js = new WeakMap(), $s = new WeakMap(), zr = new WeakMap(), Hr = new WeakMap(), Ys = new WeakMap(), Qr = new WeakMap(), Xr = new WeakMap();
3602
- var gt, Ks, qr, Zr, en, vs, $d, wh;
3603
+ var gt, Ks, qr, Zr, en, Ss, $d, wh;
3603
3604
  class gg {
3604
3605
  constructor(e, t, i, n, o) {
3605
- d(this, vs);
3606
+ d(this, Ss);
3606
3607
  d(this, gt);
3607
3608
  d(this, Ks);
3608
3609
  d(this, qr);
@@ -3617,7 +3618,7 @@ class gg {
3617
3618
  return a(this, en);
3618
3619
  }
3619
3620
  groups() {
3620
- return A(this, vs, $d).call(this);
3621
+ return A(this, Ss, $d).call(this);
3621
3622
  }
3622
3623
  subscribeId() {
3623
3624
  return a(this, Ks);
@@ -3631,13 +3632,13 @@ class gg {
3631
3632
  return this;
3632
3633
  }
3633
3634
  [kt()]() {
3634
- return A(this, vs, wh).call(this);
3635
+ return A(this, Ss, wh).call(this);
3635
3636
  }
3636
3637
  [Symbol.asyncDispose]() {
3637
- return A(this, vs, wh).call(this);
3638
+ return A(this, Ss, wh).call(this);
3638
3639
  }
3639
3640
  }
3640
- gt = new WeakMap(), Ks = new WeakMap(), qr = new WeakMap(), Zr = new WeakMap(), en = new WeakMap(), vs = new WeakSet(), $d = function() {
3641
+ gt = new WeakMap(), Ks = new WeakMap(), qr = new WeakMap(), Zr = new WeakMap(), en = new WeakMap(), Ss = new WeakSet(), $d = function() {
3641
3642
  return Rt(this, null, function* () {
3642
3643
  for (; !(yield new q(a(this, gt).isDone())); ) {
3643
3644
  const e = yield new q(a(this, gt).readBigVarInt()), t = new pg(
@@ -3753,26 +3754,26 @@ function Kd(s, e) {
3753
3754
  }
3754
3755
  });
3755
3756
  }
3756
- var ri, ea;
3757
+ var ai, ea;
3757
3758
  class wg {
3758
3759
  constructor(e, t) {
3759
- d(this, ri);
3760
+ d(this, ai);
3760
3761
  d(this, ea);
3761
- l(this, ri, e), l(this, ea, t);
3762
+ l(this, ai, e), l(this, ea, t);
3762
3763
  }
3763
3764
  start(e) {
3764
- a(this, ri).addEventListener("message", (t) => {
3765
+ a(this, ai).addEventListener("message", (t) => {
3765
3766
  if (typeof t.data == "object" && t.data instanceof ArrayBuffer) {
3766
3767
  const i = new Uint8Array(t.data);
3767
3768
  i[0] == a(this, ea) && e.enqueue(i.subarray(1));
3768
3769
  }
3769
- }), a(this, ri).addEventListener("error", () => e.error(new Error("WebSocket error"))), a(this, ri).addEventListener("close", () => Bd(() => e.close()));
3770
+ }), a(this, ai).addEventListener("error", () => e.error(new Error("WebSocket error"))), a(this, ai).addEventListener("close", () => Bd(() => e.close()));
3770
3771
  }
3771
3772
  cancel(e) {
3772
- a(this, ri).close(void 0, e);
3773
+ a(this, ai).close(void 0, e);
3773
3774
  }
3774
3775
  }
3775
- ri = new WeakMap(), ea = new WeakMap();
3776
+ ai = new WeakMap(), ea = new WeakMap();
3776
3777
  var At, Wi, zi, Hi;
3777
3778
  class bg {
3778
3779
  constructor(e) {
@@ -3798,7 +3799,7 @@ class bg {
3798
3799
  }
3799
3800
  }
3800
3801
  At = new WeakMap(), Wi = new WeakMap(), zi = new WeakMap(), Hi = new WeakMap();
3801
- var wt, ta, Qi, bt, Jo, W, sr, io, Pi, so, Jt;
3802
+ var wt, ta, Qi, bt, Jo, W, nr, io, xi, so, Jt;
3802
3803
  class xo {
3803
3804
  constructor(e, t) {
3804
3805
  d(this, W);
@@ -3811,7 +3812,7 @@ class xo {
3811
3812
  }
3812
3813
  readUnsigned8() {
3813
3814
  return f(this, null, function* () {
3814
- return yield A(this, W, Pi).call(this, 1), A(this, W, Jt).call(this, 1)[0];
3815
+ return yield A(this, W, xi).call(this, 1), A(this, W, Jt).call(this, 1)[0];
3815
3816
  });
3816
3817
  }
3817
3818
  readString() {
@@ -3830,23 +3831,23 @@ class xo {
3830
3831
  }
3831
3832
  readBigVarInt() {
3832
3833
  return f(this, null, function* () {
3833
- yield A(this, W, Pi).call(this, 1);
3834
+ yield A(this, W, xi).call(this, 1);
3834
3835
  const e = (A(this, W, so).call(this, 1)[0] & 192) >> 6;
3835
3836
  switch (a(this, wt)[a(this, bt)] = A(this, W, so).call(this, 1)[0] & 63, e) {
3836
3837
  case 0:
3837
3838
  return U(A(this, W, Jt).call(this, 1)[0]);
3838
3839
  case 1: {
3839
- yield A(this, W, Pi).call(this, 2);
3840
+ yield A(this, W, xi).call(this, 2);
3840
3841
  const t = A(this, W, Jt).call(this, 2), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3841
3842
  return U(i.getUint16(0));
3842
3843
  }
3843
3844
  case 2: {
3844
- yield A(this, W, Pi).call(this, 4);
3845
+ yield A(this, W, xi).call(this, 4);
3845
3846
  const t = A(this, W, Jt).call(this, 4), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3846
3847
  return U(i.getUint32(0));
3847
3848
  }
3848
3849
  case 3: {
3849
- yield A(this, W, Pi).call(this, 8);
3850
+ yield A(this, W, xi).call(this, 8);
3850
3851
  const t = A(this, W, Jt).call(this, 8), i = new DataView(t.buffer, t.byteOffset, t.byteLength);
3851
3852
  if (typeof i.getBigUint64 != "undefined")
3852
3853
  return U(i.getBigUint64(0));
@@ -3860,19 +3861,19 @@ class xo {
3860
3861
  }
3861
3862
  read(e) {
3862
3863
  return f(this, null, function* () {
3863
- return yield A(this, W, Pi).call(this, e), A(this, W, Jt).call(this, e);
3864
+ return yield A(this, W, xi).call(this, e), A(this, W, Jt).call(this, e);
3864
3865
  });
3865
3866
  }
3866
3867
  readAll() {
3867
3868
  return f(this, null, function* () {
3868
3869
  for (; yield A(this, W, io).call(this); )
3869
3870
  ;
3870
- return A(this, W, Jt).call(this, A(this, W, sr).call(this));
3871
+ return A(this, W, Jt).call(this, A(this, W, nr).call(this));
3871
3872
  });
3872
3873
  }
3873
3874
  isDone() {
3874
3875
  return f(this, null, function* () {
3875
- return A(this, W, sr).call(this) > 0 ? !1 : (yield A(this, W, io).call(this)) == 0;
3876
+ return A(this, W, nr).call(this) > 0 ? !1 : (yield A(this, W, io).call(this)) == 0;
3876
3877
  });
3877
3878
  }
3878
3879
  closed() {
@@ -3886,14 +3887,14 @@ class xo {
3886
3887
  });
3887
3888
  }
3888
3889
  }
3889
- wt = new WeakMap(), ta = new WeakMap(), Qi = new WeakMap(), bt = new WeakMap(), Jo = new WeakMap(), W = new WeakSet(), sr = function() {
3890
+ wt = new WeakMap(), ta = new WeakMap(), Qi = new WeakMap(), bt = new WeakMap(), Jo = new WeakMap(), W = new WeakSet(), nr = function() {
3890
3891
  return a(this, wt).length - a(this, bt);
3891
3892
  }, io = function() {
3892
3893
  return f(this, null, function* () {
3893
3894
  const { value: e, done: t } = yield a(this, Qi).read();
3894
3895
  if (t)
3895
3896
  return Promise.resolve(0);
3896
- if (A(this, W, sr).call(this) === 0)
3897
+ if (A(this, W, nr).call(this) === 0)
3897
3898
  l(this, wt, e);
3898
3899
  else {
3899
3900
  const n = a(this, wt).subarray(a(this, bt)), o = new Uint8Array(n.length + e.length);
@@ -3901,9 +3902,9 @@ wt = new WeakMap(), ta = new WeakMap(), Qi = new WeakMap(), bt = new WeakMap(),
3901
3902
  }
3902
3903
  return l(this, bt, 0), Promise.resolve(e.length);
3903
3904
  });
3904
- }, Pi = function(e) {
3905
+ }, xi = function(e) {
3905
3906
  return f(this, null, function* () {
3906
- for (; A(this, W, sr).call(this) < e; )
3907
+ for (; A(this, W, nr).call(this) < e; )
3907
3908
  if ((yield A(this, W, io).call(this)) === 0)
3908
3909
  throw new Error("Read failed");
3909
3910
  });
@@ -3955,10 +3956,10 @@ const tl = {
3955
3956
  OPEN: 1
3956
3957
  };
3957
3958
  var Ue, Le, Xi, Yo;
3958
- const kr = class kr {
3959
+ const Br = class Br {
3959
3960
  constructor(e) {
3960
3961
  d(this, Ue, 0);
3961
- d(this, Le, new Uint8Array(kr.DEFAULT_BUFFER_SIZE));
3962
+ d(this, Le, new Uint8Array(Br.DEFAULT_BUFFER_SIZE));
3962
3963
  d(this, Xi);
3963
3964
  d(this, Yo, new TextEncoder());
3964
3965
  l(this, Xi, e);
@@ -3994,15 +3995,15 @@ const kr = class kr {
3994
3995
  flush() {
3995
3996
  if (a(this, Xi).readyState !== tl.OPEN)
3996
3997
  throw new Error("Writer is not open");
3997
- return a(this, Xi).send(a(this, Le).subarray(0, a(this, Ue))), l(this, Ue, 0), l(this, Le, new Uint8Array(kr.DEFAULT_BUFFER_SIZE)), Promise.resolve();
3998
+ return a(this, Xi).send(a(this, Le).subarray(0, a(this, Ue))), l(this, Ue, 0), l(this, Le, new Uint8Array(Br.DEFAULT_BUFFER_SIZE)), Promise.resolve();
3998
3999
  }
3999
4000
  close() {
4000
4001
  return a(this, Xi).close(), Promise.resolve();
4001
4002
  }
4002
4003
  };
4003
- Ue = new WeakMap(), Le = new WeakMap(), Xi = new WeakMap(), Yo = new WeakMap(), r(kr, "DEFAULT_BUFFER_SIZE", 1024);
4004
- let xr = kr;
4005
- const il = 2 ** 6 - 1, sl = 2 ** 14 - 1, nl = 2 ** 30 - 1, yg = Number.MAX_SAFE_INTEGER, Sg = typeof BigInt == "function" ? U(2) ** U(62) - U(1) : U(Number.MAX_SAFE_INTEGER);
4004
+ Ue = new WeakMap(), Le = new WeakMap(), Xi = new WeakMap(), Yo = new WeakMap(), r(Br, "DEFAULT_BUFFER_SIZE", 1024);
4005
+ let xr = Br;
4006
+ const il = 2 ** 6 - 1, sl = 2 ** 14 - 1, nl = 2 ** 30 - 1, yg = Number.MAX_SAFE_INTEGER, vg = typeof BigInt == "function" ? U(2) ** U(62) - U(1) : U(Number.MAX_SAFE_INTEGER);
4006
4007
  function Gc(s, e) {
4007
4008
  return e[0] = s, e.subarray(0, 1);
4008
4009
  }
@@ -4040,7 +4041,7 @@ function ul(s, e) {
4040
4041
  return rl(Number(s) | 16384, e);
4041
4042
  if (s <= nl)
4042
4043
  return al(Number(s) | 2147483648, e);
4043
- if (s <= Sg)
4044
+ if (s <= vg)
4044
4045
  return typeof BigInt == "function" ? ol(BigInt(s) | BigInt(3221225472) << BigInt(32), e) : cl(Number(s), e);
4045
4046
  throw new Error(`overflow, value larger than 62-bits: ${s}`);
4046
4047
  }
@@ -4064,7 +4065,7 @@ function nu(s, e) {
4064
4065
  });
4065
4066
  }
4066
4067
  const Lo = U(2);
4067
- function Jn(s) {
4068
+ function $n(s) {
4068
4069
  return f(this, null, function* () {
4069
4070
  const e = yield s.readVarInt(), t = /* @__PURE__ */ new Map();
4070
4071
  for (let i = 0; i < e; i++) {
@@ -4074,25 +4075,25 @@ function Jn(s) {
4074
4075
  return t;
4075
4076
  });
4076
4077
  }
4077
- function $n(s, e) {
4078
+ function Yn(s, e) {
4078
4079
  return f(this, null, function* () {
4079
4080
  yield s.writeVarInt(e.size);
4080
4081
  for (const [t, i] of e)
4081
4082
  yield s.writeBigVarInt(t), yield s.writeVarInt(i.payload.length), yield s.write(i.payload);
4082
4083
  });
4083
4084
  }
4084
- function vg(s) {
4085
+ function Sg(s) {
4085
4086
  return f(this, null, function* () {
4086
4087
  return {
4087
4088
  type: C.Announce,
4088
4089
  namespace: yield jc(s),
4089
- params: yield Jn(s)
4090
+ params: yield $n(s)
4090
4091
  };
4091
4092
  });
4092
4093
  }
4093
4094
  function Eg(s, e) {
4094
4095
  return f(this, null, function* () {
4095
- yield nu(s, e.namespace), yield $n(s, e.params);
4096
+ yield nu(s, e.namespace), yield Yn(s, e.params);
4096
4097
  });
4097
4098
  }
4098
4099
  function Tg(s) {
@@ -4197,7 +4198,7 @@ function ll(s, e) {
4197
4198
  }
4198
4199
  function Rg(s) {
4199
4200
  return f(this, null, function* () {
4200
- const e = yield s.readBigVarInt(), t = yield s.readBigVarInt(), i = yield jc(s), n = yield s.readString(), o = yield s.readUnsigned8(), c = yield dl(s), h = yield kg(s), u = yield Jn(s);
4201
+ const e = yield s.readBigVarInt(), t = yield s.readBigVarInt(), i = yield jc(s), n = yield s.readString(), o = yield s.readUnsigned8(), c = yield dl(s), h = yield kg(s), u = yield $n(s);
4201
4202
  if (h.type === "absolute-range") {
4202
4203
  const m = h.start.group > h.end.group, p = h.start.group === h.end.group && h.start.object > h.end.object;
4203
4204
  if (m || p)
@@ -4218,7 +4219,7 @@ function Rg(s) {
4218
4219
  }
4219
4220
  function Ug(s, e) {
4220
4221
  return f(this, null, function* () {
4221
- yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.trackAlias), yield nu(s, e.namespace), yield s.writeString(e.name), yield s.writeUnsigned8(e.subscriberPriority), yield ll(s, e.groupOrder), yield Bg(s, e.filterType), yield $n(s, e.params);
4222
+ yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.trackAlias), yield nu(s, e.namespace), yield s.writeString(e.name), yield s.writeUnsigned8(e.subscriberPriority), yield ll(s, e.groupOrder), yield Bg(s, e.filterType), yield Yn(s, e.params);
4222
4223
  });
4223
4224
  }
4224
4225
  const yh = {
@@ -4272,7 +4273,7 @@ function Og(s) {
4272
4273
  group: yield s.readBigVarInt(),
4273
4274
  object: yield s.readBigVarInt()
4274
4275
  });
4275
- const c = yield Jn(s);
4276
+ const c = yield $n(s);
4276
4277
  return {
4277
4278
  type: C.SubscribeOk,
4278
4279
  id: e,
@@ -4285,12 +4286,12 @@ function Og(s) {
4285
4286
  }
4286
4287
  function Mg(s, e) {
4287
4288
  return f(this, null, function* () {
4288
- yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.expires), yield ll(s, e.groupOrder), yield s.writeUnsigned8(e.largestInfo ? 1 : 0), e.largestInfo && (yield s.writeBigVarInt(e.largestInfo.group), yield s.writeBigVarInt(e.largestInfo.object)), yield $n(s, e.params);
4289
+ yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.expires), yield ll(s, e.groupOrder), yield s.writeUnsigned8(e.largestInfo ? 1 : 0), e.largestInfo && (yield s.writeBigVarInt(e.largestInfo.group), yield s.writeBigVarInt(e.largestInfo.object)), yield Yn(s, e.params);
4289
4290
  });
4290
4291
  }
4291
4292
  function Fg(s) {
4292
4293
  return f(this, null, function* () {
4293
- const e = yield s.readBigVarInt(), t = yield s.readBigVarInt(), i = yield s.readBigVarInt(), n = yield s.readBigVarInt(), o = yield s.readBigVarInt(), c = yield s.readUnsigned8(), h = yield Jn(s), u = t > n, m = t === n && i > o;
4294
+ const e = yield s.readBigVarInt(), t = yield s.readBigVarInt(), i = yield s.readBigVarInt(), n = yield s.readBigVarInt(), o = yield s.readBigVarInt(), c = yield s.readUnsigned8(), h = yield $n(s), u = t > n, m = t === n && i > o;
4294
4295
  if (u || m)
4295
4296
  throw new Error("Invalid filter range");
4296
4297
  return {
@@ -4305,7 +4306,7 @@ function Fg(s) {
4305
4306
  }
4306
4307
  function _g(s, e) {
4307
4308
  return f(this, null, function* () {
4308
- yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.start.group), yield s.writeBigVarInt(e.start.object), yield s.writeBigVarInt(e.end.group), yield s.writeBigVarInt(e.end.object), yield s.writeUnsigned8(e.subscriberPriority), yield $n(s, e.params);
4309
+ yield s.writeBigVarInt(e.id), yield s.writeBigVarInt(e.start.group), yield s.writeBigVarInt(e.start.object), yield s.writeBigVarInt(e.end.group), yield s.writeBigVarInt(e.end.object), yield s.writeUnsigned8(e.subscriberPriority), yield Yn(s, e.params);
4309
4310
  });
4310
4311
  }
4311
4312
  const Ng = {
@@ -4331,7 +4332,7 @@ function Vg(s, e) {
4331
4332
  yield s.writeVarInt(e.supportedVersions.length);
4332
4333
  for (const t of e.supportedVersions)
4333
4334
  yield s.writeVarInt(t.value);
4334
- yield $n(s, e.parameters);
4335
+ yield Yn(s, e.parameters);
4335
4336
  });
4336
4337
  }
4337
4338
  function Gg(s) {
@@ -4339,7 +4340,7 @@ function Gg(s) {
4339
4340
  const e = [], t = yield s.readVarInt();
4340
4341
  for (let n = 0; n < t; n++)
4341
4342
  e.push(yield fl(s));
4342
- const i = yield Jn(s);
4343
+ const i = yield $n(s);
4343
4344
  if (!i.has(Do.Role))
4344
4345
  throw new Error("Role parameter is required");
4345
4346
  return {
@@ -4351,7 +4352,7 @@ function Gg(s) {
4351
4352
  }
4352
4353
  function jg(s, e) {
4353
4354
  return f(this, null, function* () {
4354
- yield s.writeVarInt(e.selectedVersion.value), yield $n(s, e.parameters);
4355
+ yield s.writeVarInt(e.selectedVersion.value), yield Yn(s, e.parameters);
4355
4356
  });
4356
4357
  }
4357
4358
  function Wg(s) {
@@ -4359,7 +4360,7 @@ function Wg(s) {
4359
4360
  const e = yield fl(s);
4360
4361
  if (e.type !== "known")
4361
4362
  throw new Error("Expected known version");
4362
- const t = yield Jn(s);
4363
+ const t = yield $n(s);
4363
4364
  if (!t.has(Do.Role))
4364
4365
  throw new Error("Role parameter is required");
4365
4366
  return {
@@ -4382,7 +4383,7 @@ function Hg(s, e) {
4382
4383
  yield s.writeBigVarInt(e.id);
4383
4384
  });
4384
4385
  }
4385
- var Mt, on, ee, gl, Al, wl, bl, yl, Sl, vl, El, Tl, Il;
4386
+ var Mt, on, ee, gl, Al, wl, bl, yl, vl, Sl, El, Tl, Il;
4386
4387
  class pl {
4387
4388
  constructor(e) {
4388
4389
  d(this, ee);
@@ -4414,13 +4415,13 @@ class pl {
4414
4415
  yield A(this, ee, bl).call(this, t, e);
4415
4416
  break;
4416
4417
  case C.SubscribeUpdate:
4417
- yield A(this, ee, Sl).call(this, t, e);
4418
+ yield A(this, ee, vl).call(this, t, e);
4418
4419
  break;
4419
4420
  case C.SubscribeError:
4420
4421
  yield A(this, ee, yl).call(this, t, e);
4421
4422
  break;
4422
4423
  case C.SubscribeDone:
4423
- yield A(this, ee, vl).call(this, t, e);
4424
+ yield A(this, ee, Sl).call(this, t, e);
4424
4425
  break;
4425
4426
  case C.Unsubscribe:
4426
4427
  yield A(this, ee, El).call(this, t, e);
@@ -4466,11 +4467,11 @@ Mt = new WeakMap(), on = new WeakMap(), ee = new WeakSet(), gl = function(e, t)
4466
4467
  return f(this, null, function* () {
4467
4468
  yield Dg(e, t);
4468
4469
  });
4469
- }, Sl = function(e, t) {
4470
+ }, vl = function(e, t) {
4470
4471
  return f(this, null, function* () {
4471
4472
  yield _g(e, t);
4472
4473
  });
4473
- }, vl = function(e, t) {
4474
+ }, Sl = function(e, t) {
4474
4475
  return f(this, null, function* () {
4475
4476
  yield xg(e, t);
4476
4477
  });
@@ -4554,7 +4555,7 @@ class Gu {
4554
4555
  case C.Unsubscribe:
4555
4556
  return zg(a(this, he));
4556
4557
  case C.Announce:
4557
- return vg(a(this, he));
4558
+ return Sg(a(this, he));
4558
4559
  case C.AnnounceOk:
4559
4560
  return Tg(a(this, he));
4560
4561
  case C.AnnounceError:
@@ -4662,12 +4663,12 @@ class $g {
4662
4663
  this.state = e;
4663
4664
  }
4664
4665
  }
4665
- var ln, ai, qi, tc, Zi, st;
4666
+ var ln, oi, qi, tc, Zi, st;
4666
4667
  const Ns = class Ns {
4667
4668
  constructor(e) {
4668
4669
  r(this, "subscribe");
4669
4670
  d(this, ln, new z());
4670
- d(this, ai, new z());
4671
+ d(this, oi, new z());
4671
4672
  d(this, qi, new z());
4672
4673
  d(this, tc, Date.now());
4673
4674
  d(this, Zi, new z());
@@ -4686,10 +4687,10 @@ const Ns = class Ns {
4686
4687
  }
4687
4688
  onError(e) {
4688
4689
  const t = new Error(e.reason);
4689
- return a(this, ln).reject(t), a(this, ai).reject(t), t;
4690
+ return a(this, ln).reject(t), a(this, oi).reject(t), t;
4690
4691
  }
4691
4692
  onDone(e) {
4692
- e.finalInfo && (a(this, st) || l(this, st, { startGroup: U(0) }), a(this, st).endGroup = e.finalInfo.group), a(this, ai).resolve(e);
4693
+ e.finalInfo && (a(this, st) || l(this, st, { startGroup: U(0) }), a(this, st).endGroup = e.finalInfo.group), a(this, oi).resolve(e);
4693
4694
  }
4694
4695
  onUnsubscribe(e) {
4695
4696
  a(this, qi).resolve(e);
@@ -4698,12 +4699,12 @@ const Ns = class Ns {
4698
4699
  const t = Math.max(0, Date.now() - a(this, tc)), i = Number(e.expires);
4699
4700
  if (i > 0) {
4700
4701
  const n = Math.max(Ns.minGraceTime, Math.min(i / 10, Ns.maxGraceTime));
4701
- Promise.race([Ti(i - n - t), this.done().catch(O)]).then(() => a(this, Zi).resolve(this.expiryState())).catch(O);
4702
+ Promise.race([Ii(i - n - t), this.done().catch(O)]).then(() => a(this, Zi).resolve(this.expiryState())).catch(O);
4702
4703
  }
4703
4704
  a(this, ln).resolve(e);
4704
4705
  }
4705
4706
  done() {
4706
- return a(this, ai).promise;
4707
+ return a(this, oi).promise;
4707
4708
  }
4708
4709
  ok() {
4709
4710
  return a(this, ln).promise;
@@ -4716,7 +4717,7 @@ const Ns = class Ns {
4716
4717
  }
4717
4718
  // Returns whether the subscription is still active - i.e. hasn't received a done or unsubscribe
4718
4719
  expiryState() {
4719
- return a(this, ai).resolved && a(this, ai).resolved.errorCode !== yh.Expired ? "done" : a(this, qi).pending ? "active" : "unsubscribed";
4720
+ return a(this, oi).resolved && a(this, oi).resolved.errorCode !== yh.Expired ? "done" : a(this, qi).pending ? "active" : "unsubscribed";
4720
4721
  }
4721
4722
  unsubscribed() {
4722
4723
  return a(this, qi).promise;
@@ -4732,7 +4733,7 @@ const Ns = class Ns {
4732
4733
  return a(this, Zi).promise;
4733
4734
  }
4734
4735
  };
4735
- ln = new WeakMap(), ai = new WeakMap(), qi = new WeakMap(), tc = new WeakMap(), Zi = new WeakMap(), st = new WeakMap(), r(Ns, "maxGraceTime", 15e3), r(Ns, "minGraceTime", 3e3);
4736
+ ln = new WeakMap(), oi = new WeakMap(), qi = new WeakMap(), tc = new WeakMap(), Zi = new WeakMap(), st = new WeakMap(), r(Ns, "maxGraceTime", 15e3), r(Ns, "minGraceTime", 3e3);
4736
4737
  let Mo = Ns;
4737
4738
  var we, aa;
4738
4739
  class Yg {
@@ -4811,9 +4812,9 @@ oa = new WeakMap(), We = new WeakMap(), ca = new WeakMap(), ha = new WeakMap(),
4811
4812
  break;
4812
4813
  const w = yield a(this, ca).openSendStream();
4813
4814
  const b = new Yg(w);
4814
- const v = Ve(e, new eA(b, p.consume(), a(this, We)), !0);
4815
- yield v.run();
4816
- l(this, mn, v.finalGroup());
4815
+ const S = Ve(e, new eA(b, p.consume(), a(this, We)), !0);
4816
+ yield S.run();
4817
+ l(this, mn, S.finalGroup());
4817
4818
  } catch (t) {
4818
4819
  var i = t, n = !0;
4819
4820
  } finally {
@@ -4884,10 +4885,10 @@ class eA {
4884
4885
  }
4885
4886
  }
4886
4887
  Ji = new WeakMap(), da = new WeakMap(), fn = new WeakMap(), la = new WeakMap(), pn = new WeakMap();
4887
- var ma, $i, oi, Ps;
4888
+ var ma, $i, ci, Ps;
4888
4889
  class tA {
4889
4890
  constructor(e, t, i) {
4890
- d(this, oi);
4891
+ d(this, ci);
4891
4892
  r(this, "state");
4892
4893
  d(this, ma);
4893
4894
  d(this, $i);
@@ -4913,19 +4914,19 @@ class tA {
4913
4914
  });
4914
4915
  }
4915
4916
  invalidRange() {
4916
- return A(this, oi, Ps).call(this, U(1), "Invalid range");
4917
+ return A(this, ci, Ps).call(this, U(1), "Invalid range");
4917
4918
  }
4918
4919
  retryTrackAlias() {
4919
- return A(this, oi, Ps).call(this, U(2), "Retry track alias");
4920
+ return A(this, ci, Ps).call(this, U(2), "Retry track alias");
4920
4921
  }
4921
4922
  trackDoesNotExist() {
4922
- return A(this, oi, Ps).call(this, U(3), "Track does not exist");
4923
+ return A(this, ci, Ps).call(this, U(3), "Track does not exist");
4923
4924
  }
4924
4925
  unauthorized() {
4925
- return A(this, oi, Ps).call(this, U(4), "Unauthorized");
4926
+ return A(this, ci, Ps).call(this, U(4), "Unauthorized");
4926
4927
  }
4927
4928
  timeout() {
4928
- return A(this, oi, Ps).call(this, U(5), "Timeout");
4929
+ return A(this, ci, Ps).call(this, U(5), "Timeout");
4929
4930
  }
4930
4931
  [kt()]() {
4931
4932
  return this.trackDoesNotExist();
@@ -4934,7 +4935,7 @@ class tA {
4934
4935
  return this.trackDoesNotExist();
4935
4936
  }
4936
4937
  }
4937
- ma = new WeakMap(), $i = new WeakMap(), oi = new WeakSet(), Ps = function(e, t) {
4938
+ ma = new WeakMap(), $i = new WeakMap(), ci = new WeakSet(), Ps = function(e, t) {
4938
4939
  const i = {
4939
4940
  type: C.SubscribeError,
4940
4941
  id: this.state.subscribe.id,
@@ -4944,23 +4945,23 @@ ma = new WeakMap(), $i = new WeakMap(), oi = new WeakSet(), Ps = function(e, t)
4944
4945
  };
4945
4946
  return a(this, $i).push(i);
4946
4947
  };
4947
- var od, gn, fa, An, Yi, ci, hi, ui, nh;
4948
+ var od, gn, fa, An, Yi, hi, ui, di, nh;
4948
4949
  od = [Pe({ context: "Session", enter: "info", error: "error" })];
4949
- class Sh {
4950
+ class vh {
4950
4951
  constructor(e, t, i) {
4951
- ki(nh, 5, this);
4952
+ Bi(nh, 5, this);
4952
4953
  d(this, gn);
4953
4954
  d(this, fa);
4954
4955
  d(this, An);
4955
4956
  d(this, Yi, ge.get().createContext("Publisher"));
4956
- d(this, ci, new Ie(/* @__PURE__ */ new Map()));
4957
4957
  d(this, hi, new Ie(/* @__PURE__ */ new Map()));
4958
- d(this, ui, new Mc(10));
4958
+ d(this, ui, new Ie(/* @__PURE__ */ new Map()));
4959
+ d(this, di, new Mc(10));
4959
4960
  l(this, gn, e), l(this, fa, t), l(this, An, i);
4960
4961
  }
4961
4962
  announce(e) {
4962
4963
  return f(this, null, function* () {
4963
- if (a(this, ci).current().has(e.join("/")))
4964
+ if (a(this, hi).current().has(e.join("/")))
4964
4965
  throw new Error("Duplicate announcement");
4965
4966
  const t = /* @__PURE__ */ new Map(), i = a(this, gn).authToken();
4966
4967
  i && t.set(Lo, { type: Lo, payload: new TextEncoder().encode(i) });
@@ -4969,15 +4970,15 @@ class Sh {
4969
4970
  namespace: e,
4970
4971
  params: t
4971
4972
  }, o = Jg(n);
4972
- if (a(this, ci).update((h) => h.set(n.namespace.join("/"), o)), yield a(this, An).push(n), !(yield Promise.race([o.state.ok(), a(this, gn).closed()])))
4973
+ if (a(this, hi).update((h) => h.set(n.namespace.join("/"), o)), yield a(this, An).push(n), !(yield Promise.race([o.state.ok(), a(this, gn).closed()])))
4973
4974
  throw new Error("Session closed");
4974
4975
  });
4975
4976
  }
4976
4977
  close() {
4977
- a(this, hi).current().forEach((e) => e.close()), a(this, hi).close(), a(this, ci).close(), a(this, ui).close();
4978
+ a(this, ui).current().forEach((e) => e.close()), a(this, ui).close(), a(this, hi).close(), a(this, di).close();
4978
4979
  }
4979
4980
  incomingSubscriptions() {
4980
- return a(this, ui);
4981
+ return a(this, di);
4981
4982
  }
4982
4983
  onMessage(e) {
4983
4984
  return f(this, null, function* () {
@@ -4985,36 +4986,36 @@ class Sh {
4985
4986
  case C.Subscribe:
4986
4987
  {
4987
4988
  const t = new Mo(e);
4988
- if (a(this, hi).update((i) => (i.set(e.id, t), i)), a(this, ui).isFull()) {
4989
- const i = yield a(this, ui).pop();
4989
+ if (a(this, ui).update((i) => (i.set(e.id, t), i)), a(this, di).isFull()) {
4990
+ const i = yield a(this, di).pop();
4990
4991
  yield i == null ? void 0 : i.timeout();
4991
4992
  }
4992
- yield a(this, ui).push(
4993
+ yield a(this, di).push(
4993
4994
  new tA(t, a(this, fa), a(this, An))
4994
4995
  );
4995
4996
  }
4996
4997
  break;
4997
4998
  case C.SubscribeUpdate:
4998
4999
  {
4999
- const t = a(this, hi).current().get(e.id);
5000
+ const t = a(this, ui).current().get(e.id);
5000
5001
  t || a(this, Yi).debug("No subscription found", e), t == null || t.onUpdate(e);
5001
5002
  }
5002
5003
  break;
5003
5004
  case C.Unsubscribe:
5004
5005
  {
5005
- const t = a(this, hi).current().get(e.id);
5006
+ const t = a(this, ui).current().get(e.id);
5006
5007
  t || a(this, Yi).debug("No subscription found", e), t == null || t.onUnsubscribe(e);
5007
5008
  }
5008
5009
  break;
5009
5010
  case C.AnnounceOk:
5010
5011
  {
5011
- const t = a(this, ci).current().get(e.namespace.join("/"));
5012
+ const t = a(this, hi).current().get(e.namespace.join("/"));
5012
5013
  t || a(this, Yi).debug("No announcement found", e), t == null || t.state.onOk(e);
5013
5014
  }
5014
5015
  break;
5015
5016
  case C.AnnounceError:
5016
5017
  {
5017
- const t = a(this, ci).current().get(e.namespace.join("/"));
5018
+ const t = a(this, hi).current().get(e.namespace.join("/"));
5018
5019
  t || a(this, Yi).debug("No announcement found", e), t == null || t.state.onError(e);
5019
5020
  }
5020
5021
  break;
@@ -5022,7 +5023,7 @@ class Sh {
5022
5023
  });
5023
5024
  }
5024
5025
  }
5025
- nh = Ci(null), gn = new WeakMap(), fa = new WeakMap(), An = new WeakMap(), Yi = new WeakMap(), ci = new WeakMap(), hi = new WeakMap(), ui = new WeakMap(), ye(nh, 1, "announce", od, Sh), Zt(nh, Sh);
5026
+ nh = ki(null), gn = new WeakMap(), fa = new WeakMap(), An = new WeakMap(), Yi = new WeakMap(), hi = new WeakMap(), ui = new WeakMap(), di = new WeakMap(), ye(nh, 1, "announce", od, vh), Zt(nh, vh);
5026
5027
  function iA(s, e) {
5027
5028
  const t = new Mo(e), [i, n] = tu(100), o = new sA(t, i), c = new Rl(s, t, n);
5028
5029
  return [o, c];
@@ -5052,11 +5053,11 @@ class sA {
5052
5053
  }
5053
5054
  }
5054
5055
  Ki = new WeakMap();
5055
- var cd, wn, le, bn, yn, rh, Sn, nr;
5056
+ var cd, wn, le, bn, yn, rh, vn, rr;
5056
5057
  class Rl {
5057
5058
  constructor(e, t, i) {
5058
- ki(rh, 5, this);
5059
- d(this, Sn);
5059
+ Bi(rh, 5, this);
5060
+ d(this, vn);
5060
5061
  d(this, wn);
5061
5062
  d(this, le);
5062
5063
  d(this, bn);
@@ -5132,13 +5133,13 @@ class Rl {
5132
5133
  return Rt(this, null, function* () {
5133
5134
  var e, t;
5134
5135
  try {
5135
- for (var b = $(a(this, bn)), v, I, k; v = !(I = yield new q(b.next())).done; v = !1) {
5136
+ for (var b = $(a(this, bn)), S, I, k; S = !(I = yield new q(b.next())).done; S = !1) {
5136
5137
  var h = I.value;
5137
5138
  var u = [];
5138
5139
  try {
5139
- const D = Ve(u, h, !0);
5140
+ const L = Ve(u, h, !0);
5140
5141
  try {
5141
- for (var i = $(D.groups()), n, o, c; n = !(o = yield new q(i.next())).done; n = !1) {
5142
+ for (var i = $(L.groups()), n, o, c; n = !(o = yield new q(i.next())).done; n = !1) {
5142
5143
  const T = o.value;
5143
5144
  const P = (e = a(this, le).range()) == null ? void 0 : e.startGroup, R = (t = a(this, le).range()) == null ? void 0 : t.endGroup;
5144
5145
  if (P && T.groupId() < P)
@@ -5168,7 +5169,7 @@ class Rl {
5168
5169
  k = [I];
5169
5170
  } finally {
5170
5171
  try {
5171
- v && (I = b.return) && (yield new q(I.call(b)));
5172
+ S && (I = b.return) && (yield new q(I.call(b)));
5172
5173
  } finally {
5173
5174
  if (k)
5174
5175
  throw k[0];
@@ -5216,23 +5217,23 @@ class Rl {
5216
5217
  });
5217
5218
  }
5218
5219
  [(cd = [Pe({ context: "SubscriptionConsumer", enter: "info" })], kt())]() {
5219
- return A(this, Sn, nr).call(this);
5220
+ return A(this, vn, rr).call(this);
5220
5221
  }
5221
5222
  [Symbol.asyncDispose]() {
5222
- return A(this, Sn, nr).call(this);
5223
+ return A(this, vn, rr).call(this);
5223
5224
  }
5224
5225
  }
5225
- rh = Ci(null), wn = new WeakMap(), le = new WeakMap(), bn = new WeakMap(), yn = new WeakMap(), Sn = new WeakSet(), nr = function() {
5226
+ rh = ki(null), wn = new WeakMap(), le = new WeakMap(), bn = new WeakMap(), yn = new WeakMap(), vn = new WeakSet(), rr = function() {
5226
5227
  return f(this, null, function* () {
5227
5228
  return yield this.close(), this.unsubscribe();
5228
5229
  });
5229
- }, nr = ye(rh, 17, "#dispose", cd, Sn, nr), Zt(rh, Rl);
5230
+ }, rr = ye(rh, 17, "#dispose", cd, vn, rr), Zt(rh, Rl);
5230
5231
  const nA = 2e3;
5231
5232
  var hd, ud, dd, ld, Ft, De, es, ts, Rs, Ct, ro, xs;
5232
5233
  ld = [Pe({ context: "Session", return: "debug" })], dd = [Pe({ context: "Session", enter: "info", error: "error" })], ud = [Pe({ context: "Session", enter: "debug" })], hd = [Pe({ context: "Session", enter: "debug" })];
5233
5234
  class no {
5234
5235
  constructor(e, t) {
5235
- ki(Rs, 5, this);
5236
+ Bi(Rs, 5, this);
5236
5237
  d(this, Ct);
5237
5238
  // The owner session of the subscriber
5238
5239
  d(this, Ft);
@@ -5261,7 +5262,7 @@ class no {
5261
5262
  }, [m, p] = iA(a(this, es), u);
5262
5263
  if (a(this, De).update((w) => w.set(c, m)), yield a(this, es).push(u), !(yield Promise.race([m.state.ok(), a(this, Ft).closed()])))
5263
5264
  throw new Error("Session closed");
5264
- return p.closed().then(() => Promise.race([Ti(nA), this.closed()])).then(() => A(this, Ct, xs).call(this, p.id)).catch(() => A(this, Ct, xs).call(this, p.id)), p;
5265
+ return p.closed().then(() => Promise.race([Ii(nA), this.closed()])).then(() => A(this, Ct, xs).call(this, p.id)).catch(() => A(this, Ct, xs).call(this, p.id)), p;
5265
5266
  });
5266
5267
  }
5267
5268
  closed() {
@@ -5317,7 +5318,7 @@ class no {
5317
5318
  a(this, De).current().forEach((e) => e.close()), a(this, De).close();
5318
5319
  }
5319
5320
  }
5320
- Rs = Ci(null), Ft = new WeakMap(), De = new WeakMap(), es = new WeakMap(), ts = new WeakMap(), Ct = new WeakSet(), ro = function() {
5321
+ Rs = ki(null), Ft = new WeakMap(), De = new WeakMap(), es = new WeakMap(), ts = new WeakMap(), Ct = new WeakSet(), ro = function() {
5321
5322
  return f(this, null, function* () {
5322
5323
  try {
5323
5324
  for (var e = $(a(this, De)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
@@ -5339,10 +5340,10 @@ Rs = Ci(null), Ft = new WeakMap(), De = new WeakMap(), es = new WeakMap(), ts =
5339
5340
  }, xs = function(e) {
5340
5341
  a(this, De).isClosed() || a(this, De).update((t) => (t.delete(e), t));
5341
5342
  }, ro = ye(Rs, 17, "#observeChanges", ld, Ct, ro), ye(Rs, 1, "subscribe", dd, no), ye(Rs, 1, "close", ud, no), xs = ye(Rs, 17, "#deleteSubscription", hd, Ct, xs), Zt(Rs, no);
5342
- var md, fd, pd, gd, nt, pa, is, vn, En, ue, Ul, Pl, Us, ao, oo, co, rr;
5343
+ var md, fd, pd, gd, nt, pa, is, Sn, En, ue, Ul, Pl, Us, ao, oo, co, ar;
5343
5344
  class ru {
5344
5345
  constructor(e, t) {
5345
- ki(Us, 5, this);
5346
+ Bi(Us, 5, this);
5346
5347
  d(this, ue);
5347
5348
  // The underlying transport implementation
5348
5349
  d(this, nt);
@@ -5350,12 +5351,12 @@ class ru {
5350
5351
  d(this, pa);
5351
5352
  // Outgoing messages
5352
5353
  d(this, is);
5353
- d(this, vn, ge.get().createContext("Session"));
5354
+ d(this, Sn, ge.get().createContext("Session"));
5354
5355
  r(this, "subscriber");
5355
5356
  r(this, "publisher");
5356
5357
  d(this, En);
5357
5358
  const [i, n] = tu(100);
5358
- l(this, nt, e), l(this, is, n), this.subscriber = new no(this, i), this.publisher = new Sh(this, e, i), l(this, pa, A(this, ue, Pl).call(this)), l(this, En, new Ie(t)), this.closed().then(() => this.close()).catch(O);
5359
+ l(this, nt, e), l(this, is, n), this.subscriber = new no(this, i), this.publisher = new vh(this, e, i), l(this, pa, A(this, ue, Pl).call(this)), l(this, En, new Ie(t)), this.closed().then(() => this.close()).catch(O);
5359
5360
  }
5360
5361
  updateAuthToken(e) {
5361
5362
  a(this, En).update(e);
@@ -5376,20 +5377,20 @@ class ru {
5376
5377
  try {
5377
5378
  this.subscriber.close(), this.publisher.close(), a(this, is).cancel("closing"), a(this, nt).close();
5378
5379
  } catch (e) {
5379
- a(this, vn).warn("Error closing session", e);
5380
+ a(this, Sn).warn("Error closing session", e);
5380
5381
  }
5381
5382
  }
5382
5383
  [(gd = [Pe({ context: "Session", return: "info", error: "error" })], pd = [Pe({ context: "Session", return: "info", error: "error" })], fd = [Pe({ context: "Session", return: "info", error: "error" })], md = [Pe({ context: "Session", enter: "debug" })], kd())]() {
5383
- A(this, ue, rr).call(this);
5384
+ A(this, ue, ar).call(this);
5384
5385
  }
5385
5386
  [Symbol.dispose]() {
5386
- A(this, ue, rr).call(this);
5387
+ A(this, ue, ar).call(this);
5387
5388
  }
5388
5389
  }
5389
- Us = Ci(null), nt = new WeakMap(), pa = new WeakMap(), is = new WeakMap(), vn = new WeakMap(), En = new WeakMap(), ue = new WeakSet(), Ul = function(e) {
5390
+ Us = ki(null), nt = new WeakMap(), pa = new WeakMap(), is = new WeakMap(), Sn = new WeakMap(), En = new WeakMap(), ue = new WeakSet(), Ul = function(e) {
5390
5391
  return f(this, null, function* () {
5391
5392
  var t, i;
5392
- switch (a(this, vn).debug("received message", e), yield (t = this.subscriber) == null ? void 0 : t.onMessage(e), yield (i = this.publisher) == null ? void 0 : i.onMessage(e), e.type) {
5393
+ switch (a(this, Sn).debug("received message", e), yield (t = this.subscriber) == null ? void 0 : t.onMessage(e), yield (i = this.publisher) == null ? void 0 : i.onMessage(e), e.type) {
5393
5394
  case C.Goaway:
5394
5395
  break;
5395
5396
  }
@@ -5404,7 +5405,7 @@ Us = Ci(null), nt = new WeakMap(), pa = new WeakMap(), is = new WeakMap(), vn =
5404
5405
  try {
5405
5406
  for (var e = $(a(this, is)), t, i, n; t = !(i = yield e.next()).done; t = !1) {
5406
5407
  const o = i.value;
5407
- a(this, vn).debug("sending message", o), yield a(this, nt).writeMessage(o);
5408
+ a(this, Sn).debug("sending message", o), yield a(this, nt).writeMessage(o);
5408
5409
  }
5409
5410
  } catch (i) {
5410
5411
  n = [i];
@@ -5450,11 +5451,11 @@ Us = Ci(null), nt = new WeakMap(), pa = new WeakMap(), is = new WeakMap(), vn =
5450
5451
  return t;
5451
5452
  }
5452
5453
  });
5453
- }, rr = function() {
5454
+ }, ar = function() {
5454
5455
  this.close();
5455
- }, ao = ye(Us, 17, "#runOutgoingMessages", gd, ue, ao), oo = ye(Us, 17, "#runControl", pd, ue, oo), co = ye(Us, 17, "#runObjects", fd, ue, co), rr = ye(Us, 17, "#dispose", md, ue, rr), Zt(Us, ru);
5456
+ }, ao = ye(Us, 17, "#runOutgoingMessages", gd, ue, ao), oo = ye(Us, 17, "#runControl", pd, ue, oo), co = ye(Us, 17, "#runObjects", fd, ue, co), ar = ye(Us, 17, "#dispose", md, ue, ar), Zt(Us, ru);
5456
5457
  const rA = 128;
5457
- var ze, ga, ss, Tn, Aa, be, xi, Li;
5458
+ var ze, ga, ss, Tn, Aa, be, Li, Di;
5458
5459
  class aA {
5459
5460
  constructor(e, t, i) {
5460
5461
  d(this, be);
@@ -5467,59 +5468,59 @@ class aA {
5467
5468
  }
5468
5469
  writeUnsigned8(e) {
5469
5470
  return f(this, null, function* () {
5470
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, ze).writeUnsigned8(e);
5471
+ return A(this, be, Li).call(this), yield A(this, be, Di).call(this), a(this, ze).writeUnsigned8(e);
5471
5472
  });
5472
5473
  }
5473
5474
  writeVarInt(e) {
5474
5475
  return f(this, null, function* () {
5475
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, ze).writeVarInt(e);
5476
+ return A(this, be, Li).call(this), yield A(this, be, Di).call(this), a(this, ze).writeVarInt(e);
5476
5477
  });
5477
5478
  }
5478
5479
  writeBigVarInt(e) {
5479
5480
  return f(this, null, function* () {
5480
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, ze).writeBigVarInt(e);
5481
+ return A(this, be, Li).call(this), yield A(this, be, Di).call(this), a(this, ze).writeBigVarInt(e);
5481
5482
  });
5482
5483
  }
5483
5484
  write(e) {
5484
5485
  return f(this, null, function* () {
5485
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, ze).write(e);
5486
+ return A(this, be, Li).call(this), yield A(this, be, Di).call(this), a(this, ze).write(e);
5486
5487
  });
5487
5488
  }
5488
5489
  writeString(e) {
5489
5490
  return f(this, null, function* () {
5490
- return A(this, be, xi).call(this), yield A(this, be, Li).call(this), a(this, ze).writeString(e);
5491
+ return A(this, be, Li).call(this), yield A(this, be, Di).call(this), a(this, ze).writeString(e);
5491
5492
  });
5492
5493
  }
5493
5494
  flush() {
5494
5495
  return f(this, null, function* () {
5495
- A(this, be, xi).call(this), l(this, ss, !0), yield a(this, ze).flush();
5496
+ A(this, be, Li).call(this), l(this, ss, !0), yield a(this, ze).flush();
5496
5497
  });
5497
5498
  }
5498
5499
  close() {
5499
5500
  return f(this, null, function* () {
5500
- a(this, Tn) || (l(this, ss, !0), yield A(this, be, Li).call(this, !1), yield a(this, ze).flush(), l(this, Tn, !0), a(this, Aa).call(this));
5501
+ a(this, Tn) || (l(this, ss, !0), yield A(this, be, Di).call(this, !1), yield a(this, ze).flush(), l(this, Tn, !0), a(this, Aa).call(this));
5501
5502
  });
5502
5503
  }
5503
5504
  }
5504
- ze = new WeakMap(), ga = new WeakMap(), ss = new WeakMap(), Tn = new WeakMap(), Aa = new WeakMap(), be = new WeakSet(), xi = function() {
5505
+ ze = new WeakMap(), ga = new WeakMap(), ss = new WeakMap(), Tn = new WeakMap(), Aa = new WeakMap(), be = new WeakSet(), Li = function() {
5505
5506
  if (a(this, Tn))
5506
5507
  throw new Error("Stream is closed");
5507
- }, Li = function(e = !0) {
5508
+ }, Di = function(e = !0) {
5508
5509
  if (a(this, ss))
5509
5510
  return l(this, ss, !1), a(this, ze).writeUnsigned8(a(this, ga) | (e ? rA : 0));
5510
5511
  };
5511
- var di, _t, In, ns, Nt, Cn, kn, sc, xl;
5512
+ var li, _t, In, ns, Nt, Cn, kn, sc, xl;
5512
5513
  class oA {
5513
5514
  constructor(e, t) {
5514
5515
  d(this, sc);
5515
- d(this, di);
5516
+ d(this, li);
5516
5517
  d(this, _t);
5517
5518
  d(this, In);
5518
5519
  d(this, ns);
5519
5520
  d(this, Nt, /* @__PURE__ */ new Map());
5520
5521
  d(this, Cn, ge.get().createContext("WebSocketConnection"));
5521
5522
  d(this, kn, new Set(new Array(128).fill(0).map((e, t) => t + 1)));
5522
- l(this, di, e), l(this, _t, t), l(this, In, new ReadableStream(new bg(e))), a(this, di).addEventListener("close", () => {
5523
+ l(this, li, e), l(this, _t, t), l(this, In, new ReadableStream(new bg(e))), a(this, li).addEventListener("close", () => {
5523
5524
  a(this, _t).markPostHandshake(), a(this, Nt).forEach((i) => i.close());
5524
5525
  });
5525
5526
  }
@@ -5528,14 +5529,14 @@ class oA {
5528
5529
  if (!e)
5529
5530
  throw new Error("No stream IDs available");
5530
5531
  return a(this, kn).delete(e), Promise.resolve(
5531
- new aA(new xr(a(this, di)), e, () => A(this, sc, xl).call(this, e))
5532
+ new aA(new xr(a(this, li)), e, () => A(this, sc, xl).call(this, e))
5532
5533
  );
5533
5534
  }
5534
5535
  transportType() {
5535
5536
  return "websocket";
5536
5537
  }
5537
5538
  url() {
5538
- return a(this, di).url;
5539
+ return a(this, li).url;
5539
5540
  }
5540
5541
  afterHandshake() {
5541
5542
  return a(this, _t).postHandshake();
@@ -5577,7 +5578,7 @@ class oA {
5577
5578
  }
5578
5579
  close() {
5579
5580
  var e;
5580
- return a(this, _t).cancel().catch(O), a(this, In).cancel("closing").catch(O), (e = a(this, ns)) == null || e.cancel("closing").catch(O), a(this, di).close();
5581
+ return a(this, _t).cancel().catch(O), a(this, In).cancel("closing").catch(O), (e = a(this, ns)) == null || e.cancel("closing").catch(O), a(this, li).close();
5581
5582
  }
5582
5583
  closed() {
5583
5584
  return Promise.resolve();
@@ -5593,27 +5594,27 @@ class oA {
5593
5594
  });
5594
5595
  }
5595
5596
  }
5596
- di = new WeakMap(), _t = new WeakMap(), In = new WeakMap(), ns = new WeakMap(), Nt = new WeakMap(), Cn = new WeakMap(), kn = new WeakMap(), sc = new WeakSet(), /**
5597
+ li = new WeakMap(), _t = new WeakMap(), In = new WeakMap(), ns = new WeakMap(), Nt = new WeakMap(), Cn = new WeakMap(), kn = new WeakMap(), sc = new WeakSet(), /**
5597
5598
  * Return a stream ID to the pool of available stream IDs
5598
5599
  * @param streamId - The stream ID to return
5599
5600
  */
5600
5601
  xl = function(e) {
5601
5602
  a(this, kn).add(e);
5602
5603
  };
5603
- var Vt, Gt, li, wa, ba, nc, rc, Ll;
5604
+ var Vt, Gt, mi, wa, ba, nc, rc, Ll;
5604
5605
  class cA {
5605
5606
  constructor(e, t, i) {
5606
5607
  d(this, rc);
5607
5608
  d(this, Vt);
5608
5609
  d(this, Gt);
5609
- d(this, li, new Mc(100));
5610
+ d(this, mi, new Mc(100));
5610
5611
  d(this, wa);
5611
5612
  d(this, ba, 0);
5612
5613
  d(this, nc, ge.get().createContext("WebTransportConnection"));
5613
5614
  l(this, wa, i), l(this, Vt, e), l(this, Gt, t), A(this, rc, Ll).call(this).catch((n) => {
5614
- a(this, nc).debug("Incoming streams handling ended with error", n), a(this, Gt).markPostHandshake(), a(this, li).close();
5615
+ a(this, nc).debug("Incoming streams handling ended with error", n), a(this, Gt).markPostHandshake(), a(this, mi).close();
5615
5616
  }), a(this, Vt).closed.then(() => {
5616
- a(this, Gt).markPostHandshake(), a(this, li).close();
5617
+ a(this, Gt).markPostHandshake(), a(this, mi).close();
5617
5618
  });
5618
5619
  }
5619
5620
  openSendStream() {
@@ -5651,21 +5652,21 @@ class cA {
5651
5652
  }
5652
5653
  objectStream() {
5653
5654
  return f(this, null, function* () {
5654
- return a(this, li).pop();
5655
+ return a(this, mi).pop();
5655
5656
  });
5656
5657
  }
5657
5658
  }
5658
- Vt = new WeakMap(), Gt = new WeakMap(), li = new WeakMap(), wa = new WeakMap(), ba = new WeakMap(), nc = new WeakMap(), rc = new WeakSet(), Ll = function() {
5659
+ Vt = new WeakMap(), Gt = new WeakMap(), mi = new WeakMap(), wa = new WeakMap(), ba = new WeakMap(), nc = new WeakMap(), rc = new WeakSet(), Ll = function() {
5659
5660
  return f(this, null, function* () {
5660
5661
  const e = a(this, Vt).incomingUnidirectionalStreams.getReader();
5661
5662
  for (; ; ) {
5662
5663
  const { value: t, done: i } = yield e.read();
5663
5664
  if (i) {
5664
- a(this, li).close();
5665
+ a(this, mi).close();
5665
5666
  return;
5666
5667
  }
5667
5668
  const n = new xo(new Uint8Array(), t);
5668
- yield a(this, li).push(Kd(n, a(this, ba))), Je(this, ba)._++;
5669
+ yield a(this, mi).push(Kd(n, a(this, ba))), Je(this, ba)._++;
5669
5670
  }
5670
5671
  });
5671
5672
  };
@@ -5704,7 +5705,7 @@ function hA(s) {
5704
5705
  function uA(s) {
5705
5706
  return f(this, null, function* () {
5706
5707
  if (self.WebTransport && (s == null ? void 0 : s.preferredTransport) !== "websocket" && s.url.protocol.startsWith("https")) {
5707
- const e = hA(s).catch(() => Yc(s)), t = yield Promise.race([e, Ti(s.websocketFallbackTimeoutMs)]);
5708
+ const e = hA(s).catch(() => Yc(s)), t = yield Promise.race([e, Ii(s.websocketFallbackTimeoutMs)]);
5708
5709
  return t || Yc(s);
5709
5710
  }
5710
5711
  return Yc(s);
@@ -5772,7 +5773,7 @@ Bn = new WeakMap(), ya = new WeakMap();
5772
5773
  function dA(s, e) {
5773
5774
  return ["com.vindral.moq", s];
5774
5775
  }
5775
- function Bi(s) {
5776
+ function Ri(s) {
5776
5777
  const e = s[1];
5777
5778
  if (!e)
5778
5779
  throw new Error("namespace must contain a channel ID");
@@ -5785,10 +5786,10 @@ function mA(s) {
5785
5786
  const e = new TextDecoder().decode(s);
5786
5787
  return JSON.parse(e);
5787
5788
  }
5788
- var Oe, yt, rs, He, Sa, ac, va, vh;
5789
+ var Oe, yt, rs, He, va, ac, Sa, Sh;
5789
5790
  const uu = class uu {
5790
5791
  constructor(e, t) {
5791
- d(this, va);
5792
+ d(this, Sa);
5792
5793
  d(this, Oe);
5793
5794
  // The largest group id seen so far - used to switch seamlessly between tracks
5794
5795
  d(this, yt);
@@ -5796,19 +5797,19 @@ const uu = class uu {
5796
5797
  d(this, rs, new oe(100));
5797
5798
  // This contains the unconsumed groups if this track has an absolute range
5798
5799
  d(this, He);
5799
- d(this, Sa);
5800
+ d(this, va);
5800
5801
  d(this, ac, (e) => f(this, null, function* () {
5801
5802
  if (!e)
5802
5803
  return a(this, Oe).close();
5803
5804
  if (a(this, He))
5804
5805
  return;
5805
5806
  const t = a(this, rs).items().reduce((i, n) => i < n ? i : n, e);
5806
- l(this, He, A(this, va, vh).call(this, t, e)), a(this, He).size === 0 && (yield a(this, Oe).close());
5807
+ l(this, He, A(this, Sa, Sh).call(this, t, e)), a(this, He).size === 0 && (yield a(this, Oe).close());
5807
5808
  }));
5808
5809
  l(this, Oe, e), l(this, yt, t), e.done().then((i) => f(this, null, function* () {
5809
5810
  var n;
5810
5811
  return a(this, ac).call(this, (n = i.finalInfo) == null ? void 0 : n.group);
5811
- })).catch(O), l(this, Sa, e.groups());
5812
+ })).catch(O), l(this, va, e.groups());
5812
5813
  }
5813
5814
  static subscribe(e, t) {
5814
5815
  return f(this, null, function* () {
@@ -5839,7 +5840,7 @@ const uu = class uu {
5839
5840
  }
5840
5841
  update(e, t) {
5841
5842
  return f(this, null, function* () {
5842
- return l(this, He, A(this, va, vh).call(this, e, t)), a(this, He).size === 0 && (yield a(this, Oe).close()), a(this, Oe).update(e, t);
5843
+ return l(this, He, A(this, Sa, Sh).call(this, e, t)), a(this, He).size === 0 && (yield a(this, Oe).close()), a(this, Oe).update(e, t);
5843
5844
  });
5844
5845
  }
5845
5846
  unsubscribe() {
@@ -5850,7 +5851,7 @@ const uu = class uu {
5850
5851
  var i;
5851
5852
  if (a(this, He) && a(this, He).size === 0)
5852
5853
  return { done: !0, value: void 0 };
5853
- const e = yield a(this, Sa).next();
5854
+ const e = yield a(this, va).next();
5854
5855
  if (e.done)
5855
5856
  return e;
5856
5857
  const t = e.value.groupId();
@@ -5864,7 +5865,7 @@ const uu = class uu {
5864
5865
  return this;
5865
5866
  }
5866
5867
  };
5867
- Oe = new WeakMap(), yt = new WeakMap(), rs = new WeakMap(), He = new WeakMap(), Sa = new WeakMap(), ac = new WeakMap(), va = new WeakSet(), vh = function(e, t) {
5868
+ Oe = new WeakMap(), yt = new WeakMap(), rs = new WeakMap(), He = new WeakMap(), va = new WeakMap(), ac = new WeakMap(), Sa = new WeakSet(), Sh = function(e, t) {
5868
5869
  const i = /* @__PURE__ */ new Set();
5869
5870
  for (let n = e; n <= t; n++)
5870
5871
  i == null || i.add(n);
@@ -5873,7 +5874,7 @@ Oe = new WeakMap(), yt = new WeakMap(), rs = new WeakMap(), He = new WeakMap(),
5873
5874
  }), i;
5874
5875
  };
5875
5876
  let Fo = uu;
5876
- var rt, as, Wt, St, Ea, Eh, Ta;
5877
+ var rt, as, Wt, vt, Ea, Eh, Ta;
5877
5878
  const du = class du {
5878
5879
  constructor(e) {
5879
5880
  d(this, Ea);
@@ -5883,24 +5884,24 @@ const du = class du {
5883
5884
  d(this, as);
5884
5885
  // The next group iterators to switch to when the current one runs out
5885
5886
  d(this, Wt, new Mc(10));
5886
- d(this, St);
5887
+ d(this, vt);
5887
5888
  d(this, Ta, (e, t) => f(this, null, function* () {
5888
5889
  var g = [];
5889
5890
  try {
5890
5891
  const i = Ve(g, yield a(this, rt).lock());
5891
5892
  const n = { subscribeId: i.value.subscribeId() };
5892
5893
  if (!i.value.needsRenewal()) {
5893
- a(this, St).debug("Subscription does not need renewal", n);
5894
+ a(this, vt).debug("Subscription does not need renewal", n);
5894
5895
  return;
5895
5896
  }
5896
5897
  const o = i.value.largestGroupId();
5897
5898
  const c = o !== void 0;
5898
5899
  const h = new Xt().name(t.name).priority(t.priority).groupOrder(t.groupOrder);
5899
5900
  n.largestGroupId = o;
5900
- a(this, St).debug("Renewing subscription", n);
5901
+ a(this, vt).debug("Renewing subscription", n);
5901
5902
  switch (t.filterType.type) {
5902
5903
  case "absolute-range":
5903
- a(this, St).debug("Absolute range is not renewed", n);
5904
+ a(this, vt).debug("Absolute range is not renewed", n);
5904
5905
  return;
5905
5906
  case "absolute-start":
5906
5907
  case "latest-group":
@@ -5919,14 +5920,14 @@ const du = class du {
5919
5920
  const p = new Fo(m, o);
5920
5921
  i.value = p;
5921
5922
  yield a(this, Wt).push(p);
5922
- a(this, St).info("Subscription renewed", n);
5923
+ a(this, vt).info("Subscription renewed", n);
5923
5924
  } catch (w) {
5924
- var b = w, v = !0;
5925
+ var b = w, S = !0;
5925
5926
  } finally {
5926
- Ge(g, b, v);
5927
+ Ge(g, b, S);
5927
5928
  }
5928
5929
  }));
5929
- l(this, rt, new xm(e)), l(this, as, e), l(this, St, ge.get().createContext(`Renewable '${e.name()}'`));
5930
+ l(this, rt, new xm(e)), l(this, as, e), l(this, vt, ge.get().createContext(`Renewable '${e.name()}'`));
5930
5931
  }
5931
5932
  static subscribe(e, t, i) {
5932
5933
  return f(this, null, function* () {
@@ -6044,21 +6045,21 @@ const du = class du {
6044
6045
  });
6045
6046
  }
6046
6047
  };
6047
- rt = new WeakMap(), as = new WeakMap(), Wt = new WeakMap(), St = new WeakMap(), Ea = new WeakSet(), Eh = function(e) {
6048
+ rt = new WeakMap(), as = new WeakMap(), Wt = new WeakMap(), vt = new WeakMap(), Ea = new WeakSet(), Eh = function(e) {
6048
6049
  return f(this, null, function* () {
6049
6050
  var t;
6050
6051
  if (e.unsubscribed() || (t = e.range()) != null && t.endGroup) {
6051
- a(this, St).info("Server initiated subscribe done but the subscription is already closing");
6052
+ a(this, vt).info("Server initiated subscribe done but the subscription is already closing");
6052
6053
  return;
6053
6054
  }
6054
6055
  if (a(this, rt).unsafeValue().subscribeId() !== e.id) {
6055
- a(this, St).info("subscribeId mismatch - the subscription already has been renewed");
6056
+ a(this, vt).info("subscribeId mismatch - the subscription already has been renewed");
6056
6057
  return;
6057
6058
  }
6058
6059
  return this.return();
6059
6060
  });
6060
6061
  }, Ta = new WeakMap();
6061
- let Ii = du;
6062
+ let Ci = du;
6062
6063
  const fA = "catalog";
6063
6064
  function ju(s) {
6064
6065
  const e = mA(s.payload);
@@ -6066,31 +6067,31 @@ function ju(s) {
6066
6067
  throw new Error("unexpected catalog type");
6067
6068
  return e;
6068
6069
  }
6069
- var mi, Ia, Ca, ka, oc, Ol;
6070
+ var fi, Ia, Ca, ka, oc, Ol;
6070
6071
  const cc = class cc {
6071
6072
  constructor(e, t, i) {
6072
6073
  d(this, oc);
6073
- d(this, mi);
6074
+ d(this, fi);
6074
6075
  d(this, Ia);
6075
6076
  d(this, Ca);
6076
6077
  d(this, ka);
6077
- l(this, Ia, e), l(this, mi, t), l(this, Ca, i), l(this, ka, A(this, oc, Ol).call(this)), this.closed().finally(() => a(this, mi).close()).catch(O);
6078
+ l(this, Ia, e), l(this, fi, t), l(this, Ca, i), l(this, ka, A(this, oc, Ol).call(this)), this.closed().finally(() => a(this, fi).close()).catch(O);
6078
6079
  }
6079
6080
  catalog() {
6080
- return a(this, mi);
6081
+ return a(this, fi);
6081
6082
  }
6082
6083
  closed() {
6083
6084
  return a(this, ka);
6084
6085
  }
6085
6086
  close() {
6086
6087
  return f(this, null, function* () {
6087
- return a(this, mi).close(), (yield a(this, Ia).promise).unsubscribe();
6088
+ return a(this, fi).close(), (yield a(this, Ia).promise).unsubscribe();
6088
6089
  });
6089
6090
  }
6090
6091
  static start(e, t) {
6091
6092
  return f(this, null, function* () {
6092
6093
  const i = z.fromPromise(
6093
- Ii.subscribe(
6094
+ Ci.subscribe(
6094
6095
  e,
6095
6096
  new Xt().name(t.catalogName || fA).groupOrder("ascending").build()
6096
6097
  )
@@ -6105,7 +6106,7 @@ const cc = class cc {
6105
6106
  });
6106
6107
  }
6107
6108
  };
6108
- mi = new WeakMap(), Ia = new WeakMap(), Ca = new WeakMap(), ka = new WeakMap(), oc = new WeakSet(), Ol = function() {
6109
+ fi = new WeakMap(), Ia = new WeakMap(), Ca = new WeakMap(), ka = new WeakMap(), oc = new WeakSet(), Ol = function() {
6109
6110
  return f(this, null, function* () {
6110
6111
  const e = yield a(this, Ca).promise;
6111
6112
  try {
@@ -6114,7 +6115,7 @@ mi = new WeakMap(), Ia = new WeakMap(), Ca = new WeakMap(), ka = new WeakMap(),
6114
6115
  if (c.objectStatus !== Te.Normal)
6115
6116
  continue;
6116
6117
  const h = ju(c);
6117
- a(this, mi).update(h);
6118
+ a(this, fi).update(h);
6118
6119
  }
6119
6120
  } catch (n) {
6120
6121
  o = [n];
@@ -6143,7 +6144,7 @@ class pA {
6143
6144
  [Symbol.asyncIterator]() {
6144
6145
  return Rt(this, null, function* () {
6145
6146
  const e = { name: this.track.trackObject.name, namespace: this.track.namespace };
6146
- a(this, Un).debug("start", S({}, e));
6147
+ a(this, Un).debug("start", v({}, e));
6147
6148
  try {
6148
6149
  for (var t = $(a(this, Rn)), i, n, o; i = !(n = yield new q(t.next())).done; i = !1) {
6149
6150
  const c = n.value;
@@ -6154,7 +6155,7 @@ class pA {
6154
6155
  const b = this.track.timestampRange();
6155
6156
  if (b && m >= b[1])
6156
6157
  break;
6157
- a(this, Un).debug("fragment", M(S({}, e), {
6158
+ a(this, Un).debug("fragment", M(v({}, e), {
6158
6159
  startTime: m,
6159
6160
  endTime: g,
6160
6161
  subscribeId: c.subscribeId,
@@ -6173,7 +6174,7 @@ class pA {
6173
6174
  throw o[0];
6174
6175
  }
6175
6176
  }
6176
- a(this, Un).debug("end", S({}, e));
6177
+ a(this, Un).debug("end", v({}, e));
6177
6178
  });
6178
6179
  }
6179
6180
  [kt()]() {
@@ -6189,18 +6190,18 @@ Ba = new WeakMap(), Rn = new WeakMap(), Ra = new WeakMap(), Un = new WeakMap(),
6189
6190
  return yield (t = (e = a(this, Rn)).return) == null ? void 0 : t.call(e), Promise.resolve();
6190
6191
  });
6191
6192
  };
6192
- var Pa, vt, xa, La, hc, Ml;
6193
+ var Pa, St, xa, La, hc, Ml;
6193
6194
  const Vs = class Vs {
6194
6195
  constructor(e, t, i, n, o) {
6195
6196
  d(this, Pa);
6196
- d(this, vt);
6197
+ d(this, St);
6197
6198
  // A static offset that will be applied to all fragments
6198
6199
  d(this, xa);
6199
6200
  // Stop consuming the track after we have passed thig timestamp
6200
6201
  d(this, La);
6201
6202
  r(this, "trackObject");
6202
6203
  r(this, "namespace");
6203
- this.trackObject = e, this.namespace = t, l(this, vt, i), l(this, Pa, n), l(this, xa, o);
6204
+ this.trackObject = e, this.namespace = t, l(this, St, i), l(this, Pa, n), l(this, xa, o);
6204
6205
  }
6205
6206
  static subscribe(c, h, u) {
6206
6207
  return f(this, arguments, function* (e, t, {
@@ -6208,21 +6209,21 @@ const Vs = class Vs {
6208
6209
  startGroup: n,
6209
6210
  params: o
6210
6211
  }) {
6211
- var v;
6212
+ var S;
6212
6213
  if (t.format !== "cmaf")
6213
6214
  throw new Error("format must be cmaf");
6214
6215
  const m = new Xt().name(t.name);
6215
6216
  n && m.startGroup(n);
6216
6217
  const p = m.build();
6217
6218
  if (t.initTrack) {
6218
- const I = new Xt().name(t.initTrack).build(), [k, D] = yield Promise.all([
6219
- A(v = Vs, hc, Ml).call(v, e, I),
6220
- Ii.subscribe(e, p, { params: o, largestGroupId: n ? n - U(1) : void 0 })
6219
+ const I = new Xt().name(t.initTrack).build(), [k, L] = yield Promise.all([
6220
+ A(S = Vs, hc, Ml).call(S, e, I),
6221
+ Ci.subscribe(e, p, { params: o, largestGroupId: n ? n - U(1) : void 0 })
6221
6222
  ]), T = new Ou(k);
6222
- return new Vs(t, e.namespace(), D, T, i);
6223
+ return new Vs(t, e.namespace(), L, T, i);
6223
6224
  }
6224
6225
  Xe(t.initData, "no init data found on track");
6225
- const g = Td(t.initData), w = new Ou(new Uint8Array(g)), b = yield Ii.subscribe(e, p, {
6226
+ const g = Td(t.initData), w = new Ou(new Uint8Array(g)), b = yield Ci.subscribe(e, p, {
6226
6227
  params: o,
6227
6228
  largestGroupId: n ? n - U(1) : void 0
6228
6229
  });
@@ -6230,7 +6231,7 @@ const Vs = class Vs {
6230
6231
  });
6231
6232
  }
6232
6233
  largestGroupId() {
6233
- return a(this, vt).largestGroupId();
6234
+ return a(this, St).largestGroupId();
6234
6235
  }
6235
6236
  stopAfterTimestampReached(e) {
6236
6237
  l(this, La, [0, e]);
@@ -6239,19 +6240,19 @@ const Vs = class Vs {
6239
6240
  return a(this, La);
6240
6241
  }
6241
6242
  endOfTrack(e) {
6242
- return a(this, vt).endOfTrack(e);
6243
+ return a(this, St).endOfTrack(e);
6243
6244
  }
6244
6245
  update(e, t) {
6245
- return a(this, vt).update(e, t);
6246
+ return a(this, St).update(e, t);
6246
6247
  }
6247
6248
  unsubscribe() {
6248
6249
  return f(this, null, function* () {
6249
- return a(this, vt).unsubscribe();
6250
+ return a(this, St).unsubscribe();
6250
6251
  });
6251
6252
  }
6252
6253
  next() {
6253
6254
  return f(this, null, function* () {
6254
- const e = yield a(this, vt).next();
6255
+ const e = yield a(this, St).next();
6255
6256
  return e.done ? e : {
6256
6257
  done: !1,
6257
6258
  value: new pA(e.value, a(this, Pa), a(this, xa), this)
@@ -6260,7 +6261,7 @@ const Vs = class Vs {
6260
6261
  }
6261
6262
  return() {
6262
6263
  return f(this, null, function* () {
6263
- return yield a(this, vt).return(), { done: !0, value: void 0 };
6264
+ return yield a(this, St).return(), { done: !0, value: void 0 };
6264
6265
  });
6265
6266
  }
6266
6267
  [Symbol.asyncIterator]() {
@@ -6275,7 +6276,7 @@ const Vs = class Vs {
6275
6276
  });
6276
6277
  }
6277
6278
  };
6278
- Pa = new WeakMap(), vt = new WeakMap(), xa = new WeakMap(), La = new WeakMap(), hc = new WeakSet(), Ml = function(e, t) {
6279
+ Pa = new WeakMap(), St = new WeakMap(), xa = new WeakMap(), La = new WeakMap(), hc = new WeakSet(), Ml = function(e, t) {
6279
6280
  return f(this, null, function* () {
6280
6281
  var o = [];
6281
6282
  try {
@@ -6295,17 +6296,17 @@ Pa = new WeakMap(), vt = new WeakMap(), xa = new WeakMap(), La = new WeakMap(),
6295
6296
  }, d(Vs, hc);
6296
6297
  let Ch = Vs;
6297
6298
  const Wu = 1e4, gA = 3e4;
6298
- var uc, fi, os, Da, Oa, Ma, Ts, Bh, Fl;
6299
+ var uc, pi, os, Da, Oa, Ma, Ts, Bh, Fl;
6299
6300
  const lu = class lu {
6300
6301
  constructor(e, t, i) {
6301
6302
  d(this, Ts);
6302
6303
  d(this, uc, ge.get().createContext("Timeline"));
6303
- d(this, fi, new Ie([]));
6304
+ d(this, pi, new Ie([]));
6304
6305
  d(this, os);
6305
6306
  d(this, Da);
6306
6307
  d(this, Oa);
6307
6308
  d(this, Ma);
6308
- l(this, Da, e), l(this, Oa, i), l(this, os, t), l(this, Ma, A(this, Ts, Bh).call(this, a(this, os))), this.closed().finally(() => a(this, fi).close()).catch(O);
6309
+ l(this, Da, e), l(this, Oa, i), l(this, os, t), l(this, Ma, A(this, Ts, Bh).call(this, a(this, os))), this.closed().finally(() => a(this, pi).close()).catch(O);
6309
6310
  }
6310
6311
  closed() {
6311
6312
  return a(this, Ma);
@@ -6316,7 +6317,7 @@ const lu = class lu {
6316
6317
  });
6317
6318
  }
6318
6319
  timeline() {
6319
- const [e, t] = a(this, fi).value();
6320
+ const [e, t] = a(this, pi).value();
6320
6321
  return e;
6321
6322
  }
6322
6323
  /**
@@ -6328,40 +6329,40 @@ const lu = class lu {
6328
6329
  }
6329
6330
  static start(e, t) {
6330
6331
  const i = z.fromPromise(
6331
- Ii.subscribe(e, new Xt().name(t).groupOrder("ascending").build())
6332
+ Ci.subscribe(e, new Xt().name(t).groupOrder("ascending").build())
6332
6333
  );
6333
6334
  return new lu(e, i, t);
6334
6335
  }
6335
6336
  waitForWallclockTime(e) {
6336
6337
  return f(this, null, function* () {
6337
- return yield a(this, fi).waitFor((t) => !!t.find((i) => i.wallclock >= e)), this.timeline();
6338
+ return yield a(this, pi).waitFor((t) => !!t.find((i) => i.wallclock >= e)), this.timeline();
6338
6339
  });
6339
6340
  }
6340
6341
  waitForTimelineToHaveMinDuration() {
6341
6342
  return f(this, null, function* () {
6342
- return yield a(this, fi).waitFor((e) => {
6343
+ return yield a(this, pi).waitFor((e) => {
6343
6344
  const t = e[0], i = e[e.length - 1];
6344
6345
  return !t || !i ? !1 : i.wallclock - t.wallclock > Wu;
6345
6346
  }), this.timeline();
6346
6347
  });
6347
6348
  }
6348
6349
  };
6349
- uc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(), Oa = new WeakMap(), Ma = new WeakMap(), Ts = new WeakSet(), Bh = function(e) {
6350
+ uc = new WeakMap(), pi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(), Oa = new WeakMap(), Ma = new WeakMap(), Ts = new WeakSet(), Bh = function(e) {
6350
6351
  return f(this, null, function* () {
6351
6352
  const t = yield e.promise;
6352
6353
  try {
6353
- for (var b = $(t), v, I, k; v = !(I = yield b.next()).done; v = !1) {
6354
+ for (var b = $(t), S, I, k; S = !(I = yield b.next()).done; S = !1) {
6354
6355
  var h = I.value;
6355
6356
  var u = [];
6356
6357
  try {
6357
- const D = Ve(u, h, !0);
6358
+ const L = Ve(u, h, !0);
6358
6359
  try {
6359
- for (var i = $(D), n, o, c; n = !(o = yield i.next()).done; n = !1) {
6360
+ for (var i = $(L), n, o, c; n = !(o = yield i.next()).done; n = !1) {
6360
6361
  const T = o.value;
6361
6362
  if (T.objectStatus !== Te.Normal)
6362
6363
  continue;
6363
6364
  const P = AA(T.payload);
6364
- a(this, fi).update((R) => {
6365
+ a(this, pi).update((R) => {
6365
6366
  var X, Q;
6366
6367
  for (R.push(...P), R.sort((Fe, te) => Fe.wallclock - te.wallclock); R[0] && ((Q = (X = R[R.length - 1]) == null ? void 0 : X.wallclock) != null ? Q : 0) - R[0].wallclock > gA; )
6367
6368
  R.shift();
@@ -6391,7 +6392,7 @@ uc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(),
6391
6392
  k = [I];
6392
6393
  } finally {
6393
6394
  try {
6394
- v && (I = b.return) && (yield I.call(b));
6395
+ S && (I = b.return) && (yield I.call(b));
6395
6396
  } finally {
6396
6397
  if (k)
6397
6398
  throw k[0];
@@ -6404,7 +6405,7 @@ uc = new WeakMap(), fi = new WeakMap(), os = new WeakMap(), Da = new WeakMap(),
6404
6405
  if (!n || !o || o.wallclock - n.wallclock > Wu)
6405
6406
  return;
6406
6407
  const c = z.fromPromise(
6407
- Ii.subscribe(
6408
+ Ci.subscribe(
6408
6409
  a(this, Da),
6409
6410
  new Xt().name(a(this, Oa)).groupOrder("ascending").range(t, t).build()
6410
6411
  )
@@ -6433,33 +6434,33 @@ function AA(s) {
6433
6434
  function wA(s) {
6434
6435
  return typeof s.language == "string";
6435
6436
  }
6436
- var dc, Fa, pi, Pn;
6437
+ var dc, Fa, gi, Pn;
6437
6438
  const mu = class mu {
6438
6439
  constructor(e, t, i, n, o) {
6439
6440
  d(this, dc, new qd());
6440
6441
  d(this, Fa);
6441
- d(this, pi);
6442
+ d(this, gi);
6442
6443
  d(this, Pn, 0);
6443
6444
  r(this, "trackObject");
6444
6445
  r(this, "namespace");
6445
- l(this, pi, e), l(this, Fa, t), this.trackObject = i, this.namespace = n, l(this, Pn, o);
6446
+ l(this, gi, e), l(this, Fa, t), this.trackObject = i, this.namespace = n, l(this, Pn, o);
6446
6447
  }
6447
6448
  static subscribe(e, t, i) {
6448
6449
  return f(this, null, function* () {
6449
6450
  if (!wA(t))
6450
6451
  throw new Error("track object language is required");
6451
- const n = new Xt().name(t.name).build(), o = yield Ii.subscribe(e, n), c = o.objects();
6452
+ const n = new Xt().name(t.name).build(), o = yield Ci.subscribe(e, n), c = o.objects();
6452
6453
  return new mu(o, c, t, e.namespace(), i);
6453
6454
  });
6454
6455
  }
6455
6456
  largestGroupId() {
6456
- return a(this, pi).largestGroupId();
6457
+ return a(this, gi).largestGroupId();
6457
6458
  }
6458
6459
  update(e, t) {
6459
- return a(this, pi).update(e, t);
6460
+ return a(this, gi).update(e, t);
6460
6461
  }
6461
6462
  unsubscribe() {
6462
- return a(this, pi).unsubscribe();
6463
+ return a(this, gi).unsubscribe();
6463
6464
  }
6464
6465
  next() {
6465
6466
  return f(this, null, function* () {
@@ -6479,7 +6480,7 @@ const mu = class mu {
6479
6480
  }
6480
6481
  return() {
6481
6482
  return f(this, null, function* () {
6482
- return yield a(this, pi).return(), { done: !0, value: void 0 };
6483
+ return yield a(this, gi).return(), { done: !0, value: void 0 };
6483
6484
  });
6484
6485
  }
6485
6486
  [Symbol.asyncIterator]() {
@@ -6492,9 +6493,9 @@ const mu = class mu {
6492
6493
  return this.unsubscribe();
6493
6494
  }
6494
6495
  };
6495
- dc = new WeakMap(), Fa = new WeakMap(), pi = new WeakMap(), Pn = new WeakMap();
6496
+ dc = new WeakMap(), Fa = new WeakMap(), gi = new WeakMap(), Pn = new WeakMap();
6496
6497
  let Rh = mu;
6497
- var Ad, cs, hs, us, gi, ah, xn, ho;
6498
+ var Ad, cs, hs, us, Ai, ah, xn, ho;
6498
6499
  Ad = [Pe({ context: "Channel", enter: "info" })];
6499
6500
  const Gs = class Gs {
6500
6501
  constructor(e, t, i, n, o) {
@@ -6503,8 +6504,8 @@ const Gs = class Gs {
6503
6504
  d(this, cs);
6504
6505
  d(this, hs);
6505
6506
  d(this, us);
6506
- d(this, gi);
6507
- this.namespace = n, l(this, cs, e), l(this, hs, t), l(this, us, i), l(this, gi, o);
6507
+ d(this, Ai);
6508
+ this.namespace = n, l(this, cs, e), l(this, hs, t), l(this, us, i), l(this, Ai, o);
6508
6509
  }
6509
6510
  static start(e, t) {
6510
6511
  return f(this, null, function* () {
@@ -6525,10 +6526,10 @@ const Gs = class Gs {
6525
6526
  return a(this, hs).timestampWallclockOffset();
6526
6527
  }
6527
6528
  timestampOffsetMs() {
6528
- return a(this, gi);
6529
+ return a(this, Ai);
6529
6530
  }
6530
6531
  setTimestampOffsetMs(e) {
6531
- l(this, gi, e);
6532
+ l(this, Ai, e);
6532
6533
  }
6533
6534
  waitForWallclockTime(e) {
6534
6535
  return a(this, hs).waitForWallclockTime(e);
@@ -6536,13 +6537,13 @@ const Gs = class Gs {
6536
6537
  subscribeCmafTrack(e, t) {
6537
6538
  const i = t == null ? void 0 : t.startGroup, n = t == null ? void 0 : t.params, o = this.catalog().current().tracks, c = e["com.vindral.variant_uid"] !== void 0 ? o.find((h) => h["com.vindral.variant_uid"] === e["com.vindral.variant_uid"]) : void 0;
6538
6539
  return A(this, xn, ho).call(this, () => Ch.subscribe(a(this, cs), c != null ? c : e, {
6539
- timestampOffsetMs: a(this, gi),
6540
+ timestampOffsetMs: a(this, Ai),
6540
6541
  startGroup: i,
6541
6542
  params: n
6542
6543
  }));
6543
6544
  }
6544
6545
  subscribeWebVttTrack(e) {
6545
- return A(this, xn, ho).call(this, () => Rh.subscribe(a(this, cs), e, a(this, gi)));
6546
+ return A(this, xn, ho).call(this, () => Rh.subscribe(a(this, cs), e, a(this, Ai)));
6546
6547
  }
6547
6548
  subscribeTrack(e) {
6548
6549
  return A(this, xn, ho).call(this, () => a(this, cs).subscribe(e));
@@ -6554,18 +6555,18 @@ const Gs = class Gs {
6554
6555
  return Promise.all([a(this, us).close(), a(this, hs).close()]);
6555
6556
  }
6556
6557
  };
6557
- ah = Ci(null), cs = new WeakMap(), hs = new WeakMap(), us = new WeakMap(), gi = new WeakMap(), xn = new WeakSet(), ho = function(e) {
6558
+ ah = ki(null), cs = new WeakMap(), hs = new WeakMap(), us = new WeakMap(), Ai = new WeakMap(), xn = new WeakSet(), ho = function(e) {
6558
6559
  return f(this, null, function* () {
6559
6560
  const [t, i] = this.catalog().value();
6560
6561
  try {
6561
6562
  return yield e();
6562
6563
  } catch (n) {
6563
- if (t === this.catalog().current() && i && (yield Promise.race([i, Ti(500)])), t !== this.catalog().current())
6564
+ if (t === this.catalog().current() && i && (yield Promise.race([i, Ii(500)])), t !== this.catalog().current())
6564
6565
  return e();
6565
6566
  throw n;
6566
6567
  }
6567
6568
  });
6568
- }, ye(ah, 9, "start", Ad, Gs), Zt(ah, Gs), ki(ah, 3, Gs);
6569
+ }, ye(ah, 9, "start", Ad, Gs), Zt(ah, Gs), Bi(ah, 3, Gs);
6569
6570
  let _o = Gs;
6570
6571
  const bA = U(8);
6571
6572
  function yA(s) {
@@ -6628,10 +6629,10 @@ let Uh = fu;
6628
6629
  function to(s) {
6629
6630
  return typeof s == "string" || s === null || s === void 0;
6630
6631
  }
6631
- function SA(s) {
6632
+ function vA(s) {
6632
6633
  return "provider" in s && typeof s.provider == "string" && (!("widevineLicenseUrl" in s) || to(s.widevineLicenseUrl)) && (!("playreadyLicenseUrl" in s) || to(s.playreadyLicenseUrl)) && (!("fairplayLicenseUrl" in s) || to(s.fairplayLicenseUrl)) && (!("fairplayCertificate" in s) || to(s.fairplayCertificate));
6633
6634
  }
6634
- function vA(s) {
6635
+ function SA(s) {
6635
6636
  try {
6636
6637
  return Td(s);
6637
6638
  } catch (e) {
@@ -6640,11 +6641,11 @@ function vA(s) {
6640
6641
  }
6641
6642
  function EA(s) {
6642
6643
  const e = new TextDecoder().decode(s), t = JSON.parse(e);
6643
- if (!SA(t))
6644
+ if (!vA(t))
6644
6645
  throw new Error("Invalid drm object");
6645
6646
  const o = t, { fairplayCertificate: i } = o, n = yu(o, ["fairplayCertificate"]);
6646
- return M(S({}, n), {
6647
- fairplayCertificate: i ? vA(i) : void 0
6647
+ return M(v({}, n), {
6648
+ fairplayCertificate: i ? SA(i) : void 0
6648
6649
  });
6649
6650
  }
6650
6651
  class au {
@@ -6662,7 +6663,7 @@ class au {
6662
6663
  if (c.done)
6663
6664
  throw new Error("No drm object received");
6664
6665
  const h = EA(c.value.payload);
6665
- return new au(M(S({}, h), { videoCodec: t, audioCodec: i }));
6666
+ return new au(M(v({}, h), { videoCodec: t, audioCodec: i }));
6666
6667
  } catch (m) {
6667
6668
  var p = m, g = !0;
6668
6669
  } finally {
@@ -6792,7 +6793,7 @@ class Kc {
6792
6793
  name: c.trackObject.name,
6793
6794
  namespace: c.namespace
6794
6795
  };
6795
- a(this, Dn).debug("track start", S({ mediaType: e }, h)), yield* Hc(c), a(this, Dn).debug("track end", S({ mediaType: e }, h));
6796
+ a(this, Dn).debug("track start", v({ mediaType: e }, h)), yield* Hc(c), a(this, Dn).debug("track end", v({ mediaType: e }, h));
6796
6797
  }
6797
6798
  } catch (n) {
6798
6799
  o = [n];
@@ -6809,11 +6810,11 @@ class Kc {
6809
6810
  }
6810
6811
  }
6811
6812
  Dn = new WeakMap(), Va = new WeakMap(), Ga = new WeakMap();
6812
- var wd, bd, yd, On, Mn, ls, fe, at, ot, Ai, Fn, ja, tr, Ce, uo, ar, Vl, Lh;
6813
+ var wd, bd, yd, On, Mn, ls, fe, at, ot, wi, Fn, ja, ir, Ce, uo, or, Vl, Lh;
6813
6814
  yd = [Pe({ context: "Player", enter: "info" })], bd = [Pe({ context: "Player", enter: "info", return: "info" })], wd = [Pe({ context: "Player", enter: "info" })];
6814
6815
  const js = class js {
6815
6816
  constructor(e, t, i) {
6816
- ki(tr, 5, this);
6817
+ Bi(ir, 5, this);
6817
6818
  d(this, Ce);
6818
6819
  d(this, On);
6819
6820
  d(this, Mn);
@@ -6821,10 +6822,10 @@ const js = class js {
6821
6822
  d(this, fe);
6822
6823
  d(this, at, new Ie(void 0));
6823
6824
  d(this, ot, new Ie(void 0));
6824
- d(this, Ai, new Ie(void 0));
6825
+ d(this, wi, new Ie(void 0));
6825
6826
  d(this, Fn);
6826
6827
  d(this, ja);
6827
- r(this, "subtitles", new Kc(a(this, Ai), "subtitles"));
6828
+ r(this, "subtitles", new Kc(a(this, wi), "subtitles"));
6828
6829
  r(this, "video", new Kc(a(this, ot), "video"));
6829
6830
  r(this, "audio", new Kc(a(this, at), "audio"));
6830
6831
  l(this, On, e), l(this, Mn, Uh.start(i)), l(this, ls, i), l(this, fe, new Ie(t)), l(this, Fn, new CA(t)), l(this, ja, Promise.race([i.idleTimeout(), A(this, Ce, Vl).call(this), a(this, Fn).closed()])), a(this, On).closed().then(() => this.close()).catch(O);
@@ -6894,18 +6895,18 @@ const js = class js {
6894
6895
  // Close the consumers so that the iterators will stop
6895
6896
  A(this, Ce, uo).call(this, a(this, at)),
6896
6897
  A(this, Ce, uo).call(this, a(this, ot)),
6897
- A(this, Ce, uo).call(this, a(this, Ai))
6898
+ A(this, Ce, uo).call(this, a(this, wi))
6898
6899
  ]);
6899
6900
  }
6900
6901
  zap(e, t) {
6901
6902
  return f(this, null, function* () {
6902
- var v, I;
6903
+ var S, I;
6903
6904
  const i = yield _o.start(a(this, On), e), n = a(this, Mn).wallclock() - t, o = a(this, fe).current(), c = o.timestampWallclockOffset(), h = yield i.waitForWallclockTime(n);
6904
6905
  a(this, Fn).update(i), yield a(this, fe).current().close();
6905
6906
  const u = h.toReversed().find((k) => k.wallclock <= n), m = u != null && u.mediaPts ? u.mediaPts - o.timestampOffsetMs() : void 0, w = i.timestampWallclockOffset() - c + o.timestampOffsetMs();
6906
6907
  i.setTimestampOffsetMs(w);
6907
6908
  const b = u != null && u.groupId ? U(u.groupId) : void 0;
6908
- m && ((v = a(this, ot).current()) == null || v.stopAfterTimestampReached(m), (I = a(this, at).current()) == null || I.stopAfterTimestampReached(m)), a(this, fe).update(i), yield Promise.all([
6909
+ m && ((S = a(this, ot).current()) == null || S.stopAfterTimestampReached(m), (I = a(this, at).current()) == null || I.stopAfterTimestampReached(m)), a(this, fe).update(i), yield Promise.all([
6909
6910
  e.videoTrack ? this.setVideoTrack(e.videoTrack, b) : void 0,
6910
6911
  e.audioTrack ? this.setAudioTrack(e.audioTrack, b) : void 0
6911
6912
  ]);
@@ -6915,33 +6916,33 @@ const js = class js {
6915
6916
  return f(this, null, function* () {
6916
6917
  var i, n;
6917
6918
  if (!e) {
6918
- yield (i = a(this, Ai).current()) == null ? void 0 : i.unsubscribe();
6919
+ yield (i = a(this, wi).current()) == null ? void 0 : i.unsubscribe();
6919
6920
  return;
6920
6921
  }
6921
6922
  const [t] = yield Promise.all([
6922
6923
  a(this, fe).current().subscribeWebVttTrack(e),
6923
- (n = a(this, Ai).current()) == null ? void 0 : n.unsubscribe()
6924
+ (n = a(this, wi).current()) == null ? void 0 : n.unsubscribe()
6924
6925
  ]);
6925
- a(this, Ai).update(t);
6926
+ a(this, wi).update(t);
6926
6927
  });
6927
6928
  }
6928
6929
  setVideoTrack(e, t) {
6929
6930
  return f(this, null, function* () {
6930
- const i = yield A(this, Ce, ar).call(this, a(this, fe).current(), e, a(this, ot).current(), t);
6931
+ const i = yield A(this, Ce, or).call(this, a(this, fe).current(), e, a(this, ot).current(), t);
6931
6932
  a(this, ot).update(i);
6932
6933
  });
6933
6934
  }
6934
6935
  setAudioTrack(e, t) {
6935
6936
  return f(this, null, function* () {
6936
- const i = yield A(this, Ce, ar).call(this, a(this, fe).current(), e, a(this, at).current(), t);
6937
+ const i = yield A(this, Ce, or).call(this, a(this, fe).current(), e, a(this, at).current(), t);
6937
6938
  a(this, at).update(i);
6938
6939
  });
6939
6940
  }
6940
6941
  };
6941
- tr = Ci(null), On = new WeakMap(), Mn = new WeakMap(), ls = new WeakMap(), fe = new WeakMap(), at = new WeakMap(), ot = new WeakMap(), Ai = new WeakMap(), Fn = new WeakMap(), ja = new WeakMap(), Ce = new WeakSet(), uo = function(e) {
6942
+ ir = ki(null), On = new WeakMap(), Mn = new WeakMap(), ls = new WeakMap(), fe = new WeakMap(), at = new WeakMap(), ot = new WeakMap(), wi = new WeakMap(), Fn = new WeakMap(), ja = new WeakMap(), Ce = new WeakSet(), uo = function(e) {
6942
6943
  const t = e.current(), i = t == null ? void 0 : t.largestGroupId();
6943
6944
  return e.isClosed() || e.update(void 0), e.close(), i ? t == null ? void 0 : t.update(i, i) : t == null ? void 0 : t.unsubscribe();
6944
- }, ar = function(e, t, i, n) {
6945
+ }, or = function(e, t, i, n) {
6945
6946
  return f(this, null, function* () {
6946
6947
  const o = i == null ? void 0 : i.largestGroupId(), [c, h] = yield Promise.all([
6947
6948
  e.subscribeCmafTrack(t, {
@@ -7000,23 +7001,23 @@ tr = Ci(null), On = new WeakMap(), Mn = new WeakMap(), ls = new WeakMap(), fe =
7000
7001
  t.update(yield a(this, fe).current().subscribeCmafTrack(h));
7001
7002
  }
7002
7003
  });
7003
- }, ye(tr, 1, "close", yd, js), ye(tr, 1, "zap", bd, js), ar = ye(tr, 17, "#replaceTrack", wd, Ce, ar), Zt(tr, js);
7004
+ }, ye(ir, 1, "close", yd, js), ye(ir, 1, "zap", bd, js), or = ye(ir, 17, "#replaceTrack", wd, Ce, or), Zt(ir, js);
7004
7005
  let xh = js;
7005
7006
  function eh(s, e, t) {
7006
7007
  const i = new URL("/voq/subscribe", s);
7007
7008
  return i.searchParams.set("sessionId", e.sessionId), i.searchParams.set("clientId", e.clientId), i.searchParams.set("channelId", e.channelId), t && i.searchParams.set("authToken", t), i;
7008
7009
  }
7009
7010
  const kA = 1e4;
7010
- var me, ve, Qe, ms, K, wi, Wa, _n, za, Nn, ke, Gl, Vn, Ha, Gn, jl, Wl, zl, Hl, Oh;
7011
+ var me, Se, Qe, ms, K, bi, Wa, _n, za, Nn, ke, Gl, Vn, Ha, Gn, jl, Wl, zl, Hl, Oh;
7011
7012
  const gu = class gu {
7012
7013
  constructor(e, t, i, n, o, c, h) {
7013
7014
  d(this, ke);
7014
7015
  d(this, me);
7015
- d(this, ve);
7016
+ d(this, Se);
7016
7017
  d(this, Qe);
7017
7018
  d(this, ms, "disconnected");
7018
7019
  d(this, K);
7019
- d(this, wi, /* @__PURE__ */ new Map());
7020
+ d(this, bi, /* @__PURE__ */ new Map());
7020
7021
  d(this, Wa);
7021
7022
  d(this, _n);
7022
7023
  d(this, za);
@@ -7026,7 +7027,7 @@ const gu = class gu {
7026
7027
  a(this, K).setSubtitleTrack(void 0).catch(O);
7027
7028
  return;
7028
7029
  }
7029
- const t = a(this, wi).get(Bi(a(this, K).namespace())), i = t == null ? void 0 : t.getTextTrack(e);
7030
+ const t = a(this, bi).get(Ri(a(this, K).namespace())), i = t == null ? void 0 : t.getTextTrack(e);
7030
7031
  i && a(this, K).setSubtitleTrack(i).catch(O);
7031
7032
  });
7032
7033
  d(this, Ha, (e) => {
@@ -7034,11 +7035,11 @@ const gu = class gu {
7034
7035
  case "subscribe":
7035
7036
  {
7036
7037
  if (a(this, Gn)) {
7037
- a(this, ve).info("Ignoring - we are already switching");
7038
+ a(this, Se).info("Ignoring - we are already switching");
7038
7039
  return;
7039
7040
  }
7040
7041
  l(this, Gn, !0), A(this, ke, Wl).call(this, e.subscription).catch((t) => {
7041
- a(this, ve).error("error handling subscription", t), a(this, me).emit("received signal", {
7042
+ a(this, Se).error("error handling subscription", t), a(this, me).emit("received signal", {
7042
7043
  type: "subscription changed",
7043
7044
  subscription: e.subscription,
7044
7045
  reset: !0
@@ -7047,7 +7048,7 @@ const gu = class gu {
7047
7048
  }
7048
7049
  break;
7049
7050
  case "telemetry":
7050
- Sd(new URL("/api/telemetry", a(this, Qe).url().replace("wss://", "https://")), {
7051
+ vd(new URL("/api/telemetry", a(this, Qe).url().replace("wss://", "https://")), {
7051
7052
  body: e.body,
7052
7053
  headers: { "Content-Type": "text/plain" }
7053
7054
  }).catch(O);
@@ -7059,9 +7060,9 @@ const gu = class gu {
7059
7060
  });
7060
7061
  d(this, Gn, !1);
7061
7062
  r(this, "disconnect", (e = "Disconnect Requested") => {
7062
- a(this, ve).info("Disconnecting", e), a(this, Qe).close(), a(this, K).close().catch(O), l(this, Nn, /* @__PURE__ */ new Map()), l(this, ms, "disconnected");
7063
+ a(this, Se).info("Disconnecting", e), a(this, Qe).close(), a(this, K).close().catch(O), l(this, Nn, /* @__PURE__ */ new Map()), l(this, ms, "disconnected");
7063
7064
  });
7064
- l(this, me, e), l(this, ve, t), l(this, Qe, i), l(this, K, n), l(this, wi, o), l(this, Wa, c), l(this, _n, h), a(this, me).on("send signal", a(this, Ha)), a(this, me).on("disconnect", this.disconnect), a(this, me).on("text track", a(this, Vn)), A(this, ke, Gl).call(this).catch(O), A(this, ke, zl).call(this).catch(O);
7065
+ l(this, me, e), l(this, Se, t), l(this, Qe, i), l(this, K, n), l(this, bi, o), l(this, Wa, c), l(this, _n, h), a(this, me).on("send signal", a(this, Ha)), a(this, me).on("disconnect", this.disconnect), a(this, me).on("text track", a(this, Vn)), A(this, ke, Gl).call(this).catch(O), A(this, ke, zl).call(this).catch(O);
7065
7066
  }
7066
7067
  get estimatedBandwidth() {
7067
7068
  return a(this, za);
@@ -7084,7 +7085,7 @@ const gu = class gu {
7084
7085
  var T, P, R, X;
7085
7086
  const c = new Map(
7086
7087
  n.connectInfo.channels.map((Q) => [
7087
- Bi(Q.catalog.namespace),
7088
+ Ri(Q.catalog.namespace),
7088
7089
  new th(new Ie(Q.catalog))
7089
7090
  ])
7090
7091
  ), h = yield n.onConnectInfo(n.connectInfo), u = n.options.get("authenticationToken");
@@ -7100,7 +7101,7 @@ const gu = class gu {
7100
7101
  }
7101
7102
  const g = (T = n.connectInfo.channels.find((Q) => Q.channelId === h.channelId)) == null ? void 0 : T.catalog;
7102
7103
  t.debug("Resolved edge url", { edgeUrl: m, edgeWsUrl: p }), Xe(g, "no catalog found");
7103
- const w = (P = c.get(Bi(g.namespace))) == null ? void 0 : P.getVideoTrack(h.video), b = (R = c.get(Bi(g.namespace))) == null ? void 0 : R.getAudioTrack(h.audio), v = yield uA({
7104
+ const w = (P = c.get(Ri(g.namespace))) == null ? void 0 : P.getVideoTrack(h.video), b = (R = c.get(Ri(g.namespace))) == null ? void 0 : R.getAudioTrack(h.audio), S = yield uA({
7104
7105
  url: m,
7105
7106
  wsUrl: p,
7106
7107
  authToken: n.options.get("authenticationToken"),
@@ -7108,7 +7109,7 @@ const gu = class gu {
7108
7109
  role: Ng.Subscriber,
7109
7110
  websocketFallbackTimeoutMs: 2e3
7110
7111
  }), I = yield Promise.race([
7111
- xh.start(v.subscriber, {
7112
+ xh.start(S.subscriber, {
7112
7113
  namespace: g.namespace,
7113
7114
  catalog: g,
7114
7115
  videoTrack: w == null ? void 0 : w.track,
@@ -7116,9 +7117,9 @@ const gu = class gu {
7116
7117
  burstMs: h.burstMs || 0
7117
7118
  }),
7118
7119
  su(kA, new Error("Timeout waiting for player to start")),
7119
- Lm(v.closed(), "Session closed before player started")
7120
+ Lm(S.closed(), "Session closed before player started")
7120
7121
  ]), k = new th(I.catalog());
7121
- c.set(Bi(g.namespace), k), e.emit("received signal", {
7122
+ c.set(Ri(g.namespace), k), e.emit("received signal", {
7122
7123
  type: "client ip",
7123
7124
  ip: I.connectionInfo().ip
7124
7125
  }), I.drm().then((Q) => {
@@ -7126,8 +7127,8 @@ const gu = class gu {
7126
7127
  }).catch((Q) => {
7127
7128
  t.error("Error getting DRM data", Q);
7128
7129
  });
7129
- const D = new gu(e, t, v, I, c, i, o);
7130
- return h.textTrack && a(X = D, Vn).call(X, h.textTrack), D;
7130
+ const L = new gu(e, t, S, I, c, i, o);
7131
+ return h.textTrack && a(X = L, Vn).call(X, h.textTrack), L;
7131
7132
  });
7132
7133
  }
7133
7134
  getState() {
@@ -7140,9 +7141,9 @@ const gu = class gu {
7140
7141
  return Promise.race([a(this, Qe).closed(), a(this, K).closed()]);
7141
7142
  }
7142
7143
  };
7143
- me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(), K = new WeakMap(), wi = new WeakMap(), Wa = new WeakMap(), _n = new WeakMap(), za = new WeakMap(), Nn = new WeakMap(), ke = new WeakSet(), Gl = function() {
7144
+ me = new WeakMap(), Se = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(), K = new WeakMap(), bi = new WeakMap(), Wa = new WeakMap(), _n = new WeakMap(), za = new WeakMap(), Nn = new WeakMap(), ke = new WeakSet(), Gl = function() {
7144
7145
  return f(this, null, function* () {
7145
- a(this, Qe).transportType() === "websocket" && (yield Ti(5e3));
7146
+ a(this, Qe).transportType() === "websocket" && (yield Ii(5e3));
7146
7147
  try {
7147
7148
  for (var e = $(a(this, K).stats()), t, i, n; t = !(i = yield e.next()).done; t = !1) {
7148
7149
  const { rtt: o, estimatedBandwidth: c } = i.value;
@@ -7163,7 +7164,7 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7163
7164
  return f(this, null, function* () {
7164
7165
  var n;
7165
7166
  const t = yield a(this, Wa).connect({ channelId: e });
7166
- if (!vd(t))
7167
+ if (!Sd(t))
7167
7168
  throw new Error("no moq connect info found");
7168
7169
  const i = (n = t.channels.find((o) => o.channelId === e)) == null ? void 0 : n.catalog;
7169
7170
  if (!i)
@@ -7173,11 +7174,11 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7173
7174
  }, Wl = function(e) {
7174
7175
  return f(this, null, function* () {
7175
7176
  var c, h, u;
7176
- a(this, ve).info("handle subscription", e);
7177
+ a(this, Se).info("handle subscription", e);
7177
7178
  const t = a(this, K);
7178
- let i = a(this, wi).get(e.channelId);
7179
- if (i || (i = new th(new Ie(yield A(this, ke, jl).call(this, e.channelId))), a(this, wi).set(e.channelId, i)), t.namespace().join("/") !== i.namespace().join("/")) {
7180
- a(this, ve).info("changing channel", e.channelId);
7179
+ let i = a(this, bi).get(e.channelId);
7180
+ if (i || (i = new th(new Ie(yield A(this, ke, jl).call(this, e.channelId))), a(this, bi).set(e.channelId, i)), t.namespace().join("/") !== i.namespace().join("/")) {
7181
+ a(this, Se).info("changing channel", e.channelId);
7181
7182
  const m = i.getVideoTrack(e.video), p = i.getAudioTrack(e.audio);
7182
7183
  yield t.zap(
7183
7184
  {
@@ -7190,8 +7191,8 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7190
7191
  ), t.drm().then((g) => {
7191
7192
  g && a(this, me).emit("received drm data", g.value);
7192
7193
  }).catch((g) => {
7193
- a(this, ve).error("Error getting DRM data", g);
7194
- }), a(this, ve).info("switched channel", e.channelId), (c = a(this, wi).get(Bi(t.namespace()))) == null || c.updateCatalog(t.catalog()), a(this, me).emit("received signal", {
7194
+ a(this, Se).error("Error getting DRM data", g);
7195
+ }), a(this, Se).info("switched channel", e.channelId), (c = a(this, bi).get(Ri(t.namespace()))) == null || c.updateCatalog(t.catalog()), a(this, me).emit("received signal", {
7195
7196
  type: "subscription changed",
7196
7197
  subscription: e
7197
7198
  });
@@ -7209,13 +7210,13 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7209
7210
  }, zl = function() {
7210
7211
  return f(this, null, function* () {
7211
7212
  try {
7212
- l(this, ms, "connecting"), a(this, ve).info("Connecting..."), l(this, ms, "connected"), yield Promise.all([
7213
+ l(this, ms, "connecting"), a(this, Se).info("Connecting..."), l(this, ms, "connected"), yield Promise.all([
7213
7214
  A(this, ke, Oh).call(this, a(this, K).referenceClock(), a(this, K).audio),
7214
7215
  A(this, ke, Oh).call(this, a(this, K).referenceClock(), a(this, K).video),
7215
7216
  A(this, ke, Hl).call(this, a(this, K).subtitles)
7216
- ]), yield a(this, K).closed(), a(this, Qe).close(), a(this, ve).info("Session closed");
7217
+ ]), yield a(this, K).closed(), a(this, Qe).close(), a(this, Se).info("Session closed");
7217
7218
  } catch (e) {
7218
- a(this, ve).warn("Session error", e);
7219
+ a(this, Se).warn("Session error", e);
7219
7220
  }
7220
7221
  });
7221
7222
  }, Hl = function(e) {
@@ -7242,23 +7243,23 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7242
7243
  let i = "", n = "", o;
7243
7244
  const c = a(this, K).videoTrack() === void 0;
7244
7245
  try {
7245
- for (var w = $(t), b, v, I; b = !(v = yield w.next()).done; b = !1) {
7246
- const k = v.value;
7247
- const D = Bi(k.track.namespace), T = k.track.trackObject.language, P = dm((h = k.track.trackObject.codec) != null ? h : ""), R = k.track.trackObject.codec, X = P ? Oi({ codec: P, codecString: R }) : void 0, Q = !!k.track.trackObject["com.vindral.drm"];
7246
+ for (var w = $(t), b, S, I; b = !(S = yield w.next()).done; b = !1) {
7247
+ const k = S.value;
7248
+ const L = Ri(k.track.namespace), T = k.track.trackObject.language, P = dm((h = k.track.trackObject.codec) != null ? h : ""), R = k.track.trackObject.codec, X = P ? ti({ codec: P, codecString: R }) : void 0, Q = !!k.track.trackObject["com.vindral.drm"];
7248
7249
  try {
7249
7250
  for (var u = $(k), m, p, g; m = !(p = yield u.next()).done; m = !1) {
7250
7251
  const [Fe, te] = p.value;
7251
7252
  const ht = {
7252
- channelId: i !== "" && (c || te.mediaType() === "video") && i !== D ? D : void 0,
7253
+ channelId: i !== "" && (c || te.mediaType() === "video") && i !== L ? L : void 0,
7253
7254
  language: te.mediaType() === "audio" && n !== T ? T : void 0,
7254
7255
  drmTransition: o !== void 0 && o !== Q
7255
7256
  };
7256
- i = D, n = T, o = Q;
7257
+ i = L, n = T, o = Q;
7257
7258
  const Be = te.producerReferenceTime(), y = a(this, Nn).get(k.track.namespace) || 0;
7258
7259
  if (Be && Date.now() - y > 1e3) {
7259
7260
  a(this, Nn).set(k.track.namespace, Date.now());
7260
7261
  const E = e.wallclock() - Be.getTime();
7261
- a(this, ve).debug("timing-info", {
7262
+ a(this, Se).debug("timing-info", {
7262
7263
  mediaType: te.mediaType(),
7263
7264
  referenceClock: e,
7264
7265
  delta: E,
@@ -7268,7 +7269,7 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7268
7269
  }), a(this, me).emit("received signal", {
7269
7270
  type: "timing info",
7270
7271
  timingInfo: {
7271
- channelId: D,
7272
+ channelId: L,
7272
7273
  timestamp: te.baseMediaDecodeTime() / te.timescale() * 1e3 + E,
7273
7274
  wallclockTime: Be.getTime()
7274
7275
  }
@@ -7276,7 +7277,7 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7276
7277
  }
7277
7278
  a(this, me).emit("received moq data", {
7278
7279
  payload: te,
7279
- channelId: D,
7280
+ channelId: L,
7280
7281
  groupId: Fe,
7281
7282
  mimeType: X,
7282
7283
  codec: P,
@@ -7296,11 +7297,11 @@ me = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), ms = new WeakMap(),
7296
7297
  }
7297
7298
  }
7298
7299
  }
7299
- } catch (v) {
7300
- I = [v];
7300
+ } catch (S) {
7301
+ I = [S];
7301
7302
  } finally {
7302
7303
  try {
7303
- b && (v = w.return) && (yield v.call(w));
7304
+ b && (S = w.return) && (yield S.call(w));
7304
7305
  } finally {
7305
7306
  if (I)
7306
7307
  throw I[0];
@@ -7359,7 +7360,7 @@ const RA = (s, e) => {
7359
7360
  const t = new URL("/subscribe", s);
7360
7361
  return t.searchParams.append("channelId", e.channelId), t.searchParams.append("sessionId", e.sessionId), t.searchParams.append("clientId", e.clientId), e.audio && e.audio.codec && (t.searchParams.append("audio.bitRate", Math.round(e.audio.bitRate).toString()), t.searchParams.append("audio.codec", e.audio.codec), e.audio.language && t.searchParams.append("audio.language", e.audio.language)), e.video && e.video.codec && (t.searchParams.append("video.width", e.video.width.toString()), t.searchParams.append("video.height", e.video.height.toString()), t.searchParams.append("video.bitRate", Math.round(e.video.bitRate).toString()), t.searchParams.append("video.codec", e.video.codec)), e.expectAdditionalConnection && t.searchParams.append("expectAdditionalConnection", e.expectAdditionalConnection.toString()), e.burstMs && t.searchParams.append("burstMs", e.burstMs.toString()), e.channelGroupId && t.searchParams.append("channelGroupId", e.channelGroupId), e.authToken && (t.searchParams.append("auth.token", e.authToken), t.searchParams.append("auth.type", "jwt")), t.toString();
7361
7362
  };
7362
- class UA extends Ei {
7363
+ class UA extends Ti {
7363
7364
  constructor(t, i) {
7364
7365
  super();
7365
7366
  r(this, "options");
@@ -7412,34 +7413,34 @@ class UA extends Ei {
7412
7413
  this.websockets.length !== 0 && this.options.onMessage(t, i.data);
7413
7414
  });
7414
7415
  r(this, "onError", () => {
7415
- this.logger.info("On error", S({}, this.options)), this.close("one websocket had an error"), this.emit("error", new x("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7416
+ this.logger.info("On error", v({}, this.options)), this.close("one websocket had an error"), this.emit("error", new x("WebSocket error", { code: "websocket_error", isFatal: !1 }));
7416
7417
  });
7417
7418
  r(this, "onClose", (t) => {
7418
- switch (this.logger.info("Closed", M(S({}, this.options), {
7419
+ switch (this.logger.info("Closed", M(v({}, this.options), {
7419
7420
  reason: t.reason,
7420
7421
  code: t.code,
7421
7422
  isSuspended: this.isSuspended
7422
7423
  })), this.close("one websocket was closed"), t.code) {
7423
7424
  case 4e3:
7424
- this.emit("error", mo(Kn()));
7425
+ this.emit("error", mo(er()));
7425
7426
  break;
7426
7427
  case 4001:
7427
- this.emit("error", mo(Kn()));
7428
+ this.emit("error", mo(er()));
7428
7429
  break;
7429
7430
  case 4002:
7430
- this.emit("error", nf(Kn()));
7431
+ this.emit("error", nf(er()));
7431
7432
  break;
7432
7433
  case 4003:
7433
- this.emit("error", Ud("internal", Kn()));
7434
+ this.emit("error", Ud("internal", er()));
7434
7435
  break;
7435
7436
  case 4010:
7436
- this.emit("error", rf("internal", Kn()));
7437
+ this.emit("error", rf("internal", er()));
7437
7438
  break;
7438
7439
  }
7439
7440
  this.emit("close", this);
7440
7441
  });
7441
7442
  r(this, "onOpen", () => {
7442
- this.logger.info("Opened", S({}, this.options)), this.readyState() === WebSocket.OPEN && (this._connectTime = Date.now() - this.connectStartTime, this.reconnectState.reconnectRetries = 0, this._isConnectInProgress = !1, this.emit("open", this));
7443
+ this.logger.info("Opened", v({}, this.options)), this.readyState() === WebSocket.OPEN && (this._connectTime = Date.now() - this.connectStartTime, this.reconnectState.reconnectRetries = 0, this._isConnectInProgress = !1, this.emit("open", this));
7443
7444
  });
7444
7445
  /**
7445
7446
  * @returns a promise that resolves true if the connect steps succeeded
@@ -7451,7 +7452,7 @@ class UA extends Ei {
7451
7452
  if (this.isSuspended)
7452
7453
  return !1;
7453
7454
  if (this.readyState() !== WebSocket.CLOSED && this.close("new connection in progress"), this.shouldContinueConnecting = !0, this._isConnectInProgress = !0, t && this.options.reconnectDelay > 0) {
7454
- this.logger.info("Waiting for reconnect delay", S({}, this.options)), yield Ti(this.options.reconnectDelay);
7455
+ this.logger.info("Waiting for reconnect delay", v({}, this.options)), yield Ii(this.options.reconnectDelay);
7455
7456
  const i = yield this.options.reconnectHandler(this.reconnectState);
7456
7457
  if (this.reconnectState.reconnectRetries++, !i)
7457
7458
  return this._isConnectInProgress = !1, this.emit("error", Pd()), !1;
@@ -7463,7 +7464,7 @@ class UA extends Ei {
7463
7464
  const { url: i, connectionCount: n } = yield this.options.connectHandler();
7464
7465
  if (this.connectStartTime = Date.now(), !this.shouldContinueConnecting)
7465
7466
  return this._isConnectInProgress = !1, this.logger.info("Connection aborted"), !1;
7466
- this.logger.info("Connecting websockets", M(S({}, this.options), { url: i }));
7467
+ this.logger.info("Connecting websockets", M(v({}, this.options), { url: i }));
7467
7468
  for (let o = 0; o < n; o++) {
7468
7469
  const c = new WebSocket(i);
7469
7470
  c.binaryType = "arraybuffer", c.onmessage = (h) => this.onMessage(o, h), c.addEventListener("error", this.onError), c.addEventListener("close", this.onClose), c.addEventListener("open", this.onOpen), this.websockets.push(c);
@@ -7668,11 +7669,11 @@ r(lt, "PING_INTERVAL", 5e3), r(lt, "MAX_MISSED_PINGS", 4), r(lt, "TLS_ROUNDTRIPS
7668
7669
  h.transport.once("error", (u) => c(u)), h.transport.once("open", () => o(h));
7669
7670
  }));
7670
7671
  let Mh = lt;
7671
- var jn, bi, Wn;
7672
+ var jn, yi, Wn;
7672
7673
  class OA {
7673
7674
  constructor(e) {
7674
7675
  d(this, jn);
7675
- d(this, bi, []);
7676
+ d(this, yi, []);
7676
7677
  d(this, Wn);
7677
7678
  l(this, jn, e);
7678
7679
  }
@@ -7689,8 +7690,8 @@ class OA {
7689
7690
  select(e) {
7690
7691
  if (a(this, jn).edgeUrl)
7691
7692
  return a(this, jn).edgeUrl;
7692
- a(this, bi).length === 0 && l(this, bi, a(this, bi).concat(e));
7693
- const t = a(this, bi).shift();
7693
+ a(this, yi).length === 0 && l(this, yi, a(this, yi).concat(e));
7694
+ const t = a(this, yi).shift();
7694
7695
  if (l(this, Wn, t), t)
7695
7696
  return t;
7696
7697
  }
@@ -7705,10 +7706,10 @@ class OA {
7705
7706
  * Resets the cached list of edges
7706
7707
  */
7707
7708
  reset() {
7708
- l(this, Wn, void 0), l(this, bi, []);
7709
+ l(this, Wn, void 0), l(this, yi, []);
7709
7710
  }
7710
7711
  }
7711
- jn = new WeakMap(), bi = new WeakMap(), Wn = new WeakMap();
7712
+ jn = new WeakMap(), yi = new WeakMap(), Wn = new WeakMap();
7712
7713
  var Et, Tt, zn, Ht, Hn, Qn, Xn, gc, Ac, wc, Xl;
7713
7714
  const Ws = class Ws {
7714
7715
  constructor(e, t, i) {
@@ -7738,7 +7739,7 @@ const Ws = class Ws {
7738
7739
  l(this, Tt, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
7739
7740
  });
7740
7741
  r(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected");
7741
- r(this, "getStatistics", () => this.connectionImpl ? M(S({}, this.connectionImpl.getStatistics()), {
7742
+ r(this, "getStatistics", () => this.connectionImpl ? M(v({}, this.connectionImpl.getStatistics()), {
7742
7743
  rtt: ei(a(this, Et).items()),
7743
7744
  estimatedBandwidth: this.estimatedBandwidth,
7744
7745
  connectCount: a(this, Hn),
@@ -7777,7 +7778,7 @@ const Ws = class Ws {
7777
7778
  d(this, Ac, () => f(this, null, function* () {
7778
7779
  const e = Date.now(), t = () => Date.now() - e;
7779
7780
  return Promise.race([
7780
- Ti(Ws.PING_TIMEOUT),
7781
+ Ii(Ws.PING_TIMEOUT),
7781
7782
  fetch(new URL("/api/v4/connect/ping", this.config.options.get("url")).toString(), {
7782
7783
  method: "HEAD"
7783
7784
  })
@@ -7820,11 +7821,11 @@ Et = new WeakMap(), Tt = new WeakMap(), zn = new WeakMap(), Ht = new WeakMap(),
7820
7821
  const h = e.select(n.edges);
7821
7822
  if (!h)
7822
7823
  throw new x("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
7823
- vd(n) ? this.connectionImpl = yield Dh.start(
7824
+ Sd(n) ? this.connectionImpl = yield Dh.start(
7824
7825
  this.emitter,
7825
7826
  this.logger,
7826
7827
  this.apiClient,
7827
- M(S({}, this.config), {
7828
+ M(v({}, this.config), {
7828
7829
  connectInfo: n,
7829
7830
  edgeUrl: h
7830
7831
  }),
@@ -7832,7 +7833,7 @@ Et = new WeakMap(), Tt = new WeakMap(), zn = new WeakMap(), Ht = new WeakMap(),
7832
7833
  ) : (Xe(typeof h == "string", "Edge URL is expected to be a string"), this.connectionImpl = yield Mh.start(
7833
7834
  this.emitter,
7834
7835
  this.logger,
7835
- M(S({}, this.config), {
7836
+ M(v({}, this.config), {
7836
7837
  connectInfo: n,
7837
7838
  edgeUrl: h
7838
7839
  }),
@@ -7854,7 +7855,7 @@ Et = new WeakMap(), Tt = new WeakMap(), zn = new WeakMap(), Ht = new WeakMap(),
7854
7855
  this.emitter.emit("error", Pd());
7855
7856
  break;
7856
7857
  }
7857
- if (yield Ti(1e3), !a(this, Tt))
7858
+ if (yield Ii(1e3), !a(this, Tt))
7858
7859
  break;
7859
7860
  }
7860
7861
  l(this, zn, void 0);
@@ -7862,16 +7863,16 @@ Et = new WeakMap(), Tt = new WeakMap(), zn = new WeakMap(), Ht = new WeakMap(),
7862
7863
  }, r(Ws, "PING_TIMEOUT", 1e3), r(Ws, "create", (e, t, i) => new Ws(e, t, i));
7863
7864
  let Fh = Ws;
7864
7865
  const ih = () => ({
7865
- video: M(S({}, lo()), {
7866
- bitRate: vi()
7866
+ video: M(v({}, lo()), {
7867
+ bitRate: Ei()
7867
7868
  }),
7868
7869
  audio: {
7869
- bitRate: vi()
7870
+ bitRate: Ei()
7870
7871
  }
7871
7872
  }), MA = () => ({
7872
7873
  width: window.innerWidth,
7873
7874
  height: window.innerHeight,
7874
- bitRate: vi()
7875
+ bitRate: Ei()
7875
7876
  }), zs = class zs {
7876
7877
  constructor(e, t, i, n) {
7877
7878
  r(this, "emitter");
@@ -7900,9 +7901,9 @@ const ih = () => ({
7900
7901
  r(this, "setUserSpecifiedCap", (e) => {
7901
7902
  var i;
7902
7903
  const t = (i = this.getUserSpecifiedCap()) != null ? i : ih();
7903
- this.userSpecifiedCap = M(S({}, t), {
7904
- video: S(S({}, t.video), e.video),
7905
- audio: S(S({}, t.audio), e.audio)
7904
+ this.userSpecifiedCap = M(v({}, t), {
7905
+ video: v(v({}, t.video), e.video),
7906
+ audio: v(v({}, t.audio), e.audio)
7906
7907
  }), this.evaluateConstraintCap();
7907
7908
  });
7908
7909
  r(this, "getUserSpecifiedCap", () => this.userSpecifiedCap);
@@ -7926,7 +7927,7 @@ const ih = () => ({
7926
7927
  });
7927
7928
  r(this, "evaluateConstraintCap", () => {
7928
7929
  var c, h, u, m, p;
7929
- const e = this.sizeBasedResolutionCapEnabled ? M(S({}, ih()), { video: MA() }) : ih();
7930
+ const e = this.sizeBasedResolutionCapEnabled ? M(v({}, ih()), { video: MA() }) : ih();
7930
7931
  if (!this.resizeObserver) {
7931
7932
  const g = this.element.getBoundingClientRect();
7932
7933
  this.elementSize = { width: g.width, height: g.height };
@@ -7943,7 +7944,7 @@ const ih = () => ({
7943
7944
  });
7944
7945
  i && i.video && (e.video.width = i.video.width, e.video.height = i.video.height);
7945
7946
  const n = (h = this.userSpecifiedCap) == null ? void 0 : h.video, o = (u = this.userSpecifiedCap) == null ? void 0 : u.audio;
7946
- n && (e.video.width > n.width && (e.video.width = n.width), e.video.height > n.height && (e.video.height = n.height)), e.video.bitRate = (m = n == null ? void 0 : n.bitRate) != null ? m : e.video.bitRate, e.audio.bitRate = (p = o == null ? void 0 : o.bitRate) != null ? p : e.audio.bitRate, Is(e, this.currentCap) ? this.currentCap = S({}, e) : (this.currentCap = S({}, e), this.emitter.emit("constraint cap changed", e));
7947
+ n && (e.video.width > n.width && (e.video.width = n.width), e.video.height > n.height && (e.video.height = n.height)), e.video.bitRate = (m = n == null ? void 0 : n.bitRate) != null ? m : e.video.bitRate, e.audio.bitRate = (p = o == null ? void 0 : o.bitRate) != null ? p : e.audio.bitRate, Is(e, this.currentCap) ? this.currentCap = v({}, e) : (this.currentCap = v({}, e), this.emitter.emit("constraint cap changed", e));
7947
7948
  });
7948
7949
  r(this, "enterPictureInPicture", (e) => {
7949
7950
  this.pictureInPictureSource = e, this.evaluateConstraintCap();
@@ -8074,7 +8075,7 @@ class ou {
8074
8075
  for (const h of i)
8075
8076
  switch (h.type) {
8076
8077
  case "audio": {
8077
- const { OpusDecoderContext: u } = yield import("./BLdnaIls.js");
8078
+ const { OpusDecoderContext: u } = yield import("./xMUHexhV.js");
8078
8079
  c.set(h.type, {
8079
8080
  buffer: [],
8080
8081
  decoderContext: yield u.create(48e3, 2),
@@ -8085,7 +8086,7 @@ class ou {
8085
8086
  break;
8086
8087
  }
8087
8088
  case "video": {
8088
- const { H264DecoderWorkerContext: u } = yield import("./CR970t1n.js");
8089
+ const { H264DecoderWorkerContext: u } = yield import("./BoVzlg5M.js");
8089
8090
  c.set(h.type, {
8090
8091
  buffer: [],
8091
8092
  decoderContext: yield u.create(o),
@@ -8167,7 +8168,7 @@ const VA = (s) => (e, t, i) => e.timestamp <= t || e.timestampAdded <= i - s, Kt
8167
8168
  this.timers.unload(), this.emitter.off("add event", this.addEvent);
8168
8169
  });
8169
8170
  r(this, "addEvent", (e) => {
8170
- this.logger.debug("Adding event", { event: e }), !this.waitingEvents.some((t) => typeof t.id != "undefined" && t.id === e.id) && this.waitingEvents.push(M(S({}, e), { timestampAdded: Date.now() }));
8171
+ this.logger.debug("Adding event", { event: e }), !this.waitingEvents.some((t) => typeof t.id != "undefined" && t.id === e.id) && this.waitingEvents.push(M(v({}, e), { timestampAdded: Date.now() }));
8171
8172
  });
8172
8173
  r(this, "extractEvent", (e, t) => {
8173
8174
  t.type === "video" && e.channelId !== t.channelId && this.addEvent({
@@ -8252,7 +8253,112 @@ const $e = class $e {
8252
8253
  };
8253
8254
  r($e, "NO_DATA_ERROR_TIMEOUT", 20 * 1e3), r($e, "NO_DATA_TIMEOUT", 5 * 1e3), r($e, "UPDATE_RECEIVED_BYTES_INTERVAL", 1e3), r($e, "create", (e) => new $e(e));
8254
8255
  let Gh = $e;
8255
- const GA = () => window.AudioContext || window.webkitAudioContext, yc = class yc extends Ei {
8256
+ const Hu = 1e3, Qu = 50;
8257
+ class cu {
8258
+ constructor(e) {
8259
+ r(this, "logger");
8260
+ r(this, "trackingState", /* @__PURE__ */ new Map());
8261
+ // Running jitter calculation (RFC 3550 style - exponential moving average with /16)
8262
+ r(this, "runningJitter", /* @__PURE__ */ new Map());
8263
+ // Recent jitter samples for spike detection
8264
+ r(this, "recentJitterSamples", /* @__PURE__ */ new Map());
8265
+ r(this, "load", () => {
8266
+ this.logger.debug("JitterModule loaded");
8267
+ });
8268
+ r(this, "unload", () => {
8269
+ this.trackingState.clear(), this.runningJitter.clear(), this.recentJitterSamples.clear(), this.logger.debug("JitterModule unloaded");
8270
+ });
8271
+ this.logger = e;
8272
+ }
8273
+ static create(e) {
8274
+ return new cu(e);
8275
+ }
8276
+ /**
8277
+ * Get a unique key for tracking per rendition
8278
+ */
8279
+ getTrackingKey(e, t) {
8280
+ return `${e}-${t}`;
8281
+ }
8282
+ /**
8283
+ * Record a sample arrival for jitter calculation.
8284
+ * Should be called when a sample/fragment is received.
8285
+ *
8286
+ * Jitter is calculated by comparing the expected inter-arrival time
8287
+ * (derived from media timestamps) with the actual inter-arrival time.
8288
+ */
8289
+ recordSample(e) {
8290
+ var w, b, S, I;
8291
+ const t = this.getTrackingKey(e.type, e.renditionId), i = (S = (b = (w = globalThis.performance) == null ? void 0 : w.now) == null ? void 0 : b.call(w)) != null ? S : Date.now(), n = e.timestamp / e.timescale * 1e3, o = this.trackingState.get(t);
8292
+ if (!o) {
8293
+ this.trackingState.set(t, {
8294
+ lastArrivalTime: i,
8295
+ lastTimestampMs: n,
8296
+ jitterSamples: new oe(Hu),
8297
+ interArrivalTimes: new oe(Hu)
8298
+ }), this.runningJitter.set(t, 0), this.recentJitterSamples.set(t, new oe(Qu));
8299
+ return;
8300
+ }
8301
+ const c = n - o.lastTimestampMs;
8302
+ if (c <= 0) {
8303
+ o.lastArrivalTime = i, o.lastTimestampMs = n;
8304
+ return;
8305
+ }
8306
+ const h = i - o.lastArrivalTime, u = Math.abs(h - c);
8307
+ o.jitterSamples.push(u), o.interArrivalTimes.push(h);
8308
+ const m = (I = this.runningJitter.get(t)) != null ? I : 0, p = m + (u - m) / 16;
8309
+ this.runningJitter.set(t, p);
8310
+ let g = this.recentJitterSamples.get(t);
8311
+ g || (g = new oe(Qu), this.recentJitterSamples.set(t, g)), g.push(u), o.lastArrivalTime = i, o.lastTimestampMs = n;
8312
+ }
8313
+ /**
8314
+ * Get jitter statistics for a specific media type.
8315
+ * Returns undefined if no data is available.
8316
+ * All jitter values are rounded to integer milliseconds for cleaner statistics aggregation.
8317
+ */
8318
+ getJitterForType(e) {
8319
+ var t, i, n;
8320
+ for (const [o, c] of this.trackingState)
8321
+ if (o.startsWith(e)) {
8322
+ if (c.jitterSamples.items().length < 1)
8323
+ return;
8324
+ const u = (t = this.runningJitter.get(o)) != null ? t : 0, m = (n = (i = this.recentJitterSamples.get(o)) == null ? void 0 : i.items()) != null ? n : [], { min: p, max: g, average: w } = ei(m);
8325
+ return {
8326
+ min: Math.round(p),
8327
+ max: Math.round(g),
8328
+ last: Math.round(w),
8329
+ average: Math.round(u)
8330
+ };
8331
+ }
8332
+ }
8333
+ /**
8334
+ * Get the current running jitter value
8335
+ */
8336
+ getRunningJitter(e) {
8337
+ for (const [t, i] of this.runningJitter)
8338
+ if (t.startsWith(e))
8339
+ return i;
8340
+ }
8341
+ /**
8342
+ * Reset jitter tracking for a specific rendition or all renditions.
8343
+ */
8344
+ reset(e, t) {
8345
+ if (e !== void 0 && t !== void 0) {
8346
+ const i = this.getTrackingKey(e, t);
8347
+ this.trackingState.delete(i), this.runningJitter.delete(i), this.recentJitterSamples.delete(i);
8348
+ } else if (e !== void 0)
8349
+ for (const i of this.trackingState.keys())
8350
+ i.startsWith(e) && (this.trackingState.delete(i), this.runningJitter.delete(i), this.recentJitterSamples.delete(i));
8351
+ else
8352
+ this.trackingState.clear(), this.runningJitter.clear(), this.recentJitterSamples.clear();
8353
+ }
8354
+ getStatistics() {
8355
+ return {
8356
+ audioJitter: this.getJitterForType("audio"),
8357
+ videoJitter: this.getJitterForType("video")
8358
+ };
8359
+ }
8360
+ }
8361
+ const GA = () => window.AudioContext || window.webkitAudioContext, yc = class yc extends Ti {
8256
8362
  constructor() {
8257
8363
  super();
8258
8364
  // TODO: Checkout what happens when limit is reached
@@ -8302,7 +8408,7 @@ const GA = () => window.AudioContext || window.webkitAudioContext, yc = class yc
8302
8408
  };
8303
8409
  r(yc, "CHECK_INTERVAL", 1e3);
8304
8410
  let jh = yc;
8305
- const Sc = class Sc extends Ei {
8411
+ const vc = class vc extends Ti {
8306
8412
  constructor(t, i, { muted: n, reInitWhenStuck: o }) {
8307
8413
  super();
8308
8414
  r(this, "logger");
@@ -8364,7 +8470,7 @@ const Sc = class Sc extends Ei {
8364
8470
  r(this, "onDecodedFrame", (t) => {
8365
8471
  if (!(this.gainNode && this.audio && this.audio.isRunning)) {
8366
8472
  if (t.type === "audio") {
8367
- this.preInitSampleQueue.push(M(S({}, t), { data: t.data.slice(0, t.data.length) }));
8473
+ this.preInitSampleQueue.push(M(v({}, t), { data: t.data.slice(0, t.data.length) }));
8368
8474
  const i = this.clockSource.currentTime;
8369
8475
  this.preInitSampleQueue.filterPop(({ timestamp: n, timescale: o }) => n / o * 1e3 > i);
8370
8476
  }
@@ -8470,8 +8576,8 @@ const Sc = class Sc extends Ei {
8470
8576
  return (n = this.gainNode) == null || n.connect(i), i;
8471
8577
  }
8472
8578
  };
8473
- r(Sc, "create", (t, i, n) => new Sc(t, i, n));
8474
- let No = Sc;
8579
+ r(vc, "create", (t, i, n) => new vc(t, i, n));
8580
+ let No = vc;
8475
8581
  var Qa, It, pe, ps, qe, ql, Ls, Zl;
8476
8582
  class jA {
8477
8583
  constructor() {
@@ -8559,7 +8665,7 @@ void main() {
8559
8665
  texture_coordinate = position;
8560
8666
  gl_Position = model * vec4(position, 0.0, 1.0);
8561
8667
  }
8562
- `, Hu = (s, e) => {
8668
+ `, Xu = (s, e) => {
8563
8669
  let t = s.getContext("webgl", e);
8564
8670
  if (t || (t = s.getContext("experimental-webgl", e)), !t)
8565
8671
  throw new x("Failed to create webgl context", {
@@ -8579,7 +8685,7 @@ void main() {
8579
8685
  });
8580
8686
  }
8581
8687
  return i;
8582
- }, Di = (s) => {
8688
+ }, Oi = (s) => {
8583
8689
  const e = s.createTexture();
8584
8690
  if (!e)
8585
8691
  throw new x("Failed to create texture", {
@@ -8587,7 +8693,7 @@ void main() {
8587
8693
  code: "failed_to_create_texture"
8588
8694
  });
8589
8695
  return s.bindTexture(s.TEXTURE_2D, e), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAG_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MIN_FILTER, s.NEAREST), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE), e;
8590
- }, Qu = (s, e) => {
8696
+ }, qu = (s, e) => {
8591
8697
  const t = s.createBuffer();
8592
8698
  if (!t)
8593
8699
  throw new x("Failed to create buffer", {
@@ -8611,16 +8717,16 @@ void main() {
8611
8717
  }
8612
8718
  return i;
8613
8719
  };
8614
- var vc, _, Xa, qa, Za, yi, Zn, Jl, $l, Ec;
8720
+ var Sc, _, Xa, qa, Za, vi, Jn, Jl, $l, Ec;
8615
8721
  class HA {
8616
8722
  constructor(e) {
8617
- d(this, Zn);
8618
- d(this, vc, 96);
8723
+ d(this, Jn);
8724
+ d(this, Sc, 96);
8619
8725
  d(this, _);
8620
8726
  d(this, Xa);
8621
8727
  d(this, qa);
8622
8728
  d(this, Za);
8623
- d(this, yi);
8729
+ d(this, vi);
8624
8730
  r(this, "subtitleRenderer", new jA());
8625
8731
  // biome-ignore format: special formatting
8626
8732
  d(this, Ec, (e, t, i, n) => [
@@ -8641,14 +8747,14 @@ class HA {
8641
8747
  0,
8642
8748
  1
8643
8749
  ]);
8644
- l(this, _, e), l(this, Xa, Di(e)), l(this, qa, Ds(e, e.FRAGMENT_SHADER, WA)), l(this, Za, Ds(e, e.VERTEX_SHADER, zA)), l(this, yi, Wh(e, a(this, Za), a(this, qa))), this.subtitleRenderer.config.fontSize = "64px";
8750
+ l(this, _, e), l(this, Xa, Oi(e)), l(this, qa, Ds(e, e.FRAGMENT_SHADER, WA)), l(this, Za, Ds(e, e.VERTEX_SHADER, zA)), l(this, vi, Wh(e, a(this, Za), a(this, qa))), this.subtitleRenderer.config.fontSize = "64px";
8645
8751
  }
8646
8752
  setActiveCues(e, t) {
8647
8753
  this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
8648
8754
  }
8649
8755
  render(e) {
8650
- const t = this.subtitleRenderer.canvas, i = (e.padding + a(this, vc)) * window.devicePixelRatio;
8651
- t.width !== 0 && (a(this, _).useProgram(a(this, yi)), A(this, Zn, Jl).call(this), A(this, Zn, $l).call(this, this.subtitleRenderer.canvas.width / e.width, this.subtitleRenderer.canvas.height / e.height, -this.subtitleRenderer.canvas.width / e.width / 2, -(1 - (this.subtitleRenderer.canvas.height + i) / e.height)), a(this, _).uniform1i(a(this, _).getUniformLocation(a(this, yi), "texture"), 4), a(this, _).activeTexture(a(this, _).TEXTURE4), a(this, _).bindTexture(a(this, _).TEXTURE_2D, a(this, Xa)), a(this, _).enable(a(this, _).BLEND), a(this, _).blendFunc(a(this, _).SRC_ALPHA, a(this, _).ONE_MINUS_SRC_ALPHA), a(this, _).texImage2D(
8756
+ const t = this.subtitleRenderer.canvas, i = (e.padding + a(this, Sc)) * window.devicePixelRatio;
8757
+ t.width !== 0 && (a(this, _).useProgram(a(this, vi)), A(this, Jn, Jl).call(this), A(this, Jn, $l).call(this, this.subtitleRenderer.canvas.width / e.width, this.subtitleRenderer.canvas.height / e.height, -this.subtitleRenderer.canvas.width / e.width / 2, -(1 - (this.subtitleRenderer.canvas.height + i) / e.height)), a(this, _).uniform1i(a(this, _).getUniformLocation(a(this, vi), "texture"), 4), a(this, _).activeTexture(a(this, _).TEXTURE4), a(this, _).bindTexture(a(this, _).TEXTURE_2D, a(this, Xa)), a(this, _).enable(a(this, _).BLEND), a(this, _).blendFunc(a(this, _).SRC_ALPHA, a(this, _).ONE_MINUS_SRC_ALPHA), a(this, _).texImage2D(
8652
8758
  a(this, _).TEXTURE_2D,
8653
8759
  0,
8654
8760
  a(this, _).RGBA,
@@ -8658,14 +8764,14 @@ class HA {
8658
8764
  ), a(this, _).texParameteri(a(this, _).TEXTURE_2D, a(this, _).TEXTURE_MAG_FILTER, a(this, _).LINEAR), a(this, _).drawArrays(a(this, _).TRIANGLE_STRIP, 0, 4));
8659
8765
  }
8660
8766
  }
8661
- vc = new WeakMap(), _ = new WeakMap(), Xa = new WeakMap(), qa = new WeakMap(), Za = new WeakMap(), yi = new WeakMap(), Zn = new WeakSet(), Jl = function() {
8662
- const e = a(this, _).getAttribLocation(a(this, yi), "position");
8767
+ Sc = new WeakMap(), _ = new WeakMap(), Xa = new WeakMap(), qa = new WeakMap(), Za = new WeakMap(), vi = new WeakMap(), Jn = new WeakSet(), Jl = function() {
8768
+ const e = a(this, _).getAttribLocation(a(this, vi), "position");
8663
8769
  a(this, _).enableVertexAttribArray(e), a(this, _).vertexAttribPointer(e, 2, a(this, _).FLOAT, !1, 0, 0);
8664
8770
  }, $l = function(e, t, i, n) {
8665
- const o = a(this, _).getUniformLocation(a(this, yi), "model");
8771
+ const o = a(this, _).getUniformLocation(a(this, vi), "model");
8666
8772
  a(this, _).uniformMatrix4fv(o, !1, a(this, Ec).call(this, e, t, i, n));
8667
8773
  }, Ec = new WeakMap();
8668
- const Xu = `
8774
+ const Zu = `
8669
8775
  precision mediump float;
8670
8776
  uniform sampler2D y_texture;
8671
8777
  uniform sampler2D u_texture;
@@ -8681,7 +8787,7 @@ void main() {
8681
8787
 
8682
8788
  gl_FragColor = vec4(y, u, v, 1) * conversion;
8683
8789
  }
8684
- `, qu = `
8790
+ `, Ju = `
8685
8791
  attribute vec2 position;
8686
8792
  varying vec2 texture_coordinate;
8687
8793
  uniform mat4 model;
@@ -8690,49 +8796,49 @@ void main() {
8690
8796
  texture_coordinate = position;
8691
8797
  gl_Position = model * vec4(position, 0.0, 1.0);
8692
8798
  }
8693
- `, Zu = {
8799
+ `, $u = {
8694
8800
  width: 256,
8695
8801
  codedWidth: 256,
8696
8802
  height: 144,
8697
8803
  codedHeight: 144
8698
- }, Ju = {
8804
+ }, Yu = {
8699
8805
  preserveDrawingBuffer: !1,
8700
8806
  alpha: !1,
8701
8807
  depth: !1,
8702
8808
  stencil: !1,
8703
8809
  antialias: !1,
8704
8810
  premultipliedAlpha: !1
8705
- }, Br = class Br extends Ei {
8811
+ }, Rr = class Rr extends Ti {
8706
8812
  constructor() {
8707
8813
  super();
8708
8814
  r(this, "canvas", document.createElement("canvas"));
8709
- r(this, "context", Hu(this.canvas, Ju));
8710
- r(this, "pixelShader", Ds(this.context, this.context.FRAGMENT_SHADER, Xu));
8711
- r(this, "vertexShader", Ds(this.context, this.context.VERTEX_SHADER, qu));
8712
- r(this, "buffer", Qu(this.context, Br.SQUARE_VERTICES));
8815
+ r(this, "context", Xu(this.canvas, Yu));
8816
+ r(this, "pixelShader", Ds(this.context, this.context.FRAGMENT_SHADER, Zu));
8817
+ r(this, "vertexShader", Ds(this.context, this.context.VERTEX_SHADER, Ju));
8818
+ r(this, "buffer", qu(this.context, Rr.SQUARE_VERTICES));
8713
8819
  r(this, "program", Wh(this.context, this.vertexShader, this.pixelShader));
8714
8820
  r(this, "textures", {
8715
- y: Di(this.context),
8716
- u: Di(this.context),
8717
- v: Di(this.context)
8821
+ y: Oi(this.context),
8822
+ u: Oi(this.context),
8823
+ v: Oi(this.context)
8718
8824
  });
8719
8825
  // Lazy loaded when needed
8720
8826
  r(this, "textRenderer");
8721
- r(this, "size", Zu);
8827
+ r(this, "size", $u);
8722
8828
  r(this, "onContextLost", (t) => {
8723
8829
  this.textRenderer = void 0;
8724
8830
  const i = new Error(t instanceof WebGLContextEvent ? t.statusMessage : "webgl context lost");
8725
8831
  this.emit("context lost", cf(i)), t.preventDefault();
8726
8832
  });
8727
8833
  r(this, "onContextRestored", () => {
8728
- this.emit("context restored"), this.context = Hu(this.canvas, Ju), this.pixelShader = Ds(this.context, this.context.FRAGMENT_SHADER, Xu), this.vertexShader = Ds(this.context, this.context.VERTEX_SHADER, qu), this.buffer = Qu(this.context, Br.SQUARE_VERTICES), this.program = Wh(this.context, this.vertexShader, this.pixelShader), this.textures = {
8729
- y: Di(this.context),
8730
- u: Di(this.context),
8731
- v: Di(this.context)
8834
+ this.emit("context restored"), this.context = Xu(this.canvas, Yu), this.pixelShader = Ds(this.context, this.context.FRAGMENT_SHADER, Zu), this.vertexShader = Ds(this.context, this.context.VERTEX_SHADER, Ju), this.buffer = qu(this.context, Rr.SQUARE_VERTICES), this.program = Wh(this.context, this.vertexShader, this.pixelShader), this.textures = {
8835
+ y: Oi(this.context),
8836
+ u: Oi(this.context),
8837
+ v: Oi(this.context)
8732
8838
  }, this.load();
8733
8839
  });
8734
8840
  r(this, "load", () => {
8735
- this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize(Zu), this.context.uniform1i(this.context.getUniformLocation(this.program, "y_texture"), 0), this.context.uniform1i(this.context.getUniformLocation(this.program, "u_texture"), 1), this.context.uniform1i(this.context.getUniformLocation(this.program, "v_texture"), 2), this.setConversionMatrix(this.rec709());
8841
+ this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize($u), this.context.uniform1i(this.context.getUniformLocation(this.program, "y_texture"), 0), this.context.uniform1i(this.context.getUniformLocation(this.program, "u_texture"), 1), this.context.uniform1i(this.context.getUniformLocation(this.program, "v_texture"), 2), this.setConversionMatrix(this.rec709());
8736
8842
  });
8737
8843
  r(this, "unload", () => {
8738
8844
  var i;
@@ -8841,8 +8947,8 @@ void main() {
8841
8947
  return this.textRenderer || (this.textRenderer = new HA(this.context)), this.textRenderer;
8842
8948
  }
8843
8949
  };
8844
- r(Br, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
8845
- let zh = Br;
8950
+ r(Rr, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
8951
+ let zh = Rr;
8846
8952
  const Tc = class Tc {
8847
8953
  constructor(e, t, i, n) {
8848
8954
  r(this, "oldTimestampLimit", 400);
@@ -8949,7 +9055,7 @@ class Yl {
8949
9055
  }
8950
9056
  }
8951
9057
  Si = new WeakMap();
8952
- const Ri = (s, e) => {
9058
+ const Ui = (s, e) => {
8953
9059
  let t;
8954
9060
  for (t = e; s > 1; s--) t += e;
8955
9061
  return t;
@@ -8962,13 +9068,13 @@ class QA {
8962
9068
  e.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
8963
9069
  const t = e.children.item(0);
8964
9070
  if (t instanceof HTMLAudioElement)
8965
- this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Ri(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Ri(16, "gICA") + Ri(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Ri(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Ri(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Ri(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Ri(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
9071
+ this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Ui(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Ui(16, "gICA") + Ui(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Ui(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Ui(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Ui(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Ui(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
8966
9072
  else
8967
9073
  throw new Error("Failed to create audio tag");
8968
9074
  }
8969
9075
  }
8970
9076
  const Ic = class Ic {
8971
- constructor(e, t, i, n, o) {
9077
+ constructor(e, t, i, n, o, c) {
8972
9078
  r(this, "logger");
8973
9079
  r(this, "emitter");
8974
9080
  r(this, "audioPlayer");
@@ -9019,7 +9125,7 @@ const Ic = class Ic {
9019
9125
  this.logger = t, this.emitter = e, this.pool = i, this.audioPlayer = No.create(this.logger.createContext("AudioPlayerModule"), n, {
9020
9126
  muted: o,
9021
9127
  reInitWhenStuck: !0
9022
- }), this.audioPlayer.on("stuck", () => {
9128
+ }), c !== void 0 && (this.audioPlayer.volume = c), this.audioPlayer.on("stuck", () => {
9023
9129
  this.isDisconnected = !0;
9024
9130
  }), this.audioPlayer.on("state change", () => {
9025
9131
  this.emitter.emit("volume state", {
@@ -9079,10 +9185,10 @@ const Ic = class Ic {
9079
9185
  this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
9080
9186
  }
9081
9187
  };
9082
- r(Ic, "create", (e, t, i, n, o) => new Ic(e, t, i, n, o));
9188
+ r(Ic, "create", (e, t, i, n, o, c) => new Ic(e, t, i, n, o, c));
9083
9189
  let Hh = Ic;
9084
9190
  const Cc = class Cc {
9085
- constructor(e, t, i, n, { muted: o, type: c, poster: h }) {
9191
+ constructor(e, t, i, n, { muted: o, volume: c, type: h, poster: u }) {
9086
9192
  r(this, "logger");
9087
9193
  r(this, "emitter");
9088
9194
  r(this, "mediaElement");
@@ -9151,23 +9257,24 @@ const Cc = class Cc {
9151
9257
  Is(e, this.volumeState) || (this.volumeState = e, this.emitter.emit("volume state", this.volumeState));
9152
9258
  });
9153
9259
  this.logger = t, this.emitter = e, this.pool = i, this._userProvidedMuted = o, this.mediaElement = new ph({
9154
- poster: h,
9155
- type: c,
9260
+ poster: u,
9261
+ type: h,
9156
9262
  muted: o,
9263
+ volume: c,
9157
9264
  autoplay: !1,
9158
9265
  logger: this.logger.createContext("MediaElement")
9159
- }), this.mediaElement.on("volume state", (u) => {
9160
- this.updateVolumeState(), !u.isMuted && !this.audioPlayer.isContextRunning && this.activateAudioPlayer().catch(O), u.isMuted || (this._userProvidedMuted = !1);
9161
- }), this.mediaElement.on("media element state", (u) => {
9162
- u === "paused" && this.audioPlayer.flushBuffer(), this.emitter.emit("media element state", u);
9266
+ }), this.mediaElement.on("volume state", (m) => {
9267
+ this.updateVolumeState(), !m.isMuted && !this.audioPlayer.isContextRunning && this.activateAudioPlayer().catch(O), m.isMuted || (this._userProvidedMuted = !1);
9268
+ }), this.mediaElement.on("media element state", (m) => {
9269
+ m === "paused" && this.audioPlayer.flushBuffer(), this.emitter.emit("media element state", m);
9163
9270
  }), this.audioPlayer = No.create(this.logger.createContext("AudioPlayerModule"), n, {
9164
9271
  muted: !1,
9165
9272
  // Never muted because its the media element that limits audio output,
9166
9273
  reInitWhenStuck: !1
9167
9274
  }), this.audioPlayer.on("stuck", () => {
9168
9275
  this.isDisconnected = !0;
9169
- }), this.audioPlayer.on("state change", (u) => {
9170
- u === "suspended" || u === "interrupted" ? this.mediaElement.muted = !0 : u === "running" && (this.mediaElement.muted = this._userProvidedMuted || document.visibilityState === "hidden"), this.updateVolumeState();
9276
+ }), this.audioPlayer.on("state change", (m) => {
9277
+ m === "suspended" || m === "interrupted" ? this.mediaElement.muted = !0 : m === "running" && (this.mediaElement.muted = this._userProvidedMuted || document.visibilityState === "hidden"), this.updateVolumeState();
9171
9278
  }), this.videoPlayer = Vo.create(
9172
9279
  this.logger.createContext("VideoPlayerModule"),
9173
9280
  this.audioPlayer,
@@ -9227,7 +9334,7 @@ const Cc = class Cc {
9227
9334
  };
9228
9335
  r(Cc, "create", (e, t, i, n, o) => new Cc(e, t, i, n, o));
9229
9336
  let Qh = Cc;
9230
- const XA = () => (s) => Kl(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), Kl = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), $u = (s) => (e) => e.appendBuffer(s), qA = (s) => (e) => e.changeType(s), ZA = (s) => (e) => s(e);
9337
+ const XA = () => (s) => Kl(s.buffered.start(0), s.buffered.end(s.buffered.length - 1)), Kl = (s, e) => (t) => t.remove(Math.max(0, s), Math.min(Number.POSITIVE_INFINITY, e)), Ku = (s) => (e) => e.appendBuffer(s), qA = (s) => (e) => e.changeType(s), ZA = (s) => (e) => s(e);
9231
9338
  class JA {
9232
9339
  constructor(e) {
9233
9340
  r(this, "commandQueue", []);
@@ -9239,10 +9346,10 @@ class JA {
9239
9346
  });
9240
9347
  r(this, "appendBuffer", (e, t) => new Promise((i, n) => {
9241
9348
  if (t && this.currentInit !== t) {
9242
- const c = new Cs($u(t), i, n);
9349
+ const c = new Cs(Ku(t), i, n);
9243
9350
  this.commandQueue.push(c), this.currentInit = t;
9244
9351
  }
9245
- const o = new Cs($u(e), i, n);
9352
+ const o = new Cs(Ku(e), i, n);
9246
9353
  this.commandQueue.push(o), this.handleQueue();
9247
9354
  }));
9248
9355
  r(this, "execute", (e) => new Promise((t, i) => {
@@ -9268,10 +9375,10 @@ class JA {
9268
9375
  this.sourceBuffer = e, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
9269
9376
  }
9270
9377
  }
9271
- class em extends Ei {
9378
+ class em extends Ti {
9272
9379
  constructor() {
9273
9380
  super();
9274
- r(this, "MediaSource", Rr());
9381
+ r(this, "MediaSource", Zn());
9275
9382
  r(this, "mediaSource", new this.MediaSource());
9276
9383
  r(this, "isOpen", () => this.mediaSource.readyState === "open");
9277
9384
  r(this, "isClosed", () => this.mediaSource.readyState === "closed");
@@ -9328,7 +9435,7 @@ class em extends Ei {
9328
9435
  }
9329
9436
  r(em, "isTypeSupported", (t) => {
9330
9437
  var i, n;
9331
- return (n = (i = Rr()) == null ? void 0 : i.isTypeSupported(t)) != null ? n : !1;
9438
+ return (n = (i = Zn()) == null ? void 0 : i.isTypeSupported(t)) != null ? n : !1;
9332
9439
  });
9333
9440
  class tm {
9334
9441
  constructor() {
@@ -9345,7 +9452,7 @@ class tm {
9345
9452
  }
9346
9453
  }
9347
9454
  function $A(s, { mediaSource: e, mimeType: t, codec: i }) {
9348
- return M(S({}, s), {
9455
+ return M(v({}, s), {
9349
9456
  state: "initialized",
9350
9457
  mimeType: t,
9351
9458
  codec: i,
@@ -9355,7 +9462,7 @@ function $A(s, { mediaSource: e, mimeType: t, codec: i }) {
9355
9462
  lastBufferCleanupTime: Date.now()
9356
9463
  });
9357
9464
  }
9358
- function Yu({
9465
+ function ed({
9359
9466
  initSegments: s,
9360
9467
  pendingSamples: e
9361
9468
  }) {
@@ -9421,7 +9528,7 @@ const kc = class kc {
9421
9528
  const n = (h = (c = e.get(i)) == null ? void 0 : c.pendingSamples) != null ? h : [], o = (u = e.get(i)) == null ? void 0 : u.initSegments;
9422
9529
  for (; n.length > 0 && !((m = n[0]) != null && m.isSync); )
9423
9530
  n.shift();
9424
- this.trackContexts.set(i, Yu({ pendingSamples: n, initSegments: o }));
9531
+ this.trackContexts.set(i, ed({ pendingSamples: n, initSegments: o }));
9425
9532
  });
9426
9533
  });
9427
9534
  r(this, "setSourceBuffers", (e) => f(this, null, function* () {
@@ -9443,7 +9550,7 @@ const kc = class kc {
9443
9550
  }
9444
9551
  for (const i of e) {
9445
9552
  let n = this.trackContexts.get(i.type);
9446
- n || (n = Yu({ pendingSamples: [], initSegments: new tm() }), this.trackContexts.set(i.type, n)), n.state === "initialized" ? i.mimeType !== n.mimeType && (yield n.sourceBuffer.changeType(i.mimeType)) : this.trackContexts.set(
9553
+ n || (n = ed({ pendingSamples: [], initSegments: new tm() }), this.trackContexts.set(i.type, n)), n.state === "initialized" ? i.mimeType !== n.mimeType && (yield n.sourceBuffer.changeType(i.mimeType)) : this.trackContexts.set(
9447
9554
  i.type,
9448
9555
  $A(n, {
9449
9556
  mimeType: i.mimeType,
@@ -9541,10 +9648,10 @@ const kc = class kc {
9541
9648
  this.logger.warn("Skipping fragment with no codec");
9542
9649
  return;
9543
9650
  }
9544
- const v = this.trackContexts.get(c);
9545
- if (!v)
9651
+ const S = this.trackContexts.get(c);
9652
+ if (!S)
9546
9653
  throw Ya(c);
9547
- v.state === "initialized" && t && (v.mimeType = t, v.initSegments.set(n, o, u));
9654
+ S.state === "initialized" && t && (S.mimeType = t, S.initSegments.set(n, o, u));
9548
9655
  const I = {
9549
9656
  fragmented: !0,
9550
9657
  type: c,
@@ -9571,7 +9678,7 @@ const kc = class kc {
9571
9678
  if (!(!t.hasFirstSync && !e.isSync)) {
9572
9679
  if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
9573
9680
  this.hasAddedInitialPosterFrame = !1;
9574
- const i = S({}, e);
9681
+ const i = v({}, e);
9575
9682
  "fragment" in i ? (i.fragment = i.fragment.clone(), i.fragment.updateBaseMediaDecodeTime(0), i.data = i.fragment.rawBytes()) : i.timestamp = 0, t.pendingSamples.push(i);
9576
9683
  }
9577
9684
  t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || YA(t, this.append, this.maxChunkSize).catch((i) => {
@@ -9615,7 +9722,7 @@ r(kc, "create", (e, t, i) => {
9615
9722
  return n.setTrackContexts(), n.mediaSource.on("source ended", n.onSourceEnded), n.mediaSource.on("source open", n.onSourceOpen), n.mediaSource.attach(i), n;
9616
9723
  });
9617
9724
  let Xh = kc;
9618
- const Ku = (s, e) => {
9725
+ const td = (s, e) => {
9619
9726
  var h;
9620
9727
  const t = s.renditionId !== e.renditionId, i = s.channelId !== e.channelId, n = ((h = s.timestamp) != null ? h : 0) > e.timestamp, o = s.type === "video" && e.type === "video" && "levelIdc" in s && "levelIdc" in e && s.levelIdc !== e.levelIdc;
9621
9728
  let c = !1;
@@ -9628,7 +9735,7 @@ const Ku = (s, e) => {
9628
9735
  n = h;
9629
9736
  const u = s.pendingSamples[h], m = s.pendingSamples[h + 1];
9630
9737
  if (u && (i.push(u), m)) {
9631
- if (Ku(u, m))
9738
+ if (td(u, m))
9632
9739
  break;
9633
9740
  const p = (u.timestamp + u.duration) / u.timescale;
9634
9741
  if (m.timestamp / m.timescale - p > 0.1)
@@ -9640,7 +9747,7 @@ const Ku = (s, e) => {
9640
9747
  const o = i[0];
9641
9748
  if (!o)
9642
9749
  break;
9643
- const c = s.previousSample ? Ku(s.previousSample, o) : !0;
9750
+ const c = s.previousSample ? td(s.previousSample, o) : !0;
9644
9751
  yield e(i, c), s.pendingSamples = s.pendingSamples.slice(n + 1), s.previousSample = i[i.length - 1];
9645
9752
  }
9646
9753
  s.isWorkingOnPendingSamples = !1;
@@ -9823,8 +9930,8 @@ const Jh = () => ({
9823
9930
  const t = this.timeSpentBuffering(), i = this.timeActive(), n = this.bufferingRatios(), o = this.activeRatios(), c = ((m = (u = e.video) == null ? void 0 : u.bitRate) != null ? m : 0) + ((g = (p = e.audio) == null ? void 0 : p.bitRate) != null ? g : 0), h = t / i;
9824
9931
  return Object.keys(this.metrics.levels).map((w) => parseInt(w, 10)).filter((w) => w >= c).reduce((w, b) => {
9825
9932
  var I, k;
9826
- const v = this.getQualityIndex(b).toString();
9827
- return ((I = o.get(v)) != null ? I : 0) - ((k = n.get(v)) != null ? k : 0) * h + w;
9933
+ const S = this.getQualityIndex(b).toString();
9934
+ return ((I = o.get(S)) != null ? I : 0) - ((k = n.get(S)) != null ? k : 0) * h + w;
9828
9935
  }, 0);
9829
9936
  });
9830
9937
  r(this, "timeSpentBuffering", () => Bs(this.metrics.general.bufferingRanges));
@@ -9836,15 +9943,15 @@ const Jh = () => ({
9836
9943
  fatalQosCount: this.fatalQosCount
9837
9944
  }));
9838
9945
  r(this, "onRenditionLevelChanged", (e) => {
9839
- var o, c, h, u, m, p, g, w, b, v, I, k, D, T;
9840
- const t = ((h = (c = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : c.bitRate) != null ? h : 0) + ((p = (m = (u = e.from) == null ? void 0 : u.audio) == null ? void 0 : m.bitRate) != null ? p : 0), i = ((b = (w = (g = e.to) == null ? void 0 : g.video) == null ? void 0 : w.bitRate) != null ? b : 0) + ((k = (I = (v = e.to) == null ? void 0 : v.audio) == null ? void 0 : I.bitRate) != null ? k : 0);
9946
+ var o, c, h, u, m, p, g, w, b, S, I, k, L, T;
9947
+ const t = ((h = (c = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : c.bitRate) != null ? h : 0) + ((p = (m = (u = e.from) == null ? void 0 : u.audio) == null ? void 0 : m.bitRate) != null ? p : 0), i = ((b = (w = (g = e.to) == null ? void 0 : g.video) == null ? void 0 : w.bitRate) != null ? b : 0) + ((k = (I = (S = e.to) == null ? void 0 : S.audio) == null ? void 0 : I.bitRate) != null ? k : 0);
9841
9948
  this.logger.info("rendition level changed", { fromLevel: t, toLevel: i }), this.metrics.general.activeRanges.length === 0 && this.setActive(), e.from && e.to && (t < i ? this.metrics.general.upgradesFromLevel.push(Date.now()) : this.metrics.general.downgradesFromLevel.push(Date.now()));
9842
9949
  let n = !1;
9843
9950
  if (e.from) {
9844
- const P = (D = this.metrics.levels[t]) != null ? D : Jh();
9845
- t < i ? P.upgradesFromLevel.push(Date.now()) : P.downgradesFromLevel.push(Date.now()), Ui(P.activeRanges);
9951
+ const P = (L = this.metrics.levels[t]) != null ? L : Jh();
9952
+ t < i ? P.upgradesFromLevel.push(Date.now()) : P.downgradesFromLevel.push(Date.now()), Pi(P.activeRanges);
9846
9953
  const R = P.bufferingRanges[P.bufferingRanges.length - 1];
9847
- n = !!R && !R.end, Ui(P.bufferingRanges), this.metrics.levels[t] = P;
9954
+ n = !!R && !R.end, Pi(P.bufferingRanges), this.metrics.levels[t] = P;
9848
9955
  }
9849
9956
  if (e.to) {
9850
9957
  const P = (T = this.metrics.levels[i]) != null ? T : Jh();
@@ -9883,9 +9990,9 @@ const Jh = () => ({
9883
9990
  r(this, "stopBuffering", () => {
9884
9991
  if (this.currentLevel) {
9885
9992
  const e = this.metrics.levels[this.currentLevel];
9886
- e && Ui(e.bufferingRanges);
9993
+ e && Pi(e.bufferingRanges);
9887
9994
  }
9888
- Ui(this.metrics.general.bufferingRanges);
9995
+ Pi(this.metrics.general.bufferingRanges);
9889
9996
  });
9890
9997
  r(this, "startBuffering", () => {
9891
9998
  if (this.currentLevel) {
@@ -9897,9 +10004,9 @@ const Jh = () => ({
9897
10004
  r(this, "unsetActive", () => {
9898
10005
  if (this.currentLevel) {
9899
10006
  const e = this.metrics.levels[this.currentLevel];
9900
- e && Ui(e.activeRanges);
10007
+ e && Pi(e.activeRanges);
9901
10008
  }
9902
- Ui(this.metrics.general.activeRanges);
10009
+ Pi(this.metrics.general.activeRanges);
9903
10010
  });
9904
10011
  r(this, "getQualityIndex", (e) => {
9905
10012
  var i, n;
@@ -10029,7 +10136,7 @@ const Pc = class Pc {
10029
10136
  };
10030
10137
  r(Pc, "create", (e, t) => new Pc(e, t));
10031
10138
  let Yh = Pc;
10032
- const er = (s) => JSON.parse(JSON.stringify(s)), ew = 1e4, xc = class xc {
10139
+ const tr = (s) => JSON.parse(JSON.stringify(s)), ew = 1e4, xc = class xc {
10033
10140
  constructor(e, t, i) {
10034
10141
  r(this, "logger");
10035
10142
  r(this, "timers", new Ae());
@@ -10083,13 +10190,13 @@ const er = (s) => JSON.parse(JSON.stringify(s)), ew = 1e4, xc = class xc {
10083
10190
  return !Is(Tu(this.currentSubscription, e), Tu(this.targetSubscription, e));
10084
10191
  });
10085
10192
  r(this, "onSubscriptionChanged", ({ to: e, reset: t }) => {
10086
- this.logger.debug("onSubscriptionChanged", { to: e, reset: t }), t ? this.targetSubscription = er(this.currentSubscription) : this.currentSubscription = er(e), this._isSwitchingSubscription = this.isNewSubscription();
10193
+ this.logger.debug("onSubscriptionChanged", { to: e, reset: t }), t ? this.targetSubscription = tr(this.currentSubscription) : this.currentSubscription = tr(e), this._isSwitchingSubscription = this.isNewSubscription();
10087
10194
  });
10088
10195
  r(this, "scheduleSubscriptionChange", () => {
10089
- this.targetSubscription = er(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
10196
+ this.targetSubscription = tr(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
10090
10197
  const e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, i = e !== t;
10091
10198
  this._isSwitchingSubscription && (i && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), i && this.timers.setTimeout(() => {
10092
- this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = er(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
10199
+ this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = tr(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
10093
10200
  }, ew), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
10094
10201
  () => this.emitter.emit("send signal", {
10095
10202
  type: "subscribe",
@@ -10098,12 +10205,12 @@ const er = (s) => JSON.parse(JSON.stringify(s)), ew = 1e4, xc = class xc {
10098
10205
  0
10099
10206
  ));
10100
10207
  });
10101
- this.logger = e, this.targetSubscription = t, this.currentSubscription = er(t), this.emitter = i, this.emitter.on("subscription changed", this.onSubscriptionChanged);
10208
+ this.logger = e, this.targetSubscription = t, this.currentSubscription = tr(t), this.emitter = i, this.emitter.on("subscription changed", this.onSubscriptionChanged);
10102
10209
  }
10103
10210
  };
10104
10211
  r(xc, "create", (e, t, i) => new xc(e, i, t));
10105
10212
  let Kh = xc;
10106
- const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id = (s) => (e) => e > s, Lc = class Lc {
10213
+ const id = 5e3, tw = () => Id() || Fc() || Sm(), sd = () => tw() ? 100 : 0, nd = (s) => (e) => e > s, Lc = class Lc {
10107
10214
  constructor(e, t, i, n, o) {
10108
10215
  r(this, "emitter");
10109
10216
  r(this, "logger");
@@ -10135,8 +10242,8 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10135
10242
  maxBehind: 50,
10136
10243
  multiplier: 1,
10137
10244
  maxBehindAllowed: 600,
10138
- overshoot: td(),
10139
- minOvershootAllowed: td(),
10245
+ overshoot: sd(),
10246
+ minOvershootAllowed: sd(),
10140
10247
  maxOvershootAllowed: 500
10141
10248
  });
10142
10249
  /**
@@ -10232,7 +10339,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10232
10339
  var n;
10233
10340
  if (!e.channelId)
10234
10341
  throw new Error("Sample must be assigned to a channel");
10235
- this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - ed);
10342
+ this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - id);
10236
10343
  const t = e.type === "video" && e.isSync;
10237
10344
  if (this.currentChannelId !== e.channelId) {
10238
10345
  let o = Number.MAX_SAFE_INTEGER;
@@ -10255,7 +10362,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10255
10362
  const i = t.mediaType();
10256
10363
  if (!i)
10257
10364
  throw new Error("Fragment must have a media type");
10258
- this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - ed);
10365
+ this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - id);
10259
10366
  const n = t.mediaType() === "video" && t.startsWithKeyframe();
10260
10367
  this.currentChannelId !== e ? (console.assert(this.highestSeenTimestamps.size !== 0, "no known timestamps"), this.highestSeenTimestamps.forEach((h) => {
10261
10368
  }), this.currentChannelId = e) : (n || this.timeshiftOnAudio) && this.tryTimeshiftSync();
@@ -10301,7 +10408,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10301
10408
  }
10302
10409
  if (!this.timestampOffset)
10303
10410
  return;
10304
- const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, i = this.timeShiftAdjustments.filter(id(t)).length;
10411
+ const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, i = this.timeShiftAdjustments.filter(nd(t)).length;
10305
10412
  if (i && this.timeshiftSync.multiplier > 2)
10306
10413
  return this.logger.debug("Too many diff timeShifts within sliding window", {
10307
10414
  timeShiftsCooldownMs: t,
@@ -10329,7 +10436,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10329
10436
  const e = (h = this.drift) != null ? h : 0;
10330
10437
  if (e < 0 && -e < this.currentSyncMaxAhead() || e > 0 && e < this.currentSyncMaxBehind() || Math.abs(e) < 1 || !this.isSeekCooldownExpired())
10331
10438
  return;
10332
- const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, i = this.driftAdjustments.filter(id(t)).length;
10439
+ const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, i = this.driftAdjustments.filter(nd(t)).length;
10333
10440
  if (i && this.syncMaxBehindMultiplier > 2)
10334
10441
  return this.logger.debug("Too many diff adjustments within sliding window", {
10335
10442
  adjustmentsCooldownMs: t,
@@ -10363,7 +10470,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10363
10470
  if (this.isSuspended)
10364
10471
  return;
10365
10472
  if (!n || !o) {
10366
- this.logger.info("Initial timing info", { syncInfo: t }), this.channelSyncInfo.set(e, M(S({}, t), { localTimestamp: i, timeDifferences: new oe(12) }));
10473
+ this.logger.info("Initial timing info", { syncInfo: t }), this.channelSyncInfo.set(e, M(v({}, t), { localTimestamp: i, timeDifferences: new oe(12) }));
10367
10474
  return;
10368
10475
  }
10369
10476
  const c = t.wallclockTime - n.wallclockTime, h = t.timestamp - n.timestamp, u = i - n.localTimestamp, m = h - u;
@@ -10377,7 +10484,7 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10377
10484
  wallclockDelta: c,
10378
10485
  localWallclockDelta: u
10379
10486
  }), Math.abs(m) >= this.bufferSource.getTargetBufferTime() * 2) {
10380
- this.logger.info("Resetting sync info", { diffFromEstimated: m }), this.channelSyncInfo.set(e, M(S({}, t), {
10487
+ this.logger.info("Resetting sync info", { diffFromEstimated: m }), this.channelSyncInfo.set(e, M(v({}, t), {
10381
10488
  localTimestamp: i,
10382
10489
  timeDifferences: new oe(n.timeDifferences.maxSize + 1)
10383
10490
  })), this.currentChannelId && this.currentChannelId === e && (this.reset(), this.emitter.emit("channel reset"));
@@ -10414,111 +10521,6 @@ const ed = 5e3, tw = () => Id() || Fc() || vm(), td = () => tw() ? 100 : 0, id =
10414
10521
  };
10415
10522
  r(Lc, "create", (e, t, i, n, o) => new Lc(e, t, i, n, o));
10416
10523
  let eu = Lc;
10417
- const sd = 1e3, nd = 50;
10418
- class cu {
10419
- constructor(e) {
10420
- r(this, "logger");
10421
- r(this, "trackingState", /* @__PURE__ */ new Map());
10422
- // Running jitter calculation (RFC 3550 style - exponential moving average with /16)
10423
- r(this, "runningJitter", /* @__PURE__ */ new Map());
10424
- // Recent jitter samples for spike detection
10425
- r(this, "recentJitterSamples", /* @__PURE__ */ new Map());
10426
- r(this, "load", () => {
10427
- this.logger.debug("JitterModule loaded");
10428
- });
10429
- r(this, "unload", () => {
10430
- this.trackingState.clear(), this.runningJitter.clear(), this.recentJitterSamples.clear(), this.logger.debug("JitterModule unloaded");
10431
- });
10432
- this.logger = e;
10433
- }
10434
- static create(e) {
10435
- return new cu(e);
10436
- }
10437
- /**
10438
- * Get a unique key for tracking per rendition
10439
- */
10440
- getTrackingKey(e, t) {
10441
- return `${e}-${t}`;
10442
- }
10443
- /**
10444
- * Record a sample arrival for jitter calculation.
10445
- * Should be called when a sample/fragment is received.
10446
- *
10447
- * Jitter is calculated by comparing the expected inter-arrival time
10448
- * (derived from media timestamps) with the actual inter-arrival time.
10449
- */
10450
- recordSample(e) {
10451
- var w, b, v, I;
10452
- const t = this.getTrackingKey(e.type, e.renditionId), i = (v = (b = (w = globalThis.performance) == null ? void 0 : w.now) == null ? void 0 : b.call(w)) != null ? v : Date.now(), n = e.timestamp / e.timescale * 1e3, o = this.trackingState.get(t);
10453
- if (!o) {
10454
- this.trackingState.set(t, {
10455
- lastArrivalTime: i,
10456
- lastTimestampMs: n,
10457
- jitterSamples: new oe(sd),
10458
- interArrivalTimes: new oe(sd)
10459
- }), this.runningJitter.set(t, 0), this.recentJitterSamples.set(t, new oe(nd));
10460
- return;
10461
- }
10462
- const c = n - o.lastTimestampMs;
10463
- if (c <= 0) {
10464
- o.lastArrivalTime = i, o.lastTimestampMs = n;
10465
- return;
10466
- }
10467
- const h = i - o.lastArrivalTime, u = Math.abs(h - c);
10468
- o.jitterSamples.push(u), o.interArrivalTimes.push(h);
10469
- const m = (I = this.runningJitter.get(t)) != null ? I : 0, p = m + (u - m) / 16;
10470
- this.runningJitter.set(t, p);
10471
- let g = this.recentJitterSamples.get(t);
10472
- g || (g = new oe(nd), this.recentJitterSamples.set(t, g)), g.push(u), o.lastArrivalTime = i, o.lastTimestampMs = n;
10473
- }
10474
- /**
10475
- * Get jitter statistics for a specific media type.
10476
- * Returns undefined if no data is available.
10477
- * All jitter values are rounded to integer milliseconds for cleaner statistics aggregation.
10478
- */
10479
- getJitterForType(e) {
10480
- var t, i, n;
10481
- for (const [o, c] of this.trackingState)
10482
- if (o.startsWith(e)) {
10483
- if (c.jitterSamples.items().length < 1)
10484
- return;
10485
- const u = (t = this.runningJitter.get(o)) != null ? t : 0, m = (n = (i = this.recentJitterSamples.get(o)) == null ? void 0 : i.items()) != null ? n : [], { min: p, max: g, average: w } = ei(m);
10486
- return {
10487
- min: Math.round(p),
10488
- max: Math.round(g),
10489
- last: Math.round(w),
10490
- average: Math.round(u)
10491
- };
10492
- }
10493
- }
10494
- /**
10495
- * Get the current running jitter value
10496
- */
10497
- getRunningJitter(e) {
10498
- for (const [t, i] of this.runningJitter)
10499
- if (t.startsWith(e))
10500
- return i;
10501
- }
10502
- /**
10503
- * Reset jitter tracking for a specific rendition or all renditions.
10504
- */
10505
- reset(e, t) {
10506
- if (e !== void 0 && t !== void 0) {
10507
- const i = this.getTrackingKey(e, t);
10508
- this.trackingState.delete(i), this.runningJitter.delete(i), this.recentJitterSamples.delete(i);
10509
- } else if (e !== void 0)
10510
- for (const i of this.trackingState.keys())
10511
- i.startsWith(e) && (this.trackingState.delete(i), this.runningJitter.delete(i), this.recentJitterSamples.delete(i));
10512
- else
10513
- this.trackingState.clear(), this.runningJitter.clear(), this.recentJitterSamples.clear();
10514
- }
10515
- getStatistics() {
10516
- return {
10517
- audioJitter: this.getJitterForType("audio"),
10518
- videoJitter: this.getJitterForType("video")
10519
- };
10520
- }
10521
- }
10522
10524
  const iw = {
10523
10525
  enabled: !0,
10524
10526
  interval: 3e4,
@@ -10528,7 +10530,7 @@ const iw = {
10528
10530
  maxRetries: 10,
10529
10531
  maxErrorReports: 50,
10530
10532
  maxEvents: 50
10531
- }, sh = (s, e) => M(S({}, e), { type: s, timestamp: (/* @__PURE__ */ new Date()).toISOString(), discriminator: "web" }), Dc = class Dc {
10533
+ }, sh = (s, e) => M(v({}, e), { type: s, timestamp: (/* @__PURE__ */ new Date()).toISOString(), discriminator: "web" }), Dc = class Dc {
10532
10534
  constructor(e, t, i, n) {
10533
10535
  r(this, "logger");
10534
10536
  r(this, "timers", new Ae());
@@ -10551,13 +10553,13 @@ const iw = {
10551
10553
  r(this, "addStats", ({ isFinal: e, initiator: t } = { isFinal: !1, initiator: "interval" }, i = {}) => {
10552
10554
  if (!this.options.includeStats)
10553
10555
  return;
10554
- const n = this.parentContext.getStatistics(), o = sh("stats", M(S(S({}, i), n), { isFinal: e, initiator: t, count: this.statsCount++ }));
10556
+ const n = this.parentContext.getStatistics(), o = sh("stats", M(v(v({}, i), n), { isFinal: e, initiator: t, count: this.statsCount++ }));
10555
10557
  this.unsentLines.push(o);
10556
10558
  });
10557
10559
  r(this, "addEvent", (e) => {
10558
10560
  if (!this.options.includeEvents || this.eventCount > this.options.maxEvents)
10559
10561
  return;
10560
- const t = this.parentContext.getStatistics(), i = sh("event", S(S({}, t), e));
10562
+ const t = this.parentContext.getStatistics(), i = sh("event", v(v({}, t), e));
10561
10563
  this.eventCount++, this.unsentLines.push(i);
10562
10564
  });
10563
10565
  r(this, "getStatistics", () => ({
@@ -10578,7 +10580,7 @@ const iw = {
10578
10580
  this.parentContext.connectionState === "connected" ? this.emitter.emit("send signal", {
10579
10581
  type: "telemetry",
10580
10582
  body: t
10581
- }) : yield Sd(new URL(this.options.url), { body: t, headers: { "Content-Type": "text/plain" } });
10583
+ }) : yield vd(new URL(this.options.url), { body: t, headers: { "Content-Type": "text/plain" } });
10582
10584
  break;
10583
10585
  }
10584
10586
  this.retries = 0, this.unsentLines.clear();
@@ -10602,11 +10604,11 @@ const iw = {
10602
10604
  return;
10603
10605
  const n = this.parentContext.getStatistics();
10604
10606
  this.unsentLines.push(
10605
- sh("error", S(S({}, n), e.toStringifiable()))
10607
+ sh("error", v(v({}, n), e.toStringifiable()))
10606
10608
  );
10607
10609
  }
10608
10610
  });
10609
- this.logger = e, this.emitter = t, this.options = S(S({}, iw), i), this.parentContext = n;
10611
+ this.logger = e, this.emitter = t, this.options = v(v({}, iw), i), this.parentContext = n;
10610
10612
  }
10611
10613
  };
10612
10614
  r(Dc, "create", (e, t, i, n) => new Dc(e, t, i, n));
@@ -10698,19 +10700,19 @@ class rw {
10698
10700
  const aw = 6, ow = (s) => {
10699
10701
  let e = [s], t = 0, i = 0, n = !1;
10700
10702
  const o = (h, u) => {
10701
- var k, D, T;
10702
- h.flags && cr(h.flags) && (t = (k = h.compositionTimeOffset) != null ? k : 0), h.timestamp += t, h.compositionTimeOffset = ((D = h.compositionTimeOffset) != null ? D : 0) - t;
10703
- const m = h.timestamp / h.timescale, g = u.flags && cr(u.flags) ? (T = u.compositionTimeOffset) != null ? T : 0 : t, b = (u.timestamp + g) / u.timescale, v = Math.max(0, Math.round((b - m) * h.timescale));
10704
- return v > 0 && (i = v), M(S({}, h), {
10703
+ var k, L, T;
10704
+ h.flags && hr(h.flags) && (t = (k = h.compositionTimeOffset) != null ? k : 0), h.timestamp += t, h.compositionTimeOffset = ((L = h.compositionTimeOffset) != null ? L : 0) - t;
10705
+ const m = h.timestamp / h.timescale, g = u.flags && hr(u.flags) ? (T = u.compositionTimeOffset) != null ? T : 0 : t, b = (u.timestamp + g) / u.timescale, S = Math.max(0, Math.round((b - m) * h.timescale));
10706
+ return S > 0 && (i = S), M(v({}, h), {
10705
10707
  /*
10706
10708
  During resync timeshifts we may end up with negative durations (normalized to 0 above) which is not allowed in mse (the MseModule
10707
10709
  drops the frame) so we use the last known duration instead. This is not ideal but it's better than dropping the frame.
10708
10710
  */
10709
- duration: v > 0 ? v : i
10711
+ duration: S > 0 ? S : i
10710
10712
  });
10711
10713
  };
10712
10714
  return (h, u = !1) => {
10713
- if (h.flags && cr(h.flags) && u && (n = !n), !(u && e.length < aw && n) && e.length > 0) {
10715
+ if (h.flags && hr(h.flags) && u && (n = !n), !(u && e.length < aw && n) && e.length > 0) {
10714
10716
  n = !1;
10715
10717
  let p = h;
10716
10718
  for (let w = e.length - 1; w > 0; w--) {
@@ -10728,10 +10730,10 @@ const aw = 6, ow = (s) => {
10728
10730
  };
10729
10731
  }, cw = (s, e, t) => {
10730
10732
  if (ws(e))
10731
- return S(M(S({}, s), {
10733
+ return v(M(v({}, s), {
10732
10734
  type: "video",
10733
10735
  codec: e.codec,
10734
- isSync: cr(s.flags),
10736
+ isSync: hr(s.flags),
10735
10737
  data: s.payload,
10736
10738
  duration: 0,
10737
10739
  width: e.width,
@@ -10739,13 +10741,13 @@ const aw = 6, ow = (s) => {
10739
10741
  }), t);
10740
10742
  if (e.codec === "webvtt")
10741
10743
  throw new Error("WebVTT is not supported");
10742
- return M(S({}, s), {
10744
+ return M(v({}, s), {
10743
10745
  type: "audio",
10744
10746
  channels: e.channels,
10745
10747
  sampleRate: e.sampleRate,
10746
10748
  codec: e.codec,
10747
10749
  language: e.language,
10748
- isSync: cr(s.flags),
10750
+ isSync: hr(s.flags),
10749
10751
  data: s.payload,
10750
10752
  duration: 0
10751
10753
  });
@@ -10772,25 +10774,25 @@ class hw {
10772
10774
  w.sort((T, P) => T.brand.localeCompare(P.brand));
10773
10775
  const b = [...(h = this.highEntropyValues.fullVersionList) != null ? h : []];
10774
10776
  b.sort((T, P) => T.brand.localeCompare(P.brand));
10775
- const v = b.map((T) => T.version), I = w.map((T) => T.brand), k = w.map((T) => T.version), D = parseInt((m = (u = this.highEntropyValues.platformVersion) == null ? void 0 : u.split(".")[0]) != null ? m : "1");
10776
- return S({
10777
+ const S = b.map((T) => T.version), I = w.map((T) => T.brand), k = w.map((T) => T.version), L = parseInt((m = (u = this.highEntropyValues.platformVersion) == null ? void 0 : u.split(".")[0]) != null ? m : "1");
10778
+ return v({
10777
10779
  userAgentLegacy: window.navigator.userAgent,
10778
10780
  ua: {
10779
10781
  browser: {
10780
10782
  brands: I,
10781
- fullVersionBrands: v,
10783
+ fullVersionBrands: S,
10782
10784
  majorVersions: k
10783
10785
  },
10784
10786
  device: this.highEntropyValues.model || "Other",
10785
10787
  os: {
10786
10788
  family: this.highEntropyValues.platform || "Other",
10787
10789
  version: (p = this.highEntropyValues.platformVersion) != null ? p : "1",
10788
- major_version: Number.isFinite(D) ? D : 0
10790
+ major_version: Number.isFinite(L) ? L : 0
10789
10791
  }
10790
10792
  }
10791
10793
  }, n);
10792
10794
  } else
10793
- return S({
10795
+ return v({
10794
10796
  userAgent: window.navigator.userAgent
10795
10797
  }, n);
10796
10798
  }
@@ -10798,7 +10800,7 @@ class hw {
10798
10800
  const rd = (s, e) => s && typeof s == "object" && e in s, uw = (s) => !(typeof s != "object" || !rd(s, "channelId") || typeof s.channelId != "string" || !rd(s, "url") || typeof s.url != "string" || s.channelId.length === 0 || s.url.length === 0), dw = (s) => {
10799
10801
  if (!uw(s))
10800
10802
  throw new x("Invalid options", { isFatal: !0, code: "invalid_options" });
10801
- const e = S({}, s);
10803
+ const e = v({}, s);
10802
10804
  return Object.keys(e).forEach((t) => {
10803
10805
  const i = e;
10804
10806
  typeof i[t] == "undefined" && delete i[t];
@@ -10815,7 +10817,7 @@ const rd = (s, e) => s && typeof s == "object" && e in s, uw = (s) => !(typeof s
10815
10817
  return !0;
10816
10818
  };
10817
10819
  var gs, Me, As;
10818
- const Ut = class Ut extends Ei {
10820
+ const Ut = class Ut extends Ti {
10819
10821
  constructor(t) {
10820
10822
  super();
10821
10823
  // 10s
@@ -10828,7 +10830,7 @@ const Ut = class Ut extends Ei {
10828
10830
  r(this, "options");
10829
10831
  r(this, "element");
10830
10832
  r(this, "playbackSource");
10831
- r(this, "emitter", new Ei());
10833
+ r(this, "emitter", new Ti());
10832
10834
  r(this, "logger");
10833
10835
  r(this, "modules");
10834
10836
  r(this, "clientIp");
@@ -10839,7 +10841,7 @@ const Ut = class Ut extends Ei {
10839
10841
  r(this, "hasCalledConnect", !1);
10840
10842
  r(this, "latestEmittedLanguages", []);
10841
10843
  r(this, "wakeLock");
10842
- r(this, "pool", new vu(Ut.MAX_POOL_SIZE));
10844
+ r(this, "pool", new Su(Ut.MAX_POOL_SIZE));
10843
10845
  r(this, "userAgentInformation", new hw());
10844
10846
  r(this, "encryptedMediaExtensions");
10845
10847
  d(this, gs, 0);
@@ -10916,7 +10918,7 @@ const Ut = class Ut extends Ei {
10916
10918
  var m;
10917
10919
  this.sessionId = Cu();
10918
10920
  const i = this.modules.subscription.getTargetSubscription(), n = t.channels.find((p) => p.channelId === i.channelId);
10919
- if (this.emitter.emit("connect info", t), "timeshift" in t && t.timeshift ? (t.timeshift, this._channels = t.channels.map((p) => M(S({}, p), {
10921
+ if (this.emitter.emit("connect info", t), "timeshift" in t && t.timeshift ? (t.timeshift, this._channels = t.channels.map((p) => M(v({}, p), {
10920
10922
  timeshift: t.timeshift
10921
10923
  })), this.emit("timeshift info", t.timeshift)) : this._channels = t.channels, this.updateTextTracks((m = n == null ? void 0 : n.renditions) != null ? m : []), !this.textTrack && this.options.get("textTrack") && (this.textTrack = this.options.get("textTrack")), yield Promise.all(
10922
10924
  t.channels.map((p) => f(this, null, function* () {
@@ -10988,14 +10990,14 @@ const Ut = class Ut extends Ei {
10988
10990
  r(this, "filterRenditions", (t) => f(this, null, function* () {
10989
10991
  const i = yield Promise.all(
10990
10992
  t.map((h) => f(this, null, function* () {
10991
- var p, g, w;
10993
+ var p, g, w, b;
10992
10994
  if (bs(h))
10993
- return !0;
10995
+ return !(this.willUseMediaSource() && !((p = Zn()) != null && p.isTypeSupported(ti(h))));
10994
10996
  if (!ws(h) || !this.isSupportedVideoCodecProfile(h.codec, h.codecString))
10995
10997
  return !1;
10996
10998
  if (!this.willUseMediaSource()) {
10997
- const b = this.options.get("advanced"), v = (p = b.wasmDecodingConstraint.bitRate) != null ? p : Number.MAX_SAFE_INTEGER, I = (g = b.wasmDecodingConstraint.width) != null ? g : Number.MAX_SAFE_INTEGER, k = (w = b.wasmDecodingConstraint.height) != null ? w : Number.MAX_SAFE_INTEGER;
10998
- return h.bitRate <= v && h.width <= I && h.height <= k;
10999
+ const S = this.options.get("advanced"), I = (g = S.wasmDecodingConstraint.bitRate) != null ? g : Number.MAX_SAFE_INTEGER, k = (w = S.wasmDecodingConstraint.width) != null ? w : Number.MAX_SAFE_INTEGER, L = (b = S.wasmDecodingConstraint.height) != null ? b : Number.MAX_SAFE_INTEGER;
11000
+ return h.bitRate <= I && h.width <= k && h.height <= L;
10999
11001
  }
11000
11002
  const u = yield cg(h);
11001
11003
  if (!u.supported || h.codec == "av1" && !u.smooth && !u.powerEfficient)
@@ -11026,7 +11028,7 @@ const Ut = class Ut extends Ei {
11026
11028
  ), h = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), u = this.supportedAudioCodecs(), m = t.renditions.filter(bs), p = t.renditions.filter(ws), g = u.find((I) => m.find((k) => k.codec === I) !== void 0), w = h.find((I) => p.find((k) => k.codec === I) !== void 0), b = m.map((I) => I.language);
11027
11029
  if (this.logger.debug("supported and selected codecs", { audioCodecs: u, videoCodecs: h, audioCodec: g, videoCodec: w }), w) {
11028
11030
  const I = this.options.get("maxSize");
11029
- this.modules.subscription.setVideoConstraint(S({
11031
+ this.modules.subscription.setVideoConstraint(v({
11030
11032
  codec: w,
11031
11033
  bitRate: this.abrEnabled ? o : this.options.get("maxVideoBitRate")
11032
11034
  }, I));
@@ -11036,16 +11038,16 @@ const Ut = class Ut extends Ei {
11036
11038
  bitRate: this.abrEnabled ? c : this.options.get("maxAudioBitRate"),
11037
11039
  language: this.options.get("language")
11038
11040
  }), (!b.includes(this.options.get("language")) || this.language === void 0) && this.modules.subscription.setLanguage(b[0])), this.alignSizeAndBitRate(this.targetSubscription);
11039
- const v = this.modules.subscription.getTargetSubscription();
11041
+ const S = this.modules.subscription.getTargetSubscription();
11040
11042
  this.emitter.emit("subscription changed", {
11041
- to: v,
11043
+ to: S,
11042
11044
  from: this.modules.subscription.getCurrentSubscription()
11043
11045
  });
11044
11046
  });
11045
11047
  r(this, "isSupportedVideoCodecProfile", (t, i) => {
11046
11048
  if (this.willUseMediaSource()) {
11047
- const n = Rr();
11048
- return n ? n.isTypeSupported(Oi({ codec: t, codecString: i })) : !0;
11049
+ const n = Zn();
11050
+ return n ? n.isTypeSupported(ti({ codec: t, codecString: i })) : !0;
11049
11051
  }
11050
11052
  if (t === "h264") {
11051
11053
  const n = !!(i != null && i.startsWith("avc1.42")), o = !!(i != null && i.startsWith("avc1.66."));
@@ -11057,7 +11059,7 @@ const Ut = class Ut extends Ei {
11057
11059
  if (this.options.get("media") === "video")
11058
11060
  return [];
11059
11061
  const t = [];
11060
- return (this.browser.supportsMp4Opus && this.options.get("mseOpusEnabled") || !this.willUseMediaSource()) && t.push("opus"), this.willUseMediaSource() && t.push("aac"), t;
11062
+ return this.willUseMediaSource() && t.push("aac"), (this.browser.supportsMp4Opus && this.options.get("mseOpusEnabled") || !this.willUseMediaSource()) && t.push("opus"), t;
11061
11063
  });
11062
11064
  r(this, "initializeDecodingModule", () => f(this, null, function* () {
11063
11065
  var n, o;
@@ -11066,12 +11068,12 @@ const Ut = class Ut extends Ei {
11066
11068
  throw new x("No currentRenditionLevel", { code: "no_current_rendition_level", isFatal: !1 });
11067
11069
  if (t != null && t.video && i.push({
11068
11070
  type: "video",
11069
- mimeType: Oi(t.video),
11071
+ mimeType: ti(t.video),
11070
11072
  codec: t.video.codec
11071
11073
  }), t != null && t.audio && i.push({
11072
11074
  type: "audio",
11073
11075
  codec: t.audio.codec,
11074
- mimeType: Oi(t.audio)
11076
+ mimeType: ti(t.audio)
11075
11077
  }), i.length === 0)
11076
11078
  throw new x("Can't initialize decoding module without tracks", { code: "no_tracks", isFatal: !1 });
11077
11079
  if (this.willUseMediaSource() && this.element instanceof HTMLMediaElement)
@@ -11093,7 +11095,7 @@ const Ut = class Ut extends Ei {
11093
11095
  */
11094
11096
  r(this, "unload", () => f(this, null, function* () {
11095
11097
  var t, i, n;
11096
- this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new vu(Ut.MAX_POOL_SIZE), (n = (i = this.playbackSource).unload) == null || n.call(i), this.element.remove(), this.emitter.reset(), this.encryptedMediaExtensions.unload(), this.reset(), this.logger.debug("Unloaded modules");
11098
+ this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new Su(Ut.MAX_POOL_SIZE), (n = (i = this.playbackSource).unload) == null || n.call(i), this.element.remove(), this.emitter.reset(), this.encryptedMediaExtensions.unload(), this.reset(), this.logger.debug("Unloaded modules");
11097
11099
  }));
11098
11100
  /**
11099
11101
  * @deprecated since 3.0.0 Use play instead.
@@ -11149,13 +11151,13 @@ const Ut = class Ut extends Ei {
11149
11151
  */
11150
11152
  r(this, "getStatistics", () => {
11151
11153
  const t = Object.values(this.modules).reduce(
11152
- (n, o) => o && "getStatistics" in o ? S(S({}, n), o.getStatistics()) : n,
11154
+ (n, o) => o && "getStatistics" in o ? v(v({}, n), o.getStatistics()) : n,
11153
11155
  // Safety: We know that the collective statistics from module map will equal Statistic because the Statistics type is inferred from moduleMap
11154
11156
  this.getRuntimeInfo()
11155
11157
  ), i = Math.round(
11156
11158
  this.timeActive > 0 ? (t.bytesReceived || 0) * 8 / (this.timeActive / 1e3) : 0
11157
11159
  );
11158
- return M(S({}, t), {
11160
+ return M(v({}, t), {
11159
11161
  averageBitRate: i
11160
11162
  });
11161
11163
  });
@@ -11166,9 +11168,9 @@ const Ut = class Ut extends Ei {
11166
11168
  });
11167
11169
  r(this, "getRuntimeInfo", () => {
11168
11170
  const t = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
11169
- return S({
11171
+ return v({
11170
11172
  uptime: Date.now() - this.createdAt,
11171
- version: "4.1.5",
11173
+ version: "4.1.6",
11172
11174
  clientId: this.clientId,
11173
11175
  sessionId: this.sessionId,
11174
11176
  channelId: this.channelId,
@@ -11200,7 +11202,7 @@ const Ut = class Ut extends Ei {
11200
11202
  if (i && t)
11201
11203
  return t - i;
11202
11204
  });
11203
- this.options = new rw(S(S({}, hf), dw(t)));
11205
+ this.options = new rw(v(v({}, hf), dw(t)));
11204
11206
  const i = ["localhost", "127.0.0.1"];
11205
11207
  t.telemetryEnabled === void 0 && i.includes(location.hostname) && this.options.set("telemetryEnabled", !1);
11206
11208
  const n = {
@@ -11249,17 +11251,18 @@ const Ut = class Ut extends Ei {
11249
11251
  this.encryptedMediaExtensions.queryParams = y;
11250
11252
  }
11251
11253
  };
11252
- const b = Nh.create(this.emitter), v = this.options.get("poster"), I = v === !0 ? this.getThumbnailUrl() : v || void 0;
11253
- let k, D, T;
11254
+ const b = Nh.create(this.emitter), S = this.options.get("poster"), I = S === !0 ? this.getThumbnailUrl() : S || void 0;
11255
+ let k, L, T;
11254
11256
  if (this.willUseMediaSource()) {
11255
11257
  const y = new ph({
11256
11258
  type: this.options.get("media") == "audio" ? "audio" : "video",
11257
11259
  autoplay: !1,
11258
11260
  muted: this.options.get("muted") || this.options.get("media") === "video",
11261
+ volume: this.options.get("volume"),
11259
11262
  logger: this.logger.createContext("MediaElement"),
11260
11263
  poster: I
11261
11264
  });
11262
- y.on("buffer state", (E) => this.emitter.emit("buffer state", E)), y.on("needs user input", (E) => this.emitter.emit("needs user input", E)), y.on("volume state", (E) => this.emit("volume state", E)), y.on("media element state", (E) => this.onMediaElementState(E)), this.element = y.element, this.playbackSource = y, Lu.isSupported() && this.encryptedMediaExtensions.attach(y.element), k = Xh.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (D = jo.create(this.logger.createContext("UnpauseModule"), y, b)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: y.element });
11265
+ y.on("buffer state", (E) => this.emitter.emit("buffer state", E)), y.on("needs user input", (E) => this.emitter.emit("needs user input", E)), y.on("volume state", (E) => this.emit("volume state", E)), y.on("media element state", (E) => this.onMediaElementState(E)), this.element = y.element, this.playbackSource = y, Lu.isSupported() && this.encryptedMediaExtensions.attach(y.element), k = Xh.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (L = jo.create(this.logger.createContext("UnpauseModule"), y, b)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: y.element });
11263
11266
  } else if (this.browser.platform.iosVersion >= 15 && this.options.get("iosMediaElementEnabled")) {
11264
11267
  const y = Qh.create(
11265
11268
  this.emitter,
@@ -11269,17 +11272,19 @@ const Ut = class Ut extends Ei {
11269
11272
  {
11270
11273
  type: this.options.get("media") == "audio" ? "audio" : "video",
11271
11274
  muted: this.options.get("muted") || this.options.get("media") === "video",
11275
+ volume: this.options.get("volume"),
11272
11276
  poster: I
11273
11277
  }
11274
11278
  ), E = y.element();
11275
- this.element = E.element, this.playbackSource = y, T = y, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (D = jo.create(this.logger.createContext("UnpauseModule"), E, b));
11279
+ this.element = E.element, this.playbackSource = y, T = y, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (L = jo.create(this.logger.createContext("UnpauseModule"), E, b));
11276
11280
  } else {
11277
11281
  const y = Hh.create(
11278
11282
  this.emitter,
11279
11283
  this.logger.createContext("LegacyCanvasModule"),
11280
11284
  this.pool,
11281
11285
  this,
11282
- this.options.get("muted") || this.options.get("media") === "video"
11286
+ this.options.get("muted") || this.options.get("media") === "video",
11287
+ this.options.get("volume")
11283
11288
  );
11284
11289
  this.element = y.element(), this.playbackSource = y, T = y, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new rg());
11285
11290
  }
@@ -11350,7 +11355,7 @@ const Ut = class Ut extends Ei {
11350
11355
  renditions: p,
11351
11356
  qualityOfService: g,
11352
11357
  mseModule: k,
11353
- unpause: D,
11358
+ unpause: L,
11354
11359
  canvasModule: T
11355
11360
  }, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (y) => {
11356
11361
  var E;
@@ -11383,12 +11388,12 @@ const Ut = class Ut extends Ei {
11383
11388
  }), this.emitter.on("recovered from media error", () => {
11384
11389
  this.modules.adaptivity.reset(this.targetBufferTime * 2);
11385
11390
  }), this.emitter.once("connect info", (y) => {
11386
- var G, L, N;
11387
- const F = ((L = (G = y.telemetry) == null ? void 0 : G.probability) != null ? L : 1) >= Math.random();
11391
+ var G, D, N;
11392
+ const F = ((D = (G = y.telemetry) == null ? void 0 : G.probability) != null ? D : 1) >= Math.random();
11388
11393
  y.telemetry && ((N = this.modules.telemetry) == null || N.unload(), this.modules.telemetry = Go.create(
11389
11394
  this.logger.createContext("TelemetryModule"),
11390
11395
  this.emitter,
11391
- M(S({}, y.telemetry), {
11396
+ M(v({}, y.telemetry), {
11392
11397
  enabled: this.options.get("telemetryEnabled") && F
11393
11398
  }),
11394
11399
  this
@@ -11396,12 +11401,12 @@ const Ut = class Ut extends Ei {
11396
11401
  }), this.emitter.on("adapt level", (y) => {
11397
11402
  var xe, J, ce, _e, Ne;
11398
11403
  this.logger.debug("adapt level", { direction: y });
11399
- const E = this.modules.renditions.getRenditionLevels(), F = this.modules.renditions.getRenditionLevel(), G = E.findIndex((ie) => ie === F), L = E.length - 1;
11404
+ const E = this.modules.renditions.getRenditionLevels(), F = this.modules.renditions.getRenditionLevel(), G = E.findIndex((ie) => ie === F), D = E.length - 1;
11400
11405
  let N = G;
11401
11406
  switch (y) {
11402
11407
  case "upgrade":
11403
11408
  {
11404
- const ie = Math.min(G + 1, L), ut = E[ie], im = (xe = this.modules.connection.estimatedBandwidth) != null ? xe : vi(), sm = ((ce = (J = ut == null ? void 0 : ut.audio) == null ? void 0 : J.bitRate) != null ? ce : 0) + ((Ne = (_e = ut == null ? void 0 : ut.video) == null ? void 0 : _e.bitRate) != null ? Ne : 0), nm = im * 2 > sm;
11409
+ const ie = Math.min(G + 1, D), ut = E[ie], im = (xe = this.modules.connection.estimatedBandwidth) != null ? xe : Ei(), sm = ((ce = (J = ut == null ? void 0 : ut.audio) == null ? void 0 : J.bitRate) != null ? ce : 0) + ((Ne = (_e = ut == null ? void 0 : ut.video) == null ? void 0 : _e.bitRate) != null ? Ne : 0), nm = im * 2 > sm;
11405
11410
  ut && nm && this.modules.adaptivity.isQoSOk(ut) && (N = ie);
11406
11411
  }
11407
11412
  break;
@@ -11423,16 +11428,16 @@ const Ut = class Ut extends Ei {
11423
11428
  if (N === G)
11424
11429
  return;
11425
11430
  const Z = E[N];
11426
- this.alignSizeAndBitRate(M(S({}, this.targetSubscription), {
11427
- video: S(S({}, this.targetSubscription.video), Z == null ? void 0 : Z.video),
11428
- audio: S(S({}, this.targetSubscription.audio), Z == null ? void 0 : Z.audio)
11431
+ this.alignSizeAndBitRate(M(v({}, this.targetSubscription), {
11432
+ video: v(v({}, this.targetSubscription.video), Z == null ? void 0 : Z.video),
11433
+ audio: v(v({}, this.targetSubscription.audio), Z == null ? void 0 : Z.audio)
11429
11434
  })), this.emitter.emit("adapted level");
11430
11435
  }), this.emitter.on("text track data", (y) => {
11431
- const E = a(this, Me).find((N) => N.language === y.language), G = this.modules.sync.getTimeshiftOffset() / 1e3, L = G - a(this, gs);
11436
+ const E = a(this, Me).find((N) => N.language === y.language), G = this.modules.sync.getTimeshiftOffset() / 1e3, D = G - a(this, gs);
11432
11437
  if (l(this, gs, G), E) {
11433
11438
  if (E.cues)
11434
11439
  for (const N of E.cues)
11435
- N.startTime -= L, N.endTime -= L;
11440
+ N.startTime -= D, N.endTime -= D;
11436
11441
  for (const N of y.cues) {
11437
11442
  const Z = new VTTCue(N.startTime - G, N.endTime - G, N.text);
11438
11443
  E.addCue(Z);
@@ -11441,14 +11446,14 @@ const Ut = class Ut extends Ei {
11441
11446
  }), this.emitter.on("received signal", (y) => {
11442
11447
  var G;
11443
11448
  const E = y, F = this.modules.subscription.getCurrentSubscription();
11444
- switch (this.logger.debug("received", S({}, E)), E.type) {
11449
+ switch (this.logger.debug("received", v({}, E)), E.type) {
11445
11450
  case "client ip":
11446
11451
  this.clientIp = E.ip;
11447
11452
  break;
11448
11453
  case "renditions":
11449
- this.updateTextTracks(E.renditions), l(this, As, this.filterRenditions(E.renditions).then((L) => {
11454
+ this.updateTextTracks(E.renditions), l(this, As, this.filterRenditions(E.renditions).then((D) => {
11450
11455
  this.emitter.emit("renditions", {
11451
- renditions: L,
11456
+ renditions: D,
11452
11457
  channelId: this.currentSubscription.channelId
11453
11458
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
11454
11459
  }).finally(() => {
@@ -11458,11 +11463,11 @@ const Ut = class Ut extends Ei {
11458
11463
  case "subscription changed":
11459
11464
  try {
11460
11465
  lw(E.subscription);
11461
- } catch (L) {
11466
+ } catch (D) {
11462
11467
  this.emitter.emit(
11463
11468
  "error",
11464
11469
  new x("Subscription failed validation", {
11465
- source: L instanceof Error ? L : void 0,
11470
+ source: D instanceof Error ? D : void 0,
11466
11471
  isFatal: !1,
11467
11472
  code: "subscription_failed_validation"
11468
11473
  })
@@ -11483,27 +11488,27 @@ const Ut = class Ut extends Ei {
11483
11488
  }), this.emitter.on("received data", (y) => {
11484
11489
  const E = this.modules.subscription.getCurrentSubscription(), F = sg(y);
11485
11490
  if (!E) {
11486
- this.logger.warn("Received unwanted message", S({}, F));
11491
+ this.logger.warn("Received unwanted message", v({}, F));
11487
11492
  return;
11488
11493
  }
11489
- Be(M(S({}, F), { channelId: E.channelId }));
11494
+ Be(M(v({}, F), { channelId: E.channelId }));
11490
11495
  }), this.emitter.on("received moq data", (y) => {
11491
11496
  var N, Z, xe;
11492
- const E = y.payload.mediaType(), F = y.channelId, G = y.renditionId, L = this.modules.sync.processFragment(F, y.payload);
11497
+ const E = y.payload.mediaType(), F = y.channelId, G = y.renditionId, D = this.modules.sync.processFragment(F, y.payload);
11493
11498
  if (E !== "text" && this.modules.jitter.recordSample({
11494
11499
  type: E,
11495
11500
  renditionId: G,
11496
- timestamp: L.baseMediaDecodeTime(),
11497
- timescale: L.timescale()
11501
+ timestamp: D.baseMediaDecodeTime(),
11502
+ timescale: D.timescale()
11498
11503
  }), y.switchInfo.channelId && (y.switchInfo.drmTransition && this.emitter.emit("error", xd("Switching between DRM and non-DRM channels is not supported", !0)), this.encryptedMediaExtensions.onChannelSwitch(), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.modules.event.addEvent({
11499
11504
  type: "channel switch",
11500
11505
  channelId: y.switchInfo.channelId,
11501
- timestamp: L.baseMediaDecodeTime() / L.timescale() * 1e3
11506
+ timestamp: D.baseMediaDecodeTime() / D.timescale() * 1e3
11502
11507
  })), y.switchInfo.language && this.modules.event.addEvent({
11503
11508
  type: "language switch",
11504
11509
  language: y.switchInfo.language,
11505
- timestamp: L.baseMediaDecodeTime() / L.timescale() * 1e3
11506
- }), this.modules.incomingData.add(E, y.payload.rawBytes().byteLength), L.fragment().emsgs.forEach((J) => {
11510
+ timestamp: D.baseMediaDecodeTime() / D.timescale() * 1e3
11511
+ }), this.modules.incomingData.add(E, y.payload.rawBytes().byteLength), D.fragment().emsgs.forEach((J) => {
11507
11512
  if (!J.presentationTime)
11508
11513
  return;
11509
11514
  const ce = Uf(J.data);
@@ -11514,7 +11519,7 @@ const Ut = class Ut extends Ei {
11514
11519
  type: "metadata"
11515
11520
  });
11516
11521
  }), this.modules.decoder) {
11517
- const J = (N = L.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, ce = (Z = J == null ? void 0 : J.avc1) == null ? void 0 : Z.avcC.bytes, _e = (xe = J == null ? void 0 : J.codec) != null ? xe : "h264";
11522
+ const J = (N = D.header().init().moov.traks[0]) == null ? void 0 : N.mdia.minf.stbl.stsd, ce = (Z = J == null ? void 0 : J.avc1) == null ? void 0 : Z.avcC.bytes, _e = (xe = J == null ? void 0 : J.codec) != null ? xe : "h264";
11518
11523
  if (ce) {
11519
11524
  const Ne = ce.buffer.slice(ce.byteOffset, ce.byteOffset + ce.byteLength);
11520
11525
  if (E === "text")
@@ -11532,16 +11537,16 @@ const Ut = class Ut extends Ei {
11532
11537
  // mediaType !== mimeType - but the sw decoder doesn't care
11533
11538
  });
11534
11539
  }
11535
- for (let Ne = 0; Ne < L.samplesCount(); Ne++) {
11536
- const ie = L.sample(Ne);
11537
- ie && this.emitter.emit("coded sample", M(S({}, ie), {
11540
+ for (let Ne = 0; Ne < D.samplesCount(); Ne++) {
11541
+ const ie = D.sample(Ne);
11542
+ ie && this.emitter.emit("coded sample", M(v({}, ie), {
11538
11543
  renditionId: G,
11539
11544
  channelId: F,
11540
11545
  data: ie.data.buffer.slice(ie.data.byteOffset, ie.data.byteOffset + ie.data.byteLength)
11541
11546
  }));
11542
11547
  }
11543
11548
  } else
11544
- this.emitter.emit("fragment", { mimeType: y.mimeType, codec: y.codec, fragment: L, channelId: F, renditionId: G });
11549
+ this.emitter.emit("fragment", { mimeType: y.mimeType, codec: y.codec, fragment: D, channelId: F, renditionId: G });
11545
11550
  });
11546
11551
  const ht = this.options.get("container");
11547
11552
  ht && this.attach(ht), this.logger.info("Created Vindral instance", { options: this.options });
@@ -11551,9 +11556,9 @@ const Ut = class Ut extends Ei {
11551
11556
  const F = this.modules.renditions.getRendition(y.renditionId, E);
11552
11557
  if (!eg(y.flags)) {
11553
11558
  if (tg(y.flags)) {
11554
- const L = new TextDecoder().decode(y.payload), N = this.modules.sync.getTimeshiftOffset();
11559
+ const D = new TextDecoder().decode(y.payload), N = this.modules.sync.getTimeshiftOffset();
11555
11560
  if (y.renditionId !== 0) {
11556
- const Z = pm(L);
11561
+ const Z = pm(D);
11557
11562
  if (Z && Z.language !== void 0) {
11558
11563
  const J = new qd().parse(Z.content || ""), ce = N / 1e3, _e = a(this, Me).find((ie) => ie.language === Z.language), Ne = ce - a(this, gs);
11559
11564
  if (l(this, gs, ce), _e) {
@@ -11569,7 +11574,7 @@ const Ut = class Ut extends Ei {
11569
11574
  } else
11570
11575
  this.modules.event.addEvent({
11571
11576
  timestamp: y.timestamp / y.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
11572
- content: L,
11577
+ content: D,
11573
11578
  type: "metadata"
11574
11579
  });
11575
11580
  } else if (F != null && F.codec) {
@@ -11577,30 +11582,30 @@ const Ut = class Ut extends Ei {
11577
11582
  if (G === "text")
11578
11583
  throw new Error("Subtitles are not supported");
11579
11584
  if (this.modules.incomingData.add(G, y.payload.byteLength), Kp(y.flags)) {
11580
- const L = M(S({
11585
+ const D = M(v({
11581
11586
  type: G,
11582
11587
  data: y.payload,
11583
11588
  codec: F.codec
11584
11589
  }, y), {
11585
11590
  channelId: E
11586
- }), N = Xp(L.codec, L.payload);
11587
- N && this.sizes.set(L.renditionId, N);
11588
- const Z = Oi({ codec: F.codec, codecString: F.codecString });
11589
- this.emitter.emit("init segment", { initSegment: L, mimeType: Z }), this.emit("initialized media");
11591
+ }), N = Xp(D.codec, D.payload);
11592
+ N && this.sizes.set(D.renditionId, N);
11593
+ const Z = ti({ codec: F.codec, codecString: F.codecString });
11594
+ this.emitter.emit("init segment", { initSegment: D, mimeType: Z }), this.emit("initialized media");
11590
11595
  } else {
11591
- const L = cw(y, F, this.sizes.get(y.renditionId));
11592
- this.modules.jitter.recordSample(L);
11596
+ const D = cw(y, F, this.sizes.get(y.renditionId));
11597
+ this.modules.jitter.recordSample(D);
11593
11598
  let N = this.sampleProcessingSesssions.get(G);
11594
11599
  if (!N)
11595
11600
  N = ow(
11596
- this.modules.sync.processSample(L)
11601
+ this.modules.sync.processSample(D)
11597
11602
  ), this.sampleProcessingSesssions.set(G, N);
11598
11603
  else {
11599
11604
  const Z = N(
11600
- this.modules.sync.processSample(L),
11601
- this.isSwitchingRenditionLevel && L.type === "video"
11605
+ this.modules.sync.processSample(D),
11606
+ this.isSwitchingRenditionLevel && D.type === "video"
11602
11607
  );
11603
- let xe = L;
11608
+ let xe = D;
11604
11609
  Z.forEach((J) => {
11605
11610
  this.modules.event.extractEvent(J, xe), this.emitter.emit("coded sample", J), xe = J;
11606
11611
  });
@@ -11802,7 +11807,14 @@ const Ut = class Ut extends Ei {
11802
11807
  * Set the current language
11803
11808
  */
11804
11809
  set language(t) {
11805
- this.modules.subscription.setLanguage(t);
11810
+ if (t === this.language)
11811
+ return;
11812
+ const i = this.languages;
11813
+ if (t !== void 0 && i.length > 0 && !i.includes(t)) {
11814
+ this.logger.warn(`Language "${t}" is not available. Available languages: ${i.join(", ")}`);
11815
+ return;
11816
+ }
11817
+ this.modules.subscription.setLanguage(t), this.alignSizeAndBitRate(this.targetSubscription);
11806
11818
  }
11807
11819
  /**
11808
11820
  * Set the active text track
@@ -11877,7 +11889,7 @@ const Ut = class Ut extends Ei {
11877
11889
  */
11878
11890
  get maxVideoBitRate() {
11879
11891
  var t, i;
11880
- return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) != null ? i : vi();
11892
+ return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) != null ? i : Ei();
11881
11893
  }
11882
11894
  /**
11883
11895
  * Set max video bit rate that will be subscribed to
@@ -11894,7 +11906,7 @@ const Ut = class Ut extends Ei {
11894
11906
  */
11895
11907
  get maxAudioBitRate() {
11896
11908
  var t, i;
11897
- return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) != null ? i : vi();
11909
+ return (i = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) != null ? i : Ei();
11898
11910
  }
11899
11911
  /**
11900
11912
  * Set max audio bit rate that will be subscribed to
@@ -11997,9 +12009,9 @@ const Ut = class Ut extends Ei {
11997
12009
  * Aligns size and bitrate to match a rendition level correctly
11998
12010
  */
11999
12011
  alignSizeAndBitRate(t) {
12000
- const i = this.modules.constraintCap.constrainSubscription(M(S({}, t), {
12001
- video: S({}, t.video),
12002
- audio: S({}, t.audio)
12012
+ const i = this.modules.constraintCap.constrainSubscription(M(v({}, t), {
12013
+ video: v({}, t.video),
12014
+ audio: v({}, t.audio)
12003
12015
  })), n = this.modules.constraintCap.getUserSpecifiedCap();
12004
12016
  !this.abrEnabled && n && (i.audio.bitRate = n.audio.bitRate, i.video.bitRate = n.video.bitRate, i.video.width = n.video.width, i.video.height = n.video.height);
12005
12017
  const o = this.modules.renditions.getRenditionLevel(i);