@vindral/web-sdk 4.1.7 → 4.1.8-2-gdd5314d7

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.
@@ -172,7 +172,7 @@ function Wa(a, e, t) {
172
172
  s[r] = Ki(r, a, t);
173
173
  });
174
174
  try {
175
- s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.14`);
175
+ s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`);
176
176
  } catch (r) {
177
177
  return qs();
178
178
  }
@@ -184,7 +184,7 @@ function Wa(a, e, t) {
184
184
  return s;
185
185
  }
186
186
  const se = js;
187
- function Qe(a = !0) {
187
+ function Ze(a = !0) {
188
188
  return typeof self == "undefined" ? void 0 : (a || !self.MediaSource) && self.ManagedMediaSource || self.MediaSource || self.WebKitMediaSource;
189
189
  }
190
190
  function qa(a) {
@@ -232,7 +232,7 @@ function Re(a, e = !1) {
232
232
  }
233
233
  return n;
234
234
  }
235
- function Ee(a) {
235
+ function me(a) {
236
236
  let e = "";
237
237
  for (let t = 0; t < a.length; t++) {
238
238
  let s = a[t].toString(16);
@@ -711,7 +711,7 @@ function to(a) {
711
711
  case "avc3":
712
712
  case "avc4": {
713
713
  const c = z(t, ["avcC"])[0];
714
- c && c.length > 3 && (i += "." + Bt(c[1]) + Bt(c[2]) + Bt(c[3]), r = Nt(o === "avc1" ? "dva1" : "dvav", t));
714
+ c && c.length > 3 && (i += "." + Ut(c[1]) + Ut(c[2]) + Ut(c[3]), r = Bt(o === "avc1" ? "dva1" : "dvav", t));
715
715
  break;
716
716
  }
717
717
  case "mp4a": {
@@ -727,7 +727,7 @@ function to(a) {
727
727
  h = Ls(l, h);
728
728
  const d = l[h++];
729
729
  if (d === 64)
730
- i += "." + Bt(d);
730
+ i += "." + Ut(d);
731
731
  else
732
732
  break;
733
733
  if (h += 12, l[h++] !== 5)
@@ -752,7 +752,7 @@ function to(a) {
752
752
  }
753
753
  i += p;
754
754
  }
755
- r = Nt(o == "hev1" ? "dvhe" : "dvh1", t);
755
+ r = Bt(o == "hev1" ? "dvhe" : "dvh1", t);
756
756
  break;
757
757
  }
758
758
  case "dvh1":
@@ -760,7 +760,7 @@ function to(a) {
760
760
  case "dvav":
761
761
  case "dva1":
762
762
  case "dav1": {
763
- i = Nt(i, t) || i;
763
+ i = Bt(i, t) || i;
764
764
  break;
765
765
  }
766
766
  case "vp09": {
@@ -775,7 +775,7 @@ function to(a) {
775
775
  const c = z(t, ["av1C"])[0];
776
776
  if (c && c.length > 2) {
777
777
  const l = c[1] >>> 5, h = c[1] & 31, u = c[2] >>> 7 ? "H" : "M", d = (c[2] & 64) >> 6, f = (c[2] & 32) >> 5, g = l === 2 && d ? f ? 12 : 10 : d ? 10 : 8, y = (c[2] & 16) >> 4, p = (c[2] & 8) >> 3, E = (c[2] & 4) >> 2, T = c[2] & 3;
778
- i += "." + l + "." + Ne(h) + u + "." + Ne(g) + "." + y + "." + p + E + T + "." + Ne(1) + "." + Ne(1) + "." + Ne(1) + "." + 0, r = Nt("dav1", t);
778
+ i += "." + l + "." + Ne(h) + u + "." + Ne(g) + "." + y + "." + p + E + T + "." + Ne(1) + "." + Ne(1) + "." + Ne(1) + "." + 0, r = Bt("dav1", t);
779
779
  }
780
780
  break;
781
781
  }
@@ -786,7 +786,7 @@ function to(a) {
786
786
  supplemental: r
787
787
  };
788
788
  }
789
- function Nt(a, e) {
789
+ function Bt(a, e) {
790
790
  const t = z(e, ["dvvC"]), s = t.length ? t[0] : z(e, ["dvcC"])[0];
791
791
  if (s) {
792
792
  const i = s[2] >> 1 & 127, r = s[2] << 5 & 32 | s[3] >> 3 & 31;
@@ -805,7 +805,7 @@ function Ls(a, e) {
805
805
  ;
806
806
  return e;
807
807
  }
808
- function Bt(a) {
808
+ function Ut(a) {
809
809
  return ("0" + a.toString(16).toUpperCase()).slice(-2);
810
810
  }
811
811
  function Ne(a) {
@@ -817,7 +817,7 @@ function io(a, e) {
817
817
  const t = e.keyId;
818
818
  t && e.isCommonEncryption && fn(a, (s, i) => {
819
819
  const r = s.subarray(8, 24);
820
- r.some((n) => n !== 0) || (se.log(`[eme] Patching keyId in 'enc${i ? "a" : "v"}>sinf>>tenc' box: ${Ee(r)} -> ${Ee(t)}`), s.set(t, 8));
820
+ r.some((n) => n !== 0) || (se.log(`[eme] Patching keyId in 'enc${i ? "a" : "v"}>sinf>>tenc' box: ${me(r)} -> ${me(t)}`), s.set(t, 8));
821
821
  });
822
822
  }
823
823
  function ro(a) {
@@ -954,8 +954,8 @@ function Wi(a, e) {
954
954
  for (; X < G; ) {
955
955
  const Z = W(s, j);
956
956
  if (j += 4, oo(n, s[j])) {
957
- const pe = s.subarray(j, j + Z);
958
- gi(pe, n ? 2 : 1, a + Y / i, t);
957
+ const ye = s.subarray(j, j + Z);
958
+ gi(ye, n ? 2 : 1, a + Y / i, t);
959
959
  }
960
960
  j += Z, X += Z + 4;
961
961
  }
@@ -1160,7 +1160,7 @@ function fo(a) {
1160
1160
  offset: t,
1161
1161
  size: e
1162
1162
  };
1163
- const n = a.buffer, o = Ee(new Uint8Array(n, t + 12, 16));
1163
+ const n = a.buffer, o = me(new Uint8Array(n, t + 12, 16));
1164
1164
  let c = null, l = null, h = 0;
1165
1165
  if (r === 0)
1166
1166
  h = 28;
@@ -1194,7 +1194,7 @@ function fo(a) {
1194
1194
  size: e
1195
1195
  });
1196
1196
  }
1197
- const pn = () => /\(Windows.+Firefox\//i.test(navigator.userAgent), St = {
1197
+ const pn = () => /\(Windows.+Firefox\//i.test(navigator.userAgent), vt = {
1198
1198
  audio: {
1199
1199
  a3ds: 1,
1200
1200
  "ac-3": 0.95,
@@ -1274,32 +1274,32 @@ const pn = () => /\(Windows.+Firefox\//i.test(navigator.userAgent), St = {
1274
1274
  }
1275
1275
  };
1276
1276
  function mi(a, e) {
1277
- const t = St[e];
1277
+ const t = vt[e];
1278
1278
  return !!t && !!t[a.slice(0, 4)];
1279
1279
  }
1280
- function Dt(a, e, t = !0) {
1280
+ function Ct(a, e, t = !0) {
1281
1281
  return !a.split(",").some((s) => !pi(s, e, t));
1282
1282
  }
1283
1283
  function pi(a, e, t = !0) {
1284
1284
  var s;
1285
- const i = Qe(t);
1286
- return (s = i == null ? void 0 : i.isTypeSupported(Ct(a, e))) != null ? s : !1;
1285
+ const i = Ze(t);
1286
+ return (s = i == null ? void 0 : i.isTypeSupported(Pt(a, e))) != null ? s : !1;
1287
1287
  }
1288
- function Ct(a, e) {
1288
+ function Pt(a, e) {
1289
1289
  return `${e}/mp4;codecs=${a}`;
1290
1290
  }
1291
1291
  function qi(a) {
1292
1292
  if (a) {
1293
1293
  const e = a.substring(0, 4);
1294
- return St.video[e];
1294
+ return vt.video[e];
1295
1295
  }
1296
1296
  return 2;
1297
1297
  }
1298
1298
  function os(a) {
1299
1299
  const e = pn();
1300
1300
  return a.split(",").reduce((t, s) => {
1301
- const r = e && Es(s) ? 9 : St.video[s];
1302
- return r ? (r * 2 + t) / (t ? 3 : 2) : (St.audio[s] + t) / (t ? 2 : 1);
1301
+ const r = e && Es(s) ? 9 : vt.video[s];
1302
+ return r ? (r * 2 + t) / (t ? 3 : 2) : (vt.audio[s] + t) / (t ? 2 : 1);
1303
1303
  }, 0);
1304
1304
  }
1305
1305
  const Rs = {};
@@ -1320,7 +1320,7 @@ function go(a, e = !0) {
1320
1320
  var s;
1321
1321
  if (pi(t[i], "audio", e))
1322
1322
  return Rs[a] = t[i], t[i];
1323
- if (t[i] === "mp3" && (s = Qe(e)) != null && s.isTypeSupported("audio/mpeg"))
1323
+ if (t[i] === "mp3" && (s = Ze(e)) != null && s.isTypeSupported("audio/mpeg"))
1324
1324
  return "";
1325
1325
  }
1326
1326
  return a;
@@ -1375,7 +1375,7 @@ function Eo(a) {
1375
1375
  return a;
1376
1376
  }
1377
1377
  function Xi(a) {
1378
- const e = Qe(a) || {
1378
+ const e = Ze(a) || {
1379
1379
  isTypeSupported: () => !1
1380
1380
  };
1381
1381
  return {
@@ -1474,7 +1474,7 @@ function xo(a) {
1474
1474
  const t = (e = a.videoCodec) == null ? void 0 : e.split(","), s = Sn(a), i = a.width || 640, r = a.height || 480, n = a.frameRate || 30, o = a.videoRange.toLowerCase();
1475
1475
  return t ? t.map((c) => {
1476
1476
  const l = {
1477
- contentType: Ct(Eo(c), "video"),
1477
+ contentType: Pt(Eo(c), "video"),
1478
1478
  width: i,
1479
1479
  height: r,
1480
1480
  bitrate: s,
@@ -1494,7 +1494,7 @@ function Ao(a, e, t) {
1494
1494
  const d = parseFloat(u.channels || "");
1495
1495
  i.forEach((f) => {
1496
1496
  const g = {
1497
- contentType: Ct(f, "audio"),
1497
+ contentType: Pt(f, "audio"),
1498
1498
  bitrate: t ? Io(f, r) : r
1499
1499
  };
1500
1500
  d && (g.channels = "" + d), h.push(g);
@@ -1559,7 +1559,7 @@ class Qi {
1559
1559
  return this.msn !== void 0 && t.searchParams.set("_HLS_msn", this.msn.toString()), this.part !== void 0 && t.searchParams.set("_HLS_part", this.part.toString()), this.skip && t.searchParams.set("_HLS_skip", this.skip), t.href;
1560
1560
  }
1561
1561
  }
1562
- class Pt {
1562
+ class kt {
1563
1563
  constructor(e) {
1564
1564
  if (this._attrs = void 0, this.audioCodec = void 0, this.bitrate = void 0, this.codecSet = void 0, this.url = void 0, this.frameRate = void 0, this.height = void 0, this.id = void 0, this.name = void 0, this.supplemental = void 0, this.videoCodec = void 0, this.width = void 0, this.details = void 0, this.fragmentError = 0, this.loadError = 0, this.loaded = void 0, this.realBitrate = 0, this.supportedPromise = void 0, this.supportedResult = void 0, this._avgBitrate = 0, this._audioGroups = void 0, this._subtitleGroups = void 0, this._urlId = 0, this.url = [e.url], this._attrs = [e.attrs], this.bitrate = e.bitrate, e.details && (this.details = e.details), this.id = e.id || 0, this.name = e.name, this.width = e.width || 0, this.height = e.height || 0, this.frameRate = e.attrs.optionalFloat("FRAME-RATE", 0), this._avgBitrate = e.attrs.decimalInteger("AVERAGE-BANDWIDTH"), this.audioCodec = e.audioCodec, this.videoCodec = e.videoCodec, this.codecSet = [e.videoCodec, e.audioCodec].filter((s) => !!s).map((s) => s.substring(0, 4)).join(","), "supplemental" in e) {
1565
1565
  var t;
@@ -1805,12 +1805,12 @@ function Ue(a, e, t) {
1805
1805
  }
1806
1806
  for (let s = 0; s < e.length; s++) {
1807
1807
  const i = e[s];
1808
- if (at(a, i, t))
1808
+ if (ot(a, i, t))
1809
1809
  return s;
1810
1810
  }
1811
1811
  return -1;
1812
1812
  }
1813
- function at(a, e, t) {
1813
+ function ot(a, e, t) {
1814
1814
  const {
1815
1815
  groupId: s,
1816
1816
  name: i,
@@ -1827,7 +1827,7 @@ function Oo(a, e = "") {
1827
1827
  const t = a.split(","), s = e.split(",");
1828
1828
  return t.length === s.length && !t.some((i) => s.indexOf(i) === -1);
1829
1829
  }
1830
- function rt(a, e) {
1830
+ function nt(a, e) {
1831
1831
  const {
1832
1832
  audioCodec: t,
1833
1833
  channels: s
@@ -2174,8 +2174,8 @@ class Mo extends Ce {
2174
2174
  if (!this.hls)
2175
2175
  return;
2176
2176
  G.supportedResult = Z;
2177
- const pe = this.hls.levels, fe = pe.indexOf(G);
2178
- Z.error ? this.warn(`MediaCapabilities decodingInfo error: "${Z.error}" for level ${fe} ${ne(Z)}`) : Z.supported ? Z.decodingInfoResults.some((be) => be.smooth === !1 || be.powerEfficient === !1) && this.log(`MediaCapabilities decodingInfo for level ${fe} not smooth or powerEfficient: ${ne(Z)}`) : (this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${fe} ${ne(Z)}`), fe > -1 && pe.length > 1 && (this.log(`Removing unsupported level ${fe}`), this.hls.removeLevel(fe), this.hls.loadLevel === -1 && (this.hls.nextLoadLevel = 0)));
2177
+ const ye = this.hls.levels, fe = ye.indexOf(G);
2178
+ Z.error ? this.warn(`MediaCapabilities decodingInfo error: "${Z.error}" for level ${fe} ${ne(Z)}`) : Z.supported ? Z.decodingInfoResults.some((be) => be.smooth === !1 || be.powerEfficient === !1) && this.log(`MediaCapabilities decodingInfo for level ${fe} not smooth or powerEfficient: ${ne(Z)}`) : (this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${fe} ${ne(Z)}`), fe > -1 && ye.length > 1 && (this.log(`Removing unsupported level ${fe}`), this.hls.removeLevel(fe), this.hls.loadLevel === -1 && (this.hls.nextLoadLevel = 0)));
2179
2179
  }).catch((Z) => {
2180
2180
  this.warn(`Error handling MediaCapabilities decodingInfo: ${Z}`);
2181
2181
  })) : G.supportedResult = yn;
@@ -2417,7 +2417,7 @@ class Go extends Ce {
2417
2417
  return;
2418
2418
  case R.FRAG_PARSING_ERROR:
2419
2419
  if ((s = t.frag) != null && s.gap) {
2420
- t.errorAction = pt();
2420
+ t.errorAction = yt();
2421
2421
  return;
2422
2422
  }
2423
2423
  // falls through
@@ -2479,10 +2479,10 @@ class Go extends Ce {
2479
2479
  case R.BUFFER_STALLED_ERROR:
2480
2480
  case R.BUFFER_SEEK_OVER_HOLE:
2481
2481
  case R.BUFFER_NUDGE_ON_STALL:
2482
- t.errorAction = pt();
2482
+ t.errorAction = yt();
2483
2483
  return;
2484
2484
  }
2485
- t.type === V.KEY_SYSTEM_ERROR && (t.levelRetry = !1, t.errorAction = pt());
2485
+ t.type === V.KEY_SYSTEM_ERROR && (t.levelRetry = !1, t.errorAction = yt());
2486
2486
  }
2487
2487
  getPlaylistRetryOrSwitchAction(e, t) {
2488
2488
  const s = this.hls, i = sr(s.config.playlistLoadPolicy, e), r = this.playlistError++;
@@ -2612,7 +2612,7 @@ class Go extends Ce {
2612
2612
  for (let d = h; d--; )
2613
2613
  if (this.variantHasKey(l[d], c)) {
2614
2614
  var n, o;
2615
- this.log(`Banned key found in level ${d} (${l[d].bitrate}bps) or audio group "${(n = l[d].audioGroups) == null ? void 0 : n.join(",")}" (${(o = e.frag) == null ? void 0 : o.type} fragment) ${Ee(c.keyId || [])}`), l[d].fragmentError++, l[d].loadError++, this.log(`Removing level ${d} with key error (${e.error})`), this.hls.removeLevel(d);
2615
+ this.log(`Banned key found in level ${d} (${l[d].bitrate}bps) or audio group "${(n = l[d].audioGroups) == null ? void 0 : n.join(",")}" (${(o = e.frag) == null ? void 0 : o.type} fragment) ${me(c.keyId || [])}`), l[d].fragmentError++, l[d].loadError++, this.log(`Removing level ${d} with key error (${e.error})`), this.hls.removeLevel(d);
2616
2616
  }
2617
2617
  const u = e.frag;
2618
2618
  if (this.hls.levels.length < h)
@@ -2635,7 +2635,7 @@ class Go extends Ce {
2635
2635
  }
2636
2636
  }
2637
2637
  }
2638
- function pt(a) {
2638
+ function yt(a) {
2639
2639
  const e = {
2640
2640
  action: ge.DoNothing,
2641
2641
  flags: Ae.None
@@ -2755,7 +2755,10 @@ class Ko {
2755
2755
  return;
2756
2756
  const l = t[o], h = n || c.partial === !0;
2757
2757
  r.range[o] = this.getBufferedTimes(s, e.part, h, l);
2758
- }), r.loaded = null, Object.keys(r.range).length ? (r.buffered = !0, (r.body.endList = s.endList || r.body.endList) && (this.endListFragments[r.body.type] = r), Ut(r) || this.removeParts(s.sn - 1, s.type)) : this.removeFragment(r.body);
2758
+ }), r.loaded = null, Object.keys(r.range).length ? (this.bufferedEnd(r, s), $t(r) || this.removeParts(s.sn - 1, s.type)) : this.removeFragment(r.body);
2759
+ }
2760
+ bufferedEnd(e, t) {
2761
+ e.buffered = !0, (e.body.endList = t.endList || e.body.endList) && (this.endListFragments[e.body.type] = e);
2759
2762
  }
2760
2763
  removeParts(e, t) {
2761
2764
  const s = this.activePartLists[t];
@@ -2770,7 +2773,7 @@ class Ko {
2770
2773
  loaded: null,
2771
2774
  buffered: !1,
2772
2775
  range: /* @__PURE__ */ Object.create(null)
2773
- }, e.gap && (this.hasGaps = !0)), i && (i.loaded = null, i.buffered = !0);
2776
+ }, e.gap && (this.hasGaps = !0)), i && (i.loaded = null, this.bufferedEnd(i, e));
2774
2777
  }
2775
2778
  getBufferedTimes(e, t, s, i) {
2776
2779
  const r = {
@@ -2807,16 +2810,16 @@ class Ko {
2807
2810
  } = this;
2808
2811
  return Object.keys(c).forEach((l) => {
2809
2812
  const h = c[l];
2810
- h && Ut(h) && (i = h.body.start - o, r = h.body.end + o, e >= i && e <= r && (s = Math.min(e - i, r - e), n <= s && (t = h.body, n = s)));
2813
+ h && $t(h) && (i = h.body.start - o, r = h.body.end + o, e >= i && e <= r && (s = Math.min(e - i, r - e), n <= s && (t = h.body, n = s)));
2811
2814
  }), t;
2812
2815
  }
2813
2816
  isEndListAppended(e) {
2814
2817
  const t = this.endListFragments[e];
2815
- return t !== void 0 && (t.buffered || Ut(t));
2818
+ return t !== void 0 && (t.buffered || $t(t));
2816
2819
  }
2817
2820
  getState(e) {
2818
2821
  const t = ut(e), s = this.fragments[t];
2819
- return s ? s.buffered ? Ut(s) ? ue.PARTIAL : ue.OK : ue.APPENDING : ue.NOT_LOADED;
2822
+ return s ? s.buffered ? $t(s) ? ue.PARTIAL : ue.OK : ue.APPENDING : ue.NOT_LOADED;
2820
2823
  }
2821
2824
  isTimeBuffered(e, t, s) {
2822
2825
  let i, r;
@@ -2911,7 +2914,7 @@ class Ko {
2911
2914
  t && t.forEach((s) => s.clearElementaryStreamInfo());
2912
2915
  }
2913
2916
  }
2914
- function Ut(a) {
2917
+ function $t(a) {
2915
2918
  var e, t, s;
2916
2919
  return a.buffered && !!(a.body.gap || (e = a.range.video) != null && e.partial || (t = a.range.audio) != null && t.partial || (s = a.range.audiovideo) != null && s.partial);
2917
2920
  }
@@ -2924,7 +2927,7 @@ function rr(a, e) {
2924
2927
  return s || t.clearElementaryStreamInfo(), s;
2925
2928
  });
2926
2929
  }
2927
- var Ze = {
2930
+ var Je = {
2928
2931
  cbc: 0,
2929
2932
  ctr: 1
2930
2933
  };
@@ -2934,12 +2937,12 @@ class Vo {
2934
2937
  }
2935
2938
  decrypt(e, t) {
2936
2939
  switch (this.aesMode) {
2937
- case Ze.cbc:
2940
+ case Je.cbc:
2938
2941
  return this.subtle.decrypt({
2939
2942
  name: "AES-CBC",
2940
2943
  iv: this.aesIV
2941
2944
  }, t, e);
2942
- case Ze.ctr:
2945
+ case Je.ctr:
2943
2946
  return this.subtle.decrypt(
2944
2947
  {
2945
2948
  name: "AES-CTR",
@@ -3039,9 +3042,9 @@ class Wo {
3039
3042
  }
3040
3043
  function qo(a) {
3041
3044
  switch (a) {
3042
- case Ze.cbc:
3045
+ case Je.cbc:
3043
3046
  return "AES-CBC";
3044
- case Ze.ctr:
3047
+ case Je.ctr:
3045
3048
  return "AES-CTR";
3046
3049
  default:
3047
3050
  throw new Error(`[FastAESKey] invalid aes mode ${a}`);
@@ -3095,7 +3098,7 @@ class Ei {
3095
3098
  currentResult: n,
3096
3099
  remainderData: o
3097
3100
  } = this;
3098
- if (i !== Ze.cbc || t.byteLength !== 16)
3101
+ if (i !== Je.cbc || t.byteLength !== 16)
3099
3102
  return se.warn("SoftwareDecrypt: can only handle AES-128-CBC"), null;
3100
3103
  this.logOnce("JS AES decrypt"), o && (e = De(o, e), this.remainderData = null);
3101
3104
  const c = this.getValidChunk(e);
@@ -3416,14 +3419,14 @@ class Rn extends Ce {
3416
3419
  }
3417
3420
  class Ti {
3418
3421
  constructor(e, t, s, i = 0, r = -1, n = !1) {
3419
- this.level = void 0, this.sn = void 0, this.part = void 0, this.id = void 0, this.size = void 0, this.partial = void 0, this.transmuxing = $t(), this.buffering = {
3420
- audio: $t(),
3421
- video: $t(),
3422
- audiovideo: $t()
3422
+ this.level = void 0, this.sn = void 0, this.part = void 0, this.id = void 0, this.size = void 0, this.partial = void 0, this.transmuxing = Gt(), this.buffering = {
3423
+ audio: Gt(),
3424
+ video: Gt(),
3425
+ audiovideo: Gt()
3423
3426
  }, this.level = e, this.sn = t, this.id = s, this.size = i, this.part = r, this.partial = n;
3424
3427
  }
3425
3428
  }
3426
- function $t() {
3429
+ function Gt() {
3427
3430
  return {
3428
3431
  start: 0,
3429
3432
  executeStart: 0,
@@ -3838,16 +3841,16 @@ function fs(a, e) {
3838
3841
  function dr(a, e) {
3839
3842
  return !a && !e ? !0 : !a || !e ? !1 : fs(a, e);
3840
3843
  }
3841
- function yt(a) {
3844
+ function Et(a) {
3842
3845
  return a === "AES-128" || a === "AES-256" || a === "AES-256-CTR";
3843
3846
  }
3844
3847
  function Si(a) {
3845
3848
  switch (a) {
3846
3849
  case "AES-128":
3847
3850
  case "AES-256":
3848
- return Ze.cbc;
3851
+ return Je.cbc;
3849
3852
  case "AES-256-CTR":
3850
- return Ze.ctr;
3853
+ return Je.ctr;
3851
3854
  default:
3852
3855
  throw new Error(`invalid full segment method ${a}`);
3853
3856
  }
@@ -3887,7 +3890,7 @@ var oe = {
3887
3890
  FAIRPLAY: "com.apple.fps",
3888
3891
  PLAYREADY: "com.microsoft.playready",
3889
3892
  WIDEVINE: "com.widevine.alpha"
3890
- }, me = {
3893
+ }, pe = {
3891
3894
  CLEARKEY: "org.w3.clearkey",
3892
3895
  FAIRPLAY: "com.apple.streamingkeydelivery",
3893
3896
  PLAYREADY: "com.microsoft.playready",
@@ -3895,29 +3898,29 @@ var oe = {
3895
3898
  };
3896
3899
  function ts(a) {
3897
3900
  switch (a) {
3898
- case me.FAIRPLAY:
3901
+ case pe.FAIRPLAY:
3899
3902
  return oe.FAIRPLAY;
3900
- case me.PLAYREADY:
3903
+ case pe.PLAYREADY:
3901
3904
  return oe.PLAYREADY;
3902
- case me.WIDEVINE:
3905
+ case pe.WIDEVINE:
3903
3906
  return oe.WIDEVINE;
3904
- case me.CLEARKEY:
3907
+ case pe.CLEARKEY:
3905
3908
  return oe.CLEARKEY;
3906
3909
  }
3907
3910
  }
3908
3911
  function bs(a) {
3909
3912
  switch (a) {
3910
3913
  case oe.FAIRPLAY:
3911
- return me.FAIRPLAY;
3914
+ return pe.FAIRPLAY;
3912
3915
  case oe.PLAYREADY:
3913
- return me.PLAYREADY;
3916
+ return pe.PLAYREADY;
3914
3917
  case oe.WIDEVINE:
3915
- return me.WIDEVINE;
3918
+ return pe.WIDEVINE;
3916
3919
  case oe.CLEARKEY:
3917
- return me.CLEARKEY;
3920
+ return pe.CLEARKEY;
3918
3921
  }
3919
3922
  }
3920
- function Lt(a) {
3923
+ function Rt(a) {
3921
3924
  const {
3922
3925
  drmSystems: e,
3923
3926
  widevineLicenseUrl: t
@@ -3978,31 +3981,35 @@ function kn(a) {
3978
3981
  }
3979
3982
  return null;
3980
3983
  }
3981
- let Gt = {};
3982
- class ot {
3984
+ let dt = {};
3985
+ class Qe {
3983
3986
  static clearKeyUriToKeyIdMap() {
3984
- Gt = {};
3987
+ dt = {};
3985
3988
  }
3986
3989
  static setKeyIdForUri(e, t) {
3987
- Gt[e] = t;
3990
+ dt[e] = t;
3991
+ }
3992
+ static addKeyIdForUri(e) {
3993
+ const t = Object.keys(dt).length % Number.MAX_SAFE_INTEGER, s = new Uint8Array(16);
3994
+ return new DataView(s.buffer, 12, 4).setUint32(0, t), dt[e] = s, s;
3988
3995
  }
3989
3996
  constructor(e, t, s, i = [1], r = null, n) {
3990
- this.uri = void 0, this.method = void 0, this.keyFormat = void 0, this.keyFormatVersions = void 0, this.encrypted = void 0, this.isCommonEncryption = void 0, this.iv = null, this.key = null, this.keyId = null, this.pssh = null, this.method = e, this.uri = t, this.keyFormat = s, this.keyFormatVersions = i, this.iv = r, this.encrypted = e ? e !== "NONE" : !1, this.isCommonEncryption = this.encrypted && !yt(e), n != null && n.startsWith("0x") && (this.keyId = new Uint8Array(an(n)));
3997
+ this.uri = void 0, this.method = void 0, this.keyFormat = void 0, this.keyFormatVersions = void 0, this.encrypted = void 0, this.isCommonEncryption = void 0, this.iv = null, this.key = null, this.keyId = null, this.pssh = null, this.method = e, this.uri = t, this.keyFormat = s, this.keyFormatVersions = i, this.iv = r, this.encrypted = e ? e !== "NONE" : !1, this.isCommonEncryption = this.encrypted && !Et(e), n != null && n.startsWith("0x") && (this.keyId = new Uint8Array(an(n)));
3991
3998
  }
3992
3999
  matches(e) {
3993
4000
  return e.uri === this.uri && e.method === this.method && e.encrypted === this.encrypted && e.keyFormat === this.keyFormat && fs(e.keyFormatVersions, this.keyFormatVersions) && dr(e.iv, this.iv) && dr(e.keyId, this.keyId);
3994
4001
  }
3995
4002
  isSupported() {
3996
4003
  if (this.method) {
3997
- if (yt(this.method) || this.method === "NONE")
4004
+ if (Et(this.method) || this.method === "NONE")
3998
4005
  return !0;
3999
4006
  if (this.keyFormat === "identity")
4000
4007
  return this.method === "SAMPLE-AES";
4001
4008
  switch (this.keyFormat) {
4002
- case me.FAIRPLAY:
4003
- case me.WIDEVINE:
4004
- case me.PLAYREADY:
4005
- case me.CLEARKEY:
4009
+ case pe.FAIRPLAY:
4010
+ case pe.WIDEVINE:
4011
+ case pe.PLAYREADY:
4012
+ case pe.CLEARKEY:
4006
4013
  return ["SAMPLE-AES", "SAMPLE-AES-CENC", "SAMPLE-AES-CTR"].indexOf(this.method) !== -1;
4007
4014
  }
4008
4015
  }
@@ -4011,19 +4018,19 @@ class ot {
4011
4018
  getDecryptData(e, t) {
4012
4019
  if (!this.encrypted || !this.uri)
4013
4020
  return null;
4014
- if (yt(this.method)) {
4021
+ if (Et(this.method)) {
4015
4022
  let r = this.iv;
4016
- return r || (typeof e != "number" && (se.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`), e = 0), r = cl(e)), new ot(this.method, this.uri, "identity", this.keyFormatVersions, r);
4023
+ return r || (typeof e != "number" && (se.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`), e = 0), r = cl(e)), new Qe(this.method, this.uri, "identity", this.keyFormatVersions, r);
4017
4024
  }
4018
4025
  if (this.keyId) {
4019
- const r = Gt[this.uri];
4020
- if (r && !fs(this.keyId, r) && ot.setKeyIdForUri(this.uri, this.keyId), this.pssh)
4026
+ const r = dt[this.uri];
4027
+ if (r && !fs(this.keyId, r) && Qe.setKeyIdForUri(this.uri, this.keyId), this.pssh)
4021
4028
  return this;
4022
4029
  }
4023
4030
  const s = Cn(this.uri);
4024
4031
  if (s)
4025
4032
  switch (this.keyFormat) {
4026
- case me.WIDEVINE:
4033
+ case pe.WIDEVINE:
4027
4034
  if (this.pssh = s, !this.keyId) {
4028
4035
  const r = uo(s.buffer);
4029
4036
  if (r.length) {
@@ -4034,7 +4041,7 @@ class ot {
4034
4041
  }
4035
4042
  this.keyId || (this.keyId = fr(t));
4036
4043
  break;
4037
- case me.PLAYREADY: {
4044
+ case pe.PLAYREADY: {
4038
4045
  const r = new Uint8Array([154, 4, 240, 121, 152, 64, 66, 134, 171, 146, 230, 91, 224, 136, 95, 149]);
4039
4046
  this.pssh = ho(r, null, s), this.keyId = kn(s);
4040
4047
  break;
@@ -4051,17 +4058,17 @@ class ot {
4051
4058
  }
4052
4059
  if (!this.keyId || this.keyId.byteLength !== 16) {
4053
4060
  let r;
4054
- r = ll(t), r || (r = fr(t), r || (r = Gt[this.uri])), r && (this.keyId = r, ot.setKeyIdForUri(this.uri, r));
4061
+ r = ll(t), r || (r = fr(t), r || (r = dt[this.uri])), r && (this.keyId = r, Qe.setKeyIdForUri(this.uri, r));
4055
4062
  }
4056
4063
  return this;
4057
4064
  }
4058
4065
  }
4059
4066
  function ll(a) {
4060
- const e = a == null ? void 0 : a[me.WIDEVINE];
4067
+ const e = a == null ? void 0 : a[pe.WIDEVINE];
4061
4068
  return e ? e.keyId : null;
4062
4069
  }
4063
4070
  function fr(a) {
4064
- const e = a == null ? void 0 : a[me.PLAYREADY];
4071
+ const e = a == null ? void 0 : a[pe.PLAYREADY];
4065
4072
  if (e) {
4066
4073
  const t = Cn(e.uri);
4067
4074
  if (t)
@@ -4428,7 +4435,7 @@ function pr(a, e, t) {
4428
4435
  const r = new ae(a, t), n = (s = r.METHOD) != null ? s : "", o = r.URI, c = r.hexadecimalInteger("IV"), l = r.KEYFORMATVERSIONS, h = (i = r.KEYFORMAT) != null ? i : "identity";
4429
4436
  o && r.IV && !c && se.error(`Invalid IV: ${r.IV}`);
4430
4437
  const u = o ? $e.resolve(o, e) : "", d = (l || "1").split("/").map(Number).filter(Number.isFinite);
4431
- return new ot(n, u, h, d, c, r.KEYID);
4438
+ return new Qe(n, u, h, d, c, r.KEYID);
4432
4439
  }
4433
4440
  function yr(a) {
4434
4441
  const t = new ae(a).decimalFloatingPoint("TIME-OFFSET");
@@ -4676,7 +4683,7 @@ function El(a, e) {
4676
4683
  function Lr(a) {
4677
4684
  return a.replace(/\?[^?]*$/, "");
4678
4685
  }
4679
- function Rt(a, e) {
4686
+ function bt(a, e) {
4680
4687
  for (let s = 0, i = a.length; s < i; s++) {
4681
4688
  var t;
4682
4689
  if (((t = a[s]) == null ? void 0 : t.cc) === e)
@@ -4703,7 +4710,7 @@ function Sl(a, e) {
4703
4710
  function Gn(a, e) {
4704
4711
  if (!Tl(e, a))
4705
4712
  return;
4706
- const t = Math.min(e.endCC, a.endCC), s = Rt(e.fragments, t), i = Rt(a.fragments, t);
4713
+ const t = Math.min(e.endCC, a.endCC), s = bt(e.fragments, t), i = bt(a.fragments, t);
4707
4714
  if (!s || !i)
4708
4715
  return;
4709
4716
  se.log(`Aligning playlist at start of dicontinuity sequence ${t}`);
@@ -4718,7 +4725,7 @@ function ms(a, e) {
4718
4725
  return;
4719
4726
  let i, r;
4720
4727
  const n = Math.min(e.endCC, a.endCC);
4721
- e.startCC < n && a.startCC < n && (i = Rt(s, n), r = Rt(t, n)), (!i || !r) && (i = s[Math.floor(s.length / 2)], r = Rt(t, i.cc) || t[Math.floor(t.length / 2)]);
4728
+ e.startCC < n && a.startCC < n && (i = bt(s, n), r = bt(t, n)), (!i || !r) && (i = s[Math.floor(s.length / 2)], r = bt(t, i.cc) || t[Math.floor(t.length / 2)]);
4722
4729
  const o = i.programDateTime, c = r.programDateTime;
4723
4730
  if (!o || !c)
4724
4731
  return;
@@ -4973,7 +4980,7 @@ class xi extends Rn {
4973
4980
  frag: r,
4974
4981
  payload: n
4975
4982
  } = s, o = r.decryptdata;
4976
- if (n && n.byteLength > 0 && o != null && o.key && o.iv && yt(o.method)) {
4983
+ if (n && n.byteLength > 0 && o != null && o.key && o.iv && Et(o.method)) {
4977
4984
  const c = self.performance.now();
4978
4985
  return this.decrypter.decrypt(new Uint8Array(n), o.key.buffer, o.iv.buffer, Si(o.method)).catch((l) => {
4979
4986
  throw i.trigger(m.ERROR, {
@@ -5107,7 +5114,7 @@ class xi extends Rn {
5107
5114
  } else if (!e.url)
5108
5115
  return Promise.resolve(null);
5109
5116
  this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e, !1)}) cc: ${e.cc} ${"[" + n.startSN + "-" + n.endSN + "]"}, target: ${parseFloat(s.toFixed(3))}`), M(e.sn) && !this.bitrateTest && (this.nextLoadPosition = e.start + e.duration), this.state = C.FRAG_LOADING;
5110
- const h = this.config.progressive;
5117
+ const h = this.config.progressive && e.type !== B.SUBTITLE;
5111
5118
  let u;
5112
5119
  return h && o ? u = o.then((d) => !d || this.fragContextChanged(d.frag) ? null : this.fragmentLoader.load(e, i)).catch((d) => this.handleFragLoadError(d)) : u = Promise.all([this.fragmentLoader.load(e, h ? i : void 0), o]).then(([d]) => (!h && i && i(d), d)).catch((d) => this.handleFragLoadError(d)), this.hls.trigger(m.FRAG_LOADING, {
5113
5120
  frag: e,
@@ -5580,13 +5587,14 @@ class xi extends Rn {
5580
5587
  return c;
5581
5588
  }, !1)) {
5582
5589
  var o;
5583
- if (s.fragmentError === 0 && this.treatAsGap(e, s), ((o = this.transmuxer) == null ? void 0 : o.error) === null) {
5584
- const c = new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);
5585
- if (this.warn(c.message), this.hls.trigger(m.ERROR, {
5590
+ const c = ((o = this.transmuxer) == null ? void 0 : o.error) === null;
5591
+ if ((s.fragmentError === 0 || c && (s.fragmentError < 2 || e.endList)) && this.treatAsGap(e, s), c) {
5592
+ const l = new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);
5593
+ if (this.warn(l.message), this.hls.trigger(m.ERROR, {
5586
5594
  type: V.MEDIA_ERROR,
5587
5595
  details: R.FRAG_PARSING_ERROR,
5588
5596
  fatal: !1,
5589
- error: c,
5597
+ error: l,
5590
5598
  frag: e,
5591
5599
  reason: `Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`
5592
5600
  }), !this.hls)
@@ -5766,12 +5774,12 @@ function Al() {
5766
5774
  })(Cs)), Cs.exports;
5767
5775
  }
5768
5776
  var Il = Al(), Ai = /* @__PURE__ */ ja(Il);
5769
- const kt = "1.6.14", vt = {};
5777
+ const wt = "1.6.15", xt = {};
5770
5778
  function Ll() {
5771
5779
  return typeof __HLS_WORKER_BUNDLE__ == "function";
5772
5780
  }
5773
5781
  function Rl() {
5774
- const a = vt[kt];
5782
+ const a = xt[wt];
5775
5783
  if (a)
5776
5784
  return a.clientCount++, a;
5777
5785
  const e = new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`], {
@@ -5781,10 +5789,10 @@ function Rl() {
5781
5789
  objectURL: t,
5782
5790
  clientCount: 1
5783
5791
  };
5784
- return vt[kt] = i, i;
5792
+ return xt[wt] = i, i;
5785
5793
  }
5786
5794
  function bl(a) {
5787
- const e = vt[a];
5795
+ const e = xt[a];
5788
5796
  if (e)
5789
5797
  return e.clientCount++, e;
5790
5798
  const t = new self.URL(a, self.location.href).href, i = {
@@ -5792,16 +5800,16 @@ function bl(a) {
5792
5800
  scriptURL: t,
5793
5801
  clientCount: 1
5794
5802
  };
5795
- return vt[a] = i, i;
5803
+ return xt[a] = i, i;
5796
5804
  }
5797
5805
  function _l(a) {
5798
- const e = vt[a || kt];
5806
+ const e = xt[a || wt];
5799
5807
  if (e && e.clientCount-- === 1) {
5800
5808
  const {
5801
5809
  worker: s,
5802
5810
  objectURL: i
5803
5811
  } = e;
5804
- delete vt[a || kt], i && self.URL.revokeObjectURL(i), s.terminate();
5812
+ delete xt[a || wt], i && self.URL.revokeObjectURL(i), s.terminate();
5805
5813
  }
5806
5814
  }
5807
5815
  function Vn(a, e) {
@@ -5814,7 +5822,7 @@ function Ts(a, e) {
5814
5822
  let t = 0;
5815
5823
  return t = (a[e] & 127) << 21, t |= (a[e + 1] & 127) << 14, t |= (a[e + 2] & 127) << 7, t |= a[e + 3] & 127, t;
5816
5824
  }
5817
- function wt(a, e) {
5825
+ function Ot(a, e) {
5818
5826
  const t = e;
5819
5827
  let s = 0;
5820
5828
  for (; Ii(a, e); ) {
@@ -6119,7 +6127,7 @@ class bi {
6119
6127
  // feed incoming data to the front of the parsing pipeline
6120
6128
  demux(e, t) {
6121
6129
  this.cachedData && (e = De(this.cachedData, e), this.cachedData = null);
6122
- let s = wt(e, 0), i = s ? s.length : 0, r;
6130
+ let s = Ot(e, 0), i = s ? s.length : 0, r;
6123
6131
  const n = this._audioTrack, o = this._id3Track, c = s ? Ri(s) : void 0, l = e.length;
6124
6132
  for ((this.basePTS === null || this.frameIndex === 0 && M(c)) && (this.basePTS = ql(c, t, this.initPTS), this.lastPTS = this.basePTS), this.lastPTS === null && (this.lastPTS = this.basePTS), s && s.length > 0 && o.samples.push({
6125
6133
  pts: this.lastPTS,
@@ -6131,7 +6139,7 @@ class bi {
6131
6139
  if (this.canParse(e, i)) {
6132
6140
  const h = this.appendFrame(n, e, i);
6133
6141
  h ? (this.frameIndex++, this.lastPTS = h.sample.pts, i += h.length, r = i) : i = l;
6134
- } else Ol(e, i) ? (s = wt(e, i), o.samples.push({
6142
+ } else Ol(e, i) ? (s = Ot(e, i), o.samples.push({
6135
6143
  pts: this.lastPTS,
6136
6144
  dts: this.lastPTS,
6137
6145
  data: s,
@@ -6253,7 +6261,7 @@ function Zn(a, e) {
6253
6261
  const S = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
6254
6262
  Vt = S ? parseInt(S[1]) : 0;
6255
6263
  }
6256
- return !!Vt && Vt <= 87 && s === 2 && l >= 224e3 && o === 0 && (a[e + 3] = a[e + 3] | 128), {
6264
+ return Vt && Vt <= 87 && s === 2 && l >= 224e3 && o === 0 && (a[e + 3] = a[e + 3] | 128), {
6257
6265
  sampleRate: u,
6258
6266
  channelCount: d,
6259
6267
  frameLength: p,
@@ -6303,7 +6311,7 @@ class Jl extends bi {
6303
6311
  static probe(e, t) {
6304
6312
  if (!e)
6305
6313
  return !1;
6306
- const s = wt(e, 0);
6314
+ const s = Ot(e, 0);
6307
6315
  let i = (s == null ? void 0 : s.length) || 0;
6308
6316
  if (ea(e, i))
6309
6317
  return !1;
@@ -6367,7 +6375,7 @@ class ec extends bi {
6367
6375
  static probe(e) {
6368
6376
  if (!e)
6369
6377
  return !1;
6370
- const t = wt(e, 0);
6378
+ const t = Ot(e, 0);
6371
6379
  if (!t)
6372
6380
  return !1;
6373
6381
  const s = t.length;
@@ -6412,7 +6420,7 @@ class tc extends bi {
6412
6420
  static probe(e) {
6413
6421
  if (!e)
6414
6422
  return !1;
6415
- const t = wt(e, 0);
6423
+ const t = Ot(e, 0);
6416
6424
  let s = (t == null ? void 0 : t.length) || 0;
6417
6425
  if (t && e[s] === 11 && e[s + 1] === 119 && Ri(t) !== void 0 && // check the bsid to confirm ac-3 or ec-3 (not mp3)
6418
6426
  ta(e, s) <= 16)
@@ -6547,7 +6555,7 @@ class rc {
6547
6555
  });
6548
6556
  }
6549
6557
  decryptBuffer(e) {
6550
- return this.decrypter.decrypt(e, this.keyData.key.buffer, this.keyData.iv.buffer, Ze.cbc);
6558
+ return this.decrypter.decrypt(e, this.keyData.key.buffer, this.keyData.iv.buffer, Je.cbc);
6551
6559
  }
6552
6560
  // AAC - encrypt all full 16 bytes blocks starting from offset 16
6553
6561
  decryptAacSample(e, t, s) {
@@ -6692,7 +6700,7 @@ class ia {
6692
6700
  return e.naluState = r, o;
6693
6701
  }
6694
6702
  }
6695
- class bt {
6703
+ class _t {
6696
6704
  constructor(e) {
6697
6705
  this.data = void 0, this.bytesAvailable = void 0, this.word = void 0, this.bitsAvailable = void 0, this.data = e, this.bytesAvailable = e.byteLength, this.word = 0, this.bitsAvailable = 0;
6698
6706
  }
@@ -6834,7 +6842,7 @@ class nc extends ia {
6834
6842
  return e[t] & 31;
6835
6843
  }
6836
6844
  readSliceType(e) {
6837
- const t = new bt(e);
6845
+ const t = new _t(e);
6838
6846
  return t.readUByte(), t.readUEG(), t.readUEG();
6839
6847
  }
6840
6848
  /**
@@ -6857,7 +6865,7 @@ class nc extends ia {
6857
6865
  * associated video frames.
6858
6866
  */
6859
6867
  readSPS(e) {
6860
- const t = new bt(e);
6868
+ const t = new _t(e);
6861
6869
  let s = 0, i = 0, r = 0, n = 0, o, c, l;
6862
6870
  const h = t.readUByte.bind(t), u = t.readBits.bind(t), d = t.readUEG.bind(t), f = t.readBoolean.bind(t), g = t.skipBits.bind(t), y = t.skipEG.bind(t), p = t.skipUEG.bind(t), E = this.skipScalingList.bind(this);
6863
6871
  h();
@@ -7044,7 +7052,7 @@ class ac extends ia {
7044
7052
  super.pushAccessUnit(e, t), this.initVPS && (this.initVPS = null);
7045
7053
  }
7046
7054
  readVPS(e) {
7047
- const t = new bt(e);
7055
+ const t = new _t(e);
7048
7056
  t.readUByte(), t.readUByte(), t.readBits(4), t.skipBits(2), t.readBits(6);
7049
7057
  const s = t.readBits(3), i = t.readBoolean();
7050
7058
  return {
@@ -7053,7 +7061,7 @@ class ac extends ia {
7053
7061
  };
7054
7062
  }
7055
7063
  readSPS(e) {
7056
- const t = new bt(this.ebsp2rbsp(e));
7064
+ const t = new _t(this.ebsp2rbsp(e));
7057
7065
  t.readUByte(), t.readUByte(), t.readBits(4);
7058
7066
  const s = t.readBits(3);
7059
7067
  t.readBoolean();
@@ -7075,13 +7083,13 @@ class ac extends ia {
7075
7083
  for (let J = $ ? 0 : s; J <= s; J++)
7076
7084
  t.skipUEG(), t.skipUEG(), t.skipUEG();
7077
7085
  if (t.skipUEG(), t.skipUEG(), t.skipUEG(), t.skipUEG(), t.skipUEG(), t.skipUEG(), t.readBoolean() && t.readBoolean())
7078
- for (let ye = 0; ye < 4; ye++)
7079
- for (let _e = 0; _e < (ye === 3 ? 2 : 6); _e++)
7086
+ for (let Ee = 0; Ee < 4; Ee++)
7087
+ for (let _e = 0; _e < (Ee === 3 ? 2 : 6); _e++)
7080
7088
  if (!t.readBoolean())
7081
7089
  t.readUEG();
7082
7090
  else {
7083
- const Pe = Math.min(64, 1 << 4 + (ye << 1));
7084
- ye > 1 && t.readEG();
7091
+ const Pe = Math.min(64, 1 << 4 + (Ee << 1));
7092
+ Ee > 1 && t.readEG();
7085
7093
  for (let ct = 0; ct < Pe; ct++)
7086
7094
  t.readEG();
7087
7095
  }
@@ -7089,28 +7097,28 @@ class ac extends ia {
7089
7097
  const N = t.readUEG();
7090
7098
  let K = 0;
7091
7099
  for (let J = 0; J < N; J++) {
7092
- let ye = !1;
7093
- if (J !== 0 && (ye = t.readBoolean()), ye) {
7100
+ let Ee = !1;
7101
+ if (J !== 0 && (Ee = t.readBoolean()), Ee) {
7094
7102
  J === N && t.readUEG(), t.readBoolean(), t.readUEG();
7095
7103
  let _e = 0;
7096
- for (let et = 0; et <= K; et++) {
7104
+ for (let tt = 0; tt <= K; tt++) {
7097
7105
  const Pe = t.readBoolean();
7098
7106
  let ct = !1;
7099
7107
  Pe || (ct = t.readBoolean()), (Pe || ct) && _e++;
7100
7108
  }
7101
7109
  K = _e;
7102
7110
  } else {
7103
- const _e = t.readUEG(), et = t.readUEG();
7104
- K = _e + et;
7111
+ const _e = t.readUEG(), tt = t.readUEG();
7112
+ K = _e + tt;
7105
7113
  for (let Pe = 0; Pe < _e; Pe++)
7106
7114
  t.readUEG(), t.readBoolean();
7107
- for (let Pe = 0; Pe < et; Pe++)
7115
+ for (let Pe = 0; Pe < tt; Pe++)
7108
7116
  t.readUEG(), t.readBoolean();
7109
7117
  }
7110
7118
  }
7111
7119
  if (t.readBoolean()) {
7112
7120
  const J = t.readUEG();
7113
- for (let ye = 0; ye < J; ye++) {
7121
+ for (let Ee = 0; Ee < J; Ee++) {
7114
7122
  for (let _e = 0; _e < H + 4; _e++)
7115
7123
  t.readBits(1);
7116
7124
  t.readBits(1);
@@ -7118,44 +7126,44 @@ class ac extends ia {
7118
7126
  }
7119
7127
  let w = 0, O = 1, j = 1, ee = !0, X = 1, Z = 0;
7120
7128
  t.readBoolean(), t.readBoolean();
7121
- let pe = !1;
7129
+ let ye = !1;
7122
7130
  if (t.readBoolean()) {
7123
7131
  if (t.readBoolean()) {
7124
- const tt = t.readUByte(), Mi = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2], Mt = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
7125
- tt > 0 && tt < 16 ? (O = Mi[tt - 1], j = Mt[tt - 1]) : tt === 255 && (O = t.readBits(16), j = t.readBits(16));
7132
+ const st = t.readUByte(), Mi = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2], Nt = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
7133
+ st > 0 && st < 16 ? (O = Mi[st - 1], j = Nt[st - 1]) : st === 255 && (O = t.readBits(16), j = t.readBits(16));
7126
7134
  }
7127
- if (t.readBoolean() && t.readBoolean(), t.readBoolean() && (t.readBits(3), t.readBoolean(), t.readBoolean() && (t.readUByte(), t.readUByte(), t.readUByte())), t.readBoolean() && (t.readUEG(), t.readUEG()), t.readBoolean(), t.readBoolean(), t.readBoolean(), pe = t.readBoolean(), pe && (t.skipUEG(), t.skipUEG(), t.skipUEG(), t.skipUEG()), t.readBoolean() && (X = t.readBits(32), Z = t.readBits(32), t.readBoolean() && t.readUEG(), t.readBoolean())) {
7128
- const Mt = t.readBoolean(), Ni = t.readBoolean();
7129
- let xt = !1;
7130
- (Mt || Ni) && (xt = t.readBoolean(), xt && (t.readUByte(), t.readBits(5), t.readBoolean(), t.readBits(5)), t.readBits(4), t.readBits(4), xt && t.readBits(4), t.readBits(5), t.readBits(5), t.readBits(5));
7135
+ if (t.readBoolean() && t.readBoolean(), t.readBoolean() && (t.readBits(3), t.readBoolean(), t.readBoolean() && (t.readUByte(), t.readUByte(), t.readUByte())), t.readBoolean() && (t.readUEG(), t.readUEG()), t.readBoolean(), t.readBoolean(), t.readBoolean(), ye = t.readBoolean(), ye && (t.skipUEG(), t.skipUEG(), t.skipUEG(), t.skipUEG()), t.readBoolean() && (X = t.readBits(32), Z = t.readBits(32), t.readBoolean() && t.readUEG(), t.readBoolean())) {
7136
+ const Nt = t.readBoolean(), Ni = t.readBoolean();
7137
+ let At = !1;
7138
+ (Nt || Ni) && (At = t.readBoolean(), At && (t.readUByte(), t.readBits(5), t.readBoolean(), t.readBits(5)), t.readBits(4), t.readBits(4), At && t.readBits(4), t.readBits(5), t.readBits(5), t.readBits(5));
7131
7139
  for (let Bi = 0; Bi <= s; Bi++) {
7132
7140
  ee = t.readBoolean();
7133
7141
  const Na = ee || t.readBoolean();
7134
7142
  let Ui = !1;
7135
7143
  Na ? t.readEG() : Ui = t.readBoolean();
7136
7144
  const $i = Ui ? 1 : t.readUEG() + 1;
7137
- if (Mt)
7138
- for (let At = 0; At < $i; At++)
7139
- t.readUEG(), t.readUEG(), xt && (t.readUEG(), t.readUEG()), t.skipBits(1);
7145
+ if (Nt)
7146
+ for (let It = 0; It < $i; It++)
7147
+ t.readUEG(), t.readUEG(), At && (t.readUEG(), t.readUEG()), t.skipBits(1);
7140
7148
  if (Ni)
7141
- for (let At = 0; At < $i; At++)
7142
- t.readUEG(), t.readUEG(), xt && (t.readUEG(), t.readUEG()), t.skipBits(1);
7149
+ for (let It = 0; It < $i; It++)
7150
+ t.readUEG(), t.readUEG(), At && (t.readUEG(), t.readUEG()), t.skipBits(1);
7143
7151
  }
7144
7152
  }
7145
7153
  t.readBoolean() && (t.readBoolean(), t.readBoolean(), t.readBoolean(), w = t.readUEG());
7146
7154
  }
7147
7155
  let be = x, Oe = D;
7148
7156
  if (A) {
7149
- let J = 1, ye = 1;
7150
- v === 1 ? J = ye = 2 : v == 2 && (J = 2), be = x - J * b - J * _, Oe = D - ye * P - ye * I;
7157
+ let J = 1, Ee = 1;
7158
+ v === 1 ? J = Ee = 2 : v == 2 && (J = 2), be = x - J * b - J * _, Oe = D - Ee * P - Ee * I;
7151
7159
  }
7152
- const Je = i ? ["A", "B", "C"][i] : "", Ma = o << 24 | c << 16 | l << 8 | h;
7160
+ const et = i ? ["A", "B", "C"][i] : "", Ma = o << 24 | c << 16 | l << 8 | h;
7153
7161
  let vs = 0;
7154
7162
  for (let J = 0; J < 32; J++)
7155
7163
  vs = (vs | (Ma >> J & 1) << 31 - J) >>> 0;
7156
7164
  let xs = vs.toString(16);
7157
7165
  return n === 1 && xs === "2" && (xs = "6"), {
7158
- codecString: `hvc1.${Je}${n}.${xs}.${r ? "H" : "L"}${E}.B0`,
7166
+ codecString: `hvc1.${et}${n}.${xs}.${r ? "H" : "L"}${E}.B0`,
7159
7167
  params: {
7160
7168
  general_tier_flag: r,
7161
7169
  general_profile_idc: n,
@@ -7179,7 +7187,7 @@ class ac extends ia {
7179
7187
  };
7180
7188
  }
7181
7189
  readPPS(e) {
7182
- const t = new bt(this.ebsp2rbsp(e));
7190
+ const t = new _t(this.ebsp2rbsp(e));
7183
7191
  t.readUByte(), t.readUByte(), t.skipUEG(), t.skipUEG(), t.skipBits(2), t.skipBits(3), t.skipBits(2), t.skipUEG(), t.skipUEG(), t.skipEG(), t.skipBits(2), t.readBoolean() && t.skipUEG(), t.skipEG(), t.skipEG(), t.skipBits(4);
7184
7192
  const i = t.readBoolean(), r = t.readBoolean();
7185
7193
  let n = 1;
@@ -7277,14 +7285,14 @@ class ze {
7277
7285
  P = A + 4;
7278
7286
  switch (b) {
7279
7287
  case h:
7280
- _ && (u && (r = dt(u, this.logger)) && (this.readyVideoParser(n.segmentCodec), this.videoParser !== null && this.videoParser.parsePES(n, l, r, !1)), u = {
7288
+ _ && (u && (r = ft(u, this.logger)) && (this.readyVideoParser(n.segmentCodec), this.videoParser !== null && this.videoParser.parsePES(n, l, r, !1)), u = {
7281
7289
  data: [],
7282
7290
  size: 0
7283
7291
  }), u && (u.data.push(e.subarray(P, A + de)), u.size += A + de - P);
7284
7292
  break;
7285
7293
  case d:
7286
7294
  if (_) {
7287
- if (g && (r = dt(g, this.logger)))
7295
+ if (g && (r = ft(g, this.logger)))
7288
7296
  switch (o.segmentCodec) {
7289
7297
  case "aac":
7290
7298
  this.parseAACPES(o, r);
@@ -7304,7 +7312,7 @@ class ze {
7304
7312
  g && (g.data.push(e.subarray(P, A + de)), g.size += A + de - P);
7305
7313
  break;
7306
7314
  case f:
7307
- _ && (y && (r = dt(y, this.logger)) && this.parseID3PES(c, r), y = {
7315
+ _ && (y && (r = ft(y, this.logger)) && this.parseID3PES(c, r), y = {
7308
7316
  data: [],
7309
7317
  size: 0
7310
7318
  }), y && (y.data.push(e.subarray(P, A + de)), y.size += A + de - P);
@@ -7357,7 +7365,7 @@ class ze {
7357
7365
  textTrack: r
7358
7366
  } = e, n = s.pesData, o = t.pesData, c = i.pesData;
7359
7367
  let l;
7360
- if (n && (l = dt(n, this.logger)) ? (this.readyVideoParser(s.segmentCodec), this.videoParser !== null && (this.videoParser.parsePES(s, r, l, !0), s.pesData = null)) : s.pesData = n, o && (l = dt(o, this.logger))) {
7368
+ if (n && (l = ft(n, this.logger)) ? (this.readyVideoParser(s.segmentCodec), this.videoParser !== null && (this.videoParser.parsePES(s, r, l, !0), s.pesData = null)) : s.pesData = n, o && (l = ft(o, this.logger))) {
7361
7369
  switch (t.segmentCodec) {
7362
7370
  case "aac":
7363
7371
  this.parseAACPES(t, l);
@@ -7372,7 +7380,7 @@ class ze {
7372
7380
  t.pesData = null;
7373
7381
  } else
7374
7382
  o != null && o.size && this.logger.log("last AAC PES packet truncated,might overlap between fragments"), t.pesData = o;
7375
- c && (l = dt(c, this.logger)) ? (this.parseID3PES(i, l), i.pesData = null) : i.pesData = c;
7383
+ c && (l = ft(c, this.logger)) ? (this.parseID3PES(i, l), i.pesData = null) : i.pesData = c;
7376
7384
  }
7377
7385
  demuxSampleAes(e, t, s) {
7378
7386
  const i = this.demux(e, s, !0, !this.config.progressive), r = this.sampleAes = new rc(this.observer, this.config, t);
@@ -7543,11 +7551,7 @@ function lc(a, e, t, s, i, r) {
7543
7551
  if (n.audioPid === -1 && u > 0) {
7544
7552
  let d = e + 5, f = u;
7545
7553
  for (; f > 2; ) {
7546
- switch (a[d]) {
7547
- case 106:
7548
- t.ac3 !== !0 ? r.log("AC-3 audio found, not supported in this browser for now") : (n.audioPid = h, n.segmentAudioCodec = "ac3");
7549
- break;
7550
- }
7554
+ a[d] === 106 && (t.ac3 !== !0 ? r.log("AC-3 audio found, not supported in this browser for now") : (n.audioPid = h, n.segmentAudioCodec = "ac3"));
7551
7555
  const y = a[d + 1] + 2;
7552
7556
  d += y, f -= y;
7553
7557
  }
@@ -7579,7 +7583,7 @@ function ii(a, e, t, s) {
7579
7583
  function ks(a, e) {
7580
7584
  e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`);
7581
7585
  }
7582
- function dt(a, e) {
7586
+ function ft(a, e) {
7583
7587
  let t = 0, s, i, r, n, o;
7584
7588
  const c = a.data;
7585
7589
  if (!a || a.size === 0)
@@ -8836,7 +8840,7 @@ function Di(a, e, t = 1, s = !1) {
8836
8840
  function hc(a, e, t = 1, s = !1) {
8837
8841
  return Di(a, e, 1 / t, s);
8838
8842
  }
8839
- function It(a, e = !1) {
8843
+ function Lt(a, e = !1) {
8840
8844
  return Di(a, 1e3, 1 / ra, e);
8841
8845
  }
8842
8846
  function uc(a, e = 1) {
@@ -8851,7 +8855,7 @@ function Cr(a) {
8851
8855
  return `${e / t} (${e}/${t}) trackId: ${s}`;
8852
8856
  }
8853
8857
  const dc = 10 * 1e3, fc = 1024, gc = 1152, mc = 1536;
8854
- let ft = null, ws = null;
8858
+ let gt = null, ws = null;
8855
8859
  function Pr(a, e, t, s) {
8856
8860
  return {
8857
8861
  duration: e,
@@ -8869,9 +8873,9 @@ function Pr(a, e, t, s) {
8869
8873
  }
8870
8874
  class ss extends Ce {
8871
8875
  constructor(e, t, s, i) {
8872
- if (super("mp4-remuxer", i), this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.ISGenerated = !1, this._initPTS = null, this._initDTS = null, this.nextVideoTs = null, this.nextAudioTs = null, this.videoSampleDuration = null, this.isAudioContiguous = !1, this.isVideoContiguous = !1, this.videoTrackConfig = void 0, this.observer = e, this.config = t, this.typeSupported = s, this.ISGenerated = !1, ft === null) {
8876
+ if (super("mp4-remuxer", i), this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.ISGenerated = !1, this._initPTS = null, this._initDTS = null, this.nextVideoTs = null, this.nextAudioTs = null, this.videoSampleDuration = null, this.isAudioContiguous = !1, this.isVideoContiguous = !1, this.videoTrackConfig = void 0, this.observer = e, this.config = t, this.typeSupported = s, this.ISGenerated = !1, gt === null) {
8873
8877
  const n = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
8874
- ft = n ? parseInt(n[1]) : 0;
8878
+ gt = n ? parseInt(n[1]) : 0;
8875
8879
  }
8876
8880
  if (ws === null) {
8877
8881
  const r = navigator.userAgent.match(/Safari\/(\d+)/i);
@@ -9013,7 +9017,7 @@ class ss extends Ce {
9013
9017
  let u = this.nextVideoTs, d = 8, f = this.videoSampleDuration, g, y, p = Number.POSITIVE_INFINITY, E = Number.NEGATIVE_INFINITY, T = !1;
9014
9018
  if (!s || u === null) {
9015
9019
  const w = h + t * r, O = n[0].pts - Ie(n[0].dts, n[0].pts);
9016
- ft && u !== null && Math.abs(w - O - (u + h)) < 15e3 ? s = !0 : u = w - O - h;
9020
+ gt && u !== null && Math.abs(w - O - (u + h)) < 15e3 ? s = !0 : u = w - O - h;
9017
9021
  }
9018
9022
  const S = u + h;
9019
9023
  for (let w = 0; w < c; w++) {
@@ -9027,7 +9031,7 @@ class ss extends Ce {
9027
9031
  const v = y - g, x = v ? Math.round(v / (c - 1)) : f || e.inputTimeScale / 30;
9028
9032
  if (s) {
9029
9033
  const w = g - S, O = w > x, j = w < -1;
9030
- if ((O || j) && (O ? this.warn(`${(e.segmentCodec || "").toUpperCase()}: ${It(w, !0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`) : this.warn(`${(e.segmentCodec || "").toUpperCase()}: ${It(-w, !0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`), !j || S >= n[0].pts || ft)) {
9034
+ if ((O || j) && (O ? this.warn(`${(e.segmentCodec || "").toUpperCase()}: ${Lt(w, !0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`) : this.warn(`${(e.segmentCodec || "").toUpperCase()}: ${Lt(-w, !0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`), !j || S >= n[0].pts || gt)) {
9031
9035
  g = S;
9032
9036
  const ee = n[0].pts - w;
9033
9037
  if (O)
@@ -9035,14 +9039,14 @@ class ss extends Ce {
9035
9039
  else {
9036
9040
  let X = !0;
9037
9041
  for (let Z = 0; Z < n.length && !(n[Z].dts > ee && X); Z++) {
9038
- const pe = n[Z].pts;
9042
+ const ye = n[Z].pts;
9039
9043
  if (n[Z].dts -= w, n[Z].pts -= w, Z < n.length - 1) {
9040
- const fe = n[Z + 1].pts, be = n[Z].pts, Oe = fe <= be, Je = fe <= pe;
9041
- X = Oe == Je;
9044
+ const fe = n[Z + 1].pts, be = n[Z].pts, Oe = fe <= be, et = fe <= ye;
9045
+ X = Oe == et;
9042
9046
  }
9043
9047
  }
9044
9048
  }
9045
- this.log(`Video: Initial PTS/DTS adjusted: ${It(ee, !0)}/${It(g, !0)}, delta: ${It(w, !0)} ms`);
9049
+ this.log(`Video: Initial PTS/DTS adjusted: ${Lt(ee, !0)}/${Lt(g, !0)}, delta: ${Lt(w, !0)} ms`);
9046
9050
  }
9047
9051
  }
9048
9052
  g = Math.max(0, g);
@@ -9076,17 +9080,17 @@ class ss extends Ce {
9076
9080
  for (let w = 0; w < c; w++) {
9077
9081
  const O = n[w], j = O.units;
9078
9082
  let ee = 0;
9079
- for (let pe = 0, fe = j.length; pe < fe; pe++) {
9080
- const be = j[pe], Oe = be.data, Je = be.data.byteLength;
9081
- P.setUint32(d, Je), d += 4, I.set(Oe, d), d += Je, ee += 4 + Je;
9083
+ for (let ye = 0, fe = j.length; ye < fe; ye++) {
9084
+ const be = j[ye], Oe = be.data, et = be.data.byteLength;
9085
+ P.setUint32(d, et), d += 4, I.set(Oe, d), d += et, ee += 4 + et;
9082
9086
  }
9083
9087
  let X;
9084
9088
  if (w < c - 1)
9085
9089
  f = n[w + 1].dts - O.dts, X = n[w + 1].pts - O.pts;
9086
9090
  else {
9087
- const pe = this.config, fe = w > 0 ? O.dts - n[w - 1].dts : x;
9088
- if (X = w > 0 ? O.pts - n[w - 1].pts : x, pe.stretchShortVideoTrack && this.nextAudioTs !== null) {
9089
- const be = Math.floor(pe.maxBufferHole * r), Oe = (i ? p + i * r : this.nextAudioTs + h) - O.pts;
9091
+ const ye = this.config, fe = w > 0 ? O.dts - n[w - 1].dts : x;
9092
+ if (X = w > 0 ? O.pts - n[w - 1].pts : x, ye.stretchShortVideoTrack && this.nextAudioTs !== null) {
9093
+ const be = Math.floor(ye.maxBufferHole * r), Oe = (i ? p + i * r : this.nextAudioTs + h) - O.pts;
9090
9094
  Oe > be ? (f = Oe - fe, f < 0 ? f = fe : F = !0, this.log(`It is approximately ${Oe / 90} ms to the next segment; using duration ${f / 90} ms for the last video frame.`)) : f = fe;
9091
9095
  } else
9092
9096
  f = fe;
@@ -9095,8 +9099,8 @@ class ss extends Ce {
9095
9099
  U = Math.min(U, f), $ = Math.max($, f), H = Math.min(H, X), k = Math.max(k, X), o.push(Pr(O.key, f, ee, Z));
9096
9100
  }
9097
9101
  if (o.length) {
9098
- if (ft) {
9099
- if (ft < 70) {
9102
+ if (gt) {
9103
+ if (gt < 70) {
9100
9104
  const w = o[0].flags;
9101
9105
  w.dependsOn = 2, w.isNonSync = 0;
9102
9106
  }
@@ -9218,7 +9222,7 @@ class ss extends Ce {
9218
9222
  samples: f
9219
9223
  }));
9220
9224
  e.samples = [];
9221
- const F = (v - T) / n, U = E / n, $ = {
9225
+ const F = (v - T) / n, U = this.nextAudioTs / n, $ = {
9222
9226
  data1: P,
9223
9227
  data2: D,
9224
9228
  startPTS: F,
@@ -9468,7 +9472,7 @@ class wr {
9468
9472
  duration: T,
9469
9473
  initSegmentData: S
9470
9474
  } = c, v = Tc(n, t);
9471
- if (v && yt(v.method)) {
9475
+ if (v && Et(v.method)) {
9472
9476
  const _ = this.getDecrypter(), b = Si(v.method);
9473
9477
  if (_.isSync()) {
9474
9478
  let I = _.softwareDecrypt(n, v.key.buffer, v.iv.buffer, b);
@@ -9499,7 +9503,7 @@ class wr {
9499
9503
  }
9500
9504
  (h || u || g || x) && this.resetInitSegment(S, y, p, T, t), (h || g || x) && this.resetInitialTimestamp(E), l || this.resetContiguity();
9501
9505
  const D = this.transmux(n, v, f, d, s);
9502
- this.asyncResult = Ot(D);
9506
+ this.asyncResult = Ft(D);
9503
9507
  const A = this.currentTransmuxState;
9504
9508
  return A.contiguous = !0, A.discontinuity = !1, A.trackSwitch = !1, r.executeEnd = We(), D;
9505
9509
  }
@@ -9531,7 +9535,7 @@ class wr {
9531
9535
  return this.asyncResult ? Promise.resolve(u) : u;
9532
9536
  }
9533
9537
  const h = c.flush(o);
9534
- return Ot(h) ? (this.asyncResult = !0, h.then((u) => (this.flushRemux(n, u, e), n))) : (this.flushRemux(n, h, e), this.asyncResult ? Promise.resolve(n) : n);
9538
+ return Ft(h) ? (this.asyncResult = !0, h.then((u) => (this.flushRemux(n, u, e), n))) : (this.flushRemux(n, h, e), this.asyncResult ? Promise.resolve(n) : n);
9535
9539
  }
9536
9540
  flushRemux(e, t, s) {
9537
9541
  const {
@@ -9631,7 +9635,7 @@ const Os = (a) => ({
9631
9635
  remuxResult: {},
9632
9636
  chunkMeta: a
9633
9637
  });
9634
- function Ot(a) {
9638
+ function Ft(a) {
9635
9639
  return "then" in a && a.then instanceof Function;
9636
9640
  }
9637
9641
  class Sc {
@@ -9781,7 +9785,7 @@ class oa {
9781
9785
  }, e instanceof ArrayBuffer ? [e] : []);
9782
9786
  else if (g) {
9783
9787
  const P = g.push(e, p, l, I);
9784
- Ot(P) ? P.then((F) => {
9788
+ Ft(P) ? P.then((F) => {
9785
9789
  this.handleTransmuxComplete(F);
9786
9790
  }).catch((F) => {
9787
9791
  this.transmuxerError(F, l, "transmuxer-interface push error");
@@ -9802,7 +9806,7 @@ class oa {
9802
9806
  });
9803
9807
  else if (s) {
9804
9808
  const i = s.flush(e);
9805
- Ot(i) ? i.then((r) => {
9809
+ Ft(i) ? i.then((r) => {
9806
9810
  this.handleFlushResult(r, e);
9807
9811
  }).catch((r) => {
9808
9812
  this.transmuxerError(r, e, "transmuxer-interface flush error");
@@ -10019,7 +10023,7 @@ class xc extends xi {
10019
10023
  onAudioTracksUpdated(e, {
10020
10024
  audioTracks: t
10021
10025
  }) {
10022
- this.resetTransmuxer(), this.levels = t.map((s) => new Pt(s));
10026
+ this.resetTransmuxer(), this.levels = t.map((s) => new kt(s));
10023
10027
  }
10024
10028
  onAudioTrackSwitching(e, t) {
10025
10029
  const s = !!t.url;
@@ -10322,14 +10326,14 @@ class xc extends xi {
10322
10326
  audioCodec: n,
10323
10327
  channels: o
10324
10328
  } = this.bufferedTrack;
10325
- at({
10329
+ ot({
10326
10330
  name: t,
10327
10331
  lang: s,
10328
10332
  assocLang: i,
10329
10333
  characteristics: r,
10330
10334
  audioCodec: n,
10331
10335
  channels: o
10332
- }, e, rt) || (hs(e.url, this.hls) ? (this.log("Switching audio track : flushing all audio"), super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio"), this.bufferedTrack = null) : this.bufferedTrack = e);
10336
+ }, e, nt) || (hs(e.url, this.hls) ? (this.log("Switching audio track : flushing all audio"), super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio"), this.bufferedTrack = null) : this.bufferedTrack = e);
10333
10337
  }
10334
10338
  }
10335
10339
  completeAudioSwitch(e) {
@@ -10522,11 +10526,11 @@ function la(a, e) {
10522
10526
  if (a.length !== e.length)
10523
10527
  return !1;
10524
10528
  for (let t = 0; t < a.length; t++)
10525
- if (!Ft(a[t].attrs, e[t].attrs))
10529
+ if (!Mt(a[t].attrs, e[t].attrs))
10526
10530
  return !1;
10527
10531
  return !0;
10528
10532
  }
10529
- function Ft(a, e, t) {
10533
+ function Mt(a, e, t) {
10530
10534
  const s = a["STABLE-RENDITION-ID"];
10531
10535
  return s && !t ? s === e["STABLE-RENDITION-ID"] : !(t || ["LANGUAGE", "NAME", "CHARACTERISTICS", "AUTOSELECT", "DEFAULT", "FORCED", "ASSOC-LANGUAGE"]).some((i) => a[i] !== e[i]);
10532
10536
  }
@@ -10595,7 +10599,7 @@ class Ac extends Ci {
10595
10599
  this.tracksInGroup = o;
10596
10600
  const c = this.hls.config.audioPreference;
10597
10601
  if (!r && c) {
10598
- const d = Ue(c, o, rt);
10602
+ const d = Ue(c, o, nt);
10599
10603
  if (d > -1)
10600
10604
  r = o[d];
10601
10605
  else {
@@ -10645,16 +10649,16 @@ class Ac extends Ci {
10645
10649
  const s = this.allAudioTracks;
10646
10650
  if (this.selectDefaultTrack = !1, s.length) {
10647
10651
  const i = this.currentTrack;
10648
- if (i && at(e, i, rt))
10652
+ if (i && ot(e, i, nt))
10649
10653
  return i;
10650
- const r = Ue(e, this.tracksInGroup, rt);
10654
+ const r = Ue(e, this.tracksInGroup, nt);
10651
10655
  if (r > -1) {
10652
10656
  const n = this.tracksInGroup[r];
10653
10657
  return this.setAudioTrack(r), n;
10654
10658
  } else if (i) {
10655
10659
  let n = t.loadLevel;
10656
10660
  n === -1 && (n = t.firstAutoLevel);
10657
- const o = Fo(e, t.levels, s, n, rt);
10661
+ const o = Fo(e, t.levels, s, n, nt);
10658
10662
  if (o === -1)
10659
10663
  return null;
10660
10664
  t.nextLoadLevel = o;
@@ -10685,7 +10689,7 @@ class Ac extends Ci {
10685
10689
  const t = this.tracksInGroup;
10686
10690
  for (let s = 0; s < t.length; s++) {
10687
10691
  const i = t[s];
10688
- if (!(this.selectDefaultTrack && !i.default) && (!e || at(e, i, rt)))
10692
+ if (!(this.selectDefaultTrack && !i.default) && (!e || ot(e, i, nt)))
10689
10693
  return s;
10690
10694
  }
10691
10695
  if (e) {
@@ -10699,24 +10703,24 @@ class Ac extends Ci {
10699
10703
  } = e;
10700
10704
  for (let l = 0; l < t.length; l++) {
10701
10705
  const h = t[l];
10702
- if (at({
10706
+ if (ot({
10703
10707
  name: s,
10704
10708
  lang: i,
10705
10709
  assocLang: r,
10706
10710
  characteristics: n,
10707
10711
  audioCodec: o,
10708
10712
  channels: c
10709
- }, h, rt))
10713
+ }, h, nt))
10710
10714
  return l;
10711
10715
  }
10712
10716
  for (let l = 0; l < t.length; l++) {
10713
10717
  const h = t[l];
10714
- if (Ft(e.attrs, h.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"]))
10718
+ if (Mt(e.attrs, h.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"]))
10715
10719
  return l;
10716
10720
  }
10717
10721
  for (let l = 0; l < t.length; l++) {
10718
10722
  const h = t[l];
10719
- if (Ft(e.attrs, h.attrs, ["LANGUAGE"]))
10723
+ if (Mt(e.attrs, h.attrs, ["LANGUAGE"]))
10720
10724
  return l;
10721
10725
  }
10722
10726
  }
@@ -10884,7 +10888,7 @@ class Rc extends Ce {
10884
10888
  _objectUrl: i
10885
10889
  } = this;
10886
10890
  s !== i && this.error(`Media element src was set while attaching MediaSource (${i} > ${s})`);
10887
- }, this.hls = e, this.fragmentTracker = t, this.appendSource = qa(Qe(e.config.preferManagedMediaSource)), this.initTracks(), this.registerListeners();
10891
+ }, this.hls = e, this.fragmentTracker = t, this.appendSource = qa(Ze(e.config.preferManagedMediaSource)), this.initTracks(), this.registerListeners();
10888
10892
  }
10889
10893
  hasSourceTypes() {
10890
10894
  return Object.keys(this.tracks).length > 0;
@@ -10943,7 +10947,7 @@ class Rc extends Ce {
10943
10947
  onMediaAttaching(e, t) {
10944
10948
  const s = this.media = t.media;
10945
10949
  this.transferData = this.overrides = void 0;
10946
- const i = Qe(this.appendSource);
10950
+ const i = Ze(this.appendSource);
10947
10951
  if (i) {
10948
10952
  const r = !!t.mediaSource;
10949
10953
  (r || t.overrides) && (this.transferData = t, this.overrides = t.overrides);
@@ -11254,9 +11258,9 @@ transfer tracks: ${ne(i, (c, l) => c === "initSegment" ? void 0 : l)}}`), !nn(i,
11254
11258
  if (A.code === DOMException.QUOTA_EXCEEDED_ERR || A.name == "QuotaExceededError" || "quota" in A)
11255
11259
  b.details = R.BUFFER_FULL_ERROR;
11256
11260
  else if (A.code === DOMException.INVALID_STATE_ERR && this.mediaSourceOpenOrEnded && !I)
11257
- b.errorAction = pt(!0);
11261
+ b.errorAction = yt(!0);
11258
11262
  else if (A.name === ca && this.sourceBufferCount === 0)
11259
- b.errorAction = pt(!0);
11263
+ b.errorAction = yt(!0);
11260
11264
  else {
11261
11265
  const P = ++this.appendErrors[r];
11262
11266
  this.warn(`Failed ${P}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${I || "no media error"})`), (P >= this.hls.config.appendErrorMaxRetry || I) && (b.fatal = !0);
@@ -11580,7 +11584,7 @@ transfer tracks: ${ne(i, (c, l) => c === "initSegment" ? void 0 : l)}}`), !nn(i,
11580
11584
  getTrackCodec(e, t) {
11581
11585
  const s = e.supplemental;
11582
11586
  let i = e.codec;
11583
- s && (t === "video" || t === "audiovideo") && Dt(s, "video") && (i = po(i, s));
11587
+ s && (t === "video" || t === "audiovideo") && Ct(s, "video") && (i = po(i, s));
11584
11588
  const r = Jt(i, e.levelCodec);
11585
11589
  return r ? t.slice(0, 5) === "audio" ? ls(r, this.appendSource) : r : "";
11586
11590
  }
@@ -11690,7 +11694,7 @@ transfer tracks: ${ne(i, (c, l) => c === "initSegment" ? void 0 : l)}}`), !nn(i,
11690
11694
  const {
11691
11695
  operationQueue: s
11692
11696
  } = this, i = t.map((n) => this.appendBlocker(n));
11693
- return t.length > 1 && !!this.blockedAudioAppend && this.unblockAudio(), Promise.all(i).then((n) => {
11697
+ return t.length > 1 && this.blockedAudioAppend && this.unblockAudio(), Promise.all(i).then((n) => {
11694
11698
  s === this.operationQueue && (e(), this.stepOperationQueue(this.sourceBufferTypes));
11695
11699
  });
11696
11700
  }
@@ -12065,7 +12069,7 @@ function Qc(a, e = {
12065
12069
  function ga(a, e) {
12066
12070
  return Qc(a, e);
12067
12071
  }
12068
- const Me = "CMCD-Object", le = "CMCD-Request", st = "CMCD-Session", je = "CMCD-Status", Zc = {
12072
+ const Me = "CMCD-Object", le = "CMCD-Request", it = "CMCD-Session", je = "CMCD-Status", Zc = {
12069
12073
  // Object
12070
12074
  br: Me,
12071
12075
  ab: Me,
@@ -12101,13 +12105,13 @@ const Me = "CMCD-Object", le = "CMCD-Request", st = "CMCD-Session", je = "CMCD-S
12101
12105
  // TODO: Which header to put the `ts` field is not defined yet.
12102
12106
  ts: le,
12103
12107
  // Session
12104
- cid: st,
12105
- pr: st,
12106
- sf: st,
12107
- sid: st,
12108
- st,
12109
- v: st,
12110
- msd: st,
12108
+ cid: it,
12109
+ pr: it,
12110
+ sf: it,
12111
+ sid: it,
12112
+ st: it,
12113
+ v: it,
12114
+ msd: it,
12111
12115
  // Status
12112
12116
  bs: je,
12113
12117
  bsd: je,
@@ -12633,7 +12637,7 @@ class Lh extends Ce {
12633
12637
  u["PATHWAY-ID"] = n;
12634
12638
  const d = u.AUDIO && `${u.AUDIO}_clone_${n}`, f = u.SUBTITLES && `${u.SUBTITLES}_clone_${n}`;
12635
12639
  d && (s[u.AUDIO] = d, u.AUDIO = d), f && (i[u.SUBTITLES] = f, u.SUBTITLES = f);
12636
- const g = Sa(h.uri, u["STABLE-VARIANT-ID"], "PER-VARIANT-URIS", c), y = new Pt({
12640
+ const g = Sa(h.uri, u["STABLE-VARIANT-ID"], "PER-VARIANT-URIS", c), y = new kt({
12637
12641
  attrs: u,
12638
12642
  audioCodec: h.audioCodec,
12639
12643
  bitrate: h.bitrate,
@@ -12762,9 +12766,9 @@ function Sa(a, e, t, s) {
12762
12766
  l && c.searchParams.set(l, r[l]);
12763
12767
  }), c.href;
12764
12768
  }
12765
- class Et extends Ce {
12769
+ class Tt extends Ce {
12766
12770
  constructor(e) {
12767
- super("eme", e.logger), this.hls = void 0, this.config = void 0, this.media = null, this.mediaResolved = void 0, this.keyFormatPromise = null, this.keySystemAccessPromises = {}, this._requestLicenseFailureCount = 0, this.mediaKeySessions = [], this.keyIdToKeySessionPromise = {}, this.mediaKeys = null, this.setMediaKeysQueue = Et.CDMCleanupPromise ? [Et.CDMCleanupPromise] : [], this.bannedKeyIds = {}, this.onMediaEncrypted = (t) => {
12771
+ super("eme", e.logger), this.hls = void 0, this.config = void 0, this.media = null, this.mediaResolved = void 0, this.keyFormatPromise = null, this.keySystemAccessPromises = {}, this._requestLicenseFailureCount = 0, this.mediaKeySessions = [], this.keyIdToKeySessionPromise = {}, this.mediaKeys = null, this.setMediaKeysQueue = Tt.CDMCleanupPromise ? [Tt.CDMCleanupPromise] : [], this.bannedKeyIds = {}, this.onMediaEncrypted = (t) => {
12768
12772
  const {
12769
12773
  initDataType: s,
12770
12774
  initData: i
@@ -12772,7 +12776,7 @@ class Et extends Ce {
12772
12776
  if (this.debug(r), i !== null) {
12773
12777
  if (!this.keyFormatPromise) {
12774
12778
  let n = Object.keys(this.keySystemAccessPromises);
12775
- n.length || (n = Lt(this.config));
12779
+ n.length || (n = Rt(this.config));
12776
12780
  const o = n.map(bs).filter((c) => !!c);
12777
12781
  this.keyFormatPromise = this.getKeyFormatPromise(o);
12778
12782
  }
@@ -12792,7 +12796,7 @@ class Et extends Ce {
12792
12796
  this.warn(`${r} Failed to parse sinf: ${f}`);
12793
12797
  return;
12794
12798
  }
12795
- const l = Ee(c), {
12799
+ const l = me(c), {
12796
12800
  keyIdToKeySessionPromise: h,
12797
12801
  mediaKeySessions: u
12798
12802
  } = this;
@@ -12801,7 +12805,7 @@ class Et extends Ce {
12801
12805
  const g = u[f], y = g.decryptdata;
12802
12806
  if (!y.keyId)
12803
12807
  continue;
12804
- const p = Ee(y.keyId);
12808
+ const p = me(y.keyId);
12805
12809
  if (fs(c, y.keyId) || y.uri.replace(/-/g, "").indexOf(l) !== -1) {
12806
12810
  if (d = h[p], !d)
12807
12811
  continue;
@@ -12911,7 +12915,7 @@ class Et extends Ce {
12911
12915
  keySystem: t,
12912
12916
  mediaKeys: s
12913
12917
  }) {
12914
- this.log(`Creating key-system session "${t}" keyId: ${Ee(e.keyId || [])} keyUri: ${e.uri}`);
12918
+ this.log(`Creating key-system session "${t}" keyId: ${me(e.keyId || [])} keyUri: ${e.uri}`);
12915
12919
  const i = s.createSession(), r = {
12916
12920
  decryptdata: e,
12917
12921
  keySystem: t,
@@ -12932,7 +12936,7 @@ class Et extends Ce {
12932
12936
  }
12933
12937
  updateKeySession(e, t) {
12934
12938
  const s = e.mediaKeysSession;
12935
- return this.log(`Updating key-session "${s.sessionId}" for keyId ${Ee(e.decryptdata.keyId || [])}
12939
+ return this.log(`Updating key-session "${s.sessionId}" for keyId ${me(e.decryptdata.keyId || [])}
12936
12940
  } (data length: ${t.byteLength})`), s.update(t);
12937
12941
  }
12938
12942
  getSelectedKeySystemFormats() {
@@ -12966,7 +12970,7 @@ class Et extends Ce {
12966
12970
  return this.keyFormatPromise || (this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`), this.keyFormatPromise = this.getKeyFormatPromise(t)), this.keyFormatPromise;
12967
12971
  }
12968
12972
  getKeyFormatPromise(e) {
12969
- const t = Lt(this.config), s = e.map(ts).filter((i) => !!i && t.indexOf(i) !== -1);
12973
+ const t = Rt(this.config), s = e.map(ts).filter((i) => !!i && t.indexOf(i) !== -1);
12970
12974
  return this.selectKeySystem(s);
12971
12975
  }
12972
12976
  getKeyStatus(e) {
@@ -13020,7 +13024,7 @@ class Et extends Ce {
13020
13024
  if (e instanceof xe) {
13021
13025
  t && (e.data.frag = t);
13022
13026
  const s = e.data.decryptdata;
13023
- this.error(`${e.message}${s ? ` (${Ee(s.keyId || [])})` : ""}`), this.hls.trigger(m.ERROR, e.data);
13027
+ this.error(`${e.message}${s ? ` (${me(s.keyId || [])})` : ""}`), this.hls.trigger(m.ERROR, e.data);
13024
13028
  } else
13025
13029
  this.error(e.message), this.hls.trigger(m.ERROR, {
13026
13030
  type: V.KEY_SYSTEM_ERROR,
@@ -13032,13 +13036,13 @@ class Et extends Ce {
13032
13036
  getKeySystemForKeyPromise(e) {
13033
13037
  const t = Wt(e), s = this.keyIdToKeySessionPromise[t];
13034
13038
  if (!s) {
13035
- const i = ts(e.keyFormat), r = i ? [i] : Lt(this.config);
13039
+ const i = ts(e.keyFormat), r = i ? [i] : Rt(this.config);
13036
13040
  return this.attemptKeySystemAccess(r);
13037
13041
  }
13038
13042
  return s;
13039
13043
  }
13040
13044
  getKeySystemSelectionPromise(e) {
13041
- if (e.length || (e = Lt(this.config)), e.length === 0)
13045
+ if (e.length || (e = Rt(this.config)), e.length === 0)
13042
13046
  throw new xe({
13043
13047
  type: V.KEY_SYSTEM_ERROR,
13044
13048
  details: R.KEY_SYSTEM_NO_CONFIGURED_LICENSE,
@@ -13151,8 +13155,11 @@ class Et extends Ce {
13151
13155
  i = s, s = o;
13152
13156
  }
13153
13157
  const r = "buffer" in i ? new Uint8Array(i.buffer, i.byteOffset, i.byteLength) : new Uint8Array(i);
13154
- e.keySystem === oe.PLAYREADY && r.length === 16 && Dn(r);
13155
- const n = Ee(r);
13158
+ if (e.keySystem === oe.PLAYREADY && r.length === 16) {
13159
+ const o = me(r);
13160
+ t[o] = s, Dn(r);
13161
+ }
13162
+ const n = me(r);
13156
13163
  s === "internal-error" && (this.bannedKeyIds[n] = s), this.log(`key status change "${s}" for keyStatuses keyId: ${n} key-session "${e.mediaKeysSession.sessionId}"`), t[n] = s;
13157
13164
  }), t;
13158
13165
  }
@@ -13338,9 +13345,9 @@ class Et extends Ce {
13338
13345
  if (t && t(), !this.mediaKeys && !this.mediaKeySessions.length)
13339
13346
  return;
13340
13347
  const s = this.media, i = this.mediaKeySessions.slice();
13341
- this.mediaKeySessions = [], this.mediaKeys = null, ot.clearKeyUriToKeyIdMap();
13348
+ this.mediaKeySessions = [], this.mediaKeys = null, Qe.clearKeyUriToKeyIdMap();
13342
13349
  const r = i.length;
13343
- Et.CDMCleanupPromise = Promise.all(i.map((n) => this.removeSession(n)).concat((s == null || (e = s.setMediaKeys(null)) == null ? void 0 : e.catch((n) => {
13350
+ Tt.CDMCleanupPromise = Promise.all(i.map((n) => this.removeSession(n)).concat((s == null || (e = s.setMediaKeys(null)) == null ? void 0 : e.catch((n) => {
13344
13351
  this.log(`Could not clear media keys: ${n}`), this.hls && this.hls.trigger(m.ERROR, {
13345
13352
  type: V.OTHER_ERROR,
13346
13353
  details: R.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,
@@ -13376,7 +13383,7 @@ class Et extends Ce {
13376
13383
  decryptdata: i
13377
13384
  } = e;
13378
13385
  if (t) {
13379
- this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${Ee((i == null ? void 0 : i.keyId) || [])}`), e._onmessage && (t.removeEventListener("message", e._onmessage), e._onmessage = void 0), e._onkeystatuseschange && (t.removeEventListener("keystatuseschange", e._onkeystatuseschange), e._onkeystatuseschange = void 0), s && s.readyState !== XMLHttpRequest.DONE && s.abort(), e.mediaKeysSession = e.decryptdata = e.licenseXhr = void 0;
13386
+ this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${me((i == null ? void 0 : i.keyId) || [])}`), e._onmessage && (t.removeEventListener("message", e._onmessage), e._onmessage = void 0), e._onkeystatuseschange && (t.removeEventListener("keystatuseschange", e._onkeystatuseschange), e._onkeystatuseschange = void 0), s && s.readyState !== XMLHttpRequest.DONE && s.abort(), e.mediaKeysSession = e.decryptdata = e.licenseXhr = void 0;
13380
13387
  const r = this.mediaKeySessions.indexOf(e);
13381
13388
  r > -1 && this.mediaKeySessions.splice(r, 1);
13382
13389
  const {
@@ -13407,13 +13414,13 @@ class Et extends Ce {
13407
13414
  return Promise.resolve();
13408
13415
  }
13409
13416
  }
13410
- Et.CDMCleanupPromise = void 0;
13417
+ Tt.CDMCleanupPromise = void 0;
13411
13418
  function Wt(a) {
13412
13419
  if (!a)
13413
13420
  throw new Error("Could not read keyId of undefined decryptdata");
13414
13421
  if (a.keyId === null)
13415
13422
  throw new Error("keyId is null");
13416
- return Ee(a.keyId);
13423
+ return me(a.keyId);
13417
13424
  }
13418
13425
  function Rh(a, e) {
13419
13426
  if (a.keyId && e.mediaKeysSession.keyStatuses.has(a.keyId))
@@ -13517,7 +13524,7 @@ function xa(a, e) {
13517
13524
  }
13518
13525
  t === "disabled" && (a.mode = t);
13519
13526
  }
13520
- function mt(a, e) {
13527
+ function pt(a, e) {
13521
13528
  const t = a.mode;
13522
13529
  if (t === "disabled" && (a.mode = "hidden"), a.cues)
13523
13530
  for (let s = a.cues.length; s--; )
@@ -13623,7 +13630,7 @@ class Ch extends Ci {
13623
13630
  if (self.clearInterval(this.subtitlePollingInterval), this.useTextTrackPolling || s.textTracks.removeEventListener("change", this.asyncPollTrackChange), this.trackId > -1 && (this.queuedDefaultTrack = this.trackId), this.subtitleTrack = -1, this.media = null, i)
13624
13631
  return;
13625
13632
  ns(s.textTracks).forEach((n) => {
13626
- mt(n);
13633
+ pt(n);
13627
13634
  });
13628
13635
  }
13629
13636
  onManifestLoading() {
@@ -13691,18 +13698,18 @@ class Ch extends Ci {
13691
13698
  const t = this.tracksInGroup, s = this.selectDefaultTrack;
13692
13699
  for (let i = 0; i < t.length; i++) {
13693
13700
  const r = t[i];
13694
- if (!(s && !r.default || !s && !e) && (!e || at(r, e)))
13701
+ if (!(s && !r.default || !s && !e) && (!e || ot(r, e)))
13695
13702
  return i;
13696
13703
  }
13697
13704
  if (e) {
13698
13705
  for (let i = 0; i < t.length; i++) {
13699
13706
  const r = t[i];
13700
- if (Ft(e.attrs, r.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"]))
13707
+ if (Mt(e.attrs, r.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"]))
13701
13708
  return i;
13702
13709
  }
13703
13710
  for (let i = 0; i < t.length; i++) {
13704
13711
  const r = t[i];
13705
- if (Ft(e.attrs, r.attrs, ["LANGUAGE"]))
13712
+ if (Mt(e.attrs, r.attrs, ["LANGUAGE"]))
13706
13713
  return i;
13707
13714
  }
13708
13715
  }
@@ -13743,7 +13750,7 @@ class Ch extends Ci {
13743
13750
  const t = this.allSubtitleTracks;
13744
13751
  if (this.selectDefaultTrack = !1, t.length) {
13745
13752
  const s = this.currentTrack;
13746
- if (s && at(e, s))
13753
+ if (s && ot(e, s))
13747
13754
  return s;
13748
13755
  const i = Ue(e, this.tracksInGroup);
13749
13756
  if (i > -1) {
@@ -13856,18 +13863,18 @@ function Ph() {
13856
13863
  }
13857
13864
  }
13858
13865
  }
13859
- function _t(a) {
13866
+ function Dt(a) {
13860
13867
  let e = 5381, t = a.length;
13861
13868
  for (; t; )
13862
13869
  e = e * 33 ^ a.charCodeAt(--t);
13863
13870
  return (e >>> 0).toString();
13864
13871
  }
13865
- const Tt = 0.025;
13872
+ const St = 0.025;
13866
13873
  let ys = /* @__PURE__ */ (function(a) {
13867
13874
  return a[a.Point = 0] = "Point", a[a.Range = 1] = "Range", a;
13868
13875
  })({});
13869
13876
  function kh(a, e, t) {
13870
- return `${a.identifier}-${t + 1}-${_t(e)}`;
13877
+ return `${a.identifier}-${t + 1}-${Dt(e)}`;
13871
13878
  }
13872
13879
  class wh {
13873
13880
  constructor(e, t) {
@@ -13939,7 +13946,7 @@ class wh {
13939
13946
  }
13940
13947
  get appendInPlace() {
13941
13948
  return this.appendInPlaceStarted ? !0 : this.appendInPlaceDisabled ? !1 : !!(!this.cue.once && !this.cue.pre && // preroll starts at startPosition before startPosition is known (live)
13942
- this.startIsAligned && (isNaN(this.playoutLimit) && isNaN(this.resumeOffset) || this.resumeOffset && this.duration && Math.abs(this.resumeOffset - this.duration) < Tt));
13949
+ this.startIsAligned && (isNaN(this.playoutLimit) && isNaN(this.resumeOffset) || this.resumeOffset && this.duration && Math.abs(this.resumeOffset - this.duration) < St));
13943
13950
  }
13944
13951
  set appendInPlace(e) {
13945
13952
  if (this.appendInPlaceStarted) {
@@ -13992,7 +13999,7 @@ class wh {
13992
13999
  }
13993
14000
  }
13994
14001
  function Ms(a, e) {
13995
- return a - e.start < e.duration / 2 && !(Math.abs(a - (e.start + e.duration)) < Tt) ? e.start : e.start + e.duration;
14002
+ return a - e.start < e.duration / 2 && !(Math.abs(a - (e.start + e.duration)) < St) ? e.start : e.start + e.duration;
13996
14003
  }
13997
14004
  function Aa(a, e, t) {
13998
14005
  const s = new self.URL(a, t);
@@ -14006,7 +14013,7 @@ function Ns(a, e) {
14006
14013
  function Oh(a) {
14007
14014
  return `["${a.identifier}" ${a.cue.pre ? "<pre>" : a.cue.post ? "<post>" : ""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`;
14008
14015
  }
14009
- function gt(a) {
14016
+ function mt(a) {
14010
14017
  const e = a.timelineStart, t = a.duration || 0;
14011
14018
  return `["${a.identifier}" ${e.toFixed(2)}-${(e + t).toFixed(2)}]`;
14012
14019
  }
@@ -14179,7 +14186,7 @@ class Fh {
14179
14186
  }
14180
14187
  toString() {
14181
14188
  var e;
14182
- return `HlsAssetPlayer: ${gt(this.assetItem)} ${(e = this.hls) == null ? void 0 : e.sessionId} ${this.appendInPlace ? "append-in-place" : ""}`;
14189
+ return `HlsAssetPlayer: ${mt(this.assetItem)} ${(e = this.hls) == null ? void 0 : e.sessionId} ${this.appendInPlace ? "append-in-place" : ""}`;
14183
14190
  }
14184
14191
  }
14185
14192
  const Vr = 0.033;
@@ -14450,7 +14457,7 @@ class Mh extends Ce {
14450
14457
  }
14451
14458
  primaryCanResumeInPlaceAt(e, t) {
14452
14459
  const s = e.resumeTime, i = e.startTime + e.resumptionOffset;
14453
- return Math.abs(s - i) > Tt ? (this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${i}`), !1) : !Object.keys(t).some((n) => {
14460
+ return Math.abs(s - i) > St ? (this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${i}`), !1) : !Object.keys(t).some((n) => {
14454
14461
  const o = t[n].details, c = o.edge;
14455
14462
  if (s >= c)
14456
14463
  return this.log(`"${e.identifier}" resumption ${s} past ${n} playlist end ${c}`), !1;
@@ -14458,7 +14465,7 @@ class Mh extends Ce {
14458
14465
  if (!l)
14459
14466
  return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${n} playlist (${o.fragStart}-${o.fragmentEnd})`), !0;
14460
14467
  const h = n === "audio" ? 0.175 : 0;
14461
- return Math.abs(l.start - s) < Tt + h || Math.abs(l.end - s) < Tt + h ? !1 : (this.log(`"${e.identifier}" resumption ${s} not aligned with ${n} fragment bounds (${l.start}-${l.end} sn: ${l.sn} cc: ${l.cc})`), !0);
14468
+ return Math.abs(l.start - s) < St + h || Math.abs(l.end - s) < St + h ? !1 : (this.log(`"${e.identifier}" resumption ${s} not aligned with ${n} fragment bounds (${l.start}-${l.end} sn: ${l.sn} cc: ${l.cc})`), !0);
14462
14469
  });
14463
14470
  }
14464
14471
  updateAssetDurations(e) {
@@ -14601,7 +14608,7 @@ class Bh extends Ce {
14601
14608
  const h = l.timelineStart, u = l.duration || 0;
14602
14609
  if (n && s < h || s >= h + u) {
14603
14610
  var d;
14604
- (d = o.event) != null && d.appendInPlace && (this.clearInterstitial(o.event, o), this.flushFrontBuffer(s)), this.setScheduleToAssetAtTime(s, l);
14611
+ (d = o.event) != null && d.appendInPlace && (this.clearAssetPlayers(o.event, o), this.flushFrontBuffer(s)), this.setScheduleToAssetAtTime(s, l);
14605
14612
  }
14606
14613
  }, this.onTimeupdate = () => {
14607
14614
  const s = this.currentTime;
@@ -14645,7 +14652,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
14645
14652
  try {
14646
14653
  y.timelineOffset = p;
14647
14654
  } catch (T) {
14648
- Math.abs(E) > Tt && this.warn(`${T} ("${y.assetId}" ${y.timelineOffset}->${p})`);
14655
+ Math.abs(E) > St && this.warn(`${T} ("${y.assetId}" ${y.timelineOffset}->${p})`);
14649
14656
  }
14650
14657
  }
14651
14658
  }), u || i) {
@@ -15109,7 +15116,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15109
15116
  if (f && d && (!this.eventItemsMatch(n, r) || t !== void 0 && d !== h.assetList[t].identifier)) {
15110
15117
  var c;
15111
15118
  const g = h.findAssetIndex(u);
15112
- if (this.log(`INTERSTITIAL_ASSET_ENDED ${g + 1}/${h.assetList.length} ${gt(u)}`), this.endedAsset = u, this.playingAsset = null, this.hls.trigger(m.INTERSTITIAL_ASSET_ENDED, {
15119
+ if (this.log(`INTERSTITIAL_ASSET_ENDED ${g + 1}/${h.assetList.length} ${mt(u)}`), this.endedAsset = u, this.playingAsset = null, this.hls.trigger(m.INTERSTITIAL_ASSET_ENDED, {
15113
15120
  asset: u,
15114
15121
  assetListIndex: g,
15115
15122
  event: h,
@@ -15576,7 +15583,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15576
15583
  e.appendInPlace && (e.appendInPlaceStarted = !0, t.timelineStart && (d.timelineOffset = t.timelineStart));
15577
15584
  const f = d.cmcd;
15578
15585
  f != null && f.sessionId && f.contentId && (d.cmcd = ie({}, f, {
15579
- contentId: _t(t.uri)
15586
+ contentId: Dt(t.uri)
15580
15587
  })), this.getAssetPlayer(u) && this.warn(`Duplicate date range identifier ${e} and asset ${u}`);
15581
15588
  const g = new Fh(this.HlsPlayerClass, d, e, t);
15582
15589
  this.playerQueue.push(g), e.assetList[s] = t;
@@ -15649,7 +15656,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15649
15656
  error: x
15650
15657
  };
15651
15658
  this.handleAssetItemError(D, e, this.schedule.findEventIndex(e.identifier), s, x.message);
15652
- }), this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${gt(t)}`), this.hls.trigger(m.INTERSTITIAL_ASSET_PLAYER_CREATED, {
15659
+ }), this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${mt(t)}`), this.hls.trigger(m.INTERSTITIAL_ASSET_PLAYER_CREATED, {
15653
15660
  asset: t,
15654
15661
  assetListIndex: s,
15655
15662
  event: e,
@@ -15657,9 +15664,12 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15657
15664
  }), g;
15658
15665
  }
15659
15666
  clearInterstitial(e, t) {
15667
+ this.clearAssetPlayers(e, t), e.reset();
15668
+ }
15669
+ clearAssetPlayers(e, t) {
15660
15670
  e.assetList.forEach((s) => {
15661
15671
  this.clearAssetPlayer(s.identifier, t);
15662
- }), e.reset();
15672
+ });
15663
15673
  }
15664
15674
  resetAssetPlayer(e) {
15665
15675
  const t = this.getAssetPlayerQueueIndex(e);
@@ -15688,7 +15698,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15688
15698
  assetItem: o,
15689
15699
  assetId: c
15690
15700
  } = e, l = n.assetList.length, h = this.playingAsset;
15691
- this.endedAsset = null, this.playingAsset = o, (!h || h.identifier !== c) && (h && (this.clearAssetPlayer(h.identifier, s[i]), delete h.error), this.log(`INTERSTITIAL_ASSET_STARTED ${t + 1}/${l} ${gt(o)}`), this.hls.trigger(m.INTERSTITIAL_ASSET_STARTED, {
15701
+ this.endedAsset = null, this.playingAsset = o, (!h || h.identifier !== c) && (h && (this.clearAssetPlayer(h.identifier, s[i]), delete h.error), this.log(`INTERSTITIAL_ASSET_STARTED ${t + 1}/${l} ${mt(o)}`), this.hls.trigger(m.INTERSTITIAL_ASSET_STARTED, {
15692
15702
  asset: o,
15693
15703
  assetListIndex: t,
15694
15704
  event: n,
@@ -15721,7 +15731,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15721
15731
  return;
15722
15732
  }
15723
15733
  if (u && !nn(u, e.tracks)) {
15724
- const d = new Error(`Asset ${gt(n)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`), f = {
15734
+ const d = new Error(`Asset ${mt(n)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(u)}')`), f = {
15725
15735
  fatal: !0,
15726
15736
  type: V.OTHER_ERROR,
15727
15737
  details: R.INTERSTITIAL_ASSET_ITEM_ERROR,
@@ -15757,11 +15767,11 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15757
15767
  if (e.details === R.BUFFER_STALLED_ERROR)
15758
15768
  return;
15759
15769
  const n = t.assetList[i] || null;
15760
- if (this.warn(`INTERSTITIAL_ASSET_ERROR ${n && gt(n)} ${e.error}`), !this.schedule)
15770
+ if (this.warn(`INTERSTITIAL_ASSET_ERROR ${n && mt(n)} ${e.error}`), !this.schedule)
15761
15771
  return;
15762
15772
  const o = (n == null ? void 0 : n.identifier) || "", c = this.getAssetPlayerQueueIndex(o), l = this.playerQueue[c] || null, h = this.schedule.items, u = ie({}, e, {
15763
15773
  fatal: !1,
15764
- errorAction: pt(!0),
15774
+ errorAction: yt(!0),
15765
15775
  asset: n,
15766
15776
  assetListIndex: i,
15767
15777
  event: t,
@@ -15781,17 +15791,19 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15781
15791
  }
15782
15792
  primaryFallback(e) {
15783
15793
  const t = e.timelineStart, s = this.effectivePlayingItem;
15794
+ let i = this.timelinePos;
15784
15795
  if (s) {
15785
- this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${ke(s)} error: ${e.error}`);
15786
- let i = this.timelinePos;
15787
- i === -1 && (i = this.hls.startPosition);
15788
- const r = this.updateItem(s, i);
15789
- if (this.itemsMatch(s, r) && this.clearInterstitial(e, null), e.appendInPlace && (this.attachPrimary(t, null), this.flushFrontBuffer(t)), !this.schedule)
15790
- return;
15791
- const n = this.schedule.findItemIndexAtTime(i);
15792
- this.setSchedulePosition(n);
15793
- } else
15796
+ this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${i} playing: ${ke(s)} error: ${e.error}`), i === -1 && (i = this.hls.startPosition);
15797
+ const n = this.updateItem(s, i);
15798
+ this.itemsMatch(s, n) && this.clearInterstitial(e, null), e.appendInPlace && (this.attachPrimary(t, null), this.flushFrontBuffer(t));
15799
+ } else if (i === -1) {
15794
15800
  this.checkStart();
15801
+ return;
15802
+ }
15803
+ if (!this.schedule)
15804
+ return;
15805
+ const r = this.schedule.findItemIndexAtTime(i);
15806
+ this.setSchedulePosition(r);
15795
15807
  }
15796
15808
  // Asset List loading
15797
15809
  onAssetListLoaded(e, t) {
@@ -15813,7 +15825,7 @@ Schedule: ${c.map((y) => ke(y))} pos: ${this.timelinePos}`), h.length && this.lo
15813
15825
  const y = this.schedule.findEventIndex(n), p = (g = this.schedule.items) == null ? void 0 : g[y];
15814
15826
  if (p) {
15815
15827
  if (!this.playingItem && this.timelinePos > p.end && this.schedule.findItemIndexAtTime(this.timelinePos) !== y) {
15816
- r.error = new Error(`Interstitial no longer within playback range ${this.timelinePos} ${r}`), this.updateSchedule(!0), this.primaryFallback(r);
15828
+ r.error = new Error(`Interstitial ${o.length ? "no longer within playback range" : "asset-list is empty"} ${this.timelinePos} ${r}`), this.log(r.error.message), this.updateSchedule(!0), this.primaryFallback(r);
15817
15829
  return;
15818
15830
  }
15819
15831
  this.setBufferingItem(p);
@@ -15942,11 +15954,11 @@ class Uh extends xi {
15942
15954
  subtitleTracks: t
15943
15955
  }) {
15944
15956
  if (this.levels && la(this.levels, t)) {
15945
- this.levels = t.map((s) => new Pt(s));
15957
+ this.levels = t.map((s) => new kt(s));
15946
15958
  return;
15947
15959
  }
15948
15960
  this.tracksBuffered = [], this.levels = t.map((s) => {
15949
- const i = new Pt(s);
15961
+ const i = new kt(s);
15950
15962
  return this.tracksBuffered[i.id] = [], i;
15951
15963
  }), this.fragmentTracker.removeFragmentsInRange(0, Number.POSITIVE_INFINITY, B.SUBTITLE), this.fragPrevious = null, this.mediaBuffer = null;
15952
15964
  }
@@ -16006,7 +16018,7 @@ class Uh extends xi {
16006
16018
  frag: t,
16007
16019
  payload: s
16008
16020
  } = e, i = t.decryptdata, r = this.hls;
16009
- if (!this.fragContextChanged(t) && s && s.byteLength > 0 && i != null && i.key && i.iv && yt(i.method)) {
16021
+ if (!this.fragContextChanged(t) && s && s.byteLength > 0 && i != null && i.key && i.iv && Et(i.method)) {
16010
16022
  const n = performance.now();
16011
16023
  this.decrypter.decrypt(new Uint8Array(s), i.key.buffer, i.iv.buffer, Si(i.method)).catch((o) => {
16012
16024
  throw r.trigger(m.ERROR, {
@@ -16331,7 +16343,7 @@ class qh {
16331
16343
  }
16332
16344
  }
16333
16345
  }
16334
- const it = function(e) {
16346
+ const rt = function(e) {
16335
16347
  const t = [];
16336
16348
  for (let s = 0; s < e.length; s++)
16337
16349
  t.push(e[s].toString(16));
@@ -16707,11 +16719,11 @@ class qr {
16707
16719
  let n = !1, o = null;
16708
16720
  if (i === 0 && r === 0)
16709
16721
  continue;
16710
- this.logger.log(3, () => "[" + it([t[s], t[s + 1]]) + "] -> (" + it([i, r]) + ")");
16722
+ this.logger.log(3, () => "[" + rt([t[s], t[s + 1]]) + "] -> (" + rt([i, r]) + ")");
16711
16723
  const c = this.cmdHistory;
16712
16724
  if (i >= 16 && i <= 31) {
16713
16725
  if (zh(i, r, c)) {
16714
- jt(null, null, c), this.logger.log(3, () => "Repeated command (" + it([i, r]) + ") is dropped");
16726
+ jt(null, null, c), this.logger.log(3, () => "Repeated command (" + rt([i, r]) + ") is dropped");
16715
16727
  continue;
16716
16728
  }
16717
16729
  jt(i, r, this.cmdHistory), n = this.parseCmd(i, r), n || (n = this.parseMidrow(i, r)), n || (n = this.parsePAC(i, r)), n || (n = this.parseBackgroundAttributes(i, r));
@@ -16721,7 +16733,7 @@ class qr {
16721
16733
  const h = this.currentChannel;
16722
16734
  h && h > 0 ? this.channels[h].insertChars(o) : this.logger.log(2, "No channel found yet. TEXT-MODE?");
16723
16735
  }
16724
- !n && !o && this.logger.log(2, () => "Couldn't parse cleaned data " + it([i, r]) + " orig: " + it([t[s], t[s + 1]]));
16736
+ !n && !o && this.logger.log(2, () => "Couldn't parse cleaned data " + rt([i, r]) + " orig: " + rt([t[s], t[s + 1]]));
16725
16737
  }
16726
16738
  }
16727
16739
  /**
@@ -16744,7 +16756,7 @@ class qr {
16744
16756
  if (e === 17 ? s = 1 : s = 2, s !== this.currentChannel)
16745
16757
  return this.logger.log(0, "Mismatch channel in midrow parsing"), !1;
16746
16758
  const i = this.channels[s];
16747
- return i ? (i.ccMIDROW(t), this.logger.log(3, () => "MIDROW (" + it([e, t]) + ")"), !0) : !1;
16759
+ return i ? (i.ccMIDROW(t), this.logger.log(3, () => "MIDROW (" + rt([e, t]) + ")"), !0) : !1;
16748
16760
  }
16749
16761
  return !1;
16750
16762
  }
@@ -16787,7 +16799,7 @@ class qr {
16787
16799
  let n;
16788
16800
  r === 17 ? n = t + 80 : r === 18 ? n = t + 112 : n = t + 144, this.logger.log(2, () => "Special char '" + Ia(n) + "' in channel " + s), i = [n];
16789
16801
  } else e >= 32 && e <= 127 && (i = t === 0 ? [e] : [e, t]);
16790
- return i && this.logger.log(3, () => "Char codes = " + it(i).join(",")), i;
16802
+ return i && this.logger.log(3, () => "Char codes = " + rt(i).join(",")), i;
16791
16803
  }
16792
16804
  /**
16793
16805
  * Parse extended background attributes as well as new foreground color black.
@@ -17231,7 +17243,7 @@ const su = /\r\n|\n\r|\n|\r/g, Us = function(e, t, s = 0) {
17231
17243
  return t += 1e3 * s, t += 60 * 1e3 * i, t += 3600 * 1e3 * r, t;
17232
17244
  };
17233
17245
  function Fi(a, e, t) {
17234
- return _t(a.toString()) + _t(e.toString()) + _t(t);
17246
+ return Dt(a.toString()) + Dt(e.toString()) + Dt(t);
17235
17247
  }
17236
17248
  const ru = function(e, t, s) {
17237
17249
  let i = e[t], r = e[i.prevCC];
@@ -17534,7 +17546,7 @@ class uu {
17534
17546
  languageCode: n
17535
17547
  } = t[e], o = this.getExistingTrack(r, n);
17536
17548
  if (o)
17537
- s[e] = o, mt(s[e]), va(s[e], i);
17549
+ s[e] = o, pt(s[e]), va(s[e], i);
17538
17550
  else {
17539
17551
  const c = this.createTextTrack("captions", r, n);
17540
17552
  c && (c[e] = !0, s[e] = c);
@@ -17573,7 +17585,7 @@ class uu {
17573
17585
  captionsTracks: i
17574
17586
  } = this;
17575
17587
  Object.keys(i).forEach((r) => {
17576
- mt(i[r]), delete i[r];
17588
+ pt(i[r]), delete i[r];
17577
17589
  }), this.nonNativeCaptionsTracks = {};
17578
17590
  }
17579
17591
  onManifestLoading() {
@@ -17588,7 +17600,7 @@ class uu {
17588
17600
  const t = e.textTracks;
17589
17601
  if (t)
17590
17602
  for (let s = 0; s < t.length; s++)
17591
- mt(t[s]);
17603
+ pt(t[s]);
17592
17604
  }
17593
17605
  onSubtitleTracksUpdated(e, t) {
17594
17606
  const s = t.subtitleTracks || [], i = s.some((r) => r.textCodec === $s);
@@ -17611,7 +17623,7 @@ class uu {
17611
17623
  u && (h = u);
17612
17624
  }
17613
17625
  if (h)
17614
- mt(h);
17626
+ pt(h);
17615
17627
  else {
17616
17628
  const u = ka(c);
17617
17629
  h = this.createTextTrack(u, c.name, c.lang), h && (h.mode = "disabled");
@@ -17893,7 +17905,7 @@ class Jr {
17893
17905
  } = t.loadPolicy;
17894
17906
  this.context = e, this.config = t, this.callbacks = s, this.request = this.fetchSetup(e, r), self.clearTimeout(this.requestTimeout), t.timeout = c && M(c) ? c : l, this.requestTimeout = self.setTimeout(() => {
17895
17907
  this.callbacks && (this.abortInternal(), this.callbacks.onTimeout(i, e, this.response));
17896
- }, t.timeout), (Ot(this.request) ? this.request.then(self.fetch) : self.fetch(this.request)).then((u) => {
17908
+ }, t.timeout), (Ft(this.request) ? this.request.then(self.fetch) : self.fetch(this.request)).then((u) => {
17897
17909
  var d;
17898
17910
  this.response = this.loader = u;
17899
17911
  const f = Math.max(self.performance.now(), i.loading.start);
@@ -18409,7 +18421,7 @@ const Au = {
18409
18421
  timelineController: uu,
18410
18422
  audioStreamController: xc,
18411
18423
  audioTrackController: Ac,
18412
- emeController: Et,
18424
+ emeController: Tt,
18413
18425
  cmcdController: Ah,
18414
18426
  contentSteeringController: Lh,
18415
18427
  interstitialsController: Bh
@@ -18889,7 +18901,7 @@ class wu {
18889
18901
  t && this.updateDateRangeCues(t);
18890
18902
  }
18891
18903
  onMediaDetaching(e, t) {
18892
- this.media = null, !t.transferMedia && (this.id3Track && (this.removeCues && mt(this.id3Track, this.onEventCueEnter), this.id3Track = null), this.dateRangeCuesAppended = {});
18904
+ this.media = null, !t.transferMedia && (this.id3Track && (this.removeCues && pt(this.id3Track, this.onEventCueEnter), this.id3Track = null), this.dateRangeCuesAppended = {});
18893
18905
  }
18894
18906
  onManifestLoading() {
18895
18907
  this.dateRangeCuesAppended = {};
@@ -19294,7 +19306,7 @@ class Fu extends Ci {
19294
19306
  }), this.filterAndSortMediaOptions(i, t, o, c, l);
19295
19307
  }
19296
19308
  createLevel(e) {
19297
- const t = new Pt(e), s = e.supplemental;
19309
+ const t = new kt(e), s = e.supplemental;
19298
19310
  if (s != null && s.videoCodec && !this.isVideoSupported(s.videoCodec)) {
19299
19311
  const i = new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);
19300
19312
  this.log(i.message), t.supportedResult = En(i, []);
@@ -19302,10 +19314,10 @@ class Fu extends Ci {
19302
19314
  return t;
19303
19315
  }
19304
19316
  isAudioSupported(e) {
19305
- return Dt(e, "audio", this.hls.config.preferManagedMediaSource);
19317
+ return Ct(e, "audio", this.hls.config.preferManagedMediaSource);
19306
19318
  }
19307
19319
  isVideoSupported(e) {
19308
- return Dt(e, "video", this.hls.config.preferManagedMediaSource);
19320
+ return Ct(e, "video", this.hls.config.preferManagedMediaSource);
19309
19321
  }
19310
19322
  filterAndSortMediaOptions(e, t, s, i, r) {
19311
19323
  var n;
@@ -19588,7 +19600,7 @@ function Oa() {
19588
19600
  return self.SourceBuffer || self.WebKitSourceBuffer;
19589
19601
  }
19590
19602
  function Fa() {
19591
- if (!Qe())
19603
+ if (!Ze())
19592
19604
  return !1;
19593
19605
  const e = Oa();
19594
19606
  return !e || e.prototype && typeof e.prototype.appendBuffer == "function" && typeof e.prototype.remove == "function";
@@ -19596,8 +19608,8 @@ function Fa() {
19596
19608
  function Mu() {
19597
19609
  if (!Fa())
19598
19610
  return !1;
19599
- const a = Qe();
19600
- return typeof (a == null ? void 0 : a.isTypeSupported) == "function" && (["avc1.42E01E,mp4a.40.2", "av01.0.01M.08", "vp09.00.50.08"].some((e) => a.isTypeSupported(Ct(e, "video"))) || ["mp4a.40.2", "fLaC"].some((e) => a.isTypeSupported(Ct(e, "audio"))));
19611
+ const a = Ze();
19612
+ return typeof (a == null ? void 0 : a.isTypeSupported) == "function" && (["avc1.42E01E,mp4a.40.2", "av01.0.01M.08", "vp09.00.50.08"].some((e) => a.isTypeSupported(Pt(e, "video"))) || ["mp4a.40.2", "fLaC"].some((e) => a.isTypeSupported(Pt(e, "audio"))));
19601
19613
  }
19602
19614
  function Nu() {
19603
19615
  var a;
@@ -19921,7 +19933,7 @@ class Uu extends xi {
19921
19933
  f.push(r, u, d, l, s, i, c.totalduration, h, p, E);
19922
19934
  }
19923
19935
  onAudioTrackSwitching(e, t) {
19924
- const s = this.hls, i = this.altAudio === 2;
19936
+ const s = this.hls, i = this.altAudio !== 0;
19925
19937
  if (hs(t.url, s))
19926
19938
  this.altAudio = 1;
19927
19939
  else {
@@ -19931,7 +19943,7 @@ class Uu extends xi {
19931
19943
  n && (this.log("Switching to main audio track, cancel main fragment load"), n.abortRequests(), this.fragmentTracker.removeFragment(n)), this.resetTransmuxer(), this.resetLoadingState();
19932
19944
  } else this.audioOnly && this.resetTransmuxer();
19933
19945
  if (i) {
19934
- this.fragmentTracker.removeAllFragments(), s.once(m.BUFFER_FLUSHED, () => {
19946
+ this.altAudio = 0, this.fragmentTracker.removeAllFragments(), s.once(m.BUFFER_FLUSHED, () => {
19935
19947
  this.hls && this.hls.trigger(m.AUDIO_TRACK_SWITCHED, t);
19936
19948
  }), s.trigger(m.BUFFER_FLUSHING, {
19937
19949
  startOffset: 0,
@@ -20385,7 +20397,7 @@ class $u extends Ce {
20385
20397
  });
20386
20398
  }
20387
20399
  if (this.config.requireKeySystemAccessOnStart) {
20388
- const i = Lt(this.config);
20400
+ const i = Rt(this.config);
20389
20401
  if (i.length)
20390
20402
  return this.emeController.getKeySystemAccess(i);
20391
20403
  }
@@ -20427,7 +20439,7 @@ class $u extends Ce {
20427
20439
  };
20428
20440
  });
20429
20441
  }
20430
- switch (this.log(`${this.keyIdToKeyInfo[o] ? "Rel" : "L"}oading${r.keyId ? " keyId: " + Ee(r.keyId) : ""} URI: ${r.uri} from ${e.type} ${e.level}`), c = this.keyIdToKeyInfo[o] = {
20442
+ switch (this.log(`${this.keyIdToKeyInfo[o] ? "Rel" : "L"}oading${r.keyId ? " keyId: " + me(r.keyId) : ""} URI: ${r.uri} from ${e.type} ${e.level}`), c = this.keyIdToKeyInfo[o] = {
20431
20443
  decryptdata: r,
20432
20444
  keyLoadPromise: null,
20433
20445
  loader: null,
@@ -20455,10 +20467,12 @@ class $u extends Ce {
20455
20467
  if (!e.decryptdata.keyId && (i = t.initSegment) != null && i.data) {
20456
20468
  const n = ro(t.initSegment.data);
20457
20469
  if (n.length) {
20458
- const o = n[0];
20459
- o.some((c) => c !== 0) && (this.log(`Using keyId found in init segment ${Ee(o)}`), e.decryptdata.keyId = o, ot.setKeyIdForUri(e.decryptdata.uri, o));
20470
+ let o = n[0];
20471
+ o.some((c) => c !== 0) ? (this.log(`Using keyId found in init segment ${me(o)}`), Qe.setKeyIdForUri(e.decryptdata.uri, o)) : (o = Qe.addKeyIdForUri(e.decryptdata.uri), this.log(`Generating keyId to patch media ${me(o)}`)), e.decryptdata.keyId = o;
20460
20472
  }
20461
20473
  }
20474
+ if (!e.decryptdata.keyId && !ce(t))
20475
+ return Promise.resolve(s);
20462
20476
  const r = this.emeController.loadKey(s);
20463
20477
  return (e.keyLoadPromise = r.then((n) => (e.mediaKeySessionContext = n, s))).catch((n) => {
20464
20478
  throw e.keyLoadPromise = null, "data" in n && (n.data.frag = t), n;
@@ -20521,10 +20535,10 @@ class $u extends Ce {
20521
20535
  }
20522
20536
  }
20523
20537
  function Ys(a) {
20524
- if (a.keyFormat !== me.FAIRPLAY) {
20538
+ if (a.keyFormat !== pe.FAIRPLAY) {
20525
20539
  const e = a.keyId;
20526
20540
  if (e)
20527
- return Ee(e);
20541
+ return me(e);
20528
20542
  }
20529
20543
  return a.uri;
20530
20544
  }
@@ -20761,7 +20775,7 @@ class Gu {
20761
20775
  } = T;
20762
20776
  for (let A = S.length; A--; ) {
20763
20777
  const _ = S[A];
20764
- Dt(_, "audio", v) ? (T.audioCodec = x = x ? `${x},${_}` : _, St.audio[x.substring(0, 4)] = 2, S.splice(A, 1)) : Dt(_, "video", v) && (T.videoCodec = D = D ? `${D},${_}` : _, St.video[D.substring(0, 4)] = 2, S.splice(A, 1));
20778
+ Ct(_, "audio", v) ? (T.audioCodec = x = x ? `${x},${_}` : _, vt.audio[x.substring(0, 4)] = 2, S.splice(A, 1)) : Ct(_, "video", v) && (T.videoCodec = D = D ? `${D},${_}` : _, vt.video[D.substring(0, 4)] = 2, S.splice(A, 1));
20765
20779
  }
20766
20780
  }
20767
20781
  });
@@ -20978,12 +20992,12 @@ class Gu {
20978
20992
  }
20979
20993
  }
20980
20994
  }
20981
- class nt {
20995
+ class at {
20982
20996
  /**
20983
20997
  * Get the video-dev/hls.js package version.
20984
20998
  */
20985
20999
  static get version() {
20986
- return kt;
21000
+ return wt;
20987
21001
  }
20988
21002
  /**
20989
21003
  * Check if the required MediaSource Extensions are available.
@@ -21001,7 +21015,7 @@ class nt {
21001
21015
  * Get the MediaSource global used for MSE playback (ManagedMediaSource, MediaSource, or WebKitMediaSource).
21002
21016
  */
21003
21017
  static getMediaSource() {
21004
- return Qe();
21018
+ return Ze();
21005
21019
  }
21006
21020
  static get Events() {
21007
21021
  return m;
@@ -21019,13 +21033,13 @@ class nt {
21019
21033
  * Get the default configuration applied to new instances.
21020
21034
  */
21021
21035
  static get DefaultConfig() {
21022
- return nt.defaultConfig ? nt.defaultConfig : Iu;
21036
+ return at.defaultConfig ? at.defaultConfig : Iu;
21023
21037
  }
21024
21038
  /**
21025
21039
  * Replace the default configuration applied to new instances.
21026
21040
  */
21027
21041
  static set DefaultConfig(e) {
21028
- nt.defaultConfig = e;
21042
+ at.defaultConfig = e;
21029
21043
  }
21030
21044
  /**
21031
21045
  * Creates an instance of an HLS client that can attach to exactly one `HTMLMediaElement`.
@@ -21033,7 +21047,7 @@ class nt {
21033
21047
  */
21034
21048
  constructor(e = {}) {
21035
21049
  this.config = void 0, this.userConfig = void 0, this.logger = void 0, this.coreComponents = void 0, this.networkControllers = void 0, this._emitter = new Ai(), this._autoLevelCapping = -1, this._maxHdcpLevel = null, this.abrController = void 0, this.bufferController = void 0, this.capLevelController = void 0, this.latencyController = void 0, this.levelController = void 0, this.streamController = void 0, this.audioStreamController = void 0, this.subtititleStreamController = void 0, this.audioTrackController = void 0, this.subtitleTrackController = void 0, this.interstitialsController = void 0, this.gapController = void 0, this.emeController = void 0, this.cmcdController = void 0, this._media = null, this._url = null, this._sessionId = void 0, this.triggeringException = void 0, this.started = !1;
21036
- const t = this.logger = Wa(e.debug || !1, "Hls instance", e.assetPlayerId), s = this.config = Ru(nt.DefaultConfig, e, t);
21050
+ const t = this.logger = Wa(e.debug || !1, "Hls instance", e.assetPlayerId), s = this.config = Ru(at.DefaultConfig, e, t);
21037
21051
  this.userConfig = e, s.progressive && bu(s, t);
21038
21052
  const {
21039
21053
  abrController: i,
@@ -21041,7 +21055,7 @@ class nt {
21041
21055
  capLevelController: n,
21042
21056
  errorController: o,
21043
21057
  fpsController: c
21044
- } = s, l = new o(this), h = this.abrController = new i(this), u = new Ko(this), d = s.interstitialsController, f = d ? this.interstitialsController = new d(this, nt) : null, g = this.bufferController = new r(this, u), y = this.capLevelController = new n(this), p = new c(this), E = new Gu(this), T = s.contentSteeringController, S = T ? new T(this) : null, v = this.levelController = new Fu(this, S), x = new wu(this), D = new $u(this.config, this.logger), A = this.streamController = new Uu(this, u, D), _ = this.gapController = new Pu(this, u);
21058
+ } = s, l = new o(this), h = this.abrController = new i(this), u = new Ko(this), d = s.interstitialsController, f = d ? this.interstitialsController = new d(this, at) : null, g = this.bufferController = new r(this, u), y = this.capLevelController = new n(this), p = new c(this), E = new Gu(this), T = s.contentSteeringController, S = T ? new T(this) : null, v = this.levelController = new Fu(this, S), x = new wu(this), D = new $u(this.config, this.logger), A = this.streamController = new Uu(this, u, D), _ = this.gapController = new Pu(this, u);
21045
21059
  y.setStreamController(A), p.setStreamController(A);
21046
21060
  const b = [E, v, A];
21047
21061
  f && b.splice(1, 0, f), S && b.splice(1, 0, S), this.networkControllers = b;
@@ -21684,7 +21698,7 @@ class nt {
21684
21698
  return Tn(e, s, navigator.mediaCapabilities);
21685
21699
  }
21686
21700
  }
21687
- nt.defaultConfig = void 0;
21701
+ at.defaultConfig = void 0;
21688
21702
  export {
21689
21703
  Mo as AbrController,
21690
21704
  ae as AttrList,
@@ -21700,7 +21714,7 @@ export {
21700
21714
  Lh as ContentSteeringController,
21701
21715
  gu as Cues,
21702
21716
  _n as DateRange,
21703
- Et as EMEController,
21717
+ Tt as EMEController,
21704
21718
  Ae as ErrorActionFlags,
21705
21719
  Go as ErrorController,
21706
21720
  R as ErrorDetails,
@@ -21709,14 +21723,14 @@ export {
21709
21723
  bh as FPSController,
21710
21724
  Jr as FetchLoader,
21711
21725
  Is as Fragment,
21712
- nt as Hls,
21726
+ at as Hls,
21713
21727
  es as HlsSkip,
21714
21728
  Qi as HlsUrlParameters,
21715
- me as KeySystemFormats,
21729
+ pe as KeySystemFormats,
21716
21730
  oe as KeySystems,
21717
- Pt as Level,
21731
+ kt as Level,
21718
21732
  il as LevelDetails,
21719
- ot as LevelKey,
21733
+ Qe as LevelKey,
21720
21734
  fi as LoadStats,
21721
21735
  $e as M3U8Parser,
21722
21736
  Le as MetadataSchema,
@@ -21727,9 +21741,9 @@ export {
21727
21741
  Ch as SubtitleTrackController,
21728
21742
  uu as TimelineController,
21729
21743
  wa as XhrLoader,
21730
- nt as default,
21744
+ at as default,
21731
21745
  mu as fetchSupported,
21732
- Qe as getMediaSource,
21746
+ Ze as getMediaSource,
21733
21747
  Fa as isMSESupported,
21734
21748
  Mu as isSupported,
21735
21749
  Pn as requestMediaKeySystemAccess