@vonage/vivid 5.29.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/accordion/definition.js +1 -2
  2. package/accordion-item/definition.js +1 -2
  3. package/action-group/definition.js +1 -2
  4. package/alert/definition.js +1 -2
  5. package/audio-player/definition.js +1 -2
  6. package/audio-player/index.cjs +1 -1
  7. package/audio-player/index.js +1 -5
  8. package/avatar/definition.js +1 -2
  9. package/badge/definition.js +1 -2
  10. package/banner/definition.js +1 -2
  11. package/banner/index.cjs +1 -1
  12. package/banner/index.js +1 -1
  13. package/breadcrumb/definition.js +1 -2
  14. package/bundled/char-count.cjs +1 -1
  15. package/bundled/char-count.js +1 -1
  16. package/bundled/decorate.js +1 -1
  17. package/bundled/definition12.cjs +2 -1
  18. package/bundled/definition12.js +2 -1
  19. package/bundled/definition16.cjs +1 -1
  20. package/bundled/definition16.js +2 -5
  21. package/bundled/definition19.cjs +2 -2
  22. package/bundled/definition19.js +10 -25
  23. package/bundled/definition21.cjs +1 -1
  24. package/bundled/definition21.js +1 -1
  25. package/bundled/definition25.cjs +4 -4
  26. package/bundled/definition25.js +4 -4
  27. package/bundled/definition5.cjs +1 -1
  28. package/bundled/definition5.js +2 -5
  29. package/bundled/listbox.cjs +1 -1
  30. package/bundled/listbox.js +1 -5
  31. package/bundled/option.cjs +1 -1
  32. package/bundled/option.js +1 -5
  33. package/bundled/repeat.cjs +1 -1
  34. package/bundled/repeat.js +1 -5
  35. package/bundled/single-value-picker.cjs +1 -1
  36. package/bundled/single-value-picker.js +5 -15
  37. package/bundled/slottable-request.cjs +2 -2
  38. package/bundled/slottable-request.js +31 -34
  39. package/bundled/text-field.cjs +1 -1
  40. package/bundled/text-field.js +1 -1
  41. package/bundled/time-selection-picker.template.cjs +1 -1
  42. package/bundled/time-selection-picker.template.js +1 -1
  43. package/bundled/vivid-element.cjs +2 -2
  44. package/bundled/vivid-element.js +42 -38
  45. package/button/definition.js +1 -2
  46. package/calendar/definition.js +1 -2
  47. package/card/definition.js +1 -2
  48. package/checkbox/definition.js +1 -2
  49. package/color-picker/definition.js +1 -2
  50. package/color-picker/index.cjs +1 -1
  51. package/color-picker/index.js +2 -4
  52. package/combobox/definition.js +1 -2
  53. package/combobox/index.cjs +1 -1
  54. package/combobox/index.js +1 -5
  55. package/contextual-help/definition.js +1 -2
  56. package/country/definition.js +1 -2
  57. package/country-group/definition.js +1 -2
  58. package/country-group/index.cjs +1 -1
  59. package/country-group/index.js +1 -5
  60. package/custom-elements.json +4824 -4718
  61. package/data-grid/definition.js +1 -2
  62. package/data-grid/index.cjs +2 -2
  63. package/data-grid/index.js +16 -44
  64. package/date-picker/definition.js +1 -2
  65. package/date-range-picker/definition.js +1 -2
  66. package/date-range-picker/index.cjs +1 -1
  67. package/date-range-picker/index.js +7 -18
  68. package/date-time-picker/definition.js +1 -2
  69. package/dial-pad/definition.js +1 -2
  70. package/dial-pad/index.cjs +1 -1
  71. package/dial-pad/index.js +1 -5
  72. package/dialog/definition.js +1 -2
  73. package/elevation/definition.js +1 -2
  74. package/empty-state/definition.js +1 -2
  75. package/fab/definition.js +1 -2
  76. package/fab/index.cjs +1 -1
  77. package/fab/index.js +2 -5
  78. package/file-picker/definition.js +1 -2
  79. package/file-picker/index.js +1 -0
  80. package/flag/definition.js +1 -2
  81. package/form-field/definition.js +1 -2
  82. package/header/definition.js +1 -2
  83. package/kbd-key/definition.js +1 -2
  84. package/kbd-shortcut/definition.js +1 -2
  85. package/layout/definition.js +1 -2
  86. package/lib/rich-text-editor/rte/feature.d.ts +0 -1
  87. package/lib/rich-text-editor/rte/features/base.d.ts +11 -1
  88. package/lib/rich-text-editor/rte/features/bold.d.ts +5 -1
  89. package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +7 -1
  90. package/lib/rich-text-editor/rte/features/hard-break.d.ts +4 -0
  91. package/lib/rich-text-editor/rte/features/inline-image.d.ts +5 -0
  92. package/lib/rich-text-editor/rte/features/italic.d.ts +5 -1
  93. package/lib/rich-text-editor/rte/features/link.d.ts +5 -1
  94. package/lib/rich-text-editor/rte/features/list.d.ts +6 -0
  95. package/lib/rich-text-editor/rte/features/monospace.d.ts +5 -1
  96. package/lib/rich-text-editor/rte/features/strikethrough.d.ts +5 -1
  97. package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +7 -1
  98. package/lib/rich-text-editor/rte/features/underline.d.ts +5 -1
  99. package/lib/rich-text-editor/rte/public-interface.d.ts +1 -1
  100. package/lib/rich-text-editor/rte/utils/color.d.ts +1 -0
  101. package/lib/rich-text-editor/rte/utils/flatten-slice.d.ts +2 -0
  102. package/lib/rich-text-editor/rte/utils/sanitization.d.ts +2 -0
  103. package/listbox/definition.js +1 -2
  104. package/listbox/index.cjs +1 -1
  105. package/listbox/index.js +3 -7
  106. package/locales/en-US.js +1 -2
  107. package/menu/definition.js +1 -2
  108. package/menu-item/definition.js +1 -2
  109. package/nav/definition.js +1 -2
  110. package/nav-disclosure/definition.js +1 -2
  111. package/nav-item/definition.js +1 -2
  112. package/note/definition.js +1 -2
  113. package/number-field/definition.js +1 -2
  114. package/number-field/index.cjs +1 -1
  115. package/number-field/index.js +1 -1
  116. package/package.json +18 -18
  117. package/pagination/definition.js +1 -2
  118. package/pagination/index.cjs +1 -1
  119. package/pagination/index.js +2 -13
  120. package/platform-switch/definition.js +1 -2
  121. package/platform-switch/index.cjs +1 -1
  122. package/platform-switch/index.js +1 -7
  123. package/popover/definition.js +1 -2
  124. package/popover/index.js +1 -0
  125. package/popup/definition.js +1 -2
  126. package/progress/definition.js +1 -2
  127. package/progress-ring/definition.js +1 -2
  128. package/radio/definition.js +1 -2
  129. package/radio-group/definition.js +1 -2
  130. package/radio-group/index.cjs +13 -2
  131. package/radio-group/index.js +21 -14
  132. package/range-slider/definition.js +1 -2
  133. package/rich-text-editor/definition.js +1 -2
  134. package/rich-text-editor/index.cjs +7 -7
  135. package/rich-text-editor/index.js +2123 -2047
  136. package/rich-text-view/definition.js +1 -2
  137. package/searchable-select/definition.js +1 -2
  138. package/searchable-select/index.cjs +1 -1
  139. package/searchable-select/index.js +4 -24
  140. package/select/definition.js +1 -2
  141. package/selectable-box/definition.js +1 -2
  142. package/selectable-box/index.cjs +1 -1
  143. package/selectable-box/index.js +2 -5
  144. package/shared/foundation/vivid-element/vivid-element.browser-spec.d.ts +1 -0
  145. package/shared/foundation/vivid-element/vivid-element.d.ts +8 -8
  146. package/side-drawer/definition.js +1 -2
  147. package/side-drawer/index.cjs +1 -1
  148. package/side-drawer/index.js +2 -5
  149. package/simple-color-picker/definition.js +1 -2
  150. package/split-button/definition.js +1 -2
  151. package/split-button/index.cjs +1 -1
  152. package/split-button/index.js +4 -10
  153. package/status/definition.js +1 -2
  154. package/styles/fonts/spezia-variable.css +33 -21
  155. package/switch/definition.js +1 -2
  156. package/switch/index.cjs +1 -1
  157. package/switch/index.js +1 -1
  158. package/tab/definition.js +1 -2
  159. package/tab-panel/definition.js +1 -2
  160. package/table/definition.js +1 -2
  161. package/tabs/definition.js +1 -2
  162. package/tag/definition.js +1 -2
  163. package/tag/index.cjs +1 -1
  164. package/tag/index.js +2 -2
  165. package/tag-group/definition.js +1 -2
  166. package/text-area/definition.js +1 -2
  167. package/text-field/definition.js +1 -2
  168. package/toggletip/definition.js +1 -2
  169. package/tooltip/definition.js +1 -2
  170. package/tree-item/definition.js +1 -2
  171. package/tree-view/definition.js +1 -2
  172. package/unbundled/decorate.cjs +1 -1
  173. package/unbundled/decorate.js +1 -1
  174. package/unbundled/definition11.cjs +1 -1
  175. package/unbundled/definition11.js +1 -1
  176. package/unbundled/definition2.cjs +4 -4
  177. package/unbundled/definition2.js +4 -4
  178. package/unbundled/definition55.cjs +1 -1
  179. package/unbundled/definition55.js +1 -1
  180. package/unbundled/definition61.cjs +21 -2
  181. package/unbundled/definition61.js +21 -2
  182. package/unbundled/definition63.cjs +191 -61
  183. package/unbundled/definition63.js +191 -61
  184. package/unbundled/definition72.cjs +1 -0
  185. package/unbundled/definition72.js +1 -0
  186. package/unbundled/definition74.cjs +2 -1
  187. package/unbundled/definition74.js +2 -1
  188. package/unbundled/text-field.cjs +1 -1
  189. package/unbundled/text-field.js +1 -1
  190. package/unbundled/vivid-element.cjs +54 -1
  191. package/unbundled/vivid-element.js +55 -2
  192. package/video-player/definition.js +1 -2
  193. package/video-player/index.cjs +18 -18
  194. package/video-player/index.js +629 -1219
  195. package/visually-hidden/definition.js +1 -2
  196. package/vivid.api.json +13 -13
@@ -161,11 +161,8 @@ var f = ".vjs-svg-icon{fill:currentColor;background-position:50%;background-repe
161
161
  })), b = /* @__PURE__ */ t(((e, t) => {
162
162
  var n = p(), r = function(e, t) {
163
163
  return t === void 0 && (t = !1), function(r, a, o) {
164
- if (r) {
165
- e(r);
166
- return;
167
- }
168
- if (a.statusCode >= 400 && a.statusCode <= 599) {
164
+ if (r) e(r);
165
+ else if (a.statusCode >= 400 && a.statusCode <= 599) {
169
166
  var s = o;
170
167
  if (t) {
171
168
  if (n.TextDecoder) {
@@ -176,9 +173,7 @@ var f = ".vjs-svg-icon{fill:currentColor;background-position:50%;background-repe
176
173
  } else s = String.fromCharCode.apply(null, new Uint8Array(o));
177
174
  }
178
175
  e({ cause: s });
179
- return;
180
- }
181
- e(null, o);
176
+ } else e(null, o);
182
177
  };
183
178
  };
184
179
  function i(e) {
@@ -251,22 +246,21 @@ var f = ".vjs-svg-icon{fill:currentColor;background-position:50%;background-repe
251
246
  return e;
252
247
  }
253
248
  function c(t) {
254
- if (clearTimeout(C), clearTimeout(e.retryTimeout), t instanceof Error || (t = /* @__PURE__ */ Error("" + (t || "Unknown XMLHttpRequest Error"))), t.statusCode = 0, !g && d.retryManager.getIsEnabled() && e.retry && e.retry.shouldRetry()) {
255
- e.retryTimeout = setTimeout(function() {
256
- e.retry.moveToNextAttempt(), e.xhr = p, f(e);
257
- }, e.retry.getCurrentFuzzedDelay());
258
- return;
259
- }
260
- if (e.requestType && d.responseInterceptorsStorage.getIsEnabled()) {
261
- var n = {
262
- headers: w.headers || {},
263
- body: w.body,
264
- responseUrl: p.responseURL,
265
- responseType: p.responseType
266
- }, r = d.responseInterceptorsStorage.execute(e.requestType, n);
267
- w.body = r.body, w.headers = r.headers;
249
+ if (clearTimeout(C), clearTimeout(e.retryTimeout), t instanceof Error || (t = /* @__PURE__ */ Error("" + (t || "Unknown XMLHttpRequest Error"))), t.statusCode = 0, !g && d.retryManager.getIsEnabled() && e.retry && e.retry.shouldRetry()) e.retryTimeout = setTimeout(function() {
250
+ e.retry.moveToNextAttempt(), e.xhr = p, f(e);
251
+ }, e.retry.getCurrentFuzzedDelay());
252
+ else {
253
+ if (e.requestType && d.responseInterceptorsStorage.getIsEnabled()) {
254
+ var n = {
255
+ headers: w.headers || {},
256
+ body: w.body,
257
+ responseUrl: p.responseURL,
258
+ responseType: p.responseType
259
+ }, r = d.responseInterceptorsStorage.execute(e.requestType, n);
260
+ w.body = r.body, w.headers = r.headers;
261
+ }
262
+ return i(t, w);
268
263
  }
269
- return i(t, w);
270
264
  }
271
265
  function u() {
272
266
  if (!g) {
@@ -510,34 +504,30 @@ var f = ".vjs-svg-icon{fill:currentColor;background-position:50%;background-repe
510
504
  var i = e.document.createElement(r), a = f[t];
511
505
  return a && n && (i[a] = n.trim()), i;
512
506
  }
513
- for (var s = e.document.createElement("div"), c = s, m, h = []; (m = n()) !== null;) {
514
- if (m[0] === "<") {
515
- if (m[1] === "/") {
516
- h.length && h[h.length - 1] === m.substr(2).replace(">", "") && (h.pop(), c = c.parentNode);
517
- continue;
518
- }
519
- var g = a(m.substr(1, m.length - 2)), _;
520
- if (g) {
521
- _ = e.document.createProcessingInstruction("timestamp", g), c.appendChild(_);
522
- continue;
523
- }
524
- var v = m.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
525
- if (!v || (_ = o(v[1], v[3]), !_) || !i(c, _)) continue;
526
- if (v[2]) {
527
- var y = v[2].split(".");
528
- y.forEach(function(e) {
529
- var t = /^bg_/.test(e), n = t ? e.slice(3) : e;
530
- if (d.hasOwnProperty(n)) {
531
- var r = t ? "background-color" : "color", i = d[n];
532
- _.style[r] = i;
533
- }
534
- }), _.className = y.join(" ");
535
- }
536
- h.push(v[1]), c.appendChild(_), c = _;
507
+ for (var s = e.document.createElement("div"), c = s, m, h = []; (m = n()) !== null;) if (m[0] === "<") {
508
+ if (m[1] === "/") {
509
+ h.length && h[h.length - 1] === m.substr(2).replace(">", "") && (h.pop(), c = c.parentNode);
537
510
  continue;
538
511
  }
539
- c.appendChild(e.document.createTextNode(r(m)));
540
- }
512
+ var g = a(m.substr(1, m.length - 2)), _;
513
+ if (g) {
514
+ _ = e.document.createProcessingInstruction("timestamp", g), c.appendChild(_);
515
+ continue;
516
+ }
517
+ var v = m.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
518
+ if (!v || (_ = o(v[1], v[3]), !_) || !i(c, _)) continue;
519
+ if (v[2]) {
520
+ var y = v[2].split(".");
521
+ y.forEach(function(e) {
522
+ var t = /^bg_/.test(e), n = t ? e.slice(3) : e;
523
+ if (d.hasOwnProperty(n)) {
524
+ var r = t ? "background-color" : "color", i = d[n];
525
+ _.style[r] = i;
526
+ }
527
+ }), _.className = y.join(" ");
528
+ }
529
+ h.push(v[1]), c.appendChild(_), c = _;
530
+ } else c.appendChild(e.document.createTextNode(r(m)));
541
531
  return s;
542
532
  }
543
533
  var g = [
@@ -867,14 +857,12 @@ var f = ".vjs-svg-icon{fill:currentColor;background-position:50%;background-repe
867
857
  for (var t = 0; t < e.length; t++) if (e[t].hasBeenReset || !e[t].displayState) return !0;
868
858
  return !1;
869
859
  }
870
- if (!i(t)) {
871
- for (var a = 0; a < t.length; a++) r.appendChild(t[a].displayState);
872
- return;
873
- }
874
- var o = [], s = S.getSimpleBoxPosition(r), c = { font: Math.round(s.height * T * 100) / 100 + "px " + E };
875
- (function() {
876
- for (var n, i, a = 0; a < t.length; a++) i = t[a], n = new x(e, i, c), r.appendChild(n.div), C(e, n, s, o), i.displayState = n.div, o.push(S.getSimpleBoxPosition(n));
877
- })();
860
+ if (i(t)) {
861
+ var a = [], o = S.getSimpleBoxPosition(r), s = { font: Math.round(o.height * T * 100) / 100 + "px " + E };
862
+ (function() {
863
+ for (var n, i, c = 0; c < t.length; c++) i = t[c], n = new x(e, i, s), r.appendChild(n.div), C(e, n, o, a), i.displayState = n.div, a.push(S.getSimpleBoxPosition(n));
864
+ })();
865
+ } else for (var c = 0; c < t.length; c++) r.appendChild(t[c].displayState);
878
866
  }, w.Parser = function(e, t, n) {
879
867
  n || (n = t, t = {}), t ||= {}, this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "", this.decoder = n || new TextDecoder("utf8"), this.regionList = [];
880
868
  }, w.Parser.prototype = {
@@ -1360,303 +1348,195 @@ var M = class extends te {
1360
1348
  }
1361
1349
  push(e) {
1362
1350
  let t, n;
1363
- if (e = e.trim(), e.length !== 0) {
1364
- if (e[0] !== "#") {
1365
- this.trigger("data", {
1366
- type: "uri",
1367
- uri: e
1368
- });
1369
- return;
1370
- }
1371
- this.tagMappers.reduce((t, n) => {
1372
- let r = n(e);
1373
- return r === e ? t : t.concat([r]);
1374
- }, [e]).forEach((e) => {
1375
- for (let t = 0; t < this.customParsers.length; t++) if (this.customParsers[t].call(this, e)) return;
1376
- if (e.indexOf("#EXT") !== 0) {
1377
- this.trigger("data", {
1378
- type: "comment",
1379
- text: e.slice(1)
1380
- });
1381
- return;
1382
- }
1383
- if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e), t) {
1384
- this.trigger("data", {
1385
- type: "tag",
1386
- tagType: "m3u"
1387
- });
1388
- return;
1389
- }
1390
- if (t = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e), t) {
1391
- n = {
1392
- type: "tag",
1393
- tagType: "inf"
1394
- }, t[1] && (n.duration = parseFloat(t[1])), t[2] && (n.title = t[2]), this.trigger("data", n);
1395
- return;
1396
- }
1397
- if (t = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e), t) {
1398
- n = {
1399
- type: "tag",
1400
- tagType: "targetduration"
1401
- }, t[1] && (n.duration = parseInt(t[1], 10)), this.trigger("data", n);
1402
- return;
1403
- }
1404
- if (t = /^#EXT-X-VERSION:([0-9.]*)?/.exec(e), t) {
1405
- n = {
1406
- type: "tag",
1407
- tagType: "version"
1408
- }, t[1] && (n.version = parseInt(t[1], 10)), this.trigger("data", n);
1409
- return;
1410
- }
1411
- if (t = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e), t) {
1412
- n = {
1413
- type: "tag",
1414
- tagType: "media-sequence"
1415
- }, t[1] && (n.number = parseInt(t[1], 10)), this.trigger("data", n);
1416
- return;
1417
- }
1418
- if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e), t) {
1419
- n = {
1420
- type: "tag",
1421
- tagType: "discontinuity-sequence"
1422
- }, t[1] && (n.number = parseInt(t[1], 10)), this.trigger("data", n);
1423
- return;
1424
- }
1425
- if (t = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e), t) {
1426
- n = {
1427
- type: "tag",
1428
- tagType: "playlist-type"
1429
- }, t[1] && (n.playlistType = t[1]), this.trigger("data", n);
1430
- return;
1431
- }
1432
- if (t = /^#EXT-X-BYTERANGE:(.*)?$/.exec(e), t) {
1433
- n = k(ae(t[1]), {
1434
- type: "tag",
1435
- tagType: "byterange"
1436
- }), this.trigger("data", n);
1437
- return;
1438
- }
1439
- if (t = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e), t) {
1440
- n = {
1441
- type: "tag",
1442
- tagType: "allow-cache"
1443
- }, t[1] && (n.allowed = !/NO/.test(t[1])), this.trigger("data", n);
1444
- return;
1445
- }
1446
- if (t = /^#EXT-X-MAP:(.*)$/.exec(e), t) {
1447
- if (n = {
1448
- type: "tag",
1449
- tagType: "map"
1450
- }, t[1]) {
1451
- let e = se(t[1]);
1452
- e.URI && (n.uri = e.URI), e.BYTERANGE && (n.byterange = ae(e.BYTERANGE));
1453
- }
1454
- this.trigger("data", n);
1455
- return;
1456
- }
1457
- if (t = /^#EXT-X-STREAM-INF:(.*)$/.exec(e), t) {
1458
- n = {
1459
- type: "tag",
1460
- tagType: "stream-inf"
1461
- }, t[1] && (n.attributes = se(t[1]), n.attributes.RESOLUTION && (n.attributes.RESOLUTION = ce(n.attributes.RESOLUTION)), n.attributes.BANDWIDTH && (n.attributes.BANDWIDTH = parseInt(n.attributes.BANDWIDTH, 10)), n.attributes["FRAME-RATE"] && (n.attributes["FRAME-RATE"] = parseFloat(n.attributes["FRAME-RATE"])), n.attributes["PROGRAM-ID"] && (n.attributes["PROGRAM-ID"] = parseInt(n.attributes["PROGRAM-ID"], 10))), this.trigger("data", n);
1462
- return;
1463
- }
1464
- if (t = /^#EXT-X-MEDIA:(.*)$/.exec(e), t) {
1465
- n = {
1466
- type: "tag",
1467
- tagType: "media"
1468
- }, t[1] && (n.attributes = se(t[1])), this.trigger("data", n);
1469
- return;
1470
- }
1471
- if (t = /^#EXT-X-ENDLIST/.exec(e), t) {
1472
- this.trigger("data", {
1473
- type: "tag",
1474
- tagType: "endlist"
1475
- });
1476
- return;
1477
- }
1478
- if (t = /^#EXT-X-DISCONTINUITY/.exec(e), t) {
1479
- this.trigger("data", {
1480
- type: "tag",
1481
- tagType: "discontinuity"
1482
- });
1483
- return;
1484
- }
1485
- if (t = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e), t) {
1486
- n = {
1487
- type: "tag",
1488
- tagType: "program-date-time"
1489
- }, t[1] && (n.dateTimeString = t[1], n.dateTimeObject = new Date(t[1])), this.trigger("data", n);
1490
- return;
1491
- }
1492
- if (t = /^#EXT-X-KEY:(.*)$/.exec(e), t) {
1493
- n = {
1494
- type: "tag",
1495
- tagType: "key"
1496
- }, t[1] && (n.attributes = se(t[1]), n.attributes.IV && (n.attributes.IV.substring(0, 2).toLowerCase() === "0x" && (n.attributes.IV = n.attributes.IV.substring(2)), n.attributes.IV = n.attributes.IV.match(/.{8}/g), n.attributes.IV[0] = parseInt(n.attributes.IV[0], 16), n.attributes.IV[1] = parseInt(n.attributes.IV[1], 16), n.attributes.IV[2] = parseInt(n.attributes.IV[2], 16), n.attributes.IV[3] = parseInt(n.attributes.IV[3], 16), n.attributes.IV = new Uint32Array(n.attributes.IV))), this.trigger("data", n);
1497
- return;
1498
- }
1499
- if (t = /^#EXT-X-START:(.*)$/.exec(e), t) {
1500
- n = {
1501
- type: "tag",
1502
- tagType: "start"
1503
- }, t[1] && (n.attributes = se(t[1]), n.attributes["TIME-OFFSET"] = parseFloat(n.attributes["TIME-OFFSET"]), n.attributes.PRECISE = /YES/.test(n.attributes.PRECISE)), this.trigger("data", n);
1504
- return;
1505
- }
1506
- if (t = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e), t) {
1507
- n = {
1508
- type: "tag",
1509
- tagType: "cue-out-cont"
1510
- }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1511
- return;
1512
- }
1513
- if (t = /^#EXT-X-CUE-OUT:(.*)?$/.exec(e), t) {
1514
- n = {
1515
- type: "tag",
1516
- tagType: "cue-out"
1517
- }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1518
- return;
1519
- }
1520
- if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e), t) {
1521
- n = {
1522
- type: "tag",
1523
- tagType: "cue-in"
1524
- }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1525
- return;
1526
- }
1527
- if (t = /^#EXT-X-SKIP:(.*)$/.exec(e), t && t[1]) {
1528
- n = {
1529
- type: "tag",
1530
- tagType: "skip"
1531
- }, n.attributes = se(t[1]), n.attributes.hasOwnProperty("SKIPPED-SEGMENTS") && (n.attributes["SKIPPED-SEGMENTS"] = parseInt(n.attributes["SKIPPED-SEGMENTS"], 10)), n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES") && (n.attributes["RECENTLY-REMOVED-DATERANGES"] = n.attributes["RECENTLY-REMOVED-DATERANGES"].split(ie)), this.trigger("data", n);
1532
- return;
1533
- }
1534
- if (t = /^#EXT-X-PART:(.*)$/.exec(e), t && t[1]) {
1535
- n = {
1536
- type: "tag",
1537
- tagType: "part"
1538
- }, n.attributes = se(t[1]), ["DURATION"].forEach(function(e) {
1539
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1540
- }), ["INDEPENDENT", "GAP"].forEach(function(e) {
1541
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/.test(n.attributes[e]));
1542
- }), n.attributes.hasOwnProperty("BYTERANGE") && (n.attributes.byterange = ae(n.attributes.BYTERANGE)), this.trigger("data", n);
1543
- return;
1544
- }
1545
- if (t = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e), t && t[1]) {
1546
- n = {
1547
- type: "tag",
1548
- tagType: "server-control"
1549
- }, n.attributes = se(t[1]), [
1550
- "CAN-SKIP-UNTIL",
1551
- "PART-HOLD-BACK",
1552
- "HOLD-BACK"
1553
- ].forEach(function(e) {
1554
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1555
- }), ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(e) {
1556
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/.test(n.attributes[e]));
1557
- }), this.trigger("data", n);
1558
- return;
1559
- }
1560
- if (t = /^#EXT-X-PART-INF:(.*)$/.exec(e), t && t[1]) {
1561
- n = {
1562
- type: "tag",
1563
- tagType: "part-inf"
1564
- }, n.attributes = se(t[1]), ["PART-TARGET"].forEach(function(e) {
1565
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1566
- }), this.trigger("data", n);
1567
- return;
1568
- }
1569
- if (t = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e), t && t[1]) {
1570
- n = {
1571
- type: "tag",
1572
- tagType: "preload-hint"
1573
- }, n.attributes = se(t[1]), ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(e) {
1574
- if (n.attributes.hasOwnProperty(e)) {
1575
- n.attributes[e] = parseInt(n.attributes[e], 10);
1576
- let t = e === "BYTERANGE-LENGTH" ? "length" : "offset";
1577
- n.attributes.byterange = n.attributes.byterange || {}, n.attributes.byterange[t] = n.attributes[e], delete n.attributes[e];
1578
- }
1579
- }), this.trigger("data", n);
1580
- return;
1581
- }
1582
- if (t = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e), t && t[1]) {
1583
- n = {
1584
- type: "tag",
1585
- tagType: "rendition-report"
1586
- }, n.attributes = se(t[1]), ["LAST-MSN", "LAST-PART"].forEach(function(e) {
1587
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseInt(n.attributes[e], 10));
1588
- }), this.trigger("data", n);
1589
- return;
1590
- }
1591
- if (t = /^#EXT-X-DATERANGE:(.*)$/.exec(e), t && t[1]) {
1592
- n = {
1593
- type: "tag",
1594
- tagType: "daterange"
1595
- }, n.attributes = se(t[1]), ["ID", "CLASS"].forEach(function(e) {
1596
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = String(n.attributes[e]));
1597
- }), ["START-DATE", "END-DATE"].forEach(function(e) {
1598
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = new Date(n.attributes[e]));
1599
- }), ["DURATION", "PLANNED-DURATION"].forEach(function(e) {
1600
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1601
- }), ["END-ON-NEXT"].forEach(function(e) {
1602
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/i.test(n.attributes[e]));
1603
- }), [
1604
- "SCTE35-CMD",
1605
- " SCTE35-OUT",
1606
- "SCTE35-IN"
1607
- ].forEach(function(e) {
1608
- n.attributes.hasOwnProperty(e) && (n.attributes[e] = n.attributes[e].toString(16));
1609
- });
1610
- let e = /^X-([A-Z]+-)+[A-Z]+$/;
1611
- for (let t in n.attributes) {
1612
- if (!e.test(t)) continue;
1613
- let r = /[0-9A-Fa-f]{6}/g.test(n.attributes[t]), i = /^\d+(\.\d+)?$/.test(n.attributes[t]);
1614
- n.attributes[t] = r ? n.attributes[t].toString(16) : i ? parseFloat(n.attributes[t]) : String(n.attributes[t]);
1615
- }
1616
- this.trigger("data", n);
1617
- return;
1618
- }
1619
- if (t = /^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e), t) {
1620
- this.trigger("data", {
1621
- type: "tag",
1622
- tagType: "independent-segments"
1623
- });
1624
- return;
1625
- }
1626
- if (t = /^#EXT-X-I-FRAMES-ONLY/.exec(e), t) {
1627
- this.trigger("data", {
1628
- type: "tag",
1629
- tagType: "i-frames-only"
1630
- });
1631
- return;
1632
- }
1633
- if (t = /^#EXT-X-CONTENT-STEERING:(.*)$/.exec(e), t) {
1634
- n = {
1635
- type: "tag",
1636
- tagType: "content-steering"
1637
- }, n.attributes = se(t[1]), this.trigger("data", n);
1638
- return;
1639
- }
1640
- if (t = /^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(e), t) {
1641
- n = {
1642
- type: "tag",
1643
- tagType: "i-frame-playlist"
1644
- }, n.attributes = se(t[1]), n.attributes.URI && (n.uri = n.attributes.URI), n.attributes.BANDWIDTH && (n.attributes.BANDWIDTH = parseInt(n.attributes.BANDWIDTH, 10)), n.attributes.RESOLUTION && (n.attributes.RESOLUTION = ce(n.attributes.RESOLUTION)), n.attributes["AVERAGE-BANDWIDTH"] && (n.attributes["AVERAGE-BANDWIDTH"] = parseInt(n.attributes["AVERAGE-BANDWIDTH"], 10)), n.attributes["FRAME-RATE"] && (n.attributes["FRAME-RATE"] = parseFloat(n.attributes["FRAME-RATE"])), this.trigger("data", n);
1645
- return;
1351
+ e = e.trim(), e.length !== 0 && (e[0] === "#" ? this.tagMappers.reduce((t, n) => {
1352
+ let r = n(e);
1353
+ return r === e ? t : t.concat([r]);
1354
+ }, [e]).forEach((e) => {
1355
+ for (let t = 0; t < this.customParsers.length; t++) if (this.customParsers[t].call(this, e)) return;
1356
+ if (e.indexOf("#EXT") !== 0) this.trigger("data", {
1357
+ type: "comment",
1358
+ text: e.slice(1)
1359
+ });
1360
+ else if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e), t) this.trigger("data", {
1361
+ type: "tag",
1362
+ tagType: "m3u"
1363
+ });
1364
+ else if (t = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e), t) n = {
1365
+ type: "tag",
1366
+ tagType: "inf"
1367
+ }, t[1] && (n.duration = parseFloat(t[1])), t[2] && (n.title = t[2]), this.trigger("data", n);
1368
+ else if (t = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e), t) n = {
1369
+ type: "tag",
1370
+ tagType: "targetduration"
1371
+ }, t[1] && (n.duration = parseInt(t[1], 10)), this.trigger("data", n);
1372
+ else if (t = /^#EXT-X-VERSION:([0-9.]*)?/.exec(e), t) n = {
1373
+ type: "tag",
1374
+ tagType: "version"
1375
+ }, t[1] && (n.version = parseInt(t[1], 10)), this.trigger("data", n);
1376
+ else if (t = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e), t) n = {
1377
+ type: "tag",
1378
+ tagType: "media-sequence"
1379
+ }, t[1] && (n.number = parseInt(t[1], 10)), this.trigger("data", n);
1380
+ else if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e), t) n = {
1381
+ type: "tag",
1382
+ tagType: "discontinuity-sequence"
1383
+ }, t[1] && (n.number = parseInt(t[1], 10)), this.trigger("data", n);
1384
+ else if (t = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e), t) n = {
1385
+ type: "tag",
1386
+ tagType: "playlist-type"
1387
+ }, t[1] && (n.playlistType = t[1]), this.trigger("data", n);
1388
+ else if (t = /^#EXT-X-BYTERANGE:(.*)?$/.exec(e), t) n = k(ae(t[1]), {
1389
+ type: "tag",
1390
+ tagType: "byterange"
1391
+ }), this.trigger("data", n);
1392
+ else if (t = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e), t) n = {
1393
+ type: "tag",
1394
+ tagType: "allow-cache"
1395
+ }, t[1] && (n.allowed = !/NO/.test(t[1])), this.trigger("data", n);
1396
+ else if (t = /^#EXT-X-MAP:(.*)$/.exec(e), t) {
1397
+ if (n = {
1398
+ type: "tag",
1399
+ tagType: "map"
1400
+ }, t[1]) {
1401
+ let e = se(t[1]);
1402
+ e.URI && (n.uri = e.URI), e.BYTERANGE && (n.byterange = ae(e.BYTERANGE));
1646
1403
  }
1647
- if (t = /^#EXT-X-DEFINE:(.*)$/.exec(e), t) {
1648
- n = {
1649
- type: "tag",
1650
- tagType: "define"
1651
- }, n.attributes = se(t[1]), this.trigger("data", n);
1652
- return;
1404
+ this.trigger("data", n);
1405
+ } else if (t = /^#EXT-X-STREAM-INF:(.*)$/.exec(e), t) n = {
1406
+ type: "tag",
1407
+ tagType: "stream-inf"
1408
+ }, t[1] && (n.attributes = se(t[1]), n.attributes.RESOLUTION && (n.attributes.RESOLUTION = ce(n.attributes.RESOLUTION)), n.attributes.BANDWIDTH && (n.attributes.BANDWIDTH = parseInt(n.attributes.BANDWIDTH, 10)), n.attributes["FRAME-RATE"] && (n.attributes["FRAME-RATE"] = parseFloat(n.attributes["FRAME-RATE"])), n.attributes["PROGRAM-ID"] && (n.attributes["PROGRAM-ID"] = parseInt(n.attributes["PROGRAM-ID"], 10))), this.trigger("data", n);
1409
+ else if (t = /^#EXT-X-MEDIA:(.*)$/.exec(e), t) n = {
1410
+ type: "tag",
1411
+ tagType: "media"
1412
+ }, t[1] && (n.attributes = se(t[1])), this.trigger("data", n);
1413
+ else if (t = /^#EXT-X-ENDLIST/.exec(e), t) this.trigger("data", {
1414
+ type: "tag",
1415
+ tagType: "endlist"
1416
+ });
1417
+ else if (t = /^#EXT-X-DISCONTINUITY/.exec(e), t) this.trigger("data", {
1418
+ type: "tag",
1419
+ tagType: "discontinuity"
1420
+ });
1421
+ else if (t = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e), t) n = {
1422
+ type: "tag",
1423
+ tagType: "program-date-time"
1424
+ }, t[1] && (n.dateTimeString = t[1], n.dateTimeObject = new Date(t[1])), this.trigger("data", n);
1425
+ else if (t = /^#EXT-X-KEY:(.*)$/.exec(e), t) n = {
1426
+ type: "tag",
1427
+ tagType: "key"
1428
+ }, t[1] && (n.attributes = se(t[1]), n.attributes.IV && (n.attributes.IV.substring(0, 2).toLowerCase() === "0x" && (n.attributes.IV = n.attributes.IV.substring(2)), n.attributes.IV = n.attributes.IV.match(/.{8}/g), n.attributes.IV[0] = parseInt(n.attributes.IV[0], 16), n.attributes.IV[1] = parseInt(n.attributes.IV[1], 16), n.attributes.IV[2] = parseInt(n.attributes.IV[2], 16), n.attributes.IV[3] = parseInt(n.attributes.IV[3], 16), n.attributes.IV = new Uint32Array(n.attributes.IV))), this.trigger("data", n);
1429
+ else if (t = /^#EXT-X-START:(.*)$/.exec(e), t) n = {
1430
+ type: "tag",
1431
+ tagType: "start"
1432
+ }, t[1] && (n.attributes = se(t[1]), n.attributes["TIME-OFFSET"] = parseFloat(n.attributes["TIME-OFFSET"]), n.attributes.PRECISE = /YES/.test(n.attributes.PRECISE)), this.trigger("data", n);
1433
+ else if (t = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e), t) n = {
1434
+ type: "tag",
1435
+ tagType: "cue-out-cont"
1436
+ }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1437
+ else if (t = /^#EXT-X-CUE-OUT:(.*)?$/.exec(e), t) n = {
1438
+ type: "tag",
1439
+ tagType: "cue-out"
1440
+ }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1441
+ else if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e), t) n = {
1442
+ type: "tag",
1443
+ tagType: "cue-in"
1444
+ }, t[1] ? n.data = t[1] : n.data = "", this.trigger("data", n);
1445
+ else if (t = /^#EXT-X-SKIP:(.*)$/.exec(e), t && t[1]) n = {
1446
+ type: "tag",
1447
+ tagType: "skip"
1448
+ }, n.attributes = se(t[1]), n.attributes.hasOwnProperty("SKIPPED-SEGMENTS") && (n.attributes["SKIPPED-SEGMENTS"] = parseInt(n.attributes["SKIPPED-SEGMENTS"], 10)), n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES") && (n.attributes["RECENTLY-REMOVED-DATERANGES"] = n.attributes["RECENTLY-REMOVED-DATERANGES"].split(ie)), this.trigger("data", n);
1449
+ else if (t = /^#EXT-X-PART:(.*)$/.exec(e), t && t[1]) n = {
1450
+ type: "tag",
1451
+ tagType: "part"
1452
+ }, n.attributes = se(t[1]), ["DURATION"].forEach(function(e) {
1453
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1454
+ }), ["INDEPENDENT", "GAP"].forEach(function(e) {
1455
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/.test(n.attributes[e]));
1456
+ }), n.attributes.hasOwnProperty("BYTERANGE") && (n.attributes.byterange = ae(n.attributes.BYTERANGE)), this.trigger("data", n);
1457
+ else if (t = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e), t && t[1]) n = {
1458
+ type: "tag",
1459
+ tagType: "server-control"
1460
+ }, n.attributes = se(t[1]), [
1461
+ "CAN-SKIP-UNTIL",
1462
+ "PART-HOLD-BACK",
1463
+ "HOLD-BACK"
1464
+ ].forEach(function(e) {
1465
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1466
+ }), ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(e) {
1467
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/.test(n.attributes[e]));
1468
+ }), this.trigger("data", n);
1469
+ else if (t = /^#EXT-X-PART-INF:(.*)$/.exec(e), t && t[1]) n = {
1470
+ type: "tag",
1471
+ tagType: "part-inf"
1472
+ }, n.attributes = se(t[1]), ["PART-TARGET"].forEach(function(e) {
1473
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1474
+ }), this.trigger("data", n);
1475
+ else if (t = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e), t && t[1]) n = {
1476
+ type: "tag",
1477
+ tagType: "preload-hint"
1478
+ }, n.attributes = se(t[1]), ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(e) {
1479
+ if (n.attributes.hasOwnProperty(e)) {
1480
+ n.attributes[e] = parseInt(n.attributes[e], 10);
1481
+ let t = e === "BYTERANGE-LENGTH" ? "length" : "offset";
1482
+ n.attributes.byterange = n.attributes.byterange || {}, n.attributes.byterange[t] = n.attributes[e], delete n.attributes[e];
1653
1483
  }
1654
- this.trigger("data", {
1484
+ }), this.trigger("data", n);
1485
+ else if (t = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e), t && t[1]) n = {
1486
+ type: "tag",
1487
+ tagType: "rendition-report"
1488
+ }, n.attributes = se(t[1]), ["LAST-MSN", "LAST-PART"].forEach(function(e) {
1489
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseInt(n.attributes[e], 10));
1490
+ }), this.trigger("data", n);
1491
+ else if (t = /^#EXT-X-DATERANGE:(.*)$/.exec(e), t && t[1]) {
1492
+ n = {
1655
1493
  type: "tag",
1656
- data: e.slice(4)
1494
+ tagType: "daterange"
1495
+ }, n.attributes = se(t[1]), ["ID", "CLASS"].forEach(function(e) {
1496
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = String(n.attributes[e]));
1497
+ }), ["START-DATE", "END-DATE"].forEach(function(e) {
1498
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = new Date(n.attributes[e]));
1499
+ }), ["DURATION", "PLANNED-DURATION"].forEach(function(e) {
1500
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = parseFloat(n.attributes[e]));
1501
+ }), ["END-ON-NEXT"].forEach(function(e) {
1502
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = /YES/i.test(n.attributes[e]));
1503
+ }), [
1504
+ "SCTE35-CMD",
1505
+ " SCTE35-OUT",
1506
+ "SCTE35-IN"
1507
+ ].forEach(function(e) {
1508
+ n.attributes.hasOwnProperty(e) && (n.attributes[e] = n.attributes[e].toString(16));
1657
1509
  });
1658
- });
1659
- }
1510
+ let e = /^X-([A-Z]+-)+[A-Z]+$/;
1511
+ for (let t in n.attributes) {
1512
+ if (!e.test(t)) continue;
1513
+ let r = /[0-9A-Fa-f]{6}/g.test(n.attributes[t]), i = /^\d+(\.\d+)?$/.test(n.attributes[t]);
1514
+ n.attributes[t] = r ? n.attributes[t].toString(16) : i ? parseFloat(n.attributes[t]) : String(n.attributes[t]);
1515
+ }
1516
+ this.trigger("data", n);
1517
+ } else t = /^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e), t ? this.trigger("data", {
1518
+ type: "tag",
1519
+ tagType: "independent-segments"
1520
+ }) : (t = /^#EXT-X-I-FRAMES-ONLY/.exec(e), t ? this.trigger("data", {
1521
+ type: "tag",
1522
+ tagType: "i-frames-only"
1523
+ }) : (t = /^#EXT-X-CONTENT-STEERING:(.*)$/.exec(e), t ? (n = {
1524
+ type: "tag",
1525
+ tagType: "content-steering"
1526
+ }, n.attributes = se(t[1]), this.trigger("data", n)) : (t = /^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(e), t ? (n = {
1527
+ type: "tag",
1528
+ tagType: "i-frame-playlist"
1529
+ }, n.attributes = se(t[1]), n.attributes.URI && (n.uri = n.attributes.URI), n.attributes.BANDWIDTH && (n.attributes.BANDWIDTH = parseInt(n.attributes.BANDWIDTH, 10)), n.attributes.RESOLUTION && (n.attributes.RESOLUTION = ce(n.attributes.RESOLUTION)), n.attributes["AVERAGE-BANDWIDTH"] && (n.attributes["AVERAGE-BANDWIDTH"] = parseInt(n.attributes["AVERAGE-BANDWIDTH"], 10)), n.attributes["FRAME-RATE"] && (n.attributes["FRAME-RATE"] = parseFloat(n.attributes["FRAME-RATE"])), this.trigger("data", n)) : (t = /^#EXT-X-DEFINE:(.*)$/.exec(e), t ? (n = {
1530
+ type: "tag",
1531
+ tagType: "define"
1532
+ }, n.attributes = se(t[1]), this.trigger("data", n)) : this.trigger("data", {
1533
+ type: "tag",
1534
+ data: e.slice(4)
1535
+ })))));
1536
+ }) : this.trigger("data", {
1537
+ type: "uri",
1538
+ uri: e
1539
+ }));
1660
1540
  }
1661
1541
  addParser({ expression: e, customType: t, dataParser: n, segment: r }) {
1662
1542
  typeof n != "function" && (n = (e) => e), this.customParsers.push((i) => {
@@ -1725,27 +1605,12 @@ var M = class extends te {
1725
1605
  "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this.trigger("info", { message: "defaulting media sequence to zero" })), "discontinuitySequence" in this.manifest || (this.manifest.discontinuitySequence = 0, this.trigger("info", { message: "defaulting discontinuity sequence to zero" })), e.title && (r.title = e.title), e.duration > 0 && (r.duration = e.duration), e.duration === 0 && (r.duration = .01, this.trigger("info", { message: "updating zero segment duration to a small value" })), this.manifest.segments = n;
1726
1606
  },
1727
1607
  key() {
1728
- if (!e.attributes) {
1729
- this.trigger("warn", { message: "ignoring key declaration without attribute list" });
1730
- return;
1731
- }
1732
- if (e.attributes.METHOD === "NONE") {
1733
- a = null;
1734
- return;
1735
- }
1736
- if (!e.attributes.URI) {
1737
- this.trigger("warn", { message: "ignoring key declaration without URI" });
1738
- return;
1739
- }
1740
- if (e.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
1741
- this.manifest.contentProtection = this.manifest.contentProtection || {}, this.manifest.contentProtection["com.apple.fps.1_0"] = { attributes: e.attributes };
1742
- return;
1743
- }
1744
- if (e.attributes.KEYFORMAT === "com.microsoft.playready") {
1745
- this.manifest.contentProtection = this.manifest.contentProtection || {}, this.manifest.contentProtection["com.microsoft.playready"] = { uri: e.attributes.URI };
1746
- return;
1747
- }
1748
- if (e.attributes.KEYFORMAT === "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed") {
1608
+ if (!e.attributes) this.trigger("warn", { message: "ignoring key declaration without attribute list" });
1609
+ else if (e.attributes.METHOD === "NONE") a = null;
1610
+ else if (!e.attributes.URI) this.trigger("warn", { message: "ignoring key declaration without URI" });
1611
+ else if (e.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") this.manifest.contentProtection = this.manifest.contentProtection || {}, this.manifest.contentProtection["com.apple.fps.1_0"] = { attributes: e.attributes };
1612
+ else if (e.attributes.KEYFORMAT === "com.microsoft.playready") this.manifest.contentProtection = this.manifest.contentProtection || {}, this.manifest.contentProtection["com.microsoft.playready"] = { uri: e.attributes.URI };
1613
+ else if (e.attributes.KEYFORMAT === "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed") {
1749
1614
  if ([
1750
1615
  "SAMPLE-AES",
1751
1616
  "SAMPLE-AES-CTR",
@@ -1769,43 +1634,25 @@ var M = class extends te {
1769
1634
  },
1770
1635
  pssh: re(e.attributes.URI.split(",")[1])
1771
1636
  };
1772
- return;
1773
- }
1774
- e.attributes.METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), a = {
1637
+ } else e.attributes.METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), a = {
1775
1638
  method: e.attributes.METHOD || "AES-128",
1776
1639
  uri: e.attributes.URI
1777
1640
  }, e.attributes.IV !== void 0 && (a.iv = e.attributes.IV);
1778
1641
  },
1779
1642
  "media-sequence"() {
1780
- if (!isFinite(e.number)) {
1781
- this.trigger("warn", { message: "ignoring invalid media sequence: " + e.number });
1782
- return;
1783
- }
1784
- this.manifest.mediaSequence = e.number;
1643
+ isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger("warn", { message: "ignoring invalid media sequence: " + e.number });
1785
1644
  },
1786
1645
  "discontinuity-sequence"() {
1787
- if (!isFinite(e.number)) {
1788
- this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + e.number });
1789
- return;
1790
- }
1791
- this.manifest.discontinuitySequence = e.number, l = e.number;
1646
+ isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, l = e.number) : this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + e.number });
1792
1647
  },
1793
1648
  "playlist-type"() {
1794
- if (!/VOD|EVENT/.test(e.playlistType)) {
1795
- this.trigger("warn", { message: "ignoring unknown playlist type: " + e.playlist });
1796
- return;
1797
- }
1798
- this.manifest.playlistType = e.playlistType;
1649
+ /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType : this.trigger("warn", { message: "ignoring unknown playlist type: " + e.playlist });
1799
1650
  },
1800
1651
  map() {
1801
1652
  i = {}, e.uri && (i.uri = e.uri), e.byterange && (i.byterange = e.byterange), a && (i.key = a);
1802
1653
  },
1803
1654
  "stream-inf"() {
1804
- if (this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest.mediaGroups || c, !e.attributes) {
1805
- this.trigger("warn", { message: "ignoring empty stream-inf attributes" });
1806
- return;
1807
- }
1808
- r.attributes || (r.attributes = {}), k(r.attributes, e.attributes);
1655
+ this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest.mediaGroups || c, e.attributes ? (r.attributes || (r.attributes = {}), k(r.attributes, e.attributes)) : this.trigger("warn", { message: "ignoring empty stream-inf attributes" });
1809
1656
  },
1810
1657
  media() {
1811
1658
  if (this.manifest.mediaGroups = this.manifest.mediaGroups || c, !(e.attributes && e.attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME)) {
@@ -1824,18 +1671,10 @@ var M = class extends te {
1824
1671
  this.lastProgramDateTime = new Date(e.dateTimeString).getTime(), t === null && this.manifest.segments.reduceRight((e, t) => (t.programDateTime = e - t.duration * 1e3, t.programDateTime), this.lastProgramDateTime);
1825
1672
  },
1826
1673
  targetduration() {
1827
- if (!isFinite(e.duration) || e.duration < 0) {
1828
- this.trigger("warn", { message: "ignoring invalid target duration: " + e.duration });
1829
- return;
1830
- }
1831
- this.manifest.targetDuration = e.duration, de.call(this, this.manifest);
1674
+ !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid target duration: " + e.duration }) : (this.manifest.targetDuration = e.duration, de.call(this, this.manifest));
1832
1675
  },
1833
1676
  start() {
1834
- if (!e.attributes || isNaN(e.attributes["TIME-OFFSET"])) {
1835
- this.trigger("warn", { message: "ignoring start declaration without appropriate attribute list" });
1836
- return;
1837
- }
1838
- this.manifest.start = {
1677
+ !e.attributes || isNaN(e.attributes["TIME-OFFSET"]) ? this.trigger("warn", { message: "ignoring start declaration without appropriate attribute list" }) : this.manifest.start = {
1839
1678
  timeOffset: e.attributes["TIME-OFFSET"],
1840
1679
  precise: e.attributes.PRECISE
1841
1680
  };
@@ -1916,11 +1755,7 @@ var M = class extends te {
1916
1755
  define() {
1917
1756
  this.manifest.definitions = this.manifest.definitions || {};
1918
1757
  let t = (e, t) => {
1919
- if (e in this.manifest.definitions) {
1920
- this.trigger("error", { message: `EXT-X-DEFINE: Duplicate name ${e}` });
1921
- return;
1922
- }
1923
- this.manifest.definitions[e] = t;
1758
+ e in this.manifest.definitions ? this.trigger("error", { message: `EXT-X-DEFINE: Duplicate name ${e}` }) : this.manifest.definitions[e] = t;
1924
1759
  };
1925
1760
  if ("QUERYPARAM" in e.attributes) {
1926
1761
  if ("NAME" in e.attributes || "IMPORT" in e.attributes) {
@@ -1933,9 +1768,7 @@ var M = class extends te {
1933
1768
  return;
1934
1769
  }
1935
1770
  t(e.attributes.QUERYPARAM, decodeURIComponent(n));
1936
- return;
1937
- }
1938
- if ("NAME" in e.attributes) {
1771
+ } else if ("NAME" in e.attributes) {
1939
1772
  if ("IMPORT" in e.attributes) {
1940
1773
  this.trigger("error", { message: "EXT-X-DEFINE: Invalid attributes" });
1941
1774
  return;
@@ -1945,17 +1778,13 @@ var M = class extends te {
1945
1778
  return;
1946
1779
  }
1947
1780
  t(e.attributes.NAME, e.attributes.VALUE);
1948
- return;
1949
- }
1950
- if ("IMPORT" in e.attributes) {
1781
+ } else if ("IMPORT" in e.attributes) {
1951
1782
  if (!this.mainDefinitions[e.attributes.IMPORT]) {
1952
1783
  this.trigger("error", { message: `EXT-X-DEFINE: No value ${e.attributes.IMPORT} to import, or IMPORT used on main playlist` });
1953
1784
  return;
1954
1785
  }
1955
1786
  t(e.attributes.IMPORT, this.mainDefinitions[e.attributes.IMPORT]);
1956
- return;
1957
- }
1958
- this.trigger("error", { message: "EXT-X-DEFINE: No attribute" });
1787
+ } else this.trigger("error", { message: "EXT-X-DEFINE: No attribute" });
1959
1788
  },
1960
1789
  "i-frame-playlist"() {
1961
1790
  this.manifest.iFramePlaylists.push({
@@ -2057,7 +1886,7 @@ var M = class extends te {
2057
1886
  }, ye = function(e) {
2058
1887
  return e === void 0 && (e = ""), pe.text.test(e.trim().toLowerCase());
2059
1888
  }, be = function(e) {
2060
- if (!(!e || typeof e != "string")) {
1889
+ if (e && typeof e == "string") {
2061
1890
  var t = e.toLowerCase().split(",").map(function(e) {
2062
1891
  return ge(e.trim());
2063
1892
  }), n = "video";
@@ -5685,17 +5514,13 @@ var je = function(e, t) {
5685
5514
  let i = t.segments[0], a = r.segments.findIndex(function(e) {
5686
5515
  return Math.abs(e.presentationTime - i.presentationTime) < at;
5687
5516
  });
5688
- if (a === -1) {
5689
- lt({
5690
- playlist: t,
5691
- mediaSequence: r.mediaSequence + r.segments.length
5692
- }), t.segments[0].discontinuity = !0, t.discontinuityStarts.unshift(0), (!r.segments.length && t.timeline > r.timeline || r.segments.length && t.timeline > r.segments[r.segments.length - 1].timeline) && t.discontinuitySequence--;
5693
- return;
5694
- }
5695
- r.segments[a].discontinuity && !i.discontinuity && (i.discontinuity = !0, t.discontinuityStarts.unshift(0), t.discontinuitySequence--), lt({
5517
+ a === -1 ? (lt({
5518
+ playlist: t,
5519
+ mediaSequence: r.mediaSequence + r.segments.length
5520
+ }), t.segments[0].discontinuity = !0, t.discontinuityStarts.unshift(0), (!r.segments.length && t.timeline > r.timeline || r.segments.length && t.timeline > r.segments[r.segments.length - 1].timeline) && t.discontinuitySequence--) : (r.segments[a].discontinuity && !i.discontinuity && (i.discontinuity = !0, t.discontinuityStarts.unshift(0), t.discontinuitySequence--), lt({
5696
5521
  playlist: t,
5697
5522
  mediaSequence: r.segments[a].number
5698
- });
5523
+ }));
5699
5524
  });
5700
5525
  }, dt = ({ oldManifest: e, newManifest: t }) => {
5701
5526
  let n = e.playlists.concat(ct(e)), r = t.playlists.concat(ct(t));
@@ -6481,13 +6306,12 @@ var vn = function e(t, n, r) {
6481
6306
  r === void 0 && (r = Infinity), e = I(e), n = [].concat(n);
6482
6307
  for (var i = 0, a, o = 0; i < e.length && (o < r || a);) {
6483
6308
  var s = void 0;
6484
- if (L(e.subarray(i), Dn) ? s = 4 : L(e.subarray(i), On) && (s = 3), !s) {
6485
- i++;
6486
- continue;
6309
+ if (L(e.subarray(i), Dn) ? s = 4 : L(e.subarray(i), On) && (s = 3), !s) i++;
6310
+ else {
6311
+ if (o++, a) return An(e.subarray(a, i));
6312
+ var c = void 0;
6313
+ t === "h264" ? c = e[i + s] & 31 : t === "h265" && (c = e[i + s] >> 1 & 63), n.indexOf(c) !== -1 && (a = i + s), i += s + (t === "h264" ? 1 : 2);
6487
6314
  }
6488
- if (o++, a) return An(e.subarray(a, i));
6489
- var c = void 0;
6490
- t === "h264" ? c = e[i + s] & 31 : t === "h265" && (c = e[i + s] >> 1 & 63), n.indexOf(c) !== -1 && (a = i + s), i += s + (t === "h264" ? 1 : 2);
6491
6315
  }
6492
6316
  return e.subarray(0, 0);
6493
6317
  }, Mn = function(e, t, n) {
@@ -6748,7 +6572,7 @@ var Zn = [], Qn = (e, t, n) => (r, i, a) => {
6748
6572
  }
6749
6573
  if (!E.default.console) return;
6750
6574
  let l = E.default.console[r];
6751
- !l && r === "debug" && (l = E.default.console.info || E.default.console.log), !(!l || !o || !s.test(r)) && l[Array.isArray(a) ? "apply" : "call"](E.default.console, a);
6575
+ !l && r === "debug" && (l = E.default.console.info || E.default.console.log), l && o && s.test(r) && l[Array.isArray(a) ? "apply" : "call"](E.default.console, a);
6752
6576
  };
6753
6577
  function V(e, t = ":", n = "") {
6754
6578
  let r = "info", i;
@@ -6799,11 +6623,7 @@ function U(...e) {
6799
6623
  let t = {};
6800
6624
  return e.forEach((e) => {
6801
6625
  e && nr(e, (e, n) => {
6802
- if (!ar(e)) {
6803
- t[n] = e;
6804
- return;
6805
- }
6806
- ar(t[n]) || (t[n] = {}), t[n] = U(t[n], e);
6626
+ ar(e) ? (ar(t[n]) || (t[n] = {}), t[n] = U(t[n], e)) : t[n] = e;
6807
6627
  });
6808
6628
  }), t;
6809
6629
  }
@@ -7277,12 +7097,11 @@ function Di(e, t, n) {
7277
7097
  }
7278
7098
  let a = r.handlers[t];
7279
7099
  if (a) {
7280
- if (!n) {
7281
- i(e, t);
7282
- return;
7100
+ if (!n) i(e, t);
7101
+ else {
7102
+ if (n.guid) for (let e = 0; e < a.length; e++) a[e].guid === n.guid && a.splice(e--, 1);
7103
+ bi(e, t);
7283
7104
  }
7284
- if (n.guid) for (let e = 0; e < a.length; e++) a[e].guid === n.guid && a.splice(e--, 1);
7285
- bi(e, t);
7286
7105
  }
7287
7106
  }
7288
7107
  function Oi(e, t, n) {
@@ -7631,13 +7450,7 @@ var Zi = function(e) {
7631
7450
  return "";
7632
7451
  }
7633
7452
  ready(e, t = !1) {
7634
- if (e) {
7635
- if (!this.isReady_) {
7636
- this.readyQueue_ = this.readyQueue_ || [], this.readyQueue_.push(e);
7637
- return;
7638
- }
7639
- t ? e.call(this) : this.setTimeout(e, 1);
7640
- }
7453
+ e && (this.isReady_ ? t ? e.call(this) : this.setTimeout(e, 1) : (this.readyQueue_ = this.readyQueue_ || [], this.readyQueue_.push(e)));
7641
7454
  }
7642
7455
  triggerReady() {
7643
7456
  this.isReady_ = !0, this.setTimeout(function() {
@@ -7894,7 +7707,7 @@ var Zi = function(e) {
7894
7707
  return e.components_[t] = n, e.components_[Zi(t)] = n, n;
7895
7708
  }
7896
7709
  static getComponent(t) {
7897
- if (!(!t || !e.components_)) return e.components_[t];
7710
+ if (t && e.components_) return e.components_[t];
7898
7711
  }
7899
7712
  };
7900
7713
  J.registerComponent("Component", J);
@@ -8177,7 +7990,7 @@ ya.prototype.allowedEvents_ = {
8177
7990
  };
8178
7991
  for (let e in ya.prototype.allowedEvents_) ya.prototype["on" + e] = null;
8179
7992
  var ba = function(e, t) {
8180
- for (let n = 0; n < e.length; n++) !Object.keys(e[n]).length || t.id === e[n].id || (e[n].enabled = !1);
7993
+ for (let n = 0; n < e.length; n++) Object.keys(e[n]).length && t.id !== e[n].id && (e[n].enabled = !1);
8181
7994
  }, xa = class extends ya {
8182
7995
  constructor(e = []) {
8183
7996
  for (let t = e.length - 1; t >= 0; t--) if (e[t].enabled) {
@@ -8195,7 +8008,7 @@ var ba = function(e, t) {
8195
8008
  super.removeTrack(e), e.removeEventListener && e.enabledChange_ && (e.removeEventListener("enabledchange", e.enabledChange_), e.enabledChange_ = null);
8196
8009
  }
8197
8010
  }, Sa = function(e, t) {
8198
- for (let n = 0; n < e.length; n++) !Object.keys(e[n]).length || t.id === e[n].id || (e[n].selected = !1);
8011
+ for (let n = 0; n < e.length; n++) Object.keys(e[n]).length && t.id !== e[n].id && (e[n].selected = !1);
8199
8012
  }, Ca = class extends ya {
8200
8013
  constructor(e = []) {
8201
8014
  for (let t = e.length - 1; t >= 0; t--) if (e[t].selected) {
@@ -8366,11 +8179,8 @@ var ba = function(e, t) {
8366
8179
  i && (n.withCredentials = i), (0, O.default)(n, q(this, function(e, n, r) {
8367
8180
  if (e) return H.error(e, n);
8368
8181
  t.loaded_ = !0, typeof E.default.WebVTT == "function" ? La(r, t) : t.tech_ && t.tech_.any(["vttjsloaded", "vttjserror"], (e) => {
8369
- if (e.type === "vttjserror") {
8370
- H.error(`vttjs failed to load, stopping trying to process ${t.src}`);
8371
- return;
8372
- }
8373
- return La(r, t);
8182
+ if (e.type === "vttjserror") H.error(`vttjs failed to load, stopping trying to process ${t.src}`);
8183
+ else return La(r, t);
8374
8184
  });
8375
8185
  }));
8376
8186
  }, za = class extends ja {
@@ -8383,13 +8193,7 @@ var ba = function(e, t) {
8383
8193
  (t.kind === "metadata" || t.kind === "chapters") && (n = "hidden"), super(t), this.tech_ = t.tech, this.cues_ = [], this.activeCues_ = [], this.preload_ = this.tech_.preloadTextTracks !== !1;
8384
8194
  let i = new Ea(this.cues_), a = new Ea(this.activeCues_), o = !1;
8385
8195
  this.timeupdateHandler = q(this, function(e = {}) {
8386
- if (!this.tech_.isDisposed()) {
8387
- if (!this.tech_.isReady_) {
8388
- e.type !== "timeupdate" && (this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler));
8389
- return;
8390
- }
8391
- this.activeCues = this.activeCues, o &&= (this.trigger("cuechange"), !1), e.type !== "timeupdate" && (this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler));
8392
- }
8196
+ this.tech_.isDisposed() || (this.tech_.isReady_ && (this.activeCues = this.activeCues, o &&= (this.trigger("cuechange"), !1)), e.type !== "timeupdate" && (this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler)));
8393
8197
  }), this.tech_.one("dispose", () => {
8394
8198
  this.stopTracking();
8395
8199
  }), n !== "disabled" && this.startTracking(), Object.defineProperties(this, {
@@ -9242,29 +9046,21 @@ var Co = class extends So {
9242
9046
  }
9243
9047
  crossOrigin(e) {
9244
9048
  if (e === void 0) return this.$("img") ? this.$("img").crossOrigin : this.player_.tech_ && this.player_.tech_.isReady_ ? this.player_.crossOrigin() : this.player_.options_.crossOrigin || this.player_.options_.crossorigin || null;
9245
- if (e !== null && e !== "anonymous" && e !== "use-credentials") {
9246
- this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);
9247
- return;
9248
- }
9249
- this.$("img") && (this.$("img").crossOrigin = e);
9049
+ e !== null && e !== "anonymous" && e !== "use-credentials" ? this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`) : this.$("img") && (this.$("img").crossOrigin = e);
9250
9050
  }
9251
9051
  update(e) {
9252
9052
  let t = this.player().poster();
9253
9053
  this.setSrc(t), t ? this.show() : this.hide();
9254
9054
  }
9255
9055
  setSrc(e) {
9256
- if (!e) {
9257
- this.el_.textContent = "";
9258
- return;
9259
- }
9260
- this.$("img") || this.el_.appendChild(G("picture", {
9056
+ e ? (this.$("img") || this.el_.appendChild(G("picture", {
9261
9057
  className: "vjs-poster",
9262
9058
  tabIndex: -1
9263
9059
  }, {}, G("img", {
9264
9060
  loading: this.isMainContent ? "eager" : "lazy",
9265
9061
  fetchPriority: this.isMainContent ? "high" : "auto",
9266
9062
  crossOrigin: this.crossOrigin()
9267
- }, { alt: "" }))), this.$("img").src = e;
9063
+ }, { alt: "" }))), this.$("img").src = e) : this.el_.textContent = "";
9268
9064
  }
9269
9065
  handleClick(e) {
9270
9066
  if (!this.player_.controls()) return;
@@ -9448,11 +9244,7 @@ var Mo = class extends So {
9448
9244
  super.disable(), this.el_.setAttribute("disabled", "disabled");
9449
9245
  }
9450
9246
  handleKeyDown(e) {
9451
- if (e.key === " " || e.key === "Enter") {
9452
- e.stopPropagation();
9453
- return;
9454
- }
9455
- super.handleKeyDown(e);
9247
+ e.key === " " || e.key === "Enter" ? e.stopPropagation() : super.handleKeyDown(e);
9456
9248
  }
9457
9249
  };
9458
9250
  J.registerComponent("Button", Mo);
@@ -9545,7 +9337,7 @@ var Io = class extends J {
9545
9337
  this.contentEl_ = null, this.textNode_ = null, super.dispose();
9546
9338
  }
9547
9339
  update(e) {
9548
- !this.player_.options_.enableSmoothSeeking && e.type === "seeking" || this.updateContent(e);
9340
+ (this.player_.options_.enableSmoothSeeking || e.type !== "seeking") && this.updateContent(e);
9549
9341
  }
9550
9342
  updateTextNode_(e = 0) {
9551
9343
  e = la(e), this.formattedTime_ !== e && (this.formattedTime_ = e, this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", () => {
@@ -9689,10 +9481,10 @@ var Wo = /*#__PURE__*/ Object.freeze({
9689
9481
  update() {
9690
9482
  if (!this.el_ || !this.bar) return;
9691
9483
  let e = this.getProgress();
9692
- return e === this.progress_ ? e : (this.progress_ = e, this.requestNamedAnimationFrame("Slider#update", () => {
9484
+ return e === this.progress_ || (this.progress_ = e, this.requestNamedAnimationFrame("Slider#update", () => {
9693
9485
  let t = this.vertical() ? "height" : "width";
9694
9486
  this.bar.el().style[t] = (e * 100).toFixed(2) + "%";
9695
- }), e);
9487
+ })), e;
9696
9488
  }
9697
9489
  getProgress() {
9698
9490
  return Number(Uo(this.getPercent(), 0, 1).toFixed(4));
@@ -9990,11 +9782,7 @@ var $o = class extends Mo {
9990
9782
  return `vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`;
9991
9783
  }
9992
9784
  handlePictureInPictureAudioModeChange() {
9993
- if (!(this.player_.currentType().substring(0, 5) === "audio" || this.player_.audioPosterMode() || this.player_.audioOnlyMode())) {
9994
- this.show();
9995
- return;
9996
- }
9997
- this.player_.isInPictureInPicture() && this.player_.exitPictureInPicture(), this.hide();
9785
+ this.player_.currentType().substring(0, 5) === "audio" || this.player_.audioPosterMode() || this.player_.audioOnlyMode() ? (this.player_.isInPictureInPicture() && this.player_.exitPictureInPicture(), this.hide()) : this.show();
9998
9786
  }
9999
9787
  handlePictureInPictureEnabledChange() {
10000
9788
  D.default.pictureInPictureEnabled && this.player_.disablePictureInPicture() === !1 || this.player_.options_.enableDocumentPictureInPicture && "documentPictureInPicture" in E.default ? this.enable() : this.disable();
@@ -11358,7 +11146,7 @@ var rc = class extends J {
11358
11146
  }, { "aria-hidden": "true" });
11359
11147
  }
11360
11148
  resizeHandler() {
11361
- !this.player_ || !this.player_.trigger || this.player_.trigger("playerresize");
11149
+ this.player_ && this.player_.trigger && this.player_.trigger("playerresize");
11362
11150
  }
11363
11151
  dispose() {
11364
11152
  this.debouncedHandler_ && this.debouncedHandler_.cancel(), this.resizeObserver_ && (this.player_.el() && this.resizeObserver_.unobserve(this.player_.el()), this.resizeObserver_.disconnect()), this.loadListener_ && this.off("load", this.loadListener_), this.el_ && this.el_.contentWindow && this.unloadListener_ && this.unloadListener_.call(this.el_.contentWindow), this.ResizeObserver = null, this.resizeObserver = null, this.debouncedHandler_ = null, this.loadListener_ = null, super.dispose();
@@ -11806,11 +11594,7 @@ var lc = (e) => {
11806
11594
  }
11807
11595
  }
11808
11596
  exitFullScreen() {
11809
- if (!this.el_.webkitDisplayingFullscreen) {
11810
- this.trigger("fullscreenerror", /* @__PURE__ */ Error("The video is not fullscreen"));
11811
- return;
11812
- }
11813
- this.el_.webkitExitFullScreen();
11597
+ this.el_.webkitDisplayingFullscreen ? this.el_.webkitExitFullScreen() : this.trigger("fullscreenerror", /* @__PURE__ */ Error("The video is not fullscreen"));
11814
11598
  }
11815
11599
  requestPictureInPicture() {
11816
11600
  return this.el_.requestPictureInPicture();
@@ -12190,11 +11974,7 @@ var xc = {
12190
11974
  }
12191
11975
  crossOrigin(e) {
12192
11976
  if (e === void 0) return this.techGet_("crossOrigin");
12193
- if (e !== null && e !== "anonymous" && e !== "use-credentials") {
12194
- H.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);
12195
- return;
12196
- }
12197
- this.techCall_("setCrossOrigin", e), this.posterImage && this.posterImage.crossOrigin(e);
11977
+ e !== null && e !== "anonymous" && e !== "use-credentials" ? H.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`) : (this.techCall_("setCrossOrigin", e), this.posterImage && this.posterImage.crossOrigin(e));
12198
11978
  }
12199
11979
  width(e) {
12200
11980
  return this.dimension("width", e);
@@ -12210,11 +11990,7 @@ var xc = {
12210
11990
  return;
12211
11991
  }
12212
11992
  let r = parseFloat(t);
12213
- if (isNaN(r)) {
12214
- H.error(`Improper value "${t}" supplied for for ${e}`);
12215
- return;
12216
- }
12217
- this[n] = r, this.updateStyleEl_();
11993
+ isNaN(r) ? H.error(`Improper value "${t}" supplied for for ${e}`) : (this[n] = r, this.updateStyleEl_());
12218
11994
  }
12219
11995
  fluid(e) {
12220
11996
  if (e === void 0) return !!this.fluid_;
@@ -12285,14 +12061,10 @@ var xc = {
12285
12061
  this.on(this.tech_, e, (t) => this[`handleTech${Qi(e)}_`](t));
12286
12062
  }), Object.keys(vc).forEach((e) => {
12287
12063
  this.on(this.tech_, e, (t) => {
12288
- if (this.tech_.playbackRate() === 0 && this.tech_.seeking()) {
12289
- this.queuedCallbacks_.push({
12290
- callback: this[`handleTech${vc[e]}_`].bind(this),
12291
- event: t
12292
- });
12293
- return;
12294
- }
12295
- this[`handleTech${vc[e]}_`](t);
12064
+ this.tech_.playbackRate() === 0 && this.tech_.seeking() ? this.queuedCallbacks_.push({
12065
+ callback: this[`handleTech${vc[e]}_`].bind(this),
12066
+ event: t
12067
+ }) : this[`handleTech${vc[e]}_`](t);
12296
12068
  });
12297
12069
  }), this.on(this.tech_, "loadstart", (e) => this.handleTechLoadStart_(e)), this.on(this.tech_, "sourceset", (e) => this.handleTechSourceset_(e)), this.on(this.tech_, "waiting", (e) => this.handleTechWaiting_(e)), this.on(this.tech_, "ended", (e) => this.handleTechEnded_(e)), this.on(this.tech_, "seeking", (e) => this.handleTechSeeking_(e)), this.on(this.tech_, "play", (e) => this.handleTechPlay_(e)), this.on(this.tech_, "pause", (e) => this.handleTechPause_(e)), this.on(this.tech_, "durationchange", (e) => this.handleTechDurationChange_(e)), this.on(this.tech_, "fullscreenchange", (e, t) => this.handleTechFullscreenChange_(e, t)), this.on(this.tech_, "fullscreenerror", (e, t) => this.handleTechFullscreenError_(e, t)), this.on(this.tech_, "enterpictureinpicture", (e) => this.handleTechEnterPictureInPicture_(e)), this.on(this.tech_, "leavepictureinpicture", (e) => this.handleTechLeavePictureInPicture_(e)), this.on(this.tech_, "error", (e) => this.handleTechError_(e)), this.on(this.tech_, "posterchange", (e) => this.handleTechPosterChange_(e)), this.on(this.tech_, "textdata", (e) => this.handleTechTextData_(e)), this.on(this.tech_, "ratechange", (e) => this.handleTechRateChange_(e)), this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_), this.usingNativeControls(this.techGet_("controls")), this.controls() && !this.usingNativeControls() && this.addTechControlsListeners_(), this.tech_.el().parentNode !== this.el() && (n !== "Html5" || !this.tag) && zr(this.tech_.el(), this.el()), this.tag &&= (this.tag.player = null, null);
12298
12070
  }
@@ -12500,7 +12272,7 @@ var xc = {
12500
12272
  }, !0);
12501
12273
  }
12502
12274
  techGet_(e) {
12503
- if (!(!this.tech_ || !this.tech_.isReady_)) {
12275
+ if (this.tech_ && this.tech_.isReady_) {
12504
12276
  if (e in no) return $a(this.middleware_, this.tech_, e);
12505
12277
  if (e in io) return to(this.middleware_, this.tech_, e);
12506
12278
  try {
@@ -12517,7 +12289,7 @@ var xc = {
12517
12289
  }
12518
12290
  play_(e = ma) {
12519
12291
  this.playCallbacks_.push(e);
12520
- let t = !!(!this.changingSrc_ && (this.src() || this.currentSrc())), n = !!(Ar || W);
12292
+ let t = !(this.changingSrc_ || !this.src() && !this.currentSrc()), n = !!(Ar || W);
12521
12293
  if (this.waitToPlay_ &&= (this.off(["ready", "loadstart"], this.waitToPlay_), null), !this.isReady_ || !t) {
12522
12294
  this.waitToPlay_ = (e) => {
12523
12295
  this.play_();
@@ -12554,11 +12326,7 @@ var xc = {
12554
12326
  }
12555
12327
  currentTime(e) {
12556
12328
  if (e === void 0) return this.cache_.currentTime = this.techGet_("currentTime") || 0, this.cache_.currentTime;
12557
- if (e < 0 && (e = 0), !this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
12558
- this.cache_.initTime = e, this.off("canplay", this.boundApplyInitTime_), this.one("canplay", this.boundApplyInitTime_);
12559
- return;
12560
- }
12561
- this.techCall_("setCurrentTime", e), this.cache_.initTime = 0, isFinite(e) && (this.cache_.currentTime = Number(e));
12329
+ e < 0 && (e = 0), !this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_ ? (this.cache_.initTime = e, this.off("canplay", this.boundApplyInitTime_), this.one("canplay", this.boundApplyInitTime_)) : (this.techCall_("setCurrentTime", e), this.cache_.initTime = 0, isFinite(e) && (this.cache_.currentTime = Number(e)));
12562
12330
  }
12563
12331
  applyInitTime_() {
12564
12332
  this.currentTime(this.cache_.initTime);
@@ -12602,28 +12370,19 @@ var xc = {
12602
12370
  }
12603
12371
  volume(e) {
12604
12372
  let t;
12605
- if (e !== void 0) {
12606
- t = Math.max(0, Math.min(1, e)), this.cache_.volume = t, this.techCall_("setVolume", t), t > 0 && this.lastVolume_(t);
12607
- return;
12608
- }
12609
- return t = parseFloat(this.techGet_("volume")), isNaN(t) ? 1 : t;
12373
+ if (e !== void 0) t = Math.max(0, Math.min(1, e)), this.cache_.volume = t, this.techCall_("setVolume", t), t > 0 && this.lastVolume_(t);
12374
+ else return t = parseFloat(this.techGet_("volume")), isNaN(t) ? 1 : t;
12610
12375
  }
12611
12376
  muted(e) {
12612
- if (e !== void 0) {
12613
- this.techCall_("setMuted", e);
12614
- return;
12615
- }
12616
- return this.techGet_("muted") || !1;
12377
+ if (e !== void 0) this.techCall_("setMuted", e);
12378
+ else return this.techGet_("muted") || !1;
12617
12379
  }
12618
12380
  defaultMuted(e) {
12619
12381
  return e !== void 0 && this.techCall_("setDefaultMuted", e), this.techGet_("defaultMuted") || !1;
12620
12382
  }
12621
12383
  lastVolume_(e) {
12622
- if (e !== void 0 && e !== 0) {
12623
- this.cache_.lastVolume = e;
12624
- return;
12625
- }
12626
- return this.cache_.lastVolume;
12384
+ if (e !== void 0 && e !== 0) this.cache_.lastVolume = e;
12385
+ else return this.cache_.lastVolume;
12627
12386
  }
12628
12387
  supportsFullScreen() {
12629
12388
  return this.techGet_("supportsFullScreen") || !1;
@@ -12632,9 +12391,7 @@ var xc = {
12632
12391
  if (e !== void 0) {
12633
12392
  let t = this.isFullscreen_;
12634
12393
  this.isFullscreen_ = !!e, this.isFullscreen_ !== t && this.fsApi_.prefixed && this.trigger("fullscreenchange"), this.toggleFullscreenClass_();
12635
- return;
12636
- }
12637
- return this.isFullscreen_;
12394
+ } else return this.isFullscreen_;
12638
12395
  }
12639
12396
  requestFullscreen(e) {
12640
12397
  this.isInPictureInPicture() && this.exitPictureInPicture();
@@ -12700,11 +12457,8 @@ var xc = {
12700
12457
  this.techCall_("setDisablePictureInPicture", e), this.options_.disablePictureInPicture = e, this.trigger("disablepictureinpicturechanged");
12701
12458
  }
12702
12459
  isInPictureInPicture(e) {
12703
- if (e !== void 0) {
12704
- this.isInPictureInPicture_ = !!e, this.togglePictureInPictureClass_();
12705
- return;
12706
- }
12707
- return !!this.isInPictureInPicture_;
12460
+ if (e !== void 0) this.isInPictureInPicture_ = !!e, this.togglePictureInPictureClass_();
12461
+ else return !!this.isInPictureInPicture_;
12708
12462
  }
12709
12463
  requestPictureInPicture() {
12710
12464
  if (this.options_.enableDocumentPictureInPicture && E.default.documentPictureInPicture) {
@@ -12728,7 +12482,7 @@ var xc = {
12728
12482
  }
12729
12483
  handleKeyDown(e) {
12730
12484
  let { userActions: t } = this.options_;
12731
- !t || !t.hotkeys || ((e) => {
12485
+ t && t.hotkeys && !((e) => {
12732
12486
  let t = e.tagName.toLowerCase();
12733
12487
  return e.isContentEditable ? !0 : t === "input" ? [
12734
12488
  "button",
@@ -12738,7 +12492,7 @@ var xc = {
12738
12492
  "reset",
12739
12493
  "submit"
12740
12494
  ].indexOf(e.type) === -1 : ["textarea"].indexOf(t) !== -1;
12741
- })(this.el_.ownerDocument.activeElement) || (typeof t.hotkeys == "function" ? t.hotkeys.call(this, e) : this.handleHotkeys(e));
12495
+ })(this.el_.ownerDocument.activeElement) && (typeof t.hotkeys == "function" ? t.hotkeys.call(this, e) : this.handleHotkeys(e));
12742
12496
  }
12743
12497
  handleHotkeys(e) {
12744
12498
  let { fullscreenKey: t = (t) => e.key.toLowerCase() === "f", muteKey: n = (t) => e.key.toLowerCase() === "m", playPauseKey: r = (t) => e.key.toLowerCase() === "k" || e.key.toLowerCase() === " " } = this.options_.userActions ? this.options_.userActions.hotkeys : {};
@@ -12752,11 +12506,8 @@ var xc = {
12752
12506
  let t;
12753
12507
  for (let n = 0, r = this.options_.techOrder; n < r.length; n++) {
12754
12508
  let i = r[n], a = Y.getTech(i);
12755
- if (a ||= J.getComponent(i), !a) {
12756
- H.error(`The "${i}" tech is undefined. Skipped browser support check for that tech.`);
12757
- continue;
12758
- }
12759
- if (a.isSupported() && (t = a.canPlayType(e), t)) return t;
12509
+ if (a ||= J.getComponent(i), !a) H.error(`The "${i}" tech is undefined. Skipped browser support check for that tech.`);
12510
+ else if (a.isSupported() && (t = a.canPlayType(e), t)) return t;
12760
12511
  }
12761
12512
  return "";
12762
12513
  }
@@ -12778,16 +12529,13 @@ var xc = {
12778
12529
  if (e === void 0) return this.cache_.src || "";
12779
12530
  this.resetRetryOnError_ && this.resetRetryOnError_();
12780
12531
  let n = mo(e);
12781
- if (!n.length) {
12782
- this.setTimeout(function() {
12783
- this.error({
12784
- code: 4,
12785
- message: this.options_.notSupportedMessage
12786
- });
12787
- }, 0);
12788
- return;
12789
- }
12790
- if (this.changingSrc_ = !0, t || (this.cache_.sources = n), this.updateSourceCaches_(n[0]), Za(this, n[0], (e, r) => {
12532
+ if (!n.length) this.setTimeout(function() {
12533
+ this.error({
12534
+ code: 4,
12535
+ message: this.options_.notSupportedMessage
12536
+ });
12537
+ }, 0);
12538
+ else if (this.changingSrc_ = !0, t || (this.cache_.sources = n), this.updateSourceCaches_(n[0]), Za(this, n[0], (e, r) => {
12791
12539
  if (this.middleware_ = r, t || (this.cache_.sources = n), this.updateSourceCaches_(e), this.src_(e)) {
12792
12540
  if (n.length > 1) return this.handleSrc_(n.slice(1));
12793
12541
  this.changingSrc_ = !1, this.setTimeout(function() {
@@ -12796,9 +12544,7 @@ var xc = {
12796
12544
  message: this.options_.notSupportedMessage
12797
12545
  });
12798
12546
  }, 0), this.triggerReady();
12799
- return;
12800
- }
12801
- Qa(r, this.tech_);
12547
+ } else Qa(r, this.tech_);
12802
12548
  }), n.length > 1) {
12803
12549
  let e = () => {
12804
12550
  this.error(null), this.handleSrc_(n.slice(1), !0);
@@ -12828,11 +12574,7 @@ var xc = {
12828
12574
  return this.tech_ ? this.tech_.removeSourceElement(e) : !1;
12829
12575
  }
12830
12576
  load() {
12831
- if (this.tech_ && this.tech_.vhs) {
12832
- this.src(this.currentSource());
12833
- return;
12834
- }
12835
- this.techCall_("load");
12577
+ this.tech_ && this.tech_.vhs ? this.src(this.currentSource()) : this.techCall_("load");
12836
12578
  }
12837
12579
  reset() {
12838
12580
  this.paused() ? this.doReset_() : ma(this.play().then(() => this.doReset_()));
@@ -12871,11 +12613,8 @@ var xc = {
12871
12613
  return this.currentSource() && this.currentSource().type || "";
12872
12614
  }
12873
12615
  preload(e) {
12874
- if (e !== void 0) {
12875
- this.techCall_("setPreload", e), this.options_.preload = e;
12876
- return;
12877
- }
12878
- return this.techGet_("preload");
12616
+ if (e !== void 0) this.techCall_("setPreload", e), this.options_.preload = e;
12617
+ else return this.techGet_("preload");
12879
12618
  }
12880
12619
  autoplay(e) {
12881
12620
  if (e === void 0) return this.options_.autoplay || !1;
@@ -12886,11 +12625,8 @@ var xc = {
12886
12625
  return e !== void 0 && (this.techCall_("setPlaysinline", e), this.options_.playsinline = e), this.techGet_("playsinline");
12887
12626
  }
12888
12627
  loop(e) {
12889
- if (e !== void 0) {
12890
- this.techCall_("setLoop", e), this.options_.loop = e;
12891
- return;
12892
- }
12893
- return this.techGet_("loop");
12628
+ if (e !== void 0) this.techCall_("setLoop", e), this.options_.loop = e;
12629
+ else return this.techGet_("loop");
12894
12630
  }
12895
12631
  poster(e) {
12896
12632
  if (e === void 0) return this.poster_;
@@ -12914,11 +12650,7 @@ var xc = {
12914
12650
  if (e === void 0) return this.error_ || null;
12915
12651
  if (Un("beforeerror").forEach((t) => {
12916
12652
  let n = t(this, e);
12917
- if (!(ir(n) && !Array.isArray(n) || typeof n == "string" || typeof n == "number" || n === null)) {
12918
- this.log.error("please return a value that MediaError expects in beforeerror hooks");
12919
- return;
12920
- }
12921
- e = n;
12653
+ ir(n) && !Array.isArray(n) || typeof n == "string" || typeof n == "number" || n === null ? e = n : this.log.error("please return a value that MediaError expects in beforeerror hooks");
12922
12654
  }), this.options_.suppressNotSupportedError && e && e.code === 4) {
12923
12655
  let t = function() {
12924
12656
  this.error(e);
@@ -12926,28 +12658,16 @@ var xc = {
12926
12658
  this.options_.suppressNotSupportedError = !1, this.any(["click", "touchstart"], t), this.one("loadstart", function() {
12927
12659
  this.off(["click", "touchstart"], t);
12928
12660
  });
12929
- return;
12930
- }
12931
- if (e === null) {
12932
- this.error_ = null, this.removeClass("vjs-error"), this.errorDisplay && this.errorDisplay.close();
12933
- return;
12934
- }
12935
- this.error_ = new fa(e), this.addClass("vjs-error"), H.error(`(CODE:${this.error_.code} ${fa.errorTypes[this.error_.code]})`, this.error_.message, this.error_), this.trigger("error"), Un("error").forEach((e) => e(this, this.error_));
12661
+ } else e === null ? (this.error_ = null, this.removeClass("vjs-error"), this.errorDisplay && this.errorDisplay.close()) : (this.error_ = new fa(e), this.addClass("vjs-error"), H.error(`(CODE:${this.error_.code} ${fa.errorTypes[this.error_.code]})`, this.error_.message, this.error_), this.trigger("error"), Un("error").forEach((e) => e(this, this.error_)));
12936
12662
  }
12937
12663
  reportUserActivity(e) {
12938
12664
  this.userActivity_ = !0;
12939
12665
  }
12940
12666
  userActive(e) {
12941
12667
  if (e === void 0) return this.userActive_;
12942
- if (e = !!e, e !== this.userActive_) {
12943
- if (this.userActive_ = e, this.userActive_) {
12944
- this.userActivity_ = !0, this.removeClass("vjs-user-inactive"), this.addClass("vjs-user-active"), this.trigger("useractive");
12945
- return;
12946
- }
12947
- this.tech_ && this.tech_.one("mousemove", function(e) {
12948
- e.stopPropagation(), e.preventDefault();
12949
- }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive");
12950
- }
12668
+ e = !!e, e !== this.userActive_ && (this.userActive_ = e, this.userActive_ ? (this.userActivity_ = !0, this.removeClass("vjs-user-inactive"), this.addClass("vjs-user-active"), this.trigger("useractive")) : (this.tech_ && this.tech_.one("mousemove", function(e) {
12669
+ e.stopPropagation(), e.preventDefault();
12670
+ }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive")));
12951
12671
  }
12952
12672
  listenForUserActivity_() {
12953
12673
  let e, t, n, r = q(this, this.reportUserActivity), i = function(e) {
@@ -12975,25 +12695,19 @@ var xc = {
12975
12695
  }, 250);
12976
12696
  }
12977
12697
  playbackRate(e) {
12978
- if (e !== void 0) {
12979
- this.techCall_("setPlaybackRate", e);
12980
- return;
12981
- }
12982
- return this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : 1;
12698
+ if (e !== void 0) this.techCall_("setPlaybackRate", e);
12699
+ else return this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : 1;
12983
12700
  }
12984
12701
  defaultPlaybackRate(e) {
12985
12702
  return e === void 0 ? this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1 : this.techCall_("setDefaultPlaybackRate", e);
12986
12703
  }
12987
12704
  isAudio(e) {
12988
- if (e !== void 0) {
12989
- this.isAudio_ = !!e;
12990
- return;
12991
- }
12992
- return !!this.isAudio_;
12705
+ if (e !== void 0) this.isAudio_ = !!e;
12706
+ else return !!this.isAudio_;
12993
12707
  }
12994
12708
  updatePlayerHeightOnAudioOnlyMode_() {
12995
12709
  let e = this.getChild("ControlBar");
12996
- !e || this.audioOnlyCache_.controlBarHeight === e.currentHeight() || (this.audioOnlyCache_.controlBarHeight = e.currentHeight(), this.height(this.audioOnlyCache_.controlBarHeight));
12710
+ e && this.audioOnlyCache_.controlBarHeight !== e.currentHeight() && (this.audioOnlyCache_.controlBarHeight = e.currentHeight(), this.height(this.audioOnlyCache_.controlBarHeight));
12997
12711
  }
12998
12712
  enableAudioOnlyUI_() {
12999
12713
  this.addClass("vjs-audio-only-mode");
@@ -13087,7 +12801,7 @@ var xc = {
13087
12801
  this.breakpoint_ = "", e && this.removeClass(e);
13088
12802
  }
13089
12803
  breakpoints(e) {
13090
- return e === void 0 ? Object.assign(this.breakpoints_) : (this.removeCurrentBreakpoint_(), this.breakpoints_ = Object.assign({}, xc, e), this.updateCurrentBreakpoint_(), Object.assign(this.breakpoints_));
12804
+ return e === void 0 || (this.removeCurrentBreakpoint_(), this.breakpoints_ = Object.assign({}, xc, e), this.updateCurrentBreakpoint_()), Object.assign(this.breakpoints_);
13091
12805
  }
13092
12806
  responsive(e) {
13093
12807
  if (e === void 0) return this.responsive_;
@@ -13322,11 +13036,7 @@ function Q(e, t, n) {
13322
13036
  let a = "getRootNode" in i && i.getRootNode() instanceof E.default.ShadowRoot ? i.getRootNode() : i.ownerDocument.body;
13323
13037
  return (!i.ownerDocument.defaultView || !a.contains(i)) && H.warn("The element supplied is not included in the DOM"), t ||= {}, t.restoreEl === !0 && (t.restoreEl = (i.parentNode && i.parentNode.hasAttribute && i.parentNode.hasAttribute("data-vjs-player") ? i.parentNode : i).cloneNode(!0)), Un("beforesetup").forEach((e) => {
13324
13038
  let n = e(i, U(t));
13325
- if (!ir(n) || Array.isArray(n)) {
13326
- H.error("please return an object in beforesetup hooks");
13327
- return;
13328
- }
13329
- t = U(t, n);
13039
+ !ir(n) || Array.isArray(n) ? H.error("please return an object in beforesetup hooks") : t = U(t, n);
13330
13040
  }), r = new (J.getComponent("Player"))(i, t, n), Un("setup").forEach((e) => e(r)), r;
13331
13041
  }
13332
13042
  if (Q.hooks_ = Hn, Q.hooks = Un, Q.hook = Wn, Q.hookOnce = Kn, Q.removeHook = Gn, E.default.VIDEOJS_NO_DYNAMIC_STYLE !== !0 && Pr()) {
@@ -13526,19 +13236,13 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
13526
13236
  for (let n = 0; n < e.length; n++) if (e.start(n) !== t.start(n) || e.end(n) !== t.end(n)) return !0;
13527
13237
  return !1;
13528
13238
  }, il = function(e) {
13529
- if (!(!e || !e.length || !e.end)) return e.end(e.length - 1);
13239
+ if (e && e.length && e.end) return e.end(e.length - 1);
13530
13240
  }, al = function(e, t) {
13531
13241
  let n = 0;
13532
13242
  if (!e || !e.length) return n;
13533
13243
  for (let r = 0; r < e.length; r++) {
13534
13244
  let i = e.start(r), a = e.end(r);
13535
- if (!(t > a)) {
13536
- if (t > i && t <= a) {
13537
- n += a - t;
13538
- continue;
13539
- }
13540
- n += a - i;
13541
- }
13245
+ t > a || (n += t > i && t <= a ? a - t : a - i);
13542
13246
  }
13543
13247
  return n;
13544
13248
  }, ol = (e, t) => {
@@ -13692,7 +13396,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
13692
13396
  let n = s[t];
13693
13397
  o -= n.duration;
13694
13398
  let r = n.duration > qc, l = o === 0, u = r && o + qc >= 0;
13695
- if (!((l || u) && t !== s.length - 1)) {
13399
+ if (!l && !u || t === s.length - 1) {
13696
13400
  if (a) {
13697
13401
  if (o > 0) continue;
13698
13402
  } else if (o - qc >= 0) continue;
@@ -13907,11 +13611,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
13907
13611
  return e.forEach(({ mediaType: e, type: n, details: r }) => {
13908
13612
  t[e] = t[e] || [], t[e].push(ge(`${n}${r}`));
13909
13613
  }), Object.keys(t).forEach(function(e) {
13910
- if (t[e].length > 1) {
13911
- Wl(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`), t[e] = null;
13912
- return;
13913
- }
13914
- t[e] = t[e][0];
13614
+ t[e].length > 1 ? (Wl(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`), t[e] = null) : t[e] = t[e][0];
13915
13615
  }), t;
13916
13616
  }, Yl = function(e) {
13917
13617
  let t = 0;
@@ -14028,7 +13728,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14028
13728
  if (!e) return;
14029
13729
  this.dateRangesStorage_.setOffset(e.segments), this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);
14030
13730
  let t = this.dateRangesStorage_.getDateRangesToProcess();
14031
- !t.length || !this.addDateRangesToTextTrack_ || this.addDateRangesToTextTrack_(t);
13731
+ t.length && this.addDateRangesToTextTrack_ && this.addDateRangesToTextTrack_(t);
14032
13732
  }
14033
13733
  handleMediaupdatetimeout_() {
14034
13734
  if (this.state !== "HAVE_METADATA") return;
@@ -14183,16 +13883,10 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14183
13883
  this.mediaUpdateTimeout = E.default.setTimeout(() => {
14184
13884
  this.mediaUpdateTimeout = null, this.load();
14185
13885
  }, e);
14186
- return;
14187
- }
14188
- if (!this.started) {
14189
- this.start();
14190
- return;
14191
- }
14192
- t && !t.endList ? this.trigger("mediaupdatetimeout") : this.trigger("loadedplaylist");
13886
+ } else this.started ? t && !t.endList ? this.trigger("mediaupdatetimeout") : this.trigger("loadedplaylist") : this.start();
14193
13887
  }
14194
13888
  updateMediaUpdateTimeout_(e) {
14195
- this.mediaUpdateTimeout &&= (E.default.clearTimeout(this.mediaUpdateTimeout), null), !(!this.media() || this.media().endList) && (this.mediaUpdateTimeout = E.default.setTimeout(() => {
13889
+ this.mediaUpdateTimeout &&= (E.default.clearTimeout(this.mediaUpdateTimeout), null), this.media() && !this.media().endList && (this.mediaUpdateTimeout = E.default.setTimeout(() => {
14196
13890
  this.mediaUpdateTimeout = null, this.trigger("mediaupdatetimeout"), this.updateMediaUpdateTimeout_(e);
14197
13891
  }, e));
14198
13892
  }
@@ -14285,7 +13979,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14285
13979
  "SUBTITLES",
14286
13980
  "CLOSED-CAPTIONS"
14287
13981
  ].forEach((e) => {
14288
- if (!(!n.mediaGroups[e] || !n.mediaGroups[e][r])) {
13982
+ if (n.mediaGroups[e] && n.mediaGroups[e][r]) {
14289
13983
  for (let t in n.mediaGroups[e]) if (t === r) {
14290
13984
  for (let r in n.mediaGroups[e][t]) n.mediaGroups[e][t][r].playlists.forEach((e, t) => {
14291
13985
  let r = n.playlists[e.id], i = r.id, a = r.resolvedUri;
@@ -14307,7 +14001,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14307
14001
  "SUBTITLES",
14308
14002
  "CLOSED-CAPTIONS"
14309
14003
  ].forEach((i) => {
14310
- if (!(!r.mediaGroups[i] || r.mediaGroups[i][t])) for (let a in r.mediaGroups[i]) {
14004
+ if (r.mediaGroups[i] && !r.mediaGroups[i][t]) for (let a in r.mediaGroups[i]) {
14311
14005
  if (a === n) r.mediaGroups[i][t] = {};
14312
14006
  else continue;
14313
14007
  for (let n in r.mediaGroups[i][a]) {
@@ -14370,7 +14064,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14370
14064
  n = e(n);
14371
14065
  }), n;
14372
14066
  }, uu = (e, t, n, r) => {
14373
- !e || !e.size || e.forEach((e) => {
14067
+ e && e.size && e.forEach((e) => {
14374
14068
  e(t, n, r);
14375
14069
  });
14376
14070
  }, du = function() {
@@ -14435,8 +14129,8 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14435
14129
  hexDump: bu,
14436
14130
  tagDump: ({ bytes: e }) => bu(e),
14437
14131
  textRanges: (e) => {
14438
- let t = "", n;
14439
- for (n = 0; n < e.length; n++) t += mu(e, n) + " ";
14132
+ let t = "", n = 0;
14133
+ for (; n < e.length; n++) t += mu(e, n) + " ";
14440
14134
  return t;
14441
14135
  }
14442
14136
  }), Su = .25, Cu = (e, t) => {
@@ -14714,11 +14408,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14714
14408
  e = this.mainPlaylistLoader_.main.playlists[e];
14715
14409
  }
14716
14410
  let n = !this.media_ || e.id !== this.media_.id;
14717
- if (n && this.loadedPlaylists_[e.id] && this.loadedPlaylists_[e.id].endList) {
14718
- this.state = "HAVE_METADATA", this.media_ = e, n && (this.trigger("mediachanging"), this.trigger("mediachange"));
14719
- return;
14720
- }
14721
- n && (this.media_ && this.trigger("mediachanging"), this.addSidxSegments_(e, t, (n) => {
14411
+ n && this.loadedPlaylists_[e.id] && this.loadedPlaylists_[e.id].endList ? (this.state = "HAVE_METADATA", this.media_ = e, n && (this.trigger("mediachanging"), this.trigger("mediachange"))) : n && (this.media_ && this.trigger("mediachanging"), this.addSidxSegments_(e, t, (n) => {
14722
14412
  this.haveMetadata({
14723
14413
  startingState: t,
14724
14414
  playlist: e
@@ -14737,22 +14427,12 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14737
14427
  if (e) {
14738
14428
  let e = t ? t.targetDuration / 2 * 1e3 : 5e3;
14739
14429
  this.mediaUpdateTimeout = E.default.setTimeout(() => this.load(), e);
14740
- return;
14741
- }
14742
- if (!this.started) {
14743
- this.start();
14744
- return;
14745
- }
14746
- t && !t.endList ? (this.isMain_ && !this.minimumUpdatePeriodTimeout_ && (this.trigger("minimumUpdatePeriod"), this.updateMinimumUpdatePeriodTimeout_()), this.trigger("mediaupdatetimeout")) : this.trigger("loadedplaylist");
14430
+ } else this.started ? t && !t.endList ? (this.isMain_ && !this.minimumUpdatePeriodTimeout_ && (this.trigger("minimumUpdatePeriod"), this.updateMinimumUpdatePeriodTimeout_()), this.trigger("mediaupdatetimeout")) : this.trigger("loadedplaylist") : this.start();
14747
14431
  }
14748
14432
  start() {
14749
- if (this.started = !0, !this.isMain_) {
14750
- E.default.clearTimeout(this.mediaRequest_), this.mediaRequest_ = E.default.setTimeout(() => this.haveMain_(), 0);
14751
- return;
14752
- }
14753
- this.requestMain_((e, t) => {
14433
+ this.started = !0, this.isMain_ ? this.requestMain_((e, t) => {
14754
14434
  this.haveMain_(), !this.hasPendingRequest() && !this.media_ && this.media(this.mainPlaylistLoader_.main.playlists[0]);
14755
- });
14435
+ }) : (E.default.clearTimeout(this.mediaRequest_), this.mediaRequest_ = E.default.setTimeout(() => this.haveMain_(), 0));
14756
14436
  }
14757
14437
  requestMain_(e) {
14758
14438
  let t = { manifestInfo: { uri: this.mainPlaylistLoader_.srcUrl } };
@@ -14781,11 +14461,8 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14781
14461
  metadata: t
14782
14462
  });
14783
14463
  let i = r.responseText !== this.mainPlaylistLoader_.mainXml_;
14784
- if (this.mainPlaylistLoader_.mainXml_ = r.responseText, this.mainLoaded_ = r.responseHeaders && r.responseHeaders.date ? Date.parse(r.responseHeaders.date) : Date.now(), this.mainPlaylistLoader_.srcUrl = Uc(this.mainPlaylistLoader_.srcUrl, r), i) {
14785
- this.handleMain_(), this.syncClientServerClock_(() => e(r, i));
14786
- return;
14787
- }
14788
- return e(r, i);
14464
+ if (this.mainPlaylistLoader_.mainXml_ = r.responseText, this.mainLoaded_ = r.responseHeaders && r.responseHeaders.date ? Date.parse(r.responseHeaders.date) : Date.now(), this.mainPlaylistLoader_.srcUrl = Uc(this.mainPlaylistLoader_.srcUrl, r), i) this.handleMain_(), this.syncClientServerClock_(() => e(r, i));
14465
+ else return e(r, i);
14789
14466
  });
14790
14467
  }
14791
14468
  syncClientServerClock_(e) {
@@ -14862,11 +14539,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
14862
14539
  let e = this.mainPlaylistLoader_;
14863
14540
  e.createMupOnMedia_ &&= (e.off("loadedmetadata", e.createMupOnMedia_), null), e.minimumUpdatePeriodTimeout_ &&= (E.default.clearTimeout(e.minimumUpdatePeriodTimeout_), null);
14864
14541
  let t = e.main && e.main.minimumUpdatePeriod;
14865
- if (t === 0 && (e.media() ? t = e.media().targetDuration * 1e3 : (e.createMupOnMedia_ = e.updateMinimumUpdatePeriodTimeout_, e.one("loadedmetadata", e.createMupOnMedia_))), typeof t != "number" || t <= 0) {
14866
- t < 0 && this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);
14867
- return;
14868
- }
14869
- this.createMUPTimeout_(t);
14542
+ t === 0 && (e.media() ? t = e.media().targetDuration * 1e3 : (e.createMupOnMedia_ = e.updateMinimumUpdatePeriodTimeout_, e.one("loadedmetadata", e.createMupOnMedia_))), typeof t != "number" || t <= 0 ? t < 0 && this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`) : this.createMUPTimeout_(t);
14870
14543
  }
14871
14544
  createMUPTimeout_(e) {
14872
14545
  let t = this.mainPlaylistLoader_;
@@ -15045,7 +14718,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
15045
14718
  trex: [],
15046
14719
  tkhd: [],
15047
14720
  vmhd: []
15048
- }, !(typeof Uint8Array > "u")) {
14721
+ }, typeof Uint8Array < "u") {
15049
14722
  for (e in O) O.hasOwnProperty(e) && (O[e] = [
15050
14723
  e.charCodeAt(0),
15051
14724
  e.charCodeAt(1),
@@ -15214,8 +14887,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
15214
14887
  ]);
15215
14888
  }
15216
14889
  })(), o = function(e) {
15217
- var t = [], n = 0, r, i, a;
15218
- for (r = 1; r < arguments.length; r++) t.push(arguments[r]);
14890
+ for (var t = [], n = 0, r = 1, i, a; r < arguments.length; r++) t.push(arguments[r]);
15219
14891
  for (r = t.length; r--;) n += t[r].byteLength;
15220
14892
  for (i = new Uint8Array(n + 8), a = new DataView(i.buffer, i.byteOffset, i.byteLength), a.setUint32(0, i.byteLength), i.set(e, 4), r = 0, n = 8; r < t.length; r++) i.set(t[r], n), n += t[r].byteLength;
15221
14893
  return i;
@@ -15418,8 +15090,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
15418
15090
  ]);
15419
15091
  return o(O.mvhd, t);
15420
15092
  }, S = function(e) {
15421
- var t = e.samples || [], n = new Uint8Array(4 + t.length), r, i;
15422
- for (i = 0; i < t.length; i++) r = t[i].flags, n[i + 4] = r.dependsOn << 4 | r.isDependedOn << 2 | r.hasRedundancy;
15093
+ for (var t = e.samples || [], n = new Uint8Array(4 + t.length), r, i = 0; i < t.length; i++) r = t[i].flags, n[i + 4] = r.dependsOn << 4 | r.isDependedOn << 2 | r.hasRedundancy;
15423
15094
  return o(O.sdtp, n);
15424
15095
  }, C = function(e) {
15425
15096
  return o(O.stbl, w(e), o(O.stts, ce), o(O.stsc, oe), o(O.stsz, se), o(O.stco, ae));
@@ -15437,8 +15108,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
15437
15108
  1
15438
15109
  ]), n.type === "video" ? e(n) : t(n));
15439
15110
  }, e = function(e) {
15440
- var t = e.sps || [], n = e.pps || [], r = [], i = [], a, s;
15441
- for (a = 0; a < t.length; a++) r.push((t[a].byteLength & 65280) >>> 8), r.push(t[a].byteLength & 255), r = r.concat(Array.prototype.slice.call(t[a]));
15111
+ for (var t = e.sps || [], n = e.pps || [], r = [], i = [], a = 0, s; a < t.length; a++) r.push((t[a].byteLength & 65280) >>> 8), r.push(t[a].byteLength & 255), r = r.concat(Array.prototype.slice.call(t[a]));
15442
15112
  for (a = 0; a < n.length; a++) i.push((n[a].byteLength & 65280) >>> 8), i.push(n[a].byteLength & 255), i = i.concat(Array.prototype.slice.call(n[a]));
15443
15113
  if (s = [
15444
15114
  O.avc1,
@@ -16147,33 +15817,19 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16147
15817
  };
16148
15818
  Fe.prototype = new Ne(), Fe.prototype.push = function(e) {
16149
15819
  var t, n, r;
16150
- if (e.nalUnitType === "sei_rbsp" && (t = Pe.parseSei(e.escapedRBSP), t.payload && t.payloadType === Pe.USER_DATA_REGISTERED_ITU_T_T35 && (n = Pe.parseUserData(t), n))) {
16151
- if (e.dts < this.latestDts_) {
16152
- this.ignoreNextEqualDts_ = !0;
16153
- return;
16154
- }
16155
- if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
16156
- this.numSameDts_--, this.numSameDts_ || (this.ignoreNextEqualDts_ = !1);
16157
- return;
16158
- }
16159
- r = Pe.parseCaptionPackets(e.pts, n), this.captionPackets_ = this.captionPackets_.concat(r), this.latestDts_ !== e.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts;
16160
- }
15820
+ e.nalUnitType === "sei_rbsp" && (t = Pe.parseSei(e.escapedRBSP), t.payload && t.payloadType === Pe.USER_DATA_REGISTERED_ITU_T_T35 && (n = Pe.parseUserData(t), n && (e.dts < this.latestDts_ ? this.ignoreNextEqualDts_ = !0 : e.dts === this.latestDts_ && this.ignoreNextEqualDts_ ? (this.numSameDts_--, this.numSameDts_ || (this.ignoreNextEqualDts_ = !1)) : (r = Pe.parseCaptionPackets(e.pts, n), this.captionPackets_ = this.captionPackets_.concat(r), this.latestDts_ !== e.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts))));
16161
15821
  }, Fe.prototype.flushCCStreams = function(e) {
16162
15822
  this.ccStreams_.forEach(function(t) {
16163
15823
  return e === "flush" ? t.flush() : t.partialFlush();
16164
15824
  }, this);
16165
15825
  }, Fe.prototype.flushStream = function(e) {
16166
- if (!this.captionPackets_.length) {
16167
- this.flushCCStreams(e);
16168
- return;
16169
- }
16170
- this.captionPackets_.forEach(function(e, t) {
15826
+ this.captionPackets_.length && (this.captionPackets_.forEach(function(e, t) {
16171
15827
  e.presortIndex = t;
16172
15828
  }), this.captionPackets_.sort(function(e, t) {
16173
15829
  return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts;
16174
15830
  }), this.captionPackets_.forEach(function(e) {
16175
15831
  e.type < 2 ? this.dispatchCea608Packet(e) : this.dispatchCea708Packet(e);
16176
- }, this), this.captionPackets_.length = 0, this.flushCCStreams(e);
15832
+ }, this), this.captionPackets_.length = 0), this.flushCCStreams(e);
16177
15833
  }, Fe.prototype.flush = function() {
16178
15834
  return this.flushStream("flush");
16179
15835
  }, Fe.prototype.partialFlush = function() {
@@ -16495,11 +16151,8 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16495
16151
  }, z = function(e, t) {
16496
16152
  z.prototype.init.call(this), this.field_ = e || 0, this.dataChannel_ = t || 0, this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1), this.setConstants(), this.reset(), this.push = function(e) {
16497
16153
  var t = e.ccData & 32639, n, r, i, a;
16498
- if (t === this.lastControlCode_) {
16499
- this.lastControlCode_ = null;
16500
- return;
16501
- }
16502
- if ((t & 61440) == 4096 ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ = null), r = t >>> 8, i = t & 255, t !== this.PADDING_) {
16154
+ if (t === this.lastControlCode_) this.lastControlCode_ = null;
16155
+ else if ((t & 61440) == 4096 ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ = null), r = t >>> 8, i = t & 255, t !== this.PADDING_) {
16503
16156
  if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn";
16504
16157
  else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this.flushDisplayed(e.pts), n = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = n, this.startPts_ = e.pts;
16505
16158
  else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts);
@@ -16598,8 +16251,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16598
16251
  var n = this.displayed_[this.row_].text;
16599
16252
  n += t, this.displayed_[this.row_].text = n;
16600
16253
  }, z.prototype.shiftRowsUp_ = function() {
16601
- var e;
16602
- for (e = 0; e < this.topRow_; e++) this.displayed_[e] = {
16254
+ for (var e = 0; e < this.topRow_; e++) this.displayed_[e] = {
16603
16255
  text: "",
16604
16256
  indent: 0,
16605
16257
  offset: 0
@@ -16634,11 +16286,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16634
16286
  }, Qe = function(e) {
16635
16287
  var t, n;
16636
16288
  Qe.prototype.init.call(this), this.type_ = e || Xe, this.push = function(e) {
16637
- if (e.type === "metadata") {
16638
- this.trigger("data", e);
16639
- return;
16640
- }
16641
- (this.type_ === Xe || e.type === this.type_) && (n === void 0 && (n = e.dts), e.dts = Ze(e.dts, n), e.pts = Ze(e.pts, n), t = e.dts, this.trigger("data", e));
16289
+ e.type === "metadata" ? this.trigger("data", e) : (this.type_ === Xe || e.type === this.type_) && (n === void 0 && (n = e.dts), e.dts = Ze(e.dts, n), e.pts = Ze(e.pts, n), t = e.dts, this.trigger("data", e));
16642
16290
  }, this.flush = function() {
16643
16291
  n = t, this.trigger("done");
16644
16292
  }, this.endTimeline = function() {
@@ -16692,8 +16340,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16692
16340
  e.data[0] === tt.Utf8 && (t = et(e.data, 0, 1), t !== -1 && (e.description = rt(e.data, 1, t), e.url = it(e.data, t + 1, e.data.length).replace(/\0.*$/, "")));
16693
16341
  },
16694
16342
  PRIV: function(e) {
16695
- var t;
16696
- for (t = 0; t < e.data.length; t++) if (e.data[t] === 0) {
16343
+ for (var t = 0; t < e.data.length; t++) if (e.data[t] === 0) {
16697
16344
  e.owner = it(e.data, 0, t);
16698
16345
  break;
16699
16346
  }
@@ -16724,14 +16371,11 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16724
16371
  this.push = function(e) {
16725
16372
  var t, a, o, s, c, l;
16726
16373
  if (e.type === "timed-metadata") {
16727
- if (e.dataAlignmentIndicator && (i = 0, r.length = 0), r.length === 0 && (e.data.length < 10 || e.data[0] !== 73 || e.data[1] !== 68 || e.data[2] !== 51)) {
16728
- this.trigger("log", {
16729
- level: "warn",
16730
- message: "Skipping unrecognized metadata packet"
16731
- });
16732
- return;
16733
- }
16734
- if (r.push(e), i += e.data.byteLength, r.length === 1 && (n = ut.parseSyncSafeInteger(e.data.subarray(6, 10)), n += 10), !(i < n)) {
16374
+ if (e.dataAlignmentIndicator && (i = 0, r.length = 0), r.length === 0 && (e.data.length < 10 || e.data[0] !== 73 || e.data[1] !== 68 || e.data[2] !== 51)) this.trigger("log", {
16375
+ level: "warn",
16376
+ message: "Skipping unrecognized metadata packet"
16377
+ });
16378
+ else if (r.push(e), i += e.data.byteLength, r.length === 1 && (n = ut.parseSyncSafeInteger(e.data.subarray(6, 10)), n += 10), !(i < n)) {
16735
16379
  for (t = {
16736
16380
  data: new Uint8Array(n),
16737
16381
  frames: [],
@@ -16767,13 +16411,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16767
16411
  var e = new Uint8Array(bt), t = 0;
16768
16412
  _t.prototype.init.call(this), this.push = function(n) {
16769
16413
  var r = 0, i = bt, a;
16770
- for (t ? (a = new Uint8Array(n.byteLength + t), a.set(e.subarray(0, t)), a.set(n, t), t = 0) : a = n; i < a.byteLength;) {
16771
- if (a[r] === xt && a[i] === xt) {
16772
- this.trigger("data", a.subarray(r, i)), r += bt, i += bt;
16773
- continue;
16774
- }
16775
- r++, i++;
16776
- }
16414
+ for (t ? (a = new Uint8Array(n.byteLength + t), a.set(e.subarray(0, t)), a.set(n, t), t = 0) : a = n; i < a.byteLength;) a[r] === xt && a[i] === xt ? (this.trigger("data", a.subarray(r, i)), r += bt, i += bt) : (r++, i++);
16777
16415
  r < a.byteLength && (e.set(a.subarray(r), 0), t = a.byteLength - r);
16778
16416
  }, this.flush = function() {
16779
16417
  t === bt && e[0] === xt && (this.trigger("data", e), t = 0), this.trigger("done");
@@ -16939,11 +16577,8 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16939
16577
  var i = 0, a, o, s, c, l;
16940
16578
  if (e || (n = 0), r.type === "audio") {
16941
16579
  t && t.length ? (s = t, t = new Uint8Array(s.byteLength + r.data.byteLength), t.set(s), t.set(r.data, s.byteLength)) : t = r.data;
16942
- for (var u; i + 7 < t.length;) {
16943
- if (t[i] !== 255 || (t[i + 1] & 246) != 240) {
16944
- typeof u != "number" && (u = i), i++;
16945
- continue;
16946
- }
16580
+ for (var u; i + 7 < t.length;) if (t[i] !== 255 || (t[i + 1] & 246) != 240) typeof u != "number" && (u = i), i++;
16581
+ else {
16947
16582
  if (typeof u == "number" && (this.skipWarn_(u, i), u = null), o = (~t[i + 1] & 1) * 2, a = (t[i + 3] & 3) << 11 | t[i + 4] << 3 | (t[i + 5] & 224) >> 5, c = ((t[i + 6] & 3) + 1) * 1024, l = c * Et / Ot[(t[i + 2] & 60) >>> 2], t.byteLength - i < a) break;
16948
16583
  this.trigger("data", {
16949
16584
  pts: r.pts + n * l,
@@ -16984,8 +16619,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
16984
16619
  var i = Math.min(r, e), a = n >>> 32 - i;
16985
16620
  return r -= i, r > 0 ? n <<= i : t > 0 && this.loadWord(), i = e - i, i > 0 ? a << i | this.readBits(i) : a;
16986
16621
  }, this.skipLeadingZeros = function() {
16987
- var e;
16988
- for (e = 0; e < r; ++e) if (n & 2147483648 >>> e) return n <<= e, r -= e, e;
16622
+ for (var e = 0; e < r; ++e) if (n & 2147483648 >>> e) return n <<= e, r -= e, e;
16989
16623
  return this.loadWord(), e + this.skipLeadingZeros();
16990
16624
  }, this.skipUnsignedExpGolomb = function() {
16991
16625
  this.skipBits(1 + this.skipLeadingZeros());
@@ -17103,8 +16737,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17103
16737
  }, this.endTimeline = function() {
17104
16738
  e.endTimeline();
17105
16739
  }, s = function(e, t) {
17106
- var n = 8, r = 8, i, a;
17107
- for (i = 0; i < e; i++) r !== 0 && (a = t.readExpGolomb(), r = (n + a + 256) % 256), n = r === 0 ? n : r;
16740
+ for (var n = 8, r = 8, i = 0, a; i < e; i++) r !== 0 && (a = t.readExpGolomb(), r = (n + a + 256) % 256), n = r === 0 ? n : r;
17108
16741
  }, a = function(e) {
17109
16742
  for (var t = e.byteLength, n = [], r = 1, i, a; r < t - 2;) e[r] === 0 && e[r + 1] === 0 && e[r + 2] === 3 ? (n.push(r + 2), r += 2) : r++;
17110
16743
  if (n.length === 0) return e;
@@ -17225,13 +16858,8 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17225
16858
  return e[t] === 73 && e[t + 1] === 68 && e[t + 2] === 51 ? "timed-metadata" : e[t] & !0 && (e[t + 1] & 240) == 240 ? "audio" : null;
17226
16859
  },
17227
16860
  parseSampleRate: function(e) {
17228
- for (var t = 0; t + 5 < e.length;) {
17229
- if (e[t] !== 255 || (e[t + 1] & 246) != 240) {
17230
- t++;
17231
- continue;
17232
- }
17233
- return Lt[(e[t + 2] & 60) >>> 2];
17234
- }
16861
+ for (var t = 0; t + 5 < e.length;) if (e[t] !== 255 || (e[t + 1] & 246) != 240) t++;
16862
+ else return Lt[(e[t + 2] & 60) >>> 2];
17235
16863
  return null;
17236
16864
  },
17237
16865
  parseAacTimestamp: function(e) {
@@ -17259,27 +16887,21 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17259
16887
  t = e;
17260
16888
  }, this.push = function(n) {
17261
16889
  var r = 0, i = 0, a, o, s, c;
17262
- for (e.length ? (c = e.length, e = new Uint8Array(n.byteLength + c), e.set(e.subarray(0, c)), e.set(n, c)) : e = n; e.length - i >= 3;) {
17263
- if (e[i] === 73 && e[i + 1] === 68 && e[i + 2] === 51) {
17264
- if (e.length - i < 10 || (r = Gt.parseId3TagSize(e, i), i + r > e.length)) break;
17265
- o = {
17266
- type: "timed-metadata",
17267
- data: e.subarray(i, i + r)
17268
- }, this.trigger("data", o), i += r;
17269
- continue;
17270
- }
17271
- if ((e[i] & 255) == 255 && (e[i + 1] & 240) == 240) {
17272
- if (e.length - i < 7 || (r = Gt.parseAdtsSize(e, i), i + r > e.length)) break;
17273
- s = {
17274
- type: "audio",
17275
- data: e.subarray(i, i + r),
17276
- pts: t,
17277
- dts: t
17278
- }, this.trigger("data", s), i += r;
17279
- continue;
17280
- }
17281
- i++;
17282
- }
16890
+ for (e.length ? (c = e.length, e = new Uint8Array(n.byteLength + c), e.set(e.subarray(0, c)), e.set(n, c)) : e = n; e.length - i >= 3;) if (e[i] === 73 && e[i + 1] === 68 && e[i + 2] === 51) {
16891
+ if (e.length - i < 10 || (r = Gt.parseId3TagSize(e, i), i + r > e.length)) break;
16892
+ o = {
16893
+ type: "timed-metadata",
16894
+ data: e.subarray(i, i + r)
16895
+ }, this.trigger("data", o), i += r;
16896
+ } else if ((e[i] & 255) == 255 && (e[i + 1] & 240) == 240) {
16897
+ if (e.length - i < 7 || (r = Gt.parseAdtsSize(e, i), i + r > e.length)) break;
16898
+ s = {
16899
+ type: "audio",
16900
+ data: e.subarray(i, i + r),
16901
+ pts: t,
16902
+ dts: t
16903
+ }, this.trigger("data", s), i += r;
16904
+ } else i++;
17283
16905
  a = e.length - i, e = a > 0 ? e.subarray(i) : /* @__PURE__ */ new Uint8Array();
17284
16906
  }, this.reset = function() {
17285
16907
  e = /* @__PURE__ */ new Uint8Array(), this.trigger("reset");
@@ -17306,7 +16928,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17306
16928
  }, gn = function(e, t) {
17307
16929
  for (var n = Object.keys(t), r = 0; r < n.length; r++) {
17308
16930
  var i = n[r];
17309
- i === "headOfPipeline" || !t[i].on || t[i].on("log", hn.bind(e, i));
16931
+ i !== "headOfPipeline" && t[i].on && t[i].on("log", hn.bind(e, i));
17310
16932
  }
17311
16933
  }, _n = function(e, t) {
17312
16934
  var n;
@@ -17342,17 +16964,13 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17342
16964
  a = e;
17343
16965
  }, this.flush = function() {
17344
16966
  var s, c, l, u, d, f, p;
17345
- if (n.length === 0) {
17346
- this.trigger("done", "AudioSegmentStream");
17347
- return;
17348
- }
17349
- s = $t.trimAdtsFramesByEarliestDts(n, e, i), e.baseMediaDecodeTime = en.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), p = $t.prefixWithSilence(e, s, a, o), e.samples = $t.generateSampleTable(s), l = Zt.mdat($t.concatenateFrameData(s)), n = [], c = Zt.moof(r, [e]), u = new Uint8Array(c.byteLength + l.byteLength), r++, u.set(c), u.set(l, c.byteLength), en.clearDtsInfo(e), d = Math.ceil(cn * 1024 / e.samplerate), s.length && (f = s.length * d, this.trigger("segmentTimingInfo", vn(nn.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), s[0].dts, s[0].pts, s[0].dts + f, s[0].pts + f, p || 0)), this.trigger("timingInfo", {
16967
+ n.length === 0 || (s = $t.trimAdtsFramesByEarliestDts(n, e, i), e.baseMediaDecodeTime = en.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), p = $t.prefixWithSilence(e, s, a, o), e.samples = $t.generateSampleTable(s), l = Zt.mdat($t.concatenateFrameData(s)), n = [], c = Zt.moof(r, [e]), u = new Uint8Array(c.byteLength + l.byteLength), r++, u.set(c), u.set(l, c.byteLength), en.clearDtsInfo(e), d = Math.ceil(cn * 1024 / e.samplerate), s.length && (f = s.length * d, this.trigger("segmentTimingInfo", vn(nn.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), s[0].dts, s[0].pts, s[0].dts + f, s[0].pts + f, p || 0)), this.trigger("timingInfo", {
17350
16968
  start: s[0].pts,
17351
16969
  end: s[0].pts + f
17352
16970
  })), this.trigger("data", {
17353
16971
  track: e,
17354
16972
  boxes: u
17355
- }), this.trigger("done", "AudioSegmentStream");
16973
+ })), this.trigger("done", "AudioSegmentStream");
17356
16974
  }, this.reset = function() {
17357
16975
  en.clearDtsInfo(e), n = [], this.trigger("reset");
17358
16976
  };
@@ -17364,56 +16982,48 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17364
16982
  }, this)), t.nalUnitType === "pic_parameter_set_rbsp" && !o && (o = t.data, e.pps = [t.data]), r.push(t);
17365
16983
  }, this.flush = function() {
17366
16984
  for (var a, o, s, c, l, u, d = 0, f, p; r.length && r[0].nalUnitType !== "access_unit_delimiter_rbsp";) r.shift();
17367
- if (r.length === 0) {
17368
- this.resetStream_(), this.trigger("done", "VideoSegmentStream");
17369
- return;
17370
- }
17371
- if (a = Qt.groupNalsIntoFrames(r), s = Qt.groupFramesIntoGops(a), s[0][0].keyFrame || (o = this.getGopForFusion_(r[0], e), o ? (d = o.duration, s.unshift(o), s.byteLength += o.byteLength, s.nalCount += o.nalCount, s.pts = o.pts, s.dts = o.dts, s.duration += o.duration) : s = Qt.extendFirstKeyFrame(s)), i.length) {
17372
- var m = t.alignGopsAtEnd ? this.alignGopsAtEnd_(s) : this.alignGopsAtStart_(s);
17373
- if (!m) {
17374
- this.gopCache_.unshift({
17375
- gop: s.pop(),
17376
- pps: e.pps,
17377
- sps: e.sps
17378
- }), this.gopCache_.length = Math.min(6, this.gopCache_.length), r = [], this.resetStream_(), this.trigger("done", "VideoSegmentStream");
17379
- return;
16985
+ if (r.length === 0) this.resetStream_(), this.trigger("done", "VideoSegmentStream");
16986
+ else {
16987
+ if (a = Qt.groupNalsIntoFrames(r), s = Qt.groupFramesIntoGops(a), s[0][0].keyFrame || (o = this.getGopForFusion_(r[0], e), o ? (d = o.duration, s.unshift(o), s.byteLength += o.byteLength, s.nalCount += o.nalCount, s.pts = o.pts, s.dts = o.dts, s.duration += o.duration) : s = Qt.extendFirstKeyFrame(s)), i.length) {
16988
+ var m = t.alignGopsAtEnd ? this.alignGopsAtEnd_(s) : this.alignGopsAtStart_(s);
16989
+ if (!m) {
16990
+ this.gopCache_.unshift({
16991
+ gop: s.pop(),
16992
+ pps: e.pps,
16993
+ sps: e.sps
16994
+ }), this.gopCache_.length = Math.min(6, this.gopCache_.length), r = [], this.resetStream_(), this.trigger("done", "VideoSegmentStream");
16995
+ return;
16996
+ }
16997
+ en.clearDtsInfo(e), s = m;
17380
16998
  }
17381
- en.clearDtsInfo(e), s = m;
16999
+ en.collectDtsInfo(e, s), e.samples = Qt.generateSampleTable(s), l = Zt.mdat(Qt.concatenateNalData(s)), e.baseMediaDecodeTime = en.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.trigger("processedGopsInfo", s.map(function(e) {
17000
+ return {
17001
+ pts: e.pts,
17002
+ dts: e.dts,
17003
+ byteLength: e.byteLength
17004
+ };
17005
+ })), f = s[0], p = s[s.length - 1], this.trigger("segmentTimingInfo", vn(e.baseMediaDecodeTime, f.dts, f.pts, p.dts + p.duration, p.pts + p.duration, d)), this.trigger("timingInfo", {
17006
+ start: s[0].pts,
17007
+ end: s[s.length - 1].pts + s[s.length - 1].duration
17008
+ }), this.gopCache_.unshift({
17009
+ gop: s.pop(),
17010
+ pps: e.pps,
17011
+ sps: e.sps
17012
+ }), this.gopCache_.length = Math.min(6, this.gopCache_.length), r = [], this.trigger("baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e.timelineStartInfo), c = Zt.moof(n, [e]), u = new Uint8Array(c.byteLength + l.byteLength), n++, u.set(c), u.set(l, c.byteLength), this.trigger("data", {
17013
+ track: e,
17014
+ boxes: u
17015
+ }), this.resetStream_(), this.trigger("done", "VideoSegmentStream");
17382
17016
  }
17383
- en.collectDtsInfo(e, s), e.samples = Qt.generateSampleTable(s), l = Zt.mdat(Qt.concatenateNalData(s)), e.baseMediaDecodeTime = en.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.trigger("processedGopsInfo", s.map(function(e) {
17384
- return {
17385
- pts: e.pts,
17386
- dts: e.dts,
17387
- byteLength: e.byteLength
17388
- };
17389
- })), f = s[0], p = s[s.length - 1], this.trigger("segmentTimingInfo", vn(e.baseMediaDecodeTime, f.dts, f.pts, p.dts + p.duration, p.pts + p.duration, d)), this.trigger("timingInfo", {
17390
- start: s[0].pts,
17391
- end: s[s.length - 1].pts + s[s.length - 1].duration
17392
- }), this.gopCache_.unshift({
17393
- gop: s.pop(),
17394
- pps: e.pps,
17395
- sps: e.sps
17396
- }), this.gopCache_.length = Math.min(6, this.gopCache_.length), r = [], this.trigger("baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e.timelineStartInfo), c = Zt.moof(n, [e]), u = new Uint8Array(c.byteLength + l.byteLength), n++, u.set(c), u.set(l, c.byteLength), this.trigger("data", {
17397
- track: e,
17398
- boxes: u
17399
- }), this.resetStream_(), this.trigger("done", "VideoSegmentStream");
17400
17017
  }, this.reset = function() {
17401
17018
  this.resetStream_(), r = [], this.gopCache_.length = 0, i.length = 0, this.trigger("reset");
17402
17019
  }, this.resetStream_ = function() {
17403
17020
  en.clearDtsInfo(e), a = void 0, o = void 0;
17404
17021
  }, this.getGopForFusion_ = function(t) {
17405
- var n = 45e3, r = 1e4, i = Infinity, a, o, s, c, l;
17406
- for (l = 0; l < this.gopCache_.length; l++) c = this.gopCache_[l], s = c.gop, !(!(e.pps && _n(e.pps[0], c.pps[0])) || !(e.sps && _n(e.sps[0], c.sps[0]))) && (s.dts < e.timelineStartInfo.dts || (a = t.dts - s.dts - s.duration, a >= -r && a <= n && (!o || i > a) && (o = c, i = a)));
17022
+ for (var n = 45e3, r = 1e4, i = Infinity, a, o, s, c, l = 0; l < this.gopCache_.length; l++) c = this.gopCache_[l], s = c.gop, e.pps && _n(e.pps[0], c.pps[0]) && e.sps && _n(e.sps[0], c.sps[0]) && (s.dts < e.timelineStartInfo.dts || (a = t.dts - s.dts - s.duration, a >= -r && a <= n && (!o || i > a) && (o = c, i = a)));
17407
17023
  return o ? o.gop : null;
17408
17024
  }, this.alignGopsAtStart_ = function(e) {
17409
17025
  var t, n, r, a, o = e.byteLength, s = e.nalCount, c = e.duration, l;
17410
- for (t = n = 0; t < i.length && n < e.length && (r = i[t], a = e[n], r.pts !== a.pts);) {
17411
- if (a.pts > r.pts) {
17412
- t++;
17413
- continue;
17414
- }
17415
- n++, o -= a.byteLength, s -= a.nalCount, c -= a.duration;
17416
- }
17026
+ for (t = n = 0; t < i.length && n < e.length && (r = i[t], a = e[n], r.pts !== a.pts);) a.pts > r.pts ? t++ : (n++, o -= a.byteLength, s -= a.nalCount, c -= a.duration);
17417
17027
  return n === 0 ? e : n === e.length ? null : (l = e.slice(n), l.byteLength = o, l.duration = c, l.nalCount = s, l.pts = l[0].pts, l.dts = l[0].dts, l);
17418
17028
  }, this.alignGopsAtEnd_ = function(e) {
17419
17029
  for (var t = i.length - 1, n = e.length - 1, r, a, o = null, s = !1; t >= 0 && n >= 0;) {
@@ -17421,11 +17031,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17421
17031
  s = !0;
17422
17032
  break;
17423
17033
  }
17424
- if (r.pts > a.pts) {
17425
- t--;
17426
- continue;
17427
- }
17428
- t === i.length - 1 && (o = n), n--;
17034
+ r.pts > a.pts ? t-- : (t === i.length - 1 && (o = n), n--);
17429
17035
  }
17430
17036
  if (!s && o === null) return null;
17431
17037
  var c = s ? n : o;
@@ -17615,33 +17221,27 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17615
17221
  }, Pn = i.getUint64, Fn, In, Ln = function(e) {
17616
17222
  return /* @__PURE__ */ new Date(e * 1e3 - 20828448e5);
17617
17223
  }, Rn = xn, zn = Tn, Bn = function(e) {
17618
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = [], r, i;
17619
- for (r = 0; r + 4 < e.length; r += i) {
17620
- if (i = t.getUint32(r), r += 4, i <= 0) {
17621
- n.push("<span style='color:red;'>MALFORMED DATA</span>");
17622
- continue;
17623
- }
17624
- switch (e[r] & 31) {
17625
- case 1:
17626
- n.push("slice_layer_without_partitioning_rbsp");
17627
- break;
17628
- case 5:
17629
- n.push("slice_layer_without_partitioning_rbsp_idr");
17630
- break;
17631
- case 6:
17632
- n.push("sei_rbsp");
17633
- break;
17634
- case 7:
17635
- n.push("seq_parameter_set_rbsp");
17636
- break;
17637
- case 8:
17638
- n.push("pic_parameter_set_rbsp");
17639
- break;
17640
- case 9:
17641
- n.push("access_unit_delimiter_rbsp");
17642
- break;
17643
- default: n.push("UNKNOWN NAL - " + e[r] & 31);
17644
- }
17224
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = [], r = 0, i; r + 4 < e.length; r += i) if (i = t.getUint32(r), r += 4, i <= 0) n.push("<span style='color:red;'>MALFORMED DATA</span>");
17225
+ else switch (e[r] & 31) {
17226
+ case 1:
17227
+ n.push("slice_layer_without_partitioning_rbsp");
17228
+ break;
17229
+ case 5:
17230
+ n.push("slice_layer_without_partitioning_rbsp_idr");
17231
+ break;
17232
+ case 6:
17233
+ n.push("sei_rbsp");
17234
+ break;
17235
+ case 7:
17236
+ n.push("seq_parameter_set_rbsp");
17237
+ break;
17238
+ case 8:
17239
+ n.push("pic_parameter_set_rbsp");
17240
+ break;
17241
+ case 9:
17242
+ n.push("access_unit_delimiter_rbsp");
17243
+ break;
17244
+ default: n.push("UNKNOWN NAL - " + e[r] & 31);
17645
17245
  }
17646
17246
  return n;
17647
17247
  }, Vn = {
@@ -17659,7 +17259,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17659
17259
  };
17660
17260
  },
17661
17261
  avcC: function(e) {
17662
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17262
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17663
17263
  configurationVersion: e[0],
17664
17264
  avcProfileIndication: e[1],
17665
17265
  profileCompatibility: e[2],
@@ -17667,8 +17267,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17667
17267
  lengthSizeMinusOne: e[4] & 3,
17668
17268
  sps: [],
17669
17269
  pps: []
17670
- }, r = e[5] & 31, i, a, o = 6, s;
17671
- for (s = 0; s < r; s++) a = t.getUint16(o), o += 2, n.sps.push(new Uint8Array(e.subarray(o, o + a))), o += a;
17270
+ }, r = e[5] & 31, i, a, o = 6, s = 0; s < r; s++) a = t.getUint16(o), o += 2, n.sps.push(new Uint8Array(e.subarray(o, o + a))), o += a;
17672
17271
  for (i = e[o], o++, s = 0; s < i; s++) a = t.getUint16(o), o += 2, n.pps.push(new Uint8Array(e.subarray(o, o + a))), o += a;
17673
17272
  return n;
17674
17273
  },
@@ -17684,12 +17283,11 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17684
17283
  return { boxes: Fn(e) };
17685
17284
  },
17686
17285
  elst: function(e) {
17687
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17286
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17688
17287
  version: t.getUint8(0),
17689
17288
  flags: new Uint8Array(e.subarray(1, 4)),
17690
17289
  edits: []
17691
- }, r = t.getUint32(4), i;
17692
- for (i = 8; r; r--) n.version === 0 ? (n.edits.push({
17290
+ }, r = t.getUint32(4), i = 8; r; r--) n.version === 0 ? (n.edits.push({
17693
17291
  segmentDuration: t.getUint32(i),
17694
17292
  mediaTime: t.getInt32(i + 4),
17695
17293
  mediaRate: t.getUint16(i + 8) + t.getUint16(i + 10) / 65536
@@ -17818,12 +17416,11 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17818
17416
  };
17819
17417
  },
17820
17418
  sdtp: function(e) {
17821
- var t = {
17419
+ for (var t = {
17822
17420
  version: e[0],
17823
17421
  flags: new Uint8Array(e.subarray(1, 4)),
17824
17422
  samples: []
17825
- }, n;
17826
- for (n = 4; n < e.byteLength; n++) t.samples.push({
17423
+ }, n = 4; n < e.byteLength; n++) t.samples.push({
17827
17424
  dependsOn: (e[n] & 48) >> 4,
17828
17425
  isDependedOn: (e[n] & 12) >> 2,
17829
17426
  hasRedundancy: e[n] & 3
@@ -17842,42 +17439,38 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17842
17439
  return { boxes: Fn(e) };
17843
17440
  },
17844
17441
  ctts: function(e) {
17845
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17442
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17846
17443
  version: t.getUint8(0),
17847
17444
  flags: new Uint8Array(e.subarray(1, 4)),
17848
17445
  compositionOffsets: []
17849
- }, r = t.getUint32(4), i;
17850
- for (i = 8; r; i += 8, r--) n.compositionOffsets.push({
17446
+ }, r = t.getUint32(4), i = 8; r; i += 8, r--) n.compositionOffsets.push({
17851
17447
  sampleCount: t.getUint32(i),
17852
17448
  sampleOffset: t[n.version === 0 ? "getUint32" : "getInt32"](i + 4)
17853
17449
  });
17854
17450
  return n;
17855
17451
  },
17856
17452
  stss: function(e) {
17857
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17453
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17858
17454
  version: t.getUint8(0),
17859
17455
  flags: new Uint8Array(e.subarray(1, 4)),
17860
17456
  syncSamples: []
17861
- }, r = t.getUint32(4), i;
17862
- for (i = 8; r; i += 4, r--) n.syncSamples.push(t.getUint32(i));
17457
+ }, r = t.getUint32(4), i = 8; r; i += 4, r--) n.syncSamples.push(t.getUint32(i));
17863
17458
  return n;
17864
17459
  },
17865
17460
  stco: function(e) {
17866
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17461
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17867
17462
  version: e[0],
17868
17463
  flags: new Uint8Array(e.subarray(1, 4)),
17869
17464
  chunkOffsets: []
17870
- }, r = t.getUint32(4), i;
17871
- for (i = 8; r; i += 4, r--) n.chunkOffsets.push(t.getUint32(i));
17465
+ }, r = t.getUint32(4), i = 8; r; i += 4, r--) n.chunkOffsets.push(t.getUint32(i));
17872
17466
  return n;
17873
17467
  },
17874
17468
  stsc: function(e) {
17875
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint32(4), r = {
17469
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint32(4), r = {
17876
17470
  version: e[0],
17877
17471
  flags: new Uint8Array(e.subarray(1, 4)),
17878
17472
  sampleToChunks: []
17879
- }, i;
17880
- for (i = 8; n; i += 12, n--) r.sampleToChunks.push({
17473
+ }, i = 8; n; i += 12, n--) r.sampleToChunks.push({
17881
17474
  firstChunk: t.getUint32(i),
17882
17475
  samplesPerChunk: t.getUint32(i + 4),
17883
17476
  sampleDescriptionIndex: t.getUint32(i + 8)
@@ -17892,22 +17485,20 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
17892
17485
  };
17893
17486
  },
17894
17487
  stsz: function(e) {
17895
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17488
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17896
17489
  version: e[0],
17897
17490
  flags: new Uint8Array(e.subarray(1, 4)),
17898
17491
  sampleSize: t.getUint32(4),
17899
17492
  entries: []
17900
- }, r;
17901
- for (r = 12; r < e.byteLength; r += 4) n.entries.push(t.getUint32(r));
17493
+ }, r = 12; r < e.byteLength; r += 4) n.entries.push(t.getUint32(r));
17902
17494
  return n;
17903
17495
  },
17904
17496
  stts: function(e) {
17905
- var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17497
+ for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = {
17906
17498
  version: e[0],
17907
17499
  flags: new Uint8Array(e.subarray(1, 4)),
17908
17500
  timeToSamples: []
17909
- }, r = t.getUint32(4), i;
17910
- for (i = 8; r; i += 8, r--) n.timeToSamples.push({
17501
+ }, r = t.getUint32(4), i = 8; r; i += 8, r--) n.timeToSamples.push({
17911
17502
  sampleCount: t.getUint32(i),
17912
17503
  sampleDelta: t.getUint32(i + 4)
17913
17504
  });
@@ -18155,11 +17746,10 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18155
17746
  }
18156
17747
  return null;
18157
17748
  }, Tr = function(e, t, n) {
18158
- var r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = {
17749
+ for (var r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = {
18159
17750
  logs: [],
18160
17751
  seiNals: []
18161
- }, a, o, s, c;
18162
- for (o = 0; o + 4 < e.length; o += s) if (s = r.getUint32(o), o += 4, !(s <= 0)) switch (e[o] & 31) {
17752
+ }, a, o = 0, s, c; o + 4 < e.length; o += s) if (s = r.getUint32(o), o += 4, !(s <= 0)) switch (e[o] & 31) {
18163
17753
  case 6:
18164
17754
  var l = e.subarray(o + 1, o + 1 + s), u = wr(o, t);
18165
17755
  if (a = {
@@ -18267,11 +17857,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18267
17857
  let t = jr(c, i, s), a = 0;
18268
17858
  t.forEach(function(t) {
18269
17859
  let i = new TextDecoder("utf-8"), o = r.slice(a, a + t.size);
18270
- if (W(o, ["vtte"])[0]) {
18271
- a += t.size;
18272
- return;
18273
- }
18274
- W(o, ["vttc"]).forEach(function(r) {
17860
+ W(o, ["vtte"])[0] || W(o, ["vttc"]).forEach(function(r) {
18275
17861
  let a = W(r, ["payl"])[0], o = W(r, ["sttg"])[0], s = t.pts / e, c = (t.pts + t.duration) / e, l, u;
18276
17862
  if (a) try {
18277
17863
  l = i.decode(a);
@@ -18381,71 +17967,51 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18381
17967
  }, Wr = Ke, Gr = $e.handleRollover, K = {};
18382
17968
  K.ts = Ur, K.aac = Ut;
18383
17969
  var Kr = F.ONE_SECOND_IN_TS, qr = 188, Jr = 71, Yr = function(e, t) {
18384
- for (var n = 0, r = qr, i, a; r < e.byteLength;) {
18385
- if (e[n] === Jr && e[r] === Jr) {
18386
- switch (i = e.subarray(n, r), a = K.ts.parseType(i, t.pid), a) {
18387
- case "pat":
18388
- t.pid = K.ts.parsePat(i);
18389
- break;
18390
- case "pmt":
18391
- var o = K.ts.parsePmt(i);
18392
- t.table = t.table || {}, Object.keys(o).forEach(function(e) {
18393
- t.table[e] = o[e];
18394
- });
18395
- }
18396
- n += qr, r += qr;
18397
- continue;
17970
+ for (var n = 0, r = qr, i, a; r < e.byteLength;) if (e[n] === Jr && e[r] === Jr) {
17971
+ switch (i = e.subarray(n, r), a = K.ts.parseType(i, t.pid), a) {
17972
+ case "pat":
17973
+ t.pid = K.ts.parsePat(i);
17974
+ break;
17975
+ case "pmt":
17976
+ var o = K.ts.parsePmt(i);
17977
+ t.table = t.table || {}, Object.keys(o).forEach(function(e) {
17978
+ t.table[e] = o[e];
17979
+ });
18398
17980
  }
18399
- n++, r++;
18400
- }
17981
+ n += qr, r += qr;
17982
+ } else n++, r++;
18401
17983
  }, Xr = function(e, t, n) {
18402
- for (var r = 0, i = qr, a, o, s, c, l, u = !1; i <= e.byteLength;) {
18403
- if (e[r] === Jr && (e[i] === Jr || i === e.byteLength)) {
18404
- if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "audio" && c && (l = K.ts.parsePesTime(a), l && (l.type = "audio", n.audio.push(l), u = !0))), u) break;
18405
- r += qr, i += qr;
18406
- continue;
18407
- }
18408
- r++, i++;
18409
- }
18410
- for (i = e.byteLength, r = i - qr, u = !1; r >= 0;) {
18411
- if (e[r] === Jr && (e[i] === Jr || i === e.byteLength)) {
18412
- if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "audio" && c && (l = K.ts.parsePesTime(a), l && (l.type = "audio", n.audio.push(l), u = !0))), u) break;
18413
- r -= qr, i -= qr;
18414
- continue;
18415
- }
18416
- r--, i--;
18417
- }
17984
+ for (var r = 0, i = qr, a, o, s, c, l, u = !1; i <= e.byteLength;) if (e[r] === Jr && (e[i] === Jr || i === e.byteLength)) {
17985
+ if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "audio" && c && (l = K.ts.parsePesTime(a), l && (l.type = "audio", n.audio.push(l), u = !0))), u) break;
17986
+ r += qr, i += qr;
17987
+ } else r++, i++;
17988
+ for (i = e.byteLength, r = i - qr, u = !1; r >= 0;) if (e[r] === Jr && (e[i] === Jr || i === e.byteLength)) {
17989
+ if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "audio" && c && (l = K.ts.parsePesTime(a), l && (l.type = "audio", n.audio.push(l), u = !0))), u) break;
17990
+ r -= qr, i -= qr;
17991
+ } else r--, i--;
18418
17992
  }, Zr = function(e, t, n) {
18419
17993
  for (var r = 0, i = qr, a, o, s, c, l, u, d, f, p = !1, m = {
18420
17994
  data: [],
18421
17995
  size: 0
18422
- }; i < e.byteLength;) {
18423
- if (e[r] === Jr && e[i] === Jr) {
18424
- if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "video" && (c && !p && (l = K.ts.parsePesTime(a), l && (l.type = "video", n.video.push(l), p = !0)), !n.firstKeyFrame))) {
18425
- if (c && m.size !== 0) {
18426
- for (u = new Uint8Array(m.size), d = 0; m.data.length;) f = m.data.shift(), u.set(f, d), d += f.byteLength;
18427
- if (K.ts.videoPacketContainsKeyFrame(u)) {
18428
- var h = K.ts.parsePesTime(u);
18429
- h ? (n.firstKeyFrame = h, n.firstKeyFrame.type = "video") : console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
18430
- }
18431
- m.size = 0;
17996
+ }; i < e.byteLength;) if (e[r] === Jr && e[i] === Jr) {
17997
+ if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "video" && (c && !p && (l = K.ts.parsePesTime(a), l && (l.type = "video", n.video.push(l), p = !0)), !n.firstKeyFrame))) {
17998
+ if (c && m.size !== 0) {
17999
+ for (u = new Uint8Array(m.size), d = 0; m.data.length;) f = m.data.shift(), u.set(f, d), d += f.byteLength;
18000
+ if (K.ts.videoPacketContainsKeyFrame(u)) {
18001
+ var h = K.ts.parsePesTime(u);
18002
+ h ? (n.firstKeyFrame = h, n.firstKeyFrame.type = "video") : console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
18432
18003
  }
18433
- m.data.push(a), m.size += a.byteLength;
18004
+ m.size = 0;
18434
18005
  }
18435
- if (p && n.firstKeyFrame) break;
18436
- r += qr, i += qr;
18437
- continue;
18438
- }
18439
- r++, i++;
18440
- }
18441
- for (i = e.byteLength, r = i - qr, p = !1; r >= 0;) {
18442
- if (e[r] === Jr && e[i] === Jr) {
18443
- if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "video" && c && (l = K.ts.parsePesTime(a), l && (l.type = "video", n.video.push(l), p = !0))), p) break;
18444
- r -= qr, i -= qr;
18445
- continue;
18006
+ m.data.push(a), m.size += a.byteLength;
18446
18007
  }
18447
- r--, i--;
18448
- }
18008
+ if (p && n.firstKeyFrame) break;
18009
+ r += qr, i += qr;
18010
+ } else r++, i++;
18011
+ for (i = e.byteLength, r = i - qr, p = !1; r >= 0;) if (e[r] === Jr && e[i] === Jr) {
18012
+ if (a = e.subarray(r, i), o = K.ts.parseType(a, t.pid), o === "pes" && (s = K.ts.parsePesType(a, t.table), c = K.ts.parsePayloadUnitStartIndicator(a), s === "video" && c && (l = K.ts.parsePesTime(a), l && (l.type = "video", n.video.push(l), p = !0))), p) break;
18013
+ r -= qr, i -= qr;
18014
+ } else r--, i--;
18449
18015
  }, Qr = function(e, t) {
18450
18016
  if (e.audio && e.audio.length) {
18451
18017
  var n = t;
@@ -18466,22 +18032,14 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18466
18032
  for (var t = !1, n = 0, r = null, i = null, a = 0, o = 0, s; e.length - o >= 3;) {
18467
18033
  switch (K.aac.parseType(e, o)) {
18468
18034
  case "timed-metadata":
18469
- if (e.length - o < 10) {
18470
- t = !0;
18471
- break;
18472
- }
18473
- if (a = K.aac.parseId3TagSize(e, o), a > e.length) {
18035
+ if (e.length - o < 10 || (a = K.aac.parseId3TagSize(e, o), a > e.length)) {
18474
18036
  t = !0;
18475
18037
  break;
18476
18038
  }
18477
18039
  i === null && (s = e.subarray(o, o + a), i = K.aac.parseAacTimestamp(s)), o += a;
18478
18040
  break;
18479
18041
  case "audio":
18480
- if (e.length - o < 7) {
18481
- t = !0;
18482
- break;
18483
- }
18484
- if (a = K.aac.parseAdtsSize(e, o), a > e.length) {
18042
+ if (e.length - o < 7 || (a = K.aac.parseAdtsSize(e, o), a > e.length)) {
18485
18043
  t = !0;
18486
18044
  break;
18487
18045
  }
@@ -18719,11 +18277,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18719
18277
  }
18720
18278
  }
18721
18279
  self.onmessage = function(e) {
18722
- if (e.data.action === "init" && e.data.options) {
18723
- this.messageHandlers = new ri(self, e.data.options);
18724
- return;
18725
- }
18726
- this.messageHandlers ||= new ri(self), e.data && e.data.action && e.data.action !== "init" && this.messageHandlers[e.data.action] && this.messageHandlers[e.data.action](e.data);
18280
+ e.data.action === "init" && e.data.options ? this.messageHandlers = new ri(self, e.data.options) : (this.messageHandlers ||= new ri(self), e.data && e.data.action && e.data.action !== "init" && this.messageHandlers[e.data.action] && this.messageHandlers[e.data.action](e.data));
18727
18281
  };
18728
18282
  }))), Zu = (e, t, n) => {
18729
18283
  let { type: r, initSegment: i, captions: a, captionStreams: o, metadata: s, videoFrameDtsTime: c, videoFramePtsTime: l } = e.data.segment;
@@ -18785,21 +18339,13 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
18785
18339
  }, nd = (e, t) => {
18786
18340
  e.postMessage({ action: t }), td(e);
18787
18341
  }, rd = (e, t) => {
18788
- if (!t.currentTransmux) {
18789
- t.currentTransmux = e, nd(t, e);
18790
- return;
18791
- }
18792
- t.transmuxQueue.push(nd.bind(null, t, e));
18342
+ t.currentTransmux ? t.transmuxQueue.push(nd.bind(null, t, e)) : (t.currentTransmux = e, nd(t, e));
18793
18343
  }, id = (e) => {
18794
18344
  rd("reset", e);
18795
18345
  }, ad = (e) => {
18796
18346
  rd("endTimeline", e);
18797
18347
  }, od = (e) => {
18798
- if (!e.transmuxer.currentTransmux) {
18799
- e.transmuxer.currentTransmux = e, ed(e);
18800
- return;
18801
- }
18802
- e.transmuxer.transmuxQueue.push(e);
18348
+ e.transmuxer.currentTransmux ? e.transmuxer.transmuxQueue.push(e) : (e.transmuxer.currentTransmux = e, ed(e));
18803
18349
  }, sd = {
18804
18350
  reset: id,
18805
18351
  endTimeline: ad,
@@ -19074,11 +18620,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
19074
18620
  transmuxer: e.transmuxer,
19075
18621
  offset: o,
19076
18622
  callback: ({ emsgData: n, id3Frames: r }) => {
19077
- if (t = n.buffer, e.bytes = m = n, !i.video || !n.byteLength || !e.transmuxer) {
19078
- c(void 0, r);
19079
- return;
19080
- }
19081
- cd({
18623
+ t = n.buffer, e.bytes = m = n, !i.video || !n.byteLength || !e.transmuxer ? c(void 0, r) : cd({
19082
18624
  action: "pushMp4Captions",
19083
18625
  endAction: "mp4Captions",
19084
18626
  transmuxer: e.transmuxer,
@@ -19095,20 +18637,10 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
19095
18637
  });
19096
18638
  }
19097
18639
  });
19098
- return;
19099
- }
19100
- if (!e.transmuxer) {
19101
- d(null, e, {});
19102
- return;
19103
- }
19104
- if (e.container === void 0 && (e.container = Rn(m)), e.container !== "ts" && e.container !== "aac") {
19105
- n(e, {
19106
- hasAudio: !1,
19107
- hasVideo: !1
19108
- }), d(null, e, {});
19109
- return;
19110
- }
19111
- xd({
18640
+ } else e.transmuxer ? (e.container === void 0 && (e.container = Rn(m)), e.container !== "ts" && e.container !== "aac" ? (n(e, {
18641
+ hasAudio: !1,
18642
+ hasVideo: !1
18643
+ }), d(null, e, {})) : xd({
19112
18644
  segment: e,
19113
18645
  bytes: t,
19114
18646
  trackInfoFn: n,
@@ -19123,7 +18655,7 @@ var qc = 1 / 30, Jc = qc * 3, Yc = function(e, t) {
19123
18655
  doneFn: d,
19124
18656
  onTransmuxerLog: f,
19125
18657
  triggerSegmentEventFn: p
19126
- });
18658
+ })) : d(null, e, {});
19127
18659
  }, Cd = function({ id: e, key: t, encryptedBytes: n, decryptionWorker: r, segment: i, doneFn: a }, o) {
19128
18660
  let s = (t) => {
19129
18661
  if (t.data.source === e) {
@@ -19523,7 +19055,7 @@ var Hd = function(e, t, n) {
19523
19055
  let i = E.default.WebKitDataCue || E.default.VTTCue, a = e.metadataTrack_;
19524
19056
  if (!a || (t.forEach((e) => {
19525
19057
  let t = e.cueTime + n;
19526
- typeof t != "number" || E.default.isNaN(t) || t < 0 || !(t < Infinity) || !e.frames || !e.frames.length || e.frames.forEach((e) => {
19058
+ typeof t != "number" || E.default.isNaN(t) || t < 0 || !(t < Infinity) || e.frames && e.frames.length && e.frames.forEach((e) => {
19527
19059
  let n = new i(t, t, e.value || e.url || e.data || "");
19528
19060
  n.frame = e, n.value = e, Wd(n), a.addCue(n);
19529
19061
  });
@@ -19593,8 +19125,8 @@ var Hd = function(e, t, n) {
19593
19125
  }
19594
19126
  }, Qd = (e, t, n) => {
19595
19127
  if (t == null || !e.length) return [];
19596
- let r = Math.ceil((t - n + 3) * Bn.ONE_SECOND_IN_TS), i;
19597
- for (i = 0; i < e.length && !(e[i].pts > r); i++);
19128
+ let r = Math.ceil((t - n + 3) * Bn.ONE_SECOND_IN_TS), i = 0;
19129
+ for (; i < e.length && !(e[i].pts > r); i++);
19598
19130
  return e.slice(i);
19599
19131
  }, $d = (e, t, n) => {
19600
19132
  if (!t.length) return e;
@@ -19698,7 +19230,7 @@ var Hd = function(e, t, n) {
19698
19230
  } : null;
19699
19231
  }, bf = ({ type: e, segment: t }) => {
19700
19232
  if (!t) return;
19701
- let n = !!(t.key || t.map && t.map.ke), r = !!(t.map && !t.map.bytes), i = t.startOfSegment === void 0 ? t.start : t.startOfSegment;
19233
+ let n = !!(t.key || t.map && t.map.ke), r = !(!t.map || t.map.bytes), i = t.startOfSegment === void 0 ? t.start : t.startOfSegment;
19702
19234
  return {
19703
19235
  type: e || t.type,
19704
19236
  uri: t.resolvedUri || t.uri,
@@ -19768,11 +19300,7 @@ var Hd = function(e, t, n) {
19768
19300
  this.audioDisabled_ = !e, e ? this.appendInitSegment_.audio = !0 : this.sourceUpdater_.removeAudio(0, this.duration_());
19769
19301
  }
19770
19302
  abort() {
19771
- if (this.state !== "WAITING") {
19772
- this.pendingSegment_ &&= null, this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
19773
- return;
19774
- }
19775
- this.abort_(), this.state = "READY", this.paused() || this.monitorBuffer_();
19303
+ this.state === "WAITING" ? (this.abort_(), this.state = "READY", this.paused() || this.monitorBuffer_()) : (this.pendingSegment_ &&= null, this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_));
19776
19304
  }
19777
19305
  abort_() {
19778
19306
  this.pendingSegment_ && this.pendingSegment_.abortRequests && this.pendingSegment_.abortRequests(), this.pendingSegment_ = null, this.callQueue_ = [], this.loadQueue_ = [], this.metadataQueue_.id3 = [], this.metadataQueue_.caption = [], this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_), this.waitingOnRemove_ = !1, E.default.clearTimeout(this.quotaExceededErrorRetryTimeout_), this.quotaExceededErrorRetryTimeout_ = null;
@@ -20105,13 +19633,7 @@ Fetch At Buffer: ${this.fetchAtBuffer_}
20105
19633
  }), this.transmuxer_ && this.transmuxer_.postMessage({ action: "clearParsedMp4Captions" });
20106
19634
  }
20107
19635
  handleId3_(e, t, n) {
20108
- if (this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId)) {
20109
- if (!this.pendingSegment_.hasAppendedData_) {
20110
- this.metadataQueue_.id3.push(this.handleId3_.bind(this, e, t, n));
20111
- return;
20112
- }
20113
- this.addMetadataToTextTrack(n, t, this.duration_());
20114
- }
19636
+ this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId) && (this.pendingSegment_.hasAppendedData_ ? this.addMetadataToTextTrack(n, t, this.duration_()) : this.metadataQueue_.id3.push(this.handleId3_.bind(this, e, t, n)));
20115
19637
  }
20116
19638
  processMetadataQueue_() {
20117
19639
  this.metadataQueue_.id3.forEach((e) => e()), this.metadataQueue_.caption.forEach((e) => e()), this.metadataQueue_.id3 = [], this.metadataQueue_.caption = [];
@@ -20232,20 +19754,14 @@ Fetch At Buffer: ${this.fetchAtBuffer_}
20232
19754
  }, !0);
20233
19755
  }
20234
19756
  handleAppendError_({ segmentInfo: e, type: t, bytes: n }, r) {
20235
- if (r) {
20236
- if (r.code === Hl) {
20237
- this.handleQuotaExceededError_({
20238
- segmentInfo: e,
20239
- type: t,
20240
- bytes: n
20241
- });
20242
- return;
20243
- }
20244
- this.logger_("Received non QUOTA_EXCEEDED_ERR on append", r), this.error({
20245
- message: `${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,
20246
- metadata: { errorType: Q.Error.StreamingFailedToAppendSegment }
20247
- }), this.trigger("appenderror");
20248
- }
19757
+ r && (r.code === Hl ? this.handleQuotaExceededError_({
19758
+ segmentInfo: e,
19759
+ type: t,
19760
+ bytes: n
19761
+ }) : (this.logger_("Received non QUOTA_EXCEEDED_ERR on append", r), this.error({
19762
+ message: `${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,
19763
+ metadata: { errorType: Q.Error.StreamingFailedToAppendSegment }
19764
+ }), this.trigger("appenderror")));
20249
19765
  }
20250
19766
  appendToSourceBuffer_({ segmentInfo: e, type: t, initSegment: n, data: r, bytes: i }) {
20251
19767
  if (!i) {
@@ -20294,14 +19810,10 @@ Fetch At Buffer: ${this.fetchAtBuffer_}
20294
19810
  });
20295
19811
  }
20296
19812
  loadSegment_(e) {
20297
- if (this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), typeof e.timestampOffset == "number" && this.transmuxer_ && this.transmuxer_.postMessage({ action: "clearAllMp4Captions" }), !this.hasEnoughInfoToLoad_()) {
20298
- gf(this), this.loadQueue_.push(() => {
20299
- let t = k({}, e, { forceTimestampOffset: !0 });
20300
- k(e, this.generateSegmentInfo_(t)), this.isPendingTimestampOffset_ = !1, this.updateTransmuxerAndRequestSegment_(e);
20301
- });
20302
- return;
20303
- }
20304
- this.updateTransmuxerAndRequestSegment_(e);
19813
+ this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), typeof e.timestampOffset == "number" && this.transmuxer_ && this.transmuxer_.postMessage({ action: "clearAllMp4Captions" }), this.hasEnoughInfoToLoad_() ? this.updateTransmuxerAndRequestSegment_(e) : (gf(this), this.loadQueue_.push(() => {
19814
+ let t = k({}, e, { forceTimestampOffset: !0 });
19815
+ k(e, this.generateSegmentInfo_(t)), this.isPendingTimestampOffset_ = !1, this.updateTransmuxerAndRequestSegment_(e);
19816
+ }));
20305
19817
  }
20306
19818
  updateTransmuxerAndRequestSegment_(e) {
20307
19819
  this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset) && (this.gopBuffer_.length = 0, e.gopsToAlignWith = [], this.timeMapping_ = 0, this.transmuxer_.postMessage({ action: "reset" }), this.transmuxer_.postMessage({
@@ -20439,11 +19951,7 @@ ${uf(e)}`), t.map && !t.map.bytes && (this.logger_("going to request init segmen
20439
19951
  return;
20440
19952
  }
20441
19953
  let { hasAudio: n, hasVideo: r, isMuxed: i } = t, a = this.loaderType_ === "main" && r, o = !this.audioDisabled_ && n && !i;
20442
- if (e.waitingOnAppends = 0, !e.hasAppendedData_) {
20443
- !e.timingInfo && typeof e.timestampOffset == "number" && (this.isPendingTimestampOffset_ = !0), e.timingInfo = { start: 0 }, e.waitingOnAppends++, this.isPendingTimestampOffset_ || (this.updateSourceBufferTimestampOffset_(e), this.processMetadataQueue_()), this.checkAppendsDone_(e);
20444
- return;
20445
- }
20446
- a && e.waitingOnAppends++, o && e.waitingOnAppends++, a && this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, e)), o && this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, e));
19954
+ e.waitingOnAppends = 0, e.hasAppendedData_ ? (a && e.waitingOnAppends++, o && e.waitingOnAppends++, a && this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, e)), o && this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, e))) : (!e.timingInfo && typeof e.timestampOffset == "number" && (this.isPendingTimestampOffset_ = !0), e.timingInfo = { start: 0 }, e.waitingOnAppends++, this.isPendingTimestampOffset_ || (this.updateSourceBufferTimestampOffset_(e), this.processMetadataQueue_()), this.checkAppendsDone_(e));
20447
19955
  }
20448
19956
  checkAppendsDone_(e) {
20449
19957
  this.checkForAbort_(e.requestId) || (e.waitingOnAppends--, e.waitingOnAppends === 0 && this.handleAppendsDone_());
@@ -20507,11 +20015,7 @@ ${uf(e)}`), t.map && !t.map.bytes && (this.logger_("going to request init segmen
20507
20015
  to: e.timeline
20508
20016
  })), this.currentTimeline_ = e.timeline, this.trigger("syncinfoupdate");
20509
20017
  let n = e.segment, r = e.part, i = n.end && this.currentTime_() - n.end > e.playlist.targetDuration * 3, a = r && r.end && this.currentTime_() - r.end > e.playlist.partTargetDuration * 3;
20510
- if (i || a) {
20511
- this.logger_(`bad ${i ? "segment" : "part"} ${uf(e)}`), this.resetEverything();
20512
- return;
20513
- }
20514
- this.mediaIndex !== null && this.trigger("bandwidthupdate"), this.trigger("progress"), this.mediaIndex = e.mediaIndex, this.partIndex = e.partIndex, this.isEndOfStream_(e.mediaIndex, e.playlist, e.partIndex) && this.endOfStream(), this.trigger("appended"), e.hasAppendedData_ && this.mediaAppends++, this.paused() || this.monitorBuffer_();
20018
+ i || a ? (this.logger_(`bad ${i ? "segment" : "part"} ${uf(e)}`), this.resetEverything()) : (this.mediaIndex !== null && this.trigger("bandwidthupdate"), this.trigger("progress"), this.mediaIndex = e.mediaIndex, this.partIndex = e.partIndex, this.isEndOfStream_(e.mediaIndex, e.playlist, e.partIndex) && this.endOfStream(), this.trigger("appended"), e.hasAppendedData_ && this.mediaAppends++, this.paused() || this.monitorBuffer_());
20515
20019
  }
20516
20020
  recordThroughput_(e) {
20517
20021
  if (e.duration < sf) {
@@ -20560,19 +20064,13 @@ var Cf = function(e) {
20560
20064
  }, Df = (e, t) => {
20561
20065
  if (t.queue.length === 0) return;
20562
20066
  let n = 0, r = t.queue[n];
20563
- if (r.type === "mediaSource") {
20564
- !t.updating() && t.mediaSource.readyState !== "closed" && (t.queue.shift(), r.action(t), r.doneFn && r.doneFn(), Df("audio", t), Df("video", t));
20565
- return;
20566
- }
20567
- if (e !== "mediaSource" && !(!t.ready() || t.mediaSource.readyState === "closed" || Tf(e, t))) {
20067
+ if (r.type === "mediaSource") !t.updating() && t.mediaSource.readyState !== "closed" && (t.queue.shift(), r.action(t), r.doneFn && r.doneFn(), Df("audio", t), Df("video", t));
20068
+ else if (e !== "mediaSource" && t.ready() && t.mediaSource.readyState !== "closed" && !Tf(e, t)) {
20568
20069
  if (r.type !== e) {
20569
20070
  if (n = Ef(e, t.queue), n === null) return;
20570
20071
  r = t.queue[n];
20571
20072
  }
20572
- if (t.queue.splice(n, 1), t.queuePending[e] = r, r.action(e, t), !r.doneFn) {
20573
- t.queuePending[e] = null, Df(e, t);
20574
- return;
20575
- }
20073
+ t.queue.splice(n, 1), t.queuePending[e] = r, r.action(e, t), !r.doneFn && (t.queuePending[e] = null, Df(e, t));
20576
20074
  }
20577
20075
  }, Of = (e, t) => {
20578
20076
  let n = t[`${e}Buffer`], r = Cf(e);
@@ -20733,16 +20231,12 @@ var Cf = function(e) {
20733
20231
  });
20734
20232
  }
20735
20233
  removeSourceBuffer(e) {
20736
- if (!this.canRemoveSourceBuffer()) {
20737
- Q.log.error("removeSourceBuffer is not supported!");
20738
- return;
20739
- }
20740
- jf({
20234
+ this.canRemoveSourceBuffer() ? jf({
20741
20235
  type: "mediaSource",
20742
20236
  sourceUpdater: this,
20743
20237
  action: Af.removeSourceBuffer(e),
20744
20238
  name: "removeSourceBuffer"
20745
- });
20239
+ }) : Q.log.error("removeSourceBuffer is not supported!");
20746
20240
  }
20747
20241
  canRemoveSourceBuffer() {
20748
20242
  return !Q.browser.IS_FIREFOX && E.default.MediaSource && E.default.MediaSource.prototype && typeof E.default.MediaSource.prototype.removeSourceBuffer == "function";
@@ -20754,16 +20248,12 @@ var Cf = function(e) {
20754
20248
  return this.constructor.canChangeType();
20755
20249
  }
20756
20250
  changeType(e, t) {
20757
- if (!this.canChangeType()) {
20758
- Q.log.error("changeType is not supported!");
20759
- return;
20760
- }
20761
- jf({
20251
+ this.canChangeType() ? jf({
20762
20252
  type: e,
20763
20253
  sourceUpdater: this,
20764
20254
  action: Af.changeType(t),
20765
20255
  name: "changeType"
20766
- });
20256
+ }) : Q.log.error("changeType is not supported!");
20767
20257
  }
20768
20258
  addOrChangeSourceBuffers(e) {
20769
20259
  if (!e || typeof e != "object" || Object.keys(e).length === 0) throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");
@@ -20823,11 +20313,7 @@ var Cf = function(e) {
20823
20313
  });
20824
20314
  }
20825
20315
  removeAudio(e, t, n = Sf) {
20826
- if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
20827
- n();
20828
- return;
20829
- }
20830
- jf({
20316
+ !this.audioBuffered().length || this.audioBuffered().end(0) === 0 ? n() : jf({
20831
20317
  type: "audio",
20832
20318
  sourceUpdater: this,
20833
20319
  action: Af.remove(e, t),
@@ -20836,11 +20322,7 @@ var Cf = function(e) {
20836
20322
  });
20837
20323
  }
20838
20324
  removeVideo(e, t, n = Sf) {
20839
- if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
20840
- n();
20841
- return;
20842
- }
20843
- jf({
20325
+ !this.videoBuffered().length || this.videoBuffered().end(0) === 0 ? n() : jf({
20844
20326
  type: "video",
20845
20327
  sourceUpdater: this,
20846
20328
  action: Af.remove(e, t),
@@ -20924,22 +20406,16 @@ var Cf = function(e) {
20924
20406
  return this.state = "READY", this.resetEverything(), this.monitorBuffer_();
20925
20407
  }
20926
20408
  track(e) {
20927
- return e === void 0 ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e, this.state === "INIT" && this.couldBeginLoading_() && this.init_(), this.subtitlesTrack_);
20409
+ return e === void 0 || (this.subtitlesTrack_ = e, this.state === "INIT" && this.couldBeginLoading_() && this.init_()), this.subtitlesTrack_;
20928
20410
  }
20929
20411
  remove(e, t) {
20930
20412
  Xd(e, t, this.subtitlesTrack_);
20931
20413
  }
20932
20414
  fillBuffer_() {
20933
20415
  let e = this.chooseNextRequest_();
20934
- if (e) {
20935
- if (this.syncController_.timestampOffsetForTimeline(e.timeline) === null) {
20936
- this.syncController_.one("timestampoffset", () => {
20937
- this.state = "READY", this.paused() || this.monitorBuffer_();
20938
- }), this.state = "WAITING_ON_TIMELINE";
20939
- return;
20940
- }
20941
- this.loadSegment_(e);
20942
- }
20416
+ e && (this.syncController_.timestampOffsetForTimeline(e.timeline) === null ? (this.syncController_.one("timestampoffset", () => {
20417
+ this.state = "READY", this.paused() || this.monitorBuffer_();
20418
+ }), this.state = "WAITING_ON_TIMELINE") : this.loadSegment_(e));
20943
20419
  }
20944
20420
  timestampOffsetForSegment_() {
20945
20421
  return null;
@@ -20981,36 +20457,31 @@ var Cf = function(e) {
20981
20457
  let r = this.pendingSegment_, i = n.mp4VttCues && n.mp4VttCues.length;
20982
20458
  i && (r.mp4VttCues = n.mp4VttCues), this.saveBandwidthRelatedStats_(r.duration, t.stats), t.key && this.segmentKey(t.key, !0), this.state = "APPENDING", this.trigger("appending");
20983
20459
  let a = r.segment;
20984
- if (a.map && (a.map.bytes = t.map.bytes), r.bytes = t.bytes, typeof E.default.WebVTT != "function" && typeof this.loadVttJs == "function") {
20985
- this.state = "WAITING_ON_VTTJS", this.loadVttJs().then(() => this.segmentRequestFinished_(e, t, n), () => this.stopForError({ message: "Error loading vtt.js" }));
20986
- return;
20987
- }
20988
- a.requested = !0;
20989
- try {
20990
- this.parseVTTCues_(r);
20991
- } catch (e) {
20992
- this.stopForError({
20993
- message: e.message,
20994
- metadata: {
20995
- errorType: Q.Error.StreamingVttParserError,
20996
- error: e
20997
- }
20998
- });
20999
- return;
21000
- }
21001
- if (i || this.updateTimeMapping_(r, this.syncController_.timelines[r.timeline], this.playlist_), r.timingInfo = r.cues.length ? {
21002
- start: r.cues[0].startTime,
21003
- end: r.cues[r.cues.length - 1].endTime
21004
- } : {
21005
- start: r.startOfSegment,
21006
- end: r.startOfSegment + r.duration
21007
- }, r.isSyncRequest) {
21008
- this.trigger("syncinfoupdate"), this.pendingSegment_ = null, this.state = "READY";
21009
- return;
20460
+ if (a.map && (a.map.bytes = t.map.bytes), r.bytes = t.bytes, typeof E.default.WebVTT != "function" && typeof this.loadVttJs == "function") this.state = "WAITING_ON_VTTJS", this.loadVttJs().then(() => this.segmentRequestFinished_(e, t, n), () => this.stopForError({ message: "Error loading vtt.js" }));
20461
+ else {
20462
+ a.requested = !0;
20463
+ try {
20464
+ this.parseVTTCues_(r);
20465
+ } catch (e) {
20466
+ this.stopForError({
20467
+ message: e.message,
20468
+ metadata: {
20469
+ errorType: Q.Error.StreamingVttParserError,
20470
+ error: e
20471
+ }
20472
+ });
20473
+ return;
20474
+ }
20475
+ i || this.updateTimeMapping_(r, this.syncController_.timelines[r.timeline], this.playlist_), r.timingInfo = r.cues.length ? {
20476
+ start: r.cues[0].startTime,
20477
+ end: r.cues[r.cues.length - 1].endTime
20478
+ } : {
20479
+ start: r.startOfSegment,
20480
+ end: r.startOfSegment + r.duration
20481
+ }, r.isSyncRequest ? (this.trigger("syncinfoupdate"), this.pendingSegment_ = null, this.state = "READY") : (r.byteLength = r.bytes.byteLength, this.mediaSecondsLoaded += a.duration, r.cues.forEach((e) => {
20482
+ this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new E.default.VTTCue(e.startTime, e.endTime, e.text) : e);
20483
+ }), Zd(this.subtitlesTrack_), this.handleAppendsDone_());
21010
20484
  }
21011
- r.byteLength = r.bytes.byteLength, this.mediaSecondsLoaded += a.duration, r.cues.forEach((e) => {
21012
- this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new E.default.VTTCue(e.startTime, e.endTime, e.text) : e);
21013
- }), Zd(this.subtitlesTrack_), this.handleAppendsDone_();
21014
20485
  }
21015
20486
  handleData_(e, t) {
21016
20487
  let n = e && e.type === "vtt", r = t && t.type === "text";
@@ -21389,11 +20860,8 @@ var Cf = function(e) {
21389
20860
  }
21390
20861
  saveExpiredSegmentInfo(e, t) {
21391
20862
  let n = t.mediaSequence - e.mediaSequence;
21392
- if (n > Gf) {
21393
- Q.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);
21394
- return;
21395
- }
21396
- for (let r = n - 1; r >= 0; r--) {
20863
+ if (n > Gf) Q.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);
20864
+ else for (let r = n - 1; r >= 0; r--) {
21397
20865
  let n = e.segments[r];
21398
20866
  if (n && n.start !== void 0) {
21399
20867
  t.syncInfo = {
@@ -21652,13 +21120,7 @@ var Cf = function(e) {
21652
21120
  t.activePlaylistLoader = e, e.load();
21653
21121
  }, $f = (e, t) => () => {
21654
21122
  let { segmentLoaders: { [e]: n, main: r }, mediaTypes: { [e]: i } } = t, a = i.activeTrack(), o = i.getActiveGroup(), s = i.activePlaylistLoader, c = i.lastGroup_;
21655
- if (!(o && c && o.id === c.id) && (i.lastGroup_ = o, i.lastTrack_ = a, Zf(n, i), !(!o || o.isMainPlaylist))) {
21656
- if (!o.playlistLoader) {
21657
- s && r.resetEverything();
21658
- return;
21659
- }
21660
- n.resyncLoader(), Qf(o.playlistLoader, i);
21661
- }
21123
+ o && c && o.id === c.id || (i.lastGroup_ = o, i.lastTrack_ = a, Zf(n, i), o && !o.isMainPlaylist && (o.playlistLoader ? (n.resyncLoader(), Qf(o.playlistLoader, i)) : s && r.resetEverything()));
21662
21124
  }, ep = (e, t) => () => {
21663
21125
  let { segmentLoaders: { [e]: n }, mediaTypes: { [e]: r } } = t;
21664
21126
  r.lastGroup_ = null, n.abort(), n.pause();
@@ -21670,31 +21132,26 @@ var Cf = function(e) {
21670
21132
  let e = t.vhs.playlistController_, r = e.selectPlaylist();
21671
21133
  if (e.media() === r) return;
21672
21134
  a.logger_(`track change. Switching main audio from ${l.id} to ${o.id}`), n.pause(), i.resetEverything(), e.fastQualityChange_(r);
21673
- return;
21674
- }
21675
- if (e === "AUDIO") {
21676
- if (!s.playlistLoader) {
21677
- i.setAudio(!0), i.resetEverything();
21678
- return;
21135
+ } else {
21136
+ if (e === "AUDIO") {
21137
+ if (!s.playlistLoader) {
21138
+ i.setAudio(!0), i.resetEverything();
21139
+ return;
21140
+ }
21141
+ r.setAudio(!0), i.setAudio(!1);
21679
21142
  }
21680
- r.setAudio(!0), i.setAudio(!1);
21143
+ c === s.playlistLoader || (r.track && r.track(o), r.resetEverything()), Qf(s.playlistLoader, a);
21681
21144
  }
21682
- if (c === s.playlistLoader) {
21683
- Qf(s.playlistLoader, a);
21684
- return;
21685
- }
21686
- r.track && r.track(o), r.resetEverything(), Qf(s.playlistLoader, a);
21687
21145
  }
21688
21146
  }, np = {
21689
21147
  AUDIO: (e, t) => () => {
21690
21148
  let { mediaTypes: { [e]: n }, excludePlaylist: r } = t, i = n.activeTrack(), a = n.activeGroup(), o = (a.filter((e) => e.default)[0] || a[0]).id, s = n.tracks[o];
21691
- if (i === s) {
21692
- r({ error: { message: "Problem encountered loading the default audio track." } });
21693
- return;
21149
+ if (i === s) r({ error: { message: "Problem encountered loading the default audio track." } });
21150
+ else {
21151
+ Q.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
21152
+ for (let e in n.tracks) n.tracks[e].enabled = n.tracks[e] === s;
21153
+ n.onTrackChanged();
21694
21154
  }
21695
- Q.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
21696
- for (let e in n.tracks) n.tracks[e].enabled = n.tracks[e] === s;
21697
- n.onTrackChanged();
21698
21155
  },
21699
21156
  SUBTITLES: (e, t) => () => {
21700
21157
  let { mediaTypes: { [e]: n } } = t;
@@ -21921,15 +21378,7 @@ var Cf = function(e) {
21921
21378
  assignTagProperties(e, t) {
21922
21379
  this.manifestType_ = t.serverUri ? "HLS" : "DASH";
21923
21380
  let n = t.serverUri || t.serverURL;
21924
- if (!n) {
21925
- this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`), this.trigger("error");
21926
- return;
21927
- }
21928
- if (n.startsWith("data:")) {
21929
- this.decodeDataUriManifest_(n.substring(n.indexOf(",") + 1));
21930
- return;
21931
- }
21932
- this.steeringManifest.reloadUri = Hc(e, n), this.defaultPathway = t.pathwayId || t.defaultServiceLocation, this.queryBeforeStart = t.queryBeforeStart, this.proxyServerUrl_ = t.proxyServerURL, this.defaultPathway && !this.queryBeforeStart && this.trigger("content-steering");
21381
+ n ? n.startsWith("data:") ? this.decodeDataUriManifest_(n.substring(n.indexOf(",") + 1)) : (this.steeringManifest.reloadUri = Hc(e, n), this.defaultPathway = t.pathwayId || t.defaultServiceLocation, this.queryBeforeStart = t.queryBeforeStart, this.proxyServerUrl_ = t.proxyServerURL, this.defaultPathway && !this.queryBeforeStart && this.trigger("content-steering")) : (this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`), this.trigger("error"));
21933
21382
  }
21934
21383
  requestSteeringManifest(e) {
21935
21384
  let t = this.steeringManifest.reloadUri;
@@ -22463,11 +21912,7 @@ var Cf = function(e) {
22463
21912
  this.mainSegmentLoader_.pause(), this.mediaTypes_.AUDIO.activePlaylistLoader && this.audioSegmentLoader_.pause(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this.subtitleSegmentLoader_.pause();
22464
21913
  }
22465
21914
  fastQualityChange_(e = this.selectPlaylist()) {
22466
- if (e && e === this.mainPlaylistLoader_.media()) {
22467
- this.logger_("skipping fastQualityChange because new media is same as old");
22468
- return;
22469
- }
22470
- this.switchMedia_(e, "fast-quality"), this.waitingForFastQualityPlaylistReceived_ = !0;
21915
+ e && e === this.mainPlaylistLoader_.media() ? this.logger_("skipping fastQualityChange because new media is same as old") : (this.switchMedia_(e, "fast-quality"), this.waitingForFastQualityPlaylistReceived_ = !0);
22471
21916
  }
22472
21917
  runFastQualitySwitch_() {
22473
21918
  this.waitingForFastQualityPlaylistReceived_ = !1, this.mainSegmentLoader_.pause(), this.mainSegmentLoader_.resetEverything(), this.mediaTypes_.AUDIO.activePlaylistLoader && (this.audioSegmentLoader_.pause(), this.audioSegmentLoader_.resetEverything()), this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_.pause(), this.subtitleSegmentLoader_.resetEverything()), this.load();
@@ -22707,26 +22152,26 @@ var Cf = function(e) {
22707
22152
  },
22708
22153
  playlistExclusionDuration: Infinity
22709
22154
  });
22710
- return;
22711
- }
22712
- if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
22713
- let e = [];
22714
- if (["video", "audio"].forEach((t) => {
22715
- let n = (P(this.sourceUpdater_.codecs[t] || "")[0] || {}).type, i = (P(r[t] || "")[0] || {}).type;
22716
- n && i && n.toLowerCase() !== i.toLowerCase() && e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${r[t]}"`);
22717
- }), e.length) {
22718
- this.excludePlaylist({
22719
- playlistToExclude: t,
22720
- error: {
22721
- message: `Codec switching not supported: ${e.join(", ")}.`,
22722
- internal: !0
22723
- },
22724
- playlistExclusionDuration: Infinity
22725
- });
22726
- return;
22155
+ } else {
22156
+ if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
22157
+ let e = [];
22158
+ if (["video", "audio"].forEach((t) => {
22159
+ let n = (P(this.sourceUpdater_.codecs[t] || "")[0] || {}).type, i = (P(r[t] || "")[0] || {}).type;
22160
+ n && i && n.toLowerCase() !== i.toLowerCase() && e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${r[t]}"`);
22161
+ }), e.length) {
22162
+ this.excludePlaylist({
22163
+ playlistToExclude: t,
22164
+ error: {
22165
+ message: `Codec switching not supported: ${e.join(", ")}.`,
22166
+ internal: !0
22167
+ },
22168
+ playlistExclusionDuration: Infinity
22169
+ });
22170
+ return;
22171
+ }
22727
22172
  }
22173
+ return r;
22728
22174
  }
22729
- return r;
22730
22175
  }
22731
22176
  tryToCreateSourceBuffers_() {
22732
22177
  if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers() || !this.areMediaTypesKnown_()) return;
@@ -22753,7 +22198,7 @@ var Cf = function(e) {
22753
22198
  if (t.indexOf(r.id) !== -1 || r.excludeUntil === Infinity) return;
22754
22199
  t.push(r.id);
22755
22200
  let s = [], c = Xl(this.mainPlaylistLoader_.main, r), l = Yl(c);
22756
- if (!(!c.audio && !c.video)) {
22201
+ if (c.audio || c.video) {
22757
22202
  if (l !== i && s.push(`codec count "${l}" !== "${i}"`), !this.sourceUpdater_.canChangeType()) {
22758
22203
  let e = c.video && P(c.video)[0] || null, t = c.audio && P(c.audio)[0] || null;
22759
22204
  e && a && e.type.toLowerCase() !== a.type.toLowerCase() && s.push(`video codec "${e.type}" !== "${a.type}"`), t && o && t.type.toLowerCase() !== o.type.toLowerCase() && s.push(`audio codec "${t.type}" !== "${o.type}"`);
@@ -22799,11 +22244,7 @@ var Cf = function(e) {
22799
22244
  let e = this.main();
22800
22245
  if (e.contentSteering) {
22801
22246
  for (let t of e.playlists) this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));
22802
- if (this.contentSteeringController_.assignTagProperties(e.uri, e.contentSteering), this.contentSteeringController_.queryBeforeStart) {
22803
- this.contentSteeringController_.requestSteeringManifest(!0);
22804
- return;
22805
- }
22806
- this.tech_.one("canplay", () => {
22247
+ this.contentSteeringController_.assignTagProperties(e.uri, e.contentSteering), this.contentSteeringController_.queryBeforeStart ? this.contentSteeringController_.requestSteeringManifest(!0) : this.tech_.one("canplay", () => {
22807
22248
  this.contentSteeringController_.requestSteeringManifest();
22808
22249
  });
22809
22250
  }
@@ -22828,7 +22269,7 @@ var Cf = function(e) {
22828
22269
  let e = r.attributes.serviceLocation;
22829
22270
  if (e && (n.push(e), !t.has(e))) return !0;
22830
22271
  }
22831
- return !!(!n.length && t.size);
22272
+ return !(n.length || !t.size);
22832
22273
  })()) && this.resetContentSteeringController_();
22833
22274
  });
22834
22275
  }
@@ -22856,13 +22297,9 @@ var Cf = function(e) {
22856
22297
  for (let [e, r] of t.entries()) n.get(e) || (this.mainPlaylistLoader_.updateOrDeleteClone(r), this.contentSteeringController_.excludePathway(e));
22857
22298
  for (let [r, i] of n.entries()) {
22858
22299
  let n = t.get(r);
22859
- if (!n) {
22860
- e.filter((e) => e.attributes["PATHWAY-ID"] === i["BASE-ID"]).forEach((e) => {
22861
- this.mainPlaylistLoader_.addClonePathway(i, e);
22862
- }), this.contentSteeringController_.addAvailablePathway(r);
22863
- continue;
22864
- }
22865
- this.equalPathwayClones_(n, i) || (this.mainPlaylistLoader_.updateOrDeleteClone(i, !0), this.contentSteeringController_.addAvailablePathway(r));
22300
+ n ? this.equalPathwayClones_(n, i) || (this.mainPlaylistLoader_.updateOrDeleteClone(i, !0), this.contentSteeringController_.addAvailablePathway(r)) : (e.filter((e) => e.attributes["PATHWAY-ID"] === i["BASE-ID"]).forEach((e) => {
22301
+ this.mainPlaylistLoader_.addClonePathway(i, e);
22302
+ }), this.contentSteeringController_.addAvailablePathway(r));
22866
22303
  }
22867
22304
  this.contentSteeringController_.currentPathwayClones = new Map(JSON.parse(JSON.stringify([...n])));
22868
22305
  }
@@ -22883,7 +22320,7 @@ var Cf = function(e) {
22883
22320
  let e = 0, t = "non-usable";
22884
22321
  this.mainPlaylistLoader_.main.playlists.forEach((n) => {
22885
22322
  let r = this.mainPlaylistLoader_.getKeyIdSet(n);
22886
- !r || !r.size || r.forEach((r) => {
22323
+ r && r.size && r.forEach((r) => {
22887
22324
  let i = "usable", a = this.keyStatusMap_.has(r) && this.keyStatusMap_.get(r) === i, o = n.lastExcludeReason_ === t && n.excludeUntil === Infinity;
22888
22325
  a ? a && o && (delete n.excludeUntil, delete n.lastExcludeReason_, this.logger_(`enabling playlist ${n.id} because key ID ${r} is ${i}`)) : (n.excludeUntil !== Infinity && n.lastExcludeReason_ !== t && (n.excludeUntil = Infinity, n.lastExcludeReason_ = t, this.logger_(`excluding playlist ${n.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${i}`)), e++);
22889
22326
  });
@@ -22986,9 +22423,7 @@ var Cf = function(e) {
22986
22423
  type: "bufferedrangeschanged",
22987
22424
  metadata: n
22988
22425
  }), this.resetSegmentDownloads_(e);
22989
- return;
22990
- }
22991
- this[`${e}StalledDownloads_`]++, this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`, {
22426
+ } else this[`${e}StalledDownloads_`]++, this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`, {
22992
22427
  playlistId: n.playlist_ && n.playlist_.id,
22993
22428
  buffered: nl(r)
22994
22429
  }), !(this[`${e}StalledDownloads_`] < 10) && (this.logger_(`${e} loader stalled download exclusion`), this.resetSegmentDownloads_(e), this.tech_.trigger({
@@ -23033,13 +22468,10 @@ var Cf = function(e) {
23033
22468
  waiting_() {
23034
22469
  if (this.techWaiting_()) return;
23035
22470
  let e = this.tech_.currentTime(), t = Xc(this.tech_.buffered(), e);
23036
- if (t.length && e + 3 <= t.end(0)) {
23037
- this.resetTimeUpdate_(), this.tech_.setCurrentTime(e), this.logger_(`Stopped at ${e} while inside a buffered region [${t.start(0)} -> ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`), this.tech_.trigger({
23038
- type: "usage",
23039
- name: "vhs-unknown-waiting"
23040
- });
23041
- return;
23042
- }
22471
+ t.length && e + 3 <= t.end(0) && (this.resetTimeUpdate_(), this.tech_.setCurrentTime(e), this.logger_(`Stopped at ${e} while inside a buffered region [${t.start(0)} -> ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`), this.tech_.trigger({
22472
+ type: "usage",
22473
+ name: "vhs-unknown-waiting"
22474
+ }));
23043
22475
  }
23044
22476
  techWaiting_() {
23045
22477
  let e = this.seekable(), t = this.tech_.currentTime();
@@ -23131,18 +22563,12 @@ var Cf = function(e) {
23131
22563
  name: "vhs-error-reload"
23132
22564
  }), e.play());
23133
22565
  }, s = function() {
23134
- if (Date.now() - n < i.errorInterval * 1e3) {
23135
- e.trigger({
23136
- type: "usage",
23137
- name: "vhs-error-reload-canceled"
23138
- });
23139
- return;
23140
- }
23141
- if (!i.getSource || typeof i.getSource != "function") {
23142
- Q.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
23143
- return;
23144
- }
23145
- return n = Date.now(), i.getSource.call(e, o);
22566
+ if (Date.now() - n < i.errorInterval * 1e3) e.trigger({
22567
+ type: "usage",
22568
+ name: "vhs-error-reload-canceled"
22569
+ });
22570
+ else if (!i.getSource || typeof i.getSource != "function") Q.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
22571
+ else return n = Date.now(), i.getSource.call(e, o);
23146
22572
  }, c = function() {
23147
22573
  e.off("loadedmetadata", a), e.off("error", s), e.off("dispose", c);
23148
22574
  };
@@ -23169,11 +22595,7 @@ Object.keys(Uu).forEach((e) => {
23169
22595
  return Q.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`), Uu[e];
23170
22596
  },
23171
22597
  set(t) {
23172
- if (Q.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`), typeof t != "number" || t < 0) {
23173
- Q.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);
23174
- return;
23175
- }
23176
- Uu[e] = t;
22598
+ Q.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`), typeof t != "number" || t < 0 ? Q.log.warn(`value of Vhs.${e} must be greater than or equal to 0`) : Uu[e] = t;
23177
22599
  }
23178
22600
  });
23179
22601
  });
@@ -23217,11 +22639,7 @@ var Lp = (e, t, n) => {
23217
22639
  e.tech_.one("keysessioncreated", t);
23218
22640
  })), a.push(new Promise((n, r) => {
23219
22641
  e.eme.initializeMediaKeys({ keySystems: t }, (e) => {
23220
- if (e) {
23221
- r(e);
23222
- return;
23223
- }
23224
- n();
22642
+ e ? r(e) : n();
23225
22643
  });
23226
22644
  }));
23227
22645
  }), Promise.race([Promise.all(a), Promise.race(o)]);
@@ -23300,11 +22718,7 @@ var Jp = Q.getComponent("Component"), Yp = class extends Jp {
23300
22718
  let t = D.default.fullscreenElement || D.default.webkitFullscreenElement || D.default.mozFullScreenElement || D.default.msFullscreenElement;
23301
22719
  t && t.contains(this.tech_.el()) ? this.playlistController_.fastQualityChange_() : this.playlistController_.checkABR_();
23302
22720
  }), this.on(this.tech_, "seeking", function() {
23303
- if (this.ignoreNextSeekingEvent_) {
23304
- this.ignoreNextSeekingEvent_ = !1;
23305
- return;
23306
- }
23307
- this.setCurrentTime(this.tech_.currentTime());
22721
+ this.ignoreNextSeekingEvent_ ? this.ignoreNextSeekingEvent_ = !1 : this.setCurrentTime(this.tech_.currentTime());
23308
22722
  }), this.on(this.tech_, "error", function() {
23309
22723
  this.tech_.error() && this.playlistController_ && this.playlistController_.pauseLoading();
23310
22724
  }), this.on(this.tech_, "play", this.play);
@@ -23543,17 +22957,13 @@ var Jp = Q.getComponent("Component"), Yp = class extends Jp {
23543
22957
  media: this.playlists.media(),
23544
22958
  audioMedia: e && e.media()
23545
22959
  });
23546
- if (this.player_.tech_.on("keystatuschange", (e) => {
22960
+ this.player_.tech_.on("keystatuschange", (e) => {
23547
22961
  this.playlistController_.updatePlaylistByKeyStatus(e.keyId, e.status);
23548
- }), this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this), this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_), !t) {
23549
- this.playlistController_.sourceUpdater_.initializedEme();
23550
- return;
23551
- }
23552
- this.createKeySessions_();
22962
+ }), this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this), this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_), t ? this.createKeySessions_() : this.playlistController_.sourceUpdater_.initializedEme();
23553
22963
  }
23554
22964
  setupQualityLevels_() {
23555
22965
  let e = Q.players[this.tech_.options_.playerId];
23556
- !e || !e.qualityLevels || this.qualityLevels_ || (this.qualityLevels_ = e.qualityLevels(), this.playlistController_.on("selectedinitialmedia", () => {
22966
+ e && e.qualityLevels && !this.qualityLevels_ && (this.qualityLevels_ = e.qualityLevels(), this.playlistController_.on("selectedinitialmedia", () => {
23557
22967
  Ip(this.qualityLevels_, this);
23558
22968
  }), this.playlists.on("mediachange", () => {
23559
22969
  Fp(this.qualityLevels_, this.playlists);
@@ -23686,7 +23096,7 @@ var $p = class extends n(o) {
23686
23096
  }
23687
23097
  #t() {
23688
23098
  let e = this.querySelectorAll("source");
23689
- if (!(e.length === 0 && !this.src)) return this.src ? [{ src: this.src }] : Array.from(e).map((e) => ({
23099
+ if (e.length !== 0 || this.src) return this.src ? [{ src: this.src }] : Array.from(e).map((e) => ({
23690
23100
  src: e.getAttribute("src"),
23691
23101
  type: e.getAttribute("type")
23692
23102
  }));