@vindral/web-sdk 4.3.3 → 4.4.0

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.
@@ -681,7 +681,16 @@ var A = class {
681
681
  return typeof n == "object" && t.forEach((e) => {
682
682
  delete n[e];
683
683
  }), n;
684
- }, sn, j = class {
684
+ };
685
+ //#endregion
686
+ //#region ../../libs/utils/src/subtitleFontSize.ts
687
+ function sn(e, t, n) {
688
+ let r = t * .05, i = e * .035, a = Math.max(Math.round(Math.min(r, i)), 16);
689
+ return `${(n == null ? void 0 : n.max) == null ? a : Math.min(a, n.max)}px`;
690
+ }
691
+ //#endregion
692
+ //#region ../../libs/utils/src/Timers.ts
693
+ var cn, j = class {
685
694
  constructor() {
686
695
  e(this, "pendingTimeouts", /* @__PURE__ */ new Set()), e(this, "pendingIntervals", /* @__PURE__ */ new Set()), e(this, "clearTimeout", (e) => {
687
696
  this.pendingTimeouts.delete(e) && window.clearTimeout(e);
@@ -702,28 +711,28 @@ var A = class {
702
711
  });
703
712
  }
704
713
  };
705
- sn = j, e(j, "create", () => new sn());
714
+ cn = j, e(j, "create", () => new cn());
706
715
  //#endregion
707
716
  //#region ../../libs/utils/src/timeRangesUtils.ts
708
- var cn = (e, t = performance.now()) => {
717
+ var ln = (e, t = performance.now()) => {
709
718
  let n = e.length;
710
719
  if (n > 0) {
711
720
  let r = e[n - 1];
712
721
  r.end || (r.end = t);
713
722
  }
714
- }, ln = (e, t = performance.now()) => {
715
- cn(e, t), e.push({ start: t });
716
- }, un = (e) => e.reduce((e, t) => {
723
+ }, un = (e, t = performance.now()) => {
724
+ ln(e, t), e.push({ start: t });
725
+ }, dn = (e) => e.reduce((e, t) => {
717
726
  var n;
718
727
  return e + (((n = t.end) == null ? performance.now() : n) - t.start);
719
- }, 0), dn = (e, t, n = performance.now()) => e.reduce((e, r) => {
728
+ }, 0), fn = (e, t, n = performance.now()) => e.reduce((e, r) => {
720
729
  var i;
721
730
  let a = Math.max(n - t, r.start), o = (i = r.end) == null ? n : i;
722
731
  return Math.max(0, o - a) + e;
723
732
  }, 0);
724
733
  //#endregion
725
734
  //#region ../../libs/utils/src/tryCatch.ts
726
- function fn(e) {
735
+ function pn(e) {
727
736
  try {
728
737
  return e();
729
738
  } catch (e) {
@@ -732,7 +741,7 @@ function fn(e) {
732
741
  }
733
742
  //#endregion
734
743
  //#region ../../libs/utils/src/userAgentInformation.ts
735
- var pn = class {
744
+ var mn = class {
736
745
  constructor() {
737
746
  var t;
738
747
  e(this, "highEntropyValues", void 0), (t = self.navigator.userAgentData) == null || t.getHighEntropyValues([
@@ -778,7 +787,7 @@ var pn = class {
778
787
  }, r);
779
788
  } else return w({ userAgent: window.navigator.userAgent }, r);
780
789
  }
781
- }, mn = () => {
790
+ }, hn = () => {
782
791
  let e = [...Array(256).keys()].map((e) => e.toString(16).padStart(2, "0")), t = crypto.getRandomValues(new Uint8Array(16));
783
792
  return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, [...t.entries()].map(([t, n]) => [
784
793
  4,
@@ -786,14 +795,14 @@ var pn = class {
786
795
  8,
787
796
  10
788
797
  ].includes(t) ? `-${e[n]}` : e[n]).join("");
789
- }, hn = function() {
798
+ }, gn = function() {
790
799
  var e = t(function* (e) {
791
800
  return new Promise((t) => setTimeout(t, e));
792
801
  });
793
802
  return function(t) {
794
803
  return e.apply(this, arguments);
795
804
  };
796
- }(), gn = function() {
805
+ }(), _n = function() {
797
806
  var e = t(function* (e, t = /* @__PURE__ */ Error("Timeout")) {
798
807
  return new Promise((n, r) => setTimeout(() => r(t), e));
799
808
  });
@@ -811,7 +820,7 @@ var pn = class {
811
820
  })();
812
821
  //#endregion
813
822
  //#region ../../libs/data-types/src/Rendition.ts
814
- var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleRate" in e && typeof e.sampleRate == "number", yn = (e) => {
823
+ var vn = (e) => "width" in e && typeof e.width == "number", yn = (e) => "sampleRate" in e && typeof e.sampleRate == "number", bn = (e) => {
815
824
  switch (e.codec) {
816
825
  case "opus": return "audio/mp4; codecs=\"opus\"";
817
826
  case "mp3": return "audio/mpeg";
@@ -821,10 +830,10 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
821
830
  case "h265": return e.codecString ? `video/mp4; codecs="${e.codecString}"` : "video/mp4";
822
831
  case "av1": return e.codecString ? `video/mp4; codecs="${e.codecString}"` : "video/mp4";
823
832
  }
824
- }, bn = () => 2 ** 53 - 1, xn = () => ({
833
+ }, xn = () => 2 ** 53 - 1, Sn = () => ({
825
834
  width: 2 ** 53 - 1,
826
835
  height: 2 ** 53 - 1
827
- }), Sn = (e) => !(typeof e != "object" || !e || !("type" in e)), Cn = {
836
+ }), Cn = (e) => !(typeof e != "object" || !e || !("type" in e)), wn = {
828
837
  sizeBasedResolutionCapEnabled: !0,
829
838
  pictureInPictureEnabled: !0,
830
839
  abrEnabled: !0,
@@ -836,9 +845,9 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
836
845
  minBufferTime: 1500,
837
846
  maxBufferTime: 1500,
838
847
  logLevel: Lt.OFF,
839
- maxSize: xn(),
840
- maxVideoBitRate: bn(),
841
- maxAudioBitRate: bn(),
848
+ maxSize: Sn(),
849
+ maxVideoBitRate: xn(),
850
+ maxAudioBitRate: xn(),
842
851
  maxInitialBitRate: 2.5 * 1e3 * 1e3,
843
852
  tags: [],
844
853
  media: "audio+video",
@@ -861,45 +870,45 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
861
870
  };
862
871
  //#endregion
863
872
  //#region ../../libs/web-sdk/src/promiseFinally.ts
864
- function wn(e) {
873
+ function Tn(e) {
865
874
  return typeof e == "function" ? this.then((t) => Promise.resolve(e()).then(() => t), (t) => Promise.resolve(e()).then(() => {
866
875
  throw t;
867
876
  })) : this.then();
868
877
  }
869
- function Tn(e = Promise) {
878
+ function En(e = Promise) {
870
879
  return typeof e.prototype.finally != "function" && Object.defineProperty(e.prototype, "finally", {
871
880
  configurable: !0,
872
881
  enumerable: !1,
873
- value: wn,
882
+ value: Tn,
874
883
  writable: !0
875
884
  }), e.prototype.finally;
876
885
  }
877
- Tn();
886
+ En();
878
887
  //#endregion
879
888
  //#region ../../libs/canvas-renderers/src/applyDefaultCanvasStyles.ts
880
- var En = (e) => {
889
+ var Dn = (e) => {
881
890
  e.width = 320, e.height = 180, e.style.width = "100%", e.style.position = "relative", e.style.backgroundColor = "#000";
882
- }, Dn = {
891
+ }, On = {
883
892
  backgroundColor: "rgba(0,0,0,0.6)",
884
893
  textPadding: 8,
885
894
  fontSize: "28px",
886
895
  lineGap: 16
887
- }, On = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakSet(), Mn = class {
896
+ }, kn = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), Mn = /* @__PURE__ */ new WeakSet(), Nn = class {
888
897
  constructor() {
889
- C(this, jn), y(this, On, []), y(this, kn, document.createElement("canvas")), y(this, M, void 0), y(this, An, window.devicePixelRatio || 1), e(this, "config", w({}, Dn));
890
- let t = x(kn, this).getContext("2d", { alpha: !0 });
898
+ C(this, Mn), y(this, kn, []), y(this, An, document.createElement("canvas")), y(this, M, void 0), y(this, jn, window.devicePixelRatio || 1), e(this, "config", w({}, On));
899
+ let t = x(An, this).getContext("2d", { alpha: !0 });
891
900
  if (!t) throw Error("Failed to create 2d context");
892
- S(M, this, t), b(jn, this, Pn).call(this);
901
+ S(M, this, t), b(Mn, this, Fn).call(this);
893
902
  }
894
903
  get canvas() {
895
- return x(kn, this);
904
+ return x(An, this);
896
905
  }
897
906
  setActiveCues(e) {
898
- S(On, this, e);
907
+ S(kn, this, e);
899
908
  }
900
909
  render(e, t = !1) {
901
- let n = x(On, this).flatMap((t) => t.text.split("\n").flatMap((t) => b(jn, this, Fn).call(this, t, e.width)).map((e) => {
902
- b(jn, this, Pn).call(this);
910
+ let n = x(kn, this).flatMap((t) => t.text.split("\n").flatMap((t) => b(Mn, this, In).call(this, t, e.width)).map((e) => {
911
+ b(Mn, this, Fn).call(this);
903
912
  let t = x(M, this).measureText(e);
904
913
  return {
905
914
  text: e,
@@ -910,21 +919,21 @@ var En = (e) => {
910
919
  }
911
920
  };
912
921
  })), r = Math.max(...n.map((e) => e.size.width)), i = n.reduce((e, { size: t }) => e + t.height, 0) + (n.length - 1) * this.config.lineGap, a = 0;
913
- b(jn, this, Nn).call(this, r, i), x(M, this).clearRect(0, 0, x(kn, this).width, x(kn, this).height);
914
- for (let { size: e, text: t } of n) b(jn, this, Pn).call(this), x(M, this).fillStyle = this.config.backgroundColor, x(M, this).fillRect(0, a, e.width, e.height), b(jn, this, Pn).call(this), x(M, this).fillText(t, this.config.textPadding, a + this.config.textPadding), a += e.height + this.config.lineGap;
915
- t && (x(M, this).strokeStyle = "red", x(M, this).strokeRect(0, 0, e.width, x(kn, this).height));
922
+ b(Mn, this, Pn).call(this, r, i), x(M, this).clearRect(0, 0, x(An, this).width, x(An, this).height);
923
+ for (let { size: e, text: t } of n) b(Mn, this, Fn).call(this), x(M, this).fillStyle = this.config.backgroundColor, x(M, this).fillRect(0, a, e.width, e.height), b(Mn, this, Fn).call(this), x(M, this).fillText(t, this.config.textPadding, a + this.config.textPadding), a += e.height + this.config.lineGap;
924
+ t && (x(M, this).strokeStyle = "red", x(M, this).strokeRect(0, 0, e.width, x(An, this).height));
916
925
  }
917
926
  };
918
- function Nn(e, t) {
919
- x(kn, this).width = e * x(An, this), x(kn, this).height = t * x(An, this), x(M, this).setTransform(x(An, this), 0, 0, x(An, this), 0, 0), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
927
+ function Pn(e, t) {
928
+ x(An, this).width = e * x(jn, this), x(An, this).height = t * x(jn, this), x(M, this).setTransform(x(jn, this), 0, 0, x(jn, this), 0, 0), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
920
929
  }
921
- function Pn() {
930
+ function Fn() {
922
931
  x(M, this).fillStyle = "white", x(M, this).textAlign = "left", x(M, this).textBaseline = "top", x(M, this).font = `${this.config.fontSize} sans-serif`;
923
932
  }
924
- function Fn(e, t) {
933
+ function In(e, t) {
925
934
  let n = [], r = e.split(" "), i = "";
926
935
  for (; r.length > 0;) {
927
- b(jn, this, Pn).call(this);
936
+ b(Mn, this, Fn).call(this);
928
937
  let e = 0;
929
938
  for (; x(M, this).measureText(i + (i.length > 0 ? " " : "") + r[0]).width + this.config.textPadding * 2 <= t && r.length > 0;) e++, i += (i.length > 0 ? " " : "") + r.shift();
930
939
  if (e === 0) {
@@ -937,10 +946,6 @@ function Fn(e, t) {
937
946
  }
938
947
  //#endregion
939
948
  //#region ../../libs/canvas-renderers/src/subtitleLayout.ts
940
- function In(e, t) {
941
- let n = t * .05, r = e * .035;
942
- return `${Math.max(Math.round(Math.min(n, r)), 16)}px`;
943
- }
944
949
  function Ln(e) {
945
950
  var t;
946
951
  let { subtitleWidth: n, subtitleHeight: r, canvasWidth: i, canvasHeight: a, containerWidth: o, bottomPadding: s } = e, c = (t = e.baseMargin) == null ? 20 : t, l = i / o, u = n * l, d = r * l;
@@ -975,7 +980,7 @@ var zn = {
975
980
  }), e(this, "unload", () => {
976
981
  this.context = null, this.subtitleRenderer = null, this.hasActiveSubtitles = !1, this.setSize(zn);
977
982
  }), e(this, "setActiveCues", (e, t) => {
978
- this.subtitleRenderer || (this.subtitleRenderer = new Mn()), this.subtitleRenderer.config.fontSize = In(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t), this.hasActiveSubtitles = e.length > 0;
983
+ this.subtitleRenderer || (this.subtitleRenderer = new Nn()), this.subtitleRenderer.config.fontSize = sn(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t), this.hasActiveSubtitles = e.length > 0;
979
984
  }), e(this, "render", (e, t = 0) => {
980
985
  if (!this.context) return;
981
986
  if (!e.videoFrame) {
@@ -1007,7 +1012,7 @@ var zn = {
1007
1012
  this.context.drawImage(t, i.x, i.y, i.drawWidth, i.drawHeight);
1008
1013
  }), e(this, "setSize", (e) => {
1009
1014
  e.width === this.size.width && e.height === this.size.height || (this.size = e, this.canvas.width = e.width, this.canvas.height = e.height, this.context && (this.context.fillStyle = "#000", this.context.fillRect(0, 0, e.width, e.height)));
1010
- }), En(this.canvas);
1015
+ }), Dn(this.canvas);
1011
1016
  }
1012
1017
  }, Vn = "\nprecision mediump float;\nuniform sampler2D texture;\n\nvarying vec2 texture_coordinate;\n\nvoid main() {\n float y = texture2D(texture, texture_coordinate).r;\n float a = texture2D(texture, texture_coordinate).a;\n\n gl_FragColor = vec4(y, y, y, a);\n}\n", Hn = "\n attribute vec2 position;\n varying vec2 texture_coordinate;\n uniform mat4 model;\n\n void main() {\n texture_coordinate = position;\n gl_Position = model * vec4(position, 0.0, 1.0);\n }\n", Un = (e, t) => {
1013
1018
  let n = e.getContext("webgl", t);
@@ -1060,7 +1065,7 @@ var zn = {
1060
1065
  return r;
1061
1066
  }, N = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Xn = /* @__PURE__ */ new WeakMap(), Zn = /* @__PURE__ */ new WeakMap(), Qn = /* @__PURE__ */ new WeakSet(), $n = /* @__PURE__ */ new WeakMap(), er = class {
1062
1067
  constructor(t) {
1063
- C(this, Qn), y(this, N, void 0), y(this, Jn, void 0), y(this, Yn, void 0), y(this, Xn, void 0), y(this, Zn, void 0), e(this, "subtitleRenderer", new Mn()), y(this, $n, (e, t, n, r) => [
1068
+ C(this, Qn), y(this, N, void 0), y(this, Jn, void 0), y(this, Yn, void 0), y(this, Xn, void 0), y(this, Zn, void 0), e(this, "subtitleRenderer", new Nn()), y(this, $n, (e, t, n, r) => [
1064
1069
  e,
1065
1070
  0,
1066
1071
  0,
@@ -1080,7 +1085,7 @@ var zn = {
1080
1085
  ]), S(N, this, t), S(Jn, this, Gn(t)), S(Yn, this, Wn(t, t.FRAGMENT_SHADER, Vn)), S(Xn, this, Wn(t, t.VERTEX_SHADER, Hn)), S(Zn, this, qn(t, x(Xn, this), x(Yn, this)));
1081
1086
  }
1082
1087
  setActiveCues(e, t) {
1083
- this.subtitleRenderer.config.fontSize = In(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
1088
+ this.subtitleRenderer.config.fontSize = sn(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
1084
1089
  }
1085
1090
  render(e) {
1086
1091
  let t = this.subtitleRenderer.canvas;
@@ -1199,7 +1204,7 @@ var rr = "\nprecision mediump float;\nuniform sampler2D y_texture;\nuniform samp
1199
1204
  1,
1200
1205
  0,
1201
1206
  1
1202
- ]), this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), En(this.canvas);
1207
+ ]), this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), Dn(this.canvas);
1203
1208
  }
1204
1209
  getTextRenderer() {
1205
1210
  return this.textRenderer || (this.textRenderer = new er(this.context)), this.textRenderer;
@@ -3444,10 +3449,10 @@ function us(e) {
3444
3449
  var ds = (e) => {
3445
3450
  let t = window;
3446
3451
  t.vindralInstances = t.vindralInstances || {}, t.vindralInstances[e.getStatistics().clientId.substring(0, 8)] = e;
3447
- }, fs = class extends ge {
3448
- constructor({ type: n, autoplay: r, muted: i, volume: a, logger: s, poster: c }) {
3449
- var l;
3450
- super(), l = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new v(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new j()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "addEventListeners", () => {
3452
+ }, fs = class n extends ge {
3453
+ constructor({ type: r, autoplay: i, muted: a, volume: s, logger: c, poster: l }) {
3454
+ var u;
3455
+ super(), u = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new v(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "lastPlayableAt", void 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new j()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "addEventListeners", () => {
3451
3456
  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.onWaiting), 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);
3452
3457
  }), e(this, "removeEventListeners", () => {
3453
3458
  this.element.removeEventListener("stalled", this.onEvent), this.element.removeEventListener("canplay", this.onEvent), this.element.removeEventListener("loadeddata", this.onEvent), this.element.removeEventListener("loadedmetadata", this.onEvent), this.element.removeEventListener("canplaythrough", this.onEvent), this.element.removeEventListener("waiting", this.onWaiting), this.element.removeEventListener("playing", this.onPlayPause), this.element.removeEventListener("pause", this.onPlayPause), this.element.removeEventListener("seeked", this.onSeekEnd), this.element.removeEventListener("seeking", this.onSeekStart), this.element.removeEventListener("volumechange", this.onVolumeChange), this.element.removeEventListener("timeupdate", this.onBufferStateChange), this.element.removeEventListener("progress", this.onBufferStateChange);
@@ -3459,12 +3464,10 @@ var ds = (e) => {
3459
3464
  }), e(this, "attach", (e) => {
3460
3465
  this.element.remove(), e.appendChild(this.element);
3461
3466
  }), e(this, "load", () => {
3462
- this.timers.setInterval(this.onPlayPause, 500), this.timers.setTimeout(() => {
3463
- this.timers.setInterval(this.onBufferStateChange, 500);
3464
- }, 1e4);
3467
+ this.timers.setInterval(this.onPlayPause, 500), this.onBufferStateChange(), this.timers.setInterval(this.onBufferStateChange, 500);
3465
3468
  }), e(this, "unload", () => {
3466
3469
  this.timers.unload(), this.removeEventListeners();
3467
- }), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA ? "playing" : "buffering"), e(this, "getMediaElementState", () => this.element.paused ? "paused" : "playing"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
3470
+ }), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA || this.element.seeking && this.lastPlayableAt !== void 0 && performance.now() - this.lastPlayableAt < n.SEEK_SETTLE_BUDGET_MS ? "playing" : "buffering"), e(this, "getMediaElementState", () => this.element.paused ? "paused" : "playing"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
3468
3471
  let e = [], t = this.element.buffered;
3469
3472
  if (!t) return [];
3470
3473
  for (let n = 0; n < t.length; n++) e.push({
@@ -3489,16 +3492,16 @@ var ds = (e) => {
3489
3492
  });
3490
3493
  }), e(this, "_play", t(function* () {
3491
3494
  try {
3492
- yield l.element.play(), l._userHasProvidedInput = !l.muted || l._userProvidedMuted;
3495
+ yield u.element.play(), u._userHasProvidedInput = !u.muted || u._userProvidedMuted;
3493
3496
  } catch (e) {
3494
- if (e instanceof Error && e.name === "NotAllowedError") if (l._userHasProvidedInput = !1, l.element.muted) l.emit("needs user input", {
3497
+ if (e instanceof Error && e.name === "NotAllowedError") if (u._userHasProvidedInput = !1, u.element.muted) u.emit("needs user input", {
3495
3498
  forAudio: !0,
3496
3499
  forVideo: !0
3497
3500
  });
3498
- else return l.element.muted = !0, l.emit("needs user input", {
3501
+ else return u.element.muted = !0, u.emit("needs user input", {
3499
3502
  forAudio: !0,
3500
3503
  forVideo: !1
3501
- }), l._play();
3504
+ }), u._play();
3502
3505
  else throw e;
3503
3506
  }
3504
3507
  })), e(this, "onEvent", (e) => {
@@ -3519,7 +3522,7 @@ var ds = (e) => {
3519
3522
  });
3520
3523
  }), e(this, "onPlayPause", () => {
3521
3524
  this._isPaused !== this.element.paused && (this._isPaused = this.element.paused, this.logger.info("player pause change", { paused: this.element.paused }), this.emit("media element state", this.getMediaElementState()));
3522
- }), e(this, "getBufferState", () => ({
3525
+ }), e(this, "getBufferState", () => (this.element.readyState >= this.element.HAVE_FUTURE_DATA && !this.element.seeking && (this.lastPlayableAt = performance.now()), {
3523
3526
  isPaused: this.element.paused,
3524
3527
  buffered: this.getBuffer(),
3525
3528
  currentTime: this.currentTime,
@@ -3532,8 +3535,8 @@ var ds = (e) => {
3532
3535
  if (!this.seekStartTime) return;
3533
3536
  let e = performance.now() - this.seekStartTime;
3534
3537
  this.seekTimes.push(e), this._totalSeekTime += e, this.seekStartTime = void 0;
3535
- }), this.logger = s, this._userProvidedMuted = i, this.element = document.createElement(n), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = r, this.element.muted = i, a !== void 0 && (this.element.volume = a), this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute("poster", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg=="), this.onPlayPause(), setTimeout(() => {
3536
- !this.element || !c || this.element.setAttribute("poster", c);
3538
+ }), this.logger = c, this._userProvidedMuted = a, this.element = document.createElement(r), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = i, this.element.muted = a, s !== void 0 && (this.element.volume = s), this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute("poster", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg=="), this.onPlayPause(), setTimeout(() => {
3539
+ !this.element || !l || this.element.setAttribute("poster", l);
3537
3540
  }, 0), this.addEventListeners();
3538
3541
  }
3539
3542
  get seekTime() {
@@ -3575,7 +3578,11 @@ var ds = (e) => {
3575
3578
  get isPaused() {
3576
3579
  return this._isPaused;
3577
3580
  }
3578
- }, ps = (e) => {
3581
+ };
3582
+ e(fs, "SEEK_SETTLE_BUDGET_MS", 1e3);
3583
+ //#endregion
3584
+ //#region ../../libs/web-sdk/src/mediaCapabilities.ts
3585
+ var ps = (e) => {
3579
3586
  if (!navigator.mediaCapabilities) return Promise.resolve({
3580
3587
  smooth: !0,
3581
3588
  supported: !0,
@@ -3584,10 +3591,10 @@ var ds = (e) => {
3584
3591
  });
3585
3592
  if (e.codec === "webvtt") throw Error("WebVTT is not supported");
3586
3593
  let t;
3587
- return t = vn(e) ? {
3594
+ return t = yn(e) ? {
3588
3595
  type: "media-source",
3589
3596
  audio: {
3590
- contentType: yn(e),
3597
+ contentType: bn(e),
3591
3598
  bitrate: e.bitRate,
3592
3599
  channels: e.channels.toString(),
3593
3600
  samplerate: e.sampleRate
@@ -3595,7 +3602,7 @@ var ds = (e) => {
3595
3602
  } : {
3596
3603
  type: "media-source",
3597
3604
  video: {
3598
- contentType: yn(e),
3605
+ contentType: bn(e),
3599
3606
  bitrate: e.bitRate,
3600
3607
  width: e.width,
3601
3608
  height: e.height,
@@ -3986,7 +3993,7 @@ var vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc =
3986
3993
  let n = new Uint8Array(t.data);
3987
3994
  n[0] === x(yc, this) && e.enqueue(n.subarray(1));
3988
3995
  }
3989
- }), x(vc, this).addEventListener("error", () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(vc, this).addEventListener("close", () => fn(() => e.close()));
3996
+ }), x(vc, this).addEventListener("error", () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(vc, this).addEventListener("close", () => pn(() => e.close()));
3990
3997
  }
3991
3998
  cancel(e) {
3992
3999
  x(vc, this).close(void 0, e);
@@ -4008,7 +4015,7 @@ var vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc =
4008
4015
  ]);
4009
4016
  }
4010
4017
  }
4011
- }), S(Cc, this, () => fn(() => e.close())), S(wc, this, () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(xc, this).addEventListener("message", x(Sc, this)), x(xc, this).addEventListener("error", x(wc, this)), x(xc, this).addEventListener("close", x(Cc, this));
4018
+ }), S(Cc, this, () => pn(() => e.close())), S(wc, this, () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(xc, this).addEventListener("message", x(Sc, this)), x(xc, this).addEventListener("error", x(wc, this)), x(xc, this).addEventListener("close", x(Cc, this));
4012
4019
  }
4013
4020
  cancel(e) {
4014
4021
  x(Sc, this) && x(xc, this).removeEventListener("message", x(Sc, this)), x(wc, this) && x(xc, this).removeEventListener("error", x(wc, this)), x(Cc, this) && x(xc, this).removeEventListener("close", x(Cc, this));
@@ -5011,7 +5018,7 @@ var td = class {
5011
5018
  let n = Math.max(0, Date.now() - x(ad, this)), r = Number(e.expires);
5012
5019
  if (r > 0) {
5013
5020
  let e = Math.max(t.minGraceTime, Math.min(r / 10, t.maxGraceTime)), i = Math.min(r - e - n, t.maxTimeout);
5014
- Promise.race([hn(i), this.done().catch(o)]).then(() => x(od, this).resolve(this.expiryState())).catch(o);
5021
+ Promise.race([gn(i), this.done().catch(o)]).then(() => x(od, this).resolve(this.expiryState())).catch(o);
5015
5022
  }
5016
5023
  x(nd, this).resolve(e);
5017
5024
  }
@@ -5593,7 +5600,7 @@ var sf = 2e3, cf = /* @__PURE__ */ new WeakMap(), lf = /* @__PURE__ */ new WeakM
5593
5600
  params: n
5594
5601
  }, [s, c] = Xd(x(uf, r), o);
5595
5602
  if (x(lf, r).update((e) => e.set(i, s)), yield x(uf, r).push(o), !(yield Promise.race([s.state.ok(), x(cf, r).closed()]))) throw Error("Session closed");
5596
- return c.closed().then(() => Promise.race([hn(sf), r.closed()])).then(() => b(ff, r, hf).call(r, c.id)).catch(() => b(ff, r, hf).call(r, c.id)), c;
5603
+ return c.closed().then(() => Promise.race([gn(sf), r.closed()])).then(() => b(ff, r, hf).call(r, c.id)).catch(() => b(ff, r, hf).call(r, c.id)), c;
5597
5604
  } catch (e) {
5598
5605
  throw x(df, r).error("Error 'subscribe'", e), e;
5599
5606
  }
@@ -5701,6 +5708,10 @@ var Tf = class {
5701
5708
  transportType() {
5702
5709
  return x(vf, this).transportType();
5703
5710
  }
5711
+ getStats() {
5712
+ var e, t, n;
5713
+ return (e = (t = (n = x(vf, this)).getStats) == null ? void 0 : t.call(n)) == null ? Promise.resolve(void 0) : e;
5714
+ }
5704
5715
  url() {
5705
5716
  return x(vf, this).url();
5706
5717
  }
@@ -5809,9 +5820,12 @@ function jf() {
5809
5820
  }
5810
5821
  //#endregion
5811
5822
  //#region ../../libs/moq/src/protocol/StreamIdBufferWriter.ts
5812
- var Mf = 128, Nf = /* @__PURE__ */ new WeakMap(), Pf = /* @__PURE__ */ new WeakMap(), Ff = /* @__PURE__ */ new WeakMap(), If = /* @__PURE__ */ new WeakMap(), Lf = /* @__PURE__ */ new WeakMap(), Rf = /* @__PURE__ */ new WeakSet(), zf = class {
5823
+ var Mf = 128;
5824
+ Mf - 1;
5825
+ var Nf = /* @__PURE__ */ new WeakMap(), Pf = /* @__PURE__ */ new WeakMap(), Ff = /* @__PURE__ */ new WeakMap(), If = /* @__PURE__ */ new WeakMap(), Lf = /* @__PURE__ */ new WeakMap(), Rf = /* @__PURE__ */ new WeakSet(), zf = class {
5813
5826
  constructor(e, t, n) {
5814
- C(this, Rf), y(this, Nf, void 0), y(this, Pf, void 0), y(this, Ff, !0), y(this, If, !1), y(this, Lf, void 0), S(Nf, this, e), S(Pf, this, t), S(Lf, this, n);
5827
+ if (C(this, Rf), y(this, Nf, void 0), y(this, Pf, void 0), y(this, Ff, !0), y(this, If, !1), y(this, Lf, void 0), !Number.isInteger(t) || t < 1 || t > 127) throw Error(`Invalid stream ID ${t}: must be an integer in 1..127`);
5828
+ S(Nf, this, e), S(Pf, this, t), S(Lf, this, n);
5815
5829
  }
5816
5830
  writeUnsigned8(e) {
5817
5831
  var n = this;
@@ -5866,7 +5880,7 @@ function Vf(e = !0) {
5866
5880
  //#region ../../libs/moq/src/transport/WebSocketConnection.ts
5867
5881
  var Hf = /* @__PURE__ */ new WeakMap(), Uf = /* @__PURE__ */ new WeakMap(), Wf = /* @__PURE__ */ new WeakMap(), Gf = /* @__PURE__ */ new WeakMap(), Kf = /* @__PURE__ */ new WeakMap(), qf = /* @__PURE__ */ new WeakMap(), Jf = /* @__PURE__ */ new WeakMap(), Yf = /* @__PURE__ */ new WeakSet(), Xf = class {
5868
5882
  constructor(e, t) {
5869
- C(this, Yf), y(this, Hf, void 0), y(this, Uf, void 0), y(this, Wf, void 0), y(this, Gf, void 0), y(this, Kf, /* @__PURE__ */ new Map()), y(this, qf, O.get().createContext("WebSocketConnection")), y(this, Jf, new Set(Array(128).fill(0).map((e, t) => t + 1))), S(Hf, this, e), S(Uf, this, t), S(Wf, this, new ReadableStream(new Tc(e))), x(Hf, this).addEventListener("close", (e) => {
5883
+ C(this, Yf), y(this, Hf, void 0), y(this, Uf, void 0), y(this, Wf, void 0), y(this, Gf, void 0), y(this, Kf, /* @__PURE__ */ new Map()), y(this, qf, O.get().createContext("WebSocketConnection")), y(this, Jf, new Set(Array(127).fill(0).map((e, t) => t + 1))), S(Hf, this, e), S(Uf, this, t), S(Wf, this, new ReadableStream(new Tc(e))), x(Hf, this).addEventListener("close", (e) => {
5870
5884
  x(qf, this).info("WebSocket closed", {
5871
5885
  code: e.code,
5872
5886
  reason: e.reason,
@@ -5993,6 +6007,18 @@ var Qf = /* @__PURE__ */ new WeakMap(), $f = /* @__PURE__ */ new WeakMap(), ep =
5993
6007
  return x(ep, e).pop();
5994
6008
  })();
5995
6009
  }
6010
+ getStats() {
6011
+ var e = this;
6012
+ return t(function* () {
6013
+ let t = x(Qf, e);
6014
+ if (typeof t.getStats != "function") return;
6015
+ let n = yield t.getStats();
6016
+ if (n != null) return {
6017
+ packetsLost: n.packetsLost,
6018
+ packetsSent: n.packetsSent
6019
+ };
6020
+ })();
6021
+ }
5996
6022
  };
5997
6023
  function op() {
5998
6024
  var e = this;
@@ -6080,7 +6106,7 @@ function pp() {
6080
6106
  session: yield up(e),
6081
6107
  transportSelectionReason: void 0
6082
6108
  };
6083
- let t = up(e).catch(() => cp(e)), n = yield Promise.race([t, hn(e.websocketFallbackTimeoutMs)]);
6109
+ let t = up(e).catch(() => cp(e)), n = yield Promise.race([t, gn(e.websocketFallbackTimeoutMs)]);
6084
6110
  return n ? {
6085
6111
  session: n,
6086
6112
  transportSelectionReason: n.transportType() === "websocket" ? "fallback" : void 0
@@ -6947,7 +6973,7 @@ function ih(e) {
6947
6973
  try {
6948
6974
  return yield e();
6949
6975
  } catch (i) {
6950
- if (t === n.catalog().current() && r && (yield Promise.race([r, hn(500)])), t !== n.catalog().current()) return e();
6976
+ if (t === n.catalog().current() && r && (yield Promise.race([r, gn(500)])), t !== n.catalog().current()) return e();
6951
6977
  throw i;
6952
6978
  }
6953
6979
  })();
@@ -7096,7 +7122,7 @@ var Ch = 1e4, wh = /* @__PURE__ */ new WeakMap(), Th = /* @__PURE__ */ new WeakS
7096
7122
  for (;;) {
7097
7123
  let [t, n] = e.value.value();
7098
7124
  try {
7099
- yield Promise.race([gn(Ch, /* @__PURE__ */ Error("Idle timeout")), n]);
7125
+ yield Promise.race([_n(Ch, /* @__PURE__ */ Error("Idle timeout")), n]);
7100
7126
  } catch (e) {
7101
7127
  return e;
7102
7128
  }
@@ -7491,7 +7517,7 @@ var $h = 1e4, Q = /* @__PURE__ */ new WeakMap(), eg = /* @__PURE__ */ new WeakMa
7491
7517
  audioTrack: ne == null ? void 0 : ne.track,
7492
7518
  burstMs: d.burstMs || 0
7493
7519
  }),
7494
- gn($h, /* @__PURE__ */ Error("Timeout waiting for player to start")),
7520
+ _n($h, /* @__PURE__ */ Error("Timeout waiting for player to start")),
7495
7521
  oe
7496
7522
  ]), v = new Tg(_.catalog());
7497
7523
  u.set(bp(h.namespace), v), e.emit("received signal", {
@@ -7519,7 +7545,7 @@ var $h = 1e4, Q = /* @__PURE__ */ new WeakMap(), eg = /* @__PURE__ */ new WeakMa
7519
7545
  function mg() {
7520
7546
  var e = this;
7521
7547
  return t(function* () {
7522
- x(tg, e).transportType() === "websocket" && (yield hn(5e3));
7548
+ x(tg, e).transportType() === "websocket" && (yield gn(5e3));
7523
7549
  var t = !1, n = !1, r;
7524
7550
  try {
7525
7551
  for (var i = U(x($, e).stats()), a; t = !(a = yield i.next()).done; t = !1) {
@@ -7629,7 +7655,7 @@ function bg(e, n) {
7629
7655
  let n = d.value;
7630
7656
  {
7631
7657
  var f;
7632
- let s = bp(n.track.namespace), c = n.track.trackObject.language, l = fe((f = n.track.trackObject.codec) == null ? "" : f), u = n.track.trackObject.codec, d = l ? yn({
7658
+ let s = bp(n.track.namespace), c = n.track.trackObject.language, l = fe((f = n.track.trackObject.codec) == null ? "" : f), u = n.track.trackObject.codec, d = l ? bn({
7633
7659
  codec: l,
7634
7660
  codecString: u
7635
7661
  }) : void 0, ne = !!n.track.trackObject["com.vindral.drm"];
@@ -7644,9 +7670,9 @@ function bg(e, n) {
7644
7670
  drmTransition: a !== void 0 && a !== ne
7645
7671
  };
7646
7672
  t = s, i = c, a = ne;
7647
- let h = p.producerReferenceTime(), ee = x(cg, r).get(n.track.namespace) || 0;
7648
- if (h && performance.now() - ee > 1e3) {
7649
- x(cg, r).set(n.track.namespace, performance.now());
7673
+ let h = p.producerReferenceTime(), ee = x(cg, r).get(n.track.namespace), te = performance.now();
7674
+ if (h && (ee === void 0 || te - ee > 1e3)) {
7675
+ x(cg, r).set(n.track.namespace, te);
7650
7676
  let t = e.wallclock() - h.getTime();
7651
7677
  x(eg, r).debug("timing-info", {
7652
7678
  mediaType: p.mediaType(),
@@ -7719,12 +7745,12 @@ var Sg = /* @__PURE__ */ new WeakMap(), Cg = /* @__PURE__ */ new WeakMap(), wg =
7719
7745
  }
7720
7746
  getAudioTrack(e) {
7721
7747
  if (!e.codec) return;
7722
- let t = x(Cg, this).filter((t) => !(!vn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
7748
+ let t = x(Cg, this).filter((t) => !(!yn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
7723
7749
  return t[t.length - 1];
7724
7750
  }
7725
7751
  getVideoTrack(e) {
7726
7752
  if (!e.codec) return;
7727
- let t = x(Cg, this).filter((t) => !(!_n(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
7753
+ let t = x(Cg, this).filter((t) => !(!vn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
7728
7754
  return t[t.length - 1];
7729
7755
  }
7730
7756
  renditions() {
@@ -7811,7 +7837,7 @@ var Dg = (e, t) => {
7811
7837
  if (i.isConnectInProgress) return i.logger.info("Connect already in progress"), !1;
7812
7838
  if (i.isSuspended) return !1;
7813
7839
  if (i.readyState() !== WebSocket.CLOSED && i.close("new connection in progress"), i.shouldContinueConnecting = !0, i._isConnectInProgress = !0, e && i.options.reconnectDelay > 0) {
7814
- i.logger.info("Waiting for reconnect delay", w({}, i.options)), yield hn(i.options.reconnectDelay);
7840
+ i.logger.info("Waiting for reconnect delay", w({}, i.options)), yield gn(i.options.reconnectDelay);
7815
7841
  let e = yield i.options.reconnectHandler(i.reconnectState);
7816
7842
  if (i.reconnectState.reconnectRetries++, !e) return i._isConnectInProgress = !1, i.emit("error", s()), !1;
7817
7843
  }
@@ -7879,7 +7905,7 @@ var Dg = (e, t) => {
7879
7905
  return;
7880
7906
  }
7881
7907
  let t = JSON.parse(e);
7882
- if (Sn(t)) {
7908
+ if (Cn(t)) {
7883
7909
  if (t.type === "pong") {
7884
7910
  this.handleMessage(e);
7885
7911
  return;
@@ -7917,7 +7943,7 @@ var Dg = (e, t) => {
7917
7943
  if (e instanceof ArrayBuffer) this.emitter.emit("received data", e);
7918
7944
  else {
7919
7945
  let t = JSON.parse(e);
7920
- if (!Sn(t)) return;
7946
+ if (!Cn(t)) return;
7921
7947
  switch (t.type) {
7922
7948
  case "pong":
7923
7949
  this.lastPingSentTime && (this.rtts.push(performance.now() - this.lastPingSentTime), this.isPingInFlight = !1, this.emitter.emit("rtt", Ot(this.rtts.items())));
@@ -8087,7 +8113,7 @@ var Ig = (e) => {
8087
8113
  x(t_, this) !== void 0 && (clearTimeout(x(t_, this)), S(t_, this, void 0));
8088
8114
  }), y(this, c_, function() {
8089
8115
  var e = t(function* (e) {
8090
- return (yield o.config.reconnectHandler({ reconnectRetries: x(Kg, o) })) ? (x(u_, o).call(o) ? (o.logger.info("Reconnect burst detected, applying backoff before retrying"), yield hn(n.RECONNECT_BACKOFF_MS)) : o.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), x(Wg, o)) : (o.emitter.emit("error", s()), !1);
8116
+ return (yield o.config.reconnectHandler({ reconnectRetries: x(Kg, o) })) ? (x(u_, o).call(o) ? (o.logger.info("Reconnect burst detected, applying backoff before retrying"), yield gn(n.RECONNECT_BACKOFF_MS)) : o.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), x(Wg, o)) : (o.emitter.emit("error", s()), !1);
8091
8117
  });
8092
8118
  return function(t) {
8093
8119
  return e.apply(this, arguments);
@@ -8175,12 +8201,12 @@ e(f_, "PING_TIMEOUT", 1e3), e(f_, "RECONNECT_BACKOFF_MS", 1e3), e(f_, "RECONNECT
8175
8201
  //#endregion
8176
8202
  //#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
8177
8203
  var m_, h_ = () => ({
8178
- video: w(w({}, xn()), {}, { bitRate: bn() }),
8179
- audio: { bitRate: bn() }
8204
+ video: w(w({}, Sn()), {}, { bitRate: xn() }),
8205
+ audio: { bitRate: xn() }
8180
8206
  }), g_ = () => ({
8181
8207
  width: window.innerWidth,
8182
8208
  height: window.innerHeight,
8183
- bitRate: bn()
8209
+ bitRate: xn()
8184
8210
  }), __ = class t {
8185
8211
  constructor(n, r, i, a) {
8186
8212
  e(this, "emitter", void 0), e(this, "timers", new j()), e(this, "pictureInPictureSource", void 0), e(this, "element", void 0), e(this, "currentCap", void 0), e(this, "userSpecifiedCap", void 0), e(this, "renditionLevelSource", void 0), e(this, "resizeObserver", void 0), e(this, "elementSize", void 0), e(this, "_sizeBasedResolutionCapEnabled", void 0), e(this, "unload", () => {
@@ -8431,7 +8457,7 @@ var v_ = 5, y_ = 100, b_ = 1e3, x_ = class r {
8431
8457
  break;
8432
8458
  }
8433
8459
  case "video": {
8434
- let { VideoDecoderWorkerContext: n } = yield import("./CLJilV9Y.js"), r = yield n.create(i.createContext("VideoDecoderWorker"), a, c, l, u, d, () => s.currentTime);
8460
+ let { VideoDecoderWorkerContext: n } = yield import("./Bskov1am.js"), r = yield n.create(i.createContext("VideoDecoderWorker"), a, c, l, u, d, () => s.currentTime);
8435
8461
  p = r.isWebCodecs, h = r.usingOffscreenCanvas, t.set(e.type, {
8436
8462
  buffer: [],
8437
8463
  decoderContext: r,
@@ -8627,7 +8653,7 @@ var k_ = 1e3, A_ = 50, j_ = class t {
8627
8653
  var r;
8628
8654
  super(), r = this, e(this, "context", new (M_())()), e(this, "timers", j.create()), e(this, "previousCurrentTime", 0), e(this, "_isStuck", !1), e(this, "mediaStreamDestination", void 0), e(this, "unload", () => (this.timers.unload(), this.context.removeEventListener("statechange", this.onStateChange), this.context.state === "closed" ? Promise.resolve() : this.context.close())), e(this, "createGain", () => this.context.createGain()), e(this, "createBuffer", (e, t, n) => this.context.createBuffer(e, t, n)), e(this, "createBufferSource", () => this.context.createBufferSource()), e(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination)), e(this, "getDefaultDestination", () => this.context.destination), e(this, "createSplitter", () => this.context.createChannelSplitter(2)), e(this, "resume", t(function* () {
8629
8655
  try {
8630
- return yield Promise.race([r.context.resume(), gn(1e3, p())]);
8656
+ return yield Promise.race([r.context.resume(), _n(1e3, p())]);
8631
8657
  } catch (e) {
8632
8658
  throw r.suspend().catch(o), e;
8633
8659
  }
@@ -9820,12 +9846,12 @@ var vv, yv = () => ({
9820
9846
  general: yv()
9821
9847
  }), xv = class {
9822
9848
  constructor(t, n, r) {
9823
- e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", bv()), e(this, "bufferFullness", new v(30)), e(this, "bufferFullnessRegression", void 0), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "targetBufferTime", 0), e(this, "renditionLevelSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasAsserted", !1), e(this, "load", () => {
9824
- this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("target buffer time", this.onTargetBufferTime);
9849
+ e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", bv()), e(this, "bufferFullness", new v(30)), e(this, "bufferFullnessRegression", void 0), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "targetBufferTime", 0), e(this, "renditionLevelSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasPlayedInSession", !1), e(this, "hasAsserted", !1), e(this, "load", () => {
9850
+ this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("target buffer time", this.onTargetBufferTime), this.emitter.on("connection state", this.onConnectionState);
9825
9851
  }), e(this, "unload", () => {
9826
- this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("target buffer time", this.onTargetBufferTime), this.suspend();
9852
+ this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("target buffer time", this.onTargetBufferTime), this.emitter.off("connection state", this.onConnectionState), this.suspend();
9827
9853
  }), e(this, "suspend", () => {
9828
- this.isSuspended = !0, this.timers.unload(), this.stopBuffering(), this.unsetActive();
9854
+ this.isSuspended = !0, this.timers.unload(), this.stopBuffering(), this.unsetActive(), this.hasPlayedInSession = !1;
9829
9855
  }), e(this, "unsuspend", () => {
9830
9856
  this.isSuspended = !1, this.currentLevel && this.setActive();
9831
9857
  }), e(this, "fatalQosGraceTime", () => 1e4 * (this.fatalQosCount + 1)), e(this, "incrementFatalQosCount", () => {
@@ -9835,10 +9861,10 @@ var vv, yv = () => ({
9835
9861
  let a = ((t = (n = e.video) == null ? void 0 : n.bitRate) == null ? 0 : t) + ((r = (i = e.audio) == null ? void 0 : i.bitRate) == null ? 0 : r);
9836
9862
  return this.metrics.levels[a];
9837
9863
  }), e(this, "getBufferFullnessRegression", () => this.bufferFullnessRegression), e(this, "getTargetBufferTime", () => this.targetBufferTime), e(this, "activeRatios", () => {
9838
- let e = /* @__PURE__ */ new Map(), t = un(this.metrics.general.activeRanges);
9864
+ let e = /* @__PURE__ */ new Map(), t = dn(this.metrics.general.activeRanges);
9839
9865
  if (Object.entries(this.metrics.levels).forEach(([n, r]) => {
9840
9866
  var i;
9841
- let a = parseInt(n, 10), o = t ? un(r.activeRanges) / t : 0, s = this.getQualityIndex(a).toString();
9867
+ let a = parseInt(n, 10), o = t ? dn(r.activeRanges) / t : 0, s = this.getQualityIndex(a).toString();
9842
9868
  e.set(s, ((i = e.get(s)) == null ? 0 : i) + o);
9843
9869
  }), !this.hasAsserted) {
9844
9870
  let t = e.size ? Math.abs(Array.from(e.values()).reduce((e, t) => e + t, 0) - 1) <= .02 : !0;
@@ -9846,17 +9872,17 @@ var vv, yv = () => ({
9846
9872
  }
9847
9873
  return e;
9848
9874
  }), e(this, "bufferingRatios", () => {
9849
- let e = /* @__PURE__ */ new Map(), t = un(this.metrics.general.bufferingRanges);
9875
+ let e = /* @__PURE__ */ new Map(), t = dn(this.metrics.general.bufferingRanges);
9850
9876
  if (Object.entries(this.metrics.levels).forEach(([n, r]) => {
9851
9877
  var i;
9852
- let a = parseInt(n, 10), o = t ? un(r.bufferingRanges) / t : 0, s = this.getQualityIndex(a).toString();
9878
+ let a = parseInt(n, 10), o = t ? dn(r.bufferingRanges) / t : 0, s = this.getQualityIndex(a).toString();
9853
9879
  e.set(s, ((i = e.get(s)) == null ? 0 : i) + o);
9854
9880
  }), !this.hasAsserted) {
9855
9881
  let t = Array.from(e.values()).reduce((e, t) => e + t, 0) <= 1;
9856
9882
  t || (this.hasAsserted = !0, console.assert(t, `Buffering ratios should be less than 1 - actual: ${Array.from(e.values()).reduce((e, t) => e + t, 0)}`));
9857
9883
  }
9858
9884
  return e;
9859
- }), e(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= performance.now() - e).length), e(this, "timeSpentBufferingLast", (e) => dn(this.metrics.general.bufferingRanges, e)), e(this, "timeSpentActiveLast", (e) => dn(this.metrics.general.activeRanges, e)), e(this, "timeSpentPlayingInAtLeastLevelRatio", (e) => {
9885
+ }), e(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= performance.now() - e).length), e(this, "timeSpentBufferingLast", (e) => fn(this.metrics.general.bufferingRanges, e)), e(this, "timeSpentActiveLast", (e) => fn(this.metrics.general.activeRanges, e)), e(this, "timeSpentPlayingInAtLeastLevelRatio", (e) => {
9860
9886
  var t, n, r, i;
9861
9887
  let a = this.timeSpentBuffering(), o = this.timeActive(), s = this.bufferingRatios(), c = this.activeRatios(), l = ((t = (n = e.video) == null ? void 0 : n.bitRate) == null ? 0 : t) + ((r = (i = e.audio) == null ? void 0 : i.bitRate) == null ? 0 : r), u = a / o;
9862
9888
  return Object.keys(this.metrics.levels).map((e) => parseInt(e, 10)).filter((e) => e >= l).reduce((e, t) => {
@@ -9864,7 +9890,7 @@ var vv, yv = () => ({
9864
9890
  let i = this.getQualityIndex(t).toString();
9865
9891
  return ((n = c.get(i)) == null ? 0 : n) - ((r = s.get(i)) == null ? 0 : r) * u + e;
9866
9892
  }, 0);
9867
- }), e(this, "timeSpentBuffering", () => un(this.metrics.general.bufferingRanges)), e(this, "timeActive", () => un(this.metrics.general.activeRanges)), e(this, "getStatistics", () => {
9893
+ }), e(this, "timeSpentBuffering", () => dn(this.metrics.general.bufferingRanges)), e(this, "timeActive", () => dn(this.metrics.general.activeRanges)), e(this, "getStatistics", () => {
9868
9894
  let e = this.timeSpentBuffering(), t = this.timeActive(), n = this.metrics.general.bufferingRanges.length, r = this.activeRatios(), i = t / 6e4, a = t > 0 ? e / t : 0, o = Math.max(i, 1), s = i > 0 ? n / o : 0, c = [...r].reduce((e, [t, n]) => e + parseInt(t, 10) * n, 0), l = 6e4, u = this.timeSpentActiveLast(l), d = this.timeSpentBufferingLast(l), f = u > 0 ? d / u : 0, p = this.metrics.general.upgradesFromLevel.length + this.metrics.general.downgradesFromLevel.length, m = i > 0 ? p / o : 0, h = n > 0 ? e / n : 0;
9869
9895
  return {
9870
9896
  timeSpentBuffering: e,
@@ -9889,14 +9915,14 @@ var vv, yv = () => ({
9889
9915
  if (e.from) {
9890
9916
  var f;
9891
9917
  let e = (f = this.metrics.levels[l]) == null ? yv() : f;
9892
- l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), cn(e.activeRanges);
9918
+ l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), ln(e.activeRanges);
9893
9919
  let t = e.bufferingRanges[e.bufferingRanges.length - 1];
9894
- d = !!t && !t.end, cn(e.bufferingRanges), this.metrics.levels[l] = e;
9920
+ d = !!t && !t.end, ln(e.bufferingRanges), this.metrics.levels[l] = e;
9895
9921
  }
9896
9922
  if (e.to) {
9897
9923
  var p;
9898
9924
  let e = (p = this.metrics.levels[u]) == null ? yv() : p;
9899
- ln(e.activeRanges), d && ln(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
9925
+ un(e.activeRanges), d && un(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
9900
9926
  }
9901
9927
  }), e(this, "onBufferFullness", (e) => {
9902
9928
  this.bufferFullness.push(e), this.metrics.bufferFullness = e, this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression && (this.bufferFullnessRegression = this.calculateLinearRegression());
@@ -9906,12 +9932,14 @@ var vv, yv = () => ({
9906
9932
  currentLevel: this.currentLevel
9907
9933
  }), e) {
9908
9934
  case "playing":
9909
- this.stopBuffering();
9935
+ this.hasPlayedInSession = !0, this.stopBuffering();
9910
9936
  break;
9911
9937
  case "buffering":
9912
- this.isSuspended || this.startBuffering();
9938
+ !this.isSuspended && this.hasPlayedInSession && this.startBuffering();
9913
9939
  break;
9914
9940
  }
9941
+ }), e(this, "onConnectionState", (e) => {
9942
+ e !== "connected" && this.isSuspended && (this.hasPlayedInSession = !1);
9915
9943
  }), e(this, "onVideoDecodeRate", (e) => {
9916
9944
  var t;
9917
9945
  if (this.metrics.general.decodeRate = e, !this.currentLevel) return;
@@ -9925,21 +9953,21 @@ var vv, yv = () => ({
9925
9953
  })))), e(this, "stopBuffering", () => {
9926
9954
  if (this.currentLevel) {
9927
9955
  let e = this.metrics.levels[this.currentLevel];
9928
- e && cn(e.bufferingRanges);
9956
+ e && ln(e.bufferingRanges);
9929
9957
  }
9930
- cn(this.metrics.general.bufferingRanges);
9958
+ ln(this.metrics.general.bufferingRanges);
9931
9959
  }), e(this, "startBuffering", () => {
9932
9960
  if (this.currentLevel) {
9933
9961
  let e = this.metrics.levels[this.currentLevel];
9934
- e && ln(e.bufferingRanges);
9962
+ e && un(e.bufferingRanges);
9935
9963
  }
9936
- ln(this.metrics.general.bufferingRanges);
9964
+ un(this.metrics.general.bufferingRanges);
9937
9965
  }), e(this, "unsetActive", () => {
9938
9966
  if (this.currentLevel) {
9939
9967
  let e = this.metrics.levels[this.currentLevel];
9940
- e && cn(e.activeRanges);
9968
+ e && ln(e.activeRanges);
9941
9969
  }
9942
- cn(this.metrics.general.activeRanges);
9970
+ ln(this.metrics.general.activeRanges);
9943
9971
  }), e(this, "getQualityIndex", (e) => {
9944
9972
  if (!this.qualityIndexOrder.length) {
9945
9973
  var t, n;
@@ -9959,9 +9987,9 @@ var vv, yv = () => ({
9959
9987
  setActive() {
9960
9988
  if (this.currentLevel) {
9961
9989
  let e = this.metrics.levels[this.currentLevel];
9962
- e && ln(e.activeRanges);
9990
+ e && un(e.activeRanges);
9963
9991
  }
9964
- ln(this.metrics.general.activeRanges);
9992
+ un(this.metrics.general.activeRanges);
9965
9993
  }
9966
9994
  };
9967
9995
  vv = xv, e(xv, "create", (e, t, n) => new vv(e, t, n));
@@ -9981,16 +10009,16 @@ var Sv, Cv = class {
9981
10009
  this.renditions.set(e, t);
9982
10010
  }), e(this, "getLanguages", () => this.languages), e(this, "getVideoRendition", (e, t = this.getCurrentSubscription().channelId) => {
9983
10011
  let n = this.getRendition(e, t);
9984
- if (n && _n(n)) return n;
10012
+ if (n && vn(n)) return n;
9985
10013
  }), e(this, "getAudioRenditions", (e) => {
9986
10014
  let t = this.renditions.get(e);
9987
- return t == null ? void 0 : t.filter((e) => vn(e));
10015
+ return t == null ? void 0 : t.filter((e) => yn(e));
9988
10016
  }), e(this, "getVideoRenditions", (e) => {
9989
10017
  let t = this.renditions.get(e);
9990
- return t == null ? void 0 : t.filter((e) => _n(e));
10018
+ return t == null ? void 0 : t.filter((e) => vn(e));
9991
10019
  }), e(this, "getAudioRendition", (e, t = this.getCurrentSubscription().channelId) => {
9992
10020
  let n = this.getRendition(e, t);
9993
- if (n && vn(n)) return n;
10021
+ if (n && yn(n)) return n;
9994
10022
  }), e(this, "getRendition", (e, t = this.getCurrentSubscription().channelId) => {
9995
10023
  var n;
9996
10024
  return (n = this.renditions.get(t)) == null ? void 0 : n.find((t) => t.id === e);
@@ -10030,7 +10058,7 @@ var Sv, Cv = class {
10030
10058
  }));
10031
10059
  }), e(this, "createRenditionLevels", (e) => {
10032
10060
  var t;
10033
- let { video: n, audio: r, channelId: i } = e, a = (t = this.renditions.get(i)) == null ? [] : t, o = a.filter(_n).filter((e) => n && e.codec === n.codec), s = a.filter(vn).filter((e) => r && e.codec === r.codec && e.language === r.language), c = Math.max(o.length, s.length), l = [];
10061
+ let { video: n, audio: r, channelId: i } = e, a = (t = this.renditions.get(i)) == null ? [] : t, o = a.filter(vn).filter((e) => n && e.codec === n.codec), s = a.filter(yn).filter((e) => r && e.codec === r.codec && e.language === r.language), c = Math.max(o.length, s.length), l = [];
10034
10062
  for (let e = 0; e < c; e++) {
10035
10063
  let t = o[Math.min(o.length - 1, e)], n = s[Math.min(s.length - 1, e)];
10036
10064
  l.push({
@@ -10671,7 +10699,7 @@ var Uv = class {
10671
10699
  }
10672
10700
  return "wasm";
10673
10701
  }, Xv = (e, t, n) => {
10674
- if (_n(t)) return w(w({}, e), {}, {
10702
+ if (vn(t)) return w(w({}, e), {}, {
10675
10703
  type: "video",
10676
10704
  codec: t.codec,
10677
10705
  isSync: Jo(e.flags),
@@ -10801,10 +10829,10 @@ var Uv = class {
10801
10829
  return this.inFlight.set(e, o), o;
10802
10830
  }), this.logger = n;
10803
10831
  }
10804
- }, sy = /* @__PURE__ */ new WeakMap(), cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), uy = class n extends ge {
10832
+ }, sy = 1e4, cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), uy = /* @__PURE__ */ new WeakMap(), dy = class n extends ge {
10805
10833
  constructor(r) {
10806
10834
  var i, a;
10807
- super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ge()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", mn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new xe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new pn()), e(this, "encryptedMediaExtensions", void 0), y(this, sy, 0), y(this, cy, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "disconnectTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), y(this, ly, void 0), e(this, "attach", (e) => {
10835
+ super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ge()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", hn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new xe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new mn()), e(this, "encryptedMediaExtensions", void 0), y(this, cy, 0), y(this, ly, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "disconnectTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), y(this, uy, void 0), e(this, "attach", (e) => {
10808
10836
  var t;
10809
10837
  (t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
10810
10838
  }), e(this, "setElement", (e) => {
@@ -10847,7 +10875,7 @@ var Uv = class {
10847
10875
  })), e(this, "onConnectInfo", function() {
10848
10876
  var e = t(function* (e) {
10849
10877
  var n;
10850
- i.sessionId = mn();
10878
+ i.sessionId = hn();
10851
10879
  let r = i.modules.subscription.getTargetSubscription(), a = e.channels.find((e) => e.channelId === r.channelId);
10852
10880
  if (i.emitter.emit("connect info", e), "timeshift" in e && e.timeshift ? (e.timeshift, i._channels = e.channels.map((t) => w(w({}, t), {}, { timeshift: e.timeshift })), i.emit("timeshift info", e.timeshift)) : i._channels = e.channels, i.updateTextTracks((n = a == null ? void 0 : a.renditions) == null ? [] : n), !i.textTrack && i.options.get("textTrack") && (i.textTrack = i.options.get("textTrack")), yield Promise.all(e.channels.map(function() {
10853
10881
  var e = t(function* (e) {
@@ -10887,31 +10915,31 @@ var Uv = class {
10887
10915
  }), e(this, "updateTextTracks", (e) => {
10888
10916
  let t = e.filter((e) => e.codec === "webvtt");
10889
10917
  t.forEach((e) => {
10890
- if (!x(cy, this).find((t) => t.language === e.language)) {
10918
+ if (!x(ly, this).find((t) => t.language === e.language)) {
10891
10919
  if (this.modules.canvasModule) {
10892
10920
  let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
10893
- x(cy, this).push(t);
10921
+ x(ly, this).push(t);
10894
10922
  } else if (this.mediaElement instanceof HTMLVideoElement) {
10895
10923
  let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
10896
- x(cy, this).push(t);
10924
+ x(ly, this).push(t);
10897
10925
  }
10898
10926
  }
10899
10927
  });
10900
- for (let e of x(cy, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
10928
+ for (let e of x(ly, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
10901
10929
  this.emit("text tracks", this.textTracks);
10902
10930
  }), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
10903
- x(cy, this).forEach((t) => {
10931
+ x(ly, this).forEach((t) => {
10904
10932
  if (t.cues) for (let n of t.cues) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
10905
10933
  });
10906
10934
  }), e(this, "filterRenditions", function() {
10907
10935
  var e = t(function* (e) {
10908
10936
  let n = yield Promise.all(e.map(function() {
10909
10937
  var e = t(function* (e) {
10910
- if (vn(e)) {
10938
+ if (yn(e)) {
10911
10939
  var t;
10912
- return i.willUseMediaSource() && !((t = Be()) != null && t.isTypeSupported(yn(e))) ? !1 : i.willUseMediaSource() || e.codec === "opus" ? !0 : i.isWebCodecsAudioAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkAudioSupport(e) : !1;
10940
+ return i.willUseMediaSource() && !((t = Be()) != null && t.isTypeSupported(bn(e))) ? !1 : i.willUseMediaSource() || e.codec === "opus" ? !0 : i.isWebCodecsAudioAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkAudioSupport(e) : !1;
10913
10941
  }
10914
- if (!_n(e) || !i.isSupportedVideoCodecProfile(e.codec, e.codecString)) return !1;
10942
+ if (!vn(e) || !i.isSupportedVideoCodecProfile(e.codec, e.codecString)) return !1;
10915
10943
  if (!i.willUseMediaSource()) return i.isWebCodecsVideoAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkVideoSupport(e) : !0;
10916
10944
  let n = yield ps(e);
10917
10945
  if (!n.supported) return !1;
@@ -10932,7 +10960,7 @@ var Uv = class {
10932
10960
  a.length > 0 && i.logger.debug("unsupported renditions filtered out", { renditions: a.map((e) => w(w({
10933
10961
  codec: e.codec,
10934
10962
  codecString: e.codecString
10935
- }, _n(e) ? {
10963
+ }, vn(e) ? {
10936
10964
  width: e.width,
10937
10965
  height: e.height
10938
10966
  } : {}), {}, { bitRate: e.bitRate })) });
@@ -10951,7 +10979,7 @@ var Uv = class {
10951
10979
  }), r = r.filter((e) => e.codec !== "av1")), i.logger.debug("supported renditions", { renditions: r.map((e) => w(w({
10952
10980
  codec: e.codec,
10953
10981
  codecString: e.codecString
10954
- }, _n(e) ? {
10982
+ }, vn(e) ? {
10955
10983
  width: e.width,
10956
10984
  height: e.height
10957
10985
  } : {}), {}, { bitRate: e.bitRate })) }), r;
@@ -10960,7 +10988,7 @@ var Uv = class {
10960
10988
  return e.apply(this, arguments);
10961
10989
  };
10962
10990
  }()), e(this, "patchSubscription", (e, t) => {
10963
- let n = this.options.get("maxInitialBitRate"), r = Math.min(this.options.get("maxVideoBitRate"), n, t, this.targetSubscription.video.bitRate), i = Math.min(this.options.get("maxAudioBitRate"), n, t, this.targetSubscription.audio.bitRate), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), o = this.supportedAudioCodecs(), s = e.renditions.filter(vn), c = e.renditions.filter(_n), l = o.find((e) => s.find((t) => t.codec === e) !== void 0), u = a.find((e) => c.find((t) => t.codec === e) !== void 0), d = s.map((e) => e.language);
10991
+ let n = this.options.get("maxInitialBitRate"), r = Math.min(this.options.get("maxVideoBitRate"), n, t, this.targetSubscription.video.bitRate), i = Math.min(this.options.get("maxAudioBitRate"), n, t, this.targetSubscription.audio.bitRate), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), o = this.supportedAudioCodecs(), s = e.renditions.filter(yn), c = e.renditions.filter(vn), l = o.find((e) => s.find((t) => t.codec === e) !== void 0), u = a.find((e) => c.find((t) => t.codec === e) !== void 0), d = s.map((e) => e.language);
10964
10992
  if (this.logger.debug("supported and selected codecs", {
10965
10993
  audioCodecs: o,
10966
10994
  videoCodecs: a,
@@ -10990,7 +11018,7 @@ var Uv = class {
10990
11018
  }), e(this, "isSupportedVideoCodecProfile", (e, t) => {
10991
11019
  if (this.willUseMediaSource()) {
10992
11020
  let n = Be();
10993
- return n ? n.isTypeSupported(yn({
11021
+ return n ? n.isTypeSupported(bn({
10994
11022
  codec: e,
10995
11023
  codecString: t
10996
11024
  })) : !0;
@@ -11014,12 +11042,12 @@ var Uv = class {
11014
11042
  });
11015
11043
  if (t != null && t.video && n.push({
11016
11044
  type: "video",
11017
- mimeType: yn(t.video),
11045
+ mimeType: bn(t.video),
11018
11046
  codec: t.video.codec
11019
11047
  }), t != null && t.audio && n.push({
11020
11048
  type: "audio",
11021
11049
  codec: t.audio.codec,
11022
- mimeType: yn(t.audio),
11050
+ mimeType: bn(t.audio),
11023
11051
  channels: t.audio.channels,
11024
11052
  sampleRate: t.audio.sampleRate
11025
11053
  }), n.length === 0) throw new g("Can't initialize decoding module without tracks", {
@@ -11033,7 +11061,7 @@ var Uv = class {
11033
11061
  }
11034
11062
  let a = i.shouldUseWebCodecs(i.channelId), o = i.options.get("webcodecsHardwareAcceleration", i.channelId), s = i.shouldUseOffscreenCanvas(i.channelId) && a, c = typeof OffscreenCanvas < "u" && typeof HTMLCanvasElement < "u" && typeof HTMLCanvasElement.prototype.transferControlToOffscreen == "function", l = s && c && typeof VideoDecoder < "u", u, d;
11035
11063
  if (l) try {
11036
- d = document.createElement("canvas"), En(d), u = d.transferControlToOffscreen();
11064
+ d = document.createElement("canvas"), Dn(d), u = d.transferControlToOffscreen();
11037
11065
  } catch (e) {
11038
11066
  u = void 0, d = void 0, i.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
11039
11067
  }
@@ -11079,7 +11107,7 @@ var Uv = class {
11079
11107
  ds(this);
11080
11108
  }), e(this, "play", () => {
11081
11109
  var e;
11082
- this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play();
11110
+ this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && this.playbackSource.isActivated && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play();
11083
11111
  }), e(this, "getStatistics", () => {
11084
11112
  let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? w(w({}, e), t.getStatistics()) : e, this.getRuntimeInfo()), t = Math.round(this.timeActive > 0 ? (e.bytesReceived || 0) * 8 / (this.timeActive / 1e3) : 0), n = this.uptime / 36e5, r = Math.max(0, (e.connectCount || 0) - 1), i = n > 0 ? r / n : 0, a = this.timeActive / 6e4, o = Math.max(a, 1), s = a > 0 ? (e.seekAdjustmentCount || 0) / o : 0, c = a > 0 ? (e.timeshiftAdjustmentCount || 0) / o : 0;
11085
11113
  return ty(w(w({}, e), {}, {
@@ -11091,12 +11119,12 @@ var Uv = class {
11091
11119
  }), e(this, "resetModules", () => {
11092
11120
  Object.values(this.modules).forEach((e) => {
11093
11121
  e && "reset" in e && e.reset();
11094
- }), this.sampleProcessingSesssions.clear(), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
11122
+ }), this.playbackSource instanceof fs && this.modules.adaptivity.reset(sy), this.sampleProcessingSesssions.clear(), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
11095
11123
  }), e(this, "getRuntimeInfo", () => {
11096
11124
  let e = this.modules.canvasModule instanceof J_ ? !0 : void 0;
11097
11125
  return w({
11098
11126
  uptime: this.uptime,
11099
- version: "4.3.3",
11127
+ version: "4.4.0",
11100
11128
  clientId: this.clientId,
11101
11129
  sessionId: this.sessionId,
11102
11130
  channelId: this.channelId,
@@ -11130,7 +11158,7 @@ var Uv = class {
11130
11158
  }), e(this, "timeToFirstFrame", () => {
11131
11159
  let e = this.modules.playback.getFirstFrameTime(), t = this.modules.connection.firstConnectStartTime;
11132
11160
  if (t !== void 0 && e !== void 0) return Math.round(e - t);
11133
- }), this.options = new Uv(w(w({}, Cn), iy(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
11161
+ }), this.options = new Uv(w(w({}, wn), iy(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
11134
11162
  let o = {
11135
11163
  channelId: this.options.get("channelId"),
11136
11164
  audio: {
@@ -11280,7 +11308,7 @@ var Uv = class {
11280
11308
  case "upgrade":
11281
11309
  {
11282
11310
  var o, s, c, l, u;
11283
- let e = Math.min(r + 1, i), n = t[e], d = (o = this.modules.connection.estimatedBandwidth) == null ? bn() : o, f = ((s = n == null || (c = n.audio) == null ? void 0 : c.bitRate) == null ? 0 : s) + ((l = n == null || (u = n.video) == null ? void 0 : u.bitRate) == null ? 0 : l), p = d * 2 > f;
11311
+ let e = Math.min(r + 1, i), n = t[e], d = (o = this.modules.connection.estimatedBandwidth) == null ? xn() : o, f = ((s = n == null || (c = n.audio) == null ? void 0 : c.bitRate) == null ? 0 : s) + ((l = n == null || (u = n.video) == null ? void 0 : u.bitRate) == null ? 0 : l), p = d * 2 > f;
11284
11312
  n && p && this.modules.adaptivity.isQoSOk(n) && (a = e);
11285
11313
  }
11286
11314
  break;
@@ -11303,8 +11331,8 @@ var Uv = class {
11303
11331
  audio: w(w({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
11304
11332
  })), this.emitter.emit("adapted level");
11305
11333
  }), this.emitter.on("text track data", (e) => {
11306
- let t = x(cy, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - x(sy, this);
11307
- if (S(sy, this, n), t) {
11334
+ let t = x(ly, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - x(cy, this);
11335
+ if (S(cy, this, n), t) {
11308
11336
  if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
11309
11337
  for (let r of e.cues) {
11310
11338
  let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
@@ -11320,13 +11348,13 @@ var Uv = class {
11320
11348
  this.clientIp = t.ip;
11321
11349
  break;
11322
11350
  case "renditions":
11323
- this.updateTextTracks(t.renditions), S(ly, this, this.filterRenditions(t.renditions).then((e) => {
11351
+ this.updateTextTracks(t.renditions), S(uy, this, this.filterRenditions(t.renditions).then((e) => {
11324
11352
  this.emitter.emit("renditions", {
11325
11353
  renditions: e,
11326
11354
  channelId: this.currentSubscription.channelId
11327
11355
  }), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
11328
11356
  }).finally(() => {
11329
- S(ly, this, void 0);
11357
+ S(uy, this, void 0);
11330
11358
  }));
11331
11359
  break;
11332
11360
  case "subscription changed":
@@ -11447,7 +11475,7 @@ var Uv = class {
11447
11475
  let be = function() {
11448
11476
  var e = t(function* (e) {
11449
11477
  let t = e.channelId;
11450
- x(ly, i) && (yield x(ly, i));
11478
+ x(uy, i) && (yield x(uy, i));
11451
11479
  let n = i.modules.renditions.getRendition(e.renditionId, t);
11452
11480
  if (!Xo(e.flags)) {
11453
11481
  if (Zo(e.flags)) {
@@ -11455,8 +11483,8 @@ var Uv = class {
11455
11483
  if (e.renditionId !== 0) {
11456
11484
  let e = ce(t);
11457
11485
  if (e && e.language !== void 0) {
11458
- let t = new cs().parse(e.content || ""), r = n / 1e3, a = x(cy, i).find((t) => t.language === e.language), o = r - x(sy, i);
11459
- if (S(sy, i, r), a) {
11486
+ let t = new cs().parse(e.content || ""), r = n / 1e3, a = x(ly, i).find((t) => t.language === e.language), o = r - x(cy, i);
11487
+ if (S(cy, i, r), a) {
11460
11488
  if (a.cues) for (let e of a.cues) e.startTime -= o, e.endTime -= o;
11461
11489
  for (let e of t) {
11462
11490
  let t = new VTTCue(e.startTime - r, e.endTime - r, e.text);
@@ -11479,7 +11507,7 @@ var Uv = class {
11479
11507
  codec: n.codec
11480
11508
  }, e), {}, { channelId: t }), o = Bo(a.codec, a.payload);
11481
11509
  o && i.sizes.set(a.renditionId, o);
11482
- let s = yn({
11510
+ let s = bn({
11483
11511
  codec: n.codec,
11484
11512
  codecString: n.codecString
11485
11513
  });
@@ -11506,7 +11534,7 @@ var Uv = class {
11506
11534
  return e.apply(this, arguments);
11507
11535
  };
11508
11536
  }();
11509
- this.options.get("maxVideoBitRate") !== 2 ** 53 - 1 && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== 2 ** 53 - 1 && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), Ft(this.options.get("maxSize"), xn()) || (this.maxSize = this.options.get("maxSize")), this.options.get("burstEnabled") && te.enableBurst(this.targetBufferTime);
11537
+ this.options.get("maxVideoBitRate") !== 2 ** 53 - 1 && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== 2 ** 53 - 1 && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), Ft(this.options.get("maxSize"), Sn()) || (this.maxSize = this.options.get("maxSize")), this.options.get("burstEnabled") && te.enableBurst(this.targetBufferTime);
11510
11538
  }
11511
11539
  set volume(e) {
11512
11540
  this.playbackSource.volume = e;
@@ -11599,7 +11627,7 @@ var Uv = class {
11599
11627
  this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
11600
11628
  }
11601
11629
  set textTrack(e) {
11602
- e !== this.textTrack && (x(cy, this).forEach((t) => {
11630
+ e !== this.textTrack && (x(ly, this).forEach((t) => {
11603
11631
  if (t.label === e) t.mode = "showing";
11604
11632
  else {
11605
11633
  if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
@@ -11608,11 +11636,11 @@ var Uv = class {
11608
11636
  }), this.emitter.emit("text track", e));
11609
11637
  }
11610
11638
  get textTracks() {
11611
- return x(cy, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
11639
+ return x(ly, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
11612
11640
  }
11613
11641
  get textTrack() {
11614
11642
  var e;
11615
- return (e = x(cy, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
11643
+ return (e = x(ly, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
11616
11644
  }
11617
11645
  get channelId() {
11618
11646
  var e, t;
@@ -11630,7 +11658,7 @@ var Uv = class {
11630
11658
  }
11631
11659
  get maxSize() {
11632
11660
  var e, t;
11633
- let { width: n, height: r } = (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video) == null ? xn() : e;
11661
+ let { width: n, height: r } = (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video) == null ? Sn() : e;
11634
11662
  return {
11635
11663
  width: n,
11636
11664
  height: r
@@ -11644,14 +11672,14 @@ var Uv = class {
11644
11672
  }
11645
11673
  get maxVideoBitRate() {
11646
11674
  var e, t;
11647
- return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) == null ? bn() : e;
11675
+ return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) == null ? xn() : e;
11648
11676
  }
11649
11677
  set maxVideoBitRate(e) {
11650
11678
  this.modules.constraintCap.setUserSpecifiedCap({ video: { bitRate: e } }), this.alignSizeAndBitRate(this.targetSubscription);
11651
11679
  }
11652
11680
  get maxAudioBitRate() {
11653
11681
  var e, t;
11654
- return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) == null ? bn() : e;
11682
+ return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) == null ? xn() : e;
11655
11683
  }
11656
11684
  set maxAudioBitRate(e) {
11657
11685
  this.modules.constraintCap.setUserSpecifiedCap({ audio: { bitRate: e } }), this.alignSizeAndBitRate(this.targetSubscription);
@@ -11765,6 +11793,6 @@ var Uv = class {
11765
11793
  return t === void 0 ? this.shouldUseWebCodecs(e) : t;
11766
11794
  }
11767
11795
  };
11768
- e(uy, "MAX_POOL_SIZE", 10), e(uy, "DISCONNECT_TIMEOUT", 15 * 1e3), e(uy, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
11796
+ e(dy, "MAX_POOL_SIZE", 10), e(dy, "DISCONNECT_TIMEOUT", 15 * 1e3), e(dy, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
11769
11797
  //#endregion
11770
- export { $e as _, ut as a, lt as c, wt as d, St as f, Tt as g, xt as h, mt as i, ft as l, _t as m, O as n, pt as o, bt as p, dt as r, yt as s, uy as t, gt as u, Qe as v };
11798
+ export { Tt as _, mt as a, yt as c, gt as d, wt as f, xt as g, _t as h, dt as i, lt as l, bt as m, sn as n, ut as o, St as p, O as r, pt as s, dy as t, ft as u, $e as v, Qe as y };