@videojs/html 10.0.0-beta.12 → 10.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/audio-minimal.dev.js +4 -4
- package/cdn/audio-minimal.js +1 -1
- package/cdn/audio.dev.js +4 -4
- package/cdn/audio.js +1 -1
- package/cdn/background.dev.js +3 -3
- package/cdn/background.js +1 -1
- package/cdn/{create-player-BoPlCSNw.js → create-player-C2h3JeGl.js} +2 -2
- package/cdn/{create-player-BoPlCSNw.js.map → create-player-C2h3JeGl.js.map} +1 -1
- package/cdn/{create-player-CA3KLZMe.js → create-player-i0Q36S9_.js} +2 -2
- package/cdn/{create-player-CA3KLZMe.js.map → create-player-i0Q36S9_.js.map} +1 -1
- package/cdn/{delegate-CSc5c0ZR.js → delegate-AoR5Pt_6.js} +2 -2
- package/cdn/{delegate-CSc5c0ZR.js.map → delegate-AoR5Pt_6.js.map} +1 -1
- package/cdn/{delegate-jczJeizF.js → delegate-odoSeh7c.js} +2 -2
- package/cdn/{delegate-jczJeizF.js.map → delegate-odoSeh7c.js.map} +1 -1
- package/cdn/{hls-DQ4glyHe.js → hls-CNDMNsEo.js} +2 -2
- package/cdn/hls-CNDMNsEo.js.map +1 -0
- package/cdn/{hls-C6htsSW4.js → hls-DHwATYV2.js} +4 -2
- package/cdn/hls-DHwATYV2.js.map +1 -0
- package/cdn/media/dash-video.dev.js +3 -3
- package/cdn/media/dash-video.js +1 -1
- package/cdn/media/hls-video.dev.js +3 -3
- package/cdn/media/hls-video.js +1 -1
- package/cdn/media/mux-video.dev.js +5 -5
- package/cdn/media/mux-video.dev.js.map +1 -1
- package/cdn/media/mux-video.js +1 -1
- package/cdn/media/mux-video.js.map +1 -1
- package/cdn/media/simple-hls-video.dev.js +3 -3
- package/cdn/media/simple-hls-video.js +1 -1
- package/cdn/{media-attach-mixin-BIrlT_tz.js → media-attach-mixin-ByJOWMNT.js} +2 -2
- package/cdn/{media-attach-mixin-BIrlT_tz.js.map → media-attach-mixin-ByJOWMNT.js.map} +1 -1
- package/cdn/{media-attach-mixin-Dsn4gxJA.js → media-attach-mixin-CkU58gjb.js} +2 -2
- package/cdn/{media-attach-mixin-Dsn4gxJA.js.map → media-attach-mixin-CkU58gjb.js.map} +1 -1
- package/cdn/{player-rkxd0mpV.js → player-BWRklsUx.js} +3 -3
- package/cdn/{player-rkxd0mpV.js.map → player-BWRklsUx.js.map} +1 -1
- package/cdn/player-DOTrw60d.js +2 -0
- package/cdn/{player-Dzvu8Tzs.js.map → player-DOTrw60d.js.map} +1 -1
- package/cdn/{poster-DqjXzMK_.js → poster-CRi_NWaR.js} +2 -2
- package/cdn/{poster-DqjXzMK_.js.map → poster-CRi_NWaR.js.map} +1 -1
- package/cdn/{poster-BPMPXyn3.js → poster-Ds1EOmmU.js} +4 -4
- package/cdn/{poster-BPMPXyn3.js.map → poster-Ds1EOmmU.js.map} +1 -1
- package/cdn/{safe-define-D26LrTu4.js → safe-define-Bw8JF08z.js} +11 -2
- package/cdn/{safe-define-D26LrTu4.js.map → safe-define-Bw8JF08z.js.map} +1 -1
- package/cdn/{safe-define-EEn8NTOG.js → safe-define-t0AGOouq.js} +2 -2
- package/cdn/{safe-define-EEn8NTOG.js.map → safe-define-t0AGOouq.js.map} +1 -1
- package/cdn/video-minimal.dev.js +4 -4
- package/cdn/video-minimal.js +1 -1
- package/cdn/video.dev.js +4 -4
- package/cdn/video.js +1 -1
- package/cdn/{volume-slider-CQ0Yq947.js → volume-slider-C7rEWi11.js} +2 -2
- package/cdn/{volume-slider-CQ0Yq947.js.map → volume-slider-C7rEWi11.js.map} +1 -1
- package/cdn/{volume-slider-BEXiB6_j.js → volume-slider-Dz_ND_4U.js} +3 -3
- package/cdn/{volume-slider-BEXiB6_j.js.map → volume-slider-Dz_ND_4U.js.map} +1 -1
- package/package.json +8 -8
- package/cdn/hls-C6htsSW4.js.map +0 -1
- package/cdn/hls-DQ4glyHe.js.map +0 -1
- package/cdn/player-Dzvu8Tzs.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as defineClassPropHooks } from "./safe-define-
|
|
1
|
+
import { s as defineClassPropHooks } from "./safe-define-Bw8JF08z.js";
|
|
2
2
|
|
|
3
3
|
//#region ../core/dist/dev/core/media/delegate.js
|
|
4
4
|
/** Wrap `source.dispatchEvent` so every event is also re-dispatched on `target`. */
|
|
@@ -54,4 +54,4 @@ function DelegateMixin(BaseClass, DelegateClass) {
|
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { bridgeEvents as n, DelegateMixin as t };
|
|
57
|
-
//# sourceMappingURL=delegate-
|
|
57
|
+
//# sourceMappingURL=delegate-AoR5Pt_6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate-
|
|
1
|
+
{"version":3,"file":"delegate-AoR5Pt_6.js","names":["#delegate"],"sources":["../../core/dist/dev/core/media/delegate.js"],"sourcesContent":["import { defineClassPropHooks } from \"../utils/define-class-prop-hooks.js\";\n//#region src/core/media/delegate.ts\n/** Wrap `source.dispatchEvent` so every event is also re-dispatched on `target`. */\nfunction bridgeEvents(source, target) {\n\tconst origDispatch = source.dispatchEvent.bind(source);\n\tsource.dispatchEvent = (event) => {\n\t\tconst result = origDispatch(event);\n\t\ttarget.dispatchEvent(new event.constructor(event.type, event));\n\t\treturn result;\n\t};\n}\n/**\n* Mixin that intercepts `get`, `set`, and `call` to delegate property access\n* and method calls to an instance of `DelegateClass` before falling through\n* to the base class implementation.\n*\n* Works with both `CustomMediaMixin` and `ProxyMixin`.\n*/\nfunction DelegateMixin(BaseClass, DelegateClass) {\n\tclass DelegateImpl extends BaseClass {\n\t\t#delegate = new DelegateClass();\n\t\tconstructor(...args) {\n\t\t\tsuper(...args);\n\t\t\tif (this.#delegate instanceof EventTarget) bridgeEvents(this.#delegate, this);\n\t\t}\n\t\tget(prop) {\n\t\t\tif (prop in this.#delegate) return this.#delegate[prop];\n\t\t\treturn super.get?.(prop);\n\t\t}\n\t\tset(prop, val) {\n\t\t\tif (prop in this.#delegate) {\n\t\t\t\tthis.#delegate[prop] = val;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsuper.set?.(prop, val);\n\t\t}\n\t\tcall(prop, ...args) {\n\t\t\tif (prop in this.#delegate) return this.#delegate[prop](...args);\n\t\t\treturn super.call?.(prop, ...args);\n\t\t}\n\t\tattach(target) {\n\t\t\tsuper.attach?.(target);\n\t\t\tthis.#delegate.attach?.(target);\n\t\t}\n\t\tdetach() {\n\t\t\tthis.#delegate.detach?.();\n\t\t\tsuper.detach?.();\n\t\t}\n\t}\n\tfor (let proto = DelegateClass.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) defineClassPropHooks(DelegateImpl, proto);\n\treturn DelegateImpl;\n}\n//#endregion\nexport { DelegateMixin, bridgeEvents };\n\n//# sourceMappingURL=delegate.js.map"],"mappings":";;;;AAGA,SAAS,aAAa,QAAQ,QAAQ;CACrC,MAAM,eAAe,OAAO,cAAc,KAAK,OAAO;AACtD,QAAO,iBAAiB,UAAU;EACjC,MAAM,SAAS,aAAa,MAAM;AAClC,SAAO,cAAc,IAAI,MAAM,YAAY,MAAM,MAAM,MAAM,CAAC;AAC9D,SAAO;;;;;;;;;;AAUT,SAAS,cAAc,WAAW,eAAe;CAChD,MAAM,qBAAqB,UAAU;EACpC,YAAY,IAAI,eAAe;EAC/B,YAAY,GAAG,MAAM;AACpB,SAAM,GAAG,KAAK;AACd,OAAI,MAAKA,oBAAqB,YAAa,cAAa,MAAKA,UAAW,KAAK;;EAE9E,IAAI,MAAM;AACT,OAAI,QAAQ,MAAKA,SAAW,QAAO,MAAKA,SAAU;AAClD,UAAO,MAAM,MAAM,KAAK;;EAEzB,IAAI,MAAM,KAAK;AACd,OAAI,QAAQ,MAAKA,UAAW;AAC3B,UAAKA,SAAU,QAAQ;AACvB;;AAED,SAAM,MAAM,MAAM,IAAI;;EAEvB,KAAK,MAAM,GAAG,MAAM;AACnB,OAAI,QAAQ,MAAKA,SAAW,QAAO,MAAKA,SAAU,MAAM,GAAG,KAAK;AAChE,UAAO,MAAM,OAAO,MAAM,GAAG,KAAK;;EAEnC,OAAO,QAAQ;AACd,SAAM,SAAS,OAAO;AACtB,SAAKA,SAAU,SAAS,OAAO;;EAEhC,SAAS;AACR,SAAKA,SAAU,UAAU;AACzB,SAAM,UAAU;;;AAGlB,MAAK,IAAI,QAAQ,cAAc,WAAW,SAAS,UAAU,OAAO,WAAW,QAAQ,OAAO,eAAe,MAAM,CAAE,sBAAqB,cAAc,MAAM;AAC9J,QAAO"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as e}from"./safe-define-
|
|
2
|
-
//# sourceMappingURL=delegate-
|
|
1
|
+
import{s as e}from"./safe-define-t0AGOouq.js";function t(e,t){let n=e.dispatchEvent.bind(e);e.dispatchEvent=e=>{let r=n(e);return t.dispatchEvent(new e.constructor(e.type,e)),r}}function n(n,r){class i extends n{#e=new r;constructor(...e){super(...e),this.#e instanceof EventTarget&&t(this.#e,this)}get(e){return e in this.#e?this.#e[e]:super.get?.(e)}set(e,t){if(e in this.#e){this.#e[e]=t;return}super.set?.(e,t)}call(e,...t){return e in this.#e?this.#e[e](...t):super.call?.(e,...t)}attach(e){super.attach?.(e),this.#e.attach?.(e)}detach(){this.#e.detach?.(),super.detach?.()}}for(let t=r.prototype;t&&t!==Object.prototype;t=Object.getPrototypeOf(t))e(i,t);return i}export{t as n,n as t};
|
|
2
|
+
//# sourceMappingURL=delegate-odoSeh7c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate-
|
|
1
|
+
{"version":3,"file":"delegate-odoSeh7c.js","names":["#delegate"],"sources":["../../core/dist/default/core/media/delegate.js"],"sourcesContent":["import { defineClassPropHooks } from \"../utils/define-class-prop-hooks.js\";\n//#region src/core/media/delegate.ts\n/** Wrap `source.dispatchEvent` so every event is also re-dispatched on `target`. */\nfunction bridgeEvents(source, target) {\n\tconst origDispatch = source.dispatchEvent.bind(source);\n\tsource.dispatchEvent = (event) => {\n\t\tconst result = origDispatch(event);\n\t\ttarget.dispatchEvent(new event.constructor(event.type, event));\n\t\treturn result;\n\t};\n}\n/**\n* Mixin that intercepts `get`, `set`, and `call` to delegate property access\n* and method calls to an instance of `DelegateClass` before falling through\n* to the base class implementation.\n*\n* Works with both `CustomMediaMixin` and `ProxyMixin`.\n*/\nfunction DelegateMixin(BaseClass, DelegateClass) {\n\tclass DelegateImpl extends BaseClass {\n\t\t#delegate = new DelegateClass();\n\t\tconstructor(...args) {\n\t\t\tsuper(...args);\n\t\t\tif (this.#delegate instanceof EventTarget) bridgeEvents(this.#delegate, this);\n\t\t}\n\t\tget(prop) {\n\t\t\tif (prop in this.#delegate) return this.#delegate[prop];\n\t\t\treturn super.get?.(prop);\n\t\t}\n\t\tset(prop, val) {\n\t\t\tif (prop in this.#delegate) {\n\t\t\t\tthis.#delegate[prop] = val;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsuper.set?.(prop, val);\n\t\t}\n\t\tcall(prop, ...args) {\n\t\t\tif (prop in this.#delegate) return this.#delegate[prop](...args);\n\t\t\treturn super.call?.(prop, ...args);\n\t\t}\n\t\tattach(target) {\n\t\t\tsuper.attach?.(target);\n\t\t\tthis.#delegate.attach?.(target);\n\t\t}\n\t\tdetach() {\n\t\t\tthis.#delegate.detach?.();\n\t\t\tsuper.detach?.();\n\t\t}\n\t}\n\tfor (let proto = DelegateClass.prototype; proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) defineClassPropHooks(DelegateImpl, proto);\n\treturn DelegateImpl;\n}\n//#endregion\nexport { DelegateMixin, bridgeEvents };\n\n//# sourceMappingURL=delegate.js.map"],"mappings":"8CAGA,SAAS,EAAa,EAAQ,EAAQ,CACrC,IAAM,EAAe,EAAO,cAAc,KAAK,EAAO,CACtD,EAAO,cAAiB,GAAU,CACjC,IAAM,EAAS,EAAa,EAAM,CAElC,OADA,EAAO,cAAc,IAAI,EAAM,YAAY,EAAM,KAAM,EAAM,CAAC,CACvD,GAUT,SAAS,EAAc,EAAW,EAAe,CAChD,MAAM,UAAqB,CAAU,CACpC,GAAY,IAAI,EAChB,YAAY,GAAG,EAAM,CACpB,MAAM,GAAG,EAAK,CACV,MAAA,aAA0B,aAAa,EAAa,MAAA,EAAgB,KAAK,CAE9E,IAAI,EAAM,CAET,OADI,KAAQ,MAAA,EAAuB,MAAA,EAAe,GAC3C,MAAM,MAAM,EAAK,CAEzB,IAAI,EAAM,EAAK,CACd,GAAI,KAAQ,MAAA,EAAgB,CAC3B,MAAA,EAAe,GAAQ,EACvB,OAED,MAAM,MAAM,EAAM,EAAI,CAEvB,KAAK,EAAM,GAAG,EAAM,CAEnB,OADI,KAAQ,MAAA,EAAuB,MAAA,EAAe,GAAM,GAAG,EAAK,CACzD,MAAM,OAAO,EAAM,GAAG,EAAK,CAEnC,OAAO,EAAQ,CACd,MAAM,SAAS,EAAO,CACtB,MAAA,EAAe,SAAS,EAAO,CAEhC,QAAS,CACR,MAAA,EAAe,UAAU,CACzB,MAAM,UAAU,EAGlB,IAAK,IAAI,EAAQ,EAAc,UAAW,GAAS,IAAU,OAAO,UAAW,EAAQ,OAAO,eAAe,EAAM,CAAE,EAAqB,EAAc,EAAM,CAC9J,OAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./shallow-equal-zo2IZwso.js";import{t}from"./listen-UqQNdlqV.js";import{n,t as r}from"./delegate-jczJeizF.js";import{n as i}from"./media-props-mixin-BuVUebRp.js";var a=class extends EventTarget{#e=null;#t=``;#n=`metadata`;get target(){return this.#e}get engine(){return null}get error(){return this.target?.error??null}get src(){return this.#t}set src(e){this.#t=e,this.#e&&(this.#e.src=e)}get preload(){return this.#n??`metadata`}set preload(e){this.#n=e,this.#e&&(this.#e.preload=e)}attach(e){this.#e=e}detach(){this.#e=null}destroy(){this.#e=null}},o=class e extends Error{static MEDIA_ERR_ABORTED=1;static MEDIA_ERR_NETWORK=2;static MEDIA_ERR_DECODE=3;static MEDIA_ERR_SRC_NOT_SUPPORTED=4;static MEDIA_ERR_ENCRYPTED=5;static MEDIA_ERR_CUSTOM=100;static defaultMessages={1:`You aborted the media playback`,2:`A network error caused the media download to fail.`,3:`A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.`,4:`An unsupported error occurred. The server or network failed, or your browser does not support this format.`,5:`The media is encrypted and there are no keys to decrypt it.`};name;code;context;fatal;data;constructor(t,n=e.MEDIA_ERR_CUSTOM,r,i){super(t),this.name=`MediaError`,this.code=n,this.context=i,this.fatal=r??(n>=e.MEDIA_ERR_NETWORK&&n<=e.MEDIA_ERR_ENCRYPTED),this.message||=e.defaultMessages[this.code]??``}};const s=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},c=Number.isSafeInteger||function(e){return typeof e==`number`&&Math.abs(e)<=l},l=2**53-1||9007199254740991;let u=function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e}({}),d=function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,e.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,e.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,e.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.ATTACH_MEDIA_ERROR=`attachMediaError`,e.UNKNOWN=`unknown`,e}({}),f=function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.MEDIA_ENDED=`hlsMediaEnded`,e.STALL_RESOLVED=`hlsStallResolved`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFERED_TO_END=`hlsBufferedToEnd`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUpdated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,e.ASSET_LIST_LOADING=`hlsAssetListLoading`,e.ASSET_LIST_LOADED=`hlsAssetListLoaded`,e.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,e.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,e.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,e.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,e.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,e.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,e.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,e.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,e.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,e.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,e.EVENT_CUE_ENTER=`hlsEventCueEnter`,e}({});var p={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`},m={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`},h=class{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){let n=this.alpha_**+e;this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-this.alpha_**+this.totalWeight_;if(e)return this.estimate_/e}return this.estimate_}},g=class{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new h(e),this.fast_=new h(t),this.defaultTTFB_=r,this.ttfb_=new h(e)}update(e,t){let{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new h(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new h(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new h(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){let t=e/1e3,n=Math.sqrt(2)*Math.exp(-(t**2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function _(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?y(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function S(e){var t=x(e,`string`);return typeof t==`symbol`?t:t+``}var C=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let n=`[${e}]:`;this.trace=w,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}};const w=function(){},T={trace:w,debug:w,log:w,warn:w,info:w,error:w};function E(){return v({},T)}function D(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):w}function O(e,t,n){return t[e]?t[e].bind(t):D(e,n)}const k=E();function A(e,t,n){let r=E();if(typeof console==`object`&&e===!0||typeof e==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(t=>{r[t]=O(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch{return E()}i.forEach(t=>{k[t]=O(t,e)})}else v(k,r);return r}const j=k;function M(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function N(e){return typeof self<`u`&&e===self.ManagedMediaSource}function P(e,t){let n=Object.keys(e),r=Object.keys(t),i=n.length,a=r.length;return!i||!a||i===a&&!n.some(e=>r.indexOf(e)===-1)}function F(e,t=!1){if(typeof TextDecoder<`u`){let n=new TextDecoder(`utf-8`).decode(e);if(t){let e=n.indexOf(`\0`);return e===-1?n:n.substring(0,e)}return n.replace(/\0/g,``)}let n=e.length,r,i,a,o=``,s=0;for(;s<n;){if(r=e[s++],r===0&&t)return o;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((r&31)<<6|i&63);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((r&15)<<12|(i&63)<<6|(a&63)<<0);break}}return o}function I(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t}function ee(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var ne={exports:{}},re;function ie(){return re?ne.exports:(re=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw Error(`Error trying to parse relative URL.`);if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw Error(`Error trying to parse base URL.`);if(!s.netLoc&&s.path&&s.path[0]!==`/`){var c=r.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path=`/`);var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,a.path[0]!==`/`))if(!a.path)l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));else{var u=s.path,d=u.substring(0,u.lastIndexOf(`/`)+1)+a.path;l.path=o.normalizePath(d)}return l.path===null&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(i,``);e.length!==(e=e.replace(a,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o})()})(ne),ne.exports)}var ae=ie(),oe=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},L={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`},se=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,de(this,`stats`)}setByteRange(e,t){let n=e.split(`@`,2),r;r=n.length===1?t?.byteRangeEndOffset||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[L.AUDIO]:null,[L.VIDEO]:null,[L.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new oe),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ae.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[L.AUDIO]=null,e[L.VIDEO]=null,e[L.AUDIOVIDEO]=null}};function R(e){return e.sn!==`initSegment`}var ce=class extends se{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(s(e)&&s(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||=t.identity.getDecryptData(this.sn);else if(!((e=this._decryptdata)!=null&&e.keyId)){let e=Object.keys(t);if(e.length===1){let n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=s(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let e=Object.keys(this.levelkeys),n=e.length;if(n>1||n===1&&(t=this.levelkeys[e[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!s(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return R(this)?(this._ref||={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime},this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var n;let r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,a=!1){let{elementaryStreams:o}=this,s=o[e];if(!s){o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:a};return}s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)}},le=class extends se{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=r;let a=e.enumeratedString(`BYTERANGE`);a&&this.setByteRange(a,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function ue(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||ue(n,t)}function de(e,t){let n=ue(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}const fe=2**32-1,pe=[].push,me={video:1,audio:2,id3:3,text:4};function z(e){return String.fromCharCode.apply(null,e)}function he(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function B(e,t){let n=_e(e,t);return n<0?4294967296+n:n}function ge(e,t){let n=B(e,t);return n*=2**32,n+=B(e,t+4),n}function _e(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ve(e){let t=e.byteLength;for(let n=0;n<t;){let r=B(e,n);if(r>8&&e[n+4]===109&&e[n+5]===111&&e[n+6]===111&&e[n+7]===102)return!0;n=r>1?n+r:t}return!1}function V(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let i=0;i<r;){let a=B(e,i),o=z(e.subarray(i+4,i+8)),s=a>1?i+a:r;if(o===t[0])if(t.length===1)n.push(e.subarray(i+8,s));else{let r=V(e.subarray(i+8,s),t.slice(1));r.length&&pe.apply(n,r)}i=s}return n}function ye(e){let t=[],n=e[0],r=8,i=B(e,r);r+=4;let a=0,o=0;n===0?(a=B(e,r),o=B(e,r+4),r+=8):(a=ge(e,r),o=ge(e,r+8),r+=16),r+=2;let s=e.length+o,c=he(e,r);r+=2;for(let n=0;n<c;n++){let n=r,a=B(e,n);n+=4;let o=a&2147483647;if((a&2147483648)>>>31==1)return j.warn(`SIDX has hierarchical references (not supported)`),null;let c=B(e,n);n+=4,t.push({referenceSize:o,subsegmentDuration:c,info:{duration:c/i,start:s,end:s+o-1}}),s+=o,n+=4,r=n}return{earliestPresentationTime:a,timescale:i,version:n,referencesCount:c,references:t}}function be(e){let t=[],n=V(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],i=V(r,[`tkhd`])[0];if(i){let e=i[0],n=B(i,e===0?12:20),a=V(r,[`mdia`,`mdhd`])[0];if(a){e=a[0];let i=B(a,e===0?12:20),o=V(r,[`mdia`,`hdlr`])[0];if(o){let e=z(o.subarray(8,12)),a={soun:L.AUDIO,vide:L.VIDEO}[e],s=V(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],c=xe(s);a?(t[n]={timescale:i,type:a,stsd:c},t[a]=b({timescale:i,id:n},c)):t[n]={timescale:i,type:e,stsd:c}}}}}return V(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[B(e,4)];n&&(n.default={duration:B(e,12),flags:B(e,20)})}),t}function xe(e){let t=e.subarray(8),n=t.subarray(86),r=z(t.subarray(4,8)),i=r,a,o=r===`enca`||r===`encv`;o&&V(V(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=V(e,[`schm`])[0];if(t){let n=z(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=V(e,[`frma`])[0];t&&(i=z(t))}}});let s=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=V(n,[`avcC`])[0];e&&e.length>3&&(i+=`.`+Te(e[1])+Te(e[2])+Te(e[3]),a=Se(s===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=V(t,[r])[0],n=V(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=we(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=we(n,e);let r=n[e++];if(r===64)i+=`.`+Te(r);else break;if(e+=12,n[e++]!==5)break;e=we(n,e);let a=n[e++],o=(a&248)>>3;o===31&&(o+=1+((a&7)<<3)+((n[e]&224)>>5)),i+=`.`+o}break}case`hvc1`:case`hev1`:{let e=V(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,a=B(e,2),o=(t&32)>>5?`H`:`L`,s=e[12],c=e.subarray(6,12);i+=`.`+n+r,i+=`.`+Ce(a).toString(16).toUpperCase(),i+=`.`+o+s;let l=``;for(let e=c.length;e--;){let t=c[e];(t||l)&&(l=`.`+t.toString(16).toUpperCase()+l)}i+=l}a=Se(s==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=Se(i,n)||i;break;case`vp09`:{let e=V(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;i+=`.`+Ee(t)+`.`+Ee(n)+`.`+Ee(r)}break}case`av01`:{let e=V(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,o=e[2]>>>7?`H`:`M`,s=(e[2]&64)>>6,c=(e[2]&32)>>5,l=t===2&&s?c?12:10:s?10:8,u=(e[2]&16)>>4,d=(e[2]&8)>>3,f=(e[2]&4)>>2,p=e[2]&3;i+=`.`+t+`.`+Ee(r)+o+`.`+Ee(l)+`.`+u+`.`+d+f+p+`.`+Ee(1)+`.`+Ee(1)+`.`+Ee(1)+`.0`,a=Se(`dav1`,n)}break}}return{codec:i,encrypted:o,supplemental:a}}function Se(e,t){let n=V(t,[`dvvC`]),r=n.length?n[0]:V(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+Ee(t)+`.`+Ee(n)}}function Ce(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function we(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function Te(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function Ee(e){return(e<10?`0`:``)+e}function De(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&ke(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(j.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${I(r)} -> ${I(n)}`),e.set(n,8))})}function Oe(e){let t=[];return ke(e,e=>t.push(e.subarray(8,24))),t}function ke(e,t){V(e,[`moov`,`trak`]).forEach(e=>{let n=V(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),i=V(r,[`enca`]),a=i.length>0;a||(i=V(r,[`encv`])),i.forEach(e=>{V(a?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=Ae(e);n&&t(n,a)})})})}function Ae(e){let t=V(e,[`schm`])[0];if(t){let n=z(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=V(e,[`schi`,`tenc`])[0];if(t)return t}}}function je(e,t,n){let r={},i=V(e,[`moof`,`traf`]);for(let e=0;e<i.length;e++){let a=i[e],o=V(a,[`tfhd`])[0],c=B(o,4),l=t[c];if(!l)continue;r[c]||(r[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});let u=r[c],d=V(a,[`tfdt`])[0];if(d){let e=d[0],t=B(d,4);e===1&&(t===fe?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=fe+1,t+=B(d,8))),s(t)&&(!s(u.start)||t<u.start)&&(u.start=t)}let f=l.default,p=B(o,0)|f?.flags,m=f?.duration||0;p&8&&(m=p&2?B(o,12):B(o,8));let h=V(a,[`trun`]),g=u.start||0,_=0,v=m;for(let e=0;e<h.length;e++){let t=h[e],n=B(t,4),r=u.sampleCount;u.sampleCount+=n;let i=t[3]&1,a=t[3]&4,o=t[2]&1,s=t[2]&2,c=t[2]&4,l=t[2]&8,d=8,f=n;for(i&&(d+=4),a&&n&&(!(t[d+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=r),d+=4,o?(v=B(t,d),d+=4):v=m,s&&(d+=4),l&&(d+=4),g+=v,_+=v,f--);f--;)o?(v=B(t,d),d+=4):v=m,s&&(d+=4),c&&(t[d+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(f+1),u.keyFrameStart=g),d+=4),l&&(d+=4),g+=v,_+=v;!_&&m&&(_+=m*n)}u.duration+=_}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,i=V(e,[`sidx`]);for(let e=0;e<i.length;e++){let r=ye(i[e]);if(r!=null&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);n=Math.max(n,e+r.earliestPresentationTime/r.timescale)}}n&&s(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function Me(e){let t={valid:null,remainder:null},n=V(e,[`moof`]);if(n.length<2)return t.remainder=e,t;let r=n[n.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}function Ne(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Pe(e,t){let n=[],r=t.samples,i=t.timescale,a=t.id,o=!1;return V(r,[`moof`]).map(s=>{let c=s.byteOffset-8;V(s,[`traf`]).map(s=>{let l=V(s,[`tfdt`]).map(e=>{let t=e[0],n=B(e,4);return t===1&&(n*=2**32,n+=B(e,8)),n/i})[0];return l!==void 0&&(e=l),V(s,[`tfhd`]).map(l=>{let u=B(l,4),d=B(l,0)&16777215,f=(d&1)!=0,p=(d&2)!=0,m=(d&8)!=0,h=0,g=(d&16)!=0,_=0,v=(d&32)!=0,y=8;u===a&&(f&&(y+=8),p&&(y+=4),m&&(h=B(l,y),y+=4),g&&(_=B(l,y),y+=4),v&&(y+=4),t.type===`video`&&(o=Fe(t.codec)),V(s,[`trun`]).map(a=>{let s=a[0],l=B(a,0)&16777215,u=(l&1)!=0,d=0,f=(l&4)!=0,p=(l&256)!=0,m=0,g=(l&512)!=0,v=0,y=(l&1024)!=0,b=(l&2048)!=0,x=0,S=B(a,4),C=8;u&&(d=B(a,C),C+=4),f&&(C+=4);let w=d+c;for(let c=0;c<S;c++){if(p?(m=B(a,C),C+=4):m=h,g?(v=B(a,C),C+=4):v=_,y&&(C+=4),b&&(x=s===0?B(a,C):_e(a,C),C+=4),t.type===L.VIDEO){let t=0;for(;t<v;){let a=B(r,w);w+=4,Ie(o,r[w])&&Le(r.subarray(w,w+a),o?2:1,e+x/i,n),w+=a,t+=a+4}}e+=m/i}}))})})}),n}function Fe(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function Ie(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function Le(e,t,n,r){let i=Re(e),a=0;a+=t;let o=0,s=0,c=0;for(;a<i.length;){o=0;do{if(a>=i.length)break;c=i[a++],o+=c}while(c===255);s=0;do{if(a>=i.length)break;c=i[a++],s+=c}while(c===255);let e=i.length-a,t=a;if(s<e)a+=s;else if(s>e){j.error(`Malformed SEI payload. ${s} is too small, only ${e} bytes left to parse.`);break}if(o===4){if(i[t++]===181){let e=he(i,t);if(t+=2,e===49){let e=B(i,t);if(t+=4,e===1195456820){let e=i[t++];if(e===3){let a=i[t++],s=31&a,c=64&a,l=c?2+s*3:0,u=new Uint8Array(l);if(c){u[0]=a;for(let e=1;e<l;e++)u[e]=i[t++]}r.push({type:e,payloadType:o,pts:n,bytes:u})}}}}}else if(o===5&&s>16){let e=[];for(let n=0;n<16;n++){let r=i[t++].toString(16);e.push(r.length==1?`0`+r:r),(n===3||n===5||n===7||n===9)&&e.push(`-`)}let a=s-16,c=new Uint8Array(a);for(let e=0;e<a;e++)c[e]=i[t++];r.push({payloadType:o,pts:n,uuid:e.join(``),userData:F(c),userDataBytes:c})}}}function Re(e){let t=e.byteLength,n=[],r=1;for(;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;let i=t-n.length,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}function ze(e){let t=e[0],n=``,r=``,i=0,a=0,o=0,s=0,l=0,u=0;if(t===0){for(;z(e.subarray(u,u+1))!==`\0`;)n+=z(e.subarray(u,u+1)),u+=1;for(n+=z(e.subarray(u,u+1)),u+=1;z(e.subarray(u,u+1))!==`\0`;)r+=z(e.subarray(u,u+1)),u+=1;r+=z(e.subarray(u,u+1)),u+=1,i=B(e,12),a=B(e,16),s=B(e,20),l=B(e,24),u=28}else if(t===1){u+=4,i=B(e,u),u+=4;let t=B(e,u);u+=4;let a=B(e,u);for(u+=4,o=2**32*t+a,c(o)||(o=2**53-1,j.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),s=B(e,u),u+=4,l=B(e,u),u+=4;z(e.subarray(u,u+1))!==`\0`;)n+=z(e.subarray(u,u+1)),u+=1;for(n+=z(e.subarray(u,u+1)),u+=1;z(e.subarray(u,u+1))!==`\0`;)r+=z(e.subarray(u,u+1)),u+=1;r+=z(e.subarray(u,u+1)),u+=1}let d=e.subarray(u,e.byteLength);return{schemeIdUri:n,value:r,timeScale:i,presentationTime:o,presentationTimeDelta:a,eventDuration:s,id:l,payload:d}}function Be(e,...t){let n=t.length,r=8,i=n;for(;i--;)r+=t[i].byteLength;let a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),i=0,r=8;i<n;i++)a.set(t[i],r),r+=t[i].byteLength;return a}function Ve(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,i;r=0,i=new Uint8Array;let a;r>0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;let o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),Be([112,115,115,104],new Uint8Array([r,0,0,0]),e,a,i,o,n)}function He(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=Ue(new DataView(e,r));t.push(n),r+=n.size}}return t}function Ue(e){let t=e.getUint32(0),n=e.byteOffset,r=e.byteLength;if(r<t)return{offset:n,size:r};if(e.getUint32(4)!==1886614376)return{offset:n,size:t};let i=e.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:t};let a=e.buffer,o=I(new Uint8Array(a,n+12,16)),s=null,c=null,l=0;if(i===0)l=28;else{let i=e.getUint32(28);if(!i||r<32+i*16)return{offset:n,size:t};s=[];for(let e=0;e<i;e++)s.push(new Uint8Array(a,n+32+e*16,16));l=32+i*16}if(!l)return{offset:n,size:t};let u=e.getUint32(l);return t-32<u?{offset:n,size:t}:(c=new Uint8Array(a,n+l+4,u),{version:i,systemId:o,kids:s,data:c,offset:n,size:t})}const We=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ge={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ke(e,t){let n=Ge[t];return!!n&&!!n[e.slice(0,4)]}function qe(e,t,n=!0){return!e.split(`,`).some(e=>!Je(e,t,n))}function Je(e,t,n=!0){return M(n)?.isTypeSupported(Ye(e,t))??!1}function Ye(e,t){return`${t}/mp4;codecs=${e}`}function Xe(e){if(e){let t=e.substring(0,4);return Ge.video[t]}return 2}function Ze(e){let t=We();return e.split(`,`).reduce((e,n)=>{let r=t&&Fe(n)?9:Ge.video[n];return r?(r*2+e)/(e?3:2):(Ge.audio[n]+e)/(e?2:1)},0)}const Qe={};function $e(e,t=!0){if(Qe[e])return Qe[e];let n={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[e];for(let i=0;i<n.length;i++){var r;if(Je(n[i],`audio`,t))return Qe[e]=n[i],n[i];if(n[i]===`mp3`&&(r=M(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}const et=/flac|opus|mp4a\.40\.34/i;function tt(e,t=!0){return e.replace(et,e=>$e(e.toLowerCase(),t))}function nt(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)Ke(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function rt(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(it(e,`audio`)||it(e,`video`)))return e;if(t){let n=t.split(`,`);if(n.length>1){if(e){for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t]}return n[0]}}return t||e}function it(e,t){return Ke(e,t)&&Je(e,t)}function at(e){let t=e.split(`,`);for(let e=0;e<t.length;e++){let n=t[e].split(`.`);n.length>2&&n[0]===`avc1`&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${(`000`+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(`,`)}function ot(e){if(e.startsWith(`av01.`)){let t=e.split(`.`),n=[`0`,`111`,`01`,`01`,`01`,`0`];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(`.`)}return e}function st(e){let t=M(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported(`audio/mpeg`),mp3:t.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:t.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function ct(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}const lt={supported:!0,powerEfficient:!0,smooth:!0},ut={supported:!1,smooth:!1,powerEfficient:!1},dt={supported:!0,configurations:[],decodingInfoResults:[lt]};function ft(e,t){return{supported:!1,configurations:t,decodingInfoResults:[ut],error:e}}function pt(e,t,n,r,i,a){let o=e.videoCodec,c=e.audioCodec?e.audioGroups:null,l=a?.audioCodec,u=a?.channels,d=u?parseInt(u):l?1/0:2,f=null;if(c!=null&&c.length)try{f=c.length===1&&c[0]?t.groups[c[0]].channels:c.reduce((e,n)=>{if(n){let r=t.groups[n];if(!r)throw Error(`Audio track group ${n} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch{return!0}return o!==void 0&&(o.split(`,`).some(e=>Fe(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||e.videoRange!==`SDR`&&e.videoRange!==n||e.bitrate>Math.max(i,8e6))||!!f&&s(d)&&Object.keys(f).some(e=>parseInt(e)>d)}function mt(e,t,n,r={}){let i=e.videoCodec;if(!i&&!e.audioCodec||!n)return Promise.resolve(dt);let a=[],o=ht(e),s=o.length,c=gt(e,t,s>0),l=c.length;for(let e=s||1*l||1;e--;){let t={type:`media-source`};if(s&&(t.video=o[e%s]),l){t.audio=c[e%l];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}a.push(t)}if(i){let e=navigator.userAgent;if(i.split(`,`).some(e=>Fe(e))&&We())return Promise.resolve(ft(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),a))}return Promise.all(a.map(e=>{let t=yt(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:a,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:a,decodingInfoResults:[],error:e}))}function ht(e){let t=e.videoCodec?.split(`,`),n=vt(e),r=e.width||640,i=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:Ye(ot(e),`video`),width:r,height:i,bitrate:n,framerate:a};return o!==`sdr`&&(t.transferFunction=o),t}):[]}function gt(e,t,n){let r=e.audioCodec?.split(`,`),i=vt(e);return r&&e.audioGroups?e.audioGroups.reduce((e,a)=>{let o=a?t.groups[a]?.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===a){let a=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:Ye(t,`audio`),bitrate:n?_t(t,i):i};a&&(r.channels=``+a),e.push(r)})}return e},e):e},[]):[]}function _t(e,t){if(t<=1)return 1;let n=128e3;return e===`ec-3`?n=768e3:e===`ac-3`&&(n=64e4),Math.min(t/2,n)}function vt(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function yt(e){let t=``,{audio:n,video:r}=e;if(r){let e=ct(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||`sd`}_${Math.ceil(r.bitrate/1e5)}`}if(n){let e=ct(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}const bt=[`NONE`,`TYPE-0`,`TYPE-1`,null];function xt(e){return bt.indexOf(e)>-1}const St=[`SDR`,`PQ`,`HLG`];function Ct(e){return!!e&&St.indexOf(e)>-1}var wt={No:``,Yes:`YES`,v2:`v2`};function Tt(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,i=r<t/2;return t&&i?n?wt.v2:wt.Yes:wt.No}var Et=class{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}},Dt=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(`,`),`supplemental`in e){this.supplemental=e.supplemental;let t=e.supplemental?.videoCodec;t&&t!==e.videoCodec&&(this.codecSet+=`,${t.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return Ot(this._audioGroups,e)}hasSubtitleGroup(e){return Ot(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let e=this._audioGroups;e||=this._audioGroups=[],e.indexOf(t)===-1&&e.push(t)}else if(e===`text`){let e=this._subtitleGroups;e||=this._subtitleGroups=[],e.indexOf(t)===-1&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){return this.audioGroups?.[0]}get textGroupId(){return this.subtitleGroups?.[0]}addFallback(){}};function Ot(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function kt(){if(typeof matchMedia==`function`){let e=matchMedia(`(dynamic-range: high)`),t=matchMedia(`bad query`);if(e.media!==t.media)return e.matches===!0}return!1}function At(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||St.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&kt():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}const jt=e=>{let t=new WeakSet;return(n,r)=>{if(e&&(r=e(n,r)),typeof r==`object`&&r){if(t.has(r))return;t.add(r)}return r}},H=(e,t)=>JSON.stringify(e,jt(t));function Mt(e,t,n,r,i){let a=Object.keys(e),o=r?.channels,c=r?.audioCodec,l=i?.videoCodec,u=o&&parseInt(o)===2,d=!1,f=!1,p=1/0,m=1/0,h=1/0,g=1/0,_=0,v=[],{preferHDR:y,allowedVideoRanges:b}=At(t,i);for(let t=a.length;t--;){let n=e[a[t]];d||=n.channels[2]>0,p=Math.min(p,n.minHeight),m=Math.min(m,n.minFramerate),h=Math.min(h,n.minBitrate),b.filter(e=>n.videoRanges[e]>0).length>0&&(f=!0)}p=s(p)?p:0,m=s(m)?m:0;let x=Math.max(1080,p),S=Math.max(30,m);h=s(h)?h:n,n=Math.max(h,n),f||(t=void 0);let C=a.length>1;return{codecSet:a.reduce((t,r)=>{let i=e[r];if(r===t)return t;if(v=f?b.filter(e=>i.videoRanges[e]>0):[],C){if(i.minBitrate>n)return Nt(r,`min bitrate of ${i.minBitrate} > current estimate of ${n}`),t;if(!i.hasDefaultAudio)return Nt(r,`no renditions with default or auto-select sound found`),t;if(c&&r.indexOf(c.substring(0,4))%5!=0)return Nt(r,`audio codec preference "${c}" not found`),t;if(o&&!u){if(!i.channels[o])return Nt(r,`no renditions with ${o} channel sound found (channels options: ${Object.keys(i.channels)})`),t}else if((!c||u)&&d&&i.channels[2]===0)return Nt(r,`no renditions with stereo sound found`),t;if(i.minHeight>x)return Nt(r,`min resolution of ${i.minHeight} > maximum of ${x}`),t;if(i.minFramerate>S)return Nt(r,`min framerate of ${i.minFramerate} > maximum of ${S}`),t;if(!v.some(e=>i.videoRanges[e]>0))return Nt(r,`no variants with VIDEO-RANGE of ${H(v)} found`),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return Nt(r,`video codec preference "${l}" not found`),t;if(i.maxScore<_)return Nt(r,`max score of ${i.maxScore} < selected max of ${_}`),t}return t&&(Ze(r)>=Ze(t)||i.fragmentError>e[t].fragmentError)?t:(g=i.minIndex,_=i.maxScore,r)},void 0),videoRanges:v,preferHDR:y,minFramerate:m,minBitrate:h,minIndex:g}}function Nt(e,t){j.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Pt(e){return e.reduce((e,t)=>{let n=e.groups[t.groupId];n||=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1},n.tracks.push(t);let r=t.channels||`2`;return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ft(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let i=n.audioGroups,a=e[n.codecSet];a||(e[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);let o=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,o),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.minIndex=Math.min(a.minIndex,r),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{a.channels[e]=(a.channels[e]||0)+n.channels[e]}))}),e},{})}function It(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}=e;return{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}}function Lt(e,t,n){if(`attrs`in e){let n=t.indexOf(e);if(n!==-1)return n}for(let r=0;r<t.length;r++){let i=t[r];if(Rt(e,i,n))return r}return-1}function Rt(e,t,n){let{groupId:r,name:i,lang:a,assocLang:o,default:s}=e,c=e.forced;return(r===void 0||t.groupId===r)&&(i===void 0||t.name===i)&&(a===void 0||zt(a,t.lang))&&(a===void 0||t.assocLang===o)&&(s===void 0||t.default===s)&&(c===void 0||t.forced===c)&&(!(`characteristics`in e)||Bt(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function zt(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function Bt(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function Vt(e,t){let{audioCodec:n,channels:r}=e;return(n===void 0||(t.audioCodec||``).substring(0,4)===n.substring(0,4))&&(r===void 0||r===(t.channels||`2`))}function Ht(e,t,n,r,i){let a=t[r],o=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[a.uri];o.length>1&&(r=Math.max.apply(Math,o));let s=a.videoRange,c=a.frameRate,l=a.codecSet.substring(0,4),u=Ut(t,r,t=>{if(t.videoRange!==s||t.frameRate!==c||t.codecSet.substring(0,4)!==l)return!1;let r=t.audioGroups;return Lt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1});return u>-1?u:Ut(t,r,t=>{let r=t.audioGroups;return Lt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1})}function Ut(e,t,n){for(let r=t;r>-1;r--)if(n(e[r]))return r;for(let r=t+1;r<e.length;r++)if(n(e[r]))return r;return-1}function Wt(e,t){return!!e&&e!==t.loadLevelObj?.uri}var Gt=class extends C{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{let{fragCurrent:t,partCurrent:n,hls:r}=this,{autoLevelEnabled:i,media:a}=r;if(!t||!a)return;let o=performance.now(),c=n?n.stats:t.stats,l=n?n.duration:t.duration,u=o-c.loading.start,d=r.minAutoLevel,p=t.level,m=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||p<=d){this.clearTimer(),this._nextAutoLevel=-1;return}if(!i)return;let h=m>-1&&m!==p,g=!!e||h;if(!g&&(a.paused||!a.playbackRate||!a.readyState))return;let _=r.mainForwardBufferInfo;if(!g&&_===null)return;let v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(u<=Math.max(v,1e3*(l/(y*2))))return;let b=_?_.len/y:0,x=c.loading.first?c.loading.first-c.loading.start:-1,S=c.loaded&&x>-1,C=this.getBwEstimate(),w=r.levels,T=w[p],E=Math.max(c.loaded,Math.round(l*(t.bitrate||T.averageBitrate)/8)),D=S?u-x:u;D<1&&S&&(D=Math.min(u,c.loaded*8/C));let O=S?c.loaded*1e3/D:0,k=v/1e3,A=O?(E-c.loaded)/O:E*8/C+k;if(A<=b)return;let j=O?O*8:C,M=(e?.details||this.hls.latestLevelDetails)?.live===!0,N=this.hls.config.abrBandWidthUpFactor,P=1/0,F;for(F=p-1;F>d;F--){let e=w[F].maxBitrate,t=!w[F].details||M;if(P=this.getTimeToLoadFrag(k,j,l*e,t),P<Math.min(b,l+k))break}if(P>=A||P>l*10)return;S?this.bwEstimator.sample(u-Math.min(v,x),c.loaded):this.bwEstimator.sampleTTFB(u);let I=w[F].maxBitrate;this.getBwEstimate()*N>I&&this.resetEstimator(I);let ee=this.findBestLevel(I,d,F,0,b,1,1);ee>-1&&(F=ee),this.warn(`Fragment ${t.sn}${n?` part `+n.index:``} of level ${p} is loading too slowly;
|
|
1
|
+
import{t as e}from"./shallow-equal-zo2IZwso.js";import{t}from"./listen-UqQNdlqV.js";import{n,t as r}from"./delegate-odoSeh7c.js";import{n as i}from"./media-props-mixin-BuVUebRp.js";var a=class extends EventTarget{#e=null;#t=``;#n=`metadata`;get target(){return this.#e}get engine(){return null}get error(){return this.target?.error??null}get src(){return this.#t}set src(e){this.#t=e,this.#e&&(this.#e.src=e)}get preload(){return this.#n??`metadata`}set preload(e){this.#n=e,this.#e&&(this.#e.preload=e)}attach(e){this.#e=e,this.preload!==this.#e.preload&&(this.#e.preload=this.preload),this.src!==this.#e.src&&(this.#e.src=this.src)}detach(){this.#e=null}destroy(){this.#e=null}},o=class e extends Error{static MEDIA_ERR_ABORTED=1;static MEDIA_ERR_NETWORK=2;static MEDIA_ERR_DECODE=3;static MEDIA_ERR_SRC_NOT_SUPPORTED=4;static MEDIA_ERR_ENCRYPTED=5;static MEDIA_ERR_CUSTOM=100;static defaultMessages={1:`You aborted the media playback`,2:`A network error caused the media download to fail.`,3:`A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.`,4:`An unsupported error occurred. The server or network failed, or your browser does not support this format.`,5:`The media is encrypted and there are no keys to decrypt it.`};name;code;context;fatal;data;constructor(t,n=e.MEDIA_ERR_CUSTOM,r,i){super(t),this.name=`MediaError`,this.code=n,this.context=i,this.fatal=r??(n>=e.MEDIA_ERR_NETWORK&&n<=e.MEDIA_ERR_ENCRYPTED),this.message||=e.defaultMessages[this.code]??``}};const s=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},c=Number.isSafeInteger||function(e){return typeof e==`number`&&Math.abs(e)<=l},l=2**53-1||9007199254740991;let u=function(e){return e.NETWORK_ERROR=`networkError`,e.MEDIA_ERROR=`mediaError`,e.KEY_SYSTEM_ERROR=`keySystemError`,e.MUX_ERROR=`muxError`,e.OTHER_ERROR=`otherError`,e}({}),d=function(e){return e.KEY_SYSTEM_NO_KEYS=`keySystemNoKeys`,e.KEY_SYSTEM_NO_ACCESS=`keySystemNoAccess`,e.KEY_SYSTEM_NO_SESSION=`keySystemNoSession`,e.KEY_SYSTEM_NO_CONFIGURED_LICENSE=`keySystemNoConfiguredLicense`,e.KEY_SYSTEM_LICENSE_REQUEST_FAILED=`keySystemLicenseRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED=`keySystemServerCertificateRequestFailed`,e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED=`keySystemServerCertificateUpdateFailed`,e.KEY_SYSTEM_SESSION_UPDATE_FAILED=`keySystemSessionUpdateFailed`,e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED=`keySystemStatusOutputRestricted`,e.KEY_SYSTEM_STATUS_INTERNAL_ERROR=`keySystemStatusInternalError`,e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR=`keySystemDestroyMediaKeysError`,e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR=`keySystemDestroyCloseSessionError`,e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR=`keySystemDestroyRemoveSessionError`,e.MANIFEST_LOAD_ERROR=`manifestLoadError`,e.MANIFEST_LOAD_TIMEOUT=`manifestLoadTimeOut`,e.MANIFEST_PARSING_ERROR=`manifestParsingError`,e.MANIFEST_INCOMPATIBLE_CODECS_ERROR=`manifestIncompatibleCodecsError`,e.LEVEL_EMPTY_ERROR=`levelEmptyError`,e.LEVEL_LOAD_ERROR=`levelLoadError`,e.LEVEL_LOAD_TIMEOUT=`levelLoadTimeOut`,e.LEVEL_PARSING_ERROR=`levelParsingError`,e.LEVEL_SWITCH_ERROR=`levelSwitchError`,e.AUDIO_TRACK_LOAD_ERROR=`audioTrackLoadError`,e.AUDIO_TRACK_LOAD_TIMEOUT=`audioTrackLoadTimeOut`,e.SUBTITLE_LOAD_ERROR=`subtitleTrackLoadError`,e.SUBTITLE_TRACK_LOAD_TIMEOUT=`subtitleTrackLoadTimeOut`,e.FRAG_LOAD_ERROR=`fragLoadError`,e.FRAG_LOAD_TIMEOUT=`fragLoadTimeOut`,e.FRAG_DECRYPT_ERROR=`fragDecryptError`,e.FRAG_PARSING_ERROR=`fragParsingError`,e.FRAG_GAP=`fragGap`,e.REMUX_ALLOC_ERROR=`remuxAllocError`,e.KEY_LOAD_ERROR=`keyLoadError`,e.KEY_LOAD_TIMEOUT=`keyLoadTimeOut`,e.BUFFER_ADD_CODEC_ERROR=`bufferAddCodecError`,e.BUFFER_INCOMPATIBLE_CODECS_ERROR=`bufferIncompatibleCodecsError`,e.BUFFER_APPEND_ERROR=`bufferAppendError`,e.BUFFER_APPENDING_ERROR=`bufferAppendingError`,e.BUFFER_STALLED_ERROR=`bufferStalledError`,e.BUFFER_FULL_ERROR=`bufferFullError`,e.BUFFER_SEEK_OVER_HOLE=`bufferSeekOverHole`,e.BUFFER_NUDGE_ON_STALL=`bufferNudgeOnStall`,e.ASSET_LIST_LOAD_ERROR=`assetListLoadError`,e.ASSET_LIST_LOAD_TIMEOUT=`assetListLoadTimeout`,e.ASSET_LIST_PARSING_ERROR=`assetListParsingError`,e.INTERSTITIAL_ASSET_ITEM_ERROR=`interstitialAssetItemError`,e.INTERNAL_EXCEPTION=`internalException`,e.INTERNAL_ABORTED=`aborted`,e.ATTACH_MEDIA_ERROR=`attachMediaError`,e.UNKNOWN=`unknown`,e}({}),f=function(e){return e.MEDIA_ATTACHING=`hlsMediaAttaching`,e.MEDIA_ATTACHED=`hlsMediaAttached`,e.MEDIA_DETACHING=`hlsMediaDetaching`,e.MEDIA_DETACHED=`hlsMediaDetached`,e.MEDIA_ENDED=`hlsMediaEnded`,e.STALL_RESOLVED=`hlsStallResolved`,e.BUFFER_RESET=`hlsBufferReset`,e.BUFFER_CODECS=`hlsBufferCodecs`,e.BUFFER_CREATED=`hlsBufferCreated`,e.BUFFER_APPENDING=`hlsBufferAppending`,e.BUFFER_APPENDED=`hlsBufferAppended`,e.BUFFER_EOS=`hlsBufferEos`,e.BUFFERED_TO_END=`hlsBufferedToEnd`,e.BUFFER_FLUSHING=`hlsBufferFlushing`,e.BUFFER_FLUSHED=`hlsBufferFlushed`,e.MANIFEST_LOADING=`hlsManifestLoading`,e.MANIFEST_LOADED=`hlsManifestLoaded`,e.MANIFEST_PARSED=`hlsManifestParsed`,e.LEVEL_SWITCHING=`hlsLevelSwitching`,e.LEVEL_SWITCHED=`hlsLevelSwitched`,e.LEVEL_LOADING=`hlsLevelLoading`,e.LEVEL_LOADED=`hlsLevelLoaded`,e.LEVEL_UPDATED=`hlsLevelUpdated`,e.LEVEL_PTS_UPDATED=`hlsLevelPtsUpdated`,e.LEVELS_UPDATED=`hlsLevelsUpdated`,e.AUDIO_TRACKS_UPDATED=`hlsAudioTracksUpdated`,e.AUDIO_TRACK_SWITCHING=`hlsAudioTrackSwitching`,e.AUDIO_TRACK_SWITCHED=`hlsAudioTrackSwitched`,e.AUDIO_TRACK_LOADING=`hlsAudioTrackLoading`,e.AUDIO_TRACK_LOADED=`hlsAudioTrackLoaded`,e.AUDIO_TRACK_UPDATED=`hlsAudioTrackUpdated`,e.SUBTITLE_TRACKS_UPDATED=`hlsSubtitleTracksUpdated`,e.SUBTITLE_TRACKS_CLEARED=`hlsSubtitleTracksCleared`,e.SUBTITLE_TRACK_SWITCH=`hlsSubtitleTrackSwitch`,e.SUBTITLE_TRACK_LOADING=`hlsSubtitleTrackLoading`,e.SUBTITLE_TRACK_LOADED=`hlsSubtitleTrackLoaded`,e.SUBTITLE_TRACK_UPDATED=`hlsSubtitleTrackUpdated`,e.SUBTITLE_FRAG_PROCESSED=`hlsSubtitleFragProcessed`,e.CUES_PARSED=`hlsCuesParsed`,e.NON_NATIVE_TEXT_TRACKS_FOUND=`hlsNonNativeTextTracksFound`,e.INIT_PTS_FOUND=`hlsInitPtsFound`,e.FRAG_LOADING=`hlsFragLoading`,e.FRAG_LOAD_EMERGENCY_ABORTED=`hlsFragLoadEmergencyAborted`,e.FRAG_LOADED=`hlsFragLoaded`,e.FRAG_DECRYPTED=`hlsFragDecrypted`,e.FRAG_PARSING_INIT_SEGMENT=`hlsFragParsingInitSegment`,e.FRAG_PARSING_USERDATA=`hlsFragParsingUserdata`,e.FRAG_PARSING_METADATA=`hlsFragParsingMetadata`,e.FRAG_PARSED=`hlsFragParsed`,e.FRAG_BUFFERED=`hlsFragBuffered`,e.FRAG_CHANGED=`hlsFragChanged`,e.FPS_DROP=`hlsFpsDrop`,e.FPS_DROP_LEVEL_CAPPING=`hlsFpsDropLevelCapping`,e.MAX_AUTO_LEVEL_UPDATED=`hlsMaxAutoLevelUpdated`,e.ERROR=`hlsError`,e.DESTROYING=`hlsDestroying`,e.KEY_LOADING=`hlsKeyLoading`,e.KEY_LOADED=`hlsKeyLoaded`,e.LIVE_BACK_BUFFER_REACHED=`hlsLiveBackBufferReached`,e.BACK_BUFFER_REACHED=`hlsBackBufferReached`,e.STEERING_MANIFEST_LOADED=`hlsSteeringManifestLoaded`,e.ASSET_LIST_LOADING=`hlsAssetListLoading`,e.ASSET_LIST_LOADED=`hlsAssetListLoaded`,e.INTERSTITIALS_UPDATED=`hlsInterstitialsUpdated`,e.INTERSTITIALS_BUFFERED_TO_BOUNDARY=`hlsInterstitialsBufferedToBoundary`,e.INTERSTITIAL_ASSET_PLAYER_CREATED=`hlsInterstitialAssetPlayerCreated`,e.INTERSTITIAL_STARTED=`hlsInterstitialStarted`,e.INTERSTITIAL_ASSET_STARTED=`hlsInterstitialAssetStarted`,e.INTERSTITIAL_ASSET_ENDED=`hlsInterstitialAssetEnded`,e.INTERSTITIAL_ASSET_ERROR=`hlsInterstitialAssetError`,e.INTERSTITIAL_ENDED=`hlsInterstitialEnded`,e.INTERSTITIALS_PRIMARY_RESUMED=`hlsInterstitialsPrimaryResumed`,e.PLAYOUT_LIMIT_REACHED=`hlsPlayoutLimitReached`,e.EVENT_CUE_ENTER=`hlsEventCueEnter`,e}({});var p={MANIFEST:`manifest`,LEVEL:`level`,AUDIO_TRACK:`audioTrack`,SUBTITLE_TRACK:`subtitleTrack`},m={MAIN:`main`,AUDIO:`audio`,SUBTITLE:`subtitle`},h=class{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){let n=this.alpha_**+e;this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-this.alpha_**+this.totalWeight_;if(e)return this.estimate_/e}return this.estimate_}},g=class{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new h(e),this.fast_=new h(t),this.defaultTTFB_=r,this.ttfb_=new h(e)}update(e,t){let{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new h(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new h(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new h(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);let n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){let t=e/1e3,n=Math.sqrt(2)*Math.exp(-(t**2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function _(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?y(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function S(e){var t=x(e,`string`);return typeof t==`symbol`?t:t+``}var C=class{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let n=`[${e}]:`;this.trace=w,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}};const w=function(){},T={trace:w,debug:w,log:w,warn:w,info:w,error:w};function E(){return v({},T)}function D(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):w}function O(e,t,n){return t[e]?t[e].bind(t):D(e,n)}const k=E();function A(e,t,n){let r=E();if(typeof console==`object`&&e===!0||typeof e==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(t=>{r[t]=O(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch{return E()}i.forEach(t=>{k[t]=O(t,e)})}else v(k,r);return r}const j=k;function M(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function N(e){return typeof self<`u`&&e===self.ManagedMediaSource}function P(e,t){let n=Object.keys(e),r=Object.keys(t),i=n.length,a=r.length;return!i||!a||i===a&&!n.some(e=>r.indexOf(e)===-1)}function F(e,t=!1){if(typeof TextDecoder<`u`){let n=new TextDecoder(`utf-8`).decode(e);if(t){let e=n.indexOf(`\0`);return e===-1?n:n.substring(0,e)}return n.replace(/\0/g,``)}let n=e.length,r,i,a,o=``,s=0;for(;s<n;){if(r=e[s++],r===0&&t)return o;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:i=e[s++],o+=String.fromCharCode((r&31)<<6|i&63);break;case 14:i=e[s++],a=e[s++],o+=String.fromCharCode((r&15)<<12|(i&63)<<6|(a&63)<<0);break}}return o}function I(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(16);r.length<2&&(r=`0`+r),t+=r}return t}function ee(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var ne={exports:{}},re;function ie(){return re?ne.exports:(re=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var a=o.parseURL(t);if(!a)throw Error(`Error trying to parse relative URL.`);if(a.scheme)return n.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw Error(`Error trying to parse base URL.`);if(!s.netLoc&&s.path&&s.path[0]!==`/`){var c=r.exec(s.path);s.netLoc=c[1],s.path=c[2]}s.netLoc&&!s.path&&(s.path=`/`);var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,a.path[0]!==`/`))if(!a.path)l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));else{var u=s.path,d=u.substring(0,u.lastIndexOf(`/`)+1)+a.path;l.path=o.normalizePath(d)}return l.path===null&&(l.path=n.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||``,netLoc:t[2]||``,path:t[3]||``,params:t[4]||``,query:t[5]||``,fragment:t[6]||``}:null},normalizePath:function(e){for(e=e.split(``).reverse().join(``).replace(i,``);e.length!==(e=e.replace(a,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=o})()})(ne),ne.exports)}var ae=ie(),oe=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},L={AUDIO:`audio`,VIDEO:`video`,AUDIOVIDEO:`audiovideo`},se=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e==`string`&&(e={url:e}),this.base=e,de(this,`stats`)}setByteRange(e,t){let n=e.split(`@`,2),r;r=n.length===1?t?.byteRangeEndOffset||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[L.AUDIO]:null,[L.VIDEO]:null,[L.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new oe),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ae.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||``}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[L.AUDIO]=null,e[L.VIDEO]=null,e[L.AUDIOVIDEO]=null}};function R(e){return e.sn!==`initSegment`}var ce=class extends se{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(s(e)&&s(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||=t.identity.getDecryptData(this.sn);else if(!((e=this._decryptdata)!=null&&e.keyId)){let e=Object.keys(t);if(e.length===1){let n=this._decryptdata=t[e[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;let e=s(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;let e=Object.keys(this.levelkeys),n=e.length;if(n>1||n===1&&(t=this.levelkeys[e[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!s(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return R(this)?(this._ref||={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime},this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var n;let r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,a=!1){let{elementaryStreams:o}=this,s=o[e];if(!s){o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:a};return}s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)}},le=class extends se{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint(`DURATION`),this.gap=e.bool(`GAP`),this.independent=e.bool(`INDEPENDENT`),this.relurl=e.enumeratedString(`URI`),this.fragment=t,this.index=r;let a=e.enumeratedString(`BYTERANGE`);a&&this.setByteRange(a,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function ue(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||ue(n,t)}function de(e,t){let n=ue(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}const fe=2**32-1,pe=[].push,me={video:1,audio:2,id3:3,text:4};function z(e){return String.fromCharCode.apply(null,e)}function he(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function B(e,t){let n=_e(e,t);return n<0?4294967296+n:n}function ge(e,t){let n=B(e,t);return n*=2**32,n+=B(e,t+4),n}function _e(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ve(e){let t=e.byteLength;for(let n=0;n<t;){let r=B(e,n);if(r>8&&e[n+4]===109&&e[n+5]===111&&e[n+6]===111&&e[n+7]===102)return!0;n=r>1?n+r:t}return!1}function V(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let i=0;i<r;){let a=B(e,i),o=z(e.subarray(i+4,i+8)),s=a>1?i+a:r;if(o===t[0])if(t.length===1)n.push(e.subarray(i+8,s));else{let r=V(e.subarray(i+8,s),t.slice(1));r.length&&pe.apply(n,r)}i=s}return n}function ye(e){let t=[],n=e[0],r=8,i=B(e,r);r+=4;let a=0,o=0;n===0?(a=B(e,r),o=B(e,r+4),r+=8):(a=ge(e,r),o=ge(e,r+8),r+=16),r+=2;let s=e.length+o,c=he(e,r);r+=2;for(let n=0;n<c;n++){let n=r,a=B(e,n);n+=4;let o=a&2147483647;if((a&2147483648)>>>31==1)return j.warn(`SIDX has hierarchical references (not supported)`),null;let c=B(e,n);n+=4,t.push({referenceSize:o,subsegmentDuration:c,info:{duration:c/i,start:s,end:s+o-1}}),s+=o,n+=4,r=n}return{earliestPresentationTime:a,timescale:i,version:n,referencesCount:c,references:t}}function be(e){let t=[],n=V(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],i=V(r,[`tkhd`])[0];if(i){let e=i[0],n=B(i,e===0?12:20),a=V(r,[`mdia`,`mdhd`])[0];if(a){e=a[0];let i=B(a,e===0?12:20),o=V(r,[`mdia`,`hdlr`])[0];if(o){let e=z(o.subarray(8,12)),a={soun:L.AUDIO,vide:L.VIDEO}[e],s=V(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],c=xe(s);a?(t[n]={timescale:i,type:a,stsd:c},t[a]=b({timescale:i,id:n},c)):t[n]={timescale:i,type:e,stsd:c}}}}}return V(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[B(e,4)];n&&(n.default={duration:B(e,12),flags:B(e,20)})}),t}function xe(e){let t=e.subarray(8),n=t.subarray(86),r=z(t.subarray(4,8)),i=r,a,o=r===`enca`||r===`encv`;o&&V(V(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=V(e,[`schm`])[0];if(t){let n=z(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=V(e,[`frma`])[0];t&&(i=z(t))}}});let s=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=V(n,[`avcC`])[0];e&&e.length>3&&(i+=`.`+Te(e[1])+Te(e[2])+Te(e[3]),a=Se(s===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=V(t,[r])[0],n=V(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=we(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=we(n,e);let r=n[e++];if(r===64)i+=`.`+Te(r);else break;if(e+=12,n[e++]!==5)break;e=we(n,e);let a=n[e++],o=(a&248)>>3;o===31&&(o+=1+((a&7)<<3)+((n[e]&224)>>5)),i+=`.`+o}break}case`hvc1`:case`hev1`:{let e=V(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,a=B(e,2),o=(t&32)>>5?`H`:`L`,s=e[12],c=e.subarray(6,12);i+=`.`+n+r,i+=`.`+Ce(a).toString(16).toUpperCase(),i+=`.`+o+s;let l=``;for(let e=c.length;e--;){let t=c[e];(t||l)&&(l=`.`+t.toString(16).toUpperCase()+l)}i+=l}a=Se(s==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=Se(i,n)||i;break;case`vp09`:{let e=V(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;i+=`.`+Ee(t)+`.`+Ee(n)+`.`+Ee(r)}break}case`av01`:{let e=V(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,o=e[2]>>>7?`H`:`M`,s=(e[2]&64)>>6,c=(e[2]&32)>>5,l=t===2&&s?c?12:10:s?10:8,u=(e[2]&16)>>4,d=(e[2]&8)>>3,f=(e[2]&4)>>2,p=e[2]&3;i+=`.`+t+`.`+Ee(r)+o+`.`+Ee(l)+`.`+u+`.`+d+f+p+`.`+Ee(1)+`.`+Ee(1)+`.`+Ee(1)+`.0`,a=Se(`dav1`,n)}break}}return{codec:i,encrypted:o,supplemental:a}}function Se(e,t){let n=V(t,[`dvvC`]),r=n.length?n[0]:V(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+Ee(t)+`.`+Ee(n)}}function Ce(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function we(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function Te(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function Ee(e){return(e<10?`0`:``)+e}function De(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&ke(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(j.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${I(r)} -> ${I(n)}`),e.set(n,8))})}function Oe(e){let t=[];return ke(e,e=>t.push(e.subarray(8,24))),t}function ke(e,t){V(e,[`moov`,`trak`]).forEach(e=>{let n=V(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),i=V(r,[`enca`]),a=i.length>0;a||(i=V(r,[`encv`])),i.forEach(e=>{V(a?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=Ae(e);n&&t(n,a)})})})}function Ae(e){let t=V(e,[`schm`])[0];if(t){let n=z(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=V(e,[`schi`,`tenc`])[0];if(t)return t}}}function je(e,t,n){let r={},i=V(e,[`moof`,`traf`]);for(let e=0;e<i.length;e++){let a=i[e],o=V(a,[`tfhd`])[0],c=B(o,4),l=t[c];if(!l)continue;r[c]||(r[c]={start:NaN,duration:0,sampleCount:0,timescale:l.timescale,type:l.type});let u=r[c],d=V(a,[`tfdt`])[0];if(d){let e=d[0],t=B(d,4);e===1&&(t===fe?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=fe+1,t+=B(d,8))),s(t)&&(!s(u.start)||t<u.start)&&(u.start=t)}let f=l.default,p=B(o,0)|f?.flags,m=f?.duration||0;p&8&&(m=p&2?B(o,12):B(o,8));let h=V(a,[`trun`]),g=u.start||0,_=0,v=m;for(let e=0;e<h.length;e++){let t=h[e],n=B(t,4),r=u.sampleCount;u.sampleCount+=n;let i=t[3]&1,a=t[3]&4,o=t[2]&1,s=t[2]&2,c=t[2]&4,l=t[2]&8,d=8,f=n;for(i&&(d+=4),a&&n&&(!(t[d+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=r),d+=4,o?(v=B(t,d),d+=4):v=m,s&&(d+=4),l&&(d+=4),g+=v,_+=v,f--);f--;)o?(v=B(t,d),d+=4):v=m,s&&(d+=4),c&&(t[d+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(f+1),u.keyFrameStart=g),d+=4),l&&(d+=4),g+=v,_+=v;!_&&m&&(_+=m*n)}u.duration+=_}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,i=V(e,[`sidx`]);for(let e=0;e<i.length;e++){let r=ye(i[e]);if(r!=null&&r.references){t=Math.min(t,r.earliestPresentationTime/r.timescale);let e=r.references.reduce((e,t)=>e+t.info.duration||0,0);n=Math.max(n,e+r.earliestPresentationTime/r.timescale)}}n&&s(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function Me(e){let t={valid:null,remainder:null},n=V(e,[`moof`]);if(n.length<2)return t.remainder=e,t;let r=n[n.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}function Ne(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Pe(e,t){let n=[],r=t.samples,i=t.timescale,a=t.id,o=!1;return V(r,[`moof`]).map(s=>{let c=s.byteOffset-8;V(s,[`traf`]).map(s=>{let l=V(s,[`tfdt`]).map(e=>{let t=e[0],n=B(e,4);return t===1&&(n*=2**32,n+=B(e,8)),n/i})[0];return l!==void 0&&(e=l),V(s,[`tfhd`]).map(l=>{let u=B(l,4),d=B(l,0)&16777215,f=(d&1)!=0,p=(d&2)!=0,m=(d&8)!=0,h=0,g=(d&16)!=0,_=0,v=(d&32)!=0,y=8;u===a&&(f&&(y+=8),p&&(y+=4),m&&(h=B(l,y),y+=4),g&&(_=B(l,y),y+=4),v&&(y+=4),t.type===`video`&&(o=Fe(t.codec)),V(s,[`trun`]).map(a=>{let s=a[0],l=B(a,0)&16777215,u=(l&1)!=0,d=0,f=(l&4)!=0,p=(l&256)!=0,m=0,g=(l&512)!=0,v=0,y=(l&1024)!=0,b=(l&2048)!=0,x=0,S=B(a,4),C=8;u&&(d=B(a,C),C+=4),f&&(C+=4);let w=d+c;for(let c=0;c<S;c++){if(p?(m=B(a,C),C+=4):m=h,g?(v=B(a,C),C+=4):v=_,y&&(C+=4),b&&(x=s===0?B(a,C):_e(a,C),C+=4),t.type===L.VIDEO){let t=0;for(;t<v;){let a=B(r,w);w+=4,Ie(o,r[w])&&Le(r.subarray(w,w+a),o?2:1,e+x/i,n),w+=a,t+=a+4}}e+=m/i}}))})})}),n}function Fe(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function Ie(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function Le(e,t,n,r){let i=Re(e),a=0;a+=t;let o=0,s=0,c=0;for(;a<i.length;){o=0;do{if(a>=i.length)break;c=i[a++],o+=c}while(c===255);s=0;do{if(a>=i.length)break;c=i[a++],s+=c}while(c===255);let e=i.length-a,t=a;if(s<e)a+=s;else if(s>e){j.error(`Malformed SEI payload. ${s} is too small, only ${e} bytes left to parse.`);break}if(o===4){if(i[t++]===181){let e=he(i,t);if(t+=2,e===49){let e=B(i,t);if(t+=4,e===1195456820){let e=i[t++];if(e===3){let a=i[t++],s=31&a,c=64&a,l=c?2+s*3:0,u=new Uint8Array(l);if(c){u[0]=a;for(let e=1;e<l;e++)u[e]=i[t++]}r.push({type:e,payloadType:o,pts:n,bytes:u})}}}}}else if(o===5&&s>16){let e=[];for(let n=0;n<16;n++){let r=i[t++].toString(16);e.push(r.length==1?`0`+r:r),(n===3||n===5||n===7||n===9)&&e.push(`-`)}let a=s-16,c=new Uint8Array(a);for(let e=0;e<a;e++)c[e]=i[t++];r.push({payloadType:o,pts:n,uuid:e.join(``),userData:F(c),userDataBytes:c})}}}function Re(e){let t=e.byteLength,n=[],r=1;for(;r<t-2;)e[r]===0&&e[r+1]===0&&e[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return e;let i=t-n.length,a=new Uint8Array(i),o=0;for(r=0;r<i;o++,r++)o===n[0]&&(o++,n.shift()),a[r]=e[o];return a}function ze(e){let t=e[0],n=``,r=``,i=0,a=0,o=0,s=0,l=0,u=0;if(t===0){for(;z(e.subarray(u,u+1))!==`\0`;)n+=z(e.subarray(u,u+1)),u+=1;for(n+=z(e.subarray(u,u+1)),u+=1;z(e.subarray(u,u+1))!==`\0`;)r+=z(e.subarray(u,u+1)),u+=1;r+=z(e.subarray(u,u+1)),u+=1,i=B(e,12),a=B(e,16),s=B(e,20),l=B(e,24),u=28}else if(t===1){u+=4,i=B(e,u),u+=4;let t=B(e,u);u+=4;let a=B(e,u);for(u+=4,o=2**32*t+a,c(o)||(o=2**53-1,j.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),s=B(e,u),u+=4,l=B(e,u),u+=4;z(e.subarray(u,u+1))!==`\0`;)n+=z(e.subarray(u,u+1)),u+=1;for(n+=z(e.subarray(u,u+1)),u+=1;z(e.subarray(u,u+1))!==`\0`;)r+=z(e.subarray(u,u+1)),u+=1;r+=z(e.subarray(u,u+1)),u+=1}let d=e.subarray(u,e.byteLength);return{schemeIdUri:n,value:r,timeScale:i,presentationTime:o,presentationTimeDelta:a,eventDuration:s,id:l,payload:d}}function Be(e,...t){let n=t.length,r=8,i=n;for(;i--;)r+=t[i].byteLength;let a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),i=0,r=8;i<n;i++)a.set(t[i],r),r+=t[i].byteLength;return a}function Ve(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,i;r=0,i=new Uint8Array;let a;r>0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;let o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),Be([112,115,115,104],new Uint8Array([r,0,0,0]),e,a,i,o,n)}function He(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=Ue(new DataView(e,r));t.push(n),r+=n.size}}return t}function Ue(e){let t=e.getUint32(0),n=e.byteOffset,r=e.byteLength;if(r<t)return{offset:n,size:r};if(e.getUint32(4)!==1886614376)return{offset:n,size:t};let i=e.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:t};let a=e.buffer,o=I(new Uint8Array(a,n+12,16)),s=null,c=null,l=0;if(i===0)l=28;else{let i=e.getUint32(28);if(!i||r<32+i*16)return{offset:n,size:t};s=[];for(let e=0;e<i;e++)s.push(new Uint8Array(a,n+32+e*16,16));l=32+i*16}if(!l)return{offset:n,size:t};let u=e.getUint32(l);return t-32<u?{offset:n,size:t}:(c=new Uint8Array(a,n+l+4,u),{version:i,systemId:o,kids:s,data:c,offset:n,size:t})}const We=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ge={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ke(e,t){let n=Ge[t];return!!n&&!!n[e.slice(0,4)]}function qe(e,t,n=!0){return!e.split(`,`).some(e=>!Je(e,t,n))}function Je(e,t,n=!0){return M(n)?.isTypeSupported(Ye(e,t))??!1}function Ye(e,t){return`${t}/mp4;codecs=${e}`}function Xe(e){if(e){let t=e.substring(0,4);return Ge.video[t]}return 2}function Ze(e){let t=We();return e.split(`,`).reduce((e,n)=>{let r=t&&Fe(n)?9:Ge.video[n];return r?(r*2+e)/(e?3:2):(Ge.audio[n]+e)/(e?2:1)},0)}const Qe={};function $e(e,t=!0){if(Qe[e])return Qe[e];let n={flac:[`flac`,`fLaC`,`FLAC`],opus:[`opus`,`Opus`],"mp4a.40.34":[`mp3`]}[e];for(let i=0;i<n.length;i++){var r;if(Je(n[i],`audio`,t))return Qe[e]=n[i],n[i];if(n[i]===`mp3`&&(r=M(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}const et=/flac|opus|mp4a\.40\.34/i;function tt(e,t=!0){return e.replace(et,e=>$e(e.toLowerCase(),t))}function nt(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)Ke(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function rt(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(it(e,`audio`)||it(e,`video`)))return e;if(t){let n=t.split(`,`);if(n.length>1){if(e){for(let t=n.length;t--;)if(n[t].substring(0,4)===e.substring(0,4))return n[t]}return n[0]}}return t||e}function it(e,t){return Ke(e,t)&&Je(e,t)}function at(e){let t=e.split(`,`);for(let e=0;e<t.length;e++){let n=t[e].split(`.`);n.length>2&&n[0]===`avc1`&&(t[e]=`avc1.${parseInt(n[1]).toString(16)}${(`000`+parseInt(n[2]).toString(16)).slice(-4)}`)}return t.join(`,`)}function ot(e){if(e.startsWith(`av01.`)){let t=e.split(`.`),n=[`0`,`111`,`01`,`01`,`01`,`0`];for(let e=t.length;e>4&&e<10;e++)t[e]=n[e-4];return t.join(`.`)}return e}function st(e){let t=M(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported(`audio/mpeg`),mp3:t.isTypeSupported(`audio/mp4; codecs="mp3"`),ac3:t.isTypeSupported(`audio/mp4; codecs="ac-3"`)}}function ct(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}const lt={supported:!0,powerEfficient:!0,smooth:!0},ut={supported:!1,smooth:!1,powerEfficient:!1},dt={supported:!0,configurations:[],decodingInfoResults:[lt]};function ft(e,t){return{supported:!1,configurations:t,decodingInfoResults:[ut],error:e}}function pt(e,t,n,r,i,a){let o=e.videoCodec,c=e.audioCodec?e.audioGroups:null,l=a?.audioCodec,u=a?.channels,d=u?parseInt(u):l?1/0:2,f=null;if(c!=null&&c.length)try{f=c.length===1&&c[0]?t.groups[c[0]].channels:c.reduce((e,n)=>{if(n){let r=t.groups[n];if(!r)throw Error(`Audio track group ${n} not found`);Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch{return!0}return o!==void 0&&(o.split(`,`).some(e=>Fe(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||e.videoRange!==`SDR`&&e.videoRange!==n||e.bitrate>Math.max(i,8e6))||!!f&&s(d)&&Object.keys(f).some(e=>parseInt(e)>d)}function mt(e,t,n,r={}){let i=e.videoCodec;if(!i&&!e.audioCodec||!n)return Promise.resolve(dt);let a=[],o=ht(e),s=o.length,c=gt(e,t,s>0),l=c.length;for(let e=s||1*l||1;e--;){let t={type:`media-source`};if(s&&(t.video=o[e%s]),l){t.audio=c[e%l];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}a.push(t)}if(i){let e=navigator.userAgent;if(i.split(`,`).some(e=>Fe(e))&&We())return Promise.resolve(ft(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),a))}return Promise.all(a.map(e=>{let t=yt(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:a,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:a,decodingInfoResults:[],error:e}))}function ht(e){let t=e.videoCodec?.split(`,`),n=vt(e),r=e.width||640,i=e.height||480,a=e.frameRate||30,o=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:Ye(ot(e),`video`),width:r,height:i,bitrate:n,framerate:a};return o!==`sdr`&&(t.transferFunction=o),t}):[]}function gt(e,t,n){let r=e.audioCodec?.split(`,`),i=vt(e);return r&&e.audioGroups?e.audioGroups.reduce((e,a)=>{let o=a?t.groups[a]?.tracks:null;return o?o.reduce((e,t)=>{if(t.groupId===a){let a=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:Ye(t,`audio`),bitrate:n?_t(t,i):i};a&&(r.channels=``+a),e.push(r)})}return e},e):e},[]):[]}function _t(e,t){if(t<=1)return 1;let n=128e3;return e===`ec-3`?n=768e3:e===`ac-3`&&(n=64e4),Math.min(t/2,n)}function vt(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function yt(e){let t=``,{audio:n,video:r}=e;if(r){let e=ct(r.contentType);t+=`${e}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||`sd`}_${Math.ceil(r.bitrate/1e5)}`}if(n){let e=ct(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}const bt=[`NONE`,`TYPE-0`,`TYPE-1`,null];function xt(e){return bt.indexOf(e)>-1}const St=[`SDR`,`PQ`,`HLG`];function Ct(e){return!!e&&St.indexOf(e)>-1}var wt={No:``,Yes:`YES`,v2:`v2`};function Tt(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,i=r<t/2;return t&&i?n?wt.v2:wt.Yes:wt.No}var Et=class{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){let t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set(`_HLS_msn`,this.msn.toString()),this.part!==void 0&&t.searchParams.set(`_HLS_part`,this.part.toString()),this.skip&&t.searchParams.set(`_HLS_skip`,this.skip),t.href}},Dt=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat(`FRAME-RATE`,0),this._avgBitrate=e.attrs.decimalInteger(`AVERAGE-BANDWIDTH`),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(`,`),`supplemental`in e){this.supplemental=e.supplemental;let t=e.supplemental?.videoCodec;t&&t!==e.videoCodec&&(this.codecSet+=`,${t.substring(0,4)}`)}this.addGroupId(`audio`,e.attrs.AUDIO),this.addGroupId(`text`,e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||``}get pathwayId(){return this.attrs[`PATHWAY-ID`]||`.`}get videoRange(){return this.attrs[`VIDEO-RANGE`]||`SDR`}get score(){return this.attrs.optionalFloat(`SCORE`,0)}get uri(){return this.url[0]||``}hasAudioGroup(e){return Ot(this._audioGroups,e)}hasSubtitleGroup(e){return Ot(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e===`audio`){let e=this._audioGroups;e||=this._audioGroups=[],e.indexOf(t)===-1&&e.push(t)}else if(e===`text`){let e=this._subtitleGroups;e||=this._subtitleGroups=[],e.indexOf(t)===-1&&e.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){return this.audioGroups?.[0]}get textGroupId(){return this.subtitleGroups?.[0]}addFallback(){}};function Ot(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function kt(){if(typeof matchMedia==`function`){let e=matchMedia(`(dynamic-range: high)`),t=matchMedia(`bad query`);if(e.media!==t.media)return e.matches===!0}return!1}function At(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||St.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&kt():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}const jt=e=>{let t=new WeakSet;return(n,r)=>{if(e&&(r=e(n,r)),typeof r==`object`&&r){if(t.has(r))return;t.add(r)}return r}},H=(e,t)=>JSON.stringify(e,jt(t));function Mt(e,t,n,r,i){let a=Object.keys(e),o=r?.channels,c=r?.audioCodec,l=i?.videoCodec,u=o&&parseInt(o)===2,d=!1,f=!1,p=1/0,m=1/0,h=1/0,g=1/0,_=0,v=[],{preferHDR:y,allowedVideoRanges:b}=At(t,i);for(let t=a.length;t--;){let n=e[a[t]];d||=n.channels[2]>0,p=Math.min(p,n.minHeight),m=Math.min(m,n.minFramerate),h=Math.min(h,n.minBitrate),b.filter(e=>n.videoRanges[e]>0).length>0&&(f=!0)}p=s(p)?p:0,m=s(m)?m:0;let x=Math.max(1080,p),S=Math.max(30,m);h=s(h)?h:n,n=Math.max(h,n),f||(t=void 0);let C=a.length>1;return{codecSet:a.reduce((t,r)=>{let i=e[r];if(r===t)return t;if(v=f?b.filter(e=>i.videoRanges[e]>0):[],C){if(i.minBitrate>n)return Nt(r,`min bitrate of ${i.minBitrate} > current estimate of ${n}`),t;if(!i.hasDefaultAudio)return Nt(r,`no renditions with default or auto-select sound found`),t;if(c&&r.indexOf(c.substring(0,4))%5!=0)return Nt(r,`audio codec preference "${c}" not found`),t;if(o&&!u){if(!i.channels[o])return Nt(r,`no renditions with ${o} channel sound found (channels options: ${Object.keys(i.channels)})`),t}else if((!c||u)&&d&&i.channels[2]===0)return Nt(r,`no renditions with stereo sound found`),t;if(i.minHeight>x)return Nt(r,`min resolution of ${i.minHeight} > maximum of ${x}`),t;if(i.minFramerate>S)return Nt(r,`min framerate of ${i.minFramerate} > maximum of ${S}`),t;if(!v.some(e=>i.videoRanges[e]>0))return Nt(r,`no variants with VIDEO-RANGE of ${H(v)} found`),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return Nt(r,`video codec preference "${l}" not found`),t;if(i.maxScore<_)return Nt(r,`max score of ${i.maxScore} < selected max of ${_}`),t}return t&&(Ze(r)>=Ze(t)||i.fragmentError>e[t].fragmentError)?t:(g=i.minIndex,_=i.maxScore,r)},void 0),videoRanges:v,preferHDR:y,minFramerate:m,minBitrate:h,minIndex:g}}function Nt(e,t){j.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Pt(e){return e.reduce((e,t)=>{let n=e.groups[t.groupId];n||=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1},n.tracks.push(t);let r=t.channels||`2`;return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ft(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let i=n.audioGroups,a=e[n.codecSet];a||(e[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);let o=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,o),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.minIndex=Math.min(a.minIndex,r),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{a.channels[e]=(a.channels[e]||0)+n.channels[e]}))}),e},{})}function It(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}=e;return{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:a}}function Lt(e,t,n){if(`attrs`in e){let n=t.indexOf(e);if(n!==-1)return n}for(let r=0;r<t.length;r++){let i=t[r];if(Rt(e,i,n))return r}return-1}function Rt(e,t,n){let{groupId:r,name:i,lang:a,assocLang:o,default:s}=e,c=e.forced;return(r===void 0||t.groupId===r)&&(i===void 0||t.name===i)&&(a===void 0||zt(a,t.lang))&&(a===void 0||t.assocLang===o)&&(s===void 0||t.default===s)&&(c===void 0||t.forced===c)&&(!(`characteristics`in e)||Bt(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function zt(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function Bt(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function Vt(e,t){let{audioCodec:n,channels:r}=e;return(n===void 0||(t.audioCodec||``).substring(0,4)===n.substring(0,4))&&(r===void 0||r===(t.channels||`2`))}function Ht(e,t,n,r,i){let a=t[r],o=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[a.uri];o.length>1&&(r=Math.max.apply(Math,o));let s=a.videoRange,c=a.frameRate,l=a.codecSet.substring(0,4),u=Ut(t,r,t=>{if(t.videoRange!==s||t.frameRate!==c||t.codecSet.substring(0,4)!==l)return!1;let r=t.audioGroups;return Lt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1});return u>-1?u:Ut(t,r,t=>{let r=t.audioGroups;return Lt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1})}function Ut(e,t,n){for(let r=t;r>-1;r--)if(n(e[r]))return r;for(let r=t+1;r<e.length;r++)if(n(e[r]))return r;return-1}function Wt(e,t){return!!e&&e!==t.loadLevelObj?.uri}var Gt=class extends C{constructor(e){super(`abr`,e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey=``,this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{let{fragCurrent:t,partCurrent:n,hls:r}=this,{autoLevelEnabled:i,media:a}=r;if(!t||!a)return;let o=performance.now(),c=n?n.stats:t.stats,l=n?n.duration:t.duration,u=o-c.loading.start,d=r.minAutoLevel,p=t.level,m=this._nextAutoLevel;if(c.aborted||c.loaded&&c.loaded===c.total||p<=d){this.clearTimer(),this._nextAutoLevel=-1;return}if(!i)return;let h=m>-1&&m!==p,g=!!e||h;if(!g&&(a.paused||!a.playbackRate||!a.readyState))return;let _=r.mainForwardBufferInfo;if(!g&&_===null)return;let v=this.bwEstimator.getEstimateTTFB(),y=Math.abs(a.playbackRate);if(u<=Math.max(v,1e3*(l/(y*2))))return;let b=_?_.len/y:0,x=c.loading.first?c.loading.first-c.loading.start:-1,S=c.loaded&&x>-1,C=this.getBwEstimate(),w=r.levels,T=w[p],E=Math.max(c.loaded,Math.round(l*(t.bitrate||T.averageBitrate)/8)),D=S?u-x:u;D<1&&S&&(D=Math.min(u,c.loaded*8/C));let O=S?c.loaded*1e3/D:0,k=v/1e3,A=O?(E-c.loaded)/O:E*8/C+k;if(A<=b)return;let j=O?O*8:C,M=(e?.details||this.hls.latestLevelDetails)?.live===!0,N=this.hls.config.abrBandWidthUpFactor,P=1/0,F;for(F=p-1;F>d;F--){let e=w[F].maxBitrate,t=!w[F].details||M;if(P=this.getTimeToLoadFrag(k,j,l*e,t),P<Math.min(b,l+k))break}if(P>=A||P>l*10)return;S?this.bwEstimator.sample(u-Math.min(v,x),c.loaded):this.bwEstimator.sampleTTFB(u);let I=w[F].maxBitrate;this.getBwEstimate()*N>I&&this.resetEstimator(I);let ee=this.findBestLevel(I,d,F,0,b,1,1);ee>-1&&(F=ee),this.warn(`Fragment ${t.sn}${n?` part `+n.index:``} of level ${p} is loading too slowly;
|
|
2
2
|
Fragment duration: ${t.duration.toFixed(3)}
|
|
3
3
|
Time to underbuffer: ${b.toFixed(3)} s
|
|
4
4
|
Estimated load time for current fragment: ${A.toFixed(3)} s
|
|
@@ -38,4 +38,4 @@ Schedule: ${a.map(e=>lc(e))} pos: ${this.timelinePos}`),s.length&&this.log(`Remo
|
|
|
38
38
|
`),l=[],u=t?Fa(t.baseTime,t.timescale):0,d=`00:00.000`,f=0,p=0,m,h=!0;s.oncue=function(e){let a=n[r],o=n.ccOffset,s=(f-u)/9e4;if(a!=null&&a.new&&(p===void 0?Jc(n,r,s):o=n.ccOffset=a.start),s){if(!t){m=Error(`Missing initPTS for VTT MPEGTS`);return}o=s-n.presentationOffset}let c=e.endTime-e.startTime,d=Va((e.startTime+o-p)*9e4,i*9e4)/9e4;e.startTime=Math.max(d,0),e.endTime=Math.max(d+c,0);let h=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(h)),e.id||=qc(e.startTime,e.endTime,h),e.endTime>0&&l.push(e)},s.onparsingerror=function(e){m=e},s.onflush=function(){if(m){o(m);return}a(l)},c.forEach(e=>{if(h)if(Gc(e,`X-TIMESTAMP-MAP=`)){h=!1,e.slice(16).split(`,`).forEach(e=>{Gc(e,`LOCAL:`)?d=e.slice(6):Gc(e,`MPEGTS:`)&&(f=parseInt(e.slice(7)))});try{p=Kc(d)/1e3}catch(e){m=e}return}else e===``&&(h=!1);s.parse(e+`
|
|
39
39
|
`)}),s.flush()}const Xc=`stpp.ttml.im1t`,Zc=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Qc=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,$c={left:`start`,center:`center`,right:`end`,start:`start`,end:`end`};function el(e,t,n,r){let i=V(new Uint8Array(e),[`mdat`]);if(i.length===0){r(Error(`Could not parse IMSC1 mdat`));return}let a=i.map(e=>F(e)),o=Na(t.baseTime,1,t.timescale);try{a.forEach(e=>n(tl(e,o)))}catch(e){r(e)}}function tl(e,t){let n=new DOMParser().parseFromString(e,`text/xml`).getElementsByTagName(`tt`)[0];if(!n)throw Error(`Invalid ttml`);let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(r).reduce((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||r[t],e),{}),a=n.getAttribute(`xml:space`)!==`preserve`,o=rl(nl(n,`styling`,`style`)),s=rl(nl(n,`layout`,`region`)),c=nl(n,`body`,`[begin]`);return[].map.call(c,e=>{let n=il(e,a);if(!n||!e.hasAttribute(`begin`))return null;let r=cl(e.getAttribute(`begin`),i),c=cl(e.getAttribute(`dur`),i),l=cl(e.getAttribute(`end`),i);if(r===null)throw sl(e);if(l===null){if(c===null)throw sl(e);l=r+c}let u=new Pc(r-t,l-t,n);u.id=qc(u.startTime,u.endTime,u.text);let d=s[e.getAttribute(`region`)],f=o[e.getAttribute(`style`)],p=al(d,f,o),{textAlign:m}=p;if(m){let e=$c[m];e&&(u.lineAlign=e),u.align=m}return v(u,p),u}).filter(e=>e!==null)}function nl(e,t,n){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function rl(e){return e.reduce((e,t)=>{let n=t.getAttribute(`xml:id`);return n&&(e[n]=t),e},{})}function il(e,t){return[].slice.call(e.childNodes).reduce((e,n,r)=>{var i;return n.nodeName===`br`&&r?e+`
|
|
40
40
|
`:(i=n.childNodes)!=null&&i.length?il(n,t):t?e+n.textContent.trim().replace(/\s+/g,` `):e+n.textContent},``)}function al(e,t,n){let r=`http://www.w3.org/ns/ttml#styling`,i=null,a=[`displayAlign`,`textAlign`,`color`,`backgroundColor`,`fontSize`,`fontFamily`],o=e!=null&&e.hasAttribute(`style`)?e.getAttribute(`style`):null;return o&&n.hasOwnProperty(o)&&(i=n[o]),a.reduce((n,a)=>{let o=ol(t,r,a)||ol(e,r,a)||ol(i,r,a);return o&&(n[a]=o),n},{})}function ol(e,t,n){return e&&e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function sl(e){return Error(`Could not parse ttml timestamp ${e}`)}function cl(e,t){if(!e)return null;let n=Ic(e);return n===null&&(Zc.test(e)?n=ll(e,t):Qc.test(e)&&(n=ul(e,t))),n}function ll(e,t){let n=Zc.exec(e),r=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/t.frameRate}function ul(e,t){let n=Qc.exec(e),r=Number(n[1]);switch(n[2]){case`h`:return r*3600;case`m`:return r*60;case`ms`:return r*1e3;case`f`:return r/t.frameRate;case`t`:return r/t.tickRate}return r}var dl=class{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}},fl=class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=gl(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new dl(this,`textTrack1`),t=new dl(this,`textTrack2`),n=new dl(this,`textTrack3`),r=new dl(this,`textTrack4`);this.cea608Parser1=new Ac(1,e,t),this.cea608Parser2=new Ac(3,n,r)}addCues(e,t,n,r,i){let a=!1;for(let e=i.length;e--;){let r=i[e],o=hl(r[0],r[1],t,n);if(o>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],n),a=!0,o/(n-t)>.5))return}if(a||i.push([t,n]),this.config.renderTextTracksNatively){let i=this.captionsTracks[e];this.Cues.newCue(i,t,n,r)}else{let i=this.Cues.newCue(null,t,n,r);this.hls.trigger(f.CUES_PARSED,{type:`captions`,cues:i,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:a}){let{unparsedVttFrags:o}=this;n===m.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:i,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(f.FRAG_LOADED,e):this.hls.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,error:Error(`Subtitle discontinuity domain does not match main`)})}))}getExistingTrack(e,t){let{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){let i=n.textTracks[r];if(ml(i,{name:e,lang:t,characteristics:`transcribes-spoken-dialog,describes-music-and-sound`}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:a}=t[e],o=this.getExistingTrack(i,a);if(o)n[e]=o,Us(n[e]),Vs(n[e],r);else{let t=this.createTextTrack(`captions`,i,a);t&&(t[e]=!0,n[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let n={_id:e,label:t.label,kind:`captions`,default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(f.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,n){let r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){let n=!!t.transferMedia;if(this.media=null,n)return;let{captionsTracks:r}=this;Object.keys(r).forEach(e=>{Us(r[e]),delete r[e]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=gl(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let e=0;e<t.length;e++)Us(t[e])}onSubtitleTracksUpdated(e,t){let n=t.subtitleTracks||[],r=n.some(e=>e.textCodec===Xc);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(so(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){let e=this.media,t=e?qs(e.textTracks):null;if(this.tracks.forEach((e,n)=>{let r;if(t){let n=null;for(let r=0;r<t.length;r++)if(t[r]&&ml(t[r],e)){n=t[r],t[r]=null;break}n&&(r=n)}if(r)Us(r);else{let t=pl(e);r=this.createTextTrack(t,e.name,e.lang),r&&(r.mode=`disabled`)}r&&this.textTracks.push(r)}),t!=null&&t.length){let e=t.filter(e=>e!==null).map(e=>e.label);e.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${e.join(`, `)}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(f.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let n=`textTrack${t[1]}`,r=this.captionsProperties[n];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){return this.hls.levels[e.level]?.attrs[`CLOSED-CAPTIONS`]}onFragLoading(e,t){if(this.enabled&&t.frag.type===m.MAIN){let{cea608Parser1:e,cea608Parser2:n,lastSn:r}=this,{cc:i,sn:a}=t.frag,o=t.part?.index??-1;e&&n&&(a!==r+1||a===r&&o!==this.lastPartIndex+1||i!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=i,this.lastSn=a,this.lastPartIndex=o}}onFragLoaded(e,t){let{frag:n,payload:r}=t;if(n.type===m.SUBTITLE)if(r.byteLength){let e=n.decryptdata,i=`stats`in t;if(e==null||!e.encrypted||i){let e=this.tracks[n.level],i=this.vttCCs;i[n.cc]||(i[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),e&&e.textCodec===Xc?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:Error(`Empty subtitle payload`)})}_parseIMSC1(e,t){let n=this.hls;el(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),n.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{n.logger.log(`Failed to parse IMSC1: ${t}`),n.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;let{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:a}=this,o=i.length-1;if(!i[n.cc]&&o===-1){a.push(e);return}let s=this.hls;Yc((t=n.initSegment)!=null&&t.data?Ne(n.initSegment.data,new Uint8Array(r)).buffer:r,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,e=>{this._appendCues(e,n.level),s.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},t=>{let i=t.message===`Missing initPTS for VTT MPEGTS`;i?a.push(e):this._fallbackToIMSC1(n,r),s.logger.log(`Failed to parse VTT cue: ${t}`),!(i&&o>n.cc)&&s.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})})}_fallbackToIMSC1(e,t){let n=this.tracks[e.level];n.textCodec||el(t,this.initPTS[e.cc],()=>{n.textCodec=Xc,this._parseIMSC1(e,t)},()=>{n.textCodec=`wvtt`})}_appendCues(e,t){let n=this.hls;if(this.config.renderTextTracksNatively){let n=this.textTracks[t];if(!n||n.mode===`disabled`)return;e.forEach(e=>Hs(n,e))}else{let r=this.tracks[t];if(!r)return;let i=r.default?`default`:`subtitles`+t;n.trigger(f.CUES_PARSED,{type:`subtitles`,cues:e,track:i})}}onFragDecrypted(e,t){let{frag:n}=t;n.type===m.SUBTITLE&&this.onFragLoaded(f.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:n,samples:r}=t;if(!(n.type===m.MAIN&&this.closedCaptionsForLevel(n)===`NONE`))for(let e=0;e<r.length;e++){let t=r[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();let n=this.extractCea608Data(t);this.cea608Parser1.addData(r[e].pts,n[0]),this.cea608Parser2.addData(r[e].pts,n[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){let{media:a}=this;if(!(!a||a.currentTime<n)){if(!i||i===`video`){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>Ws(e[r],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){let{textTracks:e}=this;Object.keys(e).forEach(n=>Ws(e[n],t,r))}}}extractCea608Data(e){let t=[[],[]],n=e[0]&31,r=2;for(let i=0;i<n;i++){let n=e[r++],i=127&e[r++],a=127&e[r++];if(!(i===0&&a===0)&&4&n){let e=3&n;(e===0||e===1)&&(t[e].push(i),t[e].push(a))}}return t}};function pl(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?`captions`:`subtitles`}function ml(e,t){return!!e&&e.kind===pl(t)&&lo(t,e)}function hl(e,t,n,r){return Math.min(t,r)-Math.max(e,n)}function gl(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const _l=/\s/,vl={newCue(e,t,n,r){let i=[],a,o,s,c,l,u=self.VTTCue||self.TextTrackCue;for(let f=0;f<r.rows.length;f++)if(a=r.rows[f],s=!0,c=0,l=``,!a.isEmpty()){var d;for(let e=0;e<a.chars.length;e++)_l.test(a.chars[e].uchar)&&s?c++:(l+=a.chars[e].uchar,s=!1);a.cueStartTime=t,t===n&&(n+=1e-4),c>=16?c--:c++;let r=Hc(l.trim()),p=qc(t,n,r);e!=null&&(d=e.cues)!=null&&d.getCueById(p)||(o=new u(t,n,r),o.id=p,o.line=f+1,o.align=`left`,o.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(o))}return e&&i.length&&(i.sort((e,t)=>e.line===`auto`||t.line===`auto`?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),i.forEach(t=>Hs(e,t))),i}};function yl(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const bl=/(\d+)-(\d+)\/(\d+)/;var xl=class{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Tl,this.controller=new self.AbortController,this.stats=new oe}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){let r=this.stats;if(r.loading.start)throw Error(`Loader can only be used once.`);r.loading.start=self.performance.now();let i=Sl(e,this.controller.signal),a=e.responseType===`arraybuffer`,o=a?`byteLength`:`length`,{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=c&&s(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(eo(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(n=>{this.response=this.loader=n;let i=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},l-(i-r.loading.start)),!n.ok){let{status:e,statusText:t}=n;throw new El(t||`fetch, bad network response`,e,n)}r.loading.first=i,r.total=wl(n.headers)||r.total;let o=this.callbacks?.onProgress;return o&&s(t.highWaterMark)?this.loadProgressively(n,r,e,t.highWaterMark,o):a?n.arrayBuffer():e.responseType===`json`?n.json():n.text()}).then(n=>{var i;let a=this.response;if(!a)throw Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);let c=n[o];c&&(r.loaded=r.total=c);let l={url:a.url,data:n,code:a.status},u=this.callbacks?.onProgress;u&&!s(t.highWaterMark)&&u(r,e,n,a),(i=this.callbacks)==null||i.onSuccess(l,r,e,a)}).catch(t=>{var n;if(self.clearTimeout(this.requestTimeout),r.aborted)return;let i=t&&t.code||0,a=t?t.message:null;(n=this.callbacks)==null||n.onError({code:i,text:a},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,r=0,i){let a=new ii,o=e.body.getReader(),s=()=>o.read().then(o=>{if(o.done)return a.dataLength&&i(t,n,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let c=o.value,l=c.length;return t.loaded+=l,l<r||a.dataLength?(a.push(c),a.dataLength>=r&&i(t,n,a.flush().buffer,e)):i(t,n,c.buffer,e),s()}).catch(()=>Promise.reject());return s()}};function Sl(e,t){let n={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:t,headers:new self.Headers(v({},e.headers))};return e.rangeEnd&&n.headers.set(`Range`,`bytes=`+e.rangeStart+`-`+String(e.rangeEnd-1)),n}function Cl(e){let t=bl.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function wl(e){let t=e.get(`Content-Range`);if(t){let e=Cl(t);if(s(e))return e}let n=e.get(`Content-Length`);if(n)return parseInt(n)}function Tl(e,t){return new self.Request(e.url,t)}var El=class extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}};const Dl=/^age:\s*[\d.]+\s*$/im;var Ol=class{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new oe,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw Error(`Loader can only be used once.`);this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(e=>{if(!(this.loader!==n||this.stats.aborted))return n.open(`GET`,t.url,!0),i(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(e=>{var i;(i=this.callbacks)==null||i.onError({code:n.status,text:e.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open(`GET`,t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader(`Range`,`bytes=`+t.rangeStart+`-`+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=i&&s(i)?i:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:n}=this;if(!e||!t)return;let r=t.readyState,i=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,s=t.responseType===`text`?t.responseText:null;if(r>=200&&r<300){let i=s??t.response;if(i!=null){var a;n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=t.responseType===`arraybuffer`?i.byteLength:i.length,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);let o=this.callbacks?.onProgress;o&&o(n,e,i,t);let s={url:t.responseURL,data:i,code:r};(a=this.callbacks)==null||a.onSuccess(s,n,e,t);return}}let c=i.loadPolicy.errorRetry,l=n.retry;if(on(c,l,!1,{url:e.url,data:void 0,code:r}))this.retry(c);else{var o;j.error(`${r} while loading ${e.url}`),(o=this.callbacks)==null||o.onError({code:r,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(on(e,t,!0))this.retry(e);else{j.warn(`timeout while loading ${this.context?.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:n}=this;this.retryDelay=rn(e,n.retry),n.retry++,j.warn(`${status?`HTTP Status `+status:`Timeout`} while loading ${t?.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Dl.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};const kl=b(b({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:1/0,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:`edge`,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Ol,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Gt,bufferController:go,capLevelController:bo,errorController:un,fpsController:Bs,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:rr,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:`linear`}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Al()),{},{subtitleStreamController:mc,subtitleTrackController:Js,timelineController:fl,audioStreamController:ao,audioTrackController:uo,emeController:Fs,cmcdController:js,contentSteeringController:Ms,interstitialsController:pc});function Al(){return{cueHandler:vl,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:`English`,captionsTextTrack1LanguageCode:`en`,captionsTextTrack2Label:`Spanish`,captionsTextTrack2LanguageCode:`es`,captionsTextTrack3Label:`Unknown CC`,captionsTextTrack3LanguageCode:``,captionsTextTrack4Label:`Unknown CC`,captionsTextTrack4LanguageCode:``,renderTextTracksNatively:!0}}function jl(e,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let r=Ml(e),i=[`manifest`,`level`,`frag`],a=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];return i.forEach(e=>{let i=`${e===`level`?`playlist`:e}LoadPolicy`,o=t[i]===void 0,s=[];a.forEach(n=>{let a=`${e}Loading${n}`,c=t[a];if(c!==void 0&&o){s.push(a);let e=r[i].default;switch(t[i]={default:e},n){case`TimeOut`:e.maxLoadTimeMs=c,e.maxTimeToFirstByteMs=c;break;case`MaxRetry`:e.errorRetry.maxNumRetry=c,e.timeoutRetry.maxNumRetry=c;break;case`RetryDelay`:e.errorRetry.retryDelayMs=c,e.timeoutRetry.retryDelayMs=c;break;case`MaxRetryTimeout`:e.errorRetry.maxRetryDelayMs=c,e.timeoutRetry.maxRetryDelayMs=c;break}}}),s.length&&n.warn(`hls.js config: "${s.join(`", "`)}" setting(s) are deprecated, use "${i}": ${H(t[i])}`)}),b(b({},r),t)}function Ml(e){return e&&typeof e==`object`?Array.isArray(e)?e.map(Ml):Object.keys(e).reduce((t,n)=>(t[n]=Ml(e[n]),t),{}):e}function Nl(e,t){let n=e.loader;n!==xl&&n!==Ol?(t.log(`[config]: Custom loader detected, cannot enable progressive streaming`),e.progressive=!1):yl()&&(e.loader=xl,e.progressive=!0,e.enableSoftwareAES=!0,t.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var Pl=class extends kn{constructor(e,t){super(`gap-controller`,e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;(e=this.media)!=null&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{this.hls&&(this.ended=this.media?.currentTime||1,this.hls.trigger(f.MEDIA_ENDED,{stalled:!1}))},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){let{hls:e}=this;e&&(e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;let n=this.media=t.media;Y(n,`playing`,this.onMediaPlaying),Y(n,`waiting`,this.onMediaWaiting),Y(n,`ended`,this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:n}=this;n&&(ei(n,`playing`,this.onMediaPlaying),ei(n,`waiting`,this.onMediaWaiting),ei(n,`ended`,this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;let t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){let n=this.hls?.config;if(!n)return;let r=this.media;if(!r)return;let{seeking:i}=r,a=this.seeking&&!i,o=!this.seeking&&i,s=r.paused&&!i||r.ended||r.playbackRate===0;if(this.seeking=i,e!==t){t&&(this.ended=0),this.moved=!0,i||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!s&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(o||a){a&&this.stallResolved(e);return}if(s){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(f.MEDIA_ENDED,{stalled:!1}));return}if(!G.getBuffered(r).length){this.nudgeRetry=0;return}let c=G.bufferInfo(r,e,0),l=c.nextStart||0,u=this.fragmentTracker;if(i&&u&&this.hls){let t=Fl(this.hls.inFlightFragments,e),n=c.len>2,r=!l||t||l-e>2&&!u.getPartialFragment(e);if(n||r)return;this.moved=!1}let d=this.hls?.latestLevelDetails;if(!this.moved&&this.stalled!==null&&u){if(!(c.len>0)&&!l)return;let t=Math.max(l,c.start||0)-e,n=d!=null&&d.live?d.targetduration*2:2,i=Ll(e,u);if(t>0&&(t<=n||i)){r.paused||this._trySkipBufferHole(i);return}}let p=n.detectStallWithCurrentTimeMs,m=self.performance.now(),h=this.waiting,g=this.stalled;if(g===null)if(h>0&&m-h<p)g=this.stalled=h;else{this.stalled=m;return}let _=m-g;if(!i&&(_>=p||h)&&this.hls){if(this.mediaSource?.readyState===`ended`&&!(d!=null&&d.live)&&Math.abs(e-(d?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(f.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}let v=G.bufferInfo(r,e,n.maxBufferHole);this._tryFixBufferStall(v,_,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(f.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;let r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){let n=G.bufferedInfo(G.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){let n=G.timeRangesToArray(r),i=G.bufferedInfo(n,t,0).bufferedIndex;if(i>-1&&i<n.length-1){let t=G.bufferedInfo(n,e,0).bufferedIndex,r=n[i].end,a=n[i+1].start;if((t===-1||t>i)&&a-r<1&&e-r<2){let n=Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${r} -> ${a} buffered index: ${t}`);this.warn(n.message),this.media.currentTime+=1e-6;let i=Ll(e,this.fragmentTracker);i&&`fragment`in i?i=i.fragment:i||=void 0;let o=G.bufferInfo(this.media,e,0);this.hls.trigger(f.ERROR,{type:u.MEDIA_ERROR,details:d.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:n,reason:n.message,frag:i,buffer:o.len,bufferInfo:o})}}}}}_tryFixBufferStall(e,t,n){let{fragmentTracker:r,media:i}=this,a=this.hls?.config;if(!i||!r||!a)return;let o=this.hls?.latestLevelDetails,s=Ll(n,r);if((s||o!=null&&o.live&&n<o.fragmentStart)&&(this._trySkipBufferHole(s)||!this.media))return;let c=e.buffered,l=this.adjacentTraversal(e,n);(c&&c.length>1&&e.len>a.maxBufferHole||e.nextStart&&(e.nextStart-n<a.maxBufferHole||l))&&(t>a.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn(`Trying to nudge playhead over buffer-hole`),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let n=this.fragmentTracker,r=e.nextStart;if(n&&r){let e=n.getFragAtPos(t,m.MAIN),i=n.getFragAtPos(r,m.MAIN);if(e&&i)return i.sn-e.sn<2}return!1}_reportStall(e){let{hls:t,media:n,stallReported:r,stalled:i}=this;if(!r&&i!==null&&n&&t){this.stallReported=!0;let r=Error(`Playback stalling at @${n.currentTime} due to low buffer (${H(e)})`);this.warn(r.message),t.trigger(f.ERROR,{type:u.MEDIA_ERROR,details:d.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){let{fragmentTracker:t,media:n}=this,r=this.hls?.config;if(!n||!t||!r)return 0;let i=n.currentTime,a=G.bufferInfo(n,i,0),o=i<a.start?a.start:a.nextStart;if(o&&this.hls){let c=a.len<=r.maxBufferHole,l=a.len>0&&a.len<1&&n.readyState<3,p=o-i;if(p>0&&(c||l)){if(p>r.maxBufferHole){let n=!1;if(i===0){let e=t.getAppendedFrag(0,m.MAIN);e&&o<e.end&&(n=!0)}if(!n&&e){var s;if(!((s=this.hls.loadLevelObj)!=null&&s.details)||Fl(this.hls.inFlightFragments,o))return 0;let n=!1,r=e.end;for(;r<o;){let e=Ll(r,t);if(e)r+=e.duration;else{n=!0;break}}if(n)return 0}}let c=Math.max(o+.05,i+.1);if(this.warn(`skipping hole, adjusting currentTime from ${i} to ${c}`),this.moved=!0,n.currentTime=c,!(e!=null&&e.gap)){let t=Error(`fragment loaded with buffer holes, seeking from ${i} to ${c}`),n={type:u.MEDIA_ERROR,details:d.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,buffer:a.len,bufferInfo:a};e&&(`fragment`in e?n.part=e:n.frag=e),this.hls.trigger(f.ERROR,n)}return c}}return 0}_tryNudgeBuffer(e){let{hls:t,media:n,nudgeRetry:r}=this,i=t?.config;if(!n||!i)return 0;let a=n.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){let o=a+(r+1)*i.nudgeOffset,s=Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(s.message),n.currentTime=o,t.trigger(f.ERROR,{type:u.MEDIA_ERROR,details:d.BUFFER_NUDGE_ON_STALL,error:s,fatal:!1,buffer:e.len,bufferInfo:e})}else{let n=Error(`Playhead still not moving while enough data buffered @${a} after ${i.nudgeMaxRetry} nudges`);this.error(n.message),t.trigger(f.ERROR,{type:u.MEDIA_ERROR,details:d.BUFFER_STALLED_ERROR,error:n,fatal:!0,buffer:e.len,bufferInfo:e})}}};function Fl(e,t){let n=Il(e.main);if(n&&n.start<=t)return n;let r=Il(e.audio);return r&&r.start<=t?r:null}function Il(e){if(!e)return null;switch(e.state){case X.IDLE:case X.STOPPED:case X.ENDED:case X.ERROR:return null}return e.frag}function Ll(e,t){return t.getAppendedFrag(e,m.MAIN)||t.getPartialFragment(e)}function Rl(){if(!(typeof self>`u`))return self.VTTCue||self.TextTrackCue}function zl(e,t,n,r,i){let a=new e(t,n,``);try{a.value=r,i&&(a.type=i)}catch{a=new e(t,n,H(i?b({type:i},r):r))}return a}const Bl=(()=>{let e=Rl();try{e&&new e(0,1/0,``)}catch{return Number.MAX_VALUE}return 1/0})();var Vl=class{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(f.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){let{hls:e}=this;e&&(e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(f.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(f.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){this.media=t.media,t.overrides?.cueRemoval===!1&&(this.removeCues=!1)}onMediaAttached(){let e=this.hls?.latestLevelDetails;e&&this.updateDateRangeCues(e)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&=(this.removeCues&&Us(this.id3Track,this.onEventCueEnter),null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){let t=this.getID3Track(e.textTracks);return t.mode=`hidden`,t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){let n=e[t];if(n.kind===`metadata`&&n.label===`id3`)return Vs(n,this.media),n}return this.media.addTextTrack(`metadata`,`id3`)}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:n,enableID3MetadataCues:r}=this.hls.config;if(!n&&!r)return;let{samples:i}=t;this.id3Track||=this.createTrack(this.media);let a=Rl();if(a)for(let e=0;e<i.length;e++){let t=i[e].type;if(t===Ji.emsg&&!n||!r)continue;let o=Wi(i[e].data),s=i[e].pts,c=s+i[e].duration;c>Bl&&(c=Bl),c-s<=0&&(c=s+.25);for(let e=0;e<o.length;e++){let n=o[e];if(!Gi(n)){this.updateId3CueEnds(s,t);let e=zl(a,s,c,n,t);e&&this.id3Track.addCue(e)}}}}updateId3CueEnds(e,t){let n=this.id3Track?.cues;if(n)for(let r=n.length;r--;){let i=n[r];i.type===t&&i.startTime<e&&i.endTime===Bl&&(i.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){let{id3Track:i,hls:a}=this;if(!a)return;let{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:s}}=a;if(i&&(o||s)){let e;e=r===`audio`?e=>e.type===Ji.audioId3&&s:r===`video`?e=>e.type===Ji.emsg&&o:e=>e.type===Ji.audioId3&&s||e.type===Ji.emsg&&o,Ws(i,t,n,e)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;let{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:i,interstitialsController:a}=this.hls.config;if(!i)return;let o=Rl();if(n&&r&&!a){let{fragmentStart:t,fragmentEnd:r}=e,i=this.assetCue;i?(i.startTime=t,i.endTime=r):o&&(i=this.assetCue=zl(o,t,r,{assetPlayerId:this.hls.config.assetPlayerId},`hlsjs.interstitial.asset`),i&&(i.id=n,this.id3Track||=this.createTrack(this.media),this.id3Track.addCue(i),i.addEventListener(`enter`,this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;let{id3Track:c}=this,{dateRanges:l}=e,u=Object.keys(l),d=this.dateRangeCuesAppended;if(c&&t){var f;if((f=c.cues)!=null&&f.length){let e=Object.keys(d).filter(e=>!u.includes(e));for(let t=e.length;t--;){let n=e[t],r=d[n]?.cues;delete d[n],r&&Object.keys(r).forEach(e=>{let t=r[e];if(t){t.removeEventListener(`enter`,this.onEventCueEnter);try{c.removeCue(t)}catch{}}})}}else d=this.dateRangeCuesAppended={}}let p=e.fragments[e.fragments.length-1];if(!(u.length===0||!s(p?.programDateTime))){this.id3Track||=this.createTrack(this.media);for(let e=0;e<u.length;e++){let t=u[e],n=l[t],r=n.startTime,i=d[t],s=i?.cues||{},c=i?.durationKnown||!1,f=Bl,{duration:p,endDate:m}=n;if(m&&p!==null)f=r+p,c=!0;else if(n.endOnNext&&!c){let e=u.reduce((e,t)=>{if(t!==n.id){let r=l[t];if(r.class===n.class&&r.startDate>n.startDate&&(!e||n.startDate<e.startDate))return r}return e},null);e&&(f=e.startTime,c=!0)}let h=Object.keys(n.attr);for(let e=0;e<h.length;e++){let l=h[e];if(!Bn(l))continue;let u=s[l];if(u)c&&!(i!=null&&i.durationKnown)?u.endTime=f:Math.abs(u.startTime-r)>.01&&(u.startTime=r,u.endTime=f);else if(o){let e=n.attr[l];Vn(l)&&(e=ee(e));let i=zl(o,r,f,{key:l,data:e},Ji.dateRange);i&&(i.id=t,this.id3Track.addCue(i),s[l]=i,a&&(l===`X-ASSET-LIST`||l===`X-ASSET-URL`)&&i.addEventListener(`enter`,this.onEventCueEnter))}}d[t]={cues:s,dateRange:n,durationKnown:c}}}}},Hl=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{let{media:e}=this,t=this.levelDetails;if(!e||!t)return;this.currentTime=e.currentTime;let n=this.computeLatency();if(n===null)return;this._latency=n;let{lowLatencyMode:r,maxLiveSyncPlaybackRate:i}=this.config;if(!r||i===1||!t.live)return;let a=this.targetLatency;if(a===null)return;let o=n-a;if(o<Math.min(this.maxLatency,a+t.targetduration)&&o>.05&&this.forwardBufferLength>1){let t=Math.min(2,Math.max(1,i)),n=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20,r=Math.min(t,Math.max(1,n));this.changeMediaPlaybackRate(e,r)}else e.playbackRate!==1&&e.playbackRate!==0&&this.changeMediaPlaybackRate(e,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){return this.hls?.latestLevelDetails||null}get latency(){return this._latency||0}get maxLatency(){let{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;let t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){let e=this.levelDetails;if(e===null||this.hls===null)return null;let{holdBack:t,partHoldBack:n,targetduration:r}=e,{liveSyncDuration:i,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,s=this.hls.userConfig,c=o&&n||t;(this._targetLatencyUpdated||s.liveSyncDuration||s.liveSyncDurationCount||c===0)&&(c=i===void 0?a*r:i);let l=r;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,l)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;let n=this.levelDetails;if(n===null)return null;let r=n.edge,i=e-t-this.edgeStalled,a=r-n.totalduration,o=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,i),o)}get drift(){let e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(e===null)return 0;let t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;e&&(e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(f.ERROR,this.onError,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(f.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener(`timeupdate`,this.onTimeupdate)}onMediaDetaching(){this.media&&=(this.media.removeEventListener(`timeupdate`,this.onTimeupdate),null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener(`timeupdate`,this.onTimeupdate)}onError(e,t){var n;t.details===d.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn(`[latency-controller]: Stall detected, adjusting target latency`))}changeMediaPlaybackRate(e,t){var n;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${this.targetLatency?.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}},Ul=class extends oo{constructor(e,t){super(e,`level-controller`),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let n=this.hls.config.preferManagedMediaSource,r=[],i={},a={},o=!1,s=!1,c=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:l,videoCodec:u}=e;l&&(e.audioCodec=l=tt(l,n)||void 0),u&&=e.videoCodec=at(u);let{width:d,height:f,unknownCodecs:p}=e,m=p?.length||0;if(o||=!!(d&&f),s||=!!u,c||=!!l,m||l&&!this.isAudioSupported(l)||u&&!this.isVideoSupported(u)){this.log(`Some or all CODECS not supported "${t.CODECS}"`);return}let{CODECS:h,"FRAME-RATE":g,"HDCP-LEVEL":_,"PATHWAY-ID":v,RESOLUTION:y,"VIDEO-RANGE":b}=t,x=`${`${v||`.`}-`}${e.bitrate}-${y}-${g}-${h}-${b}-${_}`;if(!i[x]){let t=this.createLevel(e);i[x]=t,a[x]=1,r.push(t)}else if(i[x].uri!==e.url&&!e.attrs[`PATHWAY-ID`]){let t=a[x]+=1;e.attrs[`PATHWAY-ID`]=Array(t+1).join(`.`);let n=this.createLevel(e);i[x]=n,r.push(n)}else i[x].addGroupId(`audio`,t.AUDIO),i[x].addGroupId(`text`,t.SUBTITLES)}),this.filterAndSortMediaOptions(r,t,o,s,c)}createLevel(e){let t=new Dt(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){let e=Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(e.message),t.supportedResult=ft(e,[])}return t}isAudioSupported(e){return qe(e,`audio`,this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return qe(e,`video`,this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,i){let a=[],o=[],s=e,c=t.stats?.parsing||{};if((n||r)&&i&&(s=s.filter(({videoCodec:e,videoRange:t,width:n,height:r})=>(!!e||!!(n&&r))&&Ct(t))),s.length===0){Promise.resolve().then(()=>{if(this.hls){let e=`no level with compatible codecs found in manifest`,n=e;t.levels.length&&(n=`one or more CODECS in variant not supported: ${H(t.levels.map(e=>e.attrs.CODECS).filter((e,t,n)=>n.indexOf(e)===t))}`,this.warn(n),e+=` (${n})`);let r=Error(e);this.hls.trigger(f.ERROR,{type:u.MEDIA_ERROR,details:d.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:n})}}),c.end=performance.now();return}t.audioTracks&&(a=t.audioTracks.filter(e=>!e.audioCodec||this.isAudioSupported(e.audioCodec)),Wl(a)),t.subtitles&&(o=t.subtitles,Wl(o));let l=s.slice(0);s.sort((e,t)=>{if(e.attrs[`HDCP-LEVEL`]!==t.attrs[`HDCP-LEVEL`])return(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return St.indexOf(e.videoRange)-St.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let n=Xe(e.videoCodec),r=Xe(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let n=Ze(e.codecSet),r=Ze(t.codecSet);if(n!==r)return r-n}return e.averageBitrate===t.averageBitrate?0:e.averageBitrate-t.averageBitrate});let p=l[0];if(this.steering&&(s=this.steering.filterParsedLevels(s),s.length!==l.length)){for(let e=0;e<l.length;e++)if(l[e].pathwayId===s[0].pathwayId){p=l[e];break}}this._levels=s;for(let e=0;e<s.length;e++)if(s[e]===p){this._firstLevel=e;let t=p.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${s.length} level(s) found, first bitrate: ${t}`),this.hls.userConfig?.abrEwmaDefaultEstimate===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let m=i&&!r,h=this.hls.config,g=!!(h.audioStreamController&&h.audioTrackController),_={levels:s,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:g&&!m&&a.some(e=>!!e.url)};c.end=performance.now(),this.hls.trigger(f.MANIFEST_PARSED,_)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(f.ERROR,{type:u.OTHER_ERROR,details:d.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}let n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs[`PATHWAY-ID`]:void 0,a=t[e],o=a.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=a,n===e&&r&&i===o)return;this.log(`Switching to level ${e} (${a.height?a.height+`p `:``}${a.videoRange?a.videoRange+` `:``}${a.codecSet?a.codecSet+` `:``}@${a.bitrate})${o?` with Pathway `+o:``} from level ${n}${i?` with Pathway `+i:``}`);let s={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(f.LEVEL_SWITCHING,s);let c=a.details;if(!c||c.live){let e=this.switchParams(a.uri,r?.details,c);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){let e=this.hls.config.startLevel;return e===void 0?this.hls.firstAutoLevel:e}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),n=e.filter(e=>t.indexOf(e)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===p.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===m.MAIN){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;let{level:r,details:i}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let e=a.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(r,t,e)}else (n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,i=e.attrs[`PATHWAY-ID`],a=e.details,o=a?.age;this.log(`Loading level index ${r}${t?.msn===void 0?``:` at sn `+t.msn+` part `+t.part}${i?` Pathway `+i:``}${o&&a.live?` age `+o.toFixed(1)+(a.type&&` `+a.type||``):``} ${n}`),this.hls.trigger(f.LEVEL_LOADING,{url:n,level:r,levelInfo:e,pathwayId:e.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;let n=this._levels.filter((t,n)=>n===e?(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1):!0);Wr(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&=Math.min(this._startLevel,r),this.hls.trigger(f.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(f.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}};function Wl(e){let t={};e.forEach(e=>{let n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}function Gl(){return self.SourceBuffer||self.WebKitSourceBuffer}function Kl(){if(!M())return!1;let e=Gl();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function ql(){if(!Kl())return!1;let e=M();return typeof e?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(t=>e.isTypeSupported(Ye(t,`video`)))||[`mp4a.40.2`,`fLaC`].some(t=>e.isTypeSupported(Ye(t,`audio`))))}function Jl(){var e;let t=Gl();return typeof(t==null||(e=t.prototype)==null?void 0:e.changeType)==`function`}var Yl=class extends ni{constructor(e,t,n){super(e,t,n,`stream-controller`,m.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{let e=this.media,t=e?e.currentTime:null;if(t===null||!s(t)||(this.log(`Media seeked to ${t.toFixed(3)}`),!this.getBufferedFrag(t)))return;let n=this.getFwdBufferInfoAtPos(e,t,m.MAIN,0);if(n===null||n.len===0){this.warn(`Main forward buffer length at ${t} on "seeked" event ${n?n.len:`empty`})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(f.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(f.BUFFER_CREATED,this.onBufferCreated,this),e.on(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(f.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(f.BUFFER_CREATED,this.onBufferCreated,this),e.off(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){let{lastCurrentTime:n,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=r.startLevel;e===-1&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=X.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=X.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case X.WAITING_LEVEL:{let{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=X.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=X.IDLE;break}break}case X.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===X.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;let a=n[i],o=this.getMainFwdBufferInfo();if(o===null)return;let s=this.getLevelDetails();if(s&&this._streamEnded(o,s)){let e={};this.altAudio===2&&(e.type=`video`),this.hls.trigger(f.BUFFER_EOS,e),this.state=X.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;let c=a.details;if(!c||this.state===X.WAITING_LEVEL||this.waitForLive(a)){this.level=i,this.state=X.WAITING_LEVEL,this.startFragRequested=!1;return}let l=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(l>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let d=this.backtrackFragment?this.backtrackFragment.start:o.end,p=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&R(p)&&this.fragmentTracker.getState(p)!==W.OK){let e=(this.backtrackFragment??p).sn-c.startSN,t=c.fragments[e-1];t&&p.cc===t.cc&&(p=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,d)){if(!p.gap){let e=this.audioOnly&&!this.altAudio?L.AUDIO:L.VIDEO,t=(e===L.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,m.MAIN)}p=this.getNextFragmentLoopLoading(p,c,o,m.MAIN,u)}p&&(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,a,d))}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);r===W.NOT_LOADED||r===W.PARTIAL?R(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,m.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let n,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let i=this.getLevelDetails();if(i!=null&&i.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<i.targetduration*2)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;n=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else n=0;let a=this.getBufferedFrag(t.currentTime+n);if(a){let e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,r=Math.max(a.end,t+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case X.KEY_LOADING:case X.FRAG_LOADING:case X.FRAG_LOADING_WAITING_RETRY:case X.PARSING:case X.PARSED:this.state=X.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let n=t.media;Y(n,`playing`,this.onMediaPlaying),Y(n,`seeked`,this.onMediaSeeked)}onMediaDetaching(e,t){let{media:n}=this;n&&(ei(n,`playing`,this.onMediaPlaying),ei(n,`seeked`,this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log(`Trigger BUFFER_RESET`),this.hls.trigger(f.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,r=!1;for(let e=0;e<t.levels.length;e++){let i=t.levels[e].audioCodec;i&&(n||=i.indexOf(`mp4a.40.2`)!==-1,r||=i.indexOf(`mp4a.40.5`)!==-1)}this.audioCodecSwitch=n&&r&&!Jl(),this.audioCodecSwitch&&this.log(`Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC`),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){let{levels:n}=this;if(!n||this.state!==X.IDLE)return;let r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=X.WAITING_LEVEL)}onLevelLoaded(e,t){var n;let{levels:r,startFragRequested:i}=this,a=t.level,o=t.details,s=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:``}, cc [${o.startCC}, ${o.endCC}] duration:${s}`);let c=t.levelInfo,l=this.fragCurrent;l&&(this.state===X.FRAG_LOADING||this.state===X.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let u=0;if(o.live||(n=c.details)!=null&&n.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;u=this.alignPlaylists(o,c.details,this.levelLastLoaded?.details)}if(c.details=o,this.levelLastLoaded=c,i||this.setStartPosition(o,u),this.hls.trigger(f.LEVEL_UPDATED,{details:o,level:a}),this.state===X.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=X.IDLE}i&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){let{config:t,media:n}=this;if(!n)return;let r=this.hls.liveSyncPosition,i=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,s=i>=a-t.maxFragLookUpTolerance&&i<=o;if(r!==null&&n.duration>r&&(i<r||!s)){let a=t.liveMaxLatencyDuration===void 0?t.liveMaxLatencyDurationCount*e.targetduration:t.liveMaxLatencyDuration;if((!s&&n.readyState<4||i<o-a)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode===`buffered`){var c;let e=G.bufferInfo(n,r,0);if(!((c=e.buffered)!=null&&c.length)){n.currentTime=r;return}if(e.start<=i){n.currentTime=r;return}let{nextStart:t}=G.bufferedInfo(e.buffered,i,0);t&&(n.currentTime=t)}else n.currentTime=r}}_handleFragmentLoadProgress(e){let t=e.frag,{part:n,payload:r}=e,{levels:i}=this;if(!i){this.warn(`Levels were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let a=i[t.level];if(!a){this.warn(`Level ${t.level} not found on progress`);return}let o=a.details;if(!o){this.warn(`Dropping fragment ${t.sn} of level ${t.level} after level details were reset`),this.fragmentTracker.removeFragment(t);return}let s=a.videoCodec,c=o.PTSKnown||!o.live,l=t.initSegment?.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new io(this.hls,m.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=f!==-1,h=new An(t.level,t.sn,t.stats.chunkCount,r.byteLength,f,p),g=this.initPTS[t.cc];d.push(r,l,u,s,t,n,o.totalduration,c,h,g)}onAudioTrackSwitching(e,t){let n=this.hls,r=this.altAudio!==0;if(Wt(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log(`Switching to main audio track, cancel main fragment load`),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(f.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(f.AUDIO_TRACK_SWITCHED,t)}),n.trigger(f.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null});return}n.trigger(f.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let n=Wt(t.url,this.hls);if(n){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=e)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){let n=t.tracks,r,i,a=!1;for(let e in n){let t=n[e];if(t.id===`main`){if(i=e,r=t,e===`video`){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:n,part:r}=t,i=n.type===m.MAIN;if(i){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?` p: `+r.index:``} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===X.PARSED&&(this.state=X.IDLE);return}let e=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*e.total/(e.buffering.end-e.loading.first)),R(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}let a=this.media;a&&(!this._hasEnoughToStart&&G.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){if(t.fatal){this.state=X.ERROR;return}switch(t.details){case d.FRAG_GAP:case d.FRAG_PARSING_ERROR:case d.FRAG_DECRYPT_ERROR:case d.FRAG_LOAD_ERROR:case d.FRAG_LOAD_TIMEOUT:case d.KEY_LOAD_ERROR:case d.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(m.MAIN,t);break;case d.LEVEL_LOAD_ERROR:case d.LEVEL_LOAD_TIMEOUT:case d.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===X.WAITING_LEVEL&&t.context?.type===p.LEVEL&&(this.state=X.IDLE);break;case d.BUFFER_ADD_CODEC_ERROR:case d.BUFFER_APPEND_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case d.BUFFER_FULL_ERROR:if(t.parent!==`main`)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,1/0));break;case d.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=X.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==L.AUDIO||!this.altAudio){let e=(t===L.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,t,m.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}let r=this.timelineOffset;r&&n&&(n+=r);let i=this.getLevelDetails(),a=G.getBuffered(e),o=a.length?a.start(0):0,s=o-n,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||s>0&&(s<c||this.loadingParts&&s<2*(i?.partTarget||0)))&&(this.log(`adjusting start position by ${s} to match buffer start`),n+=s,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${o}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{let{hls:n}=this,r=e?.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=X.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let i=r.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),n.trigger(f.FRAG_LOADED,e),r.bitrateTest=!1}).catch(t=>{this.state===X.STOPPED||this.state===X.ERROR||(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:i}=e,a=this.getCurrentContext(i);if(!a){this.resetWhenMissingContext(i);return}let{frag:o,part:c,level:l}=a,{video:u,text:d,id3:p,initSegment:m}=r,{details:h}=l,g=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=X.PARSING,m){let e=m.tracks;if(e){let r=o.initSegment||o;if(this.unhandledEncryptionError(m,o))return;this._bufferInitSegment(l,e,r,i),n.trigger(f.FRAG_PARSING_INIT_SEGMENT,{frag:r,id:t,tracks:e})}let r=m.initPTS,a=m.timescale,c=this.initPTS[o.cc];if(s(r)&&(!c||c.baseTime!==r||c.timescale!==a)){let e=m.trackId;this.initPTS[o.cc]={baseTime:r,timescale:a,trackId:e},n.trigger(f.INIT_PTS_FOUND,{frag:o,id:t,initPTS:r,timescale:a,trackId:e})}}if(u&&h){g&&u.type===`audiovideo`&&this.logMuxedErr(o);let e=h.fragments[o.sn-1-h.startSN],t=o.sn===h.startSN,n=!e||o.cc>e.cc;if(r.independent!==!1){let{startPTS:e,endPTS:r,startDTS:a,endDTS:s}=u;if(c)c.elementaryStreams[u.type]={startPTS:e,endPTS:r,startDTS:a,endDTS:s};else if(u.firstKeyFrame&&u.independent&&i.id===1&&!n&&(this.couldBacktrack=!0),u.dropped&&u.independent){let i=this.getMainFwdBufferInfo(),a=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,c=u.firstKeyFramePTS?u.firstKeyFramePTS:e;if(!t&&a<c-this.config.maxBufferHole&&!n){this.backtrack(o);return}else n&&(o.gap=!0);o.setElementaryStreamInfo(u.type,o.start,r,o.start,s,!0)}else t&&e-(h.appliedTimelineOffset||0)>2&&(o.gap=!0);o.setElementaryStreamInfo(u.type,e,r,a,s),this.backtrackFragment&&=o,this.bufferFragmentData(u,o,c,i,t||n)}else if(t||n)o.gap=!0;else{this.backtrack(o);return}}if(g){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=g;c&&(c.elementaryStreams[L.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),o.setElementaryStreamInfo(L.AUDIO,e,t,n,r),this.bufferFragmentData(g,o,c,i)}if(h&&p!=null&&p.samples.length){let e={id:t,frag:o,details:h,samples:p.samples};n.trigger(f.FRAG_PARSING_METADATA,e)}if(h&&d){let e={id:t,frag:o,details:h,samples:d.samples};n.trigger(f.FRAG_PARSING_USERDATA,e)}}logMuxedErr(e){this.warn(`${R(e)?`Media`:`Init`} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==X.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));let{audio:i,video:a,audiovideo:o}=t;if(i){let n=e.audioCodec,r=rt(i.codec,n);r===`mp4a`&&(r=`mp4a.40.5`);let a=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){r&&=r.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`;let e=i.metadata;e&&`channelCount`in e&&(e.channelCount||1)!==1&&a.indexOf(`firefox`)===-1&&(r=`mp4a.40.5`)}r&&r.indexOf(`mp4a.40.5`)!==-1&&a.indexOf(`android`)!==-1&&i.container!==`audio/mpeg`&&(r=`mp4a.40.2`,this.log(`Android: force audio codec to ${r}`)),n&&n!==r&&this.log(`Swapping manifest audio codec "${n}" for "${r}"`),i.levelCodec=r,i.id=m.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${r||``}/${n||``}/${i.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=m.MAIN;let n=a.codec;if(n?.length===4)switch(n){case`hvc1`:case`hev1`:a.codec=`hvc1.1.6.L120.90`;break;case`av01`:a.codec=`av01.0.04M.08`;break;case`avc1`:a.codec=`avc1.42e01e`;break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||``}/${n}]${a.codec===n?``:` parsed-corrected=`+a.codec}${a.supplemental?` supplemental=`+a.supplemental:``}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);let s=Object.keys(t);if(s.length){if(this.hls.trigger(f.BUFFER_CODECS,t),!this.hls)return;s.forEach(e=>{let i=t[e].initSegment;i!=null&&i.byteLength&&this.hls.trigger(f.BUFFER_APPENDING,{type:e,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,m.MAIN)}get maxBufferLength(){let{levels:e,level:t}=this,n=e?.[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=X.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let n=e.currentTime;if(G.isBuffered(e,n)?t=this.getAppendedFrag(n):G.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,n=t.level;(!e||t.sn!==e.sn||e.level!==n)&&(this.fragPlaying=t,this.hls.trigger(f.FRAG_CHANGED,{frag:t}),(!e||e.level!==n)&&this.hls.trigger(f.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){if(this.fragPlaying)return this.fragPlaying;let e=this.media?.currentTime||this.lastCurrentTime;return s(e)?this.getAppendedFrag(e):null}get currentProgramDateTime(){let e=this.media?.currentTime||this.lastCurrentTime;if(s(e)){let t=this.getLevelDetails(),n=this.currentFrag||(t?Jt(null,t.fragments,e):null);if(n){let t=n.programDateTime;if(t!==null){let r=t+(e-n.start)*1e3;return new Date(r)}}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},Xl=class extends C{constructor(e,t){super(`key-loader`,t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let t in this.keyIdToKeyInfo){let n=this.keyIdToKeyInfo[t].loader;if(n){if(e&&e!==n.context?.frag.type)return;n.abort()}}}detach(){for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyIdToKeyInfo){let t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=d.KEY_LOAD_ERROR,n,r,i){return new On({type:u.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,i=t.length;r<i;r++){let a=t[r];if(e.cc<=a.cc&&(!R(e)||!R(a)||e.sn<a.sn)||!n&&r==i-1)return this.emeController.selectKeySystemFormat(a).then(e=>{if(!this.emeController)return;a.setKeyFormat(e);let t=er(e);if(t)return this.emeController.getKeySystemAccess([t])})}if(this.config.requireKeySystemAccessOnStart){let e=nr(this.config);if(e.length)return this.emeController.getKeySystemAccess(e)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,r;t&&e.setKeyFormat(t);let i=e.decryptdata;if(!i){let n=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,d.KEY_LOAD_ERROR,n))}let a=i.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,d.KEY_LOAD_ERROR,Error(`Invalid key URI: "${a}"`)));let o=Zl(i),s=this.keyIdToKeyInfo[o];if((n=s)!=null&&n.decryptdata.key)return i.key=s.decryptdata.key,Promise.resolve({frag:e,keyInfo:s});if(this.emeController&&(r=s)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(s.decryptdata)){case`usable`:case`usable-in-future`:return s.keyLoadPromise.then(t=>{let{keyInfo:n}=t;return i.key=n.decryptdata.key,{frag:e,keyInfo:n}})}switch(this.log(`${this.keyIdToKeyInfo[o]?`Rel`:`L`}oading${i.keyId?` keyId: `+I(i.keyId):``} URI: ${i.uri} from ${e.type} ${e.level}`),s=this.keyIdToKeyInfo[o]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return i.keyFormat===`identity`?this.loadKeyHTTP(s,e):this.loadKeyEME(s,e);case`AES-128`:case`AES-256`:case`AES-256-CTR`:return this.loadKeyHTTP(s,e);default:return Promise.reject(this.createKeyLoadError(e,d.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){let n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){let n=Oe(t.initSegment.data);if(n.length){let t=n[0];t.some(e=>e!==0)?(this.log(`Using keyId found in init segment ${I(t)}`),lr.setKeyIdForUri(e.decryptdata.uri,t)):(t=lr.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${I(t)}`)),e.decryptdata.keyId=t}}return!e.decryptdata.keyId&&!R(t)?Promise.resolve(n):(e.keyLoadPromise=this.emeController.loadKey(n).then(t=>(e.mediaKeySessionContext=t,n))).catch(n=>{throw e.keyLoadPromise=null,`data`in n&&(n.data.frag=t),n})}return Promise.resolve(n)}loadKeyHTTP(e,t){let n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((r,a)=>{let o={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},s=n.keyLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(o,c,{onSuccess:(e,t,n,i)=>{let{frag:o,keyInfo:s}=n,c=Zl(s.decryptdata);if(!o.decryptdata||s!==this.keyIdToKeyInfo[c])return a(this.createKeyLoadError(o,d.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),i));s.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,s.loader=null,r({frag:o,keyInfo:s})},onError:(e,n,r,i)=>{this.resetLoader(n),a(this.createKeyLoadError(t,d.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,b({url:o.url,data:void 0},e)))},onTimeout:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,d.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),r))},onAbort:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,d.INTERNAL_ABORTED,Error(`key loading aborted`),r))}})})}resetLoader(e){let{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null);let a=Zl(n.decryptdata)||r;delete this.keyIdToKeyInfo[a],i&&i.destroy()}};function Zl(e){if(e.keyFormat!==J.FAIRPLAY){let t=e.keyId;if(t)return I(t)}return e.uri}function Ql(e){let{type:t}=e;switch(t){case p.AUDIO_TRACK:return m.AUDIO;case p.SUBTITLE_TRACK:return m.SUBTITLE;default:return m.MAIN}}function $l(e,t){let n=e.url;return(n===void 0||n.indexOf(`data:`)===0)&&(n=t.url),n}var eu=class{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,n=t.pLoader,r=t.loader,i=new(n||r)(t);return this.loaders[e.type]=i,i}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:`text`,type:p.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:n,level:r,pathwayId:i,url:a,deliveryDirectives:o,levelInfo:s}=t;this.load({id:n,level:r,pathwayId:i,responseType:`text`,type:p.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:s})}onAudioTrackLoading(e,t){let{id:n,groupId:r,url:i,deliveryDirectives:a,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:p.AUDIO_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){let{id:n,groupId:r,url:i,deliveryDirectives:a,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:`text`,type:p.SUBTITLE_TRACK,url:i,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){let n=this.loaders[p.LEVEL];if(n){let e=n.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(n.abort(),delete this.loaders[p.LEVEL])}}load(e){let t=this.hls.config,n=this.getInternalLoader(e);if(n){let t=this.hls.logger,r=n.context;if(r&&r.levelOrTrack===e.levelOrTrack&&(r.url===e.url||r.deliveryDirectives&&!e.deliveryDirectives)){r.url===e.url?t.log(`[playlist-loader]: ignore ${e.url} ongoing request`):t.log(`[playlist-loader]: ignore ${e.url} in favor of ${r.url}`);return}t.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(r=e.type===p.MANIFEST?t.manifestLoadPolicy.default:v({},t.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),s(e.deliveryDirectives?.part)){let t;if(e.type===p.LEVEL&&e.level!==null?t=this.hls.levels[e.level].details:e.type===p.AUDIO_TRACK&&e.id!==null?t=this.hls.audioTracks[e.id].details:e.type===p.SUBTITLE_TRACK&&e.id!==null&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,n=t.targetduration;if(e&&n){let t=Math.max(e*3,n*.8)*1e3;r=v({},r,{maxTimeToFirstByteMs:Math.min(t,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,r.maxTimeToFirstByteMs)})}}}let i=r.errorRetry||r.timeoutRetry||{},a={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:i.maxNumRetry||0,retryDelay:i.retryDelayMs||0,maxRetryDelay:i.maxRetryDelayMs||0};n.load(e,a,{onSuccess:(e,t,n,r)=>{let i=this.getInternalLoader(n);this.resetInternalLoader(n.type);let a=e.data;t.parsing.start=performance.now(),vr.isMediaPlaylist(a)||n.type!==p.MANIFEST?this.handleTrackOrLevelPlaylist(e,t,n,r||null,i):this.handleMasterPlaylist(e,t,n,r)},onError:(e,t,n,r)=>{this.handleNetworkError(t,n,!1,e,r)},onTimeout:(e,t,n)=>{this.handleNetworkError(t,n,!0,void 0,e)}})}checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?`auto`:`force`} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){let i=this.hls,a=e.data,o=$l(e,n),s=vr.parseMasterPlaylist(a,o);if(s.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,s.playlistParsingError,r,t);return}let{contentSteering:c,levels:l,sessionData:u,sessionKeys:d,startTimeOffset:p,variableList:m}=s;this.variableList=m,l.forEach(e=>{let{unknownCodecs:t}=e;if(t){let{preferManagedMediaSource:n}=this.hls.config,{audioCodec:r,videoCodec:i}=e;for(let a=t.length;a--;){let o=t[a];qe(o,`audio`,n)?(e.audioCodec=r=r?`${r},${o}`:o,Ge.audio[r.substring(0,4)]=2,t.splice(a,1)):qe(o,`video`,n)&&(e.videoCodec=i=i?`${i},${o}`:o,Ge.video[i.substring(0,4)]=2,t.splice(a,1))}}});let{AUDIO:h=[],SUBTITLES:g,"CLOSED-CAPTIONS":_}=vr.parseMasterPlaylistMedia(a,o,s);h.length&&!h.some(e=>!e.url)&&l[0].audioCodec&&!l[0].attrs.AUDIO&&(this.hls.logger.log(`[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one`),h.unshift({type:`main`,name:`main`,groupId:`main`,default:!1,autoselect:!1,forced:!1,id:-1,attrs:new K({}),bitrate:0,url:``})),i.trigger(f.MANIFEST_LOADED,{levels:l,audioTracks:h,subtitles:g,captions:_,contentSteering:c,url:o,stats:t,networkDetails:r,sessionData:u,sessionKeys:d,startTimeOffset:p,variableList:m})}handleTrackOrLevelPlaylist(e,t,n,r,i){let a=this.hls,{id:o,level:c,type:l}=n,u=$l(e,n),d=s(c)?c:s(o)?o:0,m=Ql(n),h=vr.parseLevelPlaylist(e.data,u,d,m,0,this.variableList);if(l===p.MANIFEST){let e={attrs:new K({}),bitrate:0,details:h,name:``,url:u};h.requestScheduled=t.loading.start+Br(h,0),a.trigger(f.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=h,this.handlePlaylistLoaded(h,e,t,n,r,i)}handleManifestParsingError(e,t,n,r,i){this.hls.trigger(f.ERROR,{type:u.NETWORK_ERROR,details:d.MANIFEST_PARSING_ERROR,fatal:t.type===p.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})}handleNetworkError(e,t,n=!1,r,i){let a=`A network ${n?`timeout`:`error`+(r?` (status `+r.code+`)`:``)} occurred while loading ${e.type}`;e.type===p.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===p.AUDIO_TRACK||e.type===p.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);let o=Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let s=d.UNKNOWN,c=!1,l=this.getInternalLoader(e);switch(e.type){case p.MANIFEST:s=n?d.MANIFEST_LOAD_TIMEOUT:d.MANIFEST_LOAD_ERROR,c=!0;break;case p.LEVEL:s=n?d.LEVEL_LOAD_TIMEOUT:d.LEVEL_LOAD_ERROR,c=!1;break;case p.AUDIO_TRACK:s=n?d.AUDIO_TRACK_LOAD_TIMEOUT:d.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case p.SUBTITLE_TRACK:s=n?d.SUBTITLE_TRACK_LOAD_TIMEOUT:d.SUBTITLE_LOAD_ERROR,c=!1;break}l&&this.resetInternalLoader(e.type);let m={type:u.NETWORK_ERROR,details:s,fatal:c,url:e.url,loader:l,context:e,error:o,networkDetails:t,stats:i};r&&(m.response=b({url:t?.url||e.url,data:void 0},r)),this.hls.trigger(f.ERROR,m)}handlePlaylistLoaded(e,t,n,r,i,a){let o=this.hls,{type:s,level:c,levelOrTrack:l,id:h,groupId:g,deliveryDirectives:_}=r,v=$l(t,r),y=Ql(r),b=typeof r.level==`number`&&y===m.MAIN?c:void 0,x=e.playlistParsingError;if(x){if(this.hls.logger.warn(`${x} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(f.ERROR,{type:u.NETWORK_ERROR,details:d.LEVEL_PARSING_ERROR,fatal:!1,url:v,error:x,reason:x.message,response:t,context:r,level:b,parent:y,networkDetails:i,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){let a=e.playlistParsingError=Error(`No Segments found in Playlist`);o.trigger(f.ERROR,{type:u.NETWORK_ERROR,details:d.LEVEL_EMPTY_ERROR,fatal:!1,url:v,error:a,reason:a.message,response:t,context:r,level:b,parent:y,networkDetails:i,stats:n});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),s){case p.MANIFEST:case p.LEVEL:if(b){if(!l)b=0;else if(l!==o.levels[b]){let e=o.levels.indexOf(l);e>-1&&(b=e)}}o.trigger(f.LEVEL_LOADED,{details:e,levelInfo:l||o.levels[0],level:b||0,id:h||0,stats:n,networkDetails:i,deliveryDirectives:_,withoutMultiVariant:s===p.MANIFEST});break;case p.AUDIO_TRACK:o.trigger(f.AUDIO_TRACK_LOADED,{details:e,track:l,id:h||0,groupId:g||``,stats:n,networkDetails:i,deliveryDirectives:_});break;case p.SUBTITLE_TRACK:o.trigger(f.SUBTITLE_TRACK_LOADED,{details:e,track:l,id:h||0,groupId:g||``,stats:n,networkDetails:i,deliveryDirectives:_});break}}},$=class e{static get version(){return ui}static isMSESupported(){return Kl()}static isSupported(){return ql()}static getMediaSource(){return M()}static get Events(){return f}static get MetadataSchema(){return Ji}static get ErrorTypes(){return u}static get ErrorDetails(){return d}static get DefaultConfig(){return e.defaultConfig?e.defaultConfig:kl}static set DefaultConfig(t){e.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new li,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;let n=this.logger=A(t.debug||!1,`Hls instance`,t.assetPlayerId),r=this.config=jl(e.DefaultConfig,t,n);this.userConfig=t,r.progressive&&Nl(r,n);let{abrController:i,bufferController:a,capLevelController:o,errorController:s,fpsController:c}=r,l=new s(this),u=this.abrController=new i(this),d=new fn(this),p=r.interstitialsController,m=p?this.interstitialsController=new p(this,e):null,h=this.bufferController=new a(this,d),g=this.capLevelController=new o(this),_=new c(this),v=new eu(this),y=r.contentSteeringController,b=y?new y(this):null,x=this.levelController=new Ul(this,b),S=new Vl(this),C=new Xl(this.config,this.logger),w=this.streamController=new Yl(this,d,C),T=this.gapController=new Pl(this,d);g.setStreamController(w),_.setStreamController(w);let E=[v,x,w];m&&E.splice(1,0,m),b&&E.splice(1,0,b),this.networkControllers=E;let D=[u,h,T,g,_,S,d];this.audioTrackController=this.createController(r.audioTrackController,E);let O=r.audioStreamController;O&&E.push(this.audioStreamController=new O(this,d,C)),this.subtitleTrackController=this.createController(r.subtitleTrackController,E);let k=r.subtitleStreamController;k&&E.push(this.subtititleStreamController=new k(this,d,C)),this.createController(r.timelineController,D),C.emeController=this.emeController=this.createController(r.emeController,D),this.cmcdController=this.createController(r.cmcdController,D),this.latencyController=this.createController(Hl,D),this.coreComponents=D,E.push(l);let j=l.onErrorOut;typeof j==`function`&&this.on(f.ERROR,j,l),this.on(f.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){let n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error(`An internal error happened while handling event `+e+`. Error message: "`+t.message+`". Here is a stacktrace:`,t),!this.triggeringException){this.triggeringException=!0;let n=e===f.ERROR;this.trigger(f.ERROR,{type:u.OTHER_ERROR,details:d.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log(`destroy`),this.trigger(f.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||`media`in e&&!e.media){let t=Error(`attachMedia failed: invalid argument (${e})`);this.trigger(f.ERROR,{type:u.OTHER_ERROR,details:d.ATTACH_MEDIA_ERROR,fatal:!0,error:t});return}this.logger.log(`attachMedia`),this._media&&(this.logger.warn(`media must be detached before attaching`),this.detachMedia());let t=`media`in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(f.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log(`detachMedia`),this.trigger(f.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;let e=this.bufferController.transferMedia();return this.trigger(f.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();let t=this.media,n=this._url,r=this._url=ae.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(f.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?`, <skip seek to start>`:``)})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log(`stopLoad`),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log(`resume buffering`),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log(`pause buffering`),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){let e={[m.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[m.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[m.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log(`recoverMediaError`);let e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||=this._sessionId=Ys(),e}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){let{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){xt(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this,r;if(r=t===-1&&e!=null&&e.length?e.length-1:t,n)for(let t=r;t--;){let r=e[t].attrs[`HDCP-LEVEL`];if(r&&r<=n)return t}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){return this.audioTrackController?.setAudioOption(e)||null}setSubtitleOption(e){return this.subtitleTrackController?.setSubtitleOption(e)||null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?.interstitialsManager||null}getMediaDecodingInfo(e,t=this.allAudioTracks){return mt(e,Pt(t),navigator.mediaCapabilities)}};$.defaultConfig=void 0;const tu={[$.ErrorTypes.NETWORK_ERROR]:o.MEDIA_ERR_NETWORK,[$.ErrorTypes.MEDIA_ERROR]:o.MEDIA_ERR_DECODE,[$.ErrorTypes.KEY_SYSTEM_ERROR]:o.MEDIA_ERR_ENCRYPTED,[$.ErrorTypes.MUX_ERROR]:o.MEDIA_ERR_DECODE,[$.ErrorTypes.OTHER_ERROR]:o.MEDIA_ERR_CUSTOM};function nu(e){class t extends e{#e=null;#t=null;constructor(...e){super(...e),this.engine?.on($.Events.MANIFEST_LOADING,()=>this.#r()),this.engine?.on($.Events.MEDIA_ATTACHED,()=>this.#r()),this.engine?.on($.Events.MEDIA_DETACHED,()=>this.#n()),this.engine?.on($.Events.DESTROYING,()=>this.#n())}get error(){return this.#t}#n(){this.#e?.abort(),this.#e=null}#r(){this.#e?.abort(),this.#e=new AbortController;let{engine:e,target:t}=this;if(!e||!t)return;let n=(e,t)=>{if(!t.fatal)return;let n=tu[t.type]??o.MEDIA_ERR_CUSTOM,r=new o(t.error,n,!0,t.details);r.data=t,this.#t=r;let i=new ErrorEvent(`error`,{error:r,message:r.message});this.dispatchEvent(i)};e.on($.Events.ERROR,n),this.#e.signal.addEventListener(`abort`,()=>{e.off($.Events.ERROR,n),this.#t=null},{once:!0})}}return t}function ru(e){class t extends e{#e=null;#t=`metadata`;#n;#r;constructor(...e){super(...e),this.engine?.on($.Events.MANIFEST_LOADING,()=>this.#a()),this.engine?.on($.Events.MEDIA_ATTACHED,()=>this.#a()),this.engine?.on($.Events.MEDIA_DETACHED,()=>this.#i()),this.engine?.on($.Events.DESTROYING,()=>this.#i())}get preload(){return this.#t}set preload(e){this.#t=e,this.#a()}#i(){this.#e?.abort(),this.#e=null}#a(){this.#e?.abort();let e=this.target;if(!e)return;e.preload!==this.preload&&(e.preload=this.preload);let{engine:t}=this;if(!t)return;this.#n??=t.config.maxBufferLength,this.#r??=t.config.maxBufferSize;let n=this.#n,r=this.#r,i=(e,t)=>{let{engine:i}=this;i&&(i.config.maxBufferLength=e??n,i.config.maxBufferSize=t??r,i.startLoad())};if(this.preload===`auto`||!e.paused){i();return}this.preload===`metadata`&&i(1,1),this.#e=new AbortController,e.addEventListener(`play`,()=>i(),{signal:this.#e.signal,once:!0})}}return t}function iu(e){class n extends e{#e=null;constructor(...e){super(...e),this.engine?.on($.Events.MANIFEST_LOADING,()=>this.#n()),this.engine?.on($.Events.MEDIA_ATTACHED,()=>this.#n()),this.engine?.on($.Events.MEDIA_DETACHED,()=>this.#t()),this.engine?.on($.Events.DESTROYING,()=>this.#t())}#t(){this.#e?.abort(),this.#e=null}#n(){this.#e?.abort(),this.#e=new AbortController;let{signal:e}=this.#e,{engine:n}=this;if(!n||!this.target)return;let r=this.target,i=(e,t)=>{this.#r();for(let e of t.tracks){let t=e.subtitleTrack??e.closedCaptions,i=n.subtitleTracks.findIndex(({lang:n,name:r,type:i})=>n===t?.lang&&r===e.label&&i.toLowerCase()===e.kind),a=e._id??e.default?`default`:`${e.kind}${i}`;au(r,e.kind,e.label,t?.lang,a,e.default)}},a=(e,{track:t,cues:n})=>{let i=r.textTracks.getTrackById(t);if(!i)return;let a=i.mode===`disabled`;a&&(i.mode=`hidden`),n.forEach(e=>{i.cues?.getCueById(e.id)||i.addCue(e)}),a&&(i.mode=`disabled`)};n.on($.Events.NON_NATIVE_TEXT_TRACKS_FOUND,i),n.on($.Events.CUES_PARSED,a),t(r.textTracks,`change`,()=>{if(!n.subtitleTracks.length)return;let e=Array.from(r.textTracks).find(e=>e.id&&e.mode===`showing`&&[`subtitles`,`captions`].includes(e.kind));if(!e)return;let t=n.subtitleTracks[n.subtitleTrack],i=t?t.default?`default`:`${n.subtitleTracks[n.subtitleTrack]?.type.toLowerCase()}${n.subtitleTrack}`:void 0;(n.subtitleTrack<0||e?.id!==i)&&(n.subtitleTrack=n.subtitleTracks.findIndex(({lang:t,name:n,type:r,default:i})=>e.id===`default`&&i||t===e.language&&n===e.label&&r.toLowerCase()===e.kind)),e?.id===i&&e.cues&&Array.from(e.cues).forEach(t=>{e.addCue(t)})},{signal:e}),e.addEventListener(`abort`,()=>{n.off($.Events.NON_NATIVE_TEXT_TRACKS_FOUND,i),n.off($.Events.CUES_PARSED,a),this.#r()},{once:!0})}#r(){(this.target?.querySelectorAll?.(`track[data-removeondestroy]`)??[]).forEach(e=>e.remove())}}return n}function au(e,t,n,r,i,a){let o=document.createElement(`track`);return o.kind=t,o.label=n,r&&(o.srclang=r),i&&(o.id=i),a&&(o.default=!0),o.track.mode=[`subtitles`,`captions`].includes(t)?`disabled`:`hidden`,o.setAttribute(`data-removeondestroy`,``),e.append(o),o.track}const ou={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0,autoStartLoad:!1};var su=class extends EventTarget{#e=null;constructor(e){super(),this.#e=new $({...ou,...e.config})}get target(){return this.#e?.media??null}get engine(){return this.#e}get src(){return this.#e?.url??``}set src(e){this.#e?.loadSource(e)}attach(e){this.#e?.attachMedia(e)}detach(){this.#e?.detachMedia()}destroy(){this.#e?.destroy(),this.#e=null}},cu=class extends ru(iu(nu(su))){};const lu={MSE:`mse`,NATIVE:`native`},uu={M3U8:`application/vnd.apple.mpegurl`,MP4:`video/mp4`};var du=class extends EventTarget{#e=null;#t=null;#n=``;#r;#i=`mse`;#a={};#o=!1;#s=`metadata`;#c;#l;get target(){return this.#e}get engine(){return this.#t?.engine??null}get error(){return this.#t?.error??null}get src(){return this.#n}set src(e){this.#n=e,this.#u()}get type(){return this.#r??fu(this.src)}set type(e){this.#r=e,this.#u()}get preferPlayback(){return this.#i}set preferPlayback(e){this.#i=e,this.#u()}get config(){return this.#a}set config(e){this.#a=e,this.#u()}get debug(){return this.#o}set debug(e){this.#o=e,this.#u()}get preload(){return this.#s}set preload(e){this.#s=e,this.#t&&(this.#t.preload=e)}attach(e){this.#e=e,this.#t?.attach(e)}detach(){this.#e=null,this.#t?.detach()}destroy(){this.#p(),this.detach()}load(){this.#c=null,this.#d(this.#f())&&(this.#p(),this.#l=this.#f(),this.#t=$.isSupported()&&this.type===uu.M3U8&&this.preferPlayback!==lu.NATIVE?new cu({config:{...this.config,debug:this.debug}}):new a,n(this.#t,this),this.target&&this.#t.attach(this.target),this.#t.preload=this.preload),this.#t&&(this.#t.src=this.#n)}async#u(){this.#c||(await(this.#c=Promise.resolve()),this.#c=null,this.load())}#d(t){return!e(this.#l,t)}#f(){return{config:this.config,debug:this.debug,preferPlayback:this.preferPlayback,type:this.type}}#p(){this.#t?.destroy(),this.#t=null,this.#l=null,this.#c=null}};function fu(e){return(e.split(/[?#]/)[0]??``).endsWith(`.mp4`)?uu.MP4:uu.M3U8}var pu=class extends r(i,du){};export{du as n,$ as r,pu as t};
|
|
41
|
-
//# sourceMappingURL=hls-
|
|
41
|
+
//# sourceMappingURL=hls-CNDMNsEo.js.map
|