@supr-design/flux-player 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Flux={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=class{state;bus;constructor(e){this.bus=e,this.state=this.getDefaultState()}getDefaultState(){return{status:`idle`,currentTime:0,duration:NaN,paused:!0,ended:!1,buffering:!1,muted:!1,volume:1,playbackRate:1,buffered:[],selectedQuality:`auto`,availableQualities:[],selectedSubtitle:null,availableSubtitles:[],selectedAudioTrack:`default`,availableAudioTracks:[],engineType:`none`,readyState:0,error:null,isLive:!1,isDvr:!1,source:null}}get snapshot(){return{...this.state,buffered:this.state.buffered.map(e=>({...e})),availableQualities:this.state.availableQualities.map(e=>({...e})),availableSubtitles:this.state.availableSubtitles.map(e=>({...e})),availableAudioTracks:this.state.availableAudioTracks.map(e=>({...e})),source:this.state.source?{...this.state.source}:null}}reset(){let e=this.state.volume,t=this.state.muted;this.state=this.getDefaultState(),this.state.volume=e,this.state.muted=t,this.notify()}update(e){let t=!1;for(let n of Object.keys(e))this.state[n]!==e[n]&&(this.state[n]=e[n],t=!0,this.bus.emit(`state:${n}`,e[n]));t&&this.notify()}notify(){this.bus.emit(`state:change`,this.snapshot)}},o=class{listeners=new Map;on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}off(e,t){let n=this.listeners.get(e);if(!n)return;let r=n.indexOf(t);r>-1&&n.splice(r,1)}emit(e,...t){let n=this.listeners.get(e);if(n)for(let r of[...n])try{r(...t)}catch(t){console.error(`Error in event listener for ${e}:`,t)}}clear(){this.listeners.clear()}},c=class{engines=[];register(e){this.engines.find(t=>t.id===e.id)||this.engines.push(e)}getEngines(){return this.engines}findEngineForSource(e,t){if(e&&e!==`auto`)return this.engines.find(t=>t.canPlayType(e))||null;for(let e of this.engines)if(e.canPlaySource(t))return e;return null}},l=[{pattern:/application\/(vnd\.apple\.mpegurl|x-mpegurl)/i,type:`hls`},{pattern:/application\/dash\+xml/i,type:`dash`},{pattern:/video\/mp4/i,type:`mp4`},{pattern:/video\/webm/i,type:`webm`}];function u(e){if(!e)return`auto`;for(let t of l)if(t.pattern.test(e))return t.type;return`auto`}function d(e){try{let t=new URL(e);return`${t.pathname}${t.search}`.toLowerCase()}catch{return e.toLowerCase()}}function f(e,t){let n=u(t);if(n!==`auto`)return n;let r=d(e);return r.includes(`.m3u8`)?`hls`:r.includes(`.mpd`)?`dash`:r.includes(`.webm`)?`webm`:r.includes(`.mp4`)?`mp4`:/(format|type)=(m3u8|hls)/i.test(r)?`hls`:/(format|type)=(mpd|dash)/i.test(r)?`dash`:`auto`}function p(e,t,n){let r=e.parentElement;if(!r||n.aborted)return Promise.resolve(`cancelled`);let i=getComputedStyle(r).position===`static`,o=r.style.position;i&&(r.style.position=`relative`);let c=document.createElement(`div`);c.style.cssText=`position:absolute;inset:0;z-index:100;background:black;color:white`;let l=document.createElement(`video`);l.style.cssText=`width:100%;height:100%;object-fit:contain`,l.playsInline=!0,l.muted=e.muted,l.volume=e.volume,l.controls=!0,l.setAttribute(`aria-label`,`Advertisement`);let u=document.createElement(`span`);return u.textContent=`Advertisement`,u.style.cssText=`position:absolute;top:12px;left:12px;background:#151515;padding:4px 8px;font:13px sans-serif;pointer-events:none`,c.append(l,u),r.append(c),new Promise(e=>{let u=!1,d,f=t=>{u||(u=!0,clearTimeout(d),n.removeEventListener(`abort`,p),l.onended=l.onerror=l.onwaiting=l.onplaying=null,l.pause(),l.removeAttribute(`src`),l.load(),c.remove(),i&&(r.style.position=o),e(t))},p=()=>f(`cancelled`),m=()=>{clearTimeout(d),d=window.setTimeout(()=>f(`failed`),1e4)};l.onended=()=>f(`ended`),l.onerror=()=>f(`failed`),l.onwaiting=m,l.onplaying=()=>clearTimeout(d),n.addEventListener(`abort`,p,{once:!0}),m(),l.src=t,l.play().catch(()=>f(`failed`))})}var m=class{bus;state;registry;currentEngine=null;currentVideoElement=null;cleans=[];generation=0;adSource;pendingMidrolls=[];adController;adPlayback;cancelAd(){this.adController?.abort(),this.adPlayback=void 0,this.adController=void 0}pendingSeekTime=null;performance={startupMode:`balanced`,startupStrategy:`balanced`,startupBufferSeconds:1.2,manifestFastPath:!1};abr={startupProfile:`balanced`,upgradeAggression:`medium`,rebufferSafetyBias:`medium`};constructor(){this.bus=new o,this.state=new i(this.bus),this.registry=new c}attachVideo(e){this.currentVideoElement=e,this.currentEngine&&this.currentEngine.attach(e)}setPerformance(e){this.performance={startupMode:e?.startupMode??`balanced`,startupStrategy:e?.startupStrategy??`balanced`,startupBufferSeconds:e?.startupBufferSeconds??1.2,manifestFastPath:e?.manifestFastPath??!1},this.bus.emit(`performance:updated`,this.performance)}setAbr(e){this.abr={startupProfile:e?.startupProfile??`balanced`,upgradeAggression:e?.upgradeAggression??`medium`,rebufferSafetyBias:e?.rebufferSafetyBias??`medium`},this.bus.emit(`abr:updated`,this.abr)}getStartupReadiness(){return this.currentEngine?.getStartupReadiness?.()??null}async load(e){let t=++this.generation;this.cancelAd(),this.adSource=e.preroll?.src,this.pendingMidrolls=(e.midrolls||[]).filter(e=>Number.isFinite(e.at)&&e.at>0&&e.src).sort((e,t)=>e.at-t.at),this.bus.emit(`startup:mode`,{mode:this.performance.startupMode,startupBufferSeconds:this.performance.startupBufferSeconds});let n=f(e.src,e.mimeType),r=e.type&&e.type!==`auto`?e.type:n;this.state.update({currentTime:0,duration:NaN,readyState:0,error:null,paused:!0,ended:!1,buffering:!1,selectedQuality:`auto`,availableQualities:[],selectedSubtitle:null,availableSubtitles:[],selectedAudioTrack:`default`,availableAudioTracks:[],isLive:!1,isDvr:!1,status:`loading`,source:{src:e.src,adBreakTimes:[...this.adSource?[0]:[],...this.pendingMidrolls.map(e=>e.at)],requestedType:r,detectedType:n,mimeType:e.mimeType||null,title:e.title||null,poster:e.poster||null,thumbnailVtt:e.thumbnailVtt||null}});let i={...e};delete i.drm,this.bus.emit(`source_loading`,i);let o=r,c=this.registry.findEngineForSource(o,e.src);if(!c||e.drm&&c.id!==`dash`){let t={code:`NO_ENGINE`,message:e.drm?`Configured DRM requires DASH playback`:`No engine found for source`,engine:`core`,recoverable:!1};throw this.state.update({error:t,status:`error`}),this.bus.emit(`error`,t),Error(t.message)}if(this.currentEngine){if(await this.currentEngine.destroy(),t!==this.generation)return;this.unbindEngine()}this.currentEngine=c,this.currentEngine.setRuntimeConfig?.({performance:this.performance,abr:this.abr}),this.pendingSeekTime=null,this.currentVideoElement&&(e.muted!==void 0&&(this.currentVideoElement.muted=e.muted),this.currentEngine.attach(this.currentVideoElement)),this.bindEngine(this.currentEngine),this.state.update({engineType:c.id});try{if(await this.currentEngine.load(e),t!==this.generation)return;this.bus.emit(`source_loaded`,i);let n=this.getState();this.state.update({status:n.paused?`paused`:`playing`}),e.autoplay&&this.play().catch(e=>console.warn(`Autoplay failed`,e))}catch(e){if(t!==this.generation)return;let n={code:`LOAD_ERROR`,message:e?.message||`Unknown loading error`,engine:c.id,recoverable:!1};throw this.state.update({error:n,status:`error`,buffering:!1}),this.bus.emit(`error`,n),e}}bindEngine(e){this.cleans.forEach(e=>e()),this.cleans=[e.on(`play`,()=>{this.state.update({paused:!1,ended:!1,status:`playing`}),this.bus.emit(`play`)}),e.on(`playing`,()=>{this.state.update({paused:!1,readyState:4,buffering:!1,ended:!1,status:`playing`}),this.bus.emit(`playing`)}),e.on(`pause`,()=>{let e=this.getState();this.state.update({paused:!0,status:e.ended?`ended`:`paused`}),this.bus.emit(`pause`)}),e.on(`ended`,()=>{this.state.update({paused:!0,ended:!0,buffering:!1,status:`ended`}),this.bus.emit(`ended`)}),e.on(`seeked`,({currentTime:e})=>{this.state.update({currentTime:e,buffering:!1,status:this.getState().paused?`paused`:`playing`}),this.pendingSeekTime!==null&&(this.bus.emit(`seek_complete`,e),this.pendingSeekTime=null)}),e.on(`timeupdate`,({currentTime:t})=>{this.state.update({currentTime:t});let n=this.pendingMidrolls[0];n&&t>=n.at&&!this.currentVideoElement?.paused&&!this.adPlayback&&(this.pendingMidrolls.shift(),this.adSource=n.src,e.pause(),this.play().catch(t=>this.bus.emit(`error`,{code:`AD_RESUME_FAILED`,message:String(t),engine:e.id})))}),e.on(`durationchange`,({duration:e,isLive:t=e===1/0})=>{this.state.update({duration:e,isLive:t,isDvr:t&&!!this.currentVideoElement?.seekable.length})}),e.on(`volumechange`,({volume:e,muted:t})=>this.state.update({volume:e,muted:t})),e.on(`ratechange`,({playbackRate:e})=>this.state.update({playbackRate:e})),e.on(`progress`,({buffered:e})=>this.state.update({buffered:e})),e.on(`qualitychange`,({level:e})=>this.state.update({selectedQuality:e})),e.on(`trackschange`,({qualities:e,subtitles:t,audioTracks:n})=>{this.state.update({availableQualities:e,availableSubtitles:t,availableAudioTracks:n})}),e.on(`telemetry`,t=>{this.bus.emit(`telemetry`,{engine:e.id,...t||{}})}),e.on(`error`,({error:e})=>{if(e?.recoverable){this.state.update({error:null}),this.bus.emit(`error`,e);return}this.state.update({error:e,status:`error`,buffering:!1}),this.bus.emit(`error`,e)}),e.on(`ready`,()=>{this.state.update({readyState:4,buffering:!1,status:this.getState().paused?`ready`:`playing`}),this.bus.emit(`ready`)}),e.on(`waiting`,()=>{this.state.update({readyState:2,buffering:!0,status:`buffering`}),this.bus.emit(`waiting`)})]}unbindEngine(){this.cleans.forEach(e=>e()),this.cleans=[]}async play(){if(!this.currentEngine)throw Error(`No engine loaded`);if(this.bus.emit(`playback_requested`),this.adPlayback)return this.adPlayback;if(this.adSource&&this.currentVideoElement){let e=this.adSource;this.adSource=void 0,this.bus.emit(`ad:started`);let t=new AbortController;return this.adController=t,this.adPlayback=p(this.currentVideoElement,e,t.signal).then(async e=>{t.signal.aborted||(this.bus.emit(`ad:`+e),await this.playContent())}).finally(()=>{this.adController===t&&this.cancelAd()}),this.adPlayback}return this.playContent()}async playContent(){let e=this.generation;await this.currentEngine?.play(),e===this.generation&&(this.state.update({paused:!1,ended:!1,status:`playing`}),this.bus.emit(`playback_started`))}pause(){this.cancelAd(),this.currentEngine?.pause();let e=this.getState();this.state.update({paused:!0,status:e.ended?`ended`:`paused`})}async destroy(){++this.generation,this.cancelAd(),this.unbindEngine(),this.currentEngine&&=(await this.currentEngine.destroy(),null),this.bus.clear()}seek(e){this.pendingSeekTime=e,this.bus.emit(`seek_start`,e),this.currentEngine?.seek(e)}setVolume(e){this.currentEngine?.setVolume(e)}setMuted(e){this.currentEngine?.setMuted(e)}setPlaybackRate(e){this.currentEngine?.setPlaybackRate(e)}setQuality(e){this.currentEngine?.setQuality(e),this.state.update({selectedQuality:e})}setSubtitle(e){this.currentEngine?.setSubtitle(e),this.state.update({selectedSubtitle:e})}setAudioTrack(e){this.currentEngine?.setAudioTrack(e),this.state.update({selectedAudioTrack:e})}getState(){return this.state.snapshot}getStats(){return this.state.snapshot}on(e,t){return this.bus.on(e,t)}},h=class{id=`native`;isNative=!0;video=null;listeners=new Map;domListeners=[];canPlayType(e){return[`mp4`,`webm`,`ogg`].includes(e)}canPlaySource(e){let t=e.toLowerCase();return t.includes(`.mp4`)||t.includes(`.webm`)||t.includes(`.ogg`)}attach(e){this.video=e,this.bindDomEvents()}bindDomEvents(){if(!this.video)return;this.unbindDomEvents();let e=(e,t,n=()=>void 0)=>{let r=e=>{let r=n(e);this.emit(t,r)};this.video.addEventListener(e,r),this.domListeners.push({event:e,handler:r})};e(`play`,`play`),e(`pause`,`pause`),e(`playing`,`playing`),e(`ended`,`ended`),e(`waiting`,`waiting`),e(`seeked`,`seeked`,()=>({currentTime:this.video.currentTime})),e(`canplay`,`ready`),e(`timeupdate`,`timeupdate`,()=>({currentTime:this.video.currentTime})),e(`durationchange`,`durationchange`,()=>({duration:this.video.duration})),e(`volumechange`,`volumechange`,()=>({volume:this.video.volume,muted:this.video.muted})),e(`ratechange`,`ratechange`,()=>({playbackRate:this.video.playbackRate})),e(`progress`,`progress`,()=>{let e=[],t=this.video.buffered;for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return{buffered:e}}),e(`error`,`error`,()=>{let e=this.video.error;return{error:{code:e?.code?.toString()||`UNKNOWN`,message:e?.message||`Media Error`,engine:this.id,recoverable:!1,originalError:e}}})}unbindDomEvents(){this.video&&(this.domListeners.forEach(({event:e,handler:t})=>{this.video.removeEventListener(e,t)}),this.domListeners=[])}async load(e){if(!this.video)throw Error(`Video element not attached`);this.video.poster=e.poster||``,this.video.src=e.src,this.video.load()}async play(){await this.video?.play()}pause(){this.video?.pause()}async destroy(){this.unbindDomEvents(),this.video&&(this.video.src=``,this.video.removeAttribute(`src`)),this.video=null,this.listeners.clear()}seek(e){this.video&&(this.video.currentTime=e)}setVolume(e){this.video&&(this.video.volume=e)}setMuted(e){this.video&&(this.video.muted=e)}setPlaybackRate(e){this.video&&(this.video.playbackRate=e)}setQuality(e){console.warn(`Quality switching not supported in native engine`)}setSubtitle(e){}setAudioTrack(e){}on(e,t){let n=e;return this.listeners.has(n)||this.listeners.set(n,[]),this.listeners.get(n).push(t),()=>this.off(e,t)}off(e,t){let n=e,r=this.listeners.get(n);if(!r)return;let i=r.indexOf(t);i>-1&&r.splice(i,1)}emit(e,t){let n=e,r=this.listeners.get(n);if(r)for(let e of[...r])e(t)}},g={play:`<svg viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>`,replay:`<svg viewBox="0 0 24 24"><path d="M12 5V2L7 7l5 5V9c3.31 0 6 2.69 6 6a6 6 0 0 1-10.24 4.24l-1.42 1.42A8 8 0 1 0 20 15c0-4.42-3.58-8-8-8z"/></svg>`,pause:`<svg viewBox="0 0 24 24"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>`,mute:`<svg viewBox="0 0 24 24"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>`,volume:`<svg viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>`,fullscreen:`<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>`,fullscreenExit:`<svg viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>`,pip:`<svg viewBox="0 0 24 24"><path d="M19 7H5v10h14V7zm2-2v14H3V5h18zm-9 7h7v5h-7v-5z"/></svg>`,settings:`<svg viewBox="0 0 24 24"><path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.06-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.73,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.06,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.43-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.49-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/></svg>`},_=class{player;target;handler;constructor(e,t){this.player=e,this.target=t,this.handler=this.handleKey.bind(this),this.target.addEventListener(`keydown`,this.handler),this.target.tabIndex=0}handleKey(e){let t=document.activeElement?.tagName.toLowerCase();if(e.defaultPrevented||t===`input`||t===`textarea`||t===`button`&&e.key===` `)return;let n=!1;switch(e.key){case` `:case`k`:case`K`:n=!0,this.togglePlay();break;case`ArrowLeft`:n=!0,this.seekRelative(-5);break;case`ArrowRight`:n=!0,this.seekRelative(5);break;case`m`:case`M`:n=!0,this.toggleMute();break;case`f`:case`F`:n=!0,this.toggleFullscreen();break;case`c`:case`C`:n=!0,this.toggleCaptions();break}n&&(e.preventDefault(),e.stopPropagation())}togglePlay(){this.player.getState().paused?this.player.play().catch(()=>{}):this.player.pause()}seekRelative(e){let t=this.player.getState();this.player.seek(Math.max(0,Math.min(t.duration||0,t.currentTime+e)))}toggleMute(){let e=this.player.getState();this.player.setMuted(!e.muted)}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.target.requestFullscreen().catch(()=>{})}toggleCaptions(){this.player.getState().selectedSubtitle?this.player.setSubtitle(null):this.player.setSubtitle(`0`)}destroy(){this.target.removeEventListener(`keydown`,this.handler)}},v=class{static makeClickable(e,t){e.setAttribute(`role`,`button`),e.tabIndex=0,e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}},y={colors:{background:`#09090b`,surface:`rgba(9, 9, 11, 0.7)`,surfaceElevated:`rgba(39, 39, 42, 0.8)`,overlayGradientEnd:`rgba(0, 0, 0, 0.7)`,overlayError:`rgba(0, 0, 0, 0.8)`,menuBackground:`rgba(15, 15, 15, 0.9)`,menuBorder:`rgba(255, 255, 255, 0.1)`,menuHover:`rgba(255, 255, 255, 0.1)`,menuActive:`rgba(59, 130, 246, 0.1)`,buffered:`rgba(255, 255, 255, 0.4)`,textPrimary:`#fafafa`,textSecondary:`#a1a1aa`,brandPrimary:`#3b82f6`,danger:`#ef4444`,focus:`rgba(59, 130, 246, 0.5)`},radius:{sm:`4px`,md:`8px`,lg:`12px`,pill:`9999px`},spacing:{xs:`4px`,sm:`8px`,md:`16px`,lg:`24px`},typography:{fontFamily:`"Inter", "Roboto", "Outfit", sans-serif`,fontSizeSm:`12px`,fontSizeMd:`14px`,fontSizeLg:`16px`,fontWeightMedium:`500`,fontWeightBold:`700`},control:{height:`40px`,iconSize:`24px`}},b={colors:{background:`#ffffff`,surface:`rgba(255, 255, 255, 0.8)`,surfaceElevated:`rgba(244, 244, 245, 0.9)`,overlayGradientEnd:`rgba(0, 0, 0, 0.35)`,overlayError:`rgba(255, 255, 255, 0.95)`,menuBackground:`rgba(255, 255, 255, 0.95)`,menuBorder:`rgba(9, 9, 11, 0.1)`,menuHover:`rgba(9, 9, 11, 0.06)`,menuActive:`rgba(37, 99, 235, 0.12)`,buffered:`rgba(9, 9, 11, 0.25)`,textPrimary:`#09090b`,textSecondary:`#71717a`,brandPrimary:`#2563eb`,danger:`#dc2626`,focus:`rgba(37, 99, 235, 0.4)`},radius:y.radius,spacing:y.spacing,typography:y.typography,control:y.control};function x(e,t){if(!t)return e;let n=JSON.parse(JSON.stringify(e));for(let e of Object.keys(t))typeof t[e]==`object`?n[e]={...n[e],...t[e]}:n[e]=t[e];return n}function S(e,t=`flux-player`){let n=``;for(let[r,i]of Object.entries(e))if(typeof i==`object`)for(let[e,o]of Object.entries(i))n+=`--${t}-${r}-${e}: ${o};\n`;return n}function C(e,t){let n=y;typeof t==`string`?t===`light`&&(n=b):n=x(t.base===`light`?b:y,t),S(n),e.setAttribute(`style`,e.getAttribute(`style`)||``);for(let[t,r]of Object.entries(n))if(typeof r==`object`)for(let[n,i]of Object.entries(r))e.style.setProperty(`--flux-player-${t}-${n}`,i)}var w=class{player;container;videoEl;wrapper;overlay;spinner;bigPlay;replayBtn;errorPanel;errorTextEl;extraButtons;playBtn;muteBtn;pipBtn;fullscreenBtn;timeDisplay;liveBadge;progressFill;bufferedFill;markerSignature=``;timeline;timelineThumbnailPreview;timelineThumbnailImage;volumeSlider;settingsBtn;settingsMenu;menuOpen=!1;uiPaused=!0;isDragging=!1;uiConfig;cleans=[];domCleans=[];idleTimeout;fullscreenChangeHandler=null;pipSupported=!1;controlElements=[];controlFocusIndex=0;menuItems=[];menuFocusIndex=0;thumbnailVttUrl=null;thumbnailCues=[];thumbnailFetchAbort=null;subtitleDisplay;subtitleTrackListeners=new Map;activeSourceToken=null;resetUiForSourceChange(e){let t=`${e.source?.src||``}|${this.resolveThumbnailVttUrl(e)||``}`;if(t!==this.activeSourceToken){this.activeSourceToken=t,this.thumbnailFetchAbort?.abort(),this.thumbnailFetchAbort=null,this.thumbnailVttUrl=null,this.thumbnailCues=[],this.hideTimelineThumbnail(),this.timelineThumbnailImage.removeAttribute(`src`),this.subtitleDisplay.innerHTML=``;for(let[e,t]of this.subtitleTrackListeners.entries())e.removeEventListener(`cuechange`,t);this.subtitleTrackListeners.clear();for(let e=0;e<this.videoEl.textTracks.length;e++)this.videoEl.textTracks[e].mode=`disabled`,this.bindSubtitleTrack(this.videoEl.textTracks[e])}}constructor(e,t,n={}){if(this.player=e,this.uiConfig=n,typeof t==`string`){let e=document.querySelector(t);if(!e)throw Error(`Target ${t} not found`);this.container=e}else this.container=t;this.videoEl=document.createElement(`video`),this.videoEl.className=`flux-player-video`,this.player.attachVideo(this.videoEl),this.render(),this.bindEvents(),this.updateState(this.player.getState())}render(){this.container.innerHTML=``,this.wrapper=document.createElement(`div`),this.wrapper.className=`flux-player-wrapper`,this.wrapper.appendChild(this.videoEl),this.spinner=document.createElement(`div`),this.spinner.className=`flux-player-spinner`,this.wrapper.appendChild(this.spinner),this.bigPlay=document.createElement(`div`),this.bigPlay.className=`flux-player-big-play`,this.bigPlay.innerHTML=g.play,this.wrapper.appendChild(this.bigPlay),v.makeClickable(this.bigPlay,()=>this.handlePrimaryAction()),this.replayBtn=document.createElement(`div`),this.replayBtn.className=`flux-player-replay flux-hidden`,this.replayBtn.innerHTML=g.replay,this.wrapper.appendChild(this.replayBtn),v.makeClickable(this.replayBtn,()=>this.replay()),this.errorPanel=document.createElement(`div`),this.errorPanel.className=`flux-player-error flux-hidden`,this.errorPanel.innerHTML=`<div class="flux-player-error-title">Playback Error</div>`,this.errorTextEl=document.createElement(`div`),this.errorTextEl.className=`flux-player-error-text`,this.errorPanel.appendChild(this.errorTextEl),this.wrapper.appendChild(this.errorPanel),this.overlay=document.createElement(`div`),this.overlay.className=`flux-player-overlay`;let e=document.createElement(`div`);e.className=`flux-player-controls`,this.timeline=document.createElement(`div`),this.timeline.className=`flux-player-timeline`,this.timeline.setAttribute(`role`,`slider`),this.timeline.setAttribute(`aria-label`,`Seek timeline`),this.timeline.tabIndex=-1,this.bufferedFill=document.createElement(`div`),this.bufferedFill.className=`flux-player-timeline-buffered`,this.progressFill=document.createElement(`div`),this.progressFill.className=`flux-player-timeline-progress`,this.timelineThumbnailPreview=document.createElement(`div`),this.timelineThumbnailPreview.className=`flux-player-thumbnail-preview flux-hidden`,this.timelineThumbnailImage=document.createElement(`img`),this.timelineThumbnailImage.className=`flux-player-thumbnail-image`,this.timelineThumbnailImage.alt=``,this.timelineThumbnailImage.setAttribute(`aria-hidden`,`true`),this.timelineThumbnailImage.onload=()=>{this.thumbnailVttUrl&&this.timelineThumbnailPreview.classList.remove(`flux-hidden`)},this.timelineThumbnailImage.onerror=()=>{this.hideTimelineThumbnail()},this.timelineThumbnailPreview.appendChild(this.timelineThumbnailImage),this.timeline.appendChild(this.bufferedFill),this.timeline.appendChild(this.progressFill),this.timeline.appendChild(this.timelineThumbnailPreview),e.appendChild(this.timeline);let t=document.createElement(`div`);t.className=`flux-player-toolbar`;let n=document.createElement(`div`);n.className=`flux-player-toolbar-group`,this.playBtn=this.createBtn(`play`,g.play,`Play`),this.muteBtn=this.createBtn(`mute`,g.mute,`Mute`),this.volumeSlider=document.createElement(`input`),this.volumeSlider.type=`range`,this.volumeSlider.min=`0`,this.volumeSlider.max=`1`,this.volumeSlider.step=`0.05`,this.volumeSlider.className=`flux-player-volume-slider`,this.volumeSlider.setAttribute(`role`,`slider`),this.volumeSlider.setAttribute(`aria-label`,`Volume`);let r=document.createElement(`div`);r.className=`flux-player-volume-container`,r.appendChild(this.muteBtn),r.appendChild(this.volumeSlider),this.timeDisplay=document.createElement(`div`),this.timeDisplay.className=`flux-player-time`,this.timeDisplay.innerText=`0:00 / 0:00`,this.timeDisplay.setAttribute(`aria-live`,`polite`),this.timeDisplay.setAttribute(`aria-atomic`,`true`),n.appendChild(this.playBtn),n.appendChild(r),n.appendChild(this.timeDisplay);let i=document.createElement(`div`);i.className=`flux-player-toolbar-group`,this.liveBadge=document.createElement(`div`),this.liveBadge.className=`flux-player-live-badge flux-hidden`,this.liveBadge.innerHTML=`<span></span>LIVE`,this.liveBadge.setAttribute(`aria-live`,`polite`),this.liveBadge.setAttribute(`aria-label`,`Live stream`),this.pipBtn=this.createBtn(`pip`,g.pip,`Picture in Picture`),this.fullscreenBtn=this.createBtn(`fullscreen`,g.fullscreen,`Fullscreen`),this.settingsBtn=this.createBtn(`settings`,g.settings,`Settings`),this.settingsBtn.setAttribute(`aria-haspopup`,`menu`),this.settingsBtn.setAttribute(`aria-expanded`,`false`),i.appendChild(this.liveBadge),this.extraButtons=document.createElement(`div`),this.extraButtons.className=`flux-player-toolbar-group`,i.appendChild(this.extraButtons),i.appendChild(this.pipBtn),i.appendChild(this.settingsBtn),i.appendChild(this.fullscreenBtn),t.appendChild(n),t.appendChild(i),e.appendChild(t),this.settingsMenu=document.createElement(`div`),this.settingsMenu.className=`flux-player-settings-menu flux-hidden`,this.settingsMenu.setAttribute(`role`,`menu`),this.settingsMenu.setAttribute(`aria-label`,`Player settings`),e.appendChild(this.settingsMenu),this.overlay.appendChild(e),this.subtitleDisplay=document.createElement(`div`),this.subtitleDisplay.className=`flux-player-subtitles flux-subs-raised`,this.wrapper.appendChild(this.subtitleDisplay),this.wrapper.appendChild(this.overlay),this.container.appendChild(this.wrapper),this.setToolbar(this.uiConfig.toolbar??{}),C(this.wrapper,`dark`)}setControlsIdle(e){e?(this.overlay.classList.add(`flux-idle`),this.subtitleDisplay.classList.remove(`flux-subs-raised`)):(this.overlay.classList.remove(`flux-idle`),this.subtitleDisplay.classList.add(`flux-subs-raised`))}createBtn(e,t,n){let r=document.createElement(`button`);return r.className=`flux-player-icon-btn flux-btn-${e}`,r.innerHTML=t,r.setAttribute(`aria-label`,n),r}formatTime(e){if(isNaN(e))return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n<10?`0`:``}${n}`}bindEvents(){this.cleans.push(this.player.on(`state:change`,e=>this.updateState(e)));let e=e=>{e&&e.stopPropagation(),this.handlePrimaryAction()};this.listen(this.playBtn,`click`,e),this.listen(this.bigPlay,`click`,e),this.listen(this.videoEl,`click`,e),this.listen(this.replayBtn,`click`,()=>this.replay()),this.listen(this.muteBtn,`click`,()=>{this.player.setMuted(!this.player.getState().muted)}),this.listen(this.volumeSlider,`input`,e=>{this.player.setVolume(parseFloat(e.target.value))}),this.updatePipAvailability(),this.setupControlRovingTabindex(),this.listen(this.pipBtn,`click`,async()=>{await this.togglePip()}),this.listen(this.videoEl,`enterpictureinpicture`,()=>{this.pipBtn.classList.add(`flux-active`),this.pipBtn.setAttribute(`aria-label`,`Exit Picture in Picture`)}),this.listen(this.videoEl,`leavepictureinpicture`,()=>{this.pipBtn.classList.remove(`flux-active`),this.pipBtn.setAttribute(`aria-label`,`Picture in Picture`)}),this.listen(this.fullscreenBtn,`click`,()=>{document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.wrapper.requestFullscreen().catch(()=>{})}),this.fullscreenChangeHandler=()=>{document.fullscreenElement?this.fullscreenBtn.innerHTML=g.fullscreenExit:this.fullscreenBtn.innerHTML=g.fullscreen},this.listen(document,`fullscreenchange`,this.fullscreenChangeHandler);let t=e=>{let t=this.getTimelineHoverData(e.clientX);if(!t)return;let{position:n,duration:r,targetTime:i}=t;this.progressFill.style.width=`${n*100}%`,this.timeDisplay.innerText=`${this.formatTime(i)} / ${this.formatTime(r)}`,this.renderTimelineThumbnail(e),(this.uiConfig.seekOnDrag&&e.type!==`mouseup`||e.type===`mouseup`||e.type===`click`)&&this.player.seek(i)},n=e=>{this.isDragging&&t(e)},r=e=>{this.isDragging&&(this.isDragging=!1,this.wrapper.classList.remove(`flux-dragging`),t(e),this.renderTimelineThumbnail(e),document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,r))};this.listen(this.timeline,`mousedown`,e=>{let i=e;this.isDragging=!0,this.wrapper.classList.add(`flux-dragging`),t(i),this.listen(document,`mousemove`,n,!0),this.listen(document,`mouseup`,r,!0)}),this.listen(this.timeline,`click`,e=>{this.isDragging||t(e)}),this.listen(this.timeline,`mousemove`,e=>{this.renderTimelineThumbnail(e)}),this.listen(this.timeline,`mouseenter`,e=>{this.renderTimelineThumbnail(e)}),this.listen(this.timeline,`mouseleave`,()=>{this.hideTimelineThumbnail()}),this.listen(this.timeline,`keydown`,e=>{let t=e;if(t.key===`ArrowLeft`&&(t.preventDefault(),this.player.seek(Math.max(0,this.player.getState().currentTime-5))),t.key===`ArrowRight`){t.preventDefault();let e=this.player.getState().duration,n=Number.isFinite(e)?e:this.player.getState().currentTime+5;this.player.seek(Math.min(n,this.player.getState().currentTime+5))}}),this.listen(this.settingsBtn,`click`,e=>{e.stopPropagation(),this.toggleMenu()}),this.listen(this.wrapper,`click`,()=>{this.menuOpen&&this.toggleMenu(!1)}),this.listen(this.settingsMenu,`click`,e=>e.stopPropagation()),this.listen(this.settingsMenu,`keydown`,e=>this.handleSettingsKeyDown(e)),this.listen(this.wrapper,`keydown`,e=>this.handleControlBarKeyDown(e));let i=()=>{this.setControlsIdle(!1),clearTimeout(this.idleTimeout),!this.player.getState().paused&&!this.menuOpen&&(this.idleTimeout=setTimeout(()=>{this.setControlsIdle(!0)},3e3))};this.listen(this.wrapper,`mousemove`,i),this.listen(this.wrapper,`touchstart`,i);for(let e of Array.from(this.videoEl.textTracks))this.bindSubtitleTrack(e);let o=e=>this.bindSubtitleTrack(e.track);this.videoEl.textTracks.addEventListener?.(`addtrack`,o),this.domCleans.push(()=>this.videoEl.textTracks.removeEventListener?.(`addtrack`,o)),this.listen(this.wrapper,`mouseleave`,()=>{!this.player.getState().paused&&!this.menuOpen&&this.setControlsIdle(!0)})}setToolbar(e){let t=new Set(e.hidden),n={play:this.playBtn,volume:this.volumeSlider.parentElement,settings:this.settingsBtn,pip:this.pipBtn,fullscreen:this.fullscreenBtn};for(let e of Object.keys(n))n[e].classList.toggle(`flux-hidden`,t.has(e));t.has(`settings`)&&this.menuOpen&&this.toggleMenu(!1),this.extraButtons.replaceChildren(...(e.buttons??[]).map(({label:e,onClick:t})=>{let n=document.createElement(`button`);return n.type=`button`,n.className=`flux-player-icon-btn`,n.textContent=e,n.onclick=()=>t(this.player),n})),this.extraButtons.style.display=this.extraButtons.childElementCount?``:`none`,this.setupControlRovingTabindex()}setupControlRovingTabindex(){this.controlElements=[this.playBtn,this.muteBtn,this.volumeSlider,this.timeline,...Array.from(this.extraButtons.querySelectorAll(`button`)),this.settingsBtn,this.pipBtn,this.fullscreenBtn].filter(e=>!e.closest(`.flux-hidden`)&&!e.hasAttribute(`disabled`)),this.controlElements.forEach((e,t)=>{e.tabIndex=t===0?0:-1})}moveControlFocus(e){this.controlElements.length!==0&&(this.controlFocusIndex=(e+this.controlElements.length)%this.controlElements.length,this.controlElements.forEach((e,t)=>{e.tabIndex=t===this.controlFocusIndex?0:-1}),this.controlElements[this.controlFocusIndex].focus())}handleControlBarKeyDown(e){if(this.menuOpen)return;let t=this.controlElements.findIndex(e=>e===document.activeElement);if(t!==-1){if(e.key===`ArrowRight`){e.preventDefault(),this.moveControlFocus(t+1);return}if(e.key===`ArrowLeft`){e.preventDefault(),this.moveControlFocus(t-1);return}if(e.key===`Home`){e.preventDefault(),this.moveControlFocus(0);return}e.key===`End`&&(e.preventDefault(),this.moveControlFocus(this.controlElements.length-1))}}updateMenuA11yState(){this.menuItems=Array.from(this.settingsMenu.querySelectorAll(`.flux-player-menu-item`)),this.menuItems.forEach((e,t)=>{e.setAttribute(`role`,`menuitemradio`),e.setAttribute(`tabindex`,t===this.menuFocusIndex?`0`:`-1`),e.setAttribute(`aria-checked`,e.classList.contains(`flux-active`)?`true`:`false`)})}focusMenuItem(e){this.menuItems.length!==0&&(this.menuFocusIndex=(e+this.menuItems.length)%this.menuItems.length,this.menuItems.forEach((e,t)=>{e.tabIndex=t===this.menuFocusIndex?0:-1}),this.menuItems[this.menuFocusIndex].focus())}handleSettingsKeyDown(e){if(!(!this.menuOpen||this.menuItems.length===0)){if(e.key===`ArrowDown`){e.preventDefault(),this.focusMenuItem(this.menuFocusIndex+1);return}if(e.key===`ArrowUp`){e.preventDefault(),this.focusMenuItem(this.menuFocusIndex-1);return}if(e.key===`Home`){e.preventDefault(),this.focusMenuItem(0);return}if(e.key===`End`){e.preventDefault(),this.focusMenuItem(this.menuItems.length-1);return}if(e.key===`Tab`){e.preventDefault();let t=e.shiftKey?-1:1;this.focusMenuItem(this.menuFocusIndex+t);return}if(e.key===`Escape`){e.preventDefault(),this.toggleMenu(!1),this.settingsBtn.focus();return}(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.menuItems[this.menuFocusIndex]?.click())}}updatePipAvailability(){let e=document,t=this.videoEl,n=!!(e.pictureInPictureEnabled&&this.videoEl.requestPictureInPicture),r=!!t.webkitSupportsPresentationMode?.(`picture-in-picture`);this.pipSupported=n||r,this.pipSupported?(this.pipBtn.removeAttribute(`disabled`),this.pipBtn.removeAttribute(`aria-disabled`),this.pipBtn.removeAttribute(`title`),this.pipBtn.classList.remove(`flux-disabled`)):(this.pipBtn.setAttribute(`disabled`,`true`),this.pipBtn.setAttribute(`aria-disabled`,`true`),this.pipBtn.setAttribute(`title`,`Picture in Picture not supported in this browser`),this.pipBtn.classList.add(`flux-disabled`))}async togglePip(){if(!this.pipSupported)return;let e=document,t=this.videoEl;if(e.pictureInPictureEnabled&&this.videoEl.requestPictureInPicture){if(e.pictureInPictureElement===this.videoEl&&e.exitPictureInPicture){await e.exitPictureInPicture().catch(()=>{});return}await this.videoEl.requestPictureInPicture().catch(()=>{});return}if(t.webkitSupportsPresentationMode?.(`picture-in-picture`)&&t.webkitSetPresentationMode){let e=t.webkitPresentationMode===`picture-in-picture`?`inline`:`picture-in-picture`;try{t.webkitSetPresentationMode(e),this.pipBtn.classList.toggle(`flux-active`,e===`picture-in-picture`)}catch{}}}listen(e,t,n,r=!1){if(e.addEventListener(t,n),this.domCleans.push(()=>{e.removeEventListener(t,n)}),r){let e=this.domCleans[this.domCleans.length-1];this.domCleans[this.domCleans.length-1]=()=>{e()}}}getTimelineHoverData(e){let t=this.timeline.getBoundingClientRect();if(t.width<=0)return null;let n=(e-t.left)/t.width;n=Math.max(0,Math.min(1,n));let r=this.player.getState().duration||0;return{position:n,duration:r,targetTime:n*r}}resolveThumbnailVttUrl(e){let t=typeof this.uiConfig?.thumbnailVtt==`string`?this.uiConfig.thumbnailVtt.trim():``;if(t.length>0)return t;let n=e.source?.thumbnailVtt?.trim()||``;return n.length>0?n:null}async syncThumbnailTrack(e){let t=this.resolveThumbnailVttUrl(e);if(t!==this.thumbnailVttUrl&&(this.thumbnailVttUrl=t,this.thumbnailCues=[],this.hideTimelineThumbnail(),t)){this.thumbnailFetchAbort?.abort(),this.thumbnailFetchAbort=new AbortController;try{let e=await fetch(t,{signal:this.thumbnailFetchAbort.signal});if(!e.ok)throw Error(`Failed to fetch thumbnail VTT: ${e.status}`);let n=await e.text();this.thumbnailCues=this.parseThumbnailVtt(n,t)}catch(e){e.name!==`AbortError`&&console.warn(`[DefaultUI] Unable to load thumbnail VTT`,e),this.thumbnailCues=[]}}}parseThumbnailVtt(e,t){let n=e.split(/\r?\n/),r=[],i=0;for(;i<n.length;){let e=n[i].trim();if(!e||e.toUpperCase()===`WEBVTT`||e.startsWith(`NOTE`)){i+=1;continue}let o=e;if(!o.includes(`-->`)&&i+1<n.length&&(o=n[i+1].trim(),i+=1),!o.includes(`-->`)){i+=1;continue}let[c,l]=o.split(`-->`).map(e=>e.trim()),u=l.split(/\s+/)[0],d=this.parseVttTime(c),f=this.parseVttTime(u);if(!Number.isFinite(d)||!Number.isFinite(f)||f<=d){i+=1;continue}i+=1;let p=[];for(;i<n.length&&n[i].trim()!==``;)p.push(n[i].trim()),i+=1;let m=p.find(e=>this.isThumbnailPayload(e))||``,h=this.parseThumbnailCuePayload(m,t);for(h&&r.push({start:d,end:f,...h});i<n.length&&n[i].trim()===``;)i+=1}return r}parseVttTime(e){let t=e.split(`:`);if(t.length<2||t.length>3)return NaN;let n=Number(t[t.length-1]),r=Number(t[t.length-2]),i=t.length===3?Number(t[0]):0;return!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(n)?NaN:i*3600+r*60+n}parseThumbnailCuePayload(e,t){if(!e)return null;let[n,r=``]=e.split(`#`,2);if(!n)return null;let i=n;try{i=new URL(n,t).toString()}catch{i=n}let o=null,c=null,l=null,u=null,d=r.match(/xywh=(\d+),(\d+),(\d+),(\d+)/i);return d&&(o=Number(d[1]),c=Number(d[2]),l=Number(d[3]),u=Number(d[4])),{imageUrl:i,x:o,y:c,w:l,h:u}}isThumbnailPayload(e){let t=e.trim();return t?/^(https?:\/\/|\/|\.\/|\.\.\/|[^\s]+\.(jpg|jpeg|png|webp|avif|gif|svg))(#xywh=\d+,\d+,\d+,\d+)?(\?.*)?$/i.test(t):!1}findThumbnailCue(e){if(this.thumbnailCues.length===0)return null;for(let t of this.thumbnailCues)if(e>=t.start&&e<t.end)return t;let t=this.thumbnailCues[this.thumbnailCues.length-1];return e>=t.start?t:null}renderTimelineThumbnail(e){if(!this.thumbnailVttUrl||this.thumbnailCues.length===0){this.hideTimelineThumbnail();return}let t=this.player.getState();if(t.isLive||!Number.isFinite(t.duration)||t.duration<=0){this.hideTimelineThumbnail();return}let n=this.getTimelineHoverData(e.clientX);if(!n){this.hideTimelineThumbnail();return}let r=this.findThumbnailCue(n.targetTime);if(!r){this.hideTimelineThumbnail();return}let i=r.x!==null&&r.y!==null&&r.w!==null&&r.h!==null;this.timelineThumbnailImage.style.objectFit=i?`none`:`cover`,i?(this.timelineThumbnailImage.style.objectPosition=`-${r.x}px -${r.y}px`,this.timelineThumbnailImage.style.width=`${r.w}px`,this.timelineThumbnailImage.style.height=`${r.h}px`):(this.timelineThumbnailImage.style.objectPosition=`50% 50%`,this.timelineThumbnailImage.style.width=`160px`,this.timelineThumbnailImage.style.height=`90px`);let o=this.timeline.getBoundingClientRect(),c=this.timelineThumbnailPreview.offsetWidth||160,l=n.position*o.width,u=Math.max(c/2,Math.min(o.width-c/2,l));this.timelineThumbnailPreview.style.left=`${u}px`,this.timelineThumbnailImage.src===r.imageUrl?this.timelineThumbnailImage.complete&&this.timelineThumbnailImage.naturalWidth>0&&this.timelineThumbnailPreview.classList.remove(`flux-hidden`):(this.timelineThumbnailPreview.classList.add(`flux-hidden`),this.timelineThumbnailImage.src=r.imageUrl)}hideTimelineThumbnail(){this.timelineThumbnailPreview.classList.add(`flux-hidden`)}bindSubtitleTrack(e){if(this.subtitleTrackListeners.has(e))return;let t=()=>{e.mode===`showing`&&(e.mode=`hidden`),this.renderSubtitleCues()};e.addEventListener(`cuechange`,t),this.subtitleTrackListeners.set(e,t),this.domCleans.push(()=>{e.removeEventListener(`cuechange`,t),this.subtitleTrackListeners.delete(e)})}renderSubtitleCues(){let e=[];for(let t=0;t<this.videoEl.textTracks.length;t++){let n=this.videoEl.textTracks[t];if(!(n.mode===`disabled`||!n.activeCues))for(let t=0;t<n.activeCues.length;t++){let r=(n.activeCues[t].text??``).trim().replace(/<[^>]+>/g,``).trim();r&&e.push(r)}}if(e.length===0){this.subtitleDisplay.innerHTML=``;return}this.subtitleDisplay.innerHTML=e.map(e=>`<span class="flux-player-subtitle-text">${this.htmlEscape(e)}</span>`).join(`<br>`)}htmlEscape(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}handlePrimaryAction(){let e=this.player.getState();if(e.ended){this.replay();return}if(e.paused){this.player.play().catch(e=>{console.error(`[DefaultUI] Play failed:`,e)});return}this.player.pause()}replay(){this.player.seek(0),this.player.play().catch(e=>{console.error(`[DefaultUI] Replay failed:`,e)})}updateState(e){this.resetUiForSourceChange(e);let t=e.source?.adBreakTimes||[],n=t.join(`,`)+`/`+e.duration;if(n!==this.markerSignature){this.markerSignature=n,this.timeline.querySelectorAll(`.flux-ad-marker`).forEach(e=>e.remove());for(let n of t){if(!Number.isFinite(e.duration)||n>=e.duration)continue;let t=document.createElement(`span`);t.className=`flux-ad-marker`,t.title=n===0?`Pre-roll ad`:`Ad at `+this.formatTime(n),t.style.cssText=`position:absolute;top:-2px;height:8px;width:4px;border-radius:1px;background:#ffd45e;z-index:2`,t.style.left=100*n/e.duration+`%`,this.timeline.append(t)}}e.selectedSubtitle===null&&!e.availableSubtitles.some(e=>e.selected)&&this.subtitleDisplay.replaceChildren(),this.syncThumbnailTrack(e).catch(e=>{console.warn(`[DefaultUI] Thumbnail sync failed`,e)}),e.paused?this.uiPaused||(this.uiPaused=!0,this.playBtn.innerHTML=g.play,!e.error&&!e.ended&&this.bigPlay.classList.remove(`flux-hidden`),this.setControlsIdle(!1),clearTimeout(this.idleTimeout)):this.uiPaused&&(this.uiPaused=!1,this.playBtn.innerHTML=g.pause,this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.add(`flux-hidden`),this.setControlsIdle(!1),clearTimeout(this.idleTimeout),this.menuOpen||(this.idleTimeout=setTimeout(()=>{this.setControlsIdle(!0)},3e3))),e.buffering?this.spinner.classList.remove(`flux-hidden`):this.spinner.classList.add(`flux-hidden`),e.error?(this.errorPanel.classList.remove(`flux-hidden`),this.errorTextEl.innerText=e.error.message,this.spinner.classList.add(`flux-hidden`),this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.add(`flux-hidden`)):this.errorPanel.classList.add(`flux-hidden`),e.ended&&!e.error?(this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.remove(`flux-hidden`),this.setControlsIdle(!1),this.playBtn.innerHTML=g.replay):this.replayBtn.classList.add(`flux-hidden`),e.isLive?(this.liveBadge.classList.remove(`flux-hidden`),this.timeline.classList.add(`flux-disabled`),this.timeDisplay.classList.add(`flux-hidden`)):(this.liveBadge.classList.add(`flux-hidden`),this.timeline.classList.remove(`flux-disabled`),this.timeDisplay.classList.remove(`flux-hidden`));let r=e.duration||0;if(!this.isDragging&&(this.timeDisplay.innerText=`${this.formatTime(e.currentTime)} / ${this.formatTime(r)}`,this.timeDisplay.setAttribute(`aria-label`,e.isLive?`Live stream, current position ${this.formatTime(e.currentTime)}`:`Current time ${this.formatTime(e.currentTime)} of ${this.formatTime(r)}`),this.timeline.setAttribute(`aria-valuemin`,`0`),this.timeline.setAttribute(`aria-valuenow`,String(Math.round(e.currentTime))),this.timeline.setAttribute(`aria-valuemax`,String(Number.isFinite(r)?Math.round(r):0)),this.timeline.setAttribute(`aria-valuetext`,`${this.formatTime(e.currentTime)} of ${this.formatTime(r)}`),r>0))if(this.progressFill.style.width=`${e.currentTime/r*100}%`,e.buffered.length>0){let t=e.buffered[e.buffered.length-1];this.bufferedFill.style.width=`${t.end/r*100}%`}else this.bufferedFill.style.width=`0%`;e.muted||e.volume===0?(this.muteBtn.innerHTML=g.mute,this.volumeSlider.value=`0`):(this.muteBtn.innerHTML=g.volume,this.volumeSlider.value=String(e.volume))}toggleMenu(e){this.menuOpen=typeof e==`boolean`?e:!this.menuOpen,this.menuOpen?(this.renderMenu(),this.settingsMenu.classList.remove(`flux-hidden`),this.settingsBtn.setAttribute(`aria-expanded`,`true`),this.menuFocusIndex=0,this.updateMenuA11yState(),this.focusMenuItem(this.menuFocusIndex),clearTimeout(this.idleTimeout)):(this.settingsMenu.classList.add(`flux-hidden`),this.settingsBtn.setAttribute(`aria-expanded`,`false`),this.wrapper.dispatchEvent(new Event(`mousemove`)))}renderMenu(){let e=this.player.getState();this.settingsMenu.innerHTML=``;let t=e.selectedSubtitle??e.availableSubtitles.find(e=>e.selected)?.id??null;this.addMenuSection(`Quality`,e.availableQualities.map(t=>({id:String(t.id),label:t.label,active:e.selectedQuality===t.id,onClick:()=>this.player.setQuality(t.id)})).concat(e.availableQualities.length>0?[{id:`auto`,label:`Auto`,active:e.selectedQuality===`auto`,onClick:()=>this.player.setQuality(`auto`)}]:[])),this.addMenuSection(`Audio`,e.availableAudioTracks.map(e=>({id:e.id,label:e.label,active:e.selected,onClick:()=>this.player.setAudioTrack(e.id)}))),this.addMenuSection(`Captions`,e.availableSubtitles.map(e=>({id:e.id,label:e.label,active:t===e.id,onClick:()=>this.player.setSubtitle(e.id)})).concat(e.availableSubtitles.length>0?[{id:`off`,label:`Off`,active:t===null,onClick:()=>this.player.setSubtitle(null)}]:[]));let n=[.5,.75,1,1.25,1.5,2].map(t=>({id:String(t),label:t===1?`Normal (1x)`:`${t}x`,active:e.playbackRate===t,onClick:()=>this.player.setPlaybackRate(t)}));this.addMenuSection(`Speed`,n),this.updateMenuA11yState()}addMenuSection(e,t){let n=document.createElement(`div`);n.className=`flux-player-menu-section`;let r=document.createElement(`div`);if(r.className=`flux-player-menu-header`,r.innerText=e,n.appendChild(r),t.length===0){let e=document.createElement(`div`);e.className=`flux-player-menu-placeholder`,e.innerText=`Not available`,n.appendChild(e)}else t.forEach(e=>{let t=document.createElement(`div`);t.className=`flux-player-menu-item ${e.active?`flux-active`:``}`,t.innerText=e.label,t.setAttribute(`role`,`menuitemradio`),t.setAttribute(`aria-checked`,e.active?`true`:`false`),t.tabIndex=-1,t.addEventListener(`click`,()=>{e.onClick(),this.toggleMenu(!1)}),n.appendChild(t)});this.settingsMenu.appendChild(n)}destroy(){this.thumbnailFetchAbort?.abort(),this.cleans.forEach(e=>e()),this.domCleans.forEach(e=>e()),this.domCleans=[],clearTimeout(this.idleTimeout),this.container.innerHTML=``}},T=class{player;adapter;cleans=[];loadStartedAt=null;playbackStartedAt=null;rebufferStartedAt=null;totalRebufferMs=0;rebufferCount=0;sessionStartedAt=Date.now();manifestLoadedAt=null;firstFrameAt=null;trace=[];bitrateTimeline=[];constructor(e,t){this.player=e,this.adapter=t||((e,t)=>console.log(`[Analytics] ${e}`,t)),this.bind()}bind(){this.emit(`player.created`,`lifecycle`,{}),[`source_loading`,`source_loaded`,`playback_requested`,`playback_started`,`seek_start`,`seek_complete`,`error`].forEach(e=>{this.cleans.push(this.player.on(e,t=>{e===`source_loading`&&(this.loadStartedAt=Date.now(),this.playbackStartedAt=null,this.manifestLoadedAt=null,this.firstFrameAt=null,this.rebufferCount=0,this.totalRebufferMs=0),e===`source_loaded`&&(this.manifestLoadedAt=Date.now(),this.emit(`qoe.startup.manifest_loaded`,`qoe`,{manifestLoadMs:this.loadStartedAt?this.manifestLoadedAt-this.loadStartedAt:null})),e===`playback_started`&&this.playbackStartedAt===null&&(this.playbackStartedAt=Date.now(),this.firstFrameAt=this.playbackStartedAt,this.emit(`qoe.startup.first_frame`,`qoe`,{firstFrameMs:this.loadStartedAt?this.firstFrameAt-this.loadStartedAt:null,manifestLoadMs:this.loadStartedAt&&this.manifestLoadedAt?this.manifestLoadedAt-this.loadStartedAt:null,postManifestToFirstFrameMs:this.firstFrameAt&&this.manifestLoadedAt?this.firstFrameAt-this.manifestLoadedAt:null})),this.emit(this.normalizeEventName(e),this.categoryForEvent(e),this.withQoe(t))}))}),this.cleans.push(this.player.on(`state:paused`,e=>{e&&this.emit(`playback.pause`,`playback`,this.withQoe({currentTime:this.player.getState().currentTime}))})),this.cleans.push(this.player.on(`state:buffered`,e=>{this.player.getState().readyState===2&&this.rebufferStartedAt===null&&(this.rebufferStartedAt=Date.now(),this.rebufferCount+=1,this.emit(`playback.buffering_start`,`qoe`,this.withQoe({currentTime:this.player.getState().currentTime,rebufferCount:this.rebufferCount,sinceStartMs:Date.now()-this.sessionStartedAt})))})),this.cleans.push(this.player.on(`state:readyState`,e=>{if(e===4&&this.rebufferStartedAt!==null){let e=Date.now()-this.rebufferStartedAt;this.totalRebufferMs+=e,this.rebufferStartedAt=null,this.emit(`playback.buffering_end`,`qoe`,this.withQoe({currentTime:this.player.getState().currentTime,rebufferMs:e,rebufferCount:this.rebufferCount,totalRebufferMs:this.totalRebufferMs,sinceStartMs:Date.now()-this.sessionStartedAt}))}})),this.cleans.push(this.player.on(`state:selectedQuality`,e=>{let t=this.player.getState().availableQualities.find(e=>e.selected);this.bitrateTimeline.push({at:Date.now(),bitrate:t?.bitrate||null,quality:e}),this.emit(`track.quality_changed`,`track`,this.withQoe({quality:e}))})),this.cleans.push(this.player.on(`state:selectedSubtitle`,e=>this.emit(`track.subtitle_changed`,`track`,this.withQoe({subtitle:e})))),this.cleans.push(this.player.on(`state:selectedAudioTrack`,e=>this.emit(`track.audio_changed`,`track`,this.withQoe({audioTrack:e})))),this.cleans.push(this.player.on(`state:volume`,e=>this.emit(`playback.volume_changed`,`playback`,this.withQoe({volume:e})))),this.cleans.push(this.player.on(`state:muted`,e=>this.emit(`playback.muted_changed`,`playback`,this.withQoe({muted:e})))),this.cleans.push(this.player.on(`state:playbackRate`,e=>this.emit(`playback.rate_changed`,`playback`,this.withQoe({rate:e})))),this.cleans.push(this.player.on(`error`,e=>{let t=e?.error||e;this.emit(`error.classified`,`error`,{classification:this.classifyError(t),code:t?.code,message:t?.message})}))}getSessionTrace(){return this.trace.map(e=>({...e,payload:JSON.parse(JSON.stringify(e.payload??null))}))}normalizeEventName(e){return{source_loading:`source.loading`,source_loaded:`source.loaded`,playback_requested:`playback.requested`,playback_started:`playback.started`,seek_start:`playback.seek_start`,seek_complete:`playback.seek_complete`,error:`playback.error`}[e]||e}withQoe(e){let t=this.player.getState().availableQualities.find(e=>e.selected),n=this.player.getVideoPlaybackQuality?.()||void 0;return{...e,qoe:{startupTimeMs:this.loadStartedAt&&this.playbackStartedAt?this.playbackStartedAt-this.loadStartedAt:null,manifestLoadMs:this.loadStartedAt&&this.manifestLoadedAt?this.manifestLoadedAt-this.loadStartedAt:null,firstFrameMs:this.loadStartedAt&&this.firstFrameAt?this.firstFrameAt-this.loadStartedAt:null,rebufferCount:this.rebufferCount,totalRebufferMs:this.totalRebufferMs,bitrate:t?.bitrate||null,droppedFrames:n?.droppedVideoFrames??null,bitrateTimeline:this.bitrateTimeline.slice(-20)}}}emit(e,t,n){let r=Date.now(),i={at:r,sinceStartMs:r-this.sessionStartedAt,event:e,category:t,payload:n};this.trace.push(i),this.trace.length>500&&this.trace.shift(),this.adapter(e,n)}classifyError(e){let t=String(e?.code||``).toLowerCase(),n=String(e?.message||``).toLowerCase();return t.includes(`network`)||n.includes(`network`)||n.includes(`manifest`)||n.includes(`segment`)?`network`:t.includes(`media`)||n.includes(`decode`)||n.includes(`demux`)?`decode`:t.includes(`drm`)||n.includes(`drm`)||n.includes(`key system`)||n.includes(`license`)?`drm`:`unknown`}categoryForEvent(e){return e===`error`?`error`:e.startsWith(`seek`)||e.startsWith(`playback`)?`playback`:e.startsWith(`source`)?`lifecycle`:`qoe`}destroy(){this.cleans.forEach(e=>e())}},E=class{player;mountEl;panel=null;bodyEl=null;visible=!0;events=[];cleans=[];constructor(e,t){this.player=e,this.mountEl=t||document.body,this.inject(),this.bind()}inject(){this.panel=document.createElement(`div`),this.panel.className=`flux-devtools-overlay`,this.panel.style.position=this.mountEl===document.body?`fixed`:`absolute`,this.panel.style.top=`10px`,this.panel.style.right=`10px`,this.panel.style.backgroundColor=`rgba(0,0,0,0.85)`,this.panel.style.color=`#0f0`,this.panel.style.padding=`10px`,this.panel.style.fontFamily=`monospace`,this.panel.style.fontSize=`12px`,this.panel.style.zIndex=`9999`,this.panel.style.width=`320px`,this.panel.style.maxHeight=`280px`,this.panel.style.overflow=`auto`,this.panel.style.borderRadius=`8px`,this.panel.style.pointerEvents=`auto`,this.bodyEl=document.createElement(`pre`),this.bodyEl.style.margin=`0`,this.bodyEl.style.whiteSpace=`pre-wrap`,this.panel.appendChild(this.bodyEl),this.mountEl.appendChild(this.panel)}bind(){[`source_loading`,`source_loaded`,`playback_requested`,`playback_started`,`seek_start`,`seek_complete`,`error`,`state:change`].forEach(e=>{this.cleans.push(this.player.on(e,t=>{this.events.unshift({name:e,payload:t,ts:Date.now()}),this.events.length>25&&(this.events.length=25),this.render()}))}),this.render()}render(){if(!this.bodyEl||!this.visible)return;let e=this.player.getState(),t=this.events.slice(0,8).map(e=>`${new Date(e.ts).toLocaleTimeString()} ${e.name}`).join(`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Flux={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t)=>()=>(e&&(t=e(e=0)),t),r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=class{state;bus;constructor(e){this.bus=e,this.state=this.getDefaultState()}getDefaultState(){return{status:`idle`,currentTime:0,duration:NaN,paused:!0,ended:!1,buffering:!1,muted:!1,volume:1,playbackRate:1,buffered:[],selectedQuality:`auto`,availableQualities:[],selectedSubtitle:null,availableSubtitles:[],selectedAudioTrack:`default`,availableAudioTracks:[],engineType:`none`,readyState:0,error:null,isLive:!1,isDvr:!1,source:null}}get snapshot(){return{...this.state,buffered:this.state.buffered.map(e=>({...e})),availableQualities:this.state.availableQualities.map(e=>({...e})),availableSubtitles:this.state.availableSubtitles.map(e=>({...e})),availableAudioTracks:this.state.availableAudioTracks.map(e=>({...e})),source:this.state.source?{...this.state.source}:null}}reset(){let e=this.state.volume,t=this.state.muted;this.state=this.getDefaultState(),this.state.volume=e,this.state.muted=t,this.notify()}update(e){let t=!1;for(let n of Object.keys(e))this.state[n]!==e[n]&&(this.state[n]=e[n],t=!0,this.bus.emit(`state:${n}`,e[n]));t&&this.notify()}notify(){this.bus.emit(`state:change`,this.snapshot)}},o=class{listeners=new Map;on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}off(e,t){let n=this.listeners.get(e);if(!n)return;let r=n.indexOf(t);r>-1&&n.splice(r,1)}emit(e,...t){let n=this.listeners.get(e);if(n)for(let r of[...n])try{r(...t)}catch(t){console.error(`Error in event listener for ${e}:`,t)}}clear(){this.listeners.clear()}},c=class{engines=[];register(e){this.engines.find(t=>t.id===e.id)||this.engines.push(e)}getEngines(){return this.engines}findEngineForSource(e,t){if(e&&e!==`auto`)return this.engines.find(t=>t.canPlayType(e))||null;for(let e of this.engines)if(e.canPlaySource(t))return e;return null}},l=[{pattern:/application\/(vnd\.apple\.mpegurl|x-mpegurl)/i,type:`hls`},{pattern:/application\/dash\+xml/i,type:`dash`},{pattern:/video\/mp4/i,type:`mp4`},{pattern:/video\/webm/i,type:`webm`}];function u(e){if(!e)return`auto`;for(let t of l)if(t.pattern.test(e))return t.type;return`auto`}function d(e){try{let t=new URL(e);return`${t.pathname}${t.search}`.toLowerCase()}catch{return e.toLowerCase()}}function f(e,t){let n=u(t);if(n!==`auto`)return n;let r=d(e);return r.includes(`.m3u8`)?`hls`:r.includes(`.mpd`)?`dash`:r.includes(`.webm`)?`webm`:r.includes(`.mp4`)?`mp4`:/(format|type)=(m3u8|hls)/i.test(r)?`hls`:/(format|type)=(mpd|dash)/i.test(r)?`dash`:`auto`}function p(e,t,n){let r=e.parentElement;if(!r||n.aborted)return Promise.resolve(`cancelled`);let i=getComputedStyle(r).position===`static`,o=r.style.position;i&&(r.style.position=`relative`);let c=document.createElement(`div`);c.style.cssText=`position:absolute;inset:0;z-index:100;background:black;color:white`;let l=document.createElement(`video`);l.style.cssText=`width:100%;height:100%;object-fit:contain`,l.playsInline=!0,l.muted=e.muted,l.volume=e.volume,l.controls=!0,l.setAttribute(`aria-label`,`Advertisement`);let u=document.createElement(`span`);return u.textContent=`Advertisement`,u.style.cssText=`position:absolute;top:12px;left:12px;background:#151515;padding:4px 8px;font:13px sans-serif;pointer-events:none`,c.append(l,u),r.append(c),new Promise(e=>{let u=!1,d,f=t=>{u||(u=!0,clearTimeout(d),n.removeEventListener(`abort`,p),l.onended=l.onerror=l.onwaiting=l.onplaying=null,l.pause(),l.removeAttribute(`src`),l.load(),c.remove(),i&&(r.style.position=o),e(t))},p=()=>f(`cancelled`),m=()=>{clearTimeout(d),d=window.setTimeout(()=>f(`failed`),1e4)};l.onended=()=>f(`ended`),l.onerror=()=>f(`failed`),l.onwaiting=m,l.onplaying=()=>clearTimeout(d),n.addEventListener(`abort`,p,{once:!0}),m(),l.src=t,l.play().catch(()=>f(`failed`))})}var m=class{bus;state;registry;currentEngine=null;currentVideoElement=null;cleans=[];generation=0;adSource;pendingMidrolls=[];adController;adPlayback;cancelAd(){this.adController?.abort(),this.adPlayback=void 0,this.adController=void 0}pendingSeekTime=null;performance={startupMode:`balanced`,startupStrategy:`balanced`,startupBufferSeconds:1.2,manifestFastPath:!1};abr={startupProfile:`balanced`,upgradeAggression:`medium`,rebufferSafetyBias:`medium`};constructor(){this.bus=new o,this.state=new i(this.bus),this.registry=new c}attachVideo(e){this.currentVideoElement=e,this.currentEngine&&this.currentEngine.attach(e)}setPerformance(e){this.performance={startupMode:e?.startupMode??`balanced`,startupStrategy:e?.startupStrategy??`balanced`,startupBufferSeconds:e?.startupBufferSeconds??1.2,manifestFastPath:e?.manifestFastPath??!1},this.bus.emit(`performance:updated`,this.performance)}setAbr(e){this.abr={startupProfile:e?.startupProfile??`balanced`,upgradeAggression:e?.upgradeAggression??`medium`,rebufferSafetyBias:e?.rebufferSafetyBias??`medium`},this.bus.emit(`abr:updated`,this.abr)}getStartupReadiness(){return this.currentEngine?.getStartupReadiness?.()??null}async load(e){let t=++this.generation;this.cancelAd(),this.adSource=e.preroll?.src,this.pendingMidrolls=(e.midrolls||[]).filter(e=>Number.isFinite(e.at)&&e.at>0&&e.src).sort((e,t)=>e.at-t.at),this.bus.emit(`startup:mode`,{mode:this.performance.startupMode,startupBufferSeconds:this.performance.startupBufferSeconds});let n=f(e.src,e.mimeType),r=e.type&&e.type!==`auto`?e.type:n;this.state.update({currentTime:0,duration:NaN,readyState:0,error:null,paused:!0,ended:!1,buffering:!1,selectedQuality:`auto`,availableQualities:[],selectedSubtitle:null,availableSubtitles:[],selectedAudioTrack:`default`,availableAudioTracks:[],isLive:!1,isDvr:!1,status:`loading`,source:{src:e.src,adBreakTimes:[...this.adSource?[0]:[],...this.pendingMidrolls.map(e=>e.at)],requestedType:r,detectedType:n,mimeType:e.mimeType||null,title:e.title||null,poster:e.poster||null,thumbnailVtt:e.thumbnailVtt||null}});let i={...e};delete i.drm,this.bus.emit(`source_loading`,i);let o=r,c=this.registry.findEngineForSource(o,e.src);if(!c||e.drm&&c.id!==`dash`){let t={code:`NO_ENGINE`,message:e.drm?`Configured DRM requires DASH playback`:`No engine found for source`,engine:`core`,recoverable:!1};throw this.state.update({error:t,status:`error`}),this.bus.emit(`error`,t),Error(t.message)}if(this.currentEngine){if(await this.currentEngine.destroy(),t!==this.generation)return;this.unbindEngine()}this.currentEngine=c,this.currentEngine.setRuntimeConfig?.({performance:this.performance,abr:this.abr}),this.pendingSeekTime=null,this.currentVideoElement&&(e.muted!==void 0&&(this.currentVideoElement.muted=e.muted),this.currentEngine.attach(this.currentVideoElement)),this.bindEngine(this.currentEngine),this.state.update({engineType:c.id});try{if(await this.currentEngine.load(e),t!==this.generation)return;this.bus.emit(`source_loaded`,i);let n=this.getState();this.state.update({status:n.paused?`paused`:`playing`}),e.autoplay&&this.play().catch(e=>console.warn(`Autoplay failed`,e))}catch(e){if(t!==this.generation)return;let n={code:`LOAD_ERROR`,message:e?.message||`Unknown loading error`,engine:c.id,recoverable:!1};throw this.state.update({error:n,status:`error`,buffering:!1}),this.bus.emit(`error`,n),e}}bindEngine(e){this.cleans.forEach(e=>e()),this.cleans=[e.on(`play`,()=>{this.state.update({paused:!1,ended:!1,status:`playing`}),this.bus.emit(`play`)}),e.on(`playing`,()=>{this.state.update({paused:!1,readyState:4,buffering:!1,ended:!1,status:`playing`}),this.bus.emit(`playing`)}),e.on(`pause`,()=>{let e=this.getState();this.state.update({paused:!0,status:e.ended?`ended`:`paused`}),this.bus.emit(`pause`)}),e.on(`ended`,()=>{this.state.update({paused:!0,ended:!0,buffering:!1,status:`ended`}),this.bus.emit(`ended`)}),e.on(`seeked`,({currentTime:e})=>{this.state.update({currentTime:e,buffering:!1,status:this.getState().paused?`paused`:`playing`}),this.pendingSeekTime!==null&&(this.bus.emit(`seek_complete`,e),this.pendingSeekTime=null)}),e.on(`timeupdate`,({currentTime:t})=>{this.state.update({currentTime:t});let n=this.pendingMidrolls[0];n&&t>=n.at&&!this.currentVideoElement?.paused&&!this.adPlayback&&(this.pendingMidrolls.shift(),this.adSource=n.src,e.pause(),this.play().catch(t=>this.bus.emit(`error`,{code:`AD_RESUME_FAILED`,message:String(t),engine:e.id})))}),e.on(`durationchange`,({duration:e,isLive:t=e===1/0})=>{this.state.update({duration:e,isLive:t,isDvr:t&&!!this.currentVideoElement?.seekable.length})}),e.on(`volumechange`,({volume:e,muted:t})=>this.state.update({volume:e,muted:t})),e.on(`ratechange`,({playbackRate:e})=>this.state.update({playbackRate:e})),e.on(`progress`,({buffered:e})=>this.state.update({buffered:e})),e.on(`qualitychange`,({level:e})=>this.state.update({selectedQuality:e})),e.on(`trackschange`,({qualities:e,subtitles:t,audioTracks:n})=>{this.state.update({availableQualities:e,availableSubtitles:t,availableAudioTracks:n})}),e.on(`telemetry`,t=>{this.bus.emit(`telemetry`,{engine:e.id,...t||{}})}),e.on(`error`,({error:e})=>{if(e?.recoverable){this.state.update({error:null}),this.bus.emit(`error`,e);return}this.state.update({error:e,status:`error`,buffering:!1}),this.bus.emit(`error`,e)}),e.on(`ready`,()=>{this.state.update({readyState:4,buffering:!1,status:this.getState().paused?`ready`:`playing`}),this.bus.emit(`ready`)}),e.on(`waiting`,()=>{this.state.update({readyState:2,buffering:!0,status:`buffering`}),this.bus.emit(`waiting`)})]}unbindEngine(){this.cleans.forEach(e=>e()),this.cleans=[]}async play(){if(!this.currentEngine)throw Error(`No engine loaded`);if(this.bus.emit(`playback_requested`),this.adPlayback)return this.adPlayback;if(this.adSource&&this.currentVideoElement){let e=this.adSource;this.adSource=void 0,this.bus.emit(`ad:started`);let t=new AbortController;return this.adController=t,this.adPlayback=p(this.currentVideoElement,e,t.signal).then(async e=>{t.signal.aborted||(this.bus.emit(`ad:`+e),await this.playContent())}).finally(()=>{this.adController===t&&this.cancelAd()}),this.adPlayback}return this.playContent()}async playContent(){let e=this.generation;await this.currentEngine?.play(),e===this.generation&&(this.state.update({paused:!1,ended:!1,status:`playing`}),this.bus.emit(`playback_started`))}pause(){this.cancelAd(),this.currentEngine?.pause();let e=this.getState();this.state.update({paused:!0,status:e.ended?`ended`:`paused`})}async destroy(){++this.generation,this.cancelAd(),this.unbindEngine(),this.currentEngine&&=(await this.currentEngine.destroy(),null),this.bus.clear()}seek(e){this.pendingSeekTime=e,this.bus.emit(`seek_start`,e),this.currentEngine?.seek(e)}setVolume(e){this.currentEngine?.setVolume(e)}setMuted(e){this.currentEngine?.setMuted(e)}setPlaybackRate(e){this.currentEngine?.setPlaybackRate(e)}setQuality(e){this.currentEngine?.setQuality(e),this.state.update({selectedQuality:e})}setSubtitle(e){this.currentEngine?.setSubtitle(e),this.state.update({selectedSubtitle:e})}setAudioTrack(e){this.currentEngine?.setAudioTrack(e),this.state.update({selectedAudioTrack:e})}getState(){return this.state.snapshot}getStats(){return this.state.snapshot}on(e,t){return this.bus.on(e,t)}},h=class{id=`native`;isNative=!0;video=null;listeners=new Map;domListeners=[];canPlayType(e){return[`mp4`,`webm`,`ogg`].includes(e)}canPlaySource(e){let t=e.toLowerCase();return t.includes(`.mp4`)||t.includes(`.webm`)||t.includes(`.ogg`)}attach(e){this.video=e,this.bindDomEvents()}bindDomEvents(){if(!this.video)return;this.unbindDomEvents();let e=(e,t,n=()=>void 0)=>{let r=e=>{let r=n(e);this.emit(t,r)};this.video.addEventListener(e,r),this.domListeners.push({event:e,handler:r})};e(`play`,`play`),e(`pause`,`pause`),e(`playing`,`playing`),e(`ended`,`ended`),e(`waiting`,`waiting`),e(`seeked`,`seeked`,()=>({currentTime:this.video.currentTime})),e(`canplay`,`ready`),e(`timeupdate`,`timeupdate`,()=>({currentTime:this.video.currentTime})),e(`durationchange`,`durationchange`,()=>({duration:this.video.duration})),e(`volumechange`,`volumechange`,()=>({volume:this.video.volume,muted:this.video.muted})),e(`ratechange`,`ratechange`,()=>({playbackRate:this.video.playbackRate})),e(`progress`,`progress`,()=>{let e=[],t=this.video.buffered;for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return{buffered:e}}),e(`error`,`error`,()=>{let e=this.video.error;return{error:{code:e?.code?.toString()||`UNKNOWN`,message:e?.message||`Media Error`,engine:this.id,recoverable:!1,originalError:e}}})}unbindDomEvents(){this.video&&(this.domListeners.forEach(({event:e,handler:t})=>{this.video.removeEventListener(e,t)}),this.domListeners=[])}async load(e){if(!this.video)throw Error(`Video element not attached`);this.video.poster=e.poster||``,this.video.src=e.src,this.video.load()}async play(){await this.video?.play()}pause(){this.video?.pause()}async destroy(){this.unbindDomEvents(),this.video&&(this.video.src=``,this.video.removeAttribute(`src`)),this.video=null,this.listeners.clear()}seek(e){this.video&&(this.video.currentTime=e)}setVolume(e){this.video&&(this.video.volume=e)}setMuted(e){this.video&&(this.video.muted=e)}setPlaybackRate(e){this.video&&(this.video.playbackRate=e)}setQuality(e){console.warn(`Quality switching not supported in native engine`)}setSubtitle(e){}setAudioTrack(e){}on(e,t){let n=e;return this.listeners.has(n)||this.listeners.set(n,[]),this.listeners.get(n).push(t),()=>this.off(e,t)}off(e,t){let n=e,r=this.listeners.get(n);if(!r)return;let i=r.indexOf(t);i>-1&&r.splice(i,1)}emit(e,t){let n=e,r=this.listeners.get(n);if(r)for(let e of[...r])e(t)}},g={play:`<svg viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>`,replay:`<svg viewBox="0 0 24 24"><path d="M12 5V2L7 7l5 5V9c3.31 0 6 2.69 6 6a6 6 0 0 1-10.24 4.24l-1.42 1.42A8 8 0 1 0 20 15c0-4.42-3.58-8-8-8z"/></svg>`,pause:`<svg viewBox="0 0 24 24"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>`,mute:`<svg viewBox="0 0 24 24"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>`,volume:`<svg viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>`,fullscreen:`<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>`,fullscreenExit:`<svg viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>`,pip:`<svg viewBox="0 0 24 24"><path d="M19 7H5v10h14V7zm2-2v14H3V5h18zm-9 7h7v5h-7v-5z"/></svg>`,settings:`<svg viewBox="0 0 24 24"><path d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.06-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.73,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.06,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.43-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.49-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"/></svg>`},_=class{player;target;handler;constructor(e,t){this.player=e,this.target=t,this.handler=this.handleKey.bind(this),this.target.addEventListener(`keydown`,this.handler),this.target.tabIndex=0}handleKey(e){let t=document.activeElement?.tagName.toLowerCase();if(e.defaultPrevented||t===`input`||t===`textarea`||t===`button`&&e.key===` `)return;let n=!1;switch(e.key){case` `:case`k`:case`K`:n=!0,this.togglePlay();break;case`ArrowLeft`:n=!0,this.seekRelative(-5);break;case`ArrowRight`:n=!0,this.seekRelative(5);break;case`m`:case`M`:n=!0,this.toggleMute();break;case`f`:case`F`:n=!0,this.toggleFullscreen();break;case`c`:case`C`:n=!0,this.toggleCaptions();break}n&&(e.preventDefault(),e.stopPropagation())}togglePlay(){this.player.getState().paused?this.player.play().catch(()=>{}):this.player.pause()}seekRelative(e){let t=this.player.getState();this.player.seek(Math.max(0,Math.min(t.duration||0,t.currentTime+e)))}toggleMute(){let e=this.player.getState();this.player.setMuted(!e.muted)}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.target.requestFullscreen().catch(()=>{})}toggleCaptions(){this.player.getState().selectedSubtitle?this.player.setSubtitle(null):this.player.setSubtitle(`0`)}destroy(){this.target.removeEventListener(`keydown`,this.handler)}},v=class{static makeClickable(e,t){e.setAttribute(`role`,`button`),e.tabIndex=0,e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}},y={colors:{background:`#09090b`,surface:`rgba(9, 9, 11, 0.7)`,surfaceElevated:`rgba(39, 39, 42, 0.8)`,overlayGradientEnd:`rgba(0, 0, 0, 0.7)`,overlayError:`rgba(0, 0, 0, 0.8)`,menuBackground:`rgba(15, 15, 15, 0.9)`,menuBorder:`rgba(255, 255, 255, 0.1)`,menuHover:`rgba(255, 255, 255, 0.1)`,menuActive:`rgba(59, 130, 246, 0.1)`,buffered:`rgba(255, 255, 255, 0.4)`,textPrimary:`#fafafa`,textSecondary:`#a1a1aa`,brandPrimary:`#3b82f6`,danger:`#ef4444`,focus:`rgba(59, 130, 246, 0.5)`},radius:{sm:`4px`,md:`8px`,lg:`12px`,pill:`9999px`},spacing:{xs:`4px`,sm:`8px`,md:`16px`,lg:`24px`},typography:{fontFamily:`"Inter", "Roboto", "Outfit", sans-serif`,fontSizeSm:`12px`,fontSizeMd:`14px`,fontSizeLg:`16px`,fontWeightMedium:`500`,fontWeightBold:`700`},control:{height:`40px`,iconSize:`24px`}},b={colors:{background:`#ffffff`,surface:`rgba(255, 255, 255, 0.8)`,surfaceElevated:`rgba(244, 244, 245, 0.9)`,overlayGradientEnd:`rgba(0, 0, 0, 0.35)`,overlayError:`rgba(255, 255, 255, 0.95)`,menuBackground:`rgba(255, 255, 255, 0.95)`,menuBorder:`rgba(9, 9, 11, 0.1)`,menuHover:`rgba(9, 9, 11, 0.06)`,menuActive:`rgba(37, 99, 235, 0.12)`,buffered:`rgba(9, 9, 11, 0.25)`,textPrimary:`#09090b`,textSecondary:`#71717a`,brandPrimary:`#2563eb`,danger:`#dc2626`,focus:`rgba(37, 99, 235, 0.4)`},radius:y.radius,spacing:y.spacing,typography:y.typography,control:y.control};function x(e,t){if(!t)return e;let n=JSON.parse(JSON.stringify(e));for(let e of Object.keys(t))typeof t[e]==`object`?n[e]={...n[e],...t[e]}:n[e]=t[e];return n}function S(e,t=`flux-player`){let n=``;for(let[r,i]of Object.entries(e))if(typeof i==`object`)for(let[e,o]of Object.entries(i))n+=`--${t}-${r}-${e}: ${o};\n`;return n}function C(e,t){let n=y;typeof t==`string`?t===`light`&&(n=b):n=x(t.base===`light`?b:y,t),S(n),e.setAttribute(`style`,e.getAttribute(`style`)||``);for(let[t,r]of Object.entries(n))if(typeof r==`object`)for(let[n,i]of Object.entries(r))e.style.setProperty(`--flux-player-${t}-${n}`,i)}var w=class{player;container;videoEl;wrapper;overlay;spinner;bigPlay;replayBtn;errorPanel;errorTextEl;extraButtons;playBtn;muteBtn;pipBtn;fullscreenBtn;timeDisplay;liveBadge;progressFill;bufferedFill;markerSignature=``;timeline;timelineThumbnailPreview;timelineThumbnailImage;volumeSlider;settingsBtn;settingsMenu;menuOpen=!1;uiPaused=!0;isDragging=!1;uiConfig;iconOverrides;renderedIcons=new Map;cleans=[];domCleans=[];idleTimeout;fullscreenChangeHandler=null;pipSupported=!1;controlElements=[];controlFocusIndex=0;menuItems=[];menuFocusIndex=0;thumbnailVttUrl=null;thumbnailCues=[];thumbnailFetchAbort=null;subtitleDisplay;subtitleTrackListeners=new Map;activeSourceToken=null;resetUiForSourceChange(e){let t=`${e.source?.src||``}|${this.resolveThumbnailVttUrl(e)||``}`;if(t!==this.activeSourceToken){this.activeSourceToken=t,this.thumbnailFetchAbort?.abort(),this.thumbnailFetchAbort=null,this.thumbnailVttUrl=null,this.thumbnailCues=[],this.hideTimelineThumbnail(),this.timelineThumbnailImage.removeAttribute(`src`),this.subtitleDisplay.innerHTML=``;for(let[e,t]of this.subtitleTrackListeners.entries())e.removeEventListener(`cuechange`,t);this.subtitleTrackListeners.clear();for(let e=0;e<this.videoEl.textTracks.length;e++)this.videoEl.textTracks[e].mode=`disabled`,this.bindSubtitleTrack(this.videoEl.textTracks[e])}}constructor(e,t,n={}){if(this.player=e,this.uiConfig=n,this.iconOverrides={...n.icons},typeof t==`string`){let e=document.querySelector(t);if(!e)throw Error(`Target ${t} not found`);this.container=e}else this.container=t;this.videoEl=document.createElement(`video`),this.videoEl.className=`flux-player-video`,this.player.attachVideo(this.videoEl),this.render(),this.bindEvents(),this.updateState(this.player.getState())}render(){this.container.innerHTML=``,this.wrapper=document.createElement(`div`),this.wrapper.className=`flux-player-wrapper`,this.wrapper.appendChild(this.videoEl),this.spinner=document.createElement(`div`),this.spinner.className=`flux-player-spinner`,this.wrapper.appendChild(this.spinner),this.bigPlay=document.createElement(`div`),this.bigPlay.className=`flux-player-big-play`,this.bigPlay.setAttribute(`aria-label`,`Play`),this.renderIcon(this.bigPlay,`play`),this.wrapper.appendChild(this.bigPlay),v.makeClickable(this.bigPlay,()=>this.handlePrimaryAction()),this.replayBtn=document.createElement(`div`),this.replayBtn.className=`flux-player-replay flux-hidden`,this.replayBtn.setAttribute(`aria-label`,`Replay`),this.renderIcon(this.replayBtn,`replay`),this.wrapper.appendChild(this.replayBtn),v.makeClickable(this.replayBtn,()=>this.replay()),this.errorPanel=document.createElement(`div`),this.errorPanel.className=`flux-player-error flux-hidden`,this.errorPanel.innerHTML=`<div class="flux-player-error-title">Playback Error</div>`,this.errorTextEl=document.createElement(`div`),this.errorTextEl.className=`flux-player-error-text`,this.errorPanel.appendChild(this.errorTextEl),this.wrapper.appendChild(this.errorPanel),this.overlay=document.createElement(`div`),this.overlay.className=`flux-player-overlay`;let e=document.createElement(`div`);e.className=`flux-player-controls`,this.timeline=document.createElement(`div`),this.timeline.className=`flux-player-timeline`,this.timeline.setAttribute(`role`,`slider`),this.timeline.setAttribute(`aria-label`,`Seek timeline`),this.timeline.tabIndex=-1,this.bufferedFill=document.createElement(`div`),this.bufferedFill.className=`flux-player-timeline-buffered`,this.progressFill=document.createElement(`div`),this.progressFill.className=`flux-player-timeline-progress`,this.timelineThumbnailPreview=document.createElement(`div`),this.timelineThumbnailPreview.className=`flux-player-thumbnail-preview flux-hidden`,this.timelineThumbnailImage=document.createElement(`img`),this.timelineThumbnailImage.className=`flux-player-thumbnail-image`,this.timelineThumbnailImage.alt=``,this.timelineThumbnailImage.setAttribute(`aria-hidden`,`true`),this.timelineThumbnailImage.onload=()=>{this.thumbnailVttUrl&&this.timelineThumbnailPreview.classList.remove(`flux-hidden`)},this.timelineThumbnailImage.onerror=()=>{this.hideTimelineThumbnail()},this.timelineThumbnailPreview.appendChild(this.timelineThumbnailImage),this.timeline.appendChild(this.bufferedFill),this.timeline.appendChild(this.progressFill),this.timeline.appendChild(this.timelineThumbnailPreview),e.appendChild(this.timeline);let t=document.createElement(`div`);t.className=`flux-player-toolbar`;let n=document.createElement(`div`);n.className=`flux-player-toolbar-group`,this.playBtn=this.createBtn(`play`,`play`,`Play`),this.muteBtn=this.createBtn(`mute`,`volume`,`Mute`),this.volumeSlider=document.createElement(`input`),this.volumeSlider.type=`range`,this.volumeSlider.min=`0`,this.volumeSlider.max=`1`,this.volumeSlider.step=`0.05`,this.volumeSlider.className=`flux-player-volume-slider`,this.volumeSlider.setAttribute(`role`,`slider`),this.volumeSlider.setAttribute(`aria-label`,`Volume`);let r=document.createElement(`div`);r.className=`flux-player-volume-container`,r.appendChild(this.muteBtn),r.appendChild(this.volumeSlider),this.timeDisplay=document.createElement(`div`),this.timeDisplay.className=`flux-player-time`,this.timeDisplay.innerText=`0:00 / 0:00`,this.timeDisplay.setAttribute(`aria-live`,`polite`),this.timeDisplay.setAttribute(`aria-atomic`,`true`),n.appendChild(this.playBtn),n.appendChild(r),n.appendChild(this.timeDisplay);let i=document.createElement(`div`);i.className=`flux-player-toolbar-group`,this.liveBadge=document.createElement(`div`),this.liveBadge.className=`flux-player-live-badge flux-hidden`,this.liveBadge.innerHTML=`<span></span>LIVE`,this.liveBadge.setAttribute(`aria-live`,`polite`),this.liveBadge.setAttribute(`aria-label`,`Live stream`),this.pipBtn=this.createBtn(`pip`,`pip`,`Picture in Picture`),this.fullscreenBtn=this.createBtn(`fullscreen`,`fullscreen`,`Fullscreen`),this.settingsBtn=this.createBtn(`settings`,`settings`,`Settings`),this.settingsBtn.setAttribute(`aria-haspopup`,`menu`),this.settingsBtn.setAttribute(`aria-expanded`,`false`),i.appendChild(this.liveBadge),this.extraButtons=document.createElement(`div`),this.extraButtons.className=`flux-player-toolbar-group`,i.appendChild(this.extraButtons),i.appendChild(this.pipBtn),i.appendChild(this.settingsBtn),i.appendChild(this.fullscreenBtn),t.appendChild(n),t.appendChild(i),e.appendChild(t),this.settingsMenu=document.createElement(`div`),this.settingsMenu.className=`flux-player-settings-menu flux-hidden`,this.settingsMenu.setAttribute(`role`,`menu`),this.settingsMenu.setAttribute(`aria-label`,`Player settings`),e.appendChild(this.settingsMenu),this.overlay.appendChild(e),this.subtitleDisplay=document.createElement(`div`),this.subtitleDisplay.className=`flux-player-subtitles flux-subs-raised`,this.wrapper.appendChild(this.subtitleDisplay),this.wrapper.appendChild(this.overlay),this.container.appendChild(this.wrapper),this.setToolbar(this.uiConfig.toolbar??{}),C(this.wrapper,`dark`)}setControlsIdle(e){e?(this.overlay.classList.add(`flux-idle`),this.subtitleDisplay.classList.remove(`flux-subs-raised`)):(this.overlay.classList.remove(`flux-idle`),this.subtitleDisplay.classList.add(`flux-subs-raised`))}setIcons(e){this.iconOverrides={...e};for(let[e,{name:t}]of this.renderedIcons)this.renderIcon(e,t)}renderIcon(e,t){let n=this.iconOverrides[t],r=this.renderedIcons.get(e);if(r?.name===t&&r.url===n)return;if(this.renderedIcons.set(e,{name:t,url:n}),!n){e.innerHTML=g[t];return}let i=document.createElement(`img`);i.alt=``,i.draggable=!1,i.onerror=()=>{i.parentElement===e&&(e.innerHTML=g[t])},i.src=n,e.replaceChildren(i)}createBtn(e,t,n){let r=document.createElement(`button`);return r.className=`flux-player-icon-btn flux-btn-${e}`,this.renderIcon(r,t),r.setAttribute(`aria-label`,n),r}formatTime(e){if(isNaN(e))return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n<10?`0`:``}${n}`}bindEvents(){this.cleans.push(this.player.on(`state:change`,e=>this.updateState(e)));let e=e=>{e&&e.stopPropagation(),this.handlePrimaryAction()};this.listen(this.playBtn,`click`,e),this.listen(this.bigPlay,`click`,e),this.listen(this.videoEl,`click`,e),this.listen(this.replayBtn,`click`,()=>this.replay()),this.listen(this.muteBtn,`click`,()=>{this.player.setMuted(!this.player.getState().muted)}),this.listen(this.volumeSlider,`input`,e=>{this.player.setVolume(parseFloat(e.target.value))}),this.updatePipAvailability(),this.setupControlRovingTabindex(),this.listen(this.pipBtn,`click`,async()=>{await this.togglePip()}),this.listen(this.videoEl,`enterpictureinpicture`,()=>{this.pipBtn.classList.add(`flux-active`),this.pipBtn.setAttribute(`aria-label`,`Exit Picture in Picture`)}),this.listen(this.videoEl,`leavepictureinpicture`,()=>{this.pipBtn.classList.remove(`flux-active`),this.pipBtn.setAttribute(`aria-label`,`Picture in Picture`)}),this.listen(this.fullscreenBtn,`click`,()=>{document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.wrapper.requestFullscreen().catch(()=>{})}),this.fullscreenChangeHandler=()=>{let e=document.fullscreenElement===this.wrapper;this.renderIcon(this.fullscreenBtn,e?`fullscreenExit`:`fullscreen`),this.fullscreenBtn.setAttribute(`aria-label`,e?`Exit fullscreen`:`Fullscreen`)},this.listen(document,`fullscreenchange`,this.fullscreenChangeHandler);let t=e=>{let t=this.getTimelineHoverData(e.clientX);if(!t)return;let{position:n,duration:r,targetTime:i}=t;this.progressFill.style.width=`${n*100}%`,this.timeDisplay.innerText=`${this.formatTime(i)} / ${this.formatTime(r)}`,this.renderTimelineThumbnail(e),(this.uiConfig.seekOnDrag&&e.type!==`mouseup`||e.type===`mouseup`||e.type===`click`)&&this.player.seek(i)},n=e=>{this.isDragging&&t(e)},r=e=>{this.isDragging&&(this.isDragging=!1,this.wrapper.classList.remove(`flux-dragging`),t(e),this.renderTimelineThumbnail(e),document.removeEventListener(`mousemove`,n),document.removeEventListener(`mouseup`,r))};this.listen(this.timeline,`mousedown`,e=>{let i=e;this.isDragging=!0,this.wrapper.classList.add(`flux-dragging`),t(i),this.listen(document,`mousemove`,n,!0),this.listen(document,`mouseup`,r,!0)}),this.listen(this.timeline,`click`,e=>{this.isDragging||t(e)}),this.listen(this.timeline,`mousemove`,e=>{this.renderTimelineThumbnail(e)}),this.listen(this.timeline,`mouseenter`,e=>{this.renderTimelineThumbnail(e)}),this.listen(this.timeline,`mouseleave`,()=>{this.hideTimelineThumbnail()}),this.listen(this.timeline,`keydown`,e=>{let t=e;if(t.key===`ArrowLeft`&&(t.preventDefault(),this.player.seek(Math.max(0,this.player.getState().currentTime-5))),t.key===`ArrowRight`){t.preventDefault();let e=this.player.getState().duration,n=Number.isFinite(e)?e:this.player.getState().currentTime+5;this.player.seek(Math.min(n,this.player.getState().currentTime+5))}}),this.listen(this.settingsBtn,`click`,e=>{e.stopPropagation(),this.toggleMenu()}),this.listen(this.wrapper,`click`,()=>{this.menuOpen&&this.toggleMenu(!1)}),this.listen(this.settingsMenu,`click`,e=>e.stopPropagation()),this.listen(this.settingsMenu,`keydown`,e=>this.handleSettingsKeyDown(e)),this.listen(this.wrapper,`keydown`,e=>this.handleControlBarKeyDown(e));let i=()=>{this.setControlsIdle(!1),clearTimeout(this.idleTimeout),!this.player.getState().paused&&!this.menuOpen&&(this.idleTimeout=setTimeout(()=>{this.setControlsIdle(!0)},3e3))};this.listen(this.wrapper,`mousemove`,i),this.listen(this.wrapper,`touchstart`,i);for(let e of Array.from(this.videoEl.textTracks))this.bindSubtitleTrack(e);let o=e=>this.bindSubtitleTrack(e.track);this.videoEl.textTracks.addEventListener?.(`addtrack`,o),this.domCleans.push(()=>this.videoEl.textTracks.removeEventListener?.(`addtrack`,o)),this.listen(this.wrapper,`mouseleave`,()=>{!this.player.getState().paused&&!this.menuOpen&&this.setControlsIdle(!0)})}setToolbar(e){let t=new Set(e.hidden),n={play:this.playBtn,volume:this.volumeSlider.parentElement,settings:this.settingsBtn,pip:this.pipBtn,fullscreen:this.fullscreenBtn};for(let e of Object.keys(n))n[e].classList.toggle(`flux-hidden`,t.has(e));t.has(`settings`)&&this.menuOpen&&this.toggleMenu(!1),this.extraButtons.replaceChildren(...(e.buttons??[]).map(({label:e,onClick:t})=>{let n=document.createElement(`button`);return n.type=`button`,n.className=`flux-player-icon-btn`,n.textContent=e,n.onclick=()=>t(this.player),n})),this.extraButtons.style.display=this.extraButtons.childElementCount?``:`none`,this.setupControlRovingTabindex()}setupControlRovingTabindex(){this.controlElements=[this.playBtn,this.muteBtn,this.volumeSlider,this.timeline,...Array.from(this.extraButtons.querySelectorAll(`button`)),this.settingsBtn,this.pipBtn,this.fullscreenBtn].filter(e=>!e.closest(`.flux-hidden`)&&!e.hasAttribute(`disabled`)),this.controlElements.forEach((e,t)=>{e.tabIndex=t===0?0:-1})}moveControlFocus(e){this.controlElements.length!==0&&(this.controlFocusIndex=(e+this.controlElements.length)%this.controlElements.length,this.controlElements.forEach((e,t)=>{e.tabIndex=t===this.controlFocusIndex?0:-1}),this.controlElements[this.controlFocusIndex].focus())}handleControlBarKeyDown(e){if(this.menuOpen)return;let t=this.controlElements.findIndex(e=>e===document.activeElement);if(t!==-1){if(e.key===`ArrowRight`){e.preventDefault(),this.moveControlFocus(t+1);return}if(e.key===`ArrowLeft`){e.preventDefault(),this.moveControlFocus(t-1);return}if(e.key===`Home`){e.preventDefault(),this.moveControlFocus(0);return}e.key===`End`&&(e.preventDefault(),this.moveControlFocus(this.controlElements.length-1))}}updateMenuA11yState(){this.menuItems=Array.from(this.settingsMenu.querySelectorAll(`.flux-player-menu-item`)),this.menuItems.forEach((e,t)=>{e.setAttribute(`role`,`menuitemradio`),e.setAttribute(`tabindex`,t===this.menuFocusIndex?`0`:`-1`),e.setAttribute(`aria-checked`,e.classList.contains(`flux-active`)?`true`:`false`)})}focusMenuItem(e){this.menuItems.length!==0&&(this.menuFocusIndex=(e+this.menuItems.length)%this.menuItems.length,this.menuItems.forEach((e,t)=>{e.tabIndex=t===this.menuFocusIndex?0:-1}),this.menuItems[this.menuFocusIndex].focus())}handleSettingsKeyDown(e){if(!(!this.menuOpen||this.menuItems.length===0)){if(e.key===`ArrowDown`){e.preventDefault(),this.focusMenuItem(this.menuFocusIndex+1);return}if(e.key===`ArrowUp`){e.preventDefault(),this.focusMenuItem(this.menuFocusIndex-1);return}if(e.key===`Home`){e.preventDefault(),this.focusMenuItem(0);return}if(e.key===`End`){e.preventDefault(),this.focusMenuItem(this.menuItems.length-1);return}if(e.key===`Tab`){e.preventDefault();let t=e.shiftKey?-1:1;this.focusMenuItem(this.menuFocusIndex+t);return}if(e.key===`Escape`){e.preventDefault(),this.toggleMenu(!1),this.settingsBtn.focus();return}(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.menuItems[this.menuFocusIndex]?.click())}}updatePipAvailability(){let e=document,t=this.videoEl,n=!!(e.pictureInPictureEnabled&&this.videoEl.requestPictureInPicture),r=!!t.webkitSupportsPresentationMode?.(`picture-in-picture`);this.pipSupported=n||r,this.pipSupported?(this.pipBtn.removeAttribute(`disabled`),this.pipBtn.removeAttribute(`aria-disabled`),this.pipBtn.removeAttribute(`title`),this.pipBtn.classList.remove(`flux-disabled`)):(this.pipBtn.setAttribute(`disabled`,`true`),this.pipBtn.setAttribute(`aria-disabled`,`true`),this.pipBtn.setAttribute(`title`,`Picture in Picture not supported in this browser`),this.pipBtn.classList.add(`flux-disabled`))}async togglePip(){if(!this.pipSupported)return;let e=document,t=this.videoEl;if(e.pictureInPictureEnabled&&this.videoEl.requestPictureInPicture){if(e.pictureInPictureElement===this.videoEl&&e.exitPictureInPicture){await e.exitPictureInPicture().catch(()=>{});return}await this.videoEl.requestPictureInPicture().catch(()=>{});return}if(t.webkitSupportsPresentationMode?.(`picture-in-picture`)&&t.webkitSetPresentationMode){let e=t.webkitPresentationMode===`picture-in-picture`?`inline`:`picture-in-picture`;try{t.webkitSetPresentationMode(e),this.pipBtn.classList.toggle(`flux-active`,e===`picture-in-picture`)}catch{}}}listen(e,t,n,r=!1){if(e.addEventListener(t,n),this.domCleans.push(()=>{e.removeEventListener(t,n)}),r){let e=this.domCleans[this.domCleans.length-1];this.domCleans[this.domCleans.length-1]=()=>{e()}}}getTimelineHoverData(e){let t=this.timeline.getBoundingClientRect();if(t.width<=0)return null;let n=(e-t.left)/t.width;n=Math.max(0,Math.min(1,n));let r=this.player.getState().duration||0;return{position:n,duration:r,targetTime:n*r}}resolveThumbnailVttUrl(e){let t=typeof this.uiConfig?.thumbnailVtt==`string`?this.uiConfig.thumbnailVtt.trim():``;if(t.length>0)return t;let n=e.source?.thumbnailVtt?.trim()||``;return n.length>0?n:null}async syncThumbnailTrack(e){let t=this.resolveThumbnailVttUrl(e);if(t!==this.thumbnailVttUrl&&(this.thumbnailVttUrl=t,this.thumbnailCues=[],this.hideTimelineThumbnail(),t)){this.thumbnailFetchAbort?.abort(),this.thumbnailFetchAbort=new AbortController;try{let e=await fetch(t,{signal:this.thumbnailFetchAbort.signal});if(!e.ok)throw Error(`Failed to fetch thumbnail VTT: ${e.status}`);let n=await e.text();this.thumbnailCues=this.parseThumbnailVtt(n,t)}catch(e){e.name!==`AbortError`&&console.warn(`[DefaultUI] Unable to load thumbnail VTT`,e),this.thumbnailCues=[]}}}parseThumbnailVtt(e,t){let n=e.split(/\r?\n/),r=[],i=0;for(;i<n.length;){let e=n[i].trim();if(!e||e.toUpperCase()===`WEBVTT`||e.startsWith(`NOTE`)){i+=1;continue}let o=e;if(!o.includes(`-->`)&&i+1<n.length&&(o=n[i+1].trim(),i+=1),!o.includes(`-->`)){i+=1;continue}let[c,l]=o.split(`-->`).map(e=>e.trim()),u=l.split(/\s+/)[0],d=this.parseVttTime(c),f=this.parseVttTime(u);if(!Number.isFinite(d)||!Number.isFinite(f)||f<=d){i+=1;continue}i+=1;let p=[];for(;i<n.length&&n[i].trim()!==``;)p.push(n[i].trim()),i+=1;let m=p.find(e=>this.isThumbnailPayload(e))||``,h=this.parseThumbnailCuePayload(m,t);for(h&&r.push({start:d,end:f,...h});i<n.length&&n[i].trim()===``;)i+=1}return r}parseVttTime(e){let t=e.split(`:`);if(t.length<2||t.length>3)return NaN;let n=Number(t[t.length-1]),r=Number(t[t.length-2]),i=t.length===3?Number(t[0]):0;return!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(n)?NaN:i*3600+r*60+n}parseThumbnailCuePayload(e,t){if(!e)return null;let[n,r=``]=e.split(`#`,2);if(!n)return null;let i=n;try{i=new URL(n,t).toString()}catch{i=n}let o=null,c=null,l=null,u=null,d=r.match(/xywh=(\d+),(\d+),(\d+),(\d+)/i);return d&&(o=Number(d[1]),c=Number(d[2]),l=Number(d[3]),u=Number(d[4])),{imageUrl:i,x:o,y:c,w:l,h:u}}isThumbnailPayload(e){let t=e.trim();return t?/^(https?:\/\/|\/|\.\/|\.\.\/|[^\s]+\.(jpg|jpeg|png|webp|avif|gif|svg))(#xywh=\d+,\d+,\d+,\d+)?(\?.*)?$/i.test(t):!1}findThumbnailCue(e){if(this.thumbnailCues.length===0)return null;for(let t of this.thumbnailCues)if(e>=t.start&&e<t.end)return t;let t=this.thumbnailCues[this.thumbnailCues.length-1];return e>=t.start?t:null}renderTimelineThumbnail(e){if(!this.thumbnailVttUrl||this.thumbnailCues.length===0){this.hideTimelineThumbnail();return}let t=this.player.getState();if(t.isLive||!Number.isFinite(t.duration)||t.duration<=0){this.hideTimelineThumbnail();return}let n=this.getTimelineHoverData(e.clientX);if(!n){this.hideTimelineThumbnail();return}let r=this.findThumbnailCue(n.targetTime);if(!r){this.hideTimelineThumbnail();return}let i=r.x!==null&&r.y!==null&&r.w!==null&&r.h!==null;this.timelineThumbnailImage.style.objectFit=i?`none`:`cover`,i?(this.timelineThumbnailImage.style.objectPosition=`-${r.x}px -${r.y}px`,this.timelineThumbnailImage.style.width=`${r.w}px`,this.timelineThumbnailImage.style.height=`${r.h}px`):(this.timelineThumbnailImage.style.objectPosition=`50% 50%`,this.timelineThumbnailImage.style.width=`160px`,this.timelineThumbnailImage.style.height=`90px`);let o=this.timeline.getBoundingClientRect(),c=this.timelineThumbnailPreview.offsetWidth||160,l=n.position*o.width,u=Math.max(c/2,Math.min(o.width-c/2,l));this.timelineThumbnailPreview.style.left=`${u}px`,this.timelineThumbnailImage.src===r.imageUrl?this.timelineThumbnailImage.complete&&this.timelineThumbnailImage.naturalWidth>0&&this.timelineThumbnailPreview.classList.remove(`flux-hidden`):(this.timelineThumbnailPreview.classList.add(`flux-hidden`),this.timelineThumbnailImage.src=r.imageUrl)}hideTimelineThumbnail(){this.timelineThumbnailPreview.classList.add(`flux-hidden`)}bindSubtitleTrack(e){if(this.subtitleTrackListeners.has(e))return;let t=()=>{e.mode===`showing`&&(e.mode=`hidden`),this.renderSubtitleCues()};e.addEventListener(`cuechange`,t),this.subtitleTrackListeners.set(e,t),this.domCleans.push(()=>{e.removeEventListener(`cuechange`,t),this.subtitleTrackListeners.delete(e)})}renderSubtitleCues(){let e=[];for(let t=0;t<this.videoEl.textTracks.length;t++){let n=this.videoEl.textTracks[t];if(!(n.mode===`disabled`||!n.activeCues))for(let t=0;t<n.activeCues.length;t++){let r=(n.activeCues[t].text??``).trim().replace(/<[^>]+>/g,``).trim();r&&e.push(r)}}if(e.length===0){this.subtitleDisplay.innerHTML=``;return}this.subtitleDisplay.innerHTML=e.map(e=>`<span class="flux-player-subtitle-text">${this.htmlEscape(e)}</span>`).join(`<br>`)}htmlEscape(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}handlePrimaryAction(){let e=this.player.getState();if(e.ended){this.replay();return}if(e.paused){this.player.play().catch(e=>{console.error(`[DefaultUI] Play failed:`,e)});return}this.player.pause()}replay(){this.player.seek(0),this.player.play().catch(e=>{console.error(`[DefaultUI] Replay failed:`,e)})}updateState(e){this.resetUiForSourceChange(e);let t=e.source?.adBreakTimes||[],n=t.join(`,`)+`/`+e.duration;if(n!==this.markerSignature){this.markerSignature=n,this.timeline.querySelectorAll(`.flux-ad-marker`).forEach(e=>e.remove());for(let n of t){if(!Number.isFinite(e.duration)||n>=e.duration)continue;let t=document.createElement(`span`);t.className=`flux-ad-marker`,t.title=n===0?`Pre-roll ad`:`Ad at `+this.formatTime(n),t.style.cssText=`position:absolute;top:-2px;height:8px;width:4px;border-radius:1px;background:#ffd45e;z-index:2`,t.style.left=100*n/e.duration+`%`,this.timeline.append(t)}}e.selectedSubtitle===null&&!e.availableSubtitles.some(e=>e.selected)&&this.subtitleDisplay.replaceChildren(),this.syncThumbnailTrack(e).catch(e=>{console.warn(`[DefaultUI] Thumbnail sync failed`,e)});let r=e.ended&&!e.error?`replay`:e.paused?`play`:`pause`;this.renderIcon(this.playBtn,r);let i=r===`replay`?`Replay`:e.paused?`Play`:`Pause`;this.playBtn.ariaLabel!==i&&(this.playBtn.ariaLabel=i),e.paused?this.uiPaused||(this.uiPaused=!0,!e.error&&!e.ended&&this.bigPlay.classList.remove(`flux-hidden`),this.setControlsIdle(!1),clearTimeout(this.idleTimeout)):this.uiPaused&&(this.uiPaused=!1,this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.add(`flux-hidden`),this.setControlsIdle(!1),clearTimeout(this.idleTimeout),this.menuOpen||(this.idleTimeout=setTimeout(()=>{this.setControlsIdle(!0)},3e3))),e.buffering?this.spinner.classList.remove(`flux-hidden`):this.spinner.classList.add(`flux-hidden`),e.error?(this.errorPanel.classList.remove(`flux-hidden`),this.errorTextEl.innerText=e.error.message,this.spinner.classList.add(`flux-hidden`),this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.add(`flux-hidden`)):this.errorPanel.classList.add(`flux-hidden`),e.ended&&!e.error?(this.bigPlay.classList.add(`flux-hidden`),this.replayBtn.classList.remove(`flux-hidden`),this.setControlsIdle(!1)):this.replayBtn.classList.add(`flux-hidden`),e.isLive?(this.liveBadge.classList.remove(`flux-hidden`),this.timeline.classList.add(`flux-disabled`),this.timeDisplay.classList.add(`flux-hidden`)):(this.liveBadge.classList.add(`flux-hidden`),this.timeline.classList.remove(`flux-disabled`),this.timeDisplay.classList.remove(`flux-hidden`));let o=e.duration||0;if(!this.isDragging&&(this.timeDisplay.innerText=`${this.formatTime(e.currentTime)} / ${this.formatTime(o)}`,this.timeDisplay.setAttribute(`aria-label`,e.isLive?`Live stream, current position ${this.formatTime(e.currentTime)}`:`Current time ${this.formatTime(e.currentTime)} of ${this.formatTime(o)}`),this.timeline.setAttribute(`aria-valuemin`,`0`),this.timeline.setAttribute(`aria-valuenow`,String(Math.round(e.currentTime))),this.timeline.setAttribute(`aria-valuemax`,String(Number.isFinite(o)?Math.round(o):0)),this.timeline.setAttribute(`aria-valuetext`,`${this.formatTime(e.currentTime)} of ${this.formatTime(o)}`),o>0))if(this.progressFill.style.width=`${e.currentTime/o*100}%`,e.buffered.length>0){let t=e.buffered[e.buffered.length-1];this.bufferedFill.style.width=`${t.end/o*100}%`}else this.bufferedFill.style.width=`0%`;let c=e.muted?`Unmute`:`Mute`;this.muteBtn.ariaLabel!==c&&(this.muteBtn.ariaLabel=c),e.muted||e.volume===0?(this.renderIcon(this.muteBtn,`mute`),this.volumeSlider.value=`0`):(this.renderIcon(this.muteBtn,`volume`),this.volumeSlider.value=String(e.volume))}toggleMenu(e){this.menuOpen=typeof e==`boolean`?e:!this.menuOpen,this.menuOpen?(this.renderMenu(),this.settingsMenu.classList.remove(`flux-hidden`),this.settingsBtn.setAttribute(`aria-expanded`,`true`),this.menuFocusIndex=0,this.updateMenuA11yState(),this.focusMenuItem(this.menuFocusIndex),clearTimeout(this.idleTimeout)):(this.settingsMenu.classList.add(`flux-hidden`),this.settingsBtn.setAttribute(`aria-expanded`,`false`),this.wrapper.dispatchEvent(new Event(`mousemove`)))}renderMenu(){let e=this.player.getState();this.settingsMenu.innerHTML=``;let t=e.selectedSubtitle??e.availableSubtitles.find(e=>e.selected)?.id??null;this.addMenuSection(`Quality`,e.availableQualities.map(t=>({id:String(t.id),label:t.label,active:e.selectedQuality===t.id,onClick:()=>this.player.setQuality(t.id)})).concat(e.availableQualities.length>0?[{id:`auto`,label:`Auto`,active:e.selectedQuality===`auto`,onClick:()=>this.player.setQuality(`auto`)}]:[])),this.addMenuSection(`Audio`,e.availableAudioTracks.map(e=>({id:e.id,label:e.label,active:e.selected,onClick:()=>this.player.setAudioTrack(e.id)}))),this.addMenuSection(`Captions`,e.availableSubtitles.map(e=>({id:e.id,label:e.label,active:t===e.id,onClick:()=>this.player.setSubtitle(e.id)})).concat(e.availableSubtitles.length>0?[{id:`off`,label:`Off`,active:t===null,onClick:()=>this.player.setSubtitle(null)}]:[]));let n=[.5,.75,1,1.25,1.5,2].map(t=>({id:String(t),label:t===1?`Normal (1x)`:`${t}x`,active:e.playbackRate===t,onClick:()=>this.player.setPlaybackRate(t)}));this.addMenuSection(`Speed`,n),this.updateMenuA11yState()}addMenuSection(e,t){let n=document.createElement(`div`);n.className=`flux-player-menu-section`;let r=document.createElement(`div`);if(r.className=`flux-player-menu-header`,r.innerText=e,n.appendChild(r),t.length===0){let e=document.createElement(`div`);e.className=`flux-player-menu-placeholder`,e.innerText=`Not available`,n.appendChild(e)}else t.forEach(e=>{let t=document.createElement(`div`);t.className=`flux-player-menu-item ${e.active?`flux-active`:``}`,t.innerText=e.label,t.setAttribute(`role`,`menuitemradio`),t.setAttribute(`aria-checked`,e.active?`true`:`false`),t.tabIndex=-1,t.addEventListener(`click`,()=>{e.onClick(),this.toggleMenu(!1)}),n.appendChild(t)});this.settingsMenu.appendChild(n)}destroy(){this.renderedIcons.clear(),this.thumbnailFetchAbort?.abort(),this.cleans.forEach(e=>e()),this.domCleans.forEach(e=>e()),this.domCleans=[],clearTimeout(this.idleTimeout),this.container.innerHTML=``}},T=class{player;adapter;cleans=[];loadStartedAt=null;playbackStartedAt=null;rebufferStartedAt=null;totalRebufferMs=0;rebufferCount=0;sessionStartedAt=Date.now();manifestLoadedAt=null;firstFrameAt=null;trace=[];bitrateTimeline=[];constructor(e,t){this.player=e,this.adapter=t||((e,t)=>console.log(`[Analytics] ${e}`,t)),this.bind()}bind(){this.emit(`player.created`,`lifecycle`,{}),[`source_loading`,`source_loaded`,`playback_requested`,`playback_started`,`seek_start`,`seek_complete`,`error`].forEach(e=>{this.cleans.push(this.player.on(e,t=>{e===`source_loading`&&(this.loadStartedAt=Date.now(),this.playbackStartedAt=null,this.manifestLoadedAt=null,this.firstFrameAt=null,this.rebufferCount=0,this.totalRebufferMs=0),e===`source_loaded`&&(this.manifestLoadedAt=Date.now(),this.emit(`qoe.startup.manifest_loaded`,`qoe`,{manifestLoadMs:this.loadStartedAt?this.manifestLoadedAt-this.loadStartedAt:null})),e===`playback_started`&&this.playbackStartedAt===null&&(this.playbackStartedAt=Date.now(),this.firstFrameAt=this.playbackStartedAt,this.emit(`qoe.startup.first_frame`,`qoe`,{firstFrameMs:this.loadStartedAt?this.firstFrameAt-this.loadStartedAt:null,manifestLoadMs:this.loadStartedAt&&this.manifestLoadedAt?this.manifestLoadedAt-this.loadStartedAt:null,postManifestToFirstFrameMs:this.firstFrameAt&&this.manifestLoadedAt?this.firstFrameAt-this.manifestLoadedAt:null})),this.emit(this.normalizeEventName(e),this.categoryForEvent(e),this.withQoe(t))}))}),this.cleans.push(this.player.on(`state:paused`,e=>{e&&this.emit(`playback.pause`,`playback`,this.withQoe({currentTime:this.player.getState().currentTime}))})),this.cleans.push(this.player.on(`state:buffered`,e=>{this.player.getState().readyState===2&&this.rebufferStartedAt===null&&(this.rebufferStartedAt=Date.now(),this.rebufferCount+=1,this.emit(`playback.buffering_start`,`qoe`,this.withQoe({currentTime:this.player.getState().currentTime,rebufferCount:this.rebufferCount,sinceStartMs:Date.now()-this.sessionStartedAt})))})),this.cleans.push(this.player.on(`state:readyState`,e=>{if(e===4&&this.rebufferStartedAt!==null){let e=Date.now()-this.rebufferStartedAt;this.totalRebufferMs+=e,this.rebufferStartedAt=null,this.emit(`playback.buffering_end`,`qoe`,this.withQoe({currentTime:this.player.getState().currentTime,rebufferMs:e,rebufferCount:this.rebufferCount,totalRebufferMs:this.totalRebufferMs,sinceStartMs:Date.now()-this.sessionStartedAt}))}})),this.cleans.push(this.player.on(`state:selectedQuality`,e=>{let t=this.player.getState().availableQualities.find(e=>e.selected);this.bitrateTimeline.push({at:Date.now(),bitrate:t?.bitrate||null,quality:e}),this.emit(`track.quality_changed`,`track`,this.withQoe({quality:e}))})),this.cleans.push(this.player.on(`state:selectedSubtitle`,e=>this.emit(`track.subtitle_changed`,`track`,this.withQoe({subtitle:e})))),this.cleans.push(this.player.on(`state:selectedAudioTrack`,e=>this.emit(`track.audio_changed`,`track`,this.withQoe({audioTrack:e})))),this.cleans.push(this.player.on(`state:volume`,e=>this.emit(`playback.volume_changed`,`playback`,this.withQoe({volume:e})))),this.cleans.push(this.player.on(`state:muted`,e=>this.emit(`playback.muted_changed`,`playback`,this.withQoe({muted:e})))),this.cleans.push(this.player.on(`state:playbackRate`,e=>this.emit(`playback.rate_changed`,`playback`,this.withQoe({rate:e})))),this.cleans.push(this.player.on(`error`,e=>{let t=e?.error||e;this.emit(`error.classified`,`error`,{classification:this.classifyError(t),code:t?.code,message:t?.message})}))}getSessionTrace(){return this.trace.map(e=>({...e,payload:JSON.parse(JSON.stringify(e.payload??null))}))}normalizeEventName(e){return{source_loading:`source.loading`,source_loaded:`source.loaded`,playback_requested:`playback.requested`,playback_started:`playback.started`,seek_start:`playback.seek_start`,seek_complete:`playback.seek_complete`,error:`playback.error`}[e]||e}withQoe(e){let t=this.player.getState().availableQualities.find(e=>e.selected),n=this.player.getVideoPlaybackQuality?.()||void 0;return{...e,qoe:{startupTimeMs:this.loadStartedAt&&this.playbackStartedAt?this.playbackStartedAt-this.loadStartedAt:null,manifestLoadMs:this.loadStartedAt&&this.manifestLoadedAt?this.manifestLoadedAt-this.loadStartedAt:null,firstFrameMs:this.loadStartedAt&&this.firstFrameAt?this.firstFrameAt-this.loadStartedAt:null,rebufferCount:this.rebufferCount,totalRebufferMs:this.totalRebufferMs,bitrate:t?.bitrate||null,droppedFrames:n?.droppedVideoFrames??null,bitrateTimeline:this.bitrateTimeline.slice(-20)}}}emit(e,t,n){let r=Date.now(),i={at:r,sinceStartMs:r-this.sessionStartedAt,event:e,category:t,payload:n};this.trace.push(i),this.trace.length>500&&this.trace.shift(),this.adapter(e,n)}classifyError(e){let t=String(e?.code||``).toLowerCase(),n=String(e?.message||``).toLowerCase();return t.includes(`network`)||n.includes(`network`)||n.includes(`manifest`)||n.includes(`segment`)?`network`:t.includes(`media`)||n.includes(`decode`)||n.includes(`demux`)?`decode`:t.includes(`drm`)||n.includes(`drm`)||n.includes(`key system`)||n.includes(`license`)?`drm`:`unknown`}categoryForEvent(e){return e===`error`?`error`:e.startsWith(`seek`)||e.startsWith(`playback`)?`playback`:e.startsWith(`source`)?`lifecycle`:`qoe`}destroy(){this.cleans.forEach(e=>e())}},E=class{player;mountEl;panel=null;bodyEl=null;visible=!0;events=[];cleans=[];constructor(e,t){this.player=e,this.mountEl=t||document.body,this.inject(),this.bind()}inject(){this.panel=document.createElement(`div`),this.panel.className=`flux-devtools-overlay`,this.panel.style.position=this.mountEl===document.body?`fixed`:`absolute`,this.panel.style.top=`10px`,this.panel.style.right=`10px`,this.panel.style.backgroundColor=`rgba(0,0,0,0.85)`,this.panel.style.color=`#0f0`,this.panel.style.padding=`10px`,this.panel.style.fontFamily=`monospace`,this.panel.style.fontSize=`12px`,this.panel.style.zIndex=`9999`,this.panel.style.width=`320px`,this.panel.style.maxHeight=`280px`,this.panel.style.overflow=`auto`,this.panel.style.borderRadius=`8px`,this.panel.style.pointerEvents=`auto`,this.bodyEl=document.createElement(`pre`),this.bodyEl.style.margin=`0`,this.bodyEl.style.whiteSpace=`pre-wrap`,this.panel.appendChild(this.bodyEl),this.mountEl.appendChild(this.panel)}bind(){[`source_loading`,`source_loaded`,`playback_requested`,`playback_started`,`seek_start`,`seek_complete`,`error`,`state:change`].forEach(e=>{this.cleans.push(this.player.on(e,t=>{this.events.unshift({name:e,payload:t,ts:Date.now()}),this.events.length>25&&(this.events.length=25),this.render()}))}),this.render()}render(){if(!this.bodyEl||!this.visible)return;let e=this.player.getState(),t=this.events.slice(0,8).map(e=>`${new Date(e.ts).toLocaleTimeString()} ${e.name}`).join(`
2
2
  `),n=[`Engine: ${e.engineType||`none`}`,`Status: ${e.status}`,`Time: ${e.currentTime.toFixed(2)} / ${Number.isFinite(e.duration)?e.duration.toFixed(2):`live`}`,`Buffered: ${e.buffered.map(e=>`[${e.start.toFixed(1)}-${e.end.toFixed(1)}]`).join(`, `)||`none`}`,`Quality: ${e.selectedQuality}`,`Subtitles: ${e.selectedSubtitle||`none`}`,`Audio: ${e.selectedAudioTrack}`,`Bitrate: ${e.availableQualities.find(e=>e.selected)?.bitrate||`n/a`}`,`Error: ${e.error?`${e.error.code} ${e.error.message}`:`none`}`,``,`Recent Events:`,t||`none`].join(`
3
3
  `);this.bodyEl.innerText=n}setVisible(e){this.visible=e,this.panel&&(this.panel.style.display=e?`block`:`none`),e&&this.render()}isVisible(){return this.visible}destroy(){this.cleans.forEach(e=>e()),this.cleans=[],this.panel&&=(this.panel.remove(),null),this.bodyEl=null}},D=()=>Date.now(),O=class{startedAt=D();waitingStartedAt=null;startupStallStartedAt=null;awaitingFirstFrameAfterPlay=!1;seenTelemetry=new Set;startup=this.createStartup(this.startedAt);sessionTrace=[];createStartup(e){return{playerCreatedAt:e,sourceLoadRequestedAt:null,manifestRequestStartedAt:null,manifestReceivedAt:null,manifestParseStartedAt:null,manifestParseCompletedAt:null,firstSegmentRequestStartedAt:null,firstSegmentReceivedAt:null,firstAppendCompletedAt:null,playCalledAt:null,firstFrameAt:null,startupCompletedAt:null,startupDurationMs:null,sourceLoadToFirstFrameMs:null,playToFirstFrameMs:null,manifestToFirstFrameMs:null,totalRebufferCount:0,totalRebufferDurationMs:0,startupStallCount:0,startupStallMs:0,retryEvents:0,errorEvents:0,bitrateOverTime:[]}}resetForNewSource(){this.startedAt=D(),this.waitingStartedAt=null,this.startupStallStartedAt=null,this.awaitingFirstFrameAfterPlay=!1,this.seenTelemetry.clear(),this.startup=this.createStartup(this.startedAt),this.sessionTrace=[]}mark(e,t=D()){this.startup[e]===null&&(this.startup[e]=t)}onSourceLoadRequested(){this.mark(`sourceLoadRequestedAt`),this.pushTrace(`source_load_requested`,`lifecycle`,void 0)}onPlayCalled(){this.startup.playCalledAt===null&&(this.mark(`playCalledAt`),this.awaitingFirstFrameAfterPlay=!0,this.pushTrace(`play_called`,`playback`,void 0))}onFirstFrame(){this.awaitingFirstFrameAfterPlay&&this.startup.firstFrameAt===null&&(this.mark(`firstFrameAt`),this.startup.playCalledAt!==null&&this.startup.firstFrameAt!==null&&this.startup.startupCompletedAt===null&&this.finalizeStartup(this.startup.firstFrameAt))}finalizeStartup(e){if(this.startup.startupCompletedAt!==null)return;this.startup.startupCompletedAt=e;let t=this.startup.playCalledAt;if(t!==null){if(e<t)return;this.startup.startupDurationMs=e-t}else{let t=this.startup.sourceLoadRequestedAt??this.startedAt;if(e<t)return;this.startup.startupDurationMs=e-t}this.awaitingFirstFrameAfterPlay=!1,this.pushTrace(`startup_completed`,`lifecycle`,{startupDurationMs:this.startup.startupDurationMs})}onWaiting(){if(this.waitingStartedAt!==null||this.startupStallStartedAt!==null)return;let e=D();this.startup.firstFrameAt===null?(this.startupStallStartedAt=e,this.startup.startupStallCount+=1,this.pushTrace(`startup_stall_start`,`qoe`,{startupStallCount:this.startup.startupStallCount})):(this.waitingStartedAt=e,this.startup.totalRebufferCount+=1,this.pushTrace(`rebuffer_start`,`qoe`,{totalRebufferCount:this.startup.totalRebufferCount}))}onPlaying(){if(this.startupStallStartedAt!==null&&(this.startup.startupStallMs+=D()-this.startupStallStartedAt,this.startupStallStartedAt=null,this.pushTrace(`startup_stall_end`,`qoe`,{startupStallMs:this.startup.startupStallMs})),this.waitingStartedAt!==null){let e=D()-this.waitingStartedAt;this.startup.totalRebufferDurationMs+=e,this.waitingStartedAt=null,this.pushTrace(`rebuffer_end`,`qoe`,{totalRebufferDurationMs:this.startup.totalRebufferDurationMs})}}onTelemetry(e,t=D(),n){let r={manifest_request_started:`manifestRequestStartedAt`,manifest_received:`manifestReceivedAt`,manifest_parse_started:`manifestParseStartedAt`,manifest_parse_completed:`manifestParseCompletedAt`,first_segment_request_started:`firstSegmentRequestStartedAt`,first_segment_received:`firstSegmentReceivedAt`,first_append_completed:`firstAppendCompletedAt`}[e];r&&!this.seenTelemetry.has(e)&&(this.seenTelemetry.add(e),this.mark(r,t)),typeof n?.bitrate==`number`&&Number.isFinite(n.bitrate)&&this.startup.bitrateOverTime.push({at:t,bitrate:n.bitrate}),e.toLowerCase().includes(`retry`)&&(this.startup.retryEvents+=1),this.pushTrace(e,`lifecycle`,n)}onError(e){this.startup.errorEvents+=1,this.pushTrace(`error`,`error`,e)}getStartupMetrics(){let e=this.startup,t=(e,t)=>e!==null&&t!==null?e-t:null;return{...e,sourceLoadToFirstFrameMs:t(e.firstFrameAt,e.sourceLoadRequestedAt),playToFirstFrameMs:t(e.firstFrameAt,e.playCalledAt),manifestToFirstFrameMs:t(e.firstFrameAt,e.manifestReceivedAt),startupStallCount:e.startupStallCount,startupStallMs:e.startupStallMs,bitrateOverTime:[...e.bitrateOverTime]}}getSessionTrace(){return[...this.sessionTrace]}printStartupReport(){let e=this.getStartupMetrics(),t=e=>e===null?`n/a`:`${Math.round(e)}ms`,n=t=>t===null?null:t-e.playerCreatedAt;console.group(`[Flux] Startup Report`),console.table({startupDuration:t(e.startupDurationMs),manifestRequestToReceived:t(e.manifestRequestStartedAt&&e.manifestReceivedAt?e.manifestReceivedAt-e.manifestRequestStartedAt:null),parseDuration:t(e.manifestParseStartedAt&&e.manifestParseCompletedAt?e.manifestParseCompletedAt-e.manifestParseStartedAt:null),firstSegmentNetwork:t(e.firstSegmentRequestStartedAt&&e.firstSegmentReceivedAt?e.firstSegmentReceivedAt-e.firstSegmentRequestStartedAt:null),firstAppendToFrame:t(e.firstAppendCompletedAt&&e.firstFrameAt?e.firstFrameAt-e.firstAppendCompletedAt:null),rebufferCount:e.totalRebufferCount,rebufferDuration:t(e.totalRebufferDurationMs),retryEvents:e.retryEvents,errorEvents:e.errorEvents}),console.log(`Timeline (ms from player create):`,{sourceLoadRequested:n(e.sourceLoadRequestedAt),manifestRequestStarted:n(e.manifestRequestStartedAt),manifestReceived:n(e.manifestReceivedAt),manifestParseStarted:n(e.manifestParseStartedAt),manifestParseCompleted:n(e.manifestParseCompletedAt),firstSegmentRequestStarted:n(e.firstSegmentRequestStartedAt),firstSegmentReceived:n(e.firstSegmentReceivedAt),firstAppendCompleted:n(e.firstAppendCompletedAt),playCalled:n(e.playCalledAt),firstFrame:n(e.firstFrameAt),startupCompleted:n(e.startupCompletedAt)}),console.groupEnd()}pushTrace(e,t,n){let r=D();this.sessionTrace.push({at:r,sinceStartMs:r-this.startedAt,event:e,category:t,payload:n})}},k=r({AbrController:()=>as,AttrList:()=>Os,AudioStreamController:()=>Uc,AudioTrackController:()=>Gc,BasePlaylistController:()=>Wc,BaseSegment:()=>zo,BaseStreamController:()=>Ks,BufferController:()=>Xc,CMCDController:()=>Fl,CapLevelController:()=>Zc,ChunkMetadata:()=>Ss,ContentSteeringController:()=>Ll,Cues:()=>Nu,DateRange:()=>As,EMEController:()=>Rl,ErrorActionFlags:()=>cs,ErrorController:()=>ls,ErrorDetails:()=>Z,ErrorTypes:()=>wo,Events:()=>Q,FPSController:()=>Bl,FetchLoader:()=>Fu,Fragment:()=>Bo,Hls:()=>ed,HlsSkip:()=>es,HlsUrlParameters:()=>ts,KeySystemFormats:()=>Fs,KeySystems:()=>Ps,Level:()=>ns,LevelDetails:()=>Ms,LevelKey:()=>Rs,LoadStats:()=>Lo,M3U8Parser:()=>Ws,MetadataSchema:()=>tc,NetworkErrorAction:()=>ss,Part:()=>Vo,PlaylistLevelType:()=>Eo,SubtitleStreamController:()=>Zl,SubtitleTrackController:()=>Vl,TimelineController:()=>ju,XhrLoader:()=>Ru,default:()=>ed,fetchSupported:()=>$a,getMediaSource:()=>B,isMSESupported:()=>go,isSupported:()=>_o,requestMediaKeySystemAccess:()=>Is});function A(e,t,n){return(t=F(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){return j=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},j.apply(null,arguments)}function M(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 N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?M(Object(n),!0).forEach(function(t){A(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function P(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 F(e){var t=P(e,`string`);return typeof t==`symbol`?t:t+``}function I(){return j({},jo)}function L(e,t){let n=self.console[e];return n?n.bind(self.console,`${t?`[`+t+`] `:``}[${e}] >`):Ao}function R(e,t,n){return t[e]?t[e].bind(t):L(e,n)}function z(e,t,n){let r=I();if(typeof console==`object`&&e===!0||typeof e==`object`){let i=[`debug`,`log`,`info`,`warn`,`error`];i.forEach(t=>{r[t]=R(t,e,n)});try{r.log(`Debug logs enabled for "${t}" in hls.js version 1.6.15`)}catch{return I()}i.forEach(t=>{Mo[t]=R(t,e)})}else j(Mo,r);return r}function B(e=!0){if(!(typeof self>`u`))return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function V(e){return typeof self<`u`&&e===self.ManagedMediaSource}function H(e,t){let n=Object.keys(e),r=Object.keys(t),i=n.length,o=r.length;return!i||!o||i===o&&!n.some(e=>r.indexOf(e)===-1)}function U(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,o,c=``,l=0;for(;l<n;){if(r=e[l++],r===0&&t)return c;if(!(r===0||r===3))switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(r);break;case 12:case 13:i=e[l++],c+=String.fromCharCode((r&31)<<6|i&63);break;case 14:i=e[l++],o=e[l++],c+=String.fromCharCode((r&15)<<12|(i&63)<<6|(o&63)<<0);break}}return c}function W(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 G(e){return Uint8Array.from(e.replace(/^0x/,``).replace(/([\da-fA-F]{2}) ?/g,`0x$1 `).replace(/ +$/,``).split(` `)).buffer}function K(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function ee(){return Fo?Po.exports:(Fo=1,(function(e,t){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,c={buildAbsoluteURL:function(e,t,n){if(n||={},e=e.trim(),t=t.trim(),!t){if(!n.alwaysNormalize)return e;var i=c.parseURL(e);if(!i)throw Error(`Error trying to parse base URL.`);return i.path=c.normalizePath(i.path),c.buildURLFromParts(i)}var o=c.parseURL(t);if(!o)throw Error(`Error trying to parse relative URL.`);if(o.scheme)return n.alwaysNormalize?(o.path=c.normalizePath(o.path),c.buildURLFromParts(o)):t;var l=c.parseURL(e);if(!l)throw Error(`Error trying to parse base URL.`);if(!l.netLoc&&l.path&&l.path[0]!==`/`){var u=r.exec(l.path);l.netLoc=u[1],l.path=u[2]}l.netLoc&&!l.path&&(l.path=`/`);var d={scheme:l.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(d.netLoc=l.netLoc,o.path[0]!==`/`))if(!o.path)d.path=l.path,o.params||(d.params=l.params,o.query||(d.query=l.query));else{var f=l.path,p=f.substring(0,f.lastIndexOf(`/`)+1)+o.path;d.path=c.normalizePath(p)}return d.path===null&&(d.path=n.alwaysNormalize?c.normalizePath(o.path):o.path),c.buildURLFromParts(d)},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(o,``)).length;);return e.split(``).reverse().join(``)},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=c})()})(Po),Po.exports)}function q(e){return e.sn!==`initSegment`}function te(e,t){let n=Object.getPrototypeOf(e);if(n)return Object.getOwnPropertyDescriptor(n,t)||te(n,t)}function ne(e,t){let n=te(e,t);n&&(n.enumerable=!0,Object.defineProperty(e,t,n))}function re(e){return String.fromCharCode.apply(null,e)}function ie(e,t){let n=e[t]<<8|e[t+1];return n<0?65536+n:n}function J(e,t){let n=oe(e,t);return n<0?4294967296+n:n}function ae(e,t){let n=J(e,t);return n*=2**32,n+=J(e,t+4),n}function oe(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function se(e){let t=e.byteLength;for(let n=0;n<t;){let r=J(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 ce(e,t){let n=[];if(!t.length)return n;let r=e.byteLength;for(let i=0;i<r;){let o=J(e,i),c=re(e.subarray(i+4,i+8)),l=o>1?i+o:r;if(c===t[0])if(t.length===1)n.push(e.subarray(i+8,l));else{let r=ce(e.subarray(i+8,l),t.slice(1));r.length&&Uo.apply(n,r)}i=l}return n}function le(e){let t=[],n=e[0],r=8,i=J(e,r);r+=4;let o=0,c=0;n===0?(o=J(e,r),c=J(e,r+4),r+=8):(o=ae(e,r),c=ae(e,r+8),r+=16),r+=2;let l=e.length+c,u=ie(e,r);r+=2;for(let n=0;n<u;n++){let n=r,o=J(e,n);n+=4;let c=o&2147483647;if((o&2147483648)>>>31==1)return No.warn(`SIDX has hierarchical references (not supported)`),null;let u=J(e,n);n+=4,t.push({referenceSize:c,subsegmentDuration:u,info:{duration:u/i,start:l,end:l+c-1}}),l+=c,n+=4,r=n}return{earliestPresentationTime:o,timescale:i,version:n,referencesCount:u,references:t}}function ue(e){let t=[],n=ce(e,[`moov`,`trak`]);for(let e=0;e<n.length;e++){let r=n[e],i=ce(r,[`tkhd`])[0];if(i){let e=i[0],n=J(i,e===0?12:20),o=ce(r,[`mdia`,`mdhd`])[0];if(o){e=o[0];let i=J(o,e===0?12:20),c=ce(r,[`mdia`,`hdlr`])[0];if(c){let e=re(c.subarray(8,12)),o={soun:Ro.AUDIO,vide:Ro.VIDEO}[e],l=ce(r,[`mdia`,`minf`,`stbl`,`stsd`])[0],u=de(l);o?(t[n]={timescale:i,type:o,stsd:u},t[o]=N({timescale:i,id:n},u)):t[n]={timescale:i,type:e,stsd:u}}}}}return ce(e,[`moov`,`mvex`,`trex`]).forEach(e=>{let n=t[J(e,4)];n&&(n.default={duration:J(e,12),flags:J(e,20)})}),t}function de(e){let t=e.subarray(8),n=t.subarray(86),r=re(t.subarray(4,8)),i=r,o,c=r===`enca`||r===`encv`;c&&ce(ce(t,[r])[0].subarray(r===`enca`?28:78),[`sinf`]).forEach(e=>{let t=ce(e,[`schm`])[0];if(t){let n=re(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=ce(e,[`frma`])[0];t&&(i=re(t))}}});let l=i;switch(i){case`avc1`:case`avc2`:case`avc3`:case`avc4`:{let e=ce(n,[`avcC`])[0];e&&e.length>3&&(i+=`.`+he(e[1])+he(e[2])+he(e[3]),o=fe(l===`avc1`?`dva1`:`dvav`,n));break}case`mp4a`:{let e=ce(t,[r])[0],n=ce(e.subarray(28),[`esds`])[0];if(n&&n.length>7){let e=4;if(n[e++]!==3)break;e=me(n,e),e+=2;let t=n[e++];if(t&128&&(e+=2),t&64&&(e+=n[e++]),n[e++]!==4)break;e=me(n,e);let r=n[e++];if(r===64)i+=`.`+he(r);else break;if(e+=12,n[e++]!==5)break;e=me(n,e);let o=n[e++],c=(o&248)>>3;c===31&&(c+=1+((o&7)<<3)+((n[e]&224)>>5)),i+=`.`+c}break}case`hvc1`:case`hev1`:{let e=ce(n,[`hvcC`])[0];if(e&&e.length>12){let t=e[1],n=[``,`A`,`B`,`C`][t>>6],r=t&31,o=J(e,2),c=(t&32)>>5?`H`:`L`,l=e[12],u=e.subarray(6,12);i+=`.`+n+r,i+=`.`+pe(o).toString(16).toUpperCase(),i+=`.`+c+l;let d=``;for(let e=u.length;e--;){let t=u[e];(t||d)&&(d=`.`+t.toString(16).toUpperCase()+d)}i+=d}o=fe(l==`hev1`?`dvhe`:`dvh1`,n);break}case`dvh1`:case`dvhe`:case`dvav`:case`dva1`:case`dav1`:i=fe(i,n)||i;break;case`vp09`:{let e=ce(n,[`vpcC`])[0];if(e&&e.length>6){let t=e[4],n=e[5],r=e[6]>>4&15;i+=`.`+ge(t)+`.`+ge(n)+`.`+ge(r)}break}case`av01`:{let e=ce(n,[`av1C`])[0];if(e&&e.length>2){let t=e[1]>>>5,r=e[1]&31,c=e[2]>>>7?`H`:`M`,l=(e[2]&64)>>6,u=(e[2]&32)>>5,d=t===2&&l?u?12:10:l?10:8,f=(e[2]&16)>>4,p=(e[2]&8)>>3,m=(e[2]&4)>>2,h=e[2]&3;i+=`.`+t+`.`+ge(r)+c+`.`+ge(d)+`.`+f+`.`+p+m+h+`.`+ge(1)+`.`+ge(1)+`.`+ge(1)+`.0`,o=fe(`dav1`,n)}break}}return{codec:i,encrypted:c,supplemental:o}}function fe(e,t){let n=ce(t,[`dvvC`]),r=n.length?n[0]:ce(t,[`dvcC`])[0];if(r){let t=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+`.`+ge(t)+`.`+ge(n)}}function pe(e){let t=0;for(let n=0;n<32;n++)t|=(e>>n&1)<<31-n;return t>>>0}function me(e,t){let n=t+5;for(;e[t++]&128&&t<n;);return t}function he(e){return(`0`+e.toString(16).toUpperCase()).slice(-2)}function ge(e){return(e<10?`0`:``)+e}function _e(e,t){if(!e||!t)return;let n=t.keyId;n&&t.isCommonEncryption&&ye(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>e!==0)||(No.log(`[eme] Patching keyId in 'enc${t?`a`:`v`}>sinf>>tenc' box: ${W(r)} -> ${W(n)}`),e.set(n,8))})}function ve(e){let t=[];return ye(e,e=>t.push(e.subarray(8,24))),t}function ye(e,t){ce(e,[`moov`,`trak`]).forEach(e=>{let n=ce(e,[`mdia`,`minf`,`stbl`,`stsd`])[0];if(!n)return;let r=n.subarray(8),i=ce(r,[`enca`]),o=i.length>0;o||(i=ce(r,[`encv`])),i.forEach(e=>{ce(o?e.subarray(28):e.subarray(78),[`sinf`]).forEach(e=>{let n=be(e);n&&t(n,o)})})})}function be(e){let t=ce(e,[`schm`])[0];if(t){let n=re(t.subarray(4,8));if(n===`cbcs`||n===`cenc`){let t=ce(e,[`schi`,`tenc`])[0];if(t)return t}}}function xe(e,t,n){let r={},i=ce(e,[`moof`,`traf`]);for(let e=0;e<i.length;e++){let o=i[e],c=ce(o,[`tfhd`])[0],l=J(c,4),u=t[l];if(!u)continue;r[l]||(r[l]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});let d=r[l],f=ce(o,[`tfdt`])[0];if(f){let e=f[0],t=J(f,4);e===1&&(t===Ho?n.warn(`[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time`):(t*=Ho+1,t+=J(f,8))),X(t)&&(!X(d.start)||t<d.start)&&(d.start=t)}let p=u.default,m=J(c,0)|p?.flags,h=p?.duration||0;m&8&&(h=m&2?J(c,12):J(c,8));let g=ce(o,[`trun`]),_=d.start||0,v=0,y=h;for(let e=0;e<g.length;e++){let t=g[e],n=J(t,4),r=d.sampleCount;d.sampleCount+=n;let i=t[3]&1,o=t[3]&4,c=t[2]&1,l=t[2]&2,u=t[2]&4,f=t[2]&8,p=8,m=n;for(i&&(p+=4),o&&n&&(!(t[p+1]&1)&&d.keyFrameIndex===void 0&&(d.keyFrameIndex=r),p+=4,c?(y=J(t,p),p+=4):y=h,l&&(p+=4),f&&(p+=4),_+=y,v+=y,m--);m--;)c?(y=J(t,p),p+=4):y=h,l&&(p+=4),u&&(t[p+1]&1||d.keyFrameIndex===void 0&&(d.keyFrameIndex=d.sampleCount-(m+1),d.keyFrameStart=_),p+=4),f&&(p+=4),_+=y,v+=y;!v&&h&&(v+=h*n)}d.duration+=v}if(!Object.keys(r).some(e=>r[e].duration)){let t=1/0,n=0,i=ce(e,[`sidx`]);for(let e=0;e<i.length;e++){let r=le(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&&X(n)&&Object.keys(r).forEach(e=>{r[e].duration||(r[e].duration=n*r[e].timescale-r[e].start)})}return r}function Se(e){let t={valid:null,remainder:null},n=ce(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 Ce(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function we(e,t){let n=[],r=t.samples,i=t.timescale,o=t.id,c=!1;return ce(r,[`moof`]).map(l=>{let u=l.byteOffset-8;ce(l,[`traf`]).map(l=>{let d=ce(l,[`tfdt`]).map(e=>{let t=e[0],n=J(e,4);return t===1&&(n*=2**32,n+=J(e,8)),n/i})[0];return d!==void 0&&(e=d),ce(l,[`tfhd`]).map(d=>{let f=J(d,4),p=J(d,0)&16777215,m=(p&1)!=0,h=(p&2)!=0,g=(p&8)!=0,_=0,v=(p&16)!=0,y=0,b=(p&32)!=0,x=8;f===o&&(m&&(x+=8),h&&(x+=4),g&&(_=J(d,x),x+=4),v&&(y=J(d,x),x+=4),b&&(x+=4),t.type===`video`&&(c=Te(t.codec)),ce(l,[`trun`]).map(o=>{let l=o[0],d=J(o,0)&16777215,f=(d&1)!=0,p=0,m=(d&4)!=0,h=(d&256)!=0,g=0,v=(d&512)!=0,b=0,x=(d&1024)!=0,S=(d&2048)!=0,C=0,w=J(o,4),T=8;f&&(p=J(o,T),T+=4),m&&(T+=4);let E=p+u;for(let u=0;u<w;u++){if(h?(g=J(o,T),T+=4):g=_,v?(b=J(o,T),T+=4):b=y,x&&(T+=4),S&&(C=l===0?J(o,T):oe(o,T),T+=4),t.type===Ro.VIDEO){let t=0;for(;t<b;){let o=J(r,E);E+=4,Ee(c,r[E])&&De(r.subarray(E,E+o),c?2:1,e+C/i,n),E+=o,t+=o+4}}e+=g/i}}))})})}),n}function Te(e){if(!e)return!1;let t=e.substring(0,4);return t===`hvc1`||t===`hev1`||t===`dvh1`||t===`dvhe`}function Ee(e,t){if(e){let e=t>>1&63;return e===39||e===40}else return(t&31)==6}function De(e,t,n,r){let i=Oe(e),o=0;o+=t;let c=0,l=0,u=0;for(;o<i.length;){c=0;do{if(o>=i.length)break;u=i[o++],c+=u}while(u===255);l=0;do{if(o>=i.length)break;u=i[o++],l+=u}while(u===255);let e=i.length-o,t=o;if(l<e)o+=l;else if(l>e){No.error(`Malformed SEI payload. ${l} is too small, only ${e} bytes left to parse.`);break}if(c===4){if(i[t++]===181){let e=ie(i,t);if(t+=2,e===49){let e=J(i,t);if(t+=4,e===1195456820){let e=i[t++];if(e===3){let o=i[t++],l=31&o,u=64&o,d=u?2+l*3:0,f=new Uint8Array(d);if(u){f[0]=o;for(let e=1;e<d;e++)f[e]=i[t++]}r.push({type:e,payloadType:c,pts:n,bytes:f})}}}}}else if(c===5&&l>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 o=l-16,u=new Uint8Array(o);for(let e=0;e<o;e++)u[e]=i[t++];r.push({payloadType:c,pts:n,uuid:e.join(``),userData:U(u),userDataBytes:u})}}}function Oe(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,o=new Uint8Array(i),c=0;for(r=0;r<i;c++,r++)c===n[0]&&(c++,n.shift()),o[r]=e[c];return o}function ke(e){let t=e[0],n=``,r=``,i=0,o=0,c=0,l=0,u=0,d=0;if(t===0){for(;re(e.subarray(d,d+1))!==`\0`;)n+=re(e.subarray(d,d+1)),d+=1;for(n+=re(e.subarray(d,d+1)),d+=1;re(e.subarray(d,d+1))!==`\0`;)r+=re(e.subarray(d,d+1)),d+=1;r+=re(e.subarray(d,d+1)),d+=1,i=J(e,12),o=J(e,16),l=J(e,20),u=J(e,24),d=28}else if(t===1){d+=4,i=J(e,d),d+=4;let t=J(e,d);d+=4;let o=J(e,d);for(d+=4,c=2**32*t+o,So(c)||(c=2**53-1,No.warn(`Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box`)),l=J(e,d),d+=4,u=J(e,d),d+=4;re(e.subarray(d,d+1))!==`\0`;)n+=re(e.subarray(d,d+1)),d+=1;for(n+=re(e.subarray(d,d+1)),d+=1;re(e.subarray(d,d+1))!==`\0`;)r+=re(e.subarray(d,d+1)),d+=1;r+=re(e.subarray(d,d+1)),d+=1}let f=e.subarray(d,e.byteLength);return{schemeIdUri:n,value:r,timeScale:i,presentationTime:c,presentationTimeDelta:o,eventDuration:l,id:u,payload:f}}function Ae(e,...t){let n=t.length,r=8,i=n;for(;i--;)r+=t[i].byteLength;let o=new Uint8Array(r);for(o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=r&255,o.set(e,4),i=0,r=8;i<n;i++)o.set(t[i],r),r+=t[i].byteLength;return o}function je(e,t,n){if(e.byteLength!==16)throw RangeError(`Invalid system id`);let r,i;r=0,i=new Uint8Array;let o;r>0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;let c=new Uint8Array(4);return n.byteLength>0&&new DataView(c.buffer).setUint32(0,n.byteLength,!1),Ae([112,115,115,104],new Uint8Array([r,0,0,0]),e,o,i,c,n)}function Me(e){let t=[];if(e instanceof ArrayBuffer){let n=e.byteLength,r=0;for(;r+32<n;){let n=Ne(new DataView(e,r));t.push(n),r+=n.size}}return t}function Ne(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 o=e.buffer,c=W(new Uint8Array(o,n+12,16)),l=null,u=null,d=0;if(i===0)d=28;else{let i=e.getUint32(28);if(!i||r<32+i*16)return{offset:n,size:t};l=[];for(let e=0;e<i;e++)l.push(new Uint8Array(o,n+32+e*16,16));d=32+i*16}if(!d)return{offset:n,size:t};let f=e.getUint32(d);return t-32<f?{offset:n,size:t}:(u=new Uint8Array(o,n+d+4,f),{version:i,systemId:c,kids:l,data:u,offset:n,size:t})}function Pe(e,t){let n=Ko[t];return!!n&&!!n[e.slice(0,4)]}function Fe(e,t,n=!0){return!e.split(`,`).some(e=>!Ie(e,t,n))}function Ie(e,t,n=!0){return B(n)?.isTypeSupported(Le(e,t))??!1}function Le(e,t){return`${t}/mp4;codecs=${e}`}function Re(e){if(e){let t=e.substring(0,4);return Ko.video[t]}return 2}function ze(e){let t=Go();return e.split(`,`).reduce((e,n)=>{let r=t&&Te(n)?9:Ko.video[n];return r?(r*2+e)/(e?3:2):(Ko.audio[n]+e)/(e?2:1)},0)}function Be(e,t=!0){if(qo[e])return qo[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(Ie(n[i],`audio`,t))return qo[e]=n[i],n[i];if(n[i]===`mp3`&&(r=B(t))!=null&&r.isTypeSupported(`audio/mpeg`))return``}return e}function Ve(e,t=!0){return e.replace(Jo,e=>Be(e.toLowerCase(),t))}function He(e,t){let n=[];if(e){let t=e.split(`,`);for(let e=0;e<t.length;e++)Pe(t[e],`video`)||n.push(t[e])}return t&&n.push(t),n.join(`,`)}function Ue(e,t){if(e&&(e.length>4||[`ac-3`,`ec-3`,`alac`,`fLaC`,`Opus`].indexOf(e)!==-1)&&(We(e,`audio`)||We(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 We(e,t){return Pe(e,t)&&Ie(e,t)}function Ge(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 Ke(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 qe(e){let t=B(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 Je(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,`$1`)}function Ye(e,t){return{supported:!1,configurations:t,decodingInfoResults:[Xo],error:e}}function Xe(e,t,n,r,i,o){let c=e.videoCodec,l=e.audioCodec?e.audioGroups:null,u=o?.audioCodec,d=o?.channels,f=d?parseInt(d):u?1/0:2,p=null;if(l!=null&&l.length)try{p=l.length===1&&l[0]?t.groups[l[0]].channels:l.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 c!==void 0&&(c.split(`,`).some(e=>Te(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))||!!p&&X(f)&&Object.keys(p).some(e=>parseInt(e)>f)}function Y(e,t,n,r={}){let i=e.videoCodec;if(!i&&!e.audioCodec||!n)return Promise.resolve(Zo);let o=[],c=Ze(e),l=c.length,u=Qe(e,t,l>0),d=u.length;for(let e=l||1*d||1;e--;){let t={type:`media-source`};if(l&&(t.video=c[e%l]),d){t.audio=u[e%d];let n=t.audio.bitrate;t.video&&n&&(t.video.bitrate-=n)}o.push(t)}if(i){let e=navigator.userAgent;if(i.split(`,`).some(e=>Te(e))&&Go())return Promise.resolve(Ye(Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${e})`),o))}return Promise.all(o.map(e=>{let t=tt(e);return r[t]||(r[t]=n.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:o,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:o,decodingInfoResults:[],error:e}))}function Ze(e){let t=e.videoCodec?.split(`,`),n=et(e),r=e.width||640,i=e.height||480,o=e.frameRate||30,c=e.videoRange.toLowerCase();return t?t.map(e=>{let t={contentType:Le(Ke(e),`video`),width:r,height:i,bitrate:n,framerate:o};return c!==`sdr`&&(t.transferFunction=c),t}):[]}function Qe(e,t,n){let r=e.audioCodec?.split(`,`),i=et(e);return r&&e.audioGroups?e.audioGroups.reduce((e,o)=>{let c=o?t.groups[o]?.tracks:null;return c?c.reduce((e,t)=>{if(t.groupId===o){let o=parseFloat(t.channels||``);r.forEach(t=>{let r={contentType:Le(t,`audio`),bitrate:n?$e(t,i):i};o&&(r.channels=``+o),e.push(r)})}return e},e):e},[]):[]}function $e(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 et(e){return Math.ceil(Math.max(e.bitrate*.9,e.averageBitrate)/1e3)*1e3||1}function tt(e){let t=``,{audio:n,video:r}=e;if(r){let e=Je(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=Je(n.contentType);t+=`${r?`_`:``}${e}_c${n.channels}`}return t}function nt(e){return Qo.indexOf(e)>-1}function rt(e){return!!e&&$o.indexOf(e)>-1}function it(e){let{canSkipUntil:t,canSkipDateRanges:n,age:r}=e,i=r<t/2;return t&&i?n?es.v2:es.Yes:es.No}function at(e,t){return!t||!e?!1:e.indexOf(t)!==-1}function ot(){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 st(e,t){let n=!1,r=[];if(e&&(n=e!==`SDR`,r=[e]),t){r=t.allowedVideoRanges||$o.slice(0);let e=r.join(``)!==`SDR`&&!t.videoCodec;n=t.preferHDR===void 0?e&&ot():t.preferHDR,n||(r=[`SDR`])}return{preferHDR:n,allowedVideoRanges:r}}function ct(e,t,n,r,i){let o=Object.keys(e),c=r?.channels,l=r?.audioCodec,u=i?.videoCodec,d=c&&parseInt(c)===2,f=!1,p=!1,m=1/0,h=1/0,g=1/0,_=1/0,v=0,y=[],{preferHDR:b,allowedVideoRanges:x}=st(t,i);for(let t=o.length;t--;){let n=e[o[t]];f||=n.channels[2]>0,m=Math.min(m,n.minHeight),h=Math.min(h,n.minFramerate),g=Math.min(g,n.minBitrate),x.filter(e=>n.videoRanges[e]>0).length>0&&(p=!0)}m=X(m)?m:0,h=X(h)?h:0;let S=Math.max(1080,m),C=Math.max(30,h);g=X(g)?g:n,n=Math.max(g,n),p||(t=void 0);let w=o.length>1;return{codecSet:o.reduce((t,r)=>{let i=e[r];if(r===t)return t;if(y=p?x.filter(e=>i.videoRanges[e]>0):[],w){if(i.minBitrate>n)return lt(r,`min bitrate of ${i.minBitrate} > current estimate of ${n}`),t;if(!i.hasDefaultAudio)return lt(r,`no renditions with default or auto-select sound found`),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return lt(r,`audio codec preference "${l}" not found`),t;if(c&&!d){if(!i.channels[c])return lt(r,`no renditions with ${c} channel sound found (channels options: ${Object.keys(i.channels)})`),t}else if((!l||d)&&f&&i.channels[2]===0)return lt(r,`no renditions with stereo sound found`),t;if(i.minHeight>S)return lt(r,`min resolution of ${i.minHeight} > maximum of ${S}`),t;if(i.minFramerate>C)return lt(r,`min framerate of ${i.minFramerate} > maximum of ${C}`),t;if(!y.some(e=>i.videoRanges[e]>0))return lt(r,`no variants with VIDEO-RANGE of ${is(y)} found`),t;if(u&&r.indexOf(u.substring(0,4))%5!=0)return lt(r,`video codec preference "${u}" not found`),t;if(i.maxScore<v)return lt(r,`max score of ${i.maxScore} < selected max of ${v}`),t}return t&&(ze(r)>=ze(t)||i.fragmentError>e[t].fragmentError)?t:(_=i.minIndex,v=i.maxScore,r)},void 0),videoRanges:y,preferHDR:b,minFramerate:h,minBitrate:g,minIndex:_}}function lt(e,t){No.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function ut(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 dt(e,t,n,r){return e.slice(n,r+1).reduce((e,n,r)=>{if(!n.codecSet)return e;let i=n.audioGroups,o=e[n.codecSet];o||(e[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);let c=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,c),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.minIndex=Math.min(o.minIndex,r),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,i&&i.forEach(e=>{if(!e)return;let n=t.groups[e];n&&(o.hasDefaultAudio=o.hasDefaultAudio||t.hasDefaultAudio?n.hasDefault:n.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(n.channels).forEach(e=>{o.channels[e]=(o.channels[e]||0)+n.channels[e]}))}),e},{})}function ft(e){if(!e)return e;let{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:o}=e;return{lang:t,assocLang:n,characteristics:r,channels:i,audioCodec:o}}function pt(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(mt(e,i,n))return r}return-1}function mt(e,t,n){let{groupId:r,name:i,lang:o,assocLang:c,default:l}=e,u=e.forced;return(r===void 0||t.groupId===r)&&(i===void 0||t.name===i)&&(o===void 0||ht(o,t.lang))&&(o===void 0||t.assocLang===c)&&(l===void 0||t.default===l)&&(u===void 0||t.forced===u)&&(!(`characteristics`in e)||gt(e.characteristics||``,t.characteristics))&&(n===void 0||n(e,t))}function ht(e,t=`--`){return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}function gt(e,t=``){let n=e.split(`,`),r=t.split(`,`);return n.length===r.length&&!n.some(e=>r.indexOf(e)===-1)}function _t(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 vt(e,t,n,r,i){let o=t[r],c=t.reduce((e,t,n)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(n),e},{})[o.uri];c.length>1&&(r=Math.max.apply(Math,c));let l=o.videoRange,u=o.frameRate,d=o.codecSet.substring(0,4),f=yt(t,r,t=>{if(t.videoRange!==l||t.frameRate!==u||t.codecSet.substring(0,4)!==d)return!1;let r=t.audioGroups;return pt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1});return f>-1?f:yt(t,r,t=>{let r=t.audioGroups;return pt(e,n.filter(e=>!r||r.indexOf(e.groupId)!==-1),i)>-1})}function yt(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 bt(e,t){return!!e&&e!==t.loadLevelObj?.uri}function xt(e,t,n){if(t===null||!Array.isArray(e)||!e.length||!X(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r<e.length;++r){let i=e[r];if(Tt(t,n,i))return i}return null}function St(e,t,n=0,r=0,i=.005){let o=null;if(e){o=t[1+e.sn-t[0].sn]||null;let r=e.endDTS-n;r>0&&r<15e-7&&(n+=15e-7),o&&e.level!==o.level&&o.end<=e.end&&(o=t[2+e.sn-t[0].sn]||null)}else n===0&&t[0].start===0&&(o=t[0]);if(o&&((!e||e.level===o.level)&&wt(n,r,o)===0||Ct(o,e,Math.min(i,r))))return o;let c=os.search(t,wt.bind(null,n,r));return c&&(c!==e||!o)?c:o}function Ct(e,t,n){if(t&&t.start===0&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>(t[0]===`INF`&&(e+=parseFloat(t[1])),e),n);return e.start<=r}return!1}function wt(e=0,t=0,n){if(n.start<=e&&n.start+n.duration>e)return 0;let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=e?1:n.start-r>e&&n.start?-1:0}function Tt(e,t,n){let r=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-r>e}function Et(e,t,n){if(e&&e.startCC<=t&&e.endCC>=t){let r=e.fragments,{fragmentHint:i}=e;i&&(r=r.concat(i));let o;return os.search(r,e=>e.cc<t?1:e.cc>t?-1:(o=e,e.end<=n?1:e.start>n?-1:0)),o||null}return null}function Dt(e){switch(e.details){case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_TIMEOUT:case Z.LEVEL_LOAD_TIMEOUT:case Z.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ot(e){return e.details.startsWith(`key`)}function kt(e){return Ot(e)&&!!e.frag&&!e.frag.decryptdata}function At(e,t){let n=Dt(t);return e.default[`${n?`timeout`:`error`}Retry`]}function jt(e,t){let n=e.backoff===`linear`?1:2**t;return Math.min(n*e.retryDelayMs,e.maxRetryDelayMs)}function Mt(e){return N(N({},e),{errorRetry:null,timeoutRetry:null})}function Nt(e,t,n,r){if(!e)return!1;let i=r?.code,o=t<e.maxNumRetry&&(Pt(i)||!!n);return e.shouldRetry?e.shouldRetry(e,t,n,r,o):o}function Pt(e){return Ft(e)||!!e&&(e<400||e>499)}function Ft(e){return e===0&&navigator.onLine===!1}function It(e){let t={action:ss.DoNothing,flags:cs.None};return e&&(t.resolved=!0),t}function Lt(e){var t,n,r;return e.buffered&&!!(e.body.gap||(t=e.range.video)!=null&&t.partial||(n=e.range.audio)!=null&&n.partial||(r=e.range.audiovideo)!=null&&r.partial)}function Rt(e){return`${e.type}_${e.level}_${e.sn}`}function zt(e,t){return e.filter(e=>{let n=t(e);return n||e.clearElementaryStreamInfo(),n})}function Bt(e){let t=e.byteLength,n=t&&new DataView(e.buffer).getUint8(t-1);return n?e.slice(0,t-n):e}function Vt(e){switch(e){case fs.cbc:return`AES-CBC`;case fs.ctr:return`AES-CTR`;default:throw Error(`[FastAESKey] invalid aes mode ${e}`)}}function Ht(e,t=null){let n=t||e,r={frag:e,part:t,responseType:`arraybuffer`,url:n.url,headers:{},rangeStart:0,rangeEnd:0},i=n.byteRangeStartOffset,o=n.byteRangeEndOffset;if(X(i)&&X(o)){let t=i,n=o;if(e.sn===`initSegment`&&Wt(e.decryptdata?.method)){let e=o-i;e%16&&(n=o+(16-e%16)),i!==0&&(r.resetIV=!0,t=i-16)}r.rangeStart=t,r.rangeEnd=n}return r}function Ut(e,t){let n=Error(`GAP ${e.gap?`tag`:`attribute`} found`),r={type:wo.MEDIA_ERROR,details:Z.FRAG_GAP,fatal:!1,frag:e,error:n,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new bs(r)}function Wt(e){return e===`AES-128`||e===`AES-256`}function Gt(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Kt(e){return Ts.test(e)}function qt(e,t){if(e.variableList!==null||e.hasVariableRefs){let n=e.variableList;return t.replace(Ts,t=>{let r=t.substring(2,t.length-1),i=n?.[r];return i===void 0?(e.playlistParsingError||=Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`),t):i})}return t}function Jt(e,t,n){let r=e.variableList;r||(e.variableList=r={});let i,o;if(`QUERYPARAM`in t){i=t.QUERYPARAM;try{let e=new self.URL(n).searchParams;if(e.has(i))o=e.get(i);else throw Error(`"${i}" does not match any query parameter in URI: "${n}"`)}catch(t){e.playlistParsingError||=Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`)}}else i=t.NAME,o=t.VALUE;i in r?e.playlistParsingError||=Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`):r[i]=o||``}function Yt(e,t,n){let r=t.IMPORT;if(n&&r in n){let t=e.variableList;t||(e.variableList=t={}),t[r]=n[r]}else e.playlistParsingError||=Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`)}function Xt(e){return e!==`ID`&&e!==`CLASS`&&e!==`CUE`&&e!==`START-DATE`&&e!==`DURATION`&&e!==`END-DATE`&&e!==`END-ON-NEXT`}function Zt(e){return e===`SCTE35-OUT`||e===`SCTE35-IN`||e===`SCTE35-CMD`}function Qt(e,t){return e.length===t.length?!e.some((e,n)=>e!==t[n]):!1}function $t(e,t){return!e&&!t?!0:!e||!t?!1:Qt(e,t)}function en(e){return e===`AES-128`||e===`AES-256`||e===`AES-256-CTR`}function tn(e){switch(e){case`AES-128`:case`AES-256`:return fs.cbc;case`AES-256-CTR`:return fs.ctr;default:throw Error(`invalid full segment method ${e}`)}}function nn(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function rn(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function an(e){let t=rn(e).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function on(e){let t=function(e,t,n){let r=e[t];e[t]=e[n],e[n]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function sn(e){let t=e.split(`:`),n=null;if(t[0]===`data`&&t.length===2){let e=t[1].split(`;`),r=e[e.length-1].split(`,`);if(r.length===2){let t=r[0]===`base64`,i=r[1];t?(e.splice(-1,1),n=nn(i)):n=an(i)}}return n}function cn(e){switch(e){case Fs.FAIRPLAY:return Ps.FAIRPLAY;case Fs.PLAYREADY:return Ps.PLAYREADY;case Fs.WIDEVINE:return Ps.WIDEVINE;case Fs.CLEARKEY:return Ps.CLEARKEY}}function ln(e){switch(e){case Ps.FAIRPLAY:return Fs.FAIRPLAY;case Ps.PLAYREADY:return Fs.PLAYREADY;case Ps.WIDEVINE:return Fs.WIDEVINE;case Ps.CLEARKEY:return Fs.CLEARKEY}}function un(e){let{drmSystems:t,widevineLicenseUrl:n}=e,r=t?[Ps.FAIRPLAY,Ps.WIDEVINE,Ps.PLAYREADY,Ps.CLEARKEY].filter(e=>!!t[e]):[];return!r[Ps.WIDEVINE]&&n&&r.push(Ps.WIDEVINE),r}function dn(e,t,n,r){let i;switch(e){case Ps.FAIRPLAY:i=[`cenc`,`sinf`];break;case Ps.WIDEVINE:case Ps.PLAYREADY:i=[`cenc`];break;case Ps.CLEARKEY:i=[`cenc`,`keyids`];break;default:throw Error(`Unknown key-system: ${e}`)}return fn(i,t,n,r)}function fn(e,t,n,r){return[{initDataTypes:e,persistentState:r.persistentState||`optional`,distinctiveIdentifier:r.distinctiveIdentifier||`optional`,sessionTypes:r.sessionTypes||[r.sessionType||`temporary`],audioCapabilities:t.map(e=>({contentType:`audio/mp4; codecs=${e}`,robustness:r.audioRobustness||``,encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:n.map(e=>({contentType:`video/mp4; codecs=${e}`,robustness:r.videoRobustness||``,encryptionScheme:r.videoEncryptionScheme||null}))}]}function pn(e){var t;return!!e&&(e.sessionType===`persistent-license`||!!((t=e.sessionTypes)!=null&&t.some(e=>e===`persistent-license`)))}function mn(e){let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),r=n.substring(n.indexOf(`<`),n.length),i=new DOMParser().parseFromString(r,`text/xml`).getElementsByTagName(`KID`)[0];if(i){let e=i.childNodes[0]?i.childNodes[0].nodeValue:i.getAttribute(`VALUE`);if(e){let t=nn(e).subarray(0,16);return on(t),t}}return null}function hn(e){let t=e?.[Fs.WIDEVINE];return t?t.keyId:null}function gn(e){let t=e?.[Fs.PLAYREADY];if(t){let e=sn(t.uri);if(e)return mn(e)}return null}function _n(e){let t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=e>>8*(15-n)&255;return t}function vn(e,t){let n=e.length;if(!n)if(t.hasProgramDateTime){let r=t.fragments[t.fragments.length-1];e.push(r),n++}else return;let r=e[n-1],i=t.live?1/0:t.totalduration,o=Object.keys(t.dateRanges);for(let c=o.length;c--;){let l=t.dateRanges[o[c]],u=l.startDate.getTime();l.tagAnchor=r.ref;for(let r=n;r--&&!(e[r]?.sn<t.startSN);){let n=yn(t,u,e,r,i);if(n!==-1){l.tagAnchor=t.fragments[n].ref;break}}}}function yn(e,t,n,r,i){let o=n[r];if(o){let c=o.programDateTime;if((t>=c||r===0)&&t<=c+((n[r+1]?.start||i)-o.start)*1e3){let i=n[r].sn-e.startSN;if(i<0)return-1;let o=e.fragments;if(o.length>n.length){let c=(n[r+1]||o[o.length-1]).sn-e.startSN;for(let e=c;e>i;e--){let n=o[e].programDateTime;if(t>=n&&t<n+o[e].duration*1e3)return e}}return i}}return-1}function bn(e,t,n){let r=new Os(e,n),i=r.METHOD??``,o=r.URI,c=r.hexadecimalInteger(`IV`),l=r.KEYFORMATVERSIONS,u=r.KEYFORMAT??`identity`;return o&&r.IV&&!c&&No.error(`Invalid IV: ${r.IV}`),new Rs(i,o?Ws.resolve(o,t):``,u,(l||`1`).split(`/`).map(Number).filter(Number.isFinite),c,r.KEYID)}function xn(e){let t=new Os(e).decimalFloatingPoint(`TIME-OFFSET`);return X(t)?t:null}function Sn(e,t){let n=(e||``).split(/[ ,]+/).filter(e=>e);[`video`,`audio`,`text`].forEach(e=>{let r=n.filter(t=>Pe(t,e));r.length&&(t[`${e}Codec`]=r.map(e=>e.split(`/`)[0]).join(`,`),n=n.filter(e=>r.indexOf(e)===-1))}),t.unknownCodecs=n}function Cn(e,t,n){let r=t[n];r&&(e[n]=r)}function wn(e,t){let n=e[t];for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=n.programDateTime-t.duration*1e3,n=t}}function Tn(e,t,n){e.rawProgramDateTime?n.push(e):t!=null&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function En(e,t,n,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=n,e.sn=`initSegment`,r&&(e.levelkeys=r),e.initSegment=null}function Dn(e,t,n){e.levelkeys=t;let{encryptedFragments:r}=n;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}function On(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function kn(e,t,n){e.playlistParsingError=Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function An(e,t){let n=t.startPTS;if(X(n)){let r=0,i;t.sn>e.sn?(r=n-e.start,i=e):(r=e.start-n,i=t),i.duration!==r&&i.setDuration(r)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function jn(e,t,n,r,i,o,c){r-n<=0&&(c.warn(`Fragment should have a positive duration`,t),r=n+t.duration,o=i+t.duration);let l=n,u=r,d=t.startPTS,f=t.endPTS;if(X(d)){let p=Math.abs(d-n);e&&p>e.totalduration?c.warn(`media timestamps and playlist times differ by ${p}s for level ${t.level} ${e.url}`):X(t.deltaPTS)?t.deltaPTS=Math.max(p,t.deltaPTS):t.deltaPTS=p,l=Math.max(n,d),n=Math.min(n,d),i=t.startDTS===void 0?i:Math.min(i,t.startDTS),u=Math.min(r,f),r=Math.max(r,f),o=t.endDTS===void 0?o:Math.max(o,t.endDTS)}let p=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(r-t.start),t.startPTS=n,t.maxStartPTS=l,t.startDTS=i,t.endPTS=r,t.minEndPTS=u,t.endDTS=o;let m=t.sn;if(!e||m<e.startSN||m>e.endSN)return 0;let h,g=m-e.startSN,_=e.fragments;for(_[g]=t,h=g;h>0;h--)An(_[h],_[h-1]);for(h=g;h<_.length-1;h++)An(_[h],_[h+1]);return e.fragmentHint&&An(_[_.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,p}function Mn(e,t,n){if(e===t)return;let r=null,i=e.fragments;for(let e=i.length-1;e>=0;e--){let t=i[e].initSegment;if(t){r=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let o;Fn(e,t,(e,n,i,c)=>{if((!t.startCC||t.skippedSegments)&&n.cc!==e.cc){let r=e.cc-n.cc;for(let e=i;e<c.length;e++)c[e].cc+=r;t.endCC=c[c.length-1].cc}X(e.startPTS)&&X(e.endPTS)&&(n.setStart(n.startPTS=e.startPTS),n.startDTS=e.startDTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.setDuration(e.endPTS-e.startPTS),n.duration&&(o=n),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(n.elementaryStreams=e.elementaryStreams),n.loader=e.loader,e.hasStats&&(n.stats=e.stats),e.initSegment&&(n.initSegment=e.initSegment,r=e.initSegment)});let c=t.fragments,l=t.fragmentHint?c.concat(t.fragmentHint):c;if(r&&l.forEach(e=>{e&&(!e.initSegment||e.initSegment.relurl===r?.relurl)&&(e.initSegment=r)}),t.skippedSegments){if(t.deltaUpdateFailed=c.some(e=>!e),t.deltaUpdateFailed){n.warn(`[level-helper] Previous playlist missing segments skipped in delta playlist`);for(let e=t.skippedSegments;e--;)c.shift();t.startSN=c[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=Nn(e.dateRanges,t,n));let r=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<l.length;e++)l[e].programDateTime===null&&Tn(l[e],l[e-1],r);vn(r,t)}t.endCC=c[c.length-1].cc}t.startCC||=Bn(e,t.startSN-1)?.cc??c[0].cc,Pn(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats}),o?jn(t,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS,n):Ln(e,t),c.length&&(t.totalduration=t.edge-c[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let u=t.advancedDateTime;if(t.advanced&&u){let e=t.edge;t.driftStart||=(t.driftStartTime=u,e),t.driftEndTime=u,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=e.requestScheduled)}function Nn(e,t,n){let{dateRanges:r,recentlyRemovedDateranges:i}=t,o=j({},e);i&&i.forEach(e=>{delete o[e]});let c=Object.keys(o).length;return c?(Object.keys(r).forEach(e=>{let t=o[e],i=new As(r[e].attr,t);i.isValid?(o[e]=i,t||(i.tagOrder+=c)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${is(r[e].attr)}"`)}),o):r}function Pn(e,t,n){if(e&&t){let r=0;for(let i=0,o=e.length;i<=o;i++){let o=e[i],c=t[i+r];o&&c&&o.index===c.index&&o.fragment.sn===c.fragment.sn?n(o,c):r--}}}function Fn(e,t,n){let r=t.skippedSegments,i=Math.max(e.startSN,t.startSN)-t.startSN,o=+!!e.fragmentHint+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,c=t.startSN-e.startSN,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,u=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let d=i;d<=o;d++){let i=u[c+d],o=l[d];if(r&&!o&&i&&(o=t.fragments[d]=i),i&&o){n(i,o,d,l);let r=i.relurl,c=o.relurl;if(r&&Wn(r,c)){t.playlistParsingError=In(`media sequence mismatch ${o.sn}:`,e,t,i,o);return}else if(i.cc!==o.cc){t.playlistParsingError=In(`discontinuity sequence mismatch (${i.cc}!=${o.cc})`,e,t,i,o);return}}}}function In(e,t,n,r,i){return Error(`${e} ${i.url}
4
4
  Playlist starting @${t.startSN}
@@ -56,4 +56,4 @@ Column: `+(t[t.length-1].length+1)+`
56
56
  Char: `+e[n])}return n+1&&(n+=1),l}if(e.charCodeAt(n+1)===63){n=e.indexOf(`>`,n),n++;continue}if(e.charCodeAt(n+1)===33){if(e.charCodeAt(n+2)==45){let t=n;for(;n!==-1&&(e.charCodeAt(n)!==62||e.charCodeAt(n-1)!=45||e.charCodeAt(n-2)!=45||n==-1);)n=e.indexOf(`>`,n+1);n===-1&&(n=r),i&&l.push(c(e.substring(t,n+1),`#comment`))}else{if(e.charCodeAt(n+2)===91&&e.charCodeAt(n+8)===91&&e.startsWith(`CDATA`,n+3)){let t=e.indexOf(`]]>`,n);t==-1?(l.push(c(e.substr(n+9),`#cdata`)),n=r):(l.push(c(e.substring(n+9,t),`#cdata`)),n=t+3);continue}{let t=n+1;n+=2;let r=!1;for(;(e.charCodeAt(n)!==62||!0===r)&&e[n];)e.charCodeAt(n)===91?r=!0:!0===r&&e.charCodeAt(n)===93&&(r=!1),n++;l.push(c(e.substring(t,n),`#doctype`))}}n++;continue}let o=f();l.push(o)}else{let e=u();if(o)e.length>0&&l.push(c(e));else{let t=e.trim();t.length>0&&l.push(c(t))}n++}return l}function u(){let t=n;return n=e.indexOf(`<`,n)-1,n===-2&&(n=r),Tt(e.slice(t,n+1))}function d(){let t=n;for(;`\r
57
57
  >/= `.indexOf(e[n])===-1&&e[n];)n++;return e.slice(t,n)}function f(){n++;let t=d(),r=t,i=null,o=t.indexOf(`:`);o!==-1&&(i=t.slice(0,o),r=t.slice(o+1));let c=function(){let t={};for(;e.charCodeAt(n)!==62&&e[n];){let r=e.charCodeAt(n);if(r>64&&r<91||r>96&&r<123){let r=d(),i=``,o=e.charCodeAt(n);for(;o!==39&&o!==34;)n++,o=e.charCodeAt(n);if(o===39||o===34){if(i=p(),n===-1)throw Error(`Missing closing quote`)}else n--;t[r]=Tt(i)}n++}return t}(),u=[],f=e.charCodeAt(n-1);return n++,f!==47&&(u=l(t)),{nodeName:t,nodeValue:null,attributes:c,childNodes:u,prefix:i,localName:r}}function p(){let t=e[n],r=n+1;return n=e.indexOf(t,r),e.slice(r,n)}return{nodeName:`#document`,nodeValue:null,childNodes:l(``),attributes:{}}}(e),n=t.childNodes.find((e=>e.nodeName===`MPD`||e.nodeName===`Patch`))||t.childNodes[0];return function e(t){t.nodeName.indexOf(`:`)!==-1&&(t.__prefix=t.prefix,t.nodeName=t.localName);let{childNodes:n,attributes:r,nodeName:i}=t;t.tagName=i;for(let e in r){let n=r[e];if(i===`S`)n=parseInt(n);else for(let t=0,r=o.length;t<r;t++){let r=o[t];if(r.test(i,e,n)){n=r.converter(n);break}}t[e]=n}let c=n?.length;for(let r=0;r<c;r++){let i=n[r];if(i.nodeName===`#text`){t.__text=i.nodeValue;continue}e(i);let{nodeName:o}=i;Array.isArray(t[o])?t[o].push(i):ga.indexOf(o)===-1?t[o]=i:(t[o]||(t[o]=[]),t[o].push(i))}t.__children=n}(n),n}(e);return{[t.tagName]:t}}catch{return null}}return r={getIron:function(){return c},parseXml:l,parse:function(e){let t,n=window.performance.now();if(t=l(e),!t)throw Error(`failed to parse the manifest`);t.Patch?(t=t.Patch,t.add&&t.add.forEach((e=>c.run(e))),t.replace&&t.replace.forEach((e=>c.run(e)))):(t=t.MPD,c.run(t));let r=window.performance.now();return i.info(`Parsing complete: `+(r-n).toPrecision(3)+`ms`),t.protocol=`DASH`,t}},i=n.getLogger(r),o=[new aa,new sa,new ua,new da],c=na(t).create({adaptationset:new ma,period:new ha}),r}_a.__dashjs_factory_name=`DashParser`;var va=i.default.getClassFactory(_a);function ya(e){e||={};let t=this.context,n=e.debug,r=e.settings,i=(0,p.default)(t).getInstance(),o=ht(t).getInstance(),c,l,u,d,f,g=e.mssHandler,_=e.errHandler;function v(e){i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:e.manifest})}return c={load:function(e,c=null,p=null){let h=new Date,_=new Yi(e,T.HTTPRequest.MPD_TYPE);c&&(_.serviceLocation=c),p&&(_.queryParams=p),_.startDate||=h,i.trigger(m.default.MANIFEST_LOADING_STARTED,{request:_}),u.load({request:_,success:function(c,u,p){if(!d)return;let h,_,v;if(p&&p!==e?(_=o.parseBaseUrl(p),h=p):(o.isRelative(e)&&(e=o.resolve(e,window.location.href)),_=o.parseBaseUrl(e)),u!=`No Content`)if(f===null&&(f=function(e){let r=null;return e.indexOf(`SmoothStreamingMedia`)>-1?(g&&(r=g.createMssParser(),g.createMssFragmentProcessor(),g.registerEvents()),r):e.indexOf(`MPD`)>-1||e.indexOf(`Patch`)>-1?va(t).create({debug:n}):r}(c)),f!==null){d.setParser(f);try{v=f.parse(c)}catch{i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Be.default(Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${e}`)});return}if(v){if(v.url=h||e,v.originalUrl||=v.url,r&&r.get().streaming.enableManifestDurationMismatchFix&&v.mediaPresentationDuration&&v.Period.length>1){let e=v.Period.reduce(((e,t)=>e+t.duration),0);!isNaN(e)&&v.mediaPresentationDuration>e&&(l.warn(`Media presentation duration greater than duration of all periods. Setting duration to total period duration`),v.mediaPresentationDuration=e)}v.baseUri=_,v.loadedTime=new Date,d.resolveManifestOnLoad(v),i.trigger(m.default.ORIGINAL_MANIFEST_LOADED,{originalManifest:c})}else i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Be.default(Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${e}`)})}else i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Be.default(Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${e}`)});else i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){i.trigger(m.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Be.default(Ne.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,Ne.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+`${e}, ${r}`)})}})},reset:function(){i.off(m.default.XLINK_READY,v,c),g&&g.reset(),d&&=(d.reset(),null),u&&=(u.abort(),null)}},l=n.getLogger(c),i.on(m.default.XLINK_READY,v,c),u=or(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,urlUtils:o,constants:h.default,dashConstants:Y.default,errors:Ne,requestTimeout:e.settings.get().streaming.manifestRequestTimeout}),d=ea(t).create({errHandler:_,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,settings:e.settings}),f=null,c}ya.__dashjs_factory_name=`ManifestLoader`;var ba=i.default.getClassFactory(ya);function xa(){let e,t,n=this.context,r=(0,p.default)(n).getInstance();return e={getValue:function(){return t},setValue:function(e){t=e,e&&r.trigger(m.default.MANIFEST_LOADED,{data:e})}},e}xa.__dashjs_factory_name=`ManifestModel`;var Sa=i.default.getSingletonFactory(xa);function Ca(){let e=this.context,t=(0,u.default)(e).getInstance(),n,r,i;return n={select:function(e){if(!e||e.length===0)return null;let n=null;return t.get().streaming.applyContentSteering&&(n=function(e){let t=i.getCurrentSteeringResponseData();return t&&t.pathwayPriority&&t.pathwayPriority.length>0?function(e=[],t=[]){let n=0,i=null;for(;n<e.length;){let o=e[n],c=t.findIndex((e=>e.serviceLocation&&e.serviceLocation===o));if(c!==-1&&!r.contains(t[c].serviceLocation)){i=t[c];break}n+=1}return i}(t.pathwayPriority,e):null}(e)),n||=function(e){return e[0]}(e),n},setConfig:function(e){e.blacklistController&&(r=e.blacklistController),e.contentSteeringController&&(i=e.contentSteeringController)},reset:function(){r.reset()}},r=Fe(e).create({updateEventName:m.default.SERVICE_LOCATION_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:m.default.SERVICE_LOCATION_LOCATION_BLACKLIST_ADD}),i=ur(e).getInstance(),n}Ca.__dashjs_factory_name=`LocationSelector`;var wa=i.default.getClassFactory(Ca);function Ta(){let e=this.context,t=(0,p.default)(e).getInstance(),n=ht(e).getInstance(),r,i,o,c,u,d,f,_,v,y,b,x,S,C,w;function T(){S=NaN,_=!1,d=!0,f=!1,E()}function E(){C!==null&&(clearTimeout(C),C=null)}function D(e){E(),f||(isNaN(e)&&!isNaN(S)&&(e=1e3*S),isNaN(e)||(y.debug(`Refresh manifest in `+e+` milliseconds.`),C=setTimeout(A,e)))}function O(e=!1){_=!0;let t=x.getValue(),o=t.url;o&&=He.default.removeQueryParameterFromUrl(o,h.default.CMCD_QUERY_KEY);let c=null,l=r.getPatchLocation(t),u=v.select(l),d=null;if(u&&!e)o=u.url,c=u.serviceLocation,d=u.queryParams;else{let e=function(e){let t=r.getLocation(e),n=i.getSynthesizedLocationElements(t);return t.concat(n)}(t),n=v.select(e);n&&(o=n.url,c=n.serviceLocation,d=n.queryParams)}n.isRelative(o)&&(o=n.resolve(o,t.url)),b.load(o,c,d)}function k(e){if(e){if(r.getIsPatch(e)){let t=e;e=x.getValue();let n=r.isPatchValid(e,t),i=n;if(n){let n=r.getPublishTime(e);r.applyPatchToManifest(e,t);let o=r.getPublishTime(e);i=n.getTime()!==o.getTime()}if(!i)return y.debug(`Patch provided is invalid, performing full manifest refresh`),void O(!0);e.loadedTime=new Date}}else (e=x.getValue()).loadedTime=new Date;if(x.getValue()&&x.getValue().type===Y.default.DYNAMIC&&e.type===Y.default.STATIC)return t.trigger(m.default.DYNAMIC_TO_STATIC),_=!1,void(f=!0);x.setValue(e);let n=new Date,i=(n.getTime()-e.loadedTime.getTime())/1e3;S=r.getManifestUpdatePeriod(e,i),1e3*S>2147483647&&(S=2147483.647),t.trigger(m.default.MANIFEST_UPDATED,{manifest:e}),y.info(`Manifest has been refreshed at `+n+`[`+n.getTime()/1e3+`] `),d||D()}function A(){d||(_?D(w.get().streaming.manifestUpdateRetryInterval):O())}function j(e){if(e.error)e.error.code===Ne.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&c.error(e.error);else{let t=e.manifest;(function(e){(function(e){let t=o.getExternalSubtitles();if(!t||t.length===0)return;let n=e&&e.Period?e.Period.length:0;t.forEach((t=>{if(t.periodId===null&&n>1)y.warn(`External subtitle with id ${t.id} has no periodId and the MPD contains more than one period. Unable to add the external subtitle as it is not clear which period shall be used.`);else if(n===1)M(e.Period[0],t);else{let n=e.Period.find((e=>e.id===t.periodId));n?M(n,t):y.warn(`External subtitle with id ${t.id} has periodId ${t.periodId} but the MPD does not contain a period with that id. Unable to add the external subtitle.`)}}))})(e)})(t),k(t)}}function M(e,t){if(!e||!e.AdaptationSet)return e;e.AdaptationSet.push(t.serializeToMpdParserFormat())}function N(){d=!1,D()}function P(){d=!w.get().streaming.scheduling.scheduleWhilePaused,d&&E()}function F(){_=!1}return u={getIsUpdating:function(){return _},initialize:function(){T(),t.on(m.default.STREAMS_COMPOSED,F,this),t.on(g.default.PLAYBACK_STARTED,N,this),t.on(g.default.PLAYBACK_PAUSED,P,this),t.on(m.default.INTERNAL_MANIFEST_LOADED,j,this)},refreshManifest:O,reset:function(){t.off(g.default.PLAYBACK_STARTED,N,this),t.off(g.default.PLAYBACK_PAUSED,P,this),t.off(m.default.STREAMS_COMPOSED,F,this),t.off(m.default.INTERNAL_MANIFEST_LOADED,j,this),T()},setConfig:function(e){e&&(e.manifestModel&&(x=e.manifestModel),e.adapter&&(r=e.adapter),e.manifestLoader&&(b=e.manifestLoader),e.errHandler&&(c=e.errHandler),e.locationSelector&&(v=e.locationSelector),e.settings&&(w=e.settings),e.contentSteeringController&&(i=e.contentSteeringController),e.customParametersModel&&(o=e.customParametersModel))},setManifest:function(e){k(e)}},y=(0,l.default)(e).getInstance().getLogger(u),v=wa(e).create(),o=(0,Kn.default)(e).getInstance(),u}Ta.__dashjs_factory_name=`ManifestUpdater`;var Ea=i.default.getClassFactory(Ta);function Da(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i,o,c,u,d,f,_,v,y;function b(e){if(!(e&&e.currentRepresentation&&e.currentRepresentation.mediaInfo&&e.currentRepresentation.mediaInfo.type))return;let t=e.currentRepresentation.mediaInfo.type;d[t]=e.currentRepresentation}function x(e,t){return e&&i[t]&&i[t][e]?i[t][e].list:[]}function S(e,t){return e&&i[t]&&i[t][e]?i[t][e].current:null}function C(e,n={}){if(!e||!e.streamInfo)return;let r=e.type,c=e.streamInfo.id,l=S(r,c);if(i[c]&&i[c][r]&&(i[c][r].current=e,i[c][r].current&&(r!==h.default.TEXT&&!E(e,l)||r===h.default.TEXT&&e.isFragmented)&&t.trigger(m.default.CURRENT_TRACK_CHANGED,{oldMediaInfo:l,newMediaInfo:e,switchMode:o.get().streaming.trackSwitchMode[r],options:n},{streamId:c}),!n.hasOwnProperty(`noSettingsSave`)||!n.noSettingsSave)){let t=function(e){let t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration,codec:e.codec};return t.lang||t.viewpoint||t.role&&t.role.length>0||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}(e);if(!t||!i[c][r].storeLastSettings)return;t.roles&&(t.role=t.roles[0],delete t.roles),t.accessibility&&=t.accessibility[0],t.audioChannelConfiguration&&=t.audioChannelConfiguration[0],u[r]=t,y.setSavedMediaSettings(r,t)}}function w(e,t){e&&t&&(c[e]=t)}function T(e){return e?c[e]:null}function E(e,t){if(!e&&!t)return!0;if(!e||!t||e.isPreselection!==t.isPreselection)return!1;let n=e.id===t.id,r=JSON.stringify(e.viewpoint)===JSON.stringify(t.viewpoint),i=e.lang===t.lang,o=e.codec===t.codec,c=JSON.stringify(e.roles)===JSON.stringify(t.roles),l=JSON.stringify(e.accessibility)===JSON.stringify(t.accessibility),u=JSON.stringify(e.audioChannelConfiguration)===JSON.stringify(t.audioChannelConfiguration);return n&&o&&r&&i&&c&&l&&u}function D(){i={},u={},d={},c={audio:null,video:null,text:null},t.off(g.default.REPRESENTATION_SWITCH,b,n)}function O(e,t,n){let i=[];return e.forEach((function(e){t(n,e)&&i.push(e)})),i.length!==0||t===N&&o.get().streaming.assumeDefaultRoleAsMain&&G(n.role,{schemeIdUri:h.default.DASH_ROLE_SCHEME_ID,value:Y.default.MAIN})&&(r.info(`no track with Role set to main - assuming main as default and searching again`),i=O(e,P,null),i.length!==0)?i:(r.info(`Filter-Function (`+t.name+`) resulted in no tracks; setting ignored`),e)}function k(e,t){try{return!e.lang||e.lang instanceof RegExp?t.lang.match(e.lang):t.lang!==``&&ii(t.lang,fi(e.lang)).length>0}catch{return!1}}function A(e,t){return e.index===void 0||e.index===null||t.index===e.index}function j(e,t){return e.id===void 0||e.id===null||t.id===e.id}function M(e,t){return!e.viewpoint||!!t.viewpoint.filter((function(t){return G(t,e.viewpoint)}))[0]}function N(e,t,n=!1){return!!t.roles&&(!e.role||!!t.roles.filter((function(t){return G(t,e.role)}))[0]||t.type===h.default.AUDIO&&n)}function P(e,t){return!t.roles||t.roles.length===0}function F(e,t){let n;return n=e.accessibility?!!t.accessibility.filter((function(t){return G(t,e.accessibility)}))[0]:!t.accessibility.length,n}function I(e,t){return!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return G(t,e.audioChannelConfiguration)}))[0]}function L(e,t){return!e.codec||e.codec===t.codec}function R(e){let t=0,n=[];return e.forEach((e=>{isNaN(e.selectionPriority)||(e.selectionPriority>t?(t=e.selectionPriority,n=[e]):e.selectionPriority===t&&n.push(e))})),n}function z(e){let t,n=0,r=[];return e.forEach((function(e){t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))),t>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function B(e){return e[0]&&e[0].type===h.default.VIDEO?function(e){let t,n=1/0,r=[];return e.forEach((function(e){t=e.bitrateList.reduce((function(e,t){let n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0)/e.bitrateList.length,t<n?(n=t,r=[e]):t===n&&r.push(e)})),r}(e):e[0]&&e[0].type===h.default.AUDIO?function(e){let t=1/0,n=[];return e.forEach((function(e){let r=e.audioChannelConfiguration.reduce((function(e,t){return e+(kr(t)||0)}),0)/e.audioChannelConfiguration.length;e.hasOwnProperty(`supplementalProperties`)&&e.supplementalProperties.some((e=>e.schemeIdUri===`tag:dolby.com,2018:dash:EC3_ExtensionType:2018`&&e.value===`JOC`))&&(r=16),r||=1;let i=e.bitrateList.reduce((function(e,t){return e+t.bandwidth/r}),0)/e.bitrateList.length;i<t?(t=i,n=[e]):i===t&&n.push(e)})),n}(e):e}function V(e){let t,n=0,r=[];return e.forEach((function(e){t=e.representationCount,t>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function H(e,t){if(e===h.default.TEXT)return function(e){if(!e||e.length===0)return null;let t=e.filter((e=>!(e&&e.roles&&e.roles.length>0)||e.roles.every((e=>e.schemeIdUri!==h.default.DASH_ROLE_SCHEME_ID||e.value!==Y.default.FORCED_SUBTITLE))));return t.length>0?t[0]:e[0]}(t);let n,i=f.getCustomInitialTrackSelectionFunction();if(n=function(e){try{let t;return t=function(e){try{let t=e.filter((e=>{let t=e.type;return e.bitrateList.some((e=>{let n=_.getAbrBitrateParameter(`maxBitrate`,t),r=_.getAbrBitrateParameter(`minBitrate`,t);return!(n>-1&&e.bandwidth>1e3*n||r>-1&&e.bandwidth<1e3*r)}))}));return t.length>0?t:e}catch(t){return r.error(t),e}}(e),t=function(e){try{if(!o.get().streaming.abr.limitBitrateByPortal)return e;let{elementWidth:t}=v.getVideoElementSize(),n=e.filter((e=>e.type!==h.default.VIDEO||e.bitrateList.some((e=>e.width<=t))));return n.length>0?n:e}catch(t){return r.error(t),e}}(t),t}catch(t){return r.error(t),e}}(t),i&&typeof i==`function`)n=i(n);else if(d[e])n=function(e,t){if(!e||e.length===0||!t||!d[t])return e;let n=d[t].bandwidth;if(!n||isNaN(n))return e;let r={min:NaN,track:null};return e.forEach((e=>{e.bitrateList.forEach((t=>{let i=Math.abs(t.bandwidth-n);(isNaN(r.min)||i<r.min)&&(r.min=i,r.track=e)}))})),r.track?[r.track]:e}(n,e);else if(o.get().streaming.ignoreSelectionPriority||(r.info(`Trying to find track with highest selectionPriority`),n=function(e){return R(e)}(n)),n.length>1&&o.get().streaming.prioritizeRoleMain&&(r.info(`Trying to find a main track`),n=O(n,N,{role:{schemeIdUri:h.default.DASH_ROLE_SCHEME_ID,value:Y.default.MAIN}})),n.length>1){r.info(`Selecting track based on selectionModeForInitialTrack`);let e=o.get().streaming.selectionModeForInitialTrack;switch(e){case h.default.TRACK_SELECTION_MODE_HIGHEST_BITRATE:n=function(e){let t=z(e);return t.length>1&&(t=V(t)),t}(n);break;case h.default.TRACK_SELECTION_MODE_FIRST_TRACK:n=U(n);break;case h.default.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:n=W(n);break;case h.default.TRACK_SELECTION_MODE_WIDEST_RANGE:n=function(e){let t=V(e);return t.length>1&&(t=z(e)),t}(n);break;case h.default.TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY:n=function(e){let t=e.filter((e=>!(!e.segmentSequenceProperties||e.segmentSequenceProperties.length===0)&&e.segmentSequenceProperties.some((e=>e.cadence===1&&(e.sapType===0||e.sapType===1)))));return W(t.length>0?t:e)}(n);break;default:r.warn(`Track selection mode ${e} is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK`),n=U(n)}}return n.length>0?n[0]:t[0]}function U(e){return e[0]}function W(e){let t=B(e);return t.length>1&&(t=z(t)),t}function G(e,t){return!(!e||!t)&&JSON.stringify({schemeIdUri:e.schemeIdUri,value:e.value})===JSON.stringify({schemeIdUri:t.schemeIdUri,value:t.value})}return n={addTrack:function(e){if(!e)return;r.info(`addTrack with track.codec='`+e.codec+`', track.type='`+e.type+`'`);let t=e.type;if((n=t)!==h.default.AUDIO&&n!==h.default.VIDEO&&n!==h.default.TEXT&&n!==h.default.IMAGE)return;var n;let c=e.streamInfo.id;i[c]||(i[c]=function(){let e=o.get().streaming.saveLastMediaSettingsForCurrentStreamingSession;return{audio:{list:[],storeLastSettings:e,current:null},video:{list:[],storeLastSettings:e,current:null},text:{list:[],storeLastSettings:e,current:null},image:{list:[],storeLastSettings:e,current:null}}}());let l=i[c][t].list;for(let t=0,n=l.length;t<n;++t)if(E(l[t],e))return;l.push(e)},areTracksEqual:E,clearDataForStream:function(e){i[e]&&delete i[e]},getCurrentTrackFor:S,getInitialSettings:T,getTracksFor:x,getTracksWithHighestSelectionPriority:R,getTracksWithHighestBitrate:z,getTracksWithHighestEfficiency:B,getTracksWithWidestRange:V,initialize:function(){t.on(g.default.REPRESENTATION_SWITCH,b,n)},isCurrentTrack:function(e){if(!e)return!1;let t=e.type,n=e.streamInfo.id;return i[n]&&i[n][t]&&E(i[n][t].current,e)},matchSettings:function(e,t,n=!1){try{let r=!1;if(e.lang){if(e.lang instanceof RegExp)r=t.lang.match(e.lang);else if(t.lang!==``){let n=fi(e.lang);n&&(r=ii(t.lang,n).length>0)}}else r=!0;let i=e.index===void 0||e.index===null||t.index===e.index,o=!e.viewpoint||!!t.viewpoint.filter((function(t){return G(t,e.viewpoint)}))[0],c=!e.role||!!t.roles.filter((function(t){return G(t,e.role)}))[0],l=!e.accessibility||!!t.accessibility.filter((function(t){return G(t,e.accessibility)}))[0],u=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return G(t,e.audioChannelConfiguration)}))[0];return r&&i&&o&&(c||t.type===h.default.AUDIO&&n)&&l&&u}catch{return!1}},matchSettingsAccessibility:F,matchSettingsAudioChannelConfig:I,matchSettingsIndex:A,matchSettingsLang:k,matchSettingsRole:N,matchSettingsViewPoint:M,reset:D,saveTextSettingsDisabled:function(){y.setSavedMediaSettings(h.default.TEXT,null)},selectInitialTrack:H,setConfig:function(e){e&&(e.domStorage&&(y=e.domStorage),e.settings&&(o=e.settings),e.customParametersModel&&(f=e.customParametersModel),e.mediaPlayerModel&&(_=e.mediaPlayerModel),e.videoModel&&(v=e.videoModel))},setInitialMediaSettingsForType:function(e,t){let n=u[e]||T(e),i=x(e,t.id),c=[];n&&Object.keys(n).length!==0||(n=y.getSavedMediaSettings(e),n&&delete n.codec,w(e,n)),i&&i.length!==0&&(c=o.get().streaming.includePreselectionsForInitialTrackSelection?Array.from(i):i.filter((e=>!e.isPreselection)),n&&(r.info(`Filtering `+c.length+` `+e+` tracks based on settings`),c=O(c,j,n),c=O(c,k,n),c=O(c,A,n),c=O(c,M,n),e===h.default.AUDIO&&u[e]||(c=O(c,N,n)),c=O(c,F,n),c=O(c,I,n),c=O(c,L,n),r.info(`Filtering `+e+` tracks ended, found `+c.length+` matching track(s).`)),c.length>1?C(H(e,c)):C(c[0]))},setInitialSettings:w,setTrack:C},r=(0,l.default)(e).getInstance().getLogger(n),D(),n}Da.__dashjs_factory_name=`MediaController`;let Oa=i.default.getSingletonFactory(Da);i.default.updateSingletonFactory(Da.__dashjs_factory_name,Oa);var ka=Oa;function Aa(){let e,t,n,r,i=this.context,o=(0,u.default)(i).getInstance();function c(e,n){return isNaN(e)?0:e>0?(n&&t.warn(`Supplied minimum playback rate is a positive value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed.`),0):e<-.5?(n&&t.warn(`Supplied minimum playback rate is out of range and will be limited to -0.5: -50% playback speed.`),-.5):e}function d(e,n){return isNaN(e)?0:e<0?(n&&t.warn(`Supplied maximum playback rate is a negative value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed.`),0):e>1?(n&&t.warn(`Supplied maximum playback rate is out of range and will be limited to 1: 200% playback speed.`),1):e}function f(){let e=p(),t=n.getLiveDelay();return!isNaN(t)&&t>0?Math.min(e,t):e}function p(){return o.get().streaming.buffer.bufferTimeDefault>0?o.get().streaming.buffer.bufferTimeDefault:m()?20:12}function m(){return o.get().streaming.buffer.fastSwitchEnabled===null?!n.getLowLatencyModeEnabled():o.get().streaming.buffer.fastSwitchEnabled}return e={getAbrBitrateParameter:function(e,t){try{let n=o.get().streaming.abr[e][t];if(!isNaN(n)&&n!==-1)return n;let i=r.getServiceDescriptionSettings();return i&&i[e]&&!isNaN(i[e][t])?i[e][t]:-1}catch{return-1}},getBufferTimeDefault:f,getBufferTimeDefaultUnadjusted:p,getCatchupMaxDrift:function(){if(!isNaN(o.get().streaming.liveCatchup.maxDrift)&&o.get().streaming.liveCatchup.maxDrift>=0)return o.get().streaming.liveCatchup.maxDrift;let e=r.getServiceDescriptionSettings();return e&&e.liveCatchup&&!isNaN(e.liveCatchup.maxDrift)&&e.liveCatchup.maxDrift>=0?e.liveCatchup.maxDrift:12},getCatchupModeEnabled:function(){return o.get().streaming.liveCatchup.enabled===null?n.getInitialCatchupModeActivated():o.get().streaming.liveCatchup.enabled},getCatchupPlaybackRates:function(e){let t=o.get().streaming.liveCatchup.playbackRate;if(!isNaN(t.min)||!isNaN(t.max))return{min:c(t.min,e),max:d(t.max,e)};let n=r.getServiceDescriptionSettings();if(n&&n.liveCatchup&&(!isNaN(n.liveCatchup.playbackRate.min)||!isNaN(n.liveCatchup.playbackRate.max))){let t=n.liveCatchup.playbackRate;return{min:c(t.min,e),max:d(t.max,e)}}return{min:-.5,max:.5}},getFastSwitchEnabled:m,getInitialBufferLevel:function(){let e=o.get().streaming.buffer.initialBufferLevel;return isNaN(e)||e<0?0:Math.min(f(),e)},getRetryAttemptsForType:function(e){let t=isNaN(o.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:o.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return n.getLowLatencyModeEnabled()?o.get().streaming.retryAttempts[e]*t:o.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){let t=isNaN(o.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:o.get().streaming.retryIntervals.lowLatencyReductionFactor;return n.getLowLatencyModeEnabled()?o.get().streaming.retryIntervals[e]/t:o.get().streaming.retryIntervals[e]},getScheduleTimeout:function(){return n.getLowLatencyModeEnabled()?o.get().streaming.scheduling.lowLatencyTimeout:o.get().streaming.scheduling.defaultTimeout},reset:function(){},setConfig:function(e){e.playbackController&&(n=e.playbackController),e.serviceDescriptionController&&(r=e.serviceDescriptionController)}},t=(0,l.default)(i).getInstance().getLogger(e),e}Aa.__dashjs_factory_name=`MediaPlayerModel`;var ja=i.default.getSingletonFactory(Aa);function Ma(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i,o,u,d,f,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N;function P(){R(),w=!1,y=0,C=0,r=0,S=!1,x=!1,o=!1,E=NaN,v=NaN,M&&(t.off(m.default.DATA_UPDATE_COMPLETED,ie,u),t.off(m.default.MANIFEST_UPDATED,Ee,u),t.off(m.default.STREAMS_COMPOSED,De,u),t.off(g.default.PLAYBACK_ENDED,be,u),t.off(g.default.STREAM_INITIALIZING,we,u),t.off(g.default.REPRESENTATION_SWITCH,Te,u),t.off(g.default.BUFFER_LEVEL_STATE_CHANGED,oe,u),re(),M.removeEventListener(`canplay`,J),M.removeEventListener(`canplaythrough`,ae),M.removeEventListener(`ended`,ve),M.removeEventListener(`error`,xe),M.removeEventListener(`loadeddata`,_e),M.removeEventListener(`loadedmetadata`,ge),M.removeEventListener(`pause`,ue),M.removeEventListener(`play`,se),M.removeEventListener(`playing`,le),M.removeEventListener(`progress`,me),M.removeEventListener(`ratechange`,he),M.removeEventListener(`seeked`,fe),M.removeEventListener(`seeking`,de),M.removeEventListener(`stalled`,Ce),M.removeEventListener(`timeupdate`,pe),M.removeEventListener(`volumechange`,ye),M.removeEventListener(`waiting`,ce)),N=null,M=null,A=null,f=null}function F(e=null){return parseFloat((I(e)-H()).toFixed(5))}function I(e){let t=e||A;return t.start+t.duration}function L(e=!1){A&&M&&M.getElement()?(e&&f&&V(H()),M.play()):w=!0}function R(){A&&M&&M.pause()}function z(e,t=!1,n=!1,r=!1){A&&M&&M.getElement()&&e!==(isNaN(E)?M.getTime():E)&&(d=!0===n,d||(E=e),b.info(`Requesting seek to time: `+e+(d?` (internal)`:``)),f&&r&&V(e),M.setCurrentTime(e,t))}function B(){if(!A||!M||!f)return;let e=k&&k.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,t=i.getCurrentDVRInfo(e);return t&&t.range?t.range.end:0}function V(e){let t=new Date(j.getClientReferenceTime()),r=n.getRegularPeriods()[0];y=j.calcPresentationTimeFromWallTime(t,r)-e}function H(){return A&&M?M.getTime():null}function U(){return A&&M?M.isPaused():null}function W(){return A&&M?M.isSeeking():null}function G(){return A&&M?M.isStalled():null}function K(){return A&&M?M.getPlaybackRate():null}function ee(){return A&&M?M.getEnded():null}function q(){return f}function te(e=null){if(U()||!f||M.getReadyState()===0||W()||S)return;e||=k.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let t=H(),n=function(e,t){let n=i.getCurrentDVRInfo(t),r=n?n.range:null,o;return r?(o=e>r.end?Math.max(r.end-y,r.start):e>0&&e+.25<r.start&&Math.abs(e-r.start)<31536e4?x?Math.max(r.end-y,r.start):r.start:e,o):NaN}(t,e);!isNaN(n)&&n!==t&&!W()&&(G()||T||M.getReadyState()===1)&&(b.debug(`UpdateCurrentTime: Seek to actual time: ${n} from currentTime: ${t}`),z(n,!1,!1))}function ne(){N===null&&(N=setInterval((()=>{(function(){if(t.trigger(m.default.WALLCLOCK_TIME_UPDATED,{isDynamic:f,time:new Date}),q()){let e=Date.now();(isNaN(v)||e>v+O.get().streaming.liveUpdateTimeThresholdInMilliseconds)&&(k.addDVRMetric(),U()?function(){let e=Date.now();(!_||e>_+500)&&(_=e,pe())}():te(),v=e)}})()}),O.get().streaming.wallclockTimeUpdateInterval))}function re(){clearInterval(N),N=null}function ie(e){let t=e.currentRepresentation,n=t?t.mediaInfo.streamInfo:null;n!==null&&A.id===n.id&&(A=n)}function J(){t.trigger(m.default.CAN_PLAY)}function ae(){t.trigger(m.default.CAN_PLAY_THROUGH)}function oe(e){e.streamId===k.getActiveStreamInfo().id&&(T=e.state===c.BUFFER_EMPTY,O.get().streaming.buffer.setStallState&&M.setStallState(e.mediaType,e.state===c.BUFFER_EMPTY))}function se(){b.info(`Native video element event: play`),te(),ne(),t.trigger(m.default.PLAYBACK_STARTED,{startTime:H()})}function ce(){b.info(`Native video element event: waiting`),t.trigger(m.default.PLAYBACK_WAITING,{playingTime:H()})}function le(){b.info(`Native video element event: playing`),d=!1,t.trigger(m.default.PLAYBACK_PLAYING,{playingTime:H()})}function ue(){b.info(`Native video element event: pause`),t.trigger(m.default.PLAYBACK_PAUSED,{ended:ee()})}function de(){if(d)return;let e=H();isNaN(E)||E===e||(e=E),E=NaN,b.info(`Seeking to: `+e),ne(),t.trigger(m.default.PLAYBACK_SEEKING,{seekTime:e,streamId:A.id})}function fe(){b.info(`Native video element event: seeked`),d=!1,t.trigger(m.default.PLAYBACK_SEEKED,{streamId:A.id})}function pe(){A&&t.trigger(m.default.PLAYBACK_TIME_UPDATED,{timeToEnd:F(),time:H(),streamId:A.id})}function me(){t.trigger(m.default.PLAYBACK_PROGRESS,{streamId:A.id})}function he(){let e=K();b.info(`Native video element event: ratechange: `,e),t.trigger(m.default.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function ge(){b.info(`Native video element event: loadedmetadata`),t.trigger(m.default.PLAYBACK_METADATA_LOADED),ne()}function _e(){b.info(`Native video element event: loadeddata`),t.trigger(m.default.PLAYBACK_LOADED_DATA)}function ve(){b.info(`Native video element event: ended`),R(),re();let e=k?k.getActiveStreamInfo():null;e&&t.trigger(m.default.PLAYBACK_ENDED,{isLast:e.isLast})}function ye(){t.trigger(m.default.PLAYBACK_VOLUME_CHANGED)}function be(e){if(N&&e.isLast){b.info(`onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended`);let t=e.seekTime?e.seekTime:I();M.setCurrentTime(t),R(),re()}}function xe(e){let n=e.target||e.srcElement;t.trigger(m.default.PLAYBACK_ERROR,{error:n.error})}function Se(){f=!1}function Ce(e){t.trigger(m.default.PLAYBACK_STALLED,{e})}function we(e){var t;(t=e.mediaInfo)&&t.supplementalProperties&&t.supplementalProperties.find((e=>e.schemeIdUri===h.default.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME))&&(b.debug(`Low Latency critical SupplementalProperty set: Enabling low Latency`),x=!0)}function Te(e){let t=k.getActiveStreamInfo();e&&t&&e.currentRepresentation&&e.streamId&&e.streamId===t.id&&e.mediaType&&(e.mediaType===h.default.VIDEO||e.mediaType===h.default.AUDIO)&&(x=!1===e.currentRepresentation.availabilityTimeComplete,x&&!o&&(o=!0))}function Ee(){S=!0}function De(){S=!1}return u={computeAndSetLiveDelay:function(e,t){let i,o,c,l=!isNaN(e)&&isFinite(e)?e:NaN,u=n.getSuggestedPresentationDelay(),d=D.getServiceDescriptionSettings();return i=isNaN(O.get().streaming.delay.liveDelay)?O.get().streaming.delay.liveDelayFragmentCount===null||isNaN(O.get().streaming.delay.liveDelayFragmentCount)||isNaN(l)?d&&!isNaN(d.liveDelay)&&d.liveDelay>0?d.liveDelay:!0===O.get().streaming.delay.useSuggestedPresentationDelay&&u!==null&&!isNaN(u)&&u>0?u:isNaN(l)?t&&!isNaN(t.minBufferTime)?4*t.minBufferTime:4*A.manifestInfo.minBufferTime:4*l:l*O.get().streaming.delay.liveDelayFragmentCount:O.get().streaming.delay.liveDelay,c=n.getAvailabilityStartTime(),c!==null&&(r=c),o=t&&t.dvrWindowSize>0?Math.min(i,t.dvrWindowSize):i,y=o,C=o,o},getAvailabilityStartTime:function(){return r},getBufferLevel:function(e=null){let t=null;return k.getActiveStreamProcessors().forEach((n=>{if(!e||e.length===0||e.indexOf(n.getType())===-1){let e=n.getBufferLevel();t=t===null?e:Math.min(t,e)}})),t},getCurrentLiveLatency:function(){if(!f||isNaN(r))return NaN;let e=H();if(isNaN(e)||e===0)return 0;let t=new Date().getTime()+1e3*j.getClientTimeOffset();return Math.max(((t-r-1e3*e)/1e3).toFixed(3),0)},getEnded:ee,getInitialCatchupModeActivated:function(){return o},getIsDynamic:q,getIsManifestUpdateInProgress:function(){return S},getLiveDelay:function(){return y},getLowLatencyModeEnabled:function(){return x},getOriginalLiveDelay:function(){return C},getPlaybackRate:K,getPlaybackStalled:function(){return T},getPlayedRanges:function(){return A&&M?M.getPlayedRanges():null},getStreamController:function(){return k},getStreamEndTime:I,getTime:H,getTimeToStreamEnd:F,initialize:function(e,n){A=e,!0!==n&&(M.addEventListener(`canplay`,J),M.addEventListener(`canplaythrough`,ae),M.addEventListener(`ended`,ve),M.addEventListener(`error`,xe),M.addEventListener(`loadeddata`,_e),M.addEventListener(`loadedmetadata`,ge),M.addEventListener(`pause`,ue),M.addEventListener(`play`,se),M.addEventListener(`playing`,le),M.addEventListener(`progress`,me),M.addEventListener(`ratechange`,he),M.addEventListener(`seeked`,fe),M.addEventListener(`seeking`,de),M.addEventListener(`stalled`,Ce),M.addEventListener(`timeupdate`,pe),M.addEventListener(`volumechange`,ye),M.addEventListener(`waiting`,ce),f=A.manifestInfo.isDynamic,T=!1,d=!1,t.on(m.default.DATA_UPDATE_COMPLETED,ie,u),t.on(m.default.MANIFEST_UPDATED,Ee,u),t.on(m.default.STREAMS_COMPOSED,De,u),t.on(g.default.PLAYBACK_ENDED,be,u,{priority:p.default.EVENT_PRIORITY_HIGH}),t.on(g.default.STREAM_INITIALIZING,we,u),t.on(g.default.REPRESENTATION_SWITCH,Te,u),t.on(g.default.BUFFER_LEVEL_STATE_CHANGED,oe,u),t.on(g.default.DYNAMIC_TO_STATIC,Se,u),w&&(w=!1,L()))},isPaused:U,isProgressing:function(e=500){return new Promise((n=>{let r=-1,i=null,o=e=>{clearTimeout(i),i=null,t.off(g.default.PLAYBACK_TIME_UPDATED,c,u),n(e)},c=e=>{r<0?r=e.time:e.time>r+.1&&o(!0)};i=setTimeout((()=>{o(!1)}),e),t.on(g.default.PLAYBACK_TIME_UPDATED,c,u)}))},isSeeking:W,isStalled:G,pause:R,play:L,reset:P,seek:z,seekToCurrentLive:function(e=!1,t=!1,n=!1){let r=B();r!==0&&z(r-y,e,t,n)},seekToOriginalLive:function(e=!1,t=!1,n=!1){let r=B();r!==0&&(y=C,z(r-y,e,t,n))},setConfig:function(e){e&&(e.streamController&&(k=e.streamController),e.serviceDescriptionController&&(D=e.serviceDescriptionController),e.dashMetrics&&(i=e.dashMetrics),e.adapter&&(n=e.adapter),e.videoModel&&(M=e.videoModel),e.timelineConverter&&(j=e.timelineConverter),e.settings&&(O=e.settings))},updateCurrentTime:te},b=(0,l.default)(e).getInstance().getLogger(u),P(),u}Ma.__dashjs_factory_name=`PlaybackController`;var Na=i.default.getSingletonFactory(Ma),Pa=class{constructor(){this.availabilityEndTime=NaN,this.availabilityStartTime=NaN,this.duration=NaN,this.index=null,this.indexRange=null,this.isPartialSegment=!1,this.media=null,this.mediaRange=null,this.mediaUrl=null,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.replacementNumber=NaN,this.replacementTime=null,this.representation=null,this.wallStartTime=NaN}assignAttributes(e){for(let t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&(this[t]=e[t])}},Fa=class extends Pa{constructor(){super()}};function Ia(){let e=this.context,t,n,r,i,o,c,l,u,d,f,p,m;function h(e,t,r,o){let c=null,u=e?m.resolve(e.path):null,d=o||{init:!0,url:u?u.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:t,representation:e};n.debug(`Start searching for initialization.`);let f=v(d);l.load({request:f,success:function(n){if(d.bytesLoaded=d.range.end,c=i.findInitRange(n),!c)return d.range.end=d.bytesLoaded+d.bytesToLoad,h(e,t,r,d);e.range=c,r(e)},error:function(){r(e)}}),n.debug(`Perform init search: `+d.url)}function g(e,t,r,o,c,u){if(r&&(r.start===void 0||r.end===void 0)){let e=r?r.toString().split(`-`):null;r=e?{start:parseFloat(e[0]),end:parseFloat(e[1])}:null}c||=_;let d=null,f=null,p=!!r,h=e?m.resolve(e.path):null,y={init:!1,url:h?h.url:void 0,range:p?r:{start:0,end:1500},searching:!p,bytesLoaded:u?u.bytesLoaded:0,bytesToLoad:1500,mediaType:t,representation:e},b=v(y);l.load({request:b,success:function(r){let l=y.bytesToLoad,u=r.byteLength;if(y.bytesLoaded=y.range.end-y.range.start,d=i.parse(r),f=d.getBox(`sidx`),f&&f.isComplete){let r=f.references,i,l;if(r!=null&&r.length>0&&(i=r[0].reference_type===1),i){let i,l,u,d,p;n.debug(`Initiate multiple SIDX load.`),y.range.end=y.range.start+f.size;let m=[],h=0,_=(f.offset||y.range.start)+f.size,v=function(t){t?(m=m.concat(t),h++,h>=l&&(m.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),c(m,e,o))):c(null,e,o)};for(i=0,l=r.length;i<l;i++)u=_,d=_+r[i].referenced_size-1,_+=r[i].referenced_size,p={start:u,end:d},g(e,t,p,o,v,y)}else n.debug(`Parsing segments from SIDX. representation `+t+` - id: `+e.id+` for range : `+y.range.start+` - `+y.range.end),l=function(e,t){let n=e.references,r=n.length,i=e.timescale,o=e.earliest_presentation_time,c=t.range.start+e.offset+e.first_offset+e.size,l=[],u,d,f,p;for(let e=0;e<r;e++)f=n[e].subsegment_duration,p=n[e].referenced_size,u=new Fa,u.duration=f,u.startTime=o,u.timescale=i,d=c+p-1,u.mediaRange=c+`-`+d,l.push(u),o+=f,c+=p;return l}(f,y),c(l,e,o)}else{if(f)y.range.start=f.offset||y.range.start,y.range.end=y.range.start+(f.size||l);else{if(u<y.bytesLoaded)return void c(null,e,o);{let e=d.getLastBox();e&&e.size?(y.range.start=e.offset+e.size,y.range.end=y.range.start+l):y.range.end+=l}}g(e,t,y.range,o,null,y)}},error:function(){c(null,e,o)}}),n.debug(`Perform SIDX load for type ${t} : ${y.url} with range ${y.range.start} - ${y.range.end}`)}function _(e,t,n){n({segments:e,representation:t,error:e?void 0:new Be.default(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function v(e){if(!e.url)return;let t=new ne;return t.setInfo(e),t}return t={setConfig:function(e){e.baseURLController&&(m=e.baseURLController),e.dashMetrics&&(o=e.dashMetrics),e.mediaPlayerModel&&(c=e.mediaPlayerModel),e.errHandler&&(r=e.errHandler),e.boxParser&&(i=e.boxParser),e.debug&&(n=e.debug.getLogger(t)),e.errors&&(u=e.errors),e.urlUtils&&(p=e.urlUtils),e.constants&&(d=e.constants),e.dashConstants&&(f=e.dashConstants)},initialize:function(){l=or(e).create({errHandler:r,dashMetrics:o,mediaPlayerModel:c,boxParser:i,errors:u,urlUtils:p,constants:d,dashConstants:f})},loadInitialization:function(e,t){return new Promise((n=>{h(e,t,n)}))},loadSegments:function(e,t,n){return new Promise((r=>{g(e,t,n,r)}))},reset:function(){l&&=(l.abort(),null)}},t}Ia.__dashjs_factory_name=`SegmentBaseLoader`;var La=i.default.getSingletonFactory(Ia);function Ra(e){let t;e||={};let n=new DataView(e.data),r=0;function i(e,t){let i,o,c=!0,l=0;if(t===void 0&&(t=!1),e.tag>16777215?(n.getUint32(r)!==e.tag&&(c=!1),l=4):e.tag>65535?(i=n.getUint16(r),o=n.getUint8(r+2),256*i+o!==e.tag&&(c=!1),l=3):e.tag>255?(n.getUint16(r)!==e.tag&&(c=!1),l=2):(n.getUint8(r)!==e.tag&&(c=!1),l=1),!c&&e.required&&!t)throw Error(`required tag not found`);return c&&(r+=l),c}function o(e){let t=1,i=128,o=-1,c=0,l=n.getUint8(r),u=0;for(u=0;u<8;u+=1){if((l&i)===i){c=e===void 0?l&~i:l,o=u;break}i>>=1}for(u=0;u<o;u+=1,t+=1)c=c<<8|255&n.getUint8(r+t);return r+=t,c}return t={getPos:function(){return r},setPos:function(e){r=e},consumeTag:i,consumeTagAndSize:function(e,t){let n=i(e,t);return n&&o(),n},parseTag:function(e){let n;return i(e),n=o(),t[e.parse](n)},skipOverElement:function(e,t){let n,c=i(e,t);return c&&(n=o(),r+=n),c},getMatroskaCodedNum:o,getMatroskaFloat:function(e){let t;switch(e){case 4:t=n.getFloat32(r),r+=4;break;case 8:t=n.getFloat64(r),r+=8}return t},getMatroskaUint:function(e){if(e>4)return function(e){let t=Math.floor((2**53-1)/256),i=0;for(let o=0;o<e;o+=1){if(i>t)throw Error(`Value exceeds safe integer limit`);i*=256;let e=n.getUint8(r+o);if(i>2**53-1-e)throw Error(`Value exceeds safe integer limit`);i+=e}return r+=e,i}(e);let t=0;for(let i=0;i<e;i+=1)t<<=8,t|=255&n.getUint8(r+i);return r+=e,t>>>0},moreData:function(){return r<n.byteLength}},t}Ra.__dashjs_factory_name=`EBMLParser`;var za=i.default.getClassFactory(Ra);function Ba(){let e=this.context,t,n,r,i,o,c,l,u,d;function f(e){let t=new ne;return t.setInfo(e),t}return t={setConfig:function(e){if(!(e.baseURLController&&e.dashMetrics&&e.mediaPlayerModel&&e.errHandler))throw Error(h.default.MISSING_CONFIG_ERROR);d=e.baseURLController,o=e.dashMetrics,c=e.mediaPlayerModel,i=e.errHandler,u=e.errors,n=e.debug.getLogger(t)},initialize:function(){l=or(e).create({errHandler:i,dashMetrics:o,mediaPlayerModel:c,errors:u})},loadInitialization:function(e,t){return new Promise((r=>{let i=null,o=e?d.resolve(e.path):null,c=e?e.range.split(`-`):null,u={range:{start:c?parseFloat(c[0]):null,end:c?parseFloat(c[1]):null},request:i,url:o?o.url:void 0,init:!0,mediaType:t};n.info(`Start loading initialization.`),i=f(u),l.load({request:i,success:function(){r(e)},error:function(){r(e)}}),n.debug(`Perform init load: `+u.url)}))},loadSegments:function(t,i,o){return new Promise((c=>{let p=null,m=t?d.resolve(t.path):null,h=m?m.url:void 0;p=f({bytesLoaded:0,bytesToLoad:8192,range:{start:0,end:8192},request:p,url:h,init:!1,mediaType:i,representation:t}),n.debug(`Parsing ebml header`),l.load({request:p,success:function(i){(function(t,i,o,c){if(!t||t.byteLength===0)return void c(null);let u,d,p,m,h=za(e).create({data:t}),g=o?o.split(`-`):null,_=null,v={url:i,range:{start:g?parseFloat(g[0]):null,end:g?parseFloat(g[1]):null},request:_};for(n.debug(`Parse EBML header: `+v.url),h.skipOverElement(r.EBML),h.consumeTag(r.Segment),p=h.getMatroskaCodedNum(),p+=h.getPos(),m=h.getPos();h.moreData()&&!h.consumeTagAndSize(r.Segment.Info,!0);)if(!(h.skipOverElement(r.Segment.SeekHead,!0)||h.skipOverElement(r.Segment.Tracks,!0)||h.skipOverElement(r.Segment.Cues,!0)||h.skipOverElement(r.Void,!0)))throw Error(`no valid top level element found`);for(;u===void 0;){let e=h.getMatroskaCodedNum(!0),t=h.getMatroskaCodedNum();e===r.Segment.Info.Duration.tag?u=h[r.Segment.Info.Duration.parse](t):h.setPos(h.getPos()+t)}_=f(v),l.load({request:_,success:function(t){d=function(t,i,o,c){let l,u,d,f,p,m,h,g;for(u=function(t){let n,i,o=[],c=za(e).create({data:t});for(c.consumeTagAndSize(r.Segment.Cues);c.moreData()&&c.consumeTagAndSize(r.Segment.Cues.CuePoint,!0);){for(n={},n.CueTime=c.parseTag(r.Segment.Cues.CuePoint.CueTime),n.CueTracks=[];c.moreData()&&c.consumeTag(r.Segment.Cues.CuePoint.CueTrackPositions,!0);){let e=c.getMatroskaCodedNum(),t=c.getPos();if(i={},i.Track=c.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),i.Track===0)throw Error(`Cue track cannot be 0`);i.ClusterPosition=c.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),n.CueTracks.push(i),c.setPos(t+e)}if(n.CueTracks.length===0)throw Error(`Mandatory cuetrack not found`);o.push(n)}if(o.length===0)throw Error(`mandatory cuepoint not found`);return o}(t),d=[],p=0,m=u.length;p<m;p+=1)f=new Fa,l=0,l=p<u.length-1?u[p+1].CueTime-u[p].CueTime:c-u[p].CueTime,f.duration=l,f.startTime=u[p].CueTime,f.timescale=1e3,h=u[p].CueTracks[0].ClusterPosition+i,g=p<u.length-1?u[p+1].CueTracks[0].ClusterPosition+i-1:o-1,f.mediaRange=h+`-`+g,d.push(f);return n.debug(`Parsed cues: `+d.length+` cues.`),d}(t,m,p,u),c(d)},error:function(){n.error(`Download Error: Cues `+v.url),c(null)}}),n.debug(`Perform cues load: `+v.url+` bytes=`+v.range.start+`-`+v.range.end)})(i,h,o,(function(e){c({segments:e,representation:t,error:e?void 0:new Be.default(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}))},error:function(){c({representation:t,error:new Be.default(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}})}))},reset:function(){l&&=(l.abort(),null)}},r={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:`getMatroskaUint`},Duration:{tag:17545,required:!0,parse:`getMatroskaFloat`}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:`getMatroskaUint`},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:`getMatroskaUint`},CueClusterPosition:{tag:241,required:!0,parse:`getMatroskaUint`}}}}},Void:{tag:236,required:!0}},t}Ba.__dashjs_factory_name=`WebmSegmentBaseLoader`;var Va=i.default.getSingletonFactory(Ba);function Ha(e){e||={};let t=this.context,n=e.eventBus,r=e.events,i=e.dashMetrics,o=e.mediaPlayerModel,c=e.errHandler,l=e.baseURLController,u=e.debug,d=e.boxParser,f=e.errors,p,m,h;function g(e){return(e?e.split(`/`)[1]:``).toLowerCase()===`webm`}return p={initialize:function(){m.initialize(),h.initialize()},getSegmentBaseInitSegment:function(e){return g(e.representation.mimeType)?h.loadInitialization(e.representation,e.mediaType):m.loadInitialization(e.representation,e.mediaType)},getSegmentList:function(e){return g(e.mimeType)?h.loadSegments(e.representation,e.mediaType,e.representation?e.representation.indexRange:null):m.loadSegments(e.representation,e.mediaType,e.representation?e.representation.indexRange:null)},reset:function(){m.reset(),h.reset()}},m=La(t).getInstance(),h=Va(t).getInstance(),m.setConfig({baseURLController:l,dashMetrics:i,mediaPlayerModel:o,errHandler:c,eventBus:n,events:r,errors:f,debug:u,boxParser:d}),h.setConfig({baseURLController:l,dashMetrics:i,mediaPlayerModel:o,errHandler:c,eventBus:n,events:r,errors:f,debug:u}),p}Ha.__dashjs_factory_name=`SegmentBaseController`;var Ua=i.default.getSingletonFactory(Ha);let Wa=[h.default.SERVICE_DESCRIPTION_DVB_LL_SCHEME],Ga=`video`,Ka=`audio`;function qa(){let e=this.context,t,n,r,i,o;function c(){n={liveDelay:NaN,liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN}},minBitrate:{},maxBitrate:{},initialBitrate:{},contentSteering:null,clientDataReporting:null},r=[]}function u(e,t,r){try{n[e][t]=r/1e3}catch(e){i.error(e)}}return t={getServiceDescriptionSettings:function(){return n},getProducerReferenceTimeOffsets:function(){return r},calculateProducerReferenceTimeOffsets:function(e){try{let t=[];if(e&&e.length>0){let n=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT],r=o.getAvailabilityStartTime()/1e3;e.forEach((e=>{let i=n.reduce(((t,n)=>t.concat(o.getAllMediaInfoForType(e,n))),[]).reduce(((t,n)=>(o.getProducerReferenceTimes(e,n).forEach((i=>{let c=o.getVoRepresentations(n);if(c&&c.length>0&&c[0].adaptation&&c[0].segmentInfoType===Y.default.SEGMENT_TEMPLATE){let n=c[0],o=r-(new Date(i[Y.default.WALL_CLOCK_TIME]).getTime()/1e3-(i[Y.default.PRESENTATION_TIME]/n[Y.default.TIMESCALE]-n[Y.default.PRESENTATION_TIME_OFFSET]+e.start));t.push({id:i[Y.default.ID],to:o})}})),t)),[]);t=t.concat(i)}))}r=t}catch(e){i.error(e),r=[]}},applyServiceDescription:function(e){if(!e||!e.serviceDescriptions)return;let t=e.serviceDescriptions.filter((e=>Wa.includes(e.schemeIdUri))),o=e.serviceDescriptions.filter((e=>e.schemeIdUri==null)),c=t.length>0?t[t.length-1]:o[o.length-1];c&&(c.latency&&c.latency.target>0&&function(e){let t;if(e.schemeIdUri,h.default.SERVICE_DESCRIPTION_DVB_LL_SCHEME,t=function(e){return{liveDelay:e.latency.target/1e3,maxDrift:!isNaN(e.latency.max)&&e.latency.max>e.latency.target?(e.latency.max-e.latency.target+500)/1e3:NaN,referenceId:e.latency.referenceId||NaN}}(e),r.length>0){let{to:e,id:o}=function(e){let t,n=0,i=r.filter((t=>t.id===e.referenceId));return i.length===0?(n=r.length>0?r[0].to:0,t=r[0].id||NaN):(n=i[0].to||0,t=i[0].id||NaN),{to:n,id:t}}(t);n.liveDelay=t.liveDelay-e,n.liveCatchup.maxDrift=t.maxDrift,i.debug(`\n Found latency properties coming from service description. Applied time offset of ${e} from ProducerReferenceTime element with id ${o}.\n Live Delay: ${t.liveDelay-e}, Live catchup max drift: ${t.maxDrift}\n `)}else n.liveDelay=t.liveDelay,n.liveCatchup.maxDrift=t.maxDrift,i.debug(`Found latency properties coming from service description: Live Delay: ${t.liveDelay}, Live catchup max drift: ${t.maxDrift}`)}(c),c.playbackRate&&function(e){let t=e.playbackRate.min?Math.round(1e3*(e.playbackRate.min-1))/1e3:NaN,r=e.playbackRate.max?Math.round(1e3*(e.playbackRate.max-1))/1e3:NaN;n.liveCatchup.playbackRate.min=t,n.liveCatchup.playbackRate.max=r,i.debug(`Found latency properties coming from service description: Live catchup min playback rate: ${t}`),i.debug(`Found latency properties coming from service description: Live catchup max playback rate: ${r}`)}(c),c.operatingQuality,c.operatingBandwidth&&function(e){if(!e||!e.operatingBandwidth||!e.operatingBandwidth.mediaType||e.operatingBandwidth.mediaType===`all`)return;let t={};t.minBandwidth=e.operatingBandwidth.min,t.maxBandwidth=e.operatingBandwidth.max,t.targetBandwidth=e.operatingBandwidth.target;let n=[];e.operatingBandwidth.mediaType===Ga||e.operatingBandwidth.mediaType===Ka?n.push(e.operatingBandwidth.mediaType):e.operatingBandwidth.mediaType===`any`&&(n.push(Ka),n.push(Ga)),n.forEach((e=>{isNaN(t.minBandwidth)||u(`minBitrate`,e,t.minBandwidth),isNaN(t.maxBandwidth)||u(`maxBitrate`,e,t.maxBandwidth),isNaN(t.targetBandwidth)||u(`initialBitrate`,e,t.targetBandwidth)}))}(c),c.contentSteering&&function(e){n.contentSteering=e.contentSteering}(c),c.clientDataReporting&&function(e){n.clientDataReporting=e.clientDataReporting}(c))},reset:function(){c()},setConfig:function(e){e&&e.adapter&&(o=e.adapter)}},i=(0,l.default)(e).getInstance().getLogger(t),c(),t}qa.__dashjs_factory_name=`ServiceDescriptionController`;var Ja=i.default.getSingletonFactory(qa);class Ya{constructor(e){this._ranges=[];for(let t of e){let e=this._ranges,n={start:t.start,end:t.end},r=e.length?e[e.length-1]:null;!r||n.start>r.end?e.push(n):r.end=n.end}}get length(){return this._ranges.length}start(e){return this._ranges[e].start}end(e){return this._ranges[e].end}}var Xa=class{constructor(e,t){this.eventBus=t,this.mimeType=e,this.updating=!1,this.chunks=[],this.appendWindowStart=0,this.appendWindowEnd=1/0,this.timestampOffset=0,this.mode=`segments`}appendBuffer(e,t,n){if(this.updating)throw Error(`SourceBuffer is currently updating`);this.updating=!0,this.eventBus.trigger(`externalSourceBufferUpdateStart`,{mimeType:this.mimeType,request:`appendBuffer`,data:e,start:t,end:n}),Number.isNaN(t)||(this.chunks.push({data:e,start:t,end:n}),this.chunks.sort(((e,t)=>e.start-t.start))),setTimeout((()=>{this.updating=!1,this.eventBus.trigger(`externalSourceBufferUpdating`,{mimeType:this.mimeType}),this.eventBus.trigger(`externalSourceBufferUpdateEnd`,{mimeType:this.mimeType})}),10)}abort(){this.updating&&(this.updating=!1,this.eventBus.trigger(`externalSourceBufferAbort`,{mimeType:this.mimeType}),this.eventBus.trigger(`externalSourceBufferUpdateEnd`,{mimeType:this.mimeType}))}remove(e,t){if(this.updating)throw Error(`SourceBuffer is currently updating`);this.updating=!0,this.eventBus.trigger(`externalSourceBufferUpdateStart`,{mimeType:this.mimeType,request:`remove`,start:e,end:t}),this.chunks=this.chunks.filter((n=>n.end<=e||n.start>=t)),setTimeout((()=>{this.updating=!1,this.eventBus.trigger(`externalSourceBufferUpdating`,{mimeType:this.mimeType}),this.eventBus.trigger(`externalSourceBufferUpdateEnd`,{mimeType:this.mimeType})}),10)}get buffered(){return new Ya(this.chunks)}},Za=class{constructor(e){this.eventBus=e,this.reset()}get duration(){return this._duration}set duration(e){if(this._readyState!==`open`)throw Error(`ExternalMediaSource is not open`);this._duration=e}get readyState(){return this._readyState}addSourceBuffer(e){if(this._readyState!==`open`)throw Error(`ExternalMediaSource is not open`);let t=new Xa(e,this.eventBus);return this.sourceBuffers.set(t,e),t}removeSourceBuffer(e){if(!this.sourceBuffers.has(e))throw Error(`ExternalSourceBuffer not found`);this.sourceBuffers.delete(e)}open(){this._readyState=`open`,this.eventBus.trigger(`externalMediaSourceOpen`,{})}endOfStream(){if(this._readyState!==`open`)throw Error(`ExternalMediaSource is not open`);this._readyState=`ended`,this.eventBus.trigger(`externalMediaSourceEnded`,{})}close(){this._readyState=`closed`,this.eventBus.trigger(`externalMediaSourceClosed`,{})}reset(){this.sourceBuffers=new Map,this._duration=NaN,this._readyState=`closed`}},Qa=class{constructor(){this.streamId=null,this.segmentType=null,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representation=null,this.endFragment=null}},$a=class extends ne{constructor(e){super(e),this.checkForExistenceOnly=!0}};function eo(e){e||={};let t=this.context,n=e.eventBus,r=e.events,i=e.urlUtils,o=e.errors,c=e.streamId,l,u;return l={abort:function(){u&&u.abort()},checkForExistence:function(e){let t=function(t){n.trigger(r.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){let n=new $a(e.url);u.load({request:n,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){let t=function(t,i){n.trigger(r.LOADING_COMPLETED,{request:e,response:t||null,error:i||null,sender:l})};e?u.load({request:e,progress:function(t){n.trigger(r.LOADING_PROGRESS,{request:e,stream:t.stream,streamId:c}),t.data&&n.trigger(r.LOADING_DATA_PROGRESS,{request:e,response:t.data||null,error:null,sender:l})},success:function(e){t(e)},error:function(e,n,r){t(void 0,new Be.default(o.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,r,n))},abort:function(e){e&&n.trigger(r.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:l})}}):t(void 0,new Be.default(o.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,o.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},reset:function(){u&&=(u.abort(),u.reset(),null)},resetInitialSettings:function(){u&&u.resetInitialSettings()}},u=or(t).create({errHandler:e.errHandler,errors:o,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,urlUtils:i,constants:h.default,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),l}eo.__dashjs_factory_name=`FragmentLoader`;var to=i.default.getClassFactory(eo);function no(e){e||={};let t=this.context,n=(0,p.default)(t).getInstance(),r=e.errHandler,i=e.mediaPlayerModel,o=e.dashMetrics,c=(0,l.default)(t).getInstance(),u=e.streamInfo,d,f,_;function v(){return u.id}function y(){for(let e in _)_[e].reset();_={}}function b(e){if(!e.sender)return;let t=e.request,r=e.response,i=t.isInitializationRequest(),o=t.representation.mediaInfo.streamInfo;if(e.error&&(t.mediaType===h.default.AUDIO||t.mediaType===h.default.VIDEO||t.mediaType===h.default.TEXT&&t.representation.mediaInfo.isFragmented)&&n.trigger(m.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD,{entry:e.request.serviceLocation}),!r||!o)return void f.warn(`No `+t.mediaType+` bytes to push or stream is inactive.`);let c=function(e,t,n,r){let i=new Qa;return i.streamId=n,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.representation=t.representation,i.endFragment=r,i}(r,t,u.id,e.type!==m.default.FRAGMENT_LOADING_PROGRESS);n.trigger(i?m.default.INIT_FRAGMENT_LOADED:m.default.MEDIA_FRAGMENT_LOADED,{chunk:c,request:t},{streamId:o.id,mediaType:t.mediaType})}return d={getStreamId:v,getModel:function(l){let d=_[l];return d||(d=se(t).create({streamInfo:u,type:l,dashMetrics:o,fragmentLoader:to(t).create({dashMetrics:o,mediaPlayerModel:i,errHandler:r,settings:e.settings,boxParser:e.boxParser,eventBus:n,events:m.default,errors:Ne,dashConstants:e.dashConstants,urlUtils:e.urlUtils,streamId:v()}),debug:c,eventBus:n,events:m.default}),_[l]=d),d},reset:function(){n.off(g.default.FRAGMENT_LOADING_COMPLETED,b,this),n.off(g.default.FRAGMENT_LOADING_PROGRESS,b,this),y()}},f=c.getLogger(d),y(),n.on(g.default.FRAGMENT_LOADING_COMPLETED,b,d),n.on(g.default.FRAGMENT_LOADING_PROGRESS,b,d),d}no.__dashjs_factory_name=`FragmentController`;var ro=i.default.getClassFactory(no),io=class{constructor(e){this.newMediaInfo=e.newMediaInfo,this.previouslySelectedRepresentation=e.previouslySelectedRepresentation,this.newRepresentation=e.newRepresentation}};function ao(e){let t=this.context,n=(0,u.default)(t).getInstance(),r=e.textController,i=e.eventBus,o,c,d,f,p,g,_=[],v=[],y=!1,b=e.mediaSource,x=null;function S(e){return e.mimeType+`;codecs="`+e.codecs+`"`}function C(e){return f=r.getTextSourceBuffer(e),Promise.resolve()}function w(){if(typeof f.addEventListener==`function`)try{f.addEventListener(`updateend`,j,!1),f.addEventListener(`error`,M,!1),f.addEventListener(`abort`,M,!1)}catch{g=setInterval(j,50)}else g=setInterval(j,50)}function E(){try{typeof f.removeEventListener==`function`&&(f.removeEventListener(`updateend`,j,!1),f.removeEventListener(`error`,M,!1),f.removeEventListener(`abort`,M,!1)),clearInterval(g)}catch(e){d.error(e)}}function D(e){return new Promise((t=>{f&&n.get().streaming.buffer.useAppendWindow?N((()=>{try{if(!f)return void t();let n=b.duration,r=0;e&&!isNaN(e.start)&&!isNaN(e.duration)&&isFinite(e.duration)&&(n=e.start+e.duration),e&&!isNaN(e.start)&&(r=e.start),f.appendWindowEnd===n&&f.appendWindowStart===r||(f.appendWindowStart=0,f.appendWindowEnd=n+.01,f.appendWindowStart=Math.max(r-.1,0),d.debug(`Updated append window for ${p.type}. Set start to ${f.appendWindowStart} and end to ${f.appendWindowEnd}`)),t()}catch{d.warn(`Failed to set append window`),t()}})):t()}))}function O(e){return new Promise((t=>{f?N((()=>{try{f.timestampOffset===e||isNaN(e)||(f.timestampOffset=e,d.debug(`Set MSE timestamp offset to ${e}`)),t()}catch{t()}})):t()}))}function k(){if(!y&&v.length>0){y=!0;let e=v[0];v.splice(0,1);let t=function(){y=!1,v.length>0&&k.call(this),e&&e.data&&e.data.segmentType&&e.data.segmentType!==T.HTTPRequest.INIT_SEGMENT_TYPE&&delete e.data.bytes,e.promise.resolve({chunk:e.data})};try{if(x=e.request,e.data.bytes.byteLength===0)t.call(this);else{try{d.debug(`Appending ${e.data.segmentType} from period ${e.data.streamId} to buffer. Request URL: ${e.request.url}, Representation: ID: ${e.data.representation.id}, bitrate: ${e.data.representation.bitrateInKbit}`)}catch{}f instanceof Xa?f.appendBuffer(e.data.bytes,e.data.start,e.data.end):f.appendBuffer?f.appendBuffer(e.data.bytes):f.append(e.data.bytes,e.data),N(t.bind(this))}}catch(t){d.fatal(`SourceBuffer append failed "`+t+`"`),v.length>0?k():y=!1,delete e.data.bytes,e.promise.reject({chunk:e.data,error:new Be.default(t.code,t.message)})}}}function A(){_.length>0&&!f.updating&&(_.shift()(),A())}function j(){f.updating||A()}function M(e){let t=e.target||{};(function(e,t){let n=t||{};i.trigger(e,n,{streamId:p.streamInfo.id,mediaType:c})})(m.default.SOURCE_BUFFER_ERROR,{error:t,lastRequestAppended:x})}function N(e){try{_.push(e),f&&!f.updating&&A()}catch(e){d.error(e)}}return o={abort:function(){return new Promise((e=>{try{v=[],b.readyState===`open`?N((()=>{try{f&&f.abort(),e()}catch{e()}})):(f&&f.setTextTrack&&b.readyState===`ended`&&f.abort(),e())}catch{e()}}))},abortBeforeAppend:function(){return new Promise((e=>{N((()=>{let t=f.appendWindowStart,n=f.appendWindowEnd;f&&(f.abort(),f.appendWindowStart=t,f.appendWindowEnd=n),e()}))}))},append:function(e,t=null){return new Promise(((n,r)=>{e?(v.push({data:e,promise:{resolve:n,reject:r},request:t}),N(k.bind(this))):r({chunk:e,error:new Be.default(Ne.APPEND_ERROR_CODE,Ne.APPEND_ERROR_MESSAGE)})}))},changeType:function(e){let t=S(e);return new Promise((e=>{N((()=>{f.changeType&&(d.debug(`Changing SourceBuffer codec to ${t}`),f.changeType(t)),e()}))}))},getAllBufferRanges:function(){try{return f?.buffered}catch(e){return d.error(`getAllBufferRanges exception: `+e.message),null}},getBuffer:function(){return f},getType:function(){return c},initializeForFirstUse:function(e,t){p=e;let n=e.streamInfo;c=p.type;let r=t?S(t):e.codec;try{if(r.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))return C(n);f=b.addSourceBuffer(r),w();let e=[];return e.push(D(p.streamInfo)),t&&t.mseTimeOffset!==void 0&&e.push(O(t.mseTimeOffset)),Promise.all(e)}catch(e){return p.type==h.default.TEXT&&!p.isFragmented||r.indexOf(`codecs="stpp`)!==-1||r.indexOf(`codecs="vtt`)!==-1||r.indexOf(`text/vtt`)!==-1?C(n):Promise.reject(e)}},initializeForStreamSwitch:function(e,t,n){p=e,c=p.type,function(e){f=e.getBuffer()}(n),w()},remove:function(e){return new Promise(((t,n)=>{let r=e.start,i=e.end;r>=0&&i>r?N((function(){try{f.remove(r,i),N((function(){t({from:r,to:i,unintended:!1}),e.resolve&&e.resolve()}))}catch(t){n({from:r,to:i,unintended:!1,error:new Be.default(Ne.REMOVE_ERROR_CODE,Ne.REMOVE_ERROR_MESSAGE)}),e.reject&&e.reject(t)}})):t()}))},removeEventListeners:E,reset:function(){if(f){try{_=[],E(),y=!1,v=[],f.getClassName&&f.getClassName()===`TextSourceBuffer`||(d.debug(`Removing sourcebuffer from media source`),b.removeSourceBuffer(f))}catch{}f=null}x=null},updateAppendWindow:D,updateTimestampOffset:O},d=(0,l.default)(t).getInstance().getLogger(o),o}ao.__dashjs_factory_name=`SourceBufferSink`;var oo=i.default.getClassFactory(ao);function so(e){let t=this.context,n,r,i,o=[],c=e;function u(e,t){return o=o.filter((n=>!((isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e)))),Promise.resolve()}return n={getAllBufferRanges:function(){let e=[];for(let t=0;t<o.length;t++){let n=o[t];e.length===0||n.start>e[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}let t={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(t,`length`,{get:function(){return e.length}}),t},append:function(e){return e.segmentType===`InitializationSegment`?i=e:(o.push(e),o.sort((function(e,t){return e.start-t.start})),i=null),r.debug(`PreBufferSink appended chunk s: `+e.start+`; e: `+e.end),c&&c({chunk:e}),Promise.resolve()},remove:u,abort:function(){return Promise.resolve()},discharge:function(e,t){let n=function(e,t){return o.filter((n=>(isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e)))}(e,t);return i&&=(n.push(i),null),u(e,t),n},reset:function(){o=[],i=null,c=null},updateTimestampOffset:function(){return Promise.resolve()},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},r=(0,l.default)(t).getInstance().getLogger(n),n}so.__dashjs_factory_name=`PreBufferSink`;var co=i.default.getClassFactory(so);function lo(){let e={};return{save:function(t){let n=t.streamId,r=t.representation.id;e[n]=e[n]||{},e[n][r]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}lo.__dashjs_factory_name=`InitCache`;var uo=i.default.getSingletonFactory(lo);let fo=.01,po=`BufferController`;function mo(e){let t=(e||={}).capabilities,n=this.context,r=(0,p.default)(n).getInstance(),i=e.fragmentModel,o=e.playbackController,u=e.representationController,d=e.settings,f=e.streamInfo,_=e.textController,v=e.type,y,b,x,S,C,w,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B;function V(e,t=null){return new Promise(((n,r)=>{w=e,O&&t&&typeof O.discharge==`function`?(k=O,H(t).then((()=>{n()})).catch((e=>{r(e)}))):n()}))}function H(e,t=new Map,i){return new Promise(((o,c)=>{L&&e?w?(A=!1,function(e,t,i){return new Promise((o=>{O=oo(n).create({mediaSource:w,textController:_,eventBus:r}),function(e,t,n){let r=u.getCurrentRepresentation(),i=null;return v!==h.default.VIDEO&&v!==h.default.AUDIO||(i=t.get(v)),i?function(e,t,n,r){O.initializeForStreamSwitch(e,t,n);let i=[];return i.push(O.abortBeforeAppend()),i.push(ve()),i.push(te(t,r)),t&&t.mseTimeOffset!==void 0&&i.push(_e(t)),Promise.allSettled(i)}(e,r,i,n):function(e,t){return O.initializeForFirstUse(e,t)}(e,r)}(e,t,i).then((()=>_e(u.getCurrentRepresentation()))).then((()=>{o(O)})).catch((e=>{b.warn(`Caught error on create SourceBuffer: `+e),o(O)}))}))}(e,t,i).then((e=>{o(e)})).catch((e=>{c(e)}))):(A=!0,function(){return new Promise(((e,t)=>{O=co(n).create(ee.bind(this)),_e(u.getCurrentRepresentation()).then((()=>{e(O)})).catch((()=>{t()}))}))}().then((e=>{o(e)})).catch((e=>{c(e)}))):o(null)}))}function U(e){d.get().streaming.cacheInitSegments&&(b.info(`Init fragment finished loading saving to`,v+`'s init cache`),L.save(e.chunk)),b.debug(`Appending init fragment for type ${v}, representationId ${e.chunk.representation.id} and bandwidth ${e.chunk.representation.bandwidth}`),G(e.chunk)}function W(e){G(e.chunk,e.request)}function G(e,t=null){O&&(O.append(e,t).then((e=>{ee(e)})).catch((e=>{ee(e)})),e.representation.mediaInfo.type===h.default.VIDEO&&Te(m.default.VIDEO_CHUNK_RECEIVED,{chunk:e}))}function K(e){if(e&&e.length>0)for(let t=0,n=e.length;t<n;t++)b.debug(`Buffered range: `+e.start(t)+` - `+e.end(t)+`, currentTime = `,o.getTime())}function ee(e){if(e.error)return e.error.code===22&&function(){if(I=!0,C=.8*Se(),b.warn(`Quota exceeded, Critical Buffer: `+C),C>0){let e=Math.max(.2*C,1),t=C-e,n=Math.min(d.get().streaming.buffer.bufferTimeAtTopQuality,.9*t),r=Math.min(d.get().streaming.buffer.bufferTimeAtTopQualityLongForm,.9*t),i={streaming:{buffer:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(n.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(r.toFixed(5))}}};d.update(i)}}(),void(e.error.code!==22&&we()||(b.warn(`Clearing playback buffer to overcome quota exceed situation`),Te(m.default.QUOTA_EXCEEDED,{criticalBufferLevel:C,quotaExceededTime:e.chunk.start}),me(pe())));if(!O||(ce(),I=!1,N=e.chunk,!N||!N.endFragment))return;N&&!isNaN(N.index)&&(E=Math.max(N.index,E),le());let t=O.getAllBufferRanges();N.segmentType===T.HTTPRequest.MEDIA_SEGMENT_TYPE&&(K(t),ie(),function(){if(isNaN(B)||A)return;if(v!==h.default.AUDIO&&v!==h.default.VIDEO)return void(B=NaN);let e=o.getTime(),t=oe(e,0),n=oe(B,0);if(t&&n&&t.start===n.start)return void(B=NaN);let r=u.getCurrentRepresentation().segmentDuration,i=oe(B,r);i&&(d.get().streaming.buffer.enableSeekDecorrelationFix&&Math.abs(e-B)>r?B<=i.end&&o.seek(Math.max(B,i.start),!1,!0):e<i.start&&o.seek(i.start,!1,!0))}());let n=!1;j&&=(j.indexOf(N)>0&&(n=!0),null),N&&!n&&Te(m.default.BYTES_APPENDED_END_FRAGMENT,{startTime:N.start,index:N.index,bufferedRanges:t,segmentType:N.segmentType,mediaType:v,representationId:N.representation.id})}function q(e,t){let n=[];return n.push(_e(e)),n.push(O?O.abort():Promise.resolve()),n.push(te(e,t)),Promise.allSettled(n)}function te(e,n){if(!e||!n)return b.warn(`BufferController._changeCodec() is missing the information about the Representations. Doing nothing`),Promise.resolve();if(e&&n&&e.mimeType===n.mimeType&&e.codecFamily===n.codecFamily)return b.debug(`Switching to new codec ${e.codecs} without changeType as previous codec ${n.codecs} is compatible.`),Promise.resolve();if(!d.get().streaming.buffer.useChangeType||!t.supportsChangeType())return b.debug(`changeType() not available`),Promise.resolve();b.debug(`Using changeType() to switch from codec ${n.codecs} to ${e.codecs}`);let r=e.dependentRepresentation?e.dependentRepresentation:e;return O.changeType(r)}function ne(){return new Promise(((e,t)=>{let n=re();if(!n||n.length===0)return ie(),void e();me(n).then((()=>{e()})).catch((e=>{t(e)}))}))}function re(e){let t=[],n=O.getAllBufferRanges();if(!n||n.length===0)return t;if(!e&&e!==0||isNaN(e))t.push({start:n.start(0),end:n.end(n.length-1)+.5});else{let r=function(e,t){let n=d.get().streaming.buffer.bufferToKeep,r=t.start(0);if(e-r>n){let t=Math.max(0,e-n),o=i.getRequests({state:se.FRAGMENT_MODEL_EXECUTED,time:e,threshold:fo})[0];if(o&&(t=Math.min(o.startTime,t)),t>0)return{start:r,end:t}}return null}(e,n),o=function(e,t){let n=t.end(t.length-1)+.5,r=Ce(e),o=f.manifestInfo.duration>=d.get().streaming.buffer.longFormContentDurationThreshold?d.get().streaming.buffer.bufferTimeAtTopQualityLongForm:d.get().streaming.buffer.bufferTimeAtTopQuality,c=isNaN(r)?e:Math.min(r,e+o);if(c>=t.end(t.length-1))return null;let l=i.getRequests({state:se.FRAGMENT_MODEL_EXECUTED,time:e,threshold:fo})[0];if(l&&(c=Math.max(l.startTime+l.duration,c)),d.get().streaming.buffer.avoidCurrentTimeRangePruning){for(let r=0;r<t.length;r++)if(t.start(r)<=e&&e<=t.end(r)&&t.start(r)<=c&&c<=t.end(r)){let i=c;c=r+1<t.length?t.start(r+1):t.end(r)+1,b.debug(`Buffered range [`+t.start(r)+`, `+t.end(r)+`] overlaps with targetTime `+e+` and range to be pruned [`+i+`, `+n+`], using [`+c+`, `+n+`] instead`+(c<n?``:` (no actual pruning)`));break}}return c<t.end(t.length-1)?{start:c,end:n}:null}(e,n);r&&t.push(r),o&&t.push(o)}return t}function ie(){(!z||v===h.default.TEXT&&_.isTextEnabled())&&ce()}function J(){ue()}function ae(){ue(),B=NaN}function oe(e,t){if(!O)return null;let n=O.getAllBufferRanges(),r,i,o=0,c=0,l=null,u=null,d=0,f=isNaN(t)?.15:t;if(n!=null){for(i=0,r=n.length;i<r;i++)if(o=n.start(i),c=n.end(i),l===null)d=Math.abs(o-e),(e>=o&&e<c||d<=f)&&(l=o,u=c);else{if(d=o-u,!(d<=f))break;u=c}if(l!==null)return{start:l,end:u}}return null}function ce(){if(o){let e=o.getTime()||0;A&&(e=isNaN(B)?0:B);let t=d.get().streaming.gaps.jumpGaps&&!isNaN(d.get().streaming.gaps.smallGapLimit)?d.get().streaming.gaps.smallGapLimit:NaN;S=Math.max(function(e,t){let n,r;return d.get().streaming.gaps.jumpGaps&&(t=d.get().streaming.gaps.smallGapLimit),n=oe(e,t),r=n===null?0:n.end-e,r}(e,t),0),Te(m.default.BUFFER_LEVEL_UPDATED,{mediaType:v,bufferLevel:S}),ue()}}function le(){let e=E>=D-1,t=o.getTimeToStreamEnd(f)-S<1e-5;!e&&!t||x||(xe(!0),b.debug(`checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ${f.id} and type ${v}`))}function ue(){if(v!==h.default.AUDIO&&v!==h.default.VIDEO)return;let e=o.getLowLatencyModeEnabled()?d.get().streaming.buffer.lowLatencyStallThreshold:d.get().streaming.buffer.stallThreshold;S<=e&&!x?de(c.BUFFER_EMPTY):(x||S>e)&&de(c.BUFFER_LOADED)}function de(e){M===e||e===c.BUFFER_EMPTY&&o.getTime()===0||v===h.default.TEXT&&!_.isTextEnabled()||(M=e,Te(m.default.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Te(e===c.BUFFER_LOADED?m.default.BUFFER_LOADED:m.default.BUFFER_EMPTY),b.debug(e===c.BUFFER_LOADED?`Got enough buffer to start`:`Waiting for more buffer before starting playback`))}function fe(){O&&v!==h.default.TEXT&&(x||me(pe()))}function pe(){let e=[],t=O.getAllBufferRanges();if(!t||t.length===0)return e;let n=o.getTime(),r=Math.max(0,n-d.get().streaming.buffer.bufferToKeep),c=i.getRequests({state:se.FRAGMENT_MODEL_EXECUTED,time:n,threshold:fo})[0];if(c)r=Math.min(c.startTime,r);else if(n===0&&o.getIsDynamic())return[];if(t.start(0)<=r){let n={start:0,end:r};for(let e=0;e<t.length&&t.end(e)<=r;e++)n.end=t.end(e);n.start<n.end&&e.push(n)}return e}function me(e){return new Promise(((t,n)=>{if(!e||!O||e.length===0)return ce(),void t();let r=[];e.forEach((e=>{r.push(function(e){return new Promise(((t,n)=>{e.resolve=t,e.reject=n,R.push(e)}))}(e))})),F||he(),Promise.all(r).then((()=>{t()})).catch((e=>{n(e)}))}))}function he(){try{if(R.length===0||!O)return b.debug(`Nothing to prune, halt pruning`),R=[],void(F=!1);let e=O.getBuffer();if(!e||!e.buffered||e.buffered.length===0)return b.debug(`SourceBuffer is empty (or does not exist), halt pruning`),R=[],void(F=!1);let t=R.shift();b.debug(`${v}: Removing buffer from: ${t.start} to ${t.end}`),F=!0,o.getTime()<t.end&&xe(!1),O.remove(t).then((e=>{ge(e)})).catch((e=>{ge(e)}))}catch{F=!1}}function ge(e){b.debug(`onRemoved buffer from:`,e.from,`to`,e.to),O&&(K(O.getAllBufferRanges()),R.length===0&&(F=!1,ce()),e.unintended&&(b.warn(`Detected unintended removal from:`,e.from,`to`,e.to,`setting streamprocessor time to`,e.from),Te(m.default.SEEK_TARGET,{time:e.from})),F?he():(z?z=!1:ce(),Te(m.default.BUFFER_CLEARED,{from:e.from,to:e.to,unintended:e.unintended,hasEnoughSpaceToAppend:we(),quotaExceeded:I})))}function _e(e){return new Promise((t=>{e&&e.mseTimeOffset!==void 0&&O&&O.updateTimestampOffset?O.updateTimestampOffset(e.mseTimeOffset).then((()=>{t()})).catch((()=>{t()})):t()}))}function ve(){return O&&!x?O.updateAppendWindow(f):Promise.resolve()}function ye(){P++,P*(d.get().streaming.wallclockTimeUpdateInterval/1e3)>=d.get().streaming.buffer.bufferPruningInterval&&(P=0,fe())}function be(){ue()}function xe(e){x=e,x?Te(m.default.BUFFERING_COMPLETED):D=1/0}function Se(){try{let e=O.getAllBufferRanges(),t,n,r=0;if(!e)return r;for(n=0,t=e.length;n<t;n++)r+=e.end(n)-e.start(n);return r}catch{return 0}}function Ce(e){try{let t=e,n=O.getAllBufferRanges();if(!n||n.length===0)return NaN;let r=0;for(;t===e&&r<n.length;){let e=n.start(r),i=n.end(r);t>=e&&t<=i&&(t=i),r+=1}return t===e?NaN:t}catch{return NaN}}function we(){let e=Se();return isNaN(e)||e<C}function Te(e,t){let n=t||{};r.trigger(e,n,{streamId:f.id,mediaType:v})}function Ee(e,t){if(C=1/0,M=void 0,D=1/0,E=0,N=null,x=!1,F=!1,I=!1,S=0,P=0,R=[],B=NaN,A=!1,O){let n=O;O=null,e||(t?n.removeEventListeners():n.abort().then((()=>{n.reset(t),n=null})))}z=!1}return y={appendInitSegmentFromCache:function(e){let t=L.extract(f.id,e);return!!t&&(b.debug(`Appending init fragment for type ${v}, representationId ${t.representation.id} and bandwidth ${t.representation.bandwidth}`),G(t),!0)},clearBuffers:me,createBufferSink:H,dischargePreBuffer:function(){if(O&&k&&typeof k.discharge==`function`){let e=k.getAllBufferRanges();if(e.length>0){let t=`Beginning `+v+`PreBuffer discharge, adding buffer for:`;for(let n=0;n<e.length;n++)t+=` start: `+e.start(n)+`, end: `+e.end(n)+`;`;b.debug(t)}else b.debug(`PreBuffer discharge requested, but there were no media segments in the PreBuffer.`);j=[];let t=k.discharge(),n=null;for(let e=0;e<t.length;e++){let r=t[e];if(r.segmentType!==T.HTTPRequest.INIT_SEGMENT_TYPE){let e=L.extract(r.streamId,r.representation.id);e&&n!==e&&(j.push(e),O.append(e),n=e)}j.push(r),O.append(r)}k.reset(),k=null}},getAllRangesWithSafetyFactor:re,getBuffer:function(){return O},getBufferControllerType:function(){return po},getBufferLevel:function(){return S},getContinuousBufferTimeForTargetTime:Ce,getIsBufferingCompleted:function(){return x},getIsPruningInProgress:function(){return F},getMediaSource:function(){return w},getRangeAt:oe,getStreamId:function(){return f.id},getType:function(){return v},hasBufferAtTime:function(e){try{let t=O.getAllBufferRanges();if(!t||t.length===0)return!1;let n=0;for(;n<t.length;){let r=t.start(n),i=t.end(n);if(e>=r&&e<=i)return!0;n+=1}return!1}catch(e){return b.error(e),!1}},initialize:function(e){V(e),r.on(m.default.INIT_FRAGMENT_LOADED,U,y),r.on(m.default.MEDIA_FRAGMENT_LOADED,W,y),r.on(m.default.WALLCLOCK_TIME_UPDATED,ye,y),r.on(g.default.PLAYBACK_PLAYING,ae,y),r.on(g.default.PLAYBACK_PROGRESS,ie,y),r.on(g.default.PLAYBACK_TIME_UPDATED,ie,y),r.on(g.default.PLAYBACK_RATE_CHANGED,be,y),r.on(g.default.PLAYBACK_STALLED,J,y)},prepareForAbandonQualitySwitch:function(e,t){return q(e,t)},prepareForDefaultQualitySwitch:function(e,t){return q(e,t)},prepareForFastQualitySwitch:function(e,t){return q(e,t)},prepareForForceReplacementQualitySwitch:function(e,t){return new Promise((n=>{let r=[];r.push(O.abort()),r.push(ve()),r.push(ne()),r.push(_e(e)),r.push(te(e,t)),Promise.allSettled(r).then((()=>{xe(!1),n()}))}))},prepareForNonReplacementTrackSwitch:function(e,t){return new Promise((n=>{let r=[];r.push(ve()),r.push(te(e,t)),Promise.allSettled(r).then((()=>{n()}))}))},prepareForPlaybackSeek:function(){return x&&xe(!1),O.abort()},prepareForReplacementTrackSwitch:function(e,t){return new Promise((n=>{let r=[];r.push(O.abort()),r.push(ve()),r.push(te(e,t)),r.push(ne()),r.push(_e(e)),Promise.allSettled(r).then((()=>{xe(!1),n()}))}))},pruneAllSafely:ne,pruneBuffer:fe,reset:function(e,t){r.off(m.default.INIT_FRAGMENT_LOADED,U,this),r.off(m.default.MEDIA_FRAGMENT_LOADED,W,this),r.off(m.default.WALLCLOCK_TIME_UPDATED,ye,this),r.off(g.default.PLAYBACK_PLAYING,ae,this),r.off(g.default.PLAYBACK_PROGRESS,ie,this),r.off(g.default.PLAYBACK_TIME_UPDATED,ie,this),r.off(g.default.PLAYBACK_RATE_CHANGED,be,this),r.off(g.default.PLAYBACK_STALLED,J,this),Ee(e,t)},segmentRequestingCompleted:function(e){isNaN(e)||(D=e,le())},setIsBufferingCompleted:xe,setMediaSource:V,setSeekTarget:function(e){B=e},updateAppendWindow:ve,updateBufferTimestampOffset:_e},b=(0,l.default)(n).getInstance().getLogger(y),L=uo(n).getInstance(),Ee(),y}mo.__dashjs_factory_name=po;var ho=i.default.getClassFactory(mo);let go=`NotFragmentedTextBufferController`;function _o(e){e||={};let t=this.context,n=(0,p.default)(t).getInstance(),r=e.textController,i=e.errHandler,o=e.streamInfo,c=e.type,l,u,d,f,h,g;function _(e){f=e}function v(e){u!==e&&(u=e,u&&function(e){n.trigger(e,{},{streamId:o.id,mediaType:c})}(m.default.BUFFERING_COMPLETED))}function y(e){e.chunk.bytes&&!u&&(g.save(e.chunk),h.append(e.chunk),v(!0))}return l={initialize:function(e){_(e)},getStreamId:function(){return o.id},getType:function(){return c},getBufferControllerType:function(){return go},createBufferSink:function(e){return new Promise(((o,l)=>{try{h=oo(t).create({mediaSource:f,textController:r,eventBus:n}),h.initializeForFirstUse(e),d||=(h.getBuffer()&&typeof h.getBuffer().initialize==`function`&&h.getBuffer().initialize(),!0),o(h)}catch(e){i.error(new Be.default(Ne.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Ne.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+c)),l(e)}}))},dischargePreBuffer:function(){},getBuffer:function(){return h},getBufferLevel:function(){return 0},getRangeAt:function(){return null},pruneBuffer:function(){},hasBufferAtTime:function(){return!0},getAllRangesWithSafetyFactor:function(){return[]},getContinuousBufferTimeForTargetTime:function(){return 1/0},setMediaSource:_,getMediaSource:function(){return f},appendInitSegmentFromCache:function(e){return g.extract(o.id,e)!==null},getIsBufferingCompleted:function(){return u},setIsBufferingCompleted:v,getIsPruningInProgress:function(){return!1},reset:function(e){n.off(m.default.INIT_FRAGMENT_LOADED,y,l),!e&&h&&(h.abort(),h.reset(),h=null)},clearBuffers:function(){return Promise.resolve()},prepareForPlaybackSeek:function(){return Promise.resolve()},prepareForReplacementTrackSwitch:function(){return u=!1,Promise.resolve()},setSeekTarget:function(){},updateAppendWindow:function(){return Promise.resolve()},pruneAllSafely:function(){return Promise.resolve()},updateBufferTimestampOffset:function(){return Promise.resolve()},segmentRequestingCompleted:function(){}},d=!1,f=null,u=!1,g=uo(t).getInstance(),n.on(m.default.INIT_FRAGMENT_LOADED,y,l),l}_o.__dashjs_factory_name=go;var vo=i.default.getClassFactory(_o);function yo(e){e||={};let t=this.context,n=(0,p.default)(t).getInstance(),r=e.dashMetrics,i=e.mediaPlayerModel,o=e.fragmentModel,u=e.abrController,d=e.playbackController,f=e.textController,_=e.type,v=e.bufferController,y=e.representationController,b=e.settings,x,S,C,w,T,E,D,O,k,A,j,M;function N(){D=(0,l.default)(t).getInstance().getLogger(w),G(),A=e.streamInfo}function P(){O=!0}function F(){O=!1}function I(e){v.getIsBufferingCompleted()||(L(),k=setTimeout(R,isNaN(e)?0:e))}function L(){k&&=(clearTimeout(k),null)}function R(){let e=i.getScheduleTimeout();try{if(function(){try{return _===h.default.TEXT&&!f.isTextEnabled()||d.isPaused()&&(!d.getStreamController().getInitialPlayback()||!d.getStreamController().getAutoPlay())&&!b.get().streaming.scheduling.scheduleWhilePaused}catch{return!1}}())return void L();(function(){try{return!!O&&y.getCurrentRepresentation()&&(E==null||j||function(){let e=y.getCurrentRepresentation();if(!_||!e)return!0;let t=e&&e.segmentDuration&&!isNaN(e.segmentDuration)?e.segmentDuration:0,n=r.getCurrentBufferLevel(_),i=z();return(i<=t||d.getLowLatencyModeEnabled()||_===h.default.AUDIO&&S)&&(t=0),n+t<i}())}catch{return!1}})()?function(){if(u.handlePendingManualQualitySwitch(A.id,_))return;let e=!1;x&&(e=u.checkPlaybackQuality(_,A.id)),e||function(){let e=y.getCurrentRepresentation();C||e.id!==E||j?function(e){j?(D.debug(`Switch track for `+_+`, representation id = `+e.id),j=!1):D.debug(`Quality has changed, get init request for representationid = `+e.id),n.trigger(m.default.INIT_FRAGMENT_NEEDED,{representationId:e.id,sender:w},{streamId:A.id,mediaType:_}),x=!1,C=!1}(e):(D.debug(`Media segment needed for ${_} and stream id ${A.id}`),n.trigger(m.default.MEDIA_FRAGMENT_NEEDED,{},{streamId:A.id,mediaType:_}),x=!0)}()}():I(e)}catch{I(e)}}function z(){let e=NaN,t=y.getCurrentRepresentation();return _&&t&&(e=_===h.default.TEXT?function(){try{if(f.isTextEnabled()){let e=y.getCurrentRepresentation();if(isNaN(e.fragmentDuration)){let e=r.getCurrentSchedulingInfo(c.SCHEDULING_INFO);return e?e.duration:0}return e.fragmentDuration}return 0}catch{return 0}}():_===h.default.AUDIO&&S?function(){try{let e=r.getCurrentBufferLevel(h.default.VIDEO),t=y.getCurrentRepresentation();return isNaN(t.fragmentDuration)?e+1:Math.max(e+1,t.fragmentDuration)}catch{return 0}}():function(){try{let e=b.get().streaming.enhancement.enabled?y.getCurrentCompositeRepresentation():y.getCurrentRepresentation(),t=e.mediaInfo.streamInfo;return u.isPlayingAtTopQuality(e)?t.manifestInfo.duration>=b.get().streaming.buffer.longFormContentDurationThreshold?b.get().streaming.buffer.bufferTimeAtTopQualityLongForm:b.get().streaming.buffer.bufferTimeAtTopQuality:i.getBufferTimeDefaultUnadjusted()}catch{return i.getBufferTimeDefaultUnadjusted()}}()),e}function B(){V(!0)}function V(e){if(d&&o){let t=o.getRequests({state:se.FRAGMENT_MODEL_EXECUTED,time:d.getTime(),threshold:0})[0];t&&d.getTime()>=t.startTime&&((!T.representation||t.representation.mediaInfo.type===T.representation.mediaInfo.type&&t.representation.mediaInfo.index!==T.representation.mediaInfo.index)&&e&&function(e){D.debug(`Track change rendered for streamId ${A.id} and type ${_}`),n.trigger(m.default.TRACK_CHANGE_RENDERED,{mediaType:_,oldMediaInfo:T&&T.representation&&T.representation.mediaInfo?T.representation.mediaInfo:null,newMediaInfo:e.representation.mediaInfo,streamId:A.id})}(t),T.representation&&t.representation.id===T.representation.id||!e||function(e){D.debug(`Quality change rendered for streamId ${A.id} and type ${_}`),n.trigger(m.default.QUALITY_CHANGE_RENDERED,{mediaType:_,oldRepresentation:T.representation?T.representation:null,newRepresentation:e.representation,streamId:A.id})}(t),T.representation=t.representation)}}function H(){o.abortRequests(),L()}function U(){b.get().streaming.scheduling.scheduleWhilePaused||I()}function W(e){r.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function G(){x=!0,M=0,E=null,T={representation:null},j=!1,C=!1,O=!0}return w={clearScheduleTimer:L,getBufferTarget:z,getPlaybackController:function(){return d},getStreamId:function(){return A.id},getSwitchTrack:function(){return j},getTimeToLoadDelay:function(){return M},getType:function(){return _},initialize:function(e){S=e,n.on(m.default.URL_RESOLUTION_FAILED,H,w),n.on(g.default.PLAYBACK_STARTED,U,w),n.on(g.default.PLAYBACK_RATE_CHANGED,W,w),n.on(g.default.PLAYBACK_TIME_UPDATED,B,w),n.on(g.default.MANAGED_MEDIA_SOURCE_START_STREAMING,P,w),n.on(g.default.MANAGED_MEDIA_SOURCE_END_STREAMING,F,w)},reset:function(){n.off(m.default.URL_RESOLUTION_FAILED,H,w),n.off(g.default.PLAYBACK_STARTED,U,w),n.off(g.default.PLAYBACK_RATE_CHANGED,W,w),n.off(g.default.PLAYBACK_TIME_UPDATED,B,w),n.off(g.default.MANAGED_MEDIA_SOURCE_START_STREAMING,P,w),n.off(g.default.MANAGED_MEDIA_SOURCE_END_STREAMING,F,w),L(),V(!1),G(),A=null},setShouldCheckPlaybackQuality:function(e){x=e},setInitSegmentRequired:function(e){C=e},setLastInitializedRepresentationId:function(e){E=e},setup:N,setSwitchTrack:function(e){j=e},setTimeToLoadDelay:function(e){M=e},startScheduleTimer:I},N(),w}yo.__dashjs_factory_name=`ScheduleController`;var bo=i.default.getClassFactory(yo);let xo=/\$(RepresentationID|Number|SubNumber|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g;var X=class extends Pa{constructor(){super(),this.isPartialSegment=!0,this.replacementSubNumber=NaN,this.totalNumberOfPartialSegments=NaN}};function So(e){return e?e.totalNumberOfPartialSegments&&!isNaN(e.totalNumberOfPartialSegments)&&e.totalNumberOfPartialSegments>0&&!isNaN(e.subNumberOfPartialSegmentToRequest)?function(e){let t=function(e,t){let n=new X,r=e.segmentDurationInSeconds/e.totalNumberOfPartialSegments,{representation:i,timelineConverter:o,isDynamic:c,index:l,totalNumberOfPartialSegments:u}=e,d=Co({representation:i,segmentDurationInSeconds:r,presentationStartTime:e.presentationStartTime+t*r,presentationEndTime:e.presentationStartTime+(t+1)*r,timelineConverter:o,isDynamic:c,mediaTimeInSeconds:e.mediaTimeInSeconds+t*r,index:l});return n.assignAttributes(d),n.replacementSubNumber=t,n.totalNumberOfPartialSegments=u,n}(e,e.subNumberOfPartialSegmentToRequest);return wo(t,e),t}(e):function(e){let t=new Fa,n=Co(e);return t.assignAttributes(n),wo(t,e),t}(e):null}function Co(e){let{representation:t,segmentDurationInSeconds:n,presentationStartTime:r,presentationEndTime:i,mediaTimeInSeconds:o,timelineConverter:c,isDynamic:l,index:u}=e,d={availabilityEndTime:c.calcAvailabilityEndTimeFromPresentationTime(i+n,t,l),availabilityStartTime:c.calcAvailabilityStartTimeFromPresentationTime(i,t,l),duration:n,index:u,mediaStartTime:o,presentationStartTime:r,replacementNumber:t.startNumber+u,representation:t};return d.wallStartTime=c.calcWallTimeForSegment(d,l),d}function wo(e,t){let{tManifest:n,mediaTime:r,mediaUrl:i,mediaRange:o}=t;e.replacementTime=n||r,e.media=Q(i,e.representation.id,e.replacementNumber,e.replacementSubNumber,e.representation.bandwidth,e.replacementTime),e.mediaRange=o,e.mediaUrl=i}function Z(e,t,n,r){let i=t.adaptation.period;if(isFinite(i.duration)&&i.start+i.duration<=n.presentationStartTime)return!1;if(r){if(t.availabilityTimeOffset===`INF`)return!0;let r=e.getClientReferenceTime();return n.availabilityStartTime.getTime()<=r&&(!isFinite(n.availabilityEndTime)||n.availabilityEndTime.getTime()>=r)}return!0}function Q(e,t,n,r,i,o){return e&&function(e,t,n,r,i,o){return e.replace(xo,((e,c,l,u)=>{let d,f;switch(c){case void 0:return`$`;case`RepresentationID`:d=t;break;case`Number`:d=n;break;case`SubNumber`:d=r;break;case`Bandwidth`:d=i;break;case`Time`:if(typeof o==`string`)return o;d=o&&Math.round(o);break;default:d=null}if(d==null)return e;switch(u){case void 0:case`d`:case`i`:case`u`:f=d.toString();break;case`o`:f=d.toString(8);break;case`x`:f=d.toString(16);break;case`X`:f=d.toString(16).toUpperCase();break;default:f=d.toString()}let p=parseInt(l,10)||1;return f.padStart(p,`0`)}))}(e,t,n,r,i,o)}function To(e){let{index:t,isDynamic:n,mediaRange:r,mediaTime:i,mediaUrl:o,representation:c,subNumberOfPartialSegmentToRequest:l,timelineConverter:u,totalNumberOfPartialSegments:d}=e,f,p,m;f=c.segmentDuration,isNaN(f)&&(f=c.adaptation.period.duration),p=parseFloat((c.adaptation.period.start+t*f).toFixed(5)),m=parseFloat((p+f).toFixed(5));let h=So({index:t,isDynamic:n,mediaRange:r,mediaTime:i,mediaTimeInSeconds:u.calcMediaTimeFromPresentationTime(p,c),mediaUrl:o,presentationEndTime:m,presentationStartTime:p,representation:c,segmentDurationInSeconds:f,subNumberOfPartialSegmentToRequest:l,timelineConverter:u,totalNumberOfPartialSegments:d});return Z(u,c,h,n)?h:null}function Eo(e){let{durationInTimescale:t,fTimescale:n,index:r,subNumberOfPartialSegmentToRequest:i,isDynamic:o,mediaRange:c,mediaTime:l,mediaUrl:u,totalNumberOfPartialSegments:d,representation:f,tManifest:p,timelineConverter:m}=e,h=l/n,g=t/n,_=m.calcPresentationTimeFromMediaTime(h,f),v=So({representation:f,segmentDurationInSeconds:g,presentationStartTime:_,presentationEndTime:_+g,mediaTimeInSeconds:h,timelineConverter:m,isDynamic:o,index:r,totalNumberOfPartialSegments:d,subNumberOfPartialSegmentToRequest:i,mediaUrl:u,mediaRange:c,tManifest:p,mediaTime:l});return Z(m,f,v,o)?v:null}function Do(e){return e.k}function Oo(e){let t=(e||={}).eventBus,n=e.events,r=e.abrController,i=e.dashMetrics,o=e.playbackController,c=e.timelineConverter,l=e.type,u=e.streamInfo,d=e.segmentsController,f=e.isDynamic,p,m,_;function v(){return l}function y(){return _?.mediaInfo.type===l?_:function(){let e=_?.dependentRepresentation;if(e){if(!e.mediaInfo)throw Error(`dependentRepresentation has no mediaInfo!`);if(e.mediaInfo.type===l)return e}return null}()}function b(){_=null,m=[]}function x(e){return new Promise(((t,n)=>{let r=e.hasInitialization(),o=e.hasSegments(),l=[];l.push(d.updateInitData(e,r)),l.push(d.updateSegmentData(e,o)),Promise.all(l).then((n=>{var r;n[0]&&!n[0].error&&(e=function(e,t){return t&&!t.error&&t.representation?t.representation:e}(e,n[0])),n[1]&&!n[1].error&&(e=function(e,t){if(!t||t.error)return;let n=t.segments,r=[],i,o,l,u,d=0;for(i=0,o=n?n.length:0;i<o;i++)l=n[i],u=Eo({durationInTimescale:l.duration,fTimescale:l.timescale,index:d,isDynamic:f,mediaRange:l.mediaRange,mediaTime:l.startTime,mediaUrl:l.media,representation:e,timelineConverter:c}),u&&(r.push(u),u=null,d++);return r.length>0&&(e.segments=r),e}(e,n[1])),e.fragmentDuration=e.segmentDuration?e.segmentDuration:e.segments&&e.segments.length>0?e.segments[0].duration:NaN,(r=e).mediaFinishedInformation=d.getMediaFinishedInformation(r),function(e){let t,n=i.getCurrentManifestUpdate(),r=!1;if(n){for(let i=0;i<n.representationInfo.length;i++)if(t=n.representationInfo[i],t.index===e.index&&t.mediaType===v()){r=!0;break}r||i.addManifestUpdateRepresentationInfo(e,v())}}(e),t()})).catch((e=>{n(e)}))}))}function S(e){if(!m||m.length===0)return null;let t=m.filter((t=>t.id===e));return t.length>0?t[0]:null}function C(e){t.trigger(n.DATA_UPDATE_COMPLETED,{currentRepresentation:_,error:e},{streamId:u.id,mediaType:l})}function w(e){_&&_.id===e.id||function(e){(function(){if(!(r&&i&&o&&c))throw Error(h.default.MISSING_CONFIG_ERROR)})();let n=new Date,d=1e3*o.getTime();e&&i.addRepresentationSwitch(e.adaptation.type,n,d,e.id),t.trigger(g.default.REPRESENTATION_SWITCH,{mediaType:l,streamId:u.id,currentRepresentation:e},{streamId:u.id,mediaType:l})}(e),_=e}function T(e){if(e.newDuration){let t=y();t&&t.adaptation.period&&(t.adaptation.period.duration=e.newDuration)}}return p={getCurrentCompositeRepresentation:function(){return _},getCurrentRepresentation:y,getRepresentationById:S,getStreamId:function(){return u.id},getType:v,prepareQualityChange:function(e){let t=m.filter((t=>t.id===e.id));t.length>0&&w(t[0])},reset:function(){t.off(g.default.MANIFEST_VALIDITY_CHANGED,T,p),b()},updateData:function(e,t,n){return new Promise(((c,d)=>{if(m=e,w(S(n)),l!==h.default.VIDEO&&l!==h.default.ENHANCEMENT&&l!==h.default.AUDIO&&(l!==h.default.TEXT||!t))return C(),void c();let f=[];for(let e=0,t=m.length;e<t;e++){let t=m[e];f.push(x(t))}Promise.all(f).then((()=>{(function(){r.setPlaybackQuality(l,u,_);let e=i.getCurrentDVRInfo(l);e&&i.updateManifestUpdateInfo({latency:e.range.end-o.getTime()}),C()})(),c()})).catch((e=>{d(e)}))}))}},b(),t.on(g.default.MANIFEST_VALIDITY_CHANGED,T,p),p}Oo.__dashjs_factory_name=`RepresentationController`;var ko=i.default.getClassFactory(Oo);function Ao(e){let t=(e||={}).eventBus,n=e.debug,r=e.urlUtils,i=e.type,o=e.streamInfo,c=e.segmentsController,l=e.timelineConverter,u=e.baseURLController,d,f,p,m,h;function _(){return i}function v(){p=null}function y(e,t,n){let i=u.resolve(n.path),o,c,l={};return i&&t!==i.url&&r.isRelative(t)?(o=i.url,c=i.serviceLocation,l=i.queryParams,t&&(o=r.resolve(t,o))):o=t,!r.isRelative(o)&&(e.url=o,e.serviceLocation=c,e.queryParams=l,!0)}function b(e,t,n){let r=null;if(!t||!t.segmentInfoType)return r;let i=c.getSegmentByTime(t,n);return i&&(p=i,f.debug(`Index for time `+n+` is `+i.index),r=x(0,i)),r}function x(e,t){if(t==null)return null;let n=new ne,r=t.representation,i=r.bandwidth,o=Q(t.media,r.id,t.replacementNumber,t.replacementSubNumber,i,t.replacementTime);return n.adaptationIndex=r.adaptation.index,n.availabilityEndTime=t.availabilityEndTime,n.availabilityStartTime=t.availabilityStartTime,n.availabilityTimeComplete=r.availabilityTimeComplete,n.bandwidth=r.bandwidth,n.duration=t.duration,n.index=t.index,n.isPartialSegmentRequest=t.isPartialSegment,n.mediaStartTime=t.mediaStartTime,n.mediaType=_(),n.presentationStartTime=t.presentationStartTime,n.range=t.mediaRange,n.representation=r,n.startTime=t.presentationStartTime,n.timescale=r.timescale,n.type=T.HTTPRequest.MEDIA_SEGMENT_TYPE,n.wallStartTime=t.wallStartTime,y(n,o,r)?n:void 0}function S(e){if(!e)return{indexToRequest:0,subNumberOfPartialSegmentToRequest:NaN};let t=e.isPartialSegment,n=!isNaN(e.replacementSubNumber),r=!isNaN(e.totalNumberOfPartialSegments);if(t&&n&&r){let t=e.replacementSubNumber+1;return t<e.totalNumberOfPartialSegments?{indexToRequest:e.index,subNumberOfPartialSegmentToRequest:t}:{indexToRequest:e.index+1,subNumberOfPartialSegmentToRequest:0}}return{indexToRequest:e.index+1,subNumberOfPartialSegmentToRequest:NaN}}function C(e,t,n,r){let i=null,o=c.getSegmentByIndex(t,n,r,p);if(o)i=x(0,o),p=o;else{if(m&&!h)return f.debug(_()+` No segment found at index: `+n+`. Wait for next loop`),null;h=!0}return i}function w(){f.debug(`Dynamic stream complete`),h=!0}return d={getCurrentIndex:function(){return p?p.index:-1},getInitRequest:function(e,t){return t?function(e,t,n){let r=new ne,i=t.adaptation.period,o=i.start;if(r.mediaType=n,r.type=T.HTTPRequest.INIT_SEGMENT_TYPE,r.range=t.range,r.availabilityStartTime=l.calcAvailabilityStartTimeFromPresentationTime(o,t,m),r.availabilityEndTime=l.calcAvailabilityEndTimeFromPresentationTime(o+i.duration,t,m),r.representation=t,y(r,t.initialization,t))return r.url=Q(r.url,t.id,void 0,void 0,t.bandwidth),r}(0,t,_()):null},getLastSegment:function(){return p},getNextSegmentRequest:function(e,t){if(!t||!t.segmentInfoType)return null;if(function(e){return e&&p&&e.endNumber&&p.replacementNumber&&p.replacementNumber>=e.endNumber}(t))return h=!0,null;let{indexToRequest:n,subNumberOfPartialSegmentToRequest:r}=S(p);return C(0,t,n,r)},getNextSegmentRequestIdempotent:function(e,t){let n=null,{indexToRequest:r,subNumberOfPartialSegmentToRequest:i}=S(p),o=c.getSegmentByIndex(t,r,i,p);return o?(n=x(0,o),n):null},getSegmentRequestForTime:b,getStreamId:function(){return o.id},getStreamInfo:function(){return o},getType:_,getValidTimeAheadOfTargetTime:function(e,t,n,r){try{if(isNaN(e)||!t||!n)return NaN;if(e<0&&(e=0),isNaN(r)&&(r=.5),b(0,n,e))return e;if(n.adaptation.period.start+n.adaptation.period.duration<e)return NaN;let i=isFinite(n.adaptation.period.duration)?n.adaptation.period.start+n.adaptation.period.duration:e+30,o=Math.min(e+r,i),c=NaN,l=null;for(;o<=i;){let e=null;if(o<=i&&(e=b(0,n,o)),e){c=o,l=e;break}o+=r}if(l){let t=l.startTime+l.duration;return e>l.startTime&&t-e>r?e:!isNaN(l.startTime)&&e<l.startTime&&c>l.startTime?l.startTime+.001:Math.min(t-r,c)}return c}catch{return NaN}},initialize:function(e){m=e,h=!1,c.initialize(e)},isLastSegmentRequested:function(e,t){return!e||!p?!1:h?!0:!isFinite(e.adaptation.period.duration)||p.presentationStartTime+p.duration>t?!1:e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.numberOfSegments)&&!isNaN(p.index)&&p.index>=e.mediaFinishedInformation.numberOfSegments-1&&(!m||e.segmentInfoType===Y.default.SEGMENT_TEMPLATE||m&&e.segmentInfoType===Y.default.SEGMENT_LIST&&e.adaptation.period.nextPeriodId)?!0:!!(m&&e.adaptation.period.nextPeriodId&&e.segmentInfoType===Y.default.SEGMENT_TIMELINE&&e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment)&&p&&!isNaN(p.mediaStartTime)&&!isNaN(p.duration)&&p.mediaStartTime+p.duration>=e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment-.05)},repeatSegmentRequest:function(e,t){return t&&t.segmentInfoType?C(0,t,p?p.index:0,p&&p.isPartialSegment&&!isNaN(p.replacementSubNumber)?p.replacementSubNumber:NaN):null},reset:function(){v(),t.off(g.default.DYNAMIC_TO_STATIC,w,d)}},f=n.getLogger(d),v(),t.on(g.default.DYNAMIC_TO_STATIC,w,d),d}Ao.__dashjs_factory_name=`DashHandler`;var jo=i.default.getClassFactory(Ao);function Mo(e,t){let n=(e||={}).timelineConverter,r=e.dashMetrics,i;function o(e,r){if(function(){if(!n)throw Error(h.default.MISSING_CONFIG_ERROR)}(),!e)return null;r===void 0&&(r=null);let i=null,o=n.calcMediaTimeFromPresentationTime(r,e);return function(e,t){let n=function(e){return e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentList}(e),r=n.SegmentTimeline,i=n.SegmentURL,o,l,u,d,f,p,m=0,h=-1;p=e.timescale,o=r.S;let g=!1,_=o.length;for(u=0;u<_&&!g;u++)for(l=o[u],f=0,l.hasOwnProperty(`r`)&&(f=l.r),l.hasOwnProperty(`t`)&&(m=l.t),f<0&&(f=c(e,o[u+1],l,p,m/p)),d=0;d<=f&&!g;d++)h++,g=t({mediaTime:m,segmentBase:n,segmentURL:i,currentSElement:l,sElementCounterIncludingRepeats:h,sElementCounter:u}),g&&(e.segmentDuration=l.d/p),m+=l.d}(e,(function(r){let c=e.timescale;return function(r,o){let{mediaTime:c,segmentBase:l,segmentURL:u,currentSElement:d,sElementCounterIncludingRepeats:f,sElementCounter:p}=o,m=d.d,h=e.timescale;return r<c+m&&r>=c&&(function(r){let{segmentBase:o,segmentURL:c,sElementCounter:l,currentSElement:u,mediaTime:d,durationInTimescale:f,fTimescale:p,requiredMediaTimeInTimescaleUnits:m,sElementCounterIncludingRepeats:h}=r,g=function(e,t,n){let r=e.media;return t&&(r=t[n].media||``),r}(o,c,l),_=function(e,t,n){let r=e.mediaRange;return t&&(r=t[n].mediaRange),r}(u,c,l),v=Do(u),y=function(e){if(!e||e.totalNumberOfPartialSegments===void 0||isNaN(e.totalNumberOfPartialSegments)||e.totalNumberOfPartialSegments<1)return;let{durationInTimescale:t,requiredMediaTimeInTimescaleUnits:n,mediaTime:r,totalNumberOfPartialSegments:i}=e,o=t/i;for(let e=0;e<i;e++){let t=r+e*o;if(n>=t&&n<t+o)return e}return NaN}({durationInTimescale:f,requiredMediaTimeInTimescaleUnits:m,mediaTime:d,totalNumberOfPartialSegments:v});i=Eo({timelineConverter:n,isDynamic:t,representation:e,mediaTime:d,durationInTimescale:f,fTimescale:p,mediaUrl:g,mediaRange:_,index:h,tManifest:u.tManifest,totalNumberOfPartialSegments:v,subNumberOfPartialSegmentToRequest:y})}({segmentBase:l,segmentURL:u,sElementCounter:p,currentSElement:d,mediaTime:c,durationInTimescale:m,fTimescale:h,requiredMediaTimeInTimescaleUnits:r,sElementCounterIncludingRepeats:f}),!0)}(parseFloat((o*c).toPrecision(15)),r)})),i}function c(e,t,i,o,c){let l;if(t&&t.hasOwnProperty(`t`))l=t.t/o;else try{let t=0;if(isNaN(e.adaptation.period.start)||isNaN(e.adaptation.period.duration)||!isFinite(e.adaptation.period.duration)){let e=r.getCurrentDVRInfo();t=isNaN(e.end)?0:e.end}else t=e.adaptation.period.start+e.adaptation.period.duration;l=n.calcMediaTimeFromPresentationTime(t,e),e.segmentDuration=i.d/o}catch{l=0}return Math.max(Math.ceil((l-c)/(i.d/o))-1,0)}return i={getMediaFinishedInformation:function(e){if(!e)return 0;let t=(e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentList).SegmentTimeline,n,r,i,o,l,u,d=0,f=0,p=0;u=e.timescale,n=t.S;let m=n.length;for(i=0;i<m;i++)for(r=n[i],l=0,r.hasOwnProperty(`r`)&&(l=r.r),r.hasOwnProperty(`t`)&&(d=r.t,f=d/u),l<0&&(l=c(e,n[i+1],r,u,f)),o=0;o<=l;o++)p++,d+=r.d,f=d/u;return{numberOfSegments:p,mediaTimeOfLastSignaledSegment:f}},getSegmentByIndex:function(e,t){return e?o(e,t&&!isNaN(t.presentationStartTime)?t.presentationStartTime+t.duration+.01:0):null},getSegmentByTime:o},i}Mo.__dashjs_factory_name=`TimelineSegmentsGetter`;var No=i.default.getClassFactory(Mo);function Po(e,t){let n=(e||={}).timelineConverter,r;function i(e,r,i){if(!e)return null;let c=o(e),l=Do(c);l!==void 0&&l>=0&&(i=i!==void 0&&i<l?i:0);let u=To({index:r=Math.max(r,0),isDynamic:t,mediaTime:Math.round(r*e.segmentDuration*e.timescale,10),mediaUrl:c.media,representation:e,subNumberOfPartialSegmentToRequest:i,timelineConverter:n,totalNumberOfPartialSegments:l});return u&&e.endNumber&&u.replacementNumber>e.endNumber?null:u}function o(e){return e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentTemplate}return r={getMediaFinishedInformation:function(e){let t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!e)return t;let n=e.segmentDuration;return isNaN(n)?t.numberOfSegments=1:t.numberOfSegments=Math.ceil(e.adaptation.period.duration/n),t},getSegmentByIndex:i,getSegmentByTime:function(e,t){if(!e)return null;let r=e.segmentDuration;if(isNaN(r))return null;let c=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t),l=o(e),u=Math.floor(c/r);return i(e,u,function(e){if(!e||e.totalNumberOfPartialSegments===void 0||isNaN(e.totalNumberOfPartialSegments)||e.totalNumberOfPartialSegments<1)return;let{totalNumberOfPartialSegments:t,representation:n,requestedTimeRelativeToPeriodStart:r,indexWithoutStartNumber:i}=e,o=i*n.segmentDuration,c=n.segmentDuration/t,l=r-o,u=Math.floor(l/c);return u=Math.max(0,Math.min(u,t-1)),u}({totalNumberOfPartialSegments:Do(l),representation:e,requestedTimeRelativeToPeriodStart:c,indexWithoutStartNumber:u}))}},r}Po.__dashjs_factory_name=`TemplateSegmentsGetter`;var Fo=i.default.getClassFactory(Po);function Io(e,t){let n=(e||={}).timelineConverter,r;function i(){if(!n||!n.hasOwnProperty(`calcPeriodRelativeTimeFromMpdRelativeTime`))throw Error(h.default.MISSING_CONFIG_ERROR)}function o(e,r){if(i(),!e)return null;let o=e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentList,c=o.SegmentURL.length,l=e&&!isNaN(e.startNumber)?e.startNumber:1,u=Math.max(l-1,0),d=Math.max(r-u,0),f=null;if(d<c){let i=o.SegmentURL[d];f=To({index:r,isDynamic:t,mediaRange:i.mediaRange,mediaTime:(l+r-1)*e.segmentDuration,representation:e,timelineConverter:n}),f&&(f.media=i.media?i.media:``,f.indexRange=i.indexRange)}return f}return r={getSegmentByIndex:o,getSegmentByTime:function(e,t){if(i(),!e)return null;let r=e.segmentDuration;if(isNaN(r))return null;let c=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return o(e,Math.floor(c/r))},getMediaFinishedInformation:function(e){let t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!e)return t;let n=e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index].Representation[e.index].SegmentList,r=e&&!isNaN(e.startNumber)?e.startNumber:1;return t.numberOfSegments=Math.max(r-1,0)+n.SegmentURL.length,t}},r}Io.__dashjs_factory_name=`ListSegmentsGetter`;var Lo=i.default.getClassFactory(Io);function Ro(e){let t=(e||={}).timelineConverter,n;function r(){if(!t||!t.hasOwnProperty(`calcPeriodRelativeTimeFromMpdRelativeTime`))throw Error(h.default.MISSING_CONFIG_ERROR)}function i(e,t){if(r(),!e)return null;let n=e.segments?e.segments.length:-1,i;if(t<n&&(i=e.segments[t],i&&i.index===t))return i;for(let r=0;r<n;r++)if(i=e.segments[r],i&&i.index===t)return i;return null}return n={getSegmentByIndex:i,getSegmentByTime:function(e,t){return r(),i(e,function(e,t){if(!e)return-1;let n=e.segments,r=n?n.length:null,i,o,c,l,u,d=-1;if(n&&r>0){for(u=0;u<r;u++)if(o=n[u],c=o.presentationStartTime,l=o.duration,i=l/2,t+i>=c&&t-i<c+l){d=o.index;break}}return d}(e,t))},getMediaFinishedInformation:function(e){let t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};return e&&e.segments&&(t.numberOfSegments=e.segments.length),t}},n}Ro.__dashjs_factory_name=`SegmentBaseGetter`;var zo=i.default.getClassFactory(Ro);function Bo(e){e||={};let t=this.context,n=e.dashConstants,r=e.type,i=e.segmentBaseController,o,c;function l(e){return e?e.segments?c[n.SEGMENT_BASE]:c[e.segmentInfoType]:null}return o={initialize:function(r){c[n.SEGMENT_TIMELINE]=No(t).create(e,r),c[n.SEGMENT_TEMPLATE]=Fo(t).create(e,r),c[n.SEGMENT_LIST]=Lo(t).create(e,r),c[n.SEGMENT_BASE]=zo(t).create(e,r)},updateInitData:function(e,t){return t?Promise.resolve():i.getSegmentBaseInitSegment({representation:e,mediaType:r})},updateSegmentData:function(e,t){return t?Promise.resolve():i.getSegmentList({mimeType:e.mimeType,representation:e,mediaType:r})},getSegmentByIndex:function(e,t,r,i){let o=l(e);return o?e.segmentInfoType?e.segmentInfoType===n.SEGMENT_TIMELINE?o.getSegmentByIndex(e,i):e.segmentInfoType===n.SEGMENT_TEMPLATE?o.getSegmentByIndex(e,t,r):o.getSegmentByIndex(e,t):o.getSegmentByIndex(e,t):null},getSegmentByTime:function(e,t){let n=l(e);return n?n.getSegmentByTime(e,t):null},getMediaFinishedInformation:function(e){let t=l(e);return t?t.getMediaFinishedInformation(e):{numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN}}},c={},o}Bo.__dashjs_factory_name=`SegmentsController`;var Vo=i.default.getClassFactory(Bo);function Ho(){let e;return e={ntpToUTC:function(e){let t=new Date(Date.UTC(1900,0,1,0,0,0));return new Date(t.getTime()+e).getTime()}},e}Ho.__dashjs_factory_name=`TimeUtils`;var Uo=i.default.getSingletonFactory(Ho);function Wo(e){e||={};let t,n,r,i,o,u,d,f,_,v,y,b,x,S,C,w,E,D,O=this.context,k=(0,p.default)(O).getInstance(),A=e.abrController,j=e.adapter,M=e.boxParser,N=e.capabilities,P=e.dashMetrics,F=e.errHandler,I=e.fragmentModel,L=e.manifestModel,R=e.mediaController,z=e.mediaPlayerModel,B=e.mimeType,V=e.playbackController,H=e.segmentBlacklistController,U=e.settings,W=e.streamInfo,G=e.textController,K=e.timelineConverter,ee=e.type;function q(){return W.id}function te(){return ee}function ne(){v=[],i=null,n=0,E=!1,w=!1,b=!1,u=null,D=!1,fe()}function re(e){return!isNaN(e)&&!isNaN(W.duration)&&isFinite(W.duration)&&e>=W.start+W.duration}function ie(e,n=!0){if(e.sender){if(V.getIsManifestUpdateInProgress())oe();else if((!i.isText||G.isTextEnabled())&&t&&e.representationId&&!t.appendInitSegmentFromCache(e.representationId)){let e=x.getCurrentRepresentation();if(e.range===0)return void J();let t=o?o.getInitRequest(i,e):null;t?I.executeRequest(t):n&&(S.setInitSegmentRequired(!0),oe())}}}function J(e,r=!0){if(V.getIsManifestUpdateInProgress()||t.getIsPruningInProgress())return void oe();let c=function(){let e;if(isNaN(n)||te()===h.default.TEXT&&!G.isTextEnabled())return null;if(o){let t=ke();e=E?o.getSegmentRequestForTime(i,t,n):w?o.repeatSegmentRequest(i,t):o.getNextSegmentRequest(i,t)}return e}();c?(E=!1,w=!1,function(e){isNaN(e.startTime+e.duration)||(n=e.startTime+e.duration),e.delayLoadingTime=new Date().getTime()+S.getTimeToLoadDelay(),S.setTimeToLoadDelay(0),function(e){let t=e.url;return e.range&&(t=t.concat(`_`,e.range)),H.contains(t)}(e)?(_.warn(`Fragment request url ${e.url} for stream id ${W.id} and media type ${ee} is on the ignore list and will be skipped`),oe()):(_.debug(`Next fragment request url for stream id ${W.id} and media type ${ee} is ${e.url} with request range ${e.range}`),I.executeRequest(e))}(c)):function(e){let t=x.getCurrentRepresentation();try{if(U.get().streaming.gaps.enableSeekFix&&(E||V.getTime()===0)){let r;if(f?f&&t.segmentInfoType===Y.default.SEGMENT_TIMELINE&&(r=function(e){return o.getValidTimeAheadOfTargetTime(n,i,e,U.get().streaming.gaps.threshold)}(t)):r=function(e){let t=o.getValidTimeAheadOfTargetTime(n,i,e,U.get().streaming.gaps.threshold);return isNaN(t)&&n>=e.adaptation.period.mpd.mediaPresentationDuration-e.segmentDuration&&(t=n-.1),t}(t),!isNaN(r)&&r!==n)return void function(e,t){V.isSeeking()||V.getTime()===0?(_.warn(`Adjusting playback time ${e} because of gap in the manifest. Seeking by ${e-n}`),V.seek(e,!1,!1)):(_.warn(`Adjusting buffering time ${e} because of gap in the manifest. Adjusting time by ${e-n}`),Le(e),t&&oe())}(r,e)}}catch(e){_.error(e)}ae()||e&&oe()}(r)}function ae(){let e=x.getCurrentRepresentation(),r=o.isLastSegmentRequested(e,n);if(r){let e=o.getCurrentIndex();_.debug(`Segment requesting for stream ${W.id} has finished`),k.trigger(m.default.STREAM_REQUESTING_COMPLETED,{segmentIndex:e},{streamId:W.id,mediaType:ee}),t.segmentRequestingCompleted(e),Oe()}return r}function oe(){let e=z.getScheduleTimeout();S.startScheduleTimer(e)}function ce(e){P.addBufferState(ee,e.state,S.getBufferTarget()),e.state!==c.BUFFER_EMPTY||V.isSeeking()||(_.info(`Buffer is empty! Stalling!`),P.pushPlayListTraceMetrics(new Date,Vi.REBUFFERING_REASON))}function le(e){I.syncExecutedRequestsWithBufferedRange(t.getBuffer().getAllBufferRanges(),W.duration),e.quotaExceeded&&e.from>V.getTime()&&Le(e.from),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&S.startScheduleTimer()}function ue(e){if(!e||!e.lastRequestAppended||!e.lastRequestAppended.url)return;let t=e.lastRequestAppended.url;e.lastRequestAppended.range&&(t=t.concat(`_`,e.lastRequestAppended.range)),_.warn(`Blacklisting segment with url ${t}`),H.add(t)}function de(e){if(_.debug(`Appended bytes for ${e.mediaType} and stream id ${e.streamId}`),e.segmentType===T.HTTPRequest.INIT_SEGMENT_TYPE){let t=e.representationId;S.setLastInitializedRepresentationId(t),_.info(`[`+ee+`] lastInitializedRepresentationId changed to `+t)}y&&y.enabled?ye(y.newRepresentation,y.oldRepresentation):D||S.startScheduleTimer(0)}function fe(){y={newRepresentation:null,oldRepresentation:null,enabled:!1}}function pe(e){return new Promise((n=>{if(!x)return Promise.resolve();let r=null;var o;r=e.newRepresentation?{selectedRepresentation:(o=e).newRepresentation,currentMediaInfo:o.newMediaInfo}:i!==null&&j.areMediaInfosEqual(i,e.newMediaInfo)?function(e){return{currentMediaInfo:e.newMediaInfo,selectedRepresentation:x.getCurrentRepresentation()}}(e):function(e){let t=NaN;return t=!U.get().streaming.abr.autoSwitchBitrate[e.newMediaInfo.type]&&e.previouslySelectedRepresentation?e.previouslySelectedRepresentation.bitrateInKbit:A.getInitialBitrateFor(ee),{selectedRepresentation:A.getOptimalRepresentationForBitrate(e.newMediaInfo,t,!1),currentMediaInfo:e.newMediaInfo}}(e),me(r.currentMediaInfo),k.trigger(),function(e){u&&e.selectedRepresentation.dependentRepresentation&&(_.info(`[`+ee+`] selectMediaInfo : call selectMediaInfo on enhancementStreamProcessor for index = `+e.selectedRepresentation.absoluteIndex),u.selectMediaInfo(new io({newMediaInfo:e.selectedRepresentation.mediaInfo,newRepresentation:e.selectedRepresentation})))}(r);let c=A.getPossibleVoRepresentations(i,!1);return x.updateData(c,i.isFragmented,r.selectedRepresentation.id).then((()=>{(function(){let e=x.getCurrentCompositeRepresentation();t.getIsBufferingCompleted()||t.updateBufferTimestampOffset(e)})(),n()})).catch((e=>{_.error(e),n()}))}))}function me(e){j.areMediaInfosEqual(i,e)||k.trigger(g.default.NEW_TRACK_SELECTED,{value:e}),i=e,A.handleNewMediaInfo(i),k.trigger(m.default.MEDIAINFO_UPDATED,{mediaType:ee,streamId:W.id,currentMediaInfo:i})}function he(e){let n=e.newRepresentation,r=e.oldRepresentation,o=Re();n&&r||_.warn(`_handleDifferentSwitchTypes() is missing the target representations`),e.reason&&e.reason.forceReplace?function(e,n){I.abortRequests(),k.trigger(m.default.BUFFER_REPLACEMENT_STARTED,{mediaType:ee,streamId:W.id},{mediaType:ee,streamId:W.id}),S.setShouldCheckPlaybackQuality(!1),t.prepareForForceReplacementQualitySwitch(e,n).then((()=>{ge()})).catch((()=>{ge()}))}(n,r):e&&e.reason&&e.reason.forceAbandon?function(e,n){t.prepareForAbandonQualitySwitch(e,n).then((()=>{_e()})).catch((()=>{_e()}))}(n,r):!z.getFastSwitchEnabled()||o&&o.isPartialSegment?ye(n,r):function(e,n){let r=V.getTime(),o=1.5*(isNaN(e.fragmentDuration)?1:e.fragmentDuration),l=I.getRequests({state:se.FRAGMENT_MODEL_EXECUTED,time:r+o,threshold:0})[0];if(l&&!i.isText){let i=t.getBufferLevel(),u=A.getAbandonmentStateFor(W.id,ee);l.bandwidth<e.bandwidth&&i>=o&&u===c.ALLOW_LOAD?t.prepareForFastQualitySwitch(e,n).then((()=>{ve(r,o)})).catch((()=>{ve(r,o)})):ye(e,n)}else ye(e,n)}(n,r),P.pushPlayListTraceMetrics(new Date,Vi.REPRESENTATION_SWITCH_STOP_REASON),P.createPlaylistTraceMetrics(n.id,1e3*V.getTime(),V.getPlaybackRate())}function ge(){Pe(),fe(),b=!1}function _e(){I.abortRequests(),w=!0,S.setShouldCheckPlaybackQuality(!1),S.startScheduleTimer(),b=!1}function ve(e,t){I.abortRequests(),Le(e+t),S.setShouldCheckPlaybackQuality(!1),S.startScheduleTimer(),b=!1}function ye(e,n){let r=I.getRequests({state:se.FRAGMENT_MODEL_LOADING});if(r&&r.length>0)return _.debug(`Preparing for default quality switch: Waiting for ongoing segment request to be finished before applying switch.`),y.newRepresentation=e,y.oldRepresentation=n,void(y.enabled=!0);t.prepareForDefaultQualitySwitch(e,n).then((()=>{be()})).catch((()=>{be()}))}function be(){S.setShouldCheckPlaybackQuality(!1),i.segmentAlignment||i.subSegmentAlignment?S.startScheduleTimer():Fe(),fe(),b=!1}function xe(e){_.info(`onFragmentLoadingAbandoned request: `+e.request.url+` has been aborted`),V.isSeeking()||S.getSwitchTrack()||b||(_.info(`onFragmentLoadingAbandoned request: `+e.request.url+` has to be downloaded again, origin is not seeking process or switch track call`),e.request&&e.request.isInitializationRequest()?S.setInitSegmentRequired(!0):Le(e.request.startTime+e.request.duration/2),S.startScheduleTimer(0))}function Se(e){_.info(`OnFragmentLoadingCompleted for stream id `+W.id+` and media type `+ee+` - Url:`,e.request?e.request.url:`undefined`,e.request.range?`, Range:`+e.request.range:``),i.isText&&S.startScheduleTimer(0),e.error&&e.request.serviceLocation&&function(e){_.info(`Fragment loading completed with an error`),e&&e.request&&e.request.type&&(e.request.type===T.HTTPRequest.INIT_SEGMENT_TYPE?ie({representationId:e.request.representation.id,sender:{}},!1):e.request.type===T.HTTPRequest.MEDIA_SEGMENT_TYPE&&(Le(e.request.startTime+e.request.duration/2),J(0,!1)))}(e)}function Ce(){Le(V.getTime()),De().startScheduleTimer()}function we(e){let n=e.currentTrackInfo;if(!n)return;let r=v.find((e=>e.index===n.index&&e.lang===n.lang));r&&pe(new io({newMediaInfo:r})).then((()=>{t.setIsBufferingCompleted(!1),Le(V.getTime()),S.setInitSegmentRequired(!0),S.startScheduleTimer()}))}function Te(e){Le(e.quotaExceededTime),Oe()}function Ee(){return t?t.getBuffer():null}function De(){return S}function Oe(){S&&S.clearScheduleTimer()}function ke(e=NaN){let t;return isNaN(e)?t=x?x.getCurrentRepresentation():null:((0,Ve.checkInteger)(e),t=x?x.getRepresentationById(e):null),t}function Ae(){return!!t&&t.getIsBufferingCompleted()}function je(e){if(!U.get().streaming.enableManifestTimescaleMismatchFix)return;let t=e.chunk,n=t.bytes,r=ke(t.representation.id);r&&(r.timescale=M.getMediaTimescaleFromMoov(n))}function Me(e){let t=e.chunk,n=t.bytes,r=ke(t.representation.id);if(r){let t;if(U.get().streaming.parseInbandPrft&&e.request.type===T.HTTPRequest.MEDIA_SEGMENT_TYPE){t||=M.parse(n);let e=function(e,t){let n=e.getBoxes(`prft`),r=[];return n.forEach((e=>{r.push(function(e,t){let n=`unknown`;switch(e.flags){case 0:n=Y.default.PRODUCER_REFERENCE_TIME_TYPE.ENCODER;break;case 16:n=Y.default.PRODUCER_REFERENCE_TIME_TYPE.APPLICATION;break;case 24:n=Y.default.PRODUCER_REFERENCE_TIME_TYPE.CAPTURED}let r=1e3*e.ntp_timestamp_sec+e.ntp_timestamp_frac/2**32*1e3;return r=Uo(O).getInstance().ntpToUTC(r),{type:n,ntpTimestamp:r,mediaTime:e.media_time/t}}(e,t))})),r}(t,r.timescale);e&&e.length&&k.trigger(g.default.INBAND_PRFT,{data:e},{streamId:W.id,mediaType:ee})}let i=j.getEventsFor(r.mediaInfo,null,W),o=j.getEventsFor(r,r,W);if(i&&i.length>0||o&&o.length>0){let r=e.request;t||=M.parse(n);let c=function(e,t,n,r){try{let i={},o=[],c=n.concat(r);for(let e=0,t=c.length;e<t;e++)i[c[e].schemeIdUri+`/`+c[e].value]=c[e];let l=e.getBoxes(`emsg`);if(!l||l.length===0)return o;let u=e.getBox(`sidx`),d=!u||isNaN(u.earliest_presentation_time)||isNaN(u.timescale)?t&&!isNaN(t.mediaStartTime)?t.mediaStartTime:0:u.earliest_presentation_time/u.timescale,f=Math.max(d,0),p=x.getCurrentRepresentation();for(let e=0,t=l.length;e<t;e++){let t=j.getEvent(l[e],i,f,p);t&&o.push(t)}return o}catch{return[]}}(t,r,i,o);k.trigger(m.default.INBAND_EVENTS,{events:c},{streamId:W.id})}}}function Pe(){let e=V.getTime();U.get().streaming.buffer.flushBufferAtTrackSwitch&&V.seek(e+.001,!1,!0),Le(e),t.setSeekTarget(e),S.startScheduleTimer()}function Fe(){let e=V.getTime(),n=t.getContinuousBufferTimeForTargetTime(e);Le(isNaN(n)?e:n),S.startScheduleTimer()}function Ie(e){e&&!isNaN(e.time)&&(Le(e.time),t.setSeekTarget(e.time))}function Le(e){n=e,E=!0}function Re(){return o.getLastSegment()}return d={checkAndHandleCompletedBuffering:ae,clearScheduleTimer:Oe,createBufferSinks:function(e,n){let r=Ee();return r?Promise.resolve(r):t?t.createBufferSink(i,e,n):Promise.resolve(null)},dischargePreBuffer:function(){t.dischargePreBuffer()},finalisePlayList:function(e,t){P.pushPlayListTraceMetrics(e,t)},getAllMediaInfos:function(){return v},getBuffer:Ee,getBufferController:function(){return t},getBufferLevel:function(){return t?t.getBufferLevel():0},getFragmentModel:function(){return I},getLastSegment:Re,getMediaInfo:function(){return i},getMediaSource:function(){return t.getMediaSource()},getRepresentation:ke,getRepresentationController:function(){return x},getScheduleController:De,getStreamId:q,getStreamInfo:function(){return W},getType:te,initialize:function(i,c,u){C=Vo(O).create({events:m.default,eventBus:k,streamInfo:W,timelineConverter:K,dashConstants:Y.default,segmentBaseController:e.segmentBaseController,type:ee}),o=jo(O).create({baseURLController:e.baseURLController,boxParser:M,constants:h.default,dashConstants:Y.default,dashMetrics:P,debug:(0,l.default)(O).getInstance(),errHandler:F,errors:Ne,eventBus:k,events:m.default,mediaPlayerModel:z,segmentsController:C,settings:U,streamInfo:W,timelineConverter:K,type:ee,urlUtils:ht(O).getInstance()}),f=W.manifestInfo.isDynamic,o.initialize(f),A.registerStreamType(ee,d),x=ko(O).create({abrController:A,adapter:j,dashConstants:Y.default,dashMetrics:P,errors:Ne,eventBus:k,events:m.default,isDynamic:f,playbackController:V,segmentsController:C,streamInfo:W,timelineConverter:K,type:ee}),t=function(e,t){let n=null;return e?(n=e!==h.default.TEXT||t?ho(O).create({abrController:A,capabilities:N,errHandler:F,fragmentModel:I,manifestModel:L,mediaController:R,mediaPlayerModel:z,playbackController:V,representationController:x,settings:U,streamInfo:W,textController:G,type:e}):vo(O).create({errHandler:F,fragmentModel:I,mimeType:B,settings:U,streamInfo:W,textController:G,type:e}),n):(F.error(new Be.default(Ne.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Ne.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+`not properly defined`)),null)}(ee,u),t&&t.initialize(i),S=bo(O).create({abrController:A,adapter:j,bufferController:t,dashMetrics:P,fragmentModel:I,mediaController:R,mediaPlayerModel:z,mimeType:B,playbackController:V,representationController:x,settings:U,streamInfo:W,textController:G,type:ee}),r=c,S.initialize(c),n=0,E=!1,w=!1},isBufferingCompleted:Ae,prepareInnerPeriodPlaybackSeeking:function(e){return new Promise((n=>{if(t.hasBufferAtTime(e.seekTime))return t.pruneBuffer(),re(t.getContinuousBufferTimeForTargetTime(e.seekTime))&&t.setIsBufferingCompleted(!0),void n();Oe(),I.abortRequests(),t.prepareForPlaybackSeek().then((()=>{let n=t.getAllRangesWithSafetyFactor(e.seekTime);return t.clearBuffers(n)})).then((()=>{let r=t.getContinuousBufferTimeForTargetTime(e.seekTime);if(re(r))t.setIsBufferingCompleted(!0),n();else{let i=isNaN(r)?e.seekTime:r;Le(i),t.setSeekTarget(i);let o=[];o.push(t.updateAppendWindow());let c=ke();o.push(t.updateBufferTimestampOffset(c)),Promise.all(o).then((()=>{S.setInitSegmentRequired(!0),S.setShouldCheckPlaybackQuality(!1),S.startScheduleTimer(),n()}))}})).catch((e=>{_.error(e)}))}))},prepareOuterPeriodPlaybackSeeking:function(){return new Promise(((e,n)=>{try{Oe(),I.abortRequests(),t.prepareForPlaybackSeek().then((()=>t.pruneAllSafely())).then((()=>{e()}))}catch(e){n(e)}}))},prepareQualityChange:function(e){e.newRepresentation&&(function(e){if(u)u.prepareQualityChange(e);else if(ee===h.default.ENHANCEMENT){let t=e.oldRepresentation.mediaInfo.type,n=e.newRepresentation.mediaInfo.type;if(t===h.default.ENHANCEMENT&&n===h.default.VIDEO)return _.info(`Stop `+ee+` stream processor`),S.reset(),!0;if(t===h.default.VIDEO&&n===h.default.ENHANCEMENT)return _.info(`Start `+ee+` stream processor`),pe(new io({newMediaInfo:e.newRepresentation.mediaInfo,newRepresentation:e.newRepresentation})).then((()=>{S.setup(),S.initialize(r),S.startScheduleTimer()})),!0}return!1}(e)||(y&&y.enabled&&_.warn(`Canceling queued representation switch to ${y.newRepresentation.id} for ${ee}`),e.isAdaptationSetSwitch?(_.debug(`Preparing quality switch to different AdaptationSet for type ${ee} from representation id ${e.oldRepresentation.id} to ${e.newRepresentation.id}`),function(e){let t=e.newRepresentation;b=!0,Oe(),S.setSwitchTrack(!0);let n=t.mediaInfo;me(n),pe(new io({newMediaInfo:n,newRepresentation:t})).then((()=>{he(e)}))}(e)):(_.debug(`Preparing quality within the same AdaptationSet for type ${ee} from representation id ${e.oldRepresentation.id} to ${e.newRepresentation.id}`),function(e){let t=e.newRepresentation;b=!0,Oe(),x.prepareQualityChange(t),he(e)}(e))))},prepareTrackSwitch:function(e,n=!1){return new Promise((r=>{_.debug(`Preparing track switch for type ${ee}`);let i=ee===h.default.TEXT||n||U.get().streaming.trackSwitchMode[ee]===h.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&V.getTimeToStreamEnd(W)>U.get().streaming.buffer.stallThreshold;t.getIsBufferingCompleted()&&!i?function(e){return new Promise((n=>{let r=x.getCurrentRepresentation();t.prepareForNonReplacementTrackSwitch(r,e).then((()=>{k.trigger(m.default.BUFFERING_COMPLETED,{},{streamId:W.id,mediaType:ee}),n()})).catch((()=>{k.trigger(m.default.BUFFERING_COMPLETED,{},{streamId:W.id,mediaType:ee}),n()}))}))}(e).then((()=>{r()})):(S.setSwitchTrack(!0),i?function(e){return new Promise((n=>{k.trigger(m.default.BUFFER_REPLACEMENT_STARTED,{mediaType:ee,streamId:W.id},{mediaType:ee,streamId:W.id}),I.abortRequests();let r=ke();t.prepareForReplacementTrackSwitch(r,e).then((()=>{Pe(),n()})).catch((()=>{Pe(),n()}))}))}(e).then((()=>{r()})):function(e){return new Promise((n=>{let r=()=>{let i=I.getRequests({state:se.FRAGMENT_MODEL_LOADING});if(i&&i.length!==0)k.once(g.default.FRAGMENT_LOADING_COMPLETED,r,d);else{let r=ke();t.prepareForNonReplacementTrackSwitch(r,e).then((()=>{Fe(),n()})).catch((e=>{_.error(e),Fe(),n()}))}};r()}))}(e).then((()=>{r()})))}))},probeNextRequest:function(){let e=ke();return o.getNextSegmentRequestIdempotent(i,e)},reset:function(e,n){o&&o.reset(),t&&=(t.reset(e,n),null),S&&=(S.reset(),null),x&&=(x.reset(),null),C&&=null,A&&A.unRegisterStreamType(q(),ee),k.off(m.default.BUFFER_CLEARED,le,d),k.off(m.default.BUFFER_LEVEL_STATE_CHANGED,ce,d),k.off(m.default.BYTES_APPENDED_END_FRAGMENT,de,d),k.off(m.default.FRAGMENT_LOADING_ABANDONED,xe,d),k.off(m.default.FRAGMENT_LOADING_COMPLETED,Se,d),k.off(m.default.INIT_FRAGMENT_LOADED,je,d),k.off(m.default.INIT_FRAGMENT_NEEDED,ie,d),k.off(m.default.MEDIA_FRAGMENT_LOADED,Me,d),k.off(m.default.MEDIA_FRAGMENT_NEEDED,J,d),k.off(m.default.QUOTA_EXCEEDED,Te,d),k.off(m.default.SEEK_TARGET,Ie,d),k.off(m.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Ce,d),k.off(m.default.SET_NON_FRAGMENTED_TEXT,we,d),k.off(m.default.SOURCE_BUFFER_ERROR,ue,d),ne(),ee=null,W=null},selectMediaInfo:pe,setEnhancementStreamProcessor:function(e){u=e,_.info(`enhancementStreamProcessor = `+u)},setExplicitBufferingTime:Le,setMediaInfoArray:function(e){v=e},setMediaSource:function(e){return t.setMediaSource(e,i)},setTrackSwitchInProgress:function(e){D=e},updateStreamInfo:function(e){return W=e,Ae()?Promise.resolve():t.updateAppendWindow()}},_=(0,l.default)(O).getInstance().getLogger(d),ne(),k.on(m.default.BUFFER_CLEARED,le,d),k.on(m.default.BUFFER_LEVEL_STATE_CHANGED,ce,d),k.on(m.default.BYTES_APPENDED_END_FRAGMENT,de,d),k.on(m.default.FRAGMENT_LOADING_ABANDONED,xe,d),k.on(m.default.FRAGMENT_LOADING_COMPLETED,Se,d),k.on(m.default.INIT_FRAGMENT_LOADED,je,d),k.on(m.default.INIT_FRAGMENT_NEEDED,ie,d),k.on(m.default.MEDIA_FRAGMENT_LOADED,Me,d),k.on(m.default.MEDIA_FRAGMENT_NEEDED,J,d),k.on(m.default.QUOTA_EXCEEDED,Te,d),k.on(m.default.SEEK_TARGET,Ie,d),k.on(m.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Ce,d),k.on(m.default.SET_NON_FRAGMENTED_TEXT,we,d),k.on(m.default.SOURCE_BUFFER_ERROR,ue,d),d}Wo.__dashjs_factory_name=`StreamProcessor`;var Go=i.default.getClassFactory(Wo),Ko=class{constructor(){this.url=null,this.width=null,this.height=null,this.x=null,this.y=null}},qo=class{constructor(){this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl=``,this.id=``}};function Jo(e){let t=this.context,n=e.adapter,r=e.baseURLController,i=e.streamInfo,o=e.timelineConverter,c=e.debug,l=e.eventBus,u=e.events,d=e.dashConstants,f=ht(t).getInstance(),p,m,g,_,v,y,b,x,S;function C(e,t){let i=new qo;i.id=e.id,i.bitrate=e.bandwidth,i.width=e.width,i.height=e.height,i.tilesHor=1,i.tilesVert=1,e.essentialProperties&&e.essentialProperties.forEach((e=>{if(h.default.THUMBNAILS_SCHEME_ID_URIS.indexOf(e.schemeIdUri)>=0&&e.value){let t=e.value.split(`x`);t.length!==2||isNaN(t[0])||isNaN(t[1])||(i.tilesHor=parseInt(t[0],10),i.tilesVert=parseInt(t[1],10))}})),t?b.updateSegmentData(e).then((t=>{(function(e,t,i){let c=[];t.segments=function(e,t){let r=[],i,c,l,u,d=0;for(i=0,c=e.segments.length;i<c;i++)l=e.segments[i],u=Eo({durationInTimescale:l.duration,fTimescale:l.timescale,index:d,isDynamic:n.getIsDynamic(),mediaRange:l.mediaRange,mediaTime:l.startTime,mediaUrl:l.media,representation:t,timelineConverter:o}),u&&(r.push(u),u=null,d++);return r}(i,t),t.fragmentDuration=t.segmentDuration||(t.segments&&t.segments.length>0?t.segments[0].duration:NaN),e.segmentDuration=t.segments[0].duration,e.readThumbnail=function(e,n){let i=null;c.some((t=>{if(t.start<=e&&t.end>e)return i=t.url,!0})),i?n(i):t.segments.some((i=>{if(i.mediaStartTime<=e&&i.mediaStartTime+i.duration>e){let e=new $n({method:`get`,url:r.resolve(t.path).url,responseType:`arraybuffer`,customData:{request:{range:i.mediaRange},onloadend:function(e){let t=S.getSamplesInfo(e.target.response),r=new Blob([e.target.response.slice(t.sampleList[0].offset,t.sampleList[0].offset+t.sampleList[0].size)],{type:`image/jpeg`}),o=window.URL.createObjectURL(r);c.push({start:i.mediaStartTime,end:i.mediaStartTime+i.duration,url:o}),n&&n(o)}}}),o=new er({request:e});return x.load(e,o),!0}}))}})(i,e,t)})):(i.startNumber=e.startNumber,i.segmentDuration=e.segmentDuration,i.timescale=e.timescale,i.templateUrl=function(e){let t=f.isRelative(e.media)?f.resolve(e.media,r.resolve(e.path).url):e.media;return t?Q(t,e.id):``}(e)),i.tilesHor>0&&i.tilesVert>0&&(i.widthPerTile=i.width/i.tilesHor,i.heightPerTile=i.height/i.tilesVert,m.push(i))}function w(){m=[],g=[],v=-1,y=null,_&&=(_.reset(),null)}return p={addTracks:function(){if(!i||!n||(y=n.getMediaInfoForType(i,h.default.IMAGE),!y))return;let e=n.getVoRepresentations(y);e&&e.length>0&&e.forEach((e=>{(e.segmentInfoType===Y.default.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===Y.default.SEGMENT_TIMELINE)&&C(e),e.segmentInfoType===Y.default.SEGMENT_BASE&&C(e,!0),g.push(e)})),m.length>0&&m.sort(((e,t)=>e.bitrate-t.bitrate))},getCurrentTrack:function(){return v<0?null:m[v]},getCurrentTrackIndex:function(){return v},getRepresentations:function(){return g},getThumbnailRequestForTime:function(e){let t,r=n.getVoRepresentations(y);for(let e=0;e<r.length;e++)if(m[v].id===r[e].id){t=r[e];break}return _.getSegmentRequestForTime(y,t,e)},getTracks:function(){return m},reset:w,setTrackById:function(e){if(!m||m.length===0)return;let t=m.findIndex((t=>t.id===e));t!==-1&&(v=t)},setTrackByIndex:function(e){m&&m.length!==0&&(e>=m.length&&(e=m.length-1),v=e)}},w(),x=We(t).create({}),S=wr(t).getInstance(),b=Vo(t).create({events:u,eventBus:l,streamInfo:i,timelineConverter:o,dashConstants:d,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController,type:h.default.IMAGE}),_=jo(t).create({streamInfo:i,type:h.default.IMAGE,timelineConverter:o,segmentsController:b,baseURLController:r,debug:c,eventBus:l,events:u,dashConstants:d,urlUtils:f}),_.initialize(!!n&&n.getIsDynamic()),p}Jo.__dashjs_factory_name=`ThumbnailTracks`;var Yo=i.default.getClassFactory(Jo);function Xo(e){let t=this.context,n=e.streamInfo,r,i;function o(e){i.setTrackByIndex(e)}function c(){i&&i.reset()}return r={getCurrentTrack:function(){return i.getCurrentTrack()},getCurrentTrackIndex:function(){return i.getCurrentTrackIndex()},getPossibleVoRepresentations:function(){return i.getRepresentations()},getStreamId:function(){return n.id},initialize:function(){i.addTracks();let e=i.getTracks();e&&e.length>0&&o(0)},provide:function(e,t){if(typeof t!=`function`)return;let n=i.getCurrentTrack(),r,o;if(!n||n.segmentDuration<=0||e==null)return void t(null);o=i.getThumbnailRequestForTime(e),o&&(n.segmentDuration=o.duration),r=e%n.segmentDuration;let c=Math.floor(r*n.tilesHor*n.tilesVert/n.segmentDuration),l=new Ko;if(l.width=Math.floor(n.widthPerTile),l.height=Math.floor(n.heightPerTile),l.x=Math.floor(c%n.tilesHor)*n.widthPerTile,l.y=Math.floor(c/n.tilesHor)*n.heightPerTile,`readThumbnail`in n)return n.readThumbnail(e,(e=>{l.url=e,t(l)}));o?(l.url=o.url,n.segmentDuration=NaN):l.url=function(e,t){let n=t+e.startNumber;return Q(e.templateUrl,void 0,n,void 0,e.bandwidth,(n-1)*e.segmentDuration*e.timescale)}(n,Math.floor(e/n.segmentDuration)),t(l)},reset:c,setTrackByIndex:o,setTrackById:function(e){i.setTrackById(e)}},c(),i=Yo(t).create({streamInfo:n,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController}),r}Xo.__dashjs_factory_name=`ThumbnailController`;var Zo=i.default.getClassFactory(Xo);let Qo=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT,h.default.MUXED,h.default.IMAGE];function $o(e){e||={};let t=this.context,n=(0,p.default)(t).getInstance(),r=ht(t).getInstance(),i=e.manifestModel,o=e.mediaPlayerModel,c=e.dashMetrics,u=e.manifestUpdater,d=e.adapter,f=e.timelineConverter,_=e.capabilities,v=e.errHandler,y=e.abrController,b=e.playbackController,x=e.throughputController,S=e.eventController,C=e.mediaController,w=e.protectionController,T=e.textController,E=e.videoModel,D=e.streamInfo,O=e.settings,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W;function G(e,t,n){return new Promise(((r,o)=>{ae(),se();let c=E.getElement(),l=[];Qo.forEach((t=>{if((t!==h.default.TEXT||e)&&(t!==h.default.VIDEO||!c||c&&/^VIDEO$/i.test(c.nodeName))){let r=n.find((e=>e.mediaInfo.type===t));l.push(K(t,e,r))}})),Promise.all(l).then((()=>function(e){return new Promise((t=>{let n={},r=H.map((t=>{let n=t.getRepresentation();return t.createBufferSinks(e,n)}));Promise.all(r).then((e=>{e.forEach((e=>{e&&(n[e.getType()]=e)})),t(n)})).catch((()=>{t(n)}))}))}(t))).then((t=>{if(H.length===0){let e=`No streams to play.`;v.error(new Be.default(Ne.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,i.getValue())),z.fatal(e)}else ve();e&&T.createTracks(D),r(t)})).catch((e=>{o(e)}))}))}function K(r,i,o){let c,l=d.getAllMediaInfoForType(D,r),u=[],f=null,p=-1;if(!l||l.length===0)return z.info(`No `+r+` data.`),Promise.resolve();r===h.default.VIDEO&&(P=!0),r===h.default.AUDIO&&(M=!0);for(let e=0,t=l.length;e<t;e++)f=l[e],r===h.default.TEXT&&f.isEmbedded&&(T.addEmbeddedTrack(D,f),u.push(f)),ee(f)&&C.addTrack(f),f.type===h.default.ENHANCEMENT&&(p=e);if(u.length>0&&(C.setInitialMediaSettingsForType(r,D),T.addMediaInfosToBuffer(D,r,u)),l=l.filter((e=>!e.isEmbedded)),l.length===0)return Promise.resolve();if(r===h.default.IMAGE)return U=Zo(t).create({streamInfo:D,adapter:d,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:A,eventBus:n,events:m.default,dashConstants:Y.default,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController}),U.initialize(),Promise.resolve();n.trigger(m.default.STREAM_INITIALIZING,{streamInfo:D,mediaInfo:f}),C.setInitialMediaSettingsForType(r,D);let g=q(l,i,r);if(p>=0){let e=new Za(n);e.open(),e.duration=D.manifestInfo.duration;let t=q(l,e,h.default.ENHANCEMENT);t.selectMediaInfo(new io({newMediaInfo:l[p]})),g.setEnhancementStreamProcessor(t)}if(c=C.getCurrentTrackFor(r,D.id),c){let e=new io({newMediaInfo:r===h.default.TEXT&&c.isEmbedded?l[0]:c,previouslySelectedRepresentation:o});return g.selectMediaInfo(e)}return Promise.resolve()}function ee(e){let t=e?e.type:null,n;return t===h.default.MUXED?(n=`Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines`,z.fatal(n),v.error(new Be.default(Ne.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,n,i.getValue())),!1):!(t!==h.default.TEXT&&t!==h.default.IMAGE&&e.contentProtection&&e.contentProtection.length>0&&!_.supportsEncryptedMedia()&&(v.error(new Be.default(Ne.CAPABILITY_MEDIAKEYS_ERROR_CODE,Ne.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE)),1))}function q(n,r,c){let l=n&&n.length>0?n.filter((e=>e.type===c))[0]:null,u=j.getModel(l?l.type:null),p=l?l.type:null,m=l?l.mimeType:null,g=l?l.isFragmented:null,S=Go(t).create({abrController:y,adapter:d,baseURLController:e.baseURLController,boxParser:k,capabilities:_,dashMetrics:e.dashMetrics,errHandler:v,fragmentModel:u,manifestModel:i,mediaController:C,mediaPlayerModel:o,mimeType:m,playbackController:b,segmentBaseController:e.segmentBaseController,segmentBlacklistController:V,settings:O,streamInfo:D,textController:T,throughputController:x,timelineConverter:f,type:p});return S.initialize(r,P,g),H.push(S),S.setMediaInfoArray(n),p===h.default.TEXT&&T.addMediaInfosToBuffer(D,p,n,u),S}function te(e){let t=H?H.length:0;for(let n=0;n<t;n++){let t=H[n].getFragmentModel();t.abortRequests(),t.resetInitialSettings(),H[n].reset(!1,e)}T&&T.deactivateStream(D),U&&=(U.reset(),null),H=[],I=!1,N=!1,ye(!1),re(!1),n.trigger(m.default.STREAM_DEACTIVATED,{streamInfo:D})}function ne(e){te(e),R=!1,P=!1,M=!1,L=!1,W=[]}function re(e){L=e}function ie(){return D?D.start:NaN}function J(){return D?D.id:null}function ae(){if(!E||!y)throw Error(h.default.MISSING_CONFIG_ERROR)}function oe(e){e.error&&(v.error(e.error),z.fatal(e.error.message))}function se(){if(S){let e=d.getEventsFor(D);e&&e.length>0&&S.addInlineEvents(e,D.id)}}function ce(e){let t=le(e);return t?t.getMediaInfo():null}function le(e){return e?H.find((t=>t.getType()===e)):null}function ue(){let e=ge(),t=e.length;if(t!==0){for(let n=0;n<t;n++)if(!e[n].isBufferingCompleted()&&(e[n].getType()===h.default.AUDIO||e[n].getType()===h.default.VIDEO))return void z.debug(`onBufferingCompleted - One streamProcessor has finished but`,e[n].getType(),`one is not buffering completed`);z.debug(`onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED`),N=!0,n.trigger(m.default.STREAM_BUFFERING_COMPLETED,{streamInfo:D},{streamInfo:D})}else z.warn(`onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined`)}function de(e){S&&S.addInbandEvents(e.events,D.id)}function fe(){ve()}function pe(){se()}function me(e){return e&&e.type?he(e.type):null}function he(e){return e?ge().filter((function(t){return t.getType()===e}))[0]:null}function ge(){let e,t,n=[];for(let r=0;r<H.length;r++)t=H[r],e=t.getType(),e!==h.default.AUDIO&&e!==h.default.VIDEO&&e!==h.default.TEXT&&e!==h.default.ENHANCEMENT||n.push(t);return n}function _e(){let e=H.length;for(let t=0;t<e&&H[t];t++)H[t].getScheduleController().startScheduleTimer()}function ve(){let e=H.length;if(w){w.clearMediaInfoArray();for(let t=0;t<e&&H[t];t++){let e=H[t].getType(),n=H[t].getMediaInfo();if(e===h.default.AUDIO||e===h.default.VIDEO||e===h.default.TEXT&&n&&n.isFragmented){let e=H[t].getMediaInfo();e&&w.initializeForMedia(e)}}w.handleKeySystemFromManifest()}R||(R=!0,E.waitForReadyState(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(()=>{n.trigger(m.default.STREAM_INITIALIZED,{streamInfo:D})})))}function ye(e){B=e}function be(){return B}return F={activate:function(e,t,r=[]){return new Promise(((i,o)=>{if(!I)return be()?(I=!0,n.trigger(m.default.STREAM_ACTIVATED,{streamInfo:D}),void i()):void function(e,t,n=[]){return G(e,t,n)}(e,t,r).then((()=>{I=!0,r&&r.length>0&&_e(),n.trigger(m.default.STREAM_ACTIVATED,{streamInfo:D}),i()})).catch((e=>{o(e)}));i()}))},checkAndHandleCompletedBuffering:function(){N||H.forEach((e=>{e.checkAndHandleCompletedBuffering()}))},deactivate:te,getAdapter:function(){return d},getCurrentMediaInfoForType:function(e){let t=he(e);return t?t.getMediaInfo():null},getCurrentRepresentationForType:function(e){let t=he(e);return t?t.getRepresentation():null},getDuration:function(){return D?D.duration:NaN},getHasAudioTrack:function(){return M},getHasFinishedBuffering:function(){return N},getHasVideoTrack:function(){return P},getId:J,getIsActive:function(){return I},getIsEndedEventSignaled:function(){return L},getPreloaded:be,getRepresentationForTypeById:function(e,t){let n;if(e===h.default.IMAGE){if(!U)return null;n=U.getPossibleVoRepresentations()}else n=function(e){let t=le(e);return t?t.getAllMediaInfos():[]}(e).flatMap((e=>y.getPossibleVoRepresentationsFilteredBySettings(e,!0)));if(!n||n.length===0)return null;let r=n.filter((e=>e.id===t));return r&&r.length>0?r[0]:null},getRepresentationForTypeByIndex:function(e,t){let n;if(e===h.default.IMAGE){if(!U)return null;n=U.getPossibleVoRepresentations()}else{let t=ce(e);n=y.getPossibleVoRepresentationsFilteredBySettings(t,!0)}return n[t=Math.max(Math.min(t,n.length-1),0)]},getRepresentationsByType:function(e){if(ae(),e===h.default.IMAGE)return U?U.getPossibleVoRepresentations():[];let t=ce(e);return y.getPossibleVoRepresentationsFilteredBySettings(t,!0)},getStartTime:ie,getStreamId:function(){return D?D.id:null},getStreamInfo:function(){return D},getStreamProcessors:ge,getThumbnailController:function(){return U},initialize:function(){n.on(m.default.BUFFERING_COMPLETED,ue,F),n.on(m.default.INBAND_EVENTS,de,F),n.on(m.default.DATA_UPDATE_COMPLETED,fe,F),n.on(g.default.PLAYBACK_SEEKED,pe,F),w&&(n.on(m.default.KEY_ERROR,oe,F),n.on(m.default.SERVER_CERTIFICATE_UPDATED,oe,F),n.on(m.default.LICENSE_REQUEST_COMPLETE,oe,F),n.on(m.default.KEY_SYSTEM_SELECTED,oe,F),n.on(m.default.KEY_SESSION_CREATED,oe,F)),T.initializeForStream(D),n.trigger(m.default.STREAM_UPDATED,{streamInfo:D})},initializeForTextWithMediaSource:function(e){return new Promise(((t,n)=>{K(h.default.TEXT,e,null).then((()=>function(){let e=he(h.default.TEXT);return e?e.createBufferSinks():Promise.resolve()}())).then((()=>{T.createTracks(D),t()})).catch((e=>{n(e)}))}))},prepareQualityChange:function(e){let t=he(e.mediaType);t&&t.prepareQualityChange(e)},prepareTrackChange:function(e){if(!I||!D)return;N=!1;let t=e.newMediaInfo,n=i.getValue(),r=me(t);if(!r)return;let o=b.getTime();if(z.info(`Stream - Process track changed at current time `+o),n.refreshManifestOnSwitchTrack)W.push(e),u.getIsUpdating()||(z.debug(`Stream - Refreshing manifest for switch track`),u.refreshManifest());else{r.clearScheduleTimer(),r.setTrackSwitchInProgress(!0);let n=r.getRepresentation();r.selectMediaInfo(new io({newMediaInfo:t})).then((()=>{let t=!!(e&&e.options&&e.options.hasOwnProperty(`replaceBuffer`))&&e.options.replaceBuffer;return r.prepareTrackSwitch(n,t)})).then((()=>{r.setTrackSwitchInProgress(!1)}))}},reset:function(e){j&&=(j.reset(),null),y&&D&&y.clearDataForStream(D.id),V&&=(V.reset(),null),T&&D&&T.clearDataForStream(D.id),C&&D&&C.clearDataForStream(D.id),ne(e),D=null,n.off(m.default.BUFFERING_COMPLETED,ue,F),n.off(m.default.INBAND_EVENTS,de,F),n.off(m.default.DATA_UPDATE_COMPLETED,fe,F),n.off(g.default.PLAYBACK_SEEKED,pe,F),w&&(n.off(m.default.KEY_ERROR,oe,F),n.off(m.default.SERVER_CERTIFICATE_UPDATED,oe,F),n.off(m.default.LICENSE_REQUEST_COMPLETE,oe,F),n.off(m.default.KEY_SYSTEM_SELECTED,oe,F),n.off(m.default.KEY_SESSION_CREATED,oe,F))},setIsEndedEventSignaled:re,setMediaSource:function(e){return new Promise(((t,n)=>{let r=[];for(let t=0;t<H.length;)ee(H[t].getMediaInfo())?(r.push(H[t].setMediaSource(e)),t++):(H[t].reset(),H.splice(t,1));Promise.all(r).then((()=>{for(let e=0;e<H.length;e++)H[e].dischargePreBuffer();if(H.length===0){let e=`No streams to play.`;v.error(new Be.default(Ne.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e+`nostreams`,i.getValue())),z.fatal(e)}t()})).catch((e=>{z.error(e),n(e)}))}))},startPreloading:function(e,t,n=[]){return new Promise(((r,i)=>{be()?i():(z.info(`[startPreloading] Preloading next stream with id ${J()}`),ye(!0),G(e,t,n).then((()=>{for(let e=0;e<H.length&&H[e];e++)H[e].setExplicitBufferingTime(ie()),H[e].getScheduleController().startScheduleTimer();r()})).catch((()=>{ye(!1),i()})))}))},startScheduleControllers:_e,triggerProtectionError:function(e){oe(e)},updateData:function(e){return new Promise((t=>{D=e,S&&se();let r,i=[];for(let e=0,t=H.length;e<t;e++){let t=H[e],n=t.getMediaInfo();i.push(t.updateStreamInfo(D));let r=d.getAllMediaInfoForType(D,t.getType());if(r=r.filter((e=>!e.isEmbedded)),t.setMediaInfoArray(r),r)for(let e=0;e<r.length;e++)d.areMediaInfosEqual(n,r[e])&&i.push(t.selectMediaInfo(new io({newMediaInfo:r[e]})))}Promise.all(i).then((()=>{let e=[];for(;W.length>0;){let t=W.pop(),n=t.newMediaInfo;if(r=me(t.oldMediaInfo),!r)return;let i=r.getRepresentation();r.setTrackSwitchInProgress(!0),e.push(r.prepareTrackSwitch(i)),e.push(r.selectMediaInfo(new io({newMediaInfo:n})))}return Promise.all(e)})).then((()=>{ve(),r&&r.setTrackSwitchInProgress(!1),n.trigger(m.default.STREAM_UPDATED,{streamInfo:D}),t()})).catch((e=>{v.error(e)}))}))}},function(){try{A=(0,l.default)(t).getInstance(),z=A.getLogger(F),ne(),k=wr(t).getInstance(),V=Fe(t).create({updateEventName:m.default.SEGMENT_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:m.default.SEGMENT_LOCATION_BLACKLIST_ADD}),j=ro(t).create({streamInfo:D,mediaPlayerModel:o,dashMetrics:c,errHandler:v,settings:O,boxParser:k,dashConstants:Y.default,urlUtils:r})}catch(e){throw e}}(),F}$o.__dashjs_factory_name=`Stream`;var es=i.default.getClassFactory($o);function ts(){let e=this.context,t=(0,p.default)(e).getInstance(),n=ht(e).getInstance(),r,i,o,c,u,d,f,h,g,_,v,y,b,x,S,C;function w(){h=[],g=[],_=null,v=null,b=null,y=NaN,o=!1,c=!1,x=u.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function E(){u.get().streaming.utcSynchronization.enabled&&!o&&!c&&b&&b.value&&b.schemeIdUri&&!isNaN(y)&&!isNaN(u.get().streaming.utcSynchronization.backgroundAttempts)&&(v&&(Date.now()-v)/1e3<30||(h=[],c=!0,D(isNaN(u.get().streaming.utcSynchronization.backgroundAttempts)?2:u.get().streaming.utcSynchronization.backgroundAttempts)))}function D(e){try{if(e<=0)return void z();let t=Date.now();d[b.schemeIdUri](b.value,(function(n){let r=k(t,Date.now(),n);h.push(r),D(e-1)}),(function(){z()}))}catch{z()}}function O(e=null){let t=e||0;if(!g||g.length===0||t>=g.length)return void A();let n=g[t];if(n)if(d.hasOwnProperty(n.schemeIdUri)){let e=new Date().getTime();d[n.schemeIdUri](n.value,(function(t){let r=k(e,new Date().getTime(),t);b=n,A(r)}),(function(){O(t+1)}))}else O(t+1);else A()}function k(e,t,n){return n-(t-(t-e)/2)}function A(e=NaN){let t=isNaN(e);t&&u.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?function(){let e=f.getLatestMPDRequestHeaderValueByID(`Date`),t=e===null?NaN:new Date(e).getTime();isNaN(t)?R(!0):R(!1,t-Date.now())}():R(t,e)}function j(e){let t=Date.parse(e);return isNaN(t)&&(t=function(e){let t,n,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=(r[8]===`+`?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function M(e){return Date.parse(e)}function N(e){return Date.parse(e)}function P(e,t,n){n()}function F(e,t,n){let r=j(e);isNaN(r)?n():t(r)}function I(e,t,r,i,o){let c,l,u=!1,d=new XMLHttpRequest,f=o?T.HTTPRequest.HEAD:T.HTTPRequest.GET,p=t.match(/\S+/g);if(t=p.shift(),c=function(){u||(u=!0,p.length?I(e,p.join(` `),r,i,o):i())},l=function(){let t,n;d.status===200&&(t=o?d.getResponseHeader(`Date`):d.response,n=e(t),isNaN(n)||(r(n),u=!0))},n.isRelative(t)){let e=C.resolve();e&&(t=n.resolve(t,e.url))}d.open(f,t),d.timeout=5e3,d.onload=l,d.onloadend=c,d.send()}function L(e,t,n){I(N,e,t,n,!0)}function R(e,n){if(isNaN(y)||isNaN(n)||e||function(e){try{let t=B(e),n=isNaN(x)?30:x,r=isNaN(u.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:u.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,o=isNaN(u.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:u.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,c=isNaN(u.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:u.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts,l;t?(l=Math.min(n*r,o),i.debug(`Increasing timeBetweenSyncAttempts to ${l}`)):(l=Math.max(n/r,c),i.debug(`Decreasing timeBetweenSyncAttempts to ${l}`)),x=l}catch{}}(n),!e&&!isNaN(n)){_=Date.now(),o=!1;let e=isNaN(y);y=n,e&&E(),i.debug(`Completed UTC sync. Setting client - server offset to ${n}`)}e&&(b=null,o=!1,S.error(new Be.default(Ne.TIME_SYNC_FAILED_ERROR_CODE,Ne.TIME_SYNC_FAILED_ERROR_MESSAGE)));let r=u.get().streaming.utcSynchronization.artificialTimeOffsetToApply;t.trigger(m.default.UPDATE_TIME_SYNC_OFFSET,{offset:n+r}),t.trigger(m.default.TIME_SYNCHRONIZATION_COMPLETED)}function z(){if(!h||h.length===0)return;let e=h.reduce(((e,t)=>e+t),0)/h.length;B(e)?i.debug(`Completed background UTC sync. Offset is within allowed threshold and is not adjusted.`):(i.debug(`Completed background UTC sync. Setting client - server offset to ${e}`),y=e,t.trigger(m.default.UPDATE_TIME_SYNC_OFFSET,{offset:y})),c=!1,v=Date.now()}function B(e){try{if(isNaN(y))return!0;let t=u.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(u.get().streaming.utcSynchronization.maximumAllowedDrift)?u.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=y-t&&e<=y+t}catch{return!0}}return r={initialize:function(){w(),d={"urn:mpeg:dash:utc:http-head:2014":L,"urn:mpeg:dash:utc:http-xsdate:2014":I.bind(null,j),"urn:mpeg:dash:utc:http-iso:2014":I.bind(null,M),"urn:mpeg:dash:utc:direct:2014":F,"urn:mpeg:dash:utc:http-head:2012":L,"urn:mpeg:dash:utc:http-xsdate:2012":I.bind(null,j),"urn:mpeg:dash:utc:http-iso:2012":I.bind(null,M),"urn:mpeg:dash:utc:direct:2012":F,"urn:mpeg:dash:utc:http-ntp:2014":P,"urn:mpeg:dash:utc:ntp:2014":P,"urn:mpeg:dash:utc:sntp:2014":P}},attemptSync:function(e,n){g=e,o||(function(e){try{if(!e||!u.get().streaming.utcSynchronization.enabled)return!1;let t=isNaN(x)?30:x;return!(_&&t&&!isNaN(t))||(Date.now()-_)/1e3>=t}catch{return!0}}(n)?(o=!0,O()):t.trigger(m.default.TIME_SYNCHRONIZATION_COMPLETED))},setConfig:function(e){e&&(e.dashMetrics&&(f=e.dashMetrics),e.baseURLController&&(C=e.baseURLController),e.errHandler&&(S=e.errHandler),e.settings&&(u=e.settings))},reset:function(){w(),t.off(m.default.ATTEMPT_BACKGROUND_SYNC,E,r)}},i=(0,l.default)(e).getInstance().getLogger(r),t.on(m.default.ATTEMPT_BACKGROUND_SYNC,E,r),r}ts.__dashjs_factory_name=`TimeSyncController`;let ns=i.default.getSingletonFactory(ts);ns.HTTP_TIMEOUT_MS=5e3,i.default.updateSingletonFactory(ts.__dashjs_factory_name,ns);var rs=ns;function is(){let e,t,n,r,i,o=this.context,c=(0,p.default)(o).getInstance();return e={attachMediaSource:function(e){let n=window.URL.createObjectURL(t);return e.setSource(n),r===`managedMediaSource`&&(e.setDisableRemotePlayback(!0),t.addEventListener(`startstreaming`,(()=>{c.trigger(g.default.MANAGED_MEDIA_SOURCE_START_STREAMING)})),t.addEventListener(`endstreaming`,(()=>{c.trigger(g.default.MANAGED_MEDIA_SOURCE_END_STREAMING)}))),n},createMediaSource:function(){let e=`WebKitMediaSource`in window,n=`MediaSource`in window;return`ManagedMediaSource`in window?(t=new ManagedMediaSource,r=`managedMediaSource`,i.info(`Created ManagedMediaSource`)):n?(t=new MediaSource,r=`mediaSource`,i.info(`Created MediaSource`)):e&&(t=new WebKitMediaSource,i.info(`Created WebkitMediaSource`)),t},detachMediaSource:function(e){e.setSource(null)},setConfig:function(e){e&&e.settings&&(n=e.settings)},setDuration:function e(r){t&&t.readyState===`open`&&(r===null&&isNaN(r)||t.duration!==r&&(r!==1/0||n.get().streaming.buffer.mediaSourceDurationInfinity||(r=2**32),function(e){let t=e.sourceBuffers;for(let e=0;e<t.length;e++)if(t[e].updating)return!0;return!1}(t)?setTimeout(e.bind(null,r),50):(i.info(`Set MediaSource duration:`+r),t.duration=r)))},setSeekable:function(e,n){t&&typeof t.setLiveSeekableRange==`function`&&typeof t.clearLiveSeekableRange==`function`&&t.readyState===`open`&&e>=0&&e<n&&(t.clearLiveSeekableRange(),t.setLiveSeekableRange(e,n))},signalEndOfStream:function(e){if(!e||e.readyState!==`open`)return;let t=e.sourceBuffers;for(let e=0;e<t.length;e++)if(t[e].updating||t[e].buffered.length===0)return;i.info(`call to mediaSource endOfStream`),e.endOfStream()}},i=(0,l.default)(o).getInstance().getLogger(e),e}is.__dashjs_factory_name=`MediaSourceController`;var as=i.default.getSingletonFactory(is);function os(){let e=`urn:mpeg:dash:event:2012`,t=`updated`,n=`added`,r=this.context,i=(0,p.default)(r).getInstance(),o,c,u,d,f,m,h,_,v,y,b;function x(){if(!h||!_)throw Error(`setConfig function has to be called previously`)}function S(){b=!1,u={},d={},f=null,y=!1,m=Date.now()/1e3}function C(){try{if(!y){y=!0;let e=_.getTime(),t=e-m;t=m>0?Math.max(0,t):0,w(d,t,e),w(u,t,e),T(d),T(u),m=e,y=!1}}catch(e){y=!1,c.error(e)}}function w(e,t,n){try{k(e,function(r){if(r!==void 0){let i=isNaN(r.duration)?0:r.duration;r.calculatedPresentationTime<=n&&r.calculatedPresentationTime+t+i>=n?j(r,g.default.EVENT_MODE_ON_START):(A(n,i+t,r.calculatedPresentationTime)||function(e){try{let t=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>t}catch(e){return c.error(e),!1}}(r))&&(c.debug(`Removing event ${r.id} from period ${r.eventStream.period.id} as it is expired or invalid`),function(e,t){try{let n=t.eventStream.schemeIdUri,r=t.eventStream.period.id,i=t.eventStream.value,o=t.id;e[r][n]=e[r][n].filter((e=>i&&e.eventStream.value&&e.eventStream.value!==i||e.id!==o)),e[r][n].length===0&&delete e[r][n]}catch(e){c.error(e)}}(e,r))}})}catch(e){c.error(e)}}function T(e){try{for(let t in e)e.hasOwnProperty(t)&&Object.keys(e[t]).length===0&&delete e[t]}catch(e){c.error(e)}}function E(e,r,i=!1){let o=e.eventStream.schemeIdUri,c=e.eventStream.value,l=e.id,u=`discarded`;r[o]||(r[o]=[]);let d=r[o].findIndex((e=>(!c||e.eventStream.value&&e.eventStream.value===c)&&e.id===l));if(d===-1)r[o].push(e),e.triggeredReceivedEvent=!1,e.triggeredStartEvent=!1,u=n;else if(i){let n=r[o][d];e.triggeredReceivedEvent=n.triggeredReceivedEvent,e.triggeredStartEvent=n.triggeredStartEvent,r[o][d]=e,u=t}return u}function D(e){try{if(e.eventStream.value==1){let t=e.calculatedPresentationTime,n;n=e.calculatedPresentationTime==4294967295?NaN:e.calculatedPresentationTime+e.duration,i.trigger(g.default.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:t,newDuration:n,newManifestValidAfter:NaN},{mode:g.default.EVENT_MODE_ON_START})}}catch(e){c.error(e)}}function O(e){try{let t=_.getTime();k(e,(function(e){let n=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.duration)?e.eventStream.period.duration:NaN,r=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.start)?e.eventStream.period.start:NaN;if(isNaN(n)||isNaN(r))return;let i=e.calculatedPresentationTime;Math.abs(i-t)<300&&j(e,g.default.EVENT_MODE_ON_START)}))}catch(e){c.error(e)}}function k(e,t){try{if(e){let n=Object.keys(e);for(let r=0;r<n.length;r++){let i=e[n[r]],o=Object.keys(i);for(let e=0;e<o.length;e++)i[o[e]].forEach((e=>{e!==void 0&&t(e)}))}}}catch(e){c.error(e)}}function A(e,t,n){try{return e-t>n}catch(e){return c.error(e),!1}}function j(t,n){try{let o=_.getTime(),l=t.id;if(n===g.default.EVENT_MODE_ON_RECEIVE&&!t.triggeredReceivedEvent)return c.debug(`Received event ${l}`),t.triggeredReceivedEvent=!0,void i.trigger(t.eventStream.schemeIdUri,{event:t},{mode:n});t.triggeredStartEvent||=(t.eventStream.schemeIdUri===e&&t.eventStream.value==1?t.duration===0&&t.presentationTimeDelta===0||(c.debug(`Starting manifest refresh event ${l} at ${o}`),function(){try{x(),h.refreshManifest()}catch(e){c.error(e)}}()):t.eventStream.schemeIdUri===`urn:mpeg:dash:event:callback:2015`&&t.eventStream.value==1?(c.debug(`Starting callback event ${l} at ${o}`),function(e){try{let t=We(r).create({}),n=new $n({method:`get`,url:e,responseType:`arraybuffer`,customData:{}}),i=new er({request:n});t.load(n,i)}catch(e){c.error(e)}}(t.messageData instanceof Uint8Array?He.default.uint8ArrayToString(t.messageData):t.messageData)):(c.debug(`Starting event ${l} from period ${t.eventStream.period.id} at ${o}`),i.trigger(t.eventStream.schemeIdUri,{event:t},{mode:n}),v.get().streaming.events.deleteEventMessageDataTimeout>-1&&setTimeout((()=>{delete t.messageData,delete t.parsedMessageData}),v.get().streaming.events.deleteEventMessageDataTimeout)),!0)}catch(e){c.error(e)}}return o={addInlineEvents:function(e,r){try{if(x(),u[r]||(u[r]={}),e)for(let i=0;i<e.length;i++){let o=e[i];if(!A(_.getTime(),isNaN(o.duration)?0:o.duration,o.calculatedPresentationTime)){let e=E(o,u[r],!0);e===n?(c.debug(`Added inline event with id ${o.id} from period ${r}`),j(o,g.default.EVENT_MODE_ON_RECEIVE)):e===t&&c.debug(`Updated inline event with id ${o.id} from period ${r}`)}}}catch(e){throw e}},addInbandEvents:function(t,r){try{x(),d[r]||(d[r]={});for(let i=0;i<t.length;i++){let o=t[i];A(_.getTime(),isNaN(o.duration)?0:o.duration,o.calculatedPresentationTime)||(E(o,d[r],!1)===n?(o.eventStream.schemeIdUri===e&&D(o),c.debug(`Added inband event with id ${o.id} from period ${r}`),j(o,g.default.EVENT_MODE_ON_RECEIVE)):c.debug(`Inband event with scheme_id_uri ${o.eventStream.schemeIdUri}, value ${o.eventStream.value}, period id ${r} and event id ${o.id} was ignored because it has been added before.`))}C()}catch(e){throw e}},getInbandEvents:function(){return d},getInlineEvents:function(){return u},start:function(){try{x(),c.debug(`Start Event Controller`);let e=v.get().streaming.events.eventControllerRefreshDelay;b||isNaN(e)||(b=!0,f=setInterval(C,e))}catch(e){throw e}},setConfig:function(e){try{if(!e)return;e.manifestUpdater&&(h=e.manifestUpdater),e.playbackController&&(_=e.playbackController),e.settings&&(v=e.settings)}catch(e){throw e}},reset:function(){(function(){try{f!==null&&b&&(clearInterval(f),f=null,b=!1,function(){try{O(d),O(u)}catch(e){c.error(e)}}())}catch(e){throw e}})(),S()}},c=(0,l.default)(r).getInstance().getLogger(o),S(),o}os.__dashjs_factory_name=`EventController`;var ss=i.default.getSingletonFactory(os),cs={LEVELS:{SUGGESTION:`Suggestion`,WARNING:`Warning`,ERROR:`Error`},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:`NO_UTC_TIMING_ELEMENT`,message:`No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/`},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:`NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE`,message:`SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"`},INVALID_DVR_WINDOW:{key:`INVALID_DVR_WINDOW`,message:`No valid segment found when applying a specification compliant DVR window calculation. Using SegmentTimeline entries as a fallback.`}}},ls=r(445),us=r(1923);function ds(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i,o,u,d,f,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,ee,q,te,ne,re,ie,J,ae,oe,se,ce;function le(){if(!(d&&d.hasOwnProperty(`load`)&&j&&j.hasOwnProperty(`initialize`)&&j.hasOwnProperty(`reset`)&&j.hasOwnProperty(`getClientTimeOffset`)&&f&&A&&v&&W))throw Error(h.default.MISSING_CONFIG_ERROR)}function ue(){(function(){try{let e=_.getStreamsInfo();if(!N&&e.length===0)throw Error(`There are no periods in the MPD`);N&&e.length>0&&v.updateManifestUpdateInfo({currentTime:W.getTime(),buffered:U.getBufferRange(),presentationStartTime:e[0].start,clientTimeOffset:j.getClientTimeOffset()}),M.length>0&&function(e){e.length===0?r.warn(`No periods included in the current manifest. Skipping the filtering of outdated stream objects.`):M=M.filter((t=>{let n=e.filter((e=>e.id===t.getId())).length>0||t.getId()===N.getId();return n||(r.debug(`Removing stream ${t.getId()}`),t.reset(!0),t=null),n}))}(e);let n=[];for(let t=0,r=e.length;t<r;t++){let r=e[t];n.push(fe(r)),v.addManifestUpdateStreamInfo(r)}Promise.all(n).then((()=>new Promise(((t,n)=>{N?t():pe(e,t,n)})))).then((()=>{t.trigger(m.default.STREAMS_COMPOSED),Ie()})).catch((e=>{throw e}))}catch(e){A.error(new Be.default(Ne.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+` nostreamscomposed`,f.getValue())),V=!0,it()}})()}function de(){ae=!0}function fe(t){let n=tt(t.id);return n?n.updateData(t):(n=es(e).create({manifestModel:f,mediaPlayerModel:K,dashMetrics:v,manifestUpdater:u,adapter:_,timelineConverter:j,capabilities:i,capabilitiesFilter:o,errHandler:A,baseURLController:S,segmentBaseController:C,textController:F,abrController:T,playbackController:W,throughputController:E,eventController:O,mediaController:D,protectionController:P,videoModel:U,streamInfo:t,settings:J}),M.push(n),n.initialize(),Promise.resolve())}function pe(e,n,i){try{De();let o=v.getCurrentDVRInfo().range;if(o.end<o.start)return void function(e,n,i,o){oe&&clearTimeout(oe);let c=Math.min(1e3*(-1*(e.end-e.start)+2),2147483647);r.debug(`Waiting for ${c} ms before playback can start`),t.trigger(m.default.AST_IN_FUTURE,{delay:c}),oe=setTimeout((()=>{pe(n,i,o)}),c)}(o,e,n,i);J.get().streaming.applyProducerReferenceTime&&G.calculateProducerReferenceTimeOffsets(e);let c=e[0].manifestInfo;if(J.get().streaming.applyServiceDescription&&G.applyServiceDescription(c),_.getIsDynamic()){let e=Ge(0,c);W.computeAndSetLiveDelay(e,c)}(J.get().streaming.applyContentSteering&&x.shouldQueryBeforeStart()?x.loadSteeringData():Promise.resolve()).then((()=>{let e=f.getValue();e&&S.update(e),me(),n()})).catch((e=>{r.error(e),me(),n()}))}catch(e){i(e)}}function me(){let e=function(){let e;return e=_.getIsDynamic()?function(){let e,t=v.getCurrentDVRInfo();e=(t&&t.range?t.range.end:0)-W.getOriginalLiveDelay();let n=t?t.range:null;if(n){if(isNaN(se)&&se.toString().indexOf(`posix:`)===-1){let t=He(!0);isNaN(t)||(r.info(`Start time from URI parameters: ${t}`),e=Math.min(e,t))}else{r.info(`Start time provided by the app: ${se}`);let t=Ue(!0,se);isNaN(t)||(e=Math.min(e,t))}let t=J.get().streaming.timeShiftBuffer.calcFromSegmentTimeline?.1:0;e=Math.max(e,n.start+t)}return e}():function(){let e=ot()[0].getStreamInfo().start;if(isNaN(se)){let t=He(!1);isNaN(t)||(r.info(`Start time from URI parameters: ${t}`),e=Math.max(e,t))}else{r.info(`Start time provided by the app: ${se}`);let t=Ue(!1,se);isNaN(t)||(e=Math.max(e,t))}return e}(),e}(),n=Ee(e),i=n===null?M[0]:n;t.trigger(m.default.INITIAL_STREAM_SWITCH,{startTime:e}),he(i,null,e),re||=setInterval((function(){!z&&W.getTimeToStreamEnd()<=0&&!W.isSeeking()&&t.trigger(m.default.PLAYBACK_ENDED,{isLast:et().isLast})}),200)}function he(e,n,i){try{if(z||!e||n===e&&e.getIsActive())return;z=!0,t.trigger(m.default.PERIOD_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});let o=!1,c=[],l=ye(n);N=e,n&&(o=we(e,n),c=ve(n),n.deactivate(o)),i=isNaN(i)?!o&&n?e.getStreamInfo().start:NaN:i,r.info(`Switch to stream ${e.getId()}. Seektime is ${i}, current playback time is ${W.getTime()}. Seamless period switch is set to ${o}`),ie=ie.filter((e=>e.getId()!==N.getId())),W.initialize(et(),!!n),U.getElement()?ge({seekTime:i,keepBuffers:o,sourceBufferSinksFromPreviousPeriod:l,streamActivated:!1,representationsFromPreviousPeriod:c}):_e({seekTime:i,keepBuffers:o,sourceBufferSinksFromPreviousPeriod:l})}catch{z=!1}}function ge(e){let t;function n(){if(!H||H.readyState!==`open`)return;r.debug(`MediaSource is open!`),window.URL.revokeObjectURL(t),H.removeEventListener(`sourceopen`,n),H.removeEventListener(`webkitsourceopen`,n),Ve();let i=v.getCurrentDVRInfo();y.setSeekable(i.range.start,i.range.end),e.streamActivated?(isNaN(e.seekTime)||W.seek(e.seekTime,!0,!0),N.setMediaSource(H).then((()=>{N.initializeForTextWithMediaSource(H)}))):_e(e)}function i(){H.addEventListener(`sourceopen`,n,!1),H.addEventListener(`webkitsourceopen`,n,!1),t=y.attachMediaSource(U),r.debug(`MediaSource attached to element. Waiting on open...`)}H?e.keepBuffers?_e(e):(y.detachMediaSource(U),i()):(H=y.createMediaSource(),i())}function _e(e){let n=e.representationsFromPreviousPeriod||[];N.activate(H,e.sourceBufferSinksFromPreviousPeriod,n).then((()=>{isNaN(e.seekTime)||(t.trigger(m.default.SEEK_TARGET,{time:e.seekTime},{streamId:N.getId()}),W.seek(e.seekTime,!1,!0),N.startScheduleControllers()),z=!1,t.trigger(m.default.PERIOD_SWITCH_COMPLETED,{toStreamInfo:et()})}))}function ve(e){return(e?e.getStreamProcessors():[]).map((e=>e.getRepresentation()))}function ye(e){let t=new Map;return e&&(e?e.getStreamProcessors():[]).forEach((e=>{let n=e.getBuffer();n&&t.set(n.getType(),n)})),t}function be(e){let t=Ee(e.seekTime);t&&t!==N?t&&t!==N&&(xe(t),function(e,t){let n=e&&!isNaN(e.seekTime)?e.seekTime:NaN,r=N.getStreamProcessors().map((t=>t.prepareOuterPeriodPlaybackSeeking(e)));Promise.all(r).then((()=>{he(t,N,n)})).catch((e=>{A.error(e)}))}(e,t)):(xe(),function(e){N.getStreamProcessors().forEach((t=>t.prepareInnerPeriodPlaybackSeeking(e))),Xe(Vi.USER_REQUEST_STOP_REASON)}(e)),Y(Bi.SEEK_START_REASON)}function xe(e=null){Se()}function Se(){ie&&ie.length>0&&(ie.forEach((e=>{e.deactivate(!0)})),ie=[])}function Ce(e){if(e.newMediaInfo.streamInfo.id===N.getId()){if(Se(),J.get().streaming.buffer.resetSourceBuffersForTrackSwitch&&e.oldMediaInfo&&e.oldMediaInfo.codec!==e.newMediaInfo.codec){let e=W.getTime();N.deactivate(!1),ge({seekTime:e,keepBuffers:!1,streamActivated:!1});return}N.prepareTrackChange(e)}}function we(e,t){try{return J.get().streaming.buffer.reuseExistingSourceBuffers&&(i.isProtectionCompatible(t.getStreamInfo(),e.getStreamInfo())||ae)&&i.supportsChangeType()&&J.get().streaming.buffer.useChangeType}catch{return!1}}function Te(e,t=null){if(!H||e.getPreloaded()||!we(e,t))return;let n=ve(t),r=ye(t);e.startPreloading(H,r,n).then((()=>{ie.push(e)}))}function Ee(e){if(isNaN(e))return null;let t=M.length;for(let n=0;n<t;n++){let t=M[n];if(e<parseFloat((t.getStartTime()+t.getDuration()).toFixed(5)))return t}return null}function De(){try{let e=_.getIsDynamic(),t=_.getStreamsInfo()[0].manifestInfo,n=W.getTime(),r=j.calcTimeShiftBufferWindow(M,e),i=Re();if(r.start===void 0||r.end===void 0)return;i&&i.length!==0?i.forEach((e=>{v.addDVRInfo(e.getType(),n,t,r)})):v.addDVRInfo(h.default.VIDEO,n,t,r)}catch{}}function Oe(e){if(te&&R){let e=K.getInitialBufferLevel(),t=[h.default.TEXT];(isNaN(e)||e<=W.getBufferLevel(t)||_.getIsDynamic()&&e>W.getLiveDelay())&&(te=!1,Y(Bi.INITIAL_PLAYOUT_START_REASON),W.play())}e&&e.mediaType&&v.addBufferLevel(e.mediaType,new Date,1e3*e.bufferLevel)}function ke(e){e.streamInfo.id===N.getId()&&Se(),tt(e.streamInfo.id).prepareQualityChange(e)}function Ae(){if(_.getIsDynamic()&&W.getOriginalLiveDelay()!==0&&N){let e=_.getStreamsInfo();if(e.length>0){let t=e[0].manifestInfo,n=Ge(0,t);W.computeAndSetLiveDelay(n,t)}}}function je(){if(Je()){let e=U.getPlaybackQuality();e&&v.addDroppedFrames(e)}}function Me(){r.debug(`[onPlaybackStarted]`),!te&&q&&Y(Bi.RESUME_FROM_PAUSE_START_REASON),te&&=!1,ne&&(ne=!1,J.get().streaming.applyContentSteering&&!x.shouldQueryBeforeStart()&&x.loadSteeringData()),q=!1}function Pe(e){r.debug(`[onPlaybackPaused]`),e.ended||(q=!0,Xe(Vi.USER_REQUEST_STOP_REASON))}function Fe(e){r.debug(`Stream with id ${e.streamInfo.id} finished buffering`);let t=e.streamInfo.isLast;H&&t?(r.info(`[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController.`),y.signalEndOfStream(H)):Ie()}function Ie(){if(!N)return;if(!N.getHasFinishedBuffering())return void N.checkAndHandleCompletedBuffering();let e=function(e=null){try{let t=e||N||null;if(t){let e=t.getStreamInfo();return M.filter((function(t){let n=t.getStreamInfo();return n.start>e.start&&e.id!==n.id}))}}catch{return[]}}(N),t=0;for(;t<e.length;){let n=e[t],r=t===0?N:e[t-1];!n.getPreloaded()&&r.getHasFinishedBuffering()&&Te(n,r),t+=1}}function Le(){re&&=(clearInterval(re),null)}function Re(){return N?N.getStreamProcessors():[]}function ze(e){if(N&&!N.getIsEndedEventSignaled()){N.setIsEndedEventSignaled(!0);let e=function(e=null){let t=e||N||null;if(!t)return null;let n=t.getStreamInfo(),r=n.start,i=0,o=-1,c=NaN;for(;i<M.length;){let e=M[i].getStreamInfo(),t=e.start-r;t>0&&(isNaN(c)||t<c)&&n.id!==e.id&&(c=t,o=i),i+=1}return o>=0?M[o]:null}();e?(r.debug(`StreamController onEnded, found next stream with id ${e.getStreamInfo().id}. Switching from ${N.getStreamInfo().id} to ${e.getStreamInfo().id}`),he(e,N,NaN)):(r.debug(`StreamController no next stream found`),N.setIsEndedEventSignaled(!1)),Xe(e?Vi.END_OF_PERIOD_STOP_REASON:Vi.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&(Le(),x.stopSteeringRequestTimer())}function Ve(e){let t=e||et().manifestInfo.duration;y.setDuration(t)}function He(e){let t=w.getURIFragmentData();if(!t||!t.t)return NaN;let n=ot()[0].getStreamInfo().start;return t.t=t.t.split(`,`)[0],We(e,t.t,n)}function Ue(e,t){let n=0;return e||(n=ot()[0].getStreamInfo().start),We(e,t,n)}function We(e,t,n){let r=_.getRegularPeriods()[0],i=t.toString(),o=i.indexOf(`posix:`)===-1?NaN:i.substring(6)===`now`?Date.now()/1e3:parseFloat(i.substring(6));return e&&!isNaN(o)?j.calcPresentationTimeFromWallTime(new Date(1e3*o),r):parseFloat(i)+n}function Ge(e,t){try{return t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration)?t.maxFragmentDuration:NaN}catch{return NaN}}function Ke(){let e=f.getValue();S.initialize(e)}function qe(e){if(e.error)V=!0,it();else{r.info(`Manifest updated... updating data system wide.`);let n=e.manifest;_.updatePeriods(n),o.filterUnsupportedFeatures(n).then((()=>{S.initialize(n);let e=_.getUTCTimingSources();!_.getIsDynamic()||e&&e.length!==0||t.trigger(g.default.CONFORMANCE_VIOLATION,{level:cs.LEVELS.WARNING,event:cs.EVENTS.NO_UTC_TIMING_ELEMENT});let r=_.getIsDynamic()?e.concat(ee.getUTCTimingSources()):e;b.attemptSync(r,_.getIsDynamic()),L.createFinalQueryStrings(n)}))}}function Je(){return!!N&&N.getHasVideoTrack()}function Ye(){return!!N&&N.getHasAudioTrack()}function Xe(e,t){t||=new Date,Re().forEach((n=>{n.finalisePlayList(t,e)})),v.addPlayList()}function Y(e){v.createPlaylistMetrics(1e3*W.getTime(),e)}function Ze(e){P.updateKeyStatusesMap(e),function(){let e=Re(),r=!1;e.forEach((e=>{let t=e.getMediaInfo();!t||i.areKeyIdsUsable(t)?t&&i.areKeyIdsExpired(t)&&function(e){let t=tt(e.getStreamId());t&&t.triggerProtectionError({error:new Be.default(us.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,us.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)})}(e):(r=!0,function(e){let t=e.getAllMediaInfos().filter((e=>i.areKeyIdsUsable(e)));if(t&&t.length!==0)D.setTrack(t[0],{replaceBuffer:!0});else{let t=e.getType();A.error(new Be.default(Ne.NO_SUPPORTED_KEY_IDS,`Type: ${t}: ${Ne.NO_SUPPORTED_KEY_IDS_MESSAGE}`))}}(e))})),r&&(W.getTime()===0?t.once(g.default.FRAGMENT_LOADING_COMPLETED,(()=>{Qe()}),n):W.isProgressing(500).then((e=>{e||Qe()})))}()}function Qe(){let e=W.getTime();W.seek(e+.01,!1,!1)}function $e(e){if(!e.error)return;let t;switch(e.error.code){case 1:t=`MEDIA_ERR_ABORTED`;break;case 2:t=`MEDIA_ERR_NETWORK`;break;case 3:t=`MEDIA_ERR_DECODE`,ce.counts.mediaErrorDecode+=1;break;case 4:t=`MEDIA_ERR_SRC_NOT_SUPPORTED`;break;case 5:t=`MEDIA_ERR_ENCRYPTED`;break;default:t=`UNKNOWN`}t===`MEDIA_ERR_DECODE`&&J.get().errors.recoverAttempts.mediaErrorDecode>=ce.counts.mediaErrorDecode?function(){r.error(`A MEDIA_ERR_DECODE occured: Resetting the MediaSource`);let e=W.getTime();N.deactivate(!1),r.info(`MediaSource has been resetted. Resuming playback from time ${e}`),ge({seekTime:e,keepBuffers:!1,streamActivated:!1})}():(B=!0,e.error.message&&(t+=` (`+e.error.message+`)`),e.error.msExtendedCode&&(t+=` (0x`+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+`)`),r.fatal(`Video Element Error: `+t),e.error&&r.fatal(e.error),A.error(new Be.default(e.error.code,t)),it())}function et(){return N?N.getStreamInfo():null}function tt(e){for(let t=0,n=M.length;t<n;t++)if(M[t].getId()===e)return M[t];return null}function nt(e){isNaN(e.newDuration)||Ve(e.newDuration)}function rt(){M=[],se=NaN,P=null,z=!1,N=null,B=!1,V=!1,te=!0,ne=!0,q=!1,R=!0,re=null,ae=!1,ie=[],oe=null,ce={counts:{mediaErrorDecode:0}}}function it(){le(),b.reset(),Xe(B||V?Vi.FAILURE_STOP_REASON:Vi.USER_REQUEST_STOP_REASON);for(let e=0,t=M?M.length:0;e<t;e++)M[e].reset(B);t.off(g.default.PLAYBACK_TIME_UPDATED,je,n),t.off(g.default.PLAYBACK_SEEKING,be,n),t.off(g.default.PLAYBACK_ERROR,$e,n),t.off(g.default.PLAYBACK_STARTED,Me,n),t.off(g.default.PLAYBACK_PAUSED,Pe,n),t.off(g.default.PLAYBACK_ENDED,ze,n),t.off(g.default.METRIC_ADDED,at,n),t.off(g.default.MANIFEST_VALIDITY_CHANGED,nt,n),t.off(g.default.BUFFER_LEVEL_UPDATED,Oe,n),t.off(g.default.QUALITY_CHANGE_REQUESTED,ke,n),t.off(g.default.CONTENT_STEERING_REQUEST_COMPLETED,Ke,n),m.default.KEY_SESSION_UPDATED&&t.off(m.default.KEY_SESSION_UPDATED,de,n),t.off(m.default.MANIFEST_UPDATED,qe,n),t.off(m.default.STREAM_BUFFERING_COMPLETED,Fe,n),t.off(m.default.TIME_SYNCHRONIZATION_COMPLETED,ue,n),t.off(m.default.CURRENT_TRACK_CHANGED,Ce,n),t.off(m.default.SETTING_UPDATED_LIVE_DELAY,Ae,n),t.off(m.default.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,Ae,n),t.off(ls.default.INTERNAL_KEY_STATUSES_CHANGED,Ze,n),S.reset(),u.reset(),O.reset(),v.clearAllCurrentMetrics(),f.setValue(null),d.reset(),j.reset(),k.reset(),H&&=(y.detachMediaSource(U),null),U=null,P&&(P=null,I=null,f.getValue()&&t.trigger(m.default.PROTECTION_DESTROYED,{data:f.getValue().url})),Le(),t.trigger(m.default.STREAM_TEARDOWN_COMPLETE),rt()}function at(e){if(e.metric===c.DVR_INFO){let t=Ye()?h.default.AUDIO:h.default.VIDEO;e.mediaType===t&&y.setSeekable(e.value.range.start,e.value.range.end)}}function ot(){return M}return n={addDVRMetric:De,getActiveStream:function(){return N},getActiveStreamInfo:et,getActiveStreamProcessors:Re,getAutoPlay:function(){return R},getHasMediaOrInitialisationError:function(){return B||V},getInitialPlayback:function(){return te},getIsStreamSwitchInProgress:function(){return z},getStreamById:tt,getStreamForTime:Ee,getStreams:ot,getTimeRelativeToStreamId:function(e,t){let n=null,r=0,i=0,o=null;for(let c=0;c<M.length;c++){if(n=M[c],i=n.getStartTime(),o=n.getDuration(),Number.isFinite(i)&&(r=i),n.getId()===t)return e-r;Number.isFinite(o)&&(r+=o)}return null},hasAudioTrack:Ye,hasVideoTrack:Je,initialize:function(r,i){le(),R=r,I=i,j.initialize(),u=Ea(e).create(),u.setConfig({manifestModel:f,adapter:_,manifestLoader:d,errHandler:A,settings:J,contentSteeringController:x}),u.initialize(),O=ss(e).getInstance(),O.setConfig({manifestUpdater:u,playbackController:W,settings:J}),O.start(),L=Qn(e).getInstance(),b.setConfig({dashMetrics:v,baseURLController:S,errHandler:A,settings:J}),b.initialize(),y.setConfig({settings:J}),P&&(t.trigger(m.default.PROTECTION_CREATED,{controller:P}),P.setMediaElement(U.getElement()),I&&P.setProtectionData(I)),t.on(g.default.PLAYBACK_TIME_UPDATED,je,n),t.on(g.default.PLAYBACK_SEEKING,be,n),t.on(g.default.PLAYBACK_ERROR,$e,n),t.on(g.default.PLAYBACK_STARTED,Me,n),t.on(g.default.PLAYBACK_PAUSED,Pe,n),t.on(g.default.PLAYBACK_ENDED,ze,n),t.on(g.default.METRIC_ADDED,at,n),t.on(g.default.MANIFEST_VALIDITY_CHANGED,nt,n),t.on(g.default.BUFFER_LEVEL_UPDATED,Oe,n),t.on(g.default.QUALITY_CHANGE_REQUESTED,ke,n),t.on(g.default.CONTENT_STEERING_REQUEST_COMPLETED,Ke,n),m.default.KEY_SESSION_UPDATED&&t.on(m.default.KEY_SESSION_UPDATED,de,n),t.on(m.default.MANIFEST_UPDATED,qe,n),t.on(m.default.STREAM_BUFFERING_COMPLETED,Fe,n),t.on(m.default.TIME_SYNCHRONIZATION_COMPLETED,ue,n),t.on(m.default.CURRENT_TRACK_CHANGED,Ce,n),t.on(m.default.SETTING_UPDATED_LIVE_DELAY,Ae,n),t.on(m.default.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,Ae,n),t.on(ls.default.INTERNAL_KEY_STATUSES_CHANGED,Ze,n)},load:function(e,t=NaN){le(),se=t,d.load(e)},loadWithManifest:function(e,t=NaN){(function(){if(!u||!u.hasOwnProperty(`setManifest`))throw Error(`initialize function has to be called previously`)})(),se=t,u.setManifest(e)},refreshManifest:function(){u.getIsUpdating()||u.refreshManifest()},reset:it,setConfig:function(e){e&&(e.capabilities&&(i=e.capabilities),e.capabilitiesFilter&&(o=e.capabilitiesFilter),e.manifestLoader&&(d=e.manifestLoader),e.manifestModel&&(f=e.manifestModel),e.mediaPlayerModel&&(K=e.mediaPlayerModel),e.customParametersModel&&(ee=e.customParametersModel),e.protectionController&&(P=e.protectionController),e.adapter&&(_=e.adapter),e.dashMetrics&&(v=e.dashMetrics),e.errHandler&&(A=e.errHandler),e.timelineConverter&&(j=e.timelineConverter),e.videoModel&&(U=e.videoModel),e.playbackController&&(W=e.playbackController),e.throughputController&&(E=e.throughputController),e.serviceDescriptionController&&(G=e.serviceDescriptionController),e.contentSteeringController&&(x=e.contentSteeringController),e.textController&&(F=e.textController),e.abrController&&(T=e.abrController),e.mediaController&&(D=e.mediaController),e.settings&&(J=e.settings),e.baseURLController&&(S=e.baseURLController),e.uriFragmentModel&&(w=e.uriFragmentModel),e.segmentBaseController&&(C=e.segmentBaseController),e.manifestUpdater&&(u=e.manifestUpdater))},setProtectionData:function(e){I=e,P&&P.setProtectionData(I)},switchToVideoElement:function(e){N&&(W.initialize(et()),ge({seekTime:e,keepBuffers:!1,streamActivated:!0}))}},r=(0,l.default)(e).getInstance().getLogger(n),b=rs(e).getInstance(),y=as(e).getInstance(),k=uo(e).getInstance(),rt(),n}ds.__dashjs_factory_name=`StreamController`;var fs=i.default.getSingletonFactory(ds),ps=class extends Hr{constructor(){super(),this.captionData=null,this.label=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1,this.isTTML=null}},ms=r(7377);function hs(){let e,t=0;function n(e){let t=``;for(let n=0;n<e.length;++n)t+=e[n].uchar;return t.length-t.replace(/^\s+/,``).length}function r(e){return`left: `+3.125*e.x+`%; top: `+6.66*e.y1+`%; width: `+(100-3.125*e.x)+`%; height: `+6.66*Math.max(e.y2-1-e.y1,1)+`%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;`}function i(e){return e===`red`?`rgb(255, 0, 0)`:e===`green`?`rgb(0, 255, 0)`:e===`blue`?`rgb(0, 0, 255)`:e===`cyan`?`rgb(0, 255, 255)`:e===`magenta`?`rgb(255, 0, 255)`:e===`yellow`?`rgb(255, 255, 0)`:e===`white`?`rgb(255, 255, 255)`:e===`black`?`rgb(0, 0, 0)`:e}function o(e,t){let n=e.videoHeight/15;return t?`font-size: `+n+`px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: `+(t.foreground?i(t.foreground):`rgb(255, 255, 255)`)+`; font-style: `+(t.italics?`italic`:`normal`)+`; text-decoration: `+(t.underline?`underline`:`none`)+`; white-space: pre; background-color: `+(t.background?i(t.background):`transparent`)+`;`:`font-size: `+n+`px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;`}function c(e){return e.replace(/^\s+/g,``)}function l(e){return e.replace(/\s+$/g,``)}return e={createHTMLCaptionsFromScreen:function(e,i,u,d){let f=null,p=null,m=!1,h=-1,g={start:i,end:u,spans:[]},_=`style_cea608_white_black`,v={},y={},b=[],x,S;for(x=0;x<15;++x){let e=d.rows[x],t=``,r=null;if(!1===e.isEmpty()){let o=n(e.chars);f===null&&(f={x:o,y1:x,y2:x+1,p:[]}),o!==h&&m&&(f.p.push(g),g={start:i,end:u,spans:[]},f.y2=x,f.name=`region_`+f.x+`_`+f.y1+`_`+f.y2,!1===v.hasOwnProperty(f.name)?(b.push(f),v[f.name]=f):(p=v[f.name],p.p.contat(f.p)),f={x:o,y1:x,y2:x+1,p:[]});for(let n=0;n<e.chars.length;++n){let i=e.chars[n],o=i.penState;if(r===null||!o.equals(r)){t.trim().length>0&&(g.spans.push({name:_,line:t,row:x}),t=``);let e=`style_cea608_`+o.foreground+`_`+o.background;o.underline&&(e+=`_underline`),o.italics&&(e+=`_italics`),y.hasOwnProperty(e)||(y[e]=JSON.parse(JSON.stringify(o))),r=o,_=e}t+=i.uchar}t.trim().length>0&&g.spans.push({name:_,line:t,row:x}),m=!0,h=o}else m=!1,h=-1,f&&=(f.p.push(g),g={start:i,end:u,spans:[]},f.y2=x,f.name=`region_`+f.x+`_`+f.y1+`_`+f.y2,!1===v.hasOwnProperty(f.name)?(b.push(f),v[f.name]=f):(p=v[f.name],p.p.contat(f.p)),null)}f&&=(f.p.push(g),f.y2=x+1,f.name=`region_`+f.x+`_`+f.y1+`_`+f.y2,!1===v.hasOwnProperty(f.name)?(b.push(f),v[f.name]=f):(p=v[f.name],p.p.contat(f.p)),null);let C=[];for(x=0;x<b.length;++x){let n=b[x],d=`sub_cea608_`+ t++,f=document.createElement(`div`);f.id=d;let p=r(n);f.style.cssText=`position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;`+p;let m=document.createElement(`div`);m.className=`paragraph bodyStyle`,m.style.cssText=o(e);let h=document.createElement(`div`);h.className=`cueUniWrapper`,h.style.cssText=`unicode-bidi: normal; direction: ltr;`;for(let t=0;t<n.p.length;++t){let r=n.p[t],i=0;for(S=0;S<r.spans.length;++S){let t=r.spans[S];if(t.line.length>0){if(S!==0&&i!=t.row){let e=document.createElement(`br`);e.className=`lineBreak`,h.appendChild(e)}let n=!1;i===t.row&&(n=!0),i=t.row;let u=y[t.name],d=document.createElement(`span`);d.className=`spanPadding `+t.name+` customSpanColor`,d.style.cssText=o(e,u),S!==0&&n?S===r.spans.length-1?d.textContent=l(t.line):d.textContent=t.line:r.spans.length>1&&S<r.spans.length-1&&t.row===r.spans[S+1].row?d.textContent=c(t.line):d.textContent=t.line.trim(),h.appendChild(d)}}}m.appendChild(h),f.appendChild(m);let g={bodyStyle:[`%`,90]};for(let e in y)y.hasOwnProperty(e)&&(g[e]=[`%`,90]);C.push({type:`html`,start:i,end:u,cueHTMLElement:f,cueID:d,cellResolution:[32,15],isFromCEA608:!0,fontSize:g,lineHeight:{},linePadding:{}})}return C}},e}hs.__dashjs_factory_name=`EmbeddedTextHtmlRender`;var gs=i.default.getSingletonFactory(hs),_s=class{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){let n=typeof t==`function`?t():t;console.log(`${this.time} [${e}] ${n}`)}}},vs=class{constructor(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}reset(){this.foreground=`white`,this.underline=!1,this.italics=!1,this.background=`black`,this.flash=!1}setStyles(e){for(let t of[`foreground`,`underline`,`italics`,`background`,`flash`])Object.prototype.hasOwnProperty.call(e,t)&&(this[t]=e[t])}isDefault(){return this.foreground===`white`&&!this.underline&&!this.italics&&this.background===`black`&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}},ys=class{constructor(){this.uchar=` `,this.penState=new vs}reset(){this.uchar=` `,this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===` `&&this.penState.isDefault()}};let bs={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499};function xs(e){return String.fromCharCode(bs[e]||e)}var Ss=class{constructor(e=new _s){this.chars=[],this.cueStartTime=null,this.pos=0,this.currPenState=new vs;for(let e=0;e<100;e++)this.chars.push(new ys);this.logger=e}equals(e){for(let t=0;t<100;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<100;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,`Negative cursor position `+this.pos),this.pos=0):this.pos>100&&(this.logger.log(3,`Too large cursor position `+this.pos),this.pos=100)}moveCursor(e){let t=this.pos+e;if(e>1)for(let e=this.pos+1;e<t+1;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(` `,this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=xs(e);this.pos>=100?this.logger.log(0,(()=>`Cannot insert `+e.toString(16)+` (`+t+`) at position `+this.pos+`. Skipping it!`)):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t<100;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let n=0;n<100;n++){let r=this.chars[n].uchar;r!==` `&&(t=!1),e.push(r)}return t?``:e.join(``)}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}},Cs=class{constructor(e=new _s){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null;for(let t=0;t<15;t++)this.rows.push(new Ss(e));this.logger=e}reset(){for(let e=0;e<15;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<15;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,`setCursor: `+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,(()=>`pacData = `+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<15;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){let r=n.rows[e].cueStartTime,i=this.logger.time;if(r!==null&&i!==null&&r<i)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(n.rows[e+r])}}this.currRow=t;let n=this.rows[this.currRow];if(e.indent!==null){let t=e.indent,r=Math.max(t-1,0);n.setCursor(e.indent),e.color=n.chars[r].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:`black`,flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,(()=>`bkgData = `+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null)return void this.logger.log(3,`roll_up but nrRollUpRows not set yet`);this.logger.log(1,(()=>this.getDisplayText()));let e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,`Rolling up`)}getDisplayText(e){e||=!1;let t=[],n=``,r=-1;for(let n=0;n<15;n++){let i=this.rows[n].getTextString();i&&(r=n+1,e?t.push(`Row `+r+`: '`+i+`'`):t.push(i.trim()))}return t.length>0&&(n=e?`[`+t.join(` | `)+`]`:t.join(`
58
58
  `)),n}getTextAndFormat(){return this.rows}},ws=class{constructor(e,t,n=new _s){this.chNr=e,this.outputFilter=t,this.mode=null,this.displayedMemory=new Cs(n),this.nonDisplayedMemory=new Cs(n),this.lastOutputScreen=new Cs(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n,this.logger.log(2,`new Cea608Channel(`+this.chNr+`)`)}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter?.reset?.(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>`MODE=`+e)),this.mode===`MODE_POP-ON`?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!==`MODE_ROLL-UP`&&(this.displayedMemory.setRollUpRows(null),this.nonDisplayedMemory.setRollUpRows(null)),this.mode=e)}insertChars(e){for(let t of e)this.writeScreen.insertChar(t);let t=this.writeScreen===this.displayedMemory?`DISP`:`NON_DISP`;this.logger.log(2,(()=>t+`: `+this.writeScreen.getDisplayText(!0))),this.mode!==`MODE_PAINT-ON`&&this.mode!==`MODE_ROLL-UP`||(this.logger.log(1,(()=>`DISPLAYED: `+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,`RCL - Resume Caption Loading`),this.setMode(`MODE_POP-ON`)}ccBS(){this.logger.log(2,`BS - BackSpace`),this.mode!==`MODE_TEXT`&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,`DER- Delete to End of Row`),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,`RU(`+e+`) - Roll Up`),this.writeScreen=this.displayedMemory,this.setMode(`MODE_ROLL-UP`),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,`FON - Flash On`),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,`RDC - Resume Direct Captioning`),this.setMode(`MODE_PAINT-ON`)}ccTR(){this.logger.log(2,`TR`),this.setMode(`MODE_TEXT`)}ccRTD(){this.logger.log(2,`RTD`),this.setMode(`MODE_TEXT`)}ccEDM(){this.logger.log(2,`EDM - Erase Displayed Memory`),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,`CR - Carriage Return`),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,`ENM - Erase Non-displayed Memory`),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,`EOC - End Of Caption`),this.mode===`MODE_POP-ON`){let e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>`DISP: `+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,`TO(`+e+`) - Tab Offset`),this.writeScreen.moveCursor(e)}ccMIDROW(e){let t={flash:!1};t.underline=e%2==1,t.italics=e>=46,t.italics?t.foreground=`white`:t.foreground=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`][Math.floor(e/2)-16],this.logger.log(2,`MIDROW: `+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){let t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};let Ts=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`black`,`transparent`];function Es(e,t,n){return n.a===e&&n.b===t}function Ds(e){let t=[];for(let n of e)t.push(n.toString(16));return t}let Os={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ks={25:2,26:4,29:6,30:8,31:10,27:13,28:15},As={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},js={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14};function Ms(e,t,n){n.a=e,n.b=t}var Ns=class{constructor(e,t,n){this.currentChannel=0,this.cmdHistory={a:null,b:null},this.lastTime=null;let r=this.logger=new _s;this.channels=[null,new ws(e,t,r),new ws(e+1,n,r)]}addData(e,t){this.lastTime=e,this.logger.time=e;for(let n=0;n<t.length;n+=2){let r=127&t[n],i=127&t[n+1],o=!1,c=null;if(this.lastTime!==null&&(e=this.lastTime+.5*n*1001/3e4,this.logger.time=e),r===0&&i===0)continue;this.logger.log(3,(()=>`[`+Ds([t[n],t[n+1]])+`] -> (`+Ds([r,i])+`)`));let l=this.cmdHistory;if(r>=16&&r<=31){if(Es(r,i,l)){Ms(null,null,l),this.logger.log(3,(()=>`Repeated command (`+Ds([r,i])+`) is dropped`));continue}Ms(r,i,this.cmdHistory),o=this.parseCmd(r,i),o||=this.parseMidrow(r,i),o||=this.parsePAC(r,i),o||=this.parseBackgroundAttributes(r,i)}else Ms(null,null,l);if(!o&&(c=this.parseChars(r,i),c.length)){let e=this.currentChannel;e&&e>0?this.channels[e].insertChars(c):this.logger.log(2,`No channel found yet. TEXT-MODE?`)}o||c||this.logger.log(2,(()=>`Couldn't parse cleaned data `+Ds([r,i])+` orig: `+Ds([t[n],t[n+1]])))}}parseCmd(e,t){if(!((e===20||e===28||e===21||e===29)&&t>=32&&t<=47||(e===23||e===31)&&t>=33&&t<=35))return!1;let n=e===20||e===21||e===23?1:2,r=this.channels[n];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(n=e===17?1:2,n!==this.currentChannel)return this.logger.log(0,`Mismatch channel in midrow parsing`),!1;let r=this.channels[n];return!!r&&(r.ccMIDROW(t),this.logger.log(3,(()=>`MIDROW (`+Ds([e,t])+`)`)),!0)}return!1}parsePAC(e,t){let n;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(e===16||e===24)&&t>=64&&t<=95))return!1;let r=e<=23?1:2;n=t>=64&&t<=95?r===1?As[e]:js[e]:r===1?Os[e]:ks[e];let i=this.channels[r];return!!i&&(i.setPAC(this.interpretPAC(n,t)),this.currentChannel=r,!0)}interpretPAC(e,t){let n,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=!(1&~n),n<=13?r.color=[`white`,`green`,`blue`,`cyan`,`red`,`yellow`,`magenta`,`white`][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color=`white`):r.indent=4*Math.floor((n-16)/2),r}parseChars(e,t){let n,r=[],i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){let e;e=i===17?t+80:i===18?t+112:t+144,this.logger.log(2,(()=>`Special char '`+xs(e)+`' in channel `+n)),r=[e]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,(()=>`Char codes = `+Ds(r).join(`,`))),r}parseBackgroundAttributes(e,t){if(!((e===16||e===24)&&t>=32&&t<=47||(e===23||e===31)&&t>=45&&t<=47))return!1;let n,r={};e===16||e===24?(n=Math.floor((t-32)/2),r.background=Ts[n],t%2==1&&(r.background+=`_semi`)):t===45?r.background=`transparent`:(r.foreground=`black`,t===47&&(r.underline=!0));let i=e<=23?1:2;return this.channels[i].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}Ms(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t of this.channels)t&&t.cueSplitAtTime(e)}};function Ps(e,t,n){let r=[];for(let i=t;i<n;i++)i+2<n&&e.getUint8(i)===0&&e.getUint8(i+1)===0&&e.getUint8(i+2)===3?(r.push(0),r.push(0),i+=2):r.push(e.getUint8(i));return new DataView(new Uint8Array(r).buffer)}function Fs(e,t,n,r){return!(e!==4||t<8)&&n.getUint8(r)===181&&n.getUint16(r+1)===49&&n.getUint32(r+3)===1195456820&&n.getUint8(r+7)===3}function Is(e,t){return(127&e)>0||(127&t)>0}function Ls(e,t){let n=0;for(;n<e.byteLength;){let i,o=0,c=0;do o+=i=e.getUint8(n++);while(i===255);do c+=i=e.getUint8(n++);while(i===255);if(Fs(o,c,e,n)){let i=n+10,o=i+3*(31&e.getUint8(i-2));for(let n=i;n<o;n+=3){let i=e.getUint8(n);if(4&i){let o=3&i;if((r=o)===0||r===1){let r=e.getUint8(n+1),i=e.getUint8(n+2);Is(r,i)&&t[o].push(r,i)}}}}n+=c}var r}function Rs(e,t,n){let r=0,i=0,o=[[],[]];for(let c=t;c<t+n-5&&(r=e.getUint32(c),i=31&e.getUint8(c+4),!(c+5+r>t+n));c++)i===6&&c+5+r<=e.byteLength&&Ls(Ps(e,c+5,c+5+r),o),c+=r+3;return o}function zs(e){let t=e.errHandler,n=e.manifestModel,r=e.mediaController,i=e.videoModel,o=e.textTracks,c=e.vttParser,u=e.vttCustomRenderingParser,d=e.ttmlParser,f=e.streamInfo,g=e.settings,_=this.context,v=(0,p.default)(_).getInstance(),y,b,x,S,C,w,E,D,O,k,A,j,M,N,P,F,I,L=!1;function R(){w=null,D=NaN,O=[],k=null,E=!1,C=[],S=null}function z(e){let t={};t[Y.default.SUBTITLE]=`subtitles`,t[Y.default.CAPTION]=`captions`,t[Y.default.FORCED_SUBTITLE]=`subtitles`;let n=new ps;for(let t in e)n[t]=e[t];n.defaultTrack=function(e){let t=!1;return j.length>1&&e.isEmbedded?t=e.id&&e.id===h.default.CC1:j.length===1?e.id&&typeof e.id==`string`&&e.id.substring(0,2)===`CC`&&(t=!0):j.length===0&&(t=e.index===C[0].index),t}(e),n.isTTML=function(e){return e.codec&&e.codec.search(h.default.STPP)>=0||e.mimeType&&e.mimeType.search(h.default.TTML)>=0}(e),n.kind=function(e,t){let n=e.roles&&e.roles.length>0?t[e.roles[0].value]:t.caption;return n=Object.values(t).includes(n)?n:t.caption,n}(e,t),o.addTextTrackInfo(n)}function B(e){let t=e.chunk;t.representation.mediaInfo.embeddedCaptions&&H(t.bytes,t)}function V(e){A=e}function H(e,r){let i=r.representation.mediaInfo,l=i.type,u=i.mimeType,d=i.codec||u;d?i.codec.indexOf(`application/mp4`)===-1?l===h.default.VIDEO?function(e,t){let n,r;if(t.segmentType===T.HTTPRequest.INIT_SEGMENT_TYPE)M===0&&(M=x.getMediaTimescaleFromMoov(e));else if(t.segmentType===T.HTTPRequest.MEDIA_SEGMENT_TYPE){if(M===0)return void b.warn(`CEA-608: No timescale for embeddedTextTrack yet`);r=x.getSamplesInfo(e);let i=r.lastSequenceNumber,c=Math.trunc(t.start),l=Math.trunc(t.end);if(F[0]||F[1]||function(){let e;for(let t=0;t<j.length;t++){if(e=o.getTrackIdxForId(j[t].id),e===-1)return void b.warn(`CEA-608: data before track is ready.`);let n=U(e);F[t]=new Ns(t+1,{newCue:n},null)}}(),M){if(function(e,t,n,r,i){return e!==null&&t!==null&&r!==null&&i!==null&&(t===e?r!==i:t!==e+n)}(N,i,r.numSequences,P,c))for(n=0;n<F.length;n++)F[n]&&F[n].reset();let t=function(e,t){if(t.length===0)return null;let n={splits:[],fields:[[],[]]},r=new DataView(e);for(let e=0;e<t.length;e++){let i=t[e],o=Rs(r,i.offset,i.size),c=null,l=0;for(let e=0;e<2;e++)if(o[e].length>0){i.cts===c?l+=1:l=0;let t=W();n.fields[e].push([i.cts+t*M,o[e],l]),c=i.cts}}return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,r.sampleList);for(let e=0;e<F.length;e++){let r=t.fields[e],i=F[e];if(i)for(n=0;n<r.length;n++)i.addData(r[n][0]/M,r[n][1])}N=i,P=l}}}(e,r):function(e,n,r){let i,c,l=new DataView(e,0,e.byteLength);c=xr.Utils.dataViewToString(l,h.default.UTF8);try{i=G(r).parse(c,0),o.addCaptions(o.getCurrentTrackIdx(),0,i),y.buffered&&y.buffered.add(n.start,n.end)}catch(e){t.error(new Be.default(Ne.TIMED_TEXT_ERROR_ID_PARSE_CODE,Ne.TIMED_TEXT_ERROR_MESSAGE_PARSE+e.message,c))}}(e,r,d):function(e,t,r){let i,l;if(t.segmentType===`InitializationSegment`)E=!0,D=x.getMediaTimescaleFromMoov(e);else{if(!E)return;l=x.getSamplesInfo(e),i=l.sampleList,i.length>0&&(k=i[0].cts-t.start*D),r.search(h.default.STPP)>=0?function(e,t,r){let i,c;for(S=S===null?G(r):S,i=0;i<t.length;i++){let r=t[i],l=r.cts,u=W(),d=u+l/D,f=d+r.duration/D;y.buffered.add(d,f);let p=new DataView(e,r.offset,r.subSizes[0]),m=xr.Utils.dataViewToString(p,h.default.UTF8),g=[],_=r.offset+r.subSizes[0];for(c=1;c<r.subSizes.length;c++){let t=new Uint8Array(e,_,r.subSizes[c]),n=String.fromCharCode.apply(null,t);g.push(n),_+=r.subSizes[c]}try{let e=n.getValue().ttmlTimeIsRelative?l/D:0,t=S.parse(m,e,l/D,(l+r.duration)/D,g);o.addCaptions(A,u,t)}catch(e){w.removeExecutedRequestsBeforeTime(),K(),b.error(`TTML parser error: `+e)}}}(e,i,r):function(e,t){let n,r,i,l=[];for(n=0;n<t.length;n++){let o=t[n];o.cts-=k;let u=W()+o.cts/D,d=u+o.duration/D;y.buffered.add(u,d);let f=e.slice(o.offset,o.offset+o.size),p=xr.parseBuffer(f);for(r=0;r<p.boxes.length;r++){let e=p.boxes[r];if(b.debug(`VTT box1: `+e.type),e.type!==`vtte`&&e.type===`vttc`){b.debug(`VTT vttc boxes.length = `+e.boxes.length);let t={styles:{}};for(i=0;i<e.boxes.length;i++){let n=e.boxes[i];if(b.debug(`VTT box2: `+n.type),n.type===`payl`)t.start=o.cts/D,t.end=(o.cts+o.duration)/D,t.data=n.cue_text;else if(n.type===`sttg`&&n.settings&&n.settings!==``)try{let e=n.settings.split(` `);t.styles=c.getCaptionStyles(e)}catch{}}t&&t.data&&(l.push(t),b.debug(`VTT ${t.start} - ${t.end} : ${t.data}`))}}}l.length>0&&o.addCaptions(A,0,l)}(e,i)}}(e,r,d):b.error(`No text type defined`)}function U(e){return function(t,n,r){let c;c=i.getTTMLRenderingDiv()?I.createHTMLCaptionsFromScreen(i.getElement(),t,n,r):[{start:t,end:n,data:r.getDisplayText(),styles:{}}],c&&o.addCaptions(e,0,c)}}function W(){return isNaN(y.timestampOffset)?0:y.timestampOffset}function G(e){let t;return e.search(h.default.VTT)>=0?t=g.get().streaming.text.webvtt.customRenderingEnabled&&u?u:c:(e.search(h.default.TTML)>=0||e.search(h.default.STPP)>=0)&&(t=d),t}function K(e,t){e===void 0&&e===t&&(e=y.buffered.start(0),t=y.buffered.end(y.buffered.length-1)),y.buffered.remove(e,t),o.deleteCuesFromTrackIdx(A,e,t)}function ee(e){j.forEach((function(t){let n=o.getTrackIdxForId(t.id);n>=0&&o.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return y={initialize:function(){L||(j=[],A=null,M=0,F=[],N=null,P=null,L=!0,I=gs(_).getInstance(),v.on(m.default.VIDEO_CHUNK_RECEIVED,B,y),v.on(m.default.BUFFER_CLEARED,ee,y))},addMediaInfos:function(e,t,n){if(C=C.concat(t),e===h.default.TEXT&&t[0].isFragmented&&!t[0].isEmbedded){w=n,y.buffered=(0,ms.default)(_).create(),O=r.getTracksFor(h.default.TEXT,f.id).filter((e=>e.isFragmented));let e=r.getCurrentTrackFor(h.default.TEXT,f.id);for(let t=0;t<O.length;t++)if(O[t]===e){V(t);break}}for(let e=0;e<t.length;e++)z(t[e])},resetMediaInfos:function(){C=[]},getStreamId:function(){return f.id},append:H,abort:function(){},addEmbeddedTrack:function(e){if(L&&e)if(e.id===h.default.CC1||e.id===h.default.CC3){for(let t=0;t<j.length;t++)if(j[t].id===e.id)return;j.push(e)}else b.warn(`Embedded track `+e.id+` not supported!`)},resetEmbedded:function(){v.off(m.default.VIDEO_CHUNK_RECEIVED,B,y),v.off(m.default.BUFFER_CLEARED,ee,y),o&&o.deleteAllTextTracks(),L=!1,j=[],F=[null,null],N=null,P=null},getConfig:function(){return{fragmentModel:w,fragmentedTracks:O,videoModel:i}},setCurrentFragmentedTrackIdx:V,remove:K,reset:function(){R(),C=[],x=null}},b=(0,l.default)(_).getInstance().getLogger(y),x=wr(_).getInstance(),R(),y}zs.__dashjs_factory_name=`TextSourceBuffer`;var Bs=i.default.getClassFactory(zs);class Vs{constructor(){this.root=null,this.size=0}addCue(e){let t={start:e.startTime,end:e.endTime,cue:e,maxEnd:e.endTime,left:null,right:null,height:1},[n,r]=this._insert(t,this.root);this.root=n,r&&this.size++}removeCue(e){let[t,n]=this._remove(e,this.root);return this.root=t,n&&this.size--,n}findCuesInRange(e,t){let n=[];return this._searchRange(this.root,e,t,n),n}findCuesAtTime(e){return this.findCuesInRange(e,e)}getAllCues(){let e=[];return this._inorderTraversal(this.root,e),e}getSize(){return this.size}clear(){this.root=null,this.size=0}_compareCues(e,t){return e.startTime===t.startTime?e.endTime===t.endTime?typeof VTTCue<`u`&&e instanceof VTTCue&&t instanceof VTTCue||e.text&&t.text?e.text.localeCompare(t.text):0:e.endTime-t.endTime:e.startTime-t.startTime}_compareIntervals(e,t){return this._compareCues(e.cue,t.cue)}_insert(e,t){if(!t)return[e,!0];let n=this._compareIntervals(e,t);if(n<0){let[n]=this._insert(e,t.left);t.left=n}else{if(!(n>0))return[t,!1];{let[n]=this._insert(e,t.right);t.right=n}}t.height=1+Math.max(this._getHeight(t.left),this._getHeight(t.right)),t.maxEnd=Math.max(t.maxEnd,e.maxEnd);let r=this._getBalance(t);return r>1?(this._compareIntervals(e,t.left)<0||(t.left=this._leftRotate(t.left)),[this._rightRotate(t),!0]):r<-1?(this._compareIntervals(e,t.right)>0||(t.right=this._rightRotate(t.right)),[this._leftRotate(t),!0]):[t,!0]}_searchRange(e,t,n,r){e&&(this._overlaps(e,t,n)&&r.push(e.cue),e.left&&e.left.maxEnd>=t&&this._searchRange(e.left,t,n,r),e.right&&e.start<=n&&this._searchRange(e.right,t,n,r))}_inorderTraversal(e,t){e&&(this._inorderTraversal(e.left,t),t.push(e.cue),this._inorderTraversal(e.right,t))}_overlaps(e,t,n){if(n===t){let n=t;return e.start<=n&&n<e.end}return e.start<n&&t<e.end}_getHeight(e){return e?e.height:0}_getBalance(e){return e?this._getHeight(e.left)-this._getHeight(e.right):0}_leftRotate(e){let t=e.right,n=t.left;return t.left=e,e.right=n,e.height=1+Math.max(this._getHeight(e.left),this._getHeight(e.right)),t.height=1+Math.max(this._getHeight(t.left),this._getHeight(t.right)),e.maxEnd=Math.max(e.end,e.left?e.left.maxEnd:0,e.right?e.right.maxEnd:0),t.maxEnd=Math.max(t.end,t.left?t.left.maxEnd:0,t.right?t.right.maxEnd:0),t}_rightRotate(e){let t=e.left,n=t.right;return t.right=e,e.left=n,e.height=1+Math.max(this._getHeight(e.left),this._getHeight(e.right)),t.height=1+Math.max(this._getHeight(t.left),this._getHeight(t.right)),e.maxEnd=Math.max(e.end,e.left?e.left.maxEnd:0,e.right?e.right.maxEnd:0),t.maxEnd=Math.max(t.end,t.left?t.left.maxEnd:0,t.right?t.right.maxEnd:0),t}_remove(e,t){if(!t)return[null,!1];let n=this._compareCues(e,t.cue);if(n<0){let[n,r]=this._remove(e,t.left);return t.left=n,r&&this._updateNode(t),[t,r]}if(n>0){let[n,r]=this._remove(e,t.right);return t.right=n,r&&this._updateNode(t),[t,r]}if(t.left||t.right){if(t.left){if(t.right){let e=this._findMin(t.right);t.cue=e.cue,t.start=e.start,t.end=e.end;let[n]=this._remove(e.cue,t.right);return t.right=n,this._updateNode(t),[t,!0]}return[t.left,!0]}return[t.right,!0]}return[null,!0]}_findMin(e){for(;e.left;)e=e.left;return e}_updateNode(e){e.height=1+Math.max(this._getHeight(e.left),this._getHeight(e.right)),e.maxEnd=Math.max(e.end,e.left?e.left.maxEnd:0,e.right?e.right.maxEnd:0)}}var Hs=r(7640);let Us=[`text`,`align`,`fontSize`,`id`,`isd`,`line`,`lineAlign`,`lineHeight`,`linePadding`,`position`,`positionAlign`,`region`,`size`,`snapToLines`,`vertical`];function Ws(e){let t=this.context,n=(0,p.default)(t).getInstance(),r=e.videoModel,i=e.streamInfo,o=e.settings,c,u,d,f,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N=new Map;function P(e){let t=e.kind,n=e.id===void 0?e.lang:e.id,i=e.lang,o=e.isTTML,c=e.isEmbedded;return r.addTextTrack(t,n,i,o,c)}function F(e,t,n,r,i,o){let c=0,l=0;e/t>n/r?(l=t,c=l/r*n):(c=e,l=c/n*r);let u=0,d=0,f=0,p=0;return c/l>i?(p=l,f=l*i):(f=c,p=c/i),u=(e-f)/2,d=(t-p)/2,o?{x:u+.1*f,y:d+.1*p,w:.8*f,h:.8*p}:{x:u,y:d,w:f,h:p}}function I(e,t){let i=r.getClientWidth(),o=r.getClientHeight(),c=r.getVideoWidth(),l=r.getVideoHeight(),u=r.getVideoRelativeOffsetTop(),d=r.getVideoRelativeOffsetLeft();if(c!==0&&l!==0){let r=c/l,f=!1;e.isFromCEA608&&(r=3.5/3,f=!0);let p=F.call(this,i,o,c,l,r,f),m=p.w,h=p.h,_=p.x,v=p.y;if(m!=x||h!=S||_!=y||v!=b||t){if(y=_+d,b=v+u,x=m,S=h,C){let e=C.style;e&&(e.left=y+`px`,e.top=b+`px`,e.width=x+`px`,e.height=S+`px`,e.zIndex=E&&document[E]||D?k:null,n.trigger(g.default.CAPTION_CONTAINER_RESIZE))}let t=e.activeCues;if(t){let e=t.length;for(let n=0;n<e;++n){let e=t[n];e.scaleCue(e)}}}}}function L(e){let t=x,n=S,r,i,o,c,l;if(e.cellResolution){let u=[t/e.cellResolution[0],n/e.cellResolution[1]];if(e.linePadding){for(r in e.linePadding)if(e.linePadding.hasOwnProperty(r)){i=(e.linePadding[r]*u[0]).toString();let t=document.getElementsByClassName(`spanPadding`);for(let e=0;e<t.length;e++)t[e].style.cssText=t[e].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,`$1`+i),t[e].style.cssText=t[e].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,`$1`+i)}}if(e.fontSize){for(r in e.fontSize)if(e.fontSize.hasOwnProperty(r)){e.fontSize[r][0]===`%`?o=e.fontSize[r][1]/100:e.fontSize[r][0]===`c`&&(o=e.fontSize[r][1]),i=(o*u[1]).toString(),l=r===`defaultFontSize`?document.getElementsByClassName(`paragraph`):document.getElementsByClassName(r);for(let e=0;e<l.length;e++)l[e].style.cssText=l[e].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,`$1`+i)}if(e.lineHeight){for(r in e.lineHeight)if(e.lineHeight.hasOwnProperty(r)){e.lineHeight[r][0]===`%`?c=e.lineHeight[r][1]/100:e.fontSize[r][0]===`c`&&(c=e.lineHeight[r][1]),i=(c*u[1]).toString(),l=document.getElementsByClassName(r);for(let e=0;e<l.length;e++)l[e].style.cssText=l[e].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,`$1`+i)}}}}if(e.isd){let t=document.getElementById(e.cueID);t&&C.removeChild(t),z(e)}}function R(e,t){let n=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,r=/^#(.*)$/;if(n.test(t)){let r=n.exec(t),i=parseInt(r[4],10)-1;return`data:image/png;base64,`+btoa(e.images[i])}if(r.test(t)){let n=r.exec(t)[1];return`data:image/png;base64,`+e.embeddedImages[n]}return t}function z(e){if(C){pe.call(this);let t=document.createElement(`div`);C.appendChild(t),O=(0,Hs.renderHTML)(e.isd,t,(function(t){return R(e,t)}),C.clientHeight,C.clientWidth,o.get().streaming.text.imsc.displayForcedOnlyMode,(function(e){u.info(`renderCaption :`,e)}),O,o.get().streaming.text.imsc.enableRollUp),t.id=e.cueID,n.trigger(g.default.CAPTION_RENDERED,{captionDiv:t,currentTrackIdx:v})}}function B(e,t){let n=t.findCuesInRange(e.startTime-.1,e.endTime+.1);for(let t of n)if(V(e,t)&&H(e,t,Us)||V(t,e)&&H(e,t,Us))return t;return null}function V(e,t){return!!t&&t.endTime>=e.startTime}function H(e,t,n){for(let r=0;r<n.length;r++){let i=n[r];if(JSON.stringify(e[i])!==JSON.stringify(t[i]))return!1}return!0}function U(e,t){t&&t.forEach((t=>{t.kind&&t.kind===`image`&&(t.src=R(e,t.src)),U(e,t.contents)}))}function W(e,t,n){let r=ae(e),i=N.get(r),c=o.get().streaming.text.dispatchForManualRendering;if(r&&i&&Array.isArray(n)&&n.length!==0){for(let e=0;e<n.length;e++){let f=null,p=n[e];if(r.cellResolution=p.cellResolution,r.isFromCEA608=p.isFromCEA608,isNaN(p.start)||isNaN(p.end)||(c?f=G(p,t):ne(p)&&C?f=q(p,t,r):p.data&&(f=te(p,t,r))),f){if(o.get().streaming.text.extendSegmentedCues){let e=B(f,i.allCues);e&&(i.allCues.removeCue(e),d=f,(l=e).startTime=Math.min(l.startTime,d.startTime),l.endTime=Math.max(l.endTime,d.endTime),f=l)}i.allCues.addCue(f)}else u.error(`Impossible to display subtitles. You might have missed setting a TTML rendering div via player.attachTTMLRenderingDiv(TTMLRenderingDiv)`)}var l,d;ue()}}function G(e,t){let n=re(e,t);return n.onenter=function(){ne(e)&&M&&M.cueID!==n.cueID&&ee(M),delete n.type,M=n,K(n)},n.onexit=function(){ee(n),M=null},n}function K(e){n.trigger(g.default.CUE_ENTER,e)}function ee(e){n.trigger(g.default.CUE_EXIT,{cueID:e.cueID})}function q(e,t,r){let i=this,o=re(e,t);return C.style.left=y+`px`,C.style.top=b+`px`,C.style.width=x+`px`,C.style.height=S+`px`,o.onenter=function(){r.mode===h.default.TEXT_SHOWING&&(this.isd?(j?requestAnimationFrame((()=>z(this))):z(this),u.debug(`Cue enter id:`+this.cueID)):(C.appendChild(this.cueHTMLElement),L.call(i,this),n.trigger(g.default.CAPTION_RENDERED,{captionDiv:this.cueHTMLElement,currentTrackIdx:v})))},o.onexit=function(){if(C){let e=C.childNodes;for(let t=0;t<e.length;++t)e[t].id===this.cueID&&(u.debug(`Cue exit id:`+e[t].id),C.removeChild(e[t]),--t)}},o}function te(e,t,r){let i=re(e,t);if(e.styles)try{e.styles.align!==void 0&&`align`in i&&(i.align=e.styles.align),e.styles.line!==void 0&&`line`in i&&(i.line=e.styles.line),e.styles.lineAlign!==void 0&&(i.lineAlign=e.styles.lineAlign),e.styles.snapToLines!==void 0&&`snapToLines`in i&&(i.snapToLines=e.styles.snapToLines),e.styles.position!==void 0&&`position`in i&&(i.position=e.styles.position),e.styles.positionAlign!==void 0&&(i.positionAlign=e.styles.positionAlign),e.styles.size!==void 0&&`size`in i&&(i.size=e.styles.size)}catch(e){u.error(e)}return i.onenter=function(){r.mode===h.default.TEXT_SHOWING&&n.trigger(g.default.CAPTION_RENDERED,{currentTrackIdx:v})},i}function ne(e){return e.type===`html`}function re(e,t){return ne(e)?function(e,t){let n=new d(e.start+t,e.end+t,``);return n.cueHTMLElement=e.cueHTMLElement,n.isd=e.isd,n.images=e.images,n.embeddedImages=e.embeddedImages,n.cueID=e.cueID,n.scaleCue=L.bind(self),n.cellResolution=e.cellResolution,n.lineHeight=e.lineHeight,n.linePadding=e.linePadding,n.fontSize=e.fontSize,n.isd&&U(n,n.isd.contents),n}(e,t):function(e,t){let n=new d(e.start-t,e.end-t,e.data);return n.cueID=He.default.generateUuid(),n}(e,t)}function ie(e){if(w){let t=w.childNodes;for(let n=0;n<t.length;++n)t[n].id===e.cueID&&(w.removeChild(t[n]),--n)}}function J(){let e=r.getTextTracks(),t=[];for(let n of e)n.manualMode===h.default.TEXT_SHOWING&&t.push(n);return t}function ae(e){return e>=0&&f[e]?r.getTextTrack(f[e].kind,f[e].id,f[e].lang,f[e].isTTML,f[e].isEmbedded):null}function oe(e){if(e===v)return;v=e;let t=ae(v);se.call(this,t),T&&=(clearInterval(T),null),t&&t.renderingType===`html`&&(I.call(this,t,!0),window.ResizeObserver?(A=new window.ResizeObserver((()=>{I.call(this,t,!0)})),A.observe(r.getElement())):T=setInterval(I.bind(this,t),500))}function se(e){pe.call(this),e&&e.renderingType===`html`?de.call(this):fe.call(this)}function ce(e,t,n,r=!0){return!!e&&(isNaN(t)||(r?e.startTime:e.endTime)>=t)&&(isNaN(n)||(r?e.endTime:e.startTime)<=n)}function le(e,t,n,r=!0){if(!e)return;if(e.cues&&e.cues.length>0)for(let i=e.cues.length-1;i>=0;i--)ce(e.cues[i],t,n,r)&&(e.cues[i].onexit&&e.cues[i].onexit(),e.removeCue(e.cues[i]));let i=N.get(e);if(i){let e=i.activeCues,r=e.filter((e=>e.startTime>=t&&e.endTime<=n));r.forEach((e=>{o.get().streaming.text.dispatchForManualRendering?ee(e):ie(e)})),i.activeCues=e.filter((e=>!r.includes(e)))}}function ue(){for(let e of N.values())e.lastCueWindowUpdate=-1/0}function de(){let e=document.getElementById(`native-cue-style`);if(e)return;e=document.createElement(`style`),e.id=`native-cue-style`,document.head.appendChild(e);let t=e.sheet,n=r.getElement();try{n&&(n.id?t.insertRule(`#`+n.id+`::cue {background: transparent}`,0):n.classList.length===0?t.insertRule(`video::cue {background: transparent}`,0):t.insertRule(`.`+n.className+`::cue {background: transparent}`,0))}catch(e){u.info(``+e.message)}}function fe(){let e=document.getElementById(`native-cue-style`);e&&document.head.removeChild(e)}function pe(){if(C)for(;C.firstChild;)C.removeChild(C.firstChild)}function me(){return f}return c={addCaptions:W,addTextTrackInfo:function(e){f.push(e)},createTracks:function(){f.sort((function(e,t){return e.index-t.index})),C=r.getTTMLRenderingDiv(),w=r.getVttRenderingDiv();let e=-1;for(let t=0;t<f.length;t++){let r=P(f[t]);_.push(r),f[t].defaultTrack&&(r.default=!0,e=t);let i=ae(t);i&&(i.mode=h.default.TEXT_SHOWING,C&&(f[t].isTTML||f[t].isEmbedded)?i.renderingType=`html`:i.renderingType=`default`,N.set(i,{allCues:new Vs,lastCueWindowUpdate:-1/0,activeCues:[]})),W(t,0,f[t].captionData),n.trigger(g.default.TEXT_TRACK_ADDED)}if(oe.call(this,e),e>=0){let t=function(){let r=ae(e);r&&r.renderingType===`html`&&I.call(this,r,!0),n.off(g.default.PLAYBACK_METADATA_LOADED,t,this)};n.on(g.default.PLAYBACK_METADATA_LOADED,t,this);for(let t=0;t<f.length;t++){let n=ae(t);if(n){let r=o.get().streaming.text.dispatchForManualRendering;n.mode=t!==e||r?h.default.TEXT_HIDDEN:h.default.TEXT_SHOWING,n.manualMode=t===e?h.default.TEXT_SHOWING:h.default.TEXT_HIDDEN}}}n.trigger(m.default.TEXT_TRACKS_QUEUE_INITIALIZED,{index:v,tracks:f,streamId:i.id})},deleteAllTextTracks:function(){let e=_?_.length:0;for(let t=0;t<e;t++){let e=ae(t);e&&le.call(this,e,i.start,i.start+i.duration,!1)}_=[],f=[],T&&=(clearInterval(T),null),A&&r&&(A.unobserve(r.getElement()),A=null),v=-1,pe.call(this),N.clear()},deleteCuesFromTrackIdx:function(e,t,n){let r=ae(e);r&&le(r,t,n)},disableManualTracks:function(){let e=J();if(e&&e.length>0){let t=e[0],n=N.get(t);if(!n)return;n.activeCues.forEach((e=>{o.get().streaming.text.dispatchForManualRendering?ee(e):ie(e)})),n.activeCues=[]}},getCurrentTrackIdx:function(){return v},getCurrentTextTrackInfo:function(){return f[v]},getStreamId:function(){return i.id},getTextTrackInfos:me,getTrackIdxForId:function(e){let t=-1;for(let n=0;n<f.length;n++)if(f[n].id===e){t=n;break}return t},initialize:function(){typeof window<`u`&&typeof navigator<`u`&&(d=window.VTTCue||window.TextTrackCue,f=[],_=[],v=-1,y=0,b=0,x=0,S=0,C=null,w=null,T=null,D=!1,k=2147483647,O=null,j=`requestAnimationFrame`in window,N.clear(),document.fullscreenElement===void 0?document.webkitIsFullScreen===void 0?document.msFullscreenElement?E=`msFullscreenElement`:document.mozFullScreen&&(E=`mozFullScreen`):E=`webkitIsFullScreen`:E=`fullscreenElement`)},manualCueProcessing:function(e){let t=J();if(t&&t.length>0){let n=t[0],r=N.get(n);if(!r)return;let i=r.activeCues,c=r.allCues.findCuesAtTime(e),l=i.filter((e=>!c.includes(e))),u=c.filter((e=>!i.includes(e)));l.forEach((e=>{o.get().streaming.text.dispatchForManualRendering?ee(e):ie(e)})),u.forEach((e=>{o.get().streaming.text.dispatchForManualRendering?K(e):WebVTT.processCues(window,[e],w,e.cueID)})),r.activeCues=c}},setCurrentTrackIdx:oe,setModeForTrackIdx:function(e,t){let n=ae(e);n&&n.mode!==t&&(n.mode=t),n&&n.manualMode!==t&&(n.manualMode=t)},updateTextTrackWindow:function(e,t=!1){let n=me(),i=o.get().streaming.text.webvtt.customRenderingEnabled;for(let c=0;c<n.length;c++){let l=n[c],u=ae(c),d=N.get(u);if(!u||!d||!l.isEmbedded&&i)continue;let{bufferToKeep:f,bufferPruningInterval:p}=o.get().streaming.buffer,m=Date.now();if((m-d.lastCueWindowUpdate)/1e3<p&&!t)continue;let g=r.getPlaybackRate()||1,_=Math.max(0,e-f/g),v=e+2*p/g;if(u.cues)for(;u.cues.length>0;)u.removeCue(u.cues[0]);u.mode!==h.default.TEXT_DISABLED&&d.allCues.findCuesInRange(_,v).forEach((e=>{u.addCue(e)})),d.lastCueWindowUpdate=m}},invalidateCueWindow:ue},u=(0,l.default)(t).getInstance().getLogger(c),c}Ws.__dashjs_factory_name=`TextTracks`;var Gs=i.default.getClassFactory(Ws);function $(){let e=this.context,t,n,r,i,o,c;function u(e){let t=e.split(`:`),n=t.length-1;return e=60*parseInt(t[n-1],10)+parseFloat(t[n]),n===2&&(e+=3600*parseInt(t[0],10)),e}function d(e){let t=e.split(i),n=t[1].split(c);return n.shift(),t[1]=n[0],n.shift(),{cuePoints:t,styles:f(n)}}function f(e){let t={};return e.forEach((function(e){let n=e.split(`:`);if(n.length>1){let[e,r]=n;switch(e){case`align`:case`A`:t.align=r;break;case`line`:case`L`:let[e,n]=r.split(`,`),i=e.endsWith(`%`);t.line=e===`auto`?e:parseInt(e,10),i&&(t.snapToLines=!1),n&&(t.lineAlign=n);break;case`position`:case`P`:let[o,c]=r.split(`,`);t.position=parseInt(o,10),c&&(t.positionAlign=c);break;case`size`:case`S`:t.size=parseInt(r,10)}}})),t}function p(e,t){let n,r=t,o=``,c=``;for(;e[r]!==``&&r<e.length;)r++;if(n=r-t,n>1)for(let r=0;r<n;r++){if(c=e[t+r],c.match(i)){o=``;break}o+=c,r!==n-1&&(o+=`
59
- `)}else c=e[t],c.match(i)||(o=c);return o}return t={parse:function(e){let t=[],c,l;if(!e)return t;c=(e=e.split(r)).length,l=-1;for(let r=0;r<c;r++){let c=e[r];if(c.length>0&&c!==`WEBVTT`&&c.match(i)){let i=d(c),f=i.cuePoints,m=i.styles,h=p(e,r+1),g=u(f[0].replace(o,``)),_=u(f[1].replace(o,``));!isNaN(g)&&!isNaN(_)&&g>=l&&_>g?h===``?n.error(`Skipping cue due to empty/malformed cue text`):(l=g,t.push({start:g,end:_,data:h,styles:m})):n.error(`Skipping cue due to incorrect cue timing`)}}return t},getCaptionStyles:f},n=(0,l.default)(e).getInstance().getLogger(t),r=/(?:\r\n|\r|\n)/gm,i=/-->/,o=/(^[\s]+|[\s]+$)/g,c=/\s\b/g,t}$.__dashjs_factory_name=`VTTParser`;var Ks=i.default.getSingletonFactory($);function qs(){let e,t;return e={parse:function(e){let n=[];return t.oncue=function(e){e.start=e.startTime,e.end=e.endTime,e.data=e.text,e.styles={align:e.align,line:e.line,position:e.position,size:e.size},n.push(e)},t.parse(e),n}},function(){try{window&&window.WebVTT&&window.WebVTT.Parser&&(t=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()))}catch{}}(),e}qs.__dashjs_factory_name=`VttCustomRenderingParser`;var Js=i.default.getSingletonFactory(qs);function Ys(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i=0;function o(){let e=`cue_TTML_`+i;return i++,e}return n={parse:function(e,n,i,c,l){let u=``,d=[],f,p,h,_={},v={},y=``,b=``,x={onOpenTag:function(e,n,i){if(i[` imagetype`]&&!i[` imageType`]&&(t.trigger(g.default.CONFORMANCE_VIOLATION,{level:cs.LEVELS.ERROR,event:cs.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[` imageType`]=i[` imagetype`]),n===`image`&&(e===`http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt`||e===`http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt`)){if(!i[` imageType`]||i[` imageType`].value!==`PNG`)return void r.warn(`smpte-tt imageType != PNG. Discarded`);y=i[`http://www.w3.org/XML/1998/namespace id`].value}},onCloseTag:function(){y&&(v[y]=b.trim()),b=``,y=``},onText:function(e){y&&(b+=e)}};if(!e)throw u=`no ttml data to parse`,Error(u);_.data=e,t.trigger(m.default.TTML_TO_PARSE,_);let S=(0,Hs.fromXML)(_.data,(function(e){u=e}),x);t.trigger(m.default.TTML_PARSED,{ttmlString:_.data,ttmlDoc:S});let C=S.getMediaTimeEvents();for(h=0;h<C.length;h++){let e=(0,Hs.generateISD)(S,C[h],(function(e){u=e}));e.contents.some((e=>e.contents.length))&&(f=C[h]+n,p=C[h+1]+n,f<p&&d.push({start:f,end:p,type:`html`,cueID:o(),isd:e,images:l,embeddedImages:v}))}if(u!==``)throw r.error(u),Error(u);return d}},r=(0,l.default)(e).getInstance().getLogger(n),n}Ys.__dashjs_factory_name=`TTMLParser`;var Xs=i.default.getSingletonFactory(Ys);function Zs(e){let t=this.context,n=(0,p.default)(t).getInstance(),r=ht(t).getInstance(),i=e.adapter,o=e.baseURLController,c,u,d;function f(e,t){let n,c,l=!1;if(o.resolve()){let t=i.getVoRepresentations(e);t&&t.length>0&&(n=o.resolve(t[0].path).url)}let u=e.essentialProperties.filter((e=>e.schemeIdUri&&e.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME)),f=e.supplementalProperties.filter((e=>e.schemeIdUri&&e.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME));u.length>0?(l=!0,c=u):c=f,c.forEach((i=>{if(function(e){return!(!(e.value&&parseInt(e.value)===1&&e.dvbUrl&&e.dvbUrl.length>0&&e.dvbFontFamily&&e.dvbFontFamily.length>0&&e.dvbMimeType)||e.dvbMimeType!==h.default.OFF_MIMETYPE&&e.dvbMimeType!==h.default.WOFF_MIMETYPE)}(i)){let u=(o=i.dvbUrl,c=n,r.isPathAbsolute(o)?o:r.isRelative(o)?c?r.resolve(o,c):r.resolve(o):o);d.push({fontFamily:i.dvbFontFamily,url:u,mimeType:i.dvbMimeType,trackId:e.id,streamId:t,isEssential:l,status:`unloaded`,fontFace:new FontFace(i.dvbFontFamily,`url(${u})`,{display:`swap`})})}var o,c}))}function m(e,t){let n=d[e];d[e]={...n,status:t}}function _(){d=[]}return c={addFontsFromTracks:function(e,t){if(e&&Array.isArray(e)&&t)for(let n=0;n<e.length;n++)f(e[n],t)},downloadFonts:function(){for(let e=0;e<d.length;e++){let t=d[e];document.fonts.add(t.fontFace),n.trigger(g.default.DVB_FONT_DOWNLOAD_ADDED,t),t.fontFace.load().then((()=>{m(e,`loaded`),n.trigger(g.default.DVB_FONT_DOWNLOAD_COMPLETE,t)}),(r=>{m(e,`error`),u.debug(`Font download error: `,r),n.trigger(g.default.DVB_FONT_DOWNLOAD_FAILED,t)}))}},getFonts:function(){return d},getFontsForTrackId:function(e){return d.filter((t=>t.trackId&&t.trackId===e))},reset:function(){(function(){for(let e of d){let t=document.fonts.delete(e.fontFace);u.debug(`Removal of fontFamily: ${e.fontFamily} was ${t?`successful`:`unsuccessful`}`)}})(),_()}},u=(0,l.default)(t).getInstance().getLogger(c),_(),c}Zs.__dashjs_factory_name=`DVBFonts`;var Qs=i.default.getClassFactory(Zs);function $s(e){let t=this.context,n=e.adapter,r=e.errHandler,i=e.manifestModel,o=e.mediaController,c=e.baseURLController,u=e.videoModel,d=e.settings,f,_,v,y,b,x,S,C,w,T,E,D,O,k;function A(e){if(k.error(`Could not download ${e.isEssential?`an essential`:`a`} font - fontFamily: ${e.fontFamily}, url: ${e.url}`),e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_DISABLED)}}function j(e){if(k.debug(`Successfully downloaded ${e.isEssential?`an essential`:`a`} font - fontFamily: ${e.fontFamily}, url: ${e.url}`),e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);t===y[e.streamId].getCurrentTrackIdx()?y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_SHOWING):y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_HIDDEN)}}function M(e){let t=e.tracks,n=e.index,r=e.streamId;if(!1===d.get().streaming.text.defaultEnabled&&!L()||D)R(r,-1);else{let e=o.getCurrentTrackFor(h.default.TEXT,r);if(e){let i={lang:e.lang,role:e.roles[0],index:e.index,codec:e.codec,accessibility:e.accessibility[0]};t.some(((e,t)=>{if(o.matchSettings(i,e))return R(r,t),n=t,!0}))}w=!1}_[r].lastEnabledIndex=n,C.trigger(g.default.TEXT_TRACKS_ADDED,{enabled:L(),index:n,tracks:t,streamId:r}),E=!0,O.addFontsFromTracks(t,r),O.getFonts().forEach((e=>{if(e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_DISABLED)}})),O.downloadFonts()}function N(e){try{let t=e.streamId,n=y[t];if(!n||isNaN(e.time))return;n.updateTextTrackWindow(e.time),d.get().streaming.text.webvtt.customRenderingEnabled&&n.manualCueProcessing(e.time)}catch{}}function P(e){try{let t=e.streamId;if(!y[t])return;y[t].disableManualTracks()}catch{}}function F(e){try{let t=y[e.streamId];if(!t)return;let n=u.getTime()||0;t.updateTextTrackWindow(n,!0)}catch(e){k.error(e)}}function I(e){try{if(!e||!e.mediaType||e.mediaType!==h.default.AUDIO||!e.currentMediaInfo)return;let t=y[e.streamId].getCurrentTextTrackInfo(),n=NaN;w?n=z(e.streamId):B(t)&&e.currentMediaInfo.lang&&e.currentMediaInfo.lang!==t.lang&&(n=z(e.streamId),isNaN(n)&&(n=-1)),isNaN(n)||R(e.streamId,n)}catch(e){k.error(e)}}function L(){let e=!0;return w&&!T&&(e=!1),e}function R(e,t){w=t===-1,w&&o&&o.saveTextSettingsDisabled();let n=V(e);if(n===t||!y[e])return;y[e].disableManualTracks(),y[e].invalidateCueWindow();let r=y[e].getCurrentTextTrackInfo(),i=r?u.getTextTrack(r.kind,r.id,r.lang,r.isTTML,r.isEmbedded):null;i&&i.mode!==h.default.TEXT_DISABLED&&y[e].setModeForTrackIdx(n,h.default.TEXT_HIDDEN),y[e].setCurrentTrackIdx(t),r=y[e].getCurrentTextTrackInfo();let c=d.get().streaming.text.dispatchForManualRendering;if(r&&!c&&r.mode!==h.default.TEXT_DISABLED&&y[e].setModeForTrackIdx(t,h.default.TEXT_SHOWING),r&&r.isFragmented&&!r.isEmbedded)(function(e,t,n){if(!v[e])return;let r=v[e].getConfig().fragmentedTracks;for(let i=0;i<r.length;i++){let c=r[i];if(t.lang===c.lang&&(c.id?t.id===c.id:t.index===c.index)){let t=o.getCurrentTrackFor(h.default.TEXT,e);(c.id?t.id!==c.id:t.index!==c.index)?(y[e].deleteCuesFromTrackIdx(n),v[e].setCurrentFragmentedTrackIdx(i)):n===-1&&C.trigger(m.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,{},{streamId:e,mediaType:h.default.TEXT})}}})(e,r,n);else if(r&&!r.isFragmented)(function(e,t){C.trigger(m.default.SET_NON_FRAGMENTED_TEXT,{currentTrackInfo:t},{streamId:e,mediaType:h.default.TEXT})})(e,r);else if(!r&&w){let t=z(e);isNaN(t)||R(e,t);return}o.setTrack(r)}function z(e){let t=function(e){return y[e].getTextTrackInfos().filter(((e,t)=>(e._indexToSelect=t,!!(e&&e.roles&&e.roles.length>0)&&B(e))))}(e);if(!t||t.length<=0)return NaN;let n=o.getCurrentTrackFor(h.default.AUDIO,e);if(!n)return NaN;let r=t.find((e=>n.lang===e.lang));return r?r._indexToSelect:NaN}function B(e){return!(!e||!e.roles||e.roles.length===0)&&e.roles.some((e=>e.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&e.value===Y.default.FORCED_SUBTITLE))}function V(e){return y[e].getCurrentTrackIdx()}function H(){v={},y={},_={},w=!0,E=!1,D=!1}return f={addEmbeddedTrack:function(e,t){let n=e.id;v[n]&&v[n].addEmbeddedTrack(t)},addMediaInfosToBuffer:function(e,t,n,r=null){let i=e.id;v[i]&&v[i].addMediaInfos(t,n,r)},createTracks:function(e){let t=e.id;y[t]&&y[t].createTracks()},deactivateStream:function(e){if(!e)return;let t=e.id;v[t]&&v[t].resetMediaInfos(),y[t]&&y[t].deleteAllTextTracks()},enableForcedTextStreaming:function(e){return(0,Ve.checkParameterType)(e,`boolean`),T=e,!0},enableText:function(e,t){return(0,Ve.checkParameterType)(t,`boolean`),L()!==t&&(t&&R(e,_[e].lastEnabledIndex),t||(_[e].lastEnabledIndex=V(e),E?R(e,-1):D=!0)),!0},getAllTracksAreDisabled:function(){return w},getCurrentTrackIdx:V,getTextSourceBuffer:function(e){let t=e.id;if(v&&v[t])return v[t]},initialize:function(){O=Qs(t).create({adapter:n,baseURLController:c}),C.on(m.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,f),C.on(m.default.DVB_FONT_DOWNLOAD_FAILED,A,f),C.on(m.default.DVB_FONT_DOWNLOAD_COMPLETE,j,f),C.on(m.default.MEDIAINFO_UPDATED,I,f),C.on(m.default.PLAYBACK_TIME_UPDATED,N,f),d.get().streaming.text.webvtt.customRenderingEnabled&&C.on(m.default.PLAYBACK_SEEKING,P,f),C.on(m.default.PLAYBACK_SEEKED,F,f)},initializeForStream:function(e){let c=e.id,l=Gs(t).create({videoModel:u,settings:d,streamInfo:e});l.initialize(),y[c]=l;let f=Bs(t).create({errHandler:r,adapter:n,dvbFonts:O,manifestModel:i,mediaController:o,videoModel:u,textTracks:l,vttParser:b,vttCustomRenderingParser:x,ttmlParser:S,streamInfo:e,settings:d});f.initialize(),v[c]=f,_[c]={},_[c].lastEnabledIndex=-1},isTextEnabled:L,reset:function(){Object.keys(v).forEach((e=>{v[e].resetEmbedded(),v[e].reset()})),O.reset(),H(),C.off(m.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,f),C.off(m.default.DVB_FONT_DOWNLOAD_FAILED,A,f),C.off(m.default.DVB_FONT_DOWNLOAD_COMPLETE,j,f),C.off(m.default.MEDIAINFO_UPDATED,I,f),C.off(m.default.PLAYBACK_TIME_UPDATED,N,f),d.get().streaming.text.webvtt.customRenderingEnabled&&C.off(m.default.PLAYBACK_SEEKING,P,f),C.off(m.default.PLAYBACK_SEEKED,F,f)},setTextTrack:R,clearDataForStream:function(e){v[e]&&(v[e].resetEmbedded(),v[e].reset(),delete v[e]),y[e]&&(y[e].deleteAllTextTracks(),delete y[e]),_[e]&&delete _[e]}},T=!1,E=!1,D=!1,b=Ks(t).getInstance(),x=Js(t).getInstance(),S=Xs(t).getInstance(),C=(0,p.default)(t).getInstance(),k=(0,l.default)(t).getInstance().getLogger(f),H(),f}$s.__dashjs_factory_name=`TextController`;var ec=i.default.getClassFactory($s);function tc(e){e||={};let t=this.context,n=(0,l.default)(t).getInstance(),r=e.settings,i=(0,p.default)(t).getInstance(),o,c,u,d,f,m;function _(){return navigator&&navigator.connection&&!isNaN(navigator.connection.downlink)&&navigator.connection.downlink>0?1e3*navigator.connection.downlink:NaN}function v(e,t,n,r){let i=.5**(n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;let o=.5**(n/r.slow);e.slowEstimate=(1-o)*t+o*e.slowEstimate,e.totalWeight+=n}function y(){o={},c={},u={},d={}}let b={addEntry:function(e,t){try{if(!(e&&t&&t.trace&&t.trace.length))return;(function(e){o[e]=o[e]||[],c[e]=c[e]||[],u[e]=u[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},d[e]=d[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}})(e);let n=t.tresponse.getTime()-t.trequest.getTime()||1,l=function(e,t){return e._fileLoaderType&&e._fileLoaderType===h.default.FILE_LOADER_TYPES.FETCH?function(e){let t=e.trace.reduce(((e,t)=>e+t.b[0]),0),n=e.trace.reduce(((e,t)=>e+t.d),0),i=NaN;return r.get().streaming.abr.throughput.useNetworkInformationApi.fetch&&(i=_()),isNaN(i)&&(i=Math.round(8*t/n)),{downloadedBytes:t,value:i,downloadTimeInMs:n}}(e):function(e,t){let n=NaN,i=NaN,o=!1;if(r.get().streaming.abr.throughput.useResourceTimingApi&&e._resourceTimingValues)n=e._resourceTimingValues.transferSize,i=e._resourceTimingValues.responseEnd-e._resourceTimingValues.responseStart,o=!0;else{if(e.trace.length<=1)return{throughput:NaN,downloadTimeInMs:NaN};n=e.trace.reduce(((e,t)=>e+t.b[0]),0)-e.trace[0].b[0],i=Math.max(e.trace.reduce(((e,t)=>e+t.d),0)-e.trace[0].d,1)}let c=NaN;if(!o&&r.get().streaming.abr.throughput.useNetworkInformationApi.xhr&&(c=_()),isNaN(c)){let e=r.get().streaming.abr.throughput.useDeadTimeLatency?i:i+t;c=Math.round(8*n/e)}return{downloadedBytes:n,value:c,downloadTimeInMs:i}}(e,t)}(t,n);if(l.latencyInMs=n,isNaN(l.value)||!isFinite(l.value))return;if(t.cmsd){let e=t.cmsd.dynamic&&t.cmsd.dynamic.etp?t.cmsd.dynamic.etp:null;if(e){let t=r.get().streaming.cmsd.abr.etpWeightRatio;t>0&&t<=1&&(l.value=l.value*(1-t)+e*t)}}if(function(e,t,n){return r.get().streaming.abr.throughput.useResourceTimingApi&&n._resourceTimingValues?n._resourceTimingValues.transferSize===0&&n._resourceTimingValues.decodedBodySize>0:!isNaN(t)&&(e===h.default.VIDEO?t<r.get().streaming.cacheLoadThresholds[h.default.VIDEO]:e===h.default.AUDIO?t<r.get().streaming.cacheLoadThresholds[h.default.AUDIO]:void 0)}(e,t._tfinish.getTime()-t.trequest.getTime(),t))return void m.debug(`${e} Assuming segment ${t.url} came from cache, ignoring it for throughput calculation`);m.debug(`Added throughput entry for ${e}: ${l.value} kbit/s`),l.serviceLocation=t._serviceLocation,o[e].push(l),c[e].push({value:n}),function(e){o[e].length>r.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&o[e].shift(),c[e].length>r.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&c[e].shift()}(e),i.trigger(g.default.THROUGHPUT_MEASUREMENT_STORED,{throughputValues:l}),t.type!==T.HTTPRequest.MPD_TYPE&&(v(u[e],l.value,r.get().streaming.abr.throughput.ewma.weightDownloadTimeMultiplicationFactor*l.downloadTimeInMs,f.bandwidthHalfLife),v(d[e],n,1,f.latencyHalfLife))}catch(e){m.error(e)}},getThroughputDict:function(e){return e?o[e]:o},getEwmaThroughputDict:function(e){return e?u[e]:u},getEwmaLatencyDict:function(e){return e?d[e]:d},getEwmaHalfLife:function(){return f},getLatencyDict:function(e){return e?c[e]:c},reset:y};return m=n.getLogger(b),f={bandwidthHalfLife:{fast:r.get().streaming.abr.throughput.ewma.throughputFastHalfLifeSeconds,slow:r.get().streaming.abr.throughput.ewma.throughputSlowHalfLifeSeconds},latencyHalfLife:{fast:r.get().streaming.abr.throughput.ewma.latencyFastHalfLifeCount,slow:r.get().streaming.abr.throughput.ewma.latencySlowHalfLifeCount}},y(),b}tc.__dashjs_factory_name=`ThroughputModel`;var nc=i.default.getClassFactory(tc);function rc(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i;function o(){performance.clearResourceTimings()}function l(e){e.metric!==c.HTTP_REQUEST||!e.value||e.value.type!==T.HTTPRequest.MPD_TYPE&&(e.value.type!==T.HTTPRequest.MEDIA_SEGMENT_TYPE||e.mediaType!==h.default.AUDIO&&e.mediaType!==h.default.VIDEO)||n.addEntry(e.mediaType,e.value)}function u(e,t,o=null,c=NaN){let l,u=null,p=n.getEwmaHalfLife(),g=null,C=!0;switch(o||=i.get().streaming.abr.throughput.averageCalculationMode,e){case h.default.THROUGHPUT_TYPES.BANDWIDTH:u=o===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?n.getEwmaThroughputDict(t):n.getThroughputDict(t),g=p.bandwidthHalfLife,C=!0,c=isNaN(c)?r.getIsDynamic()?i.get().streaming.abr.throughput.sampleSettings.live:i.get().streaming.abr.throughput.sampleSettings.vod:c;break;case h.default.THROUGHPUT_TYPES.LATENCY:u=o===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?n.getEwmaLatencyDict(t):n.getLatencyDict(t),g=p.latencyHalfLife,C=!1,c=isNaN(c)?i.get().streaming.abr.throughput.sampleSettings.averageLatencySampleAmount:c}if(!u||u.length===0)return NaN;switch(o){case h.default.THROUGHPUT_CALCULATION_MODES.ARITHMETIC_MEAN:return l=d(u,c,e),f(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:return l=d(u,c,e),m(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_ARITHMETIC_MEAN:return l=d(u,c,e),_(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.HARMONIC_MEAN:return l=d(u,c,e),v(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:return l=d(u,c,e),y(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_HARMONIC_MEAN:return l=d(u,c,e),b(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.EWMA:return x(u,g,C);case h.default.THROUGHPUT_CALCULATION_MODES.ZLEMA:return l=d(u,c,e),S(u,l)}}function d(e,t,n){if(e){if(t>=e.length)t=e.length;else if(n===h.default.THROUGHPUT_TYPES.BANDWIDTH&&i.get().streaming.abr.throughput.sampleSettings.enableSampleSizeAdjustment)for(let n=1;n<t;++n){let r=e[e.length-n].value/e[e.length-n-1].value;if((r>=i.get().streaming.abr.throughput.sampleSettings.increaseScale||r<=i.get().streaming.abr.throughput.sampleSettings.decreaseScale)&&(t+=1)===e.length)break}}else t=0;return t}function f(e,t){let n=e;return t!==0&&n&&n.length!==0?(n=n.slice(-t),n.reduce(((e,t)=>e+t.value),0)/n.length):NaN}function m(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0;return n.reduce(((e,t)=>{let n=Math.sqrt(t.downloadedBytes);return r+=n,e+t.value*n}),0)/r}function _(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0;return n.reduce(((e,t,n)=>{let i=n+1;return r+=i,e+t.value*i}),0)/r}function v(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=n.reduce(((e,t)=>e+1/t.value),0);return n.length/r}function y(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0,i=n.reduce(((e,t)=>{let n=Math.sqrt(t.downloadedBytes);return r+=n,e+1/t.value*n}),0);return r/i}function b(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0,i=n.reduce(((e,t,n)=>{let i=n+1;return r+=i,e+1/t.value*i}),0);return r/i}function x(e,t,n=!0){if(!e||e.totalWeight<=0)return NaN;let r=e.fastEstimate/(1-.5**(e.totalWeight/t.fast)),i=e.slowEstimate/(1-.5**(e.totalWeight/t.slow));return n?Math.min(r,i):Math.max(r,i)}function S(e,t){if(t===0||!e||e.length===0)return NaN;let n=e.slice(-t).map((e=>e.value)),r=2/(n.length+1),i=n[n.length-1],o=n[n.length-1];for(let e=0;e<n.length;e++)i=r*n[e]+(1-r)*i,o=r*i+(1-r)*o;return o}function C(e,t=null,n=NaN){let r=u(h.default.THROUGHPUT_TYPES.BANDWIDTH,e,t,n);return Math.round(r)}let w={getArithmeticMean:f,getAverageLatency:function(e,t=null,n=NaN){let r=u(h.default.THROUGHPUT_TYPES.LATENCY,e,t,n);return Math.round(r)},getAverageThroughput:C,getByteSizeWeightedArithmeticMean:m,getByteSizeWeightedHarmonicMean:y,getDateWeightedArithmeticMean:_,getDateWeightedHarmonicMean:b,getEwma:x,getHarmonicMean:v,getRawThroughputData:function(e){return e?n.getThroughputDict(e):[]},getSafeAverageThroughput:function(e,t=null,n=NaN){let r=C(e,t,n);return isNaN(r)||(r*=i.get().streaming.abr.throughput.bandwidthSafetyFactor),r},getZlema:S,initialize:function(){n=nc(e).create({settings:i}),t.on(g.default.METRIC_ADDED,l,w),window.performance?.addEventListener?.(`resourcetimingbufferfull`,o)},reset:function(){n.reset(),t.off(g.default.METRIC_ADDED,l,w),window.performance?.removeEventListener?.(`resourcetimingbufferfull`,o)},setConfig:function(e){e.settings&&(i=e.settings),e.playbackController&&(r=e.playbackController)}};return w}rc.__dashjs_factory_name=`ThroughputController`;var ic=i.default.getSingletonFactory(rc);function ac(){let e=this.context,t=(0,p.default)(e).getInstance(),n=(0,u.default)(e).getInstance(),r,i,o,c;function l(e){c=e}function d(e,t,n,r){let i,o=t.adaptation.period.mpd,c=o.availabilityStartTime;if(r)i=n&&o.timeShiftBufferDepth!==1/0?new Date(c.getTime()+1e3*(e+o.timeShiftBufferDepth)):o.availabilityEndTime;else if(n){let n=t.availabilityTimeOffset;i=new Date(c.getTime()+1e3*(e-n))}else i=c;return i}function f(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*c)/1e3}function _(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function v(e){let t={start:NaN,end:NaN},n=e[0].getAdapter().getRegularPeriods()[0],r=f(new Date,n);if(!e||e.length===0)return{range:t,now:r};e.forEach((e=>{let n=e.getCurrentRepresentationForType(h.default.VIDEO);if(n||=e.getCurrentRepresentationForType(h.default.AUDIO),!n){let t=e.getAdapter(),r=t.getMediaInfoForType(e.getStreamInfo(),h.default.VIDEO)||t.getMediaInfoForType(e.getStreamInfo(),h.default.AUDIO);n=t.getVoRepresentations(r)[0]}let o={start:NaN,end:NaN};if(n)if(n.segmentInfoType===Y.default.SEGMENT_TIMELINE)o=function(e){let t=e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index],n=i.getRepresentationFor(e.index,t),r=n.SegmentTemplate||n.SegmentList,o=r.SegmentTimeline,c=r.timescale,l=o.S,u={start:0,end:0},d=l[0].t,f=!isNaN(d),p=f?d:0,m,h,g,v,y=0;for(f&&(u.start=_(p/c,e)),g=0,v=l.length;g<v;g++)m=l[g],h=0,m.hasOwnProperty(`r`)&&(h=m.r),y+=m.d*(1+h);return u.end=_((p+y)/c,e),u}(n);else{let e=n.adaptation.period;o.start=e.start,o.end=Math.max(r,e.start+e.duration)}!isNaN(o.start)&&(isNaN(t.start)||t.start>o.start)&&(t.start=o.start),!isNaN(o.end)&&(isNaN(t.end)||t.end<o.end)&&(t.end=o.end)})),t.end=Math.min(r,t.end);let o=b(e,t.end,!0);return t.end=isNaN(o)?t.end:o,t.start=n&&n.mpd&&n.mpd.timeShiftBufferDepth&&!isNaN(n.mpd.timeShiftBufferDepth)&&!isNaN(t.end)?Math.max(t.end-n.mpd.timeShiftBufferDepth,t.start):t.start,t.start=b(e,t.start),{range:t,now:r}}function y(e,t){o=e-t.end}function b(e,t,n=!1){try{let r=0,i=!1,o=NaN;for(;!i&&r<e.length;){let c=e[r].getStreamInfo();c.start<=t&&(!isFinite(c.duration)||c.start+c.duration>=t)?(o=t,i=!0):!n&&c.start>t&&(isNaN(o)||c.start<o)?o=c.start:n&&c.start+c.duration<t&&(isNaN(o)||c.start+c.duration>o)&&(o=c.start+c.duration),r+=1}return o}catch{return t}}function x(e){e.offset===void 0||isNaN(e.offset)||l(e.offset/1e3)}function S(){c=0,o=0}function C(){t.off(m.default.UPDATE_TIME_SYNC_OFFSET,x,this),S()}return r={calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return d(e,t,n,!0)},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return d(e,t,n)},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcPresentationTimeFromMediaTime:_,calcPresentationTimeFromWallTime:f,calcTimeShiftBufferWindow:function(e,r){if(!r)return function(e){let t={start:NaN,end:NaN},n=0,r=NaN;return e.forEach((e=>{let t=e.getStreamInfo();n+=t.duration,(isNaN(r)||t.start<r)&&(r=t.start)})),t.start=r,t.end=r+n,t}(e);if(n.get().streaming.timeShiftBuffer.calcFromSegmentTimeline){let t=v(e);return y(t.now,t.range),t.range}return function(e){let r={start:NaN,end:NaN};if(!e||e.length===0)return r;let i=e[0].getAdapter().getRegularPeriods()[0],o=f(new Date,i),c=i.mpd.timeShiftBufferDepth;if(r.start=b(e,isNaN(c)?0:o-c),r.end=!isNaN(r.start)&&o<r.start?o:b(e,o,!0),!isNaN(c)&&r.end<o-c&&(r.end=NaN),n.get().streaming.timeShiftBuffer.fallbackToSegmentTimeline){let n=v(e);if(n.range.end<r.start)return t.trigger(g.default.CONFORMANCE_VIOLATION,{level:cs.LEVELS.WARNING,event:cs.EVENTS.INVALID_DVR_WINDOW}),y(n.now,n.range),n.range}return r}(e)},calcWallTimeForSegment:function(e,t){let n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},getClientReferenceTime:function(){return Date.now()-1e3*o+1e3*c},getClientTimeOffset:function(){return c},initialize:function(){S(),t.on(m.default.UPDATE_TIME_SYNC_OFFSET,x,this)},reset:C,setClientTimeOffset:l,setConfig:function(e){e&&e.dashManifestModel&&(i=e.dashManifestModel)}},i=yt(e).getInstance(),C(),r}ac.__dashjs_factory_name=`TimelineConverter`;var oc=i.default.getSingletonFactory(ac),sc=class{constructor(){this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null}};function cc(){let e,t;return e={initialize:function(e){if(t=new sc,!e)return null;let n=e.indexOf(`#`);if(n!==-1){let r=e.substr(n+1).split(`&`);for(let e=0,n=r.length;e<n;++e){let n=r[e],i=n.indexOf(`=`);if(i!==-1){let e=n.substring(0,i);t.hasOwnProperty(e)&&(t[e]=n.substr(i+1))}}}},getURIFragmentData:function(){return t}},e}cc.__dashjs_factory_name=`URIFragmentModel`;var lc=i.default.getSingletonFactory(cc);let uc=new Map([[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,`loadedmetadata`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA,`loadeddata`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,`canplay`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA,`canplaythrough`]]);function dc(){let e,t,n,r,i,o,c,d,f,g,_,v,y=this.context,b=(0,p.default)(y).getInstance(),x=[];function S(e,t=!1){n&&(t?n.playbackRate=e:N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,(()=>{n.playbackRate=e})))}function C(){return x.length>0}function w(e){let t=x.indexOf(e);if(e!==null&&(t!==-1&&x.splice(t,1),g.get().streaming.buffer.syntheticStallEvents.enabled&&n&&!C())){let e=()=>{if(S(o||1,g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState),!n.paused){let e=document.createEvent(`Event`);e.initEvent(`playing`,!0,!1),n.dispatchEvent(e)}};g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState?e():(d&&d.func&&d.event&&D(d.event,d.func),d=N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,e))}}function T(){if(n&&C()&&n.playbackRate===0){let e=document.createEvent(`Event`);e.initEvent(`waiting`,!0,!1),n.dispatchEvent(e)}}function E(e,t){n&&n.addEventListener(e,t)}function D(e,t){n&&n.removeEventListener(e,t)}function O(){return n?n.readyState:NaN}function k(){return n?n.buffered:null}function A(){return n?n.clientWidth:NaN}function j(){return n?n.clientHeight:NaN}function M(e,t,r,i,o){if(n){for(let c=0;c<n.textTracks.length;c++)if(n.textTracks[c].kind===e&&(!t||n.textTracks[c].label==t)&&n.textTracks[c].language===r&&n.textTracks[c].isTTML===i&&n.textTracks[c].isEmbedded===o)return n.textTracks[c]}return null}function N(e,t){return e===h.default.VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING||O()>=e?(t(),null):function(e,t){let n=()=>{D(e,n),t(e)};return E(e,n),{func:n,event:e}}(uc.get(e),t)}return r={addEventListener:E,addTextTrack:function(e,t,r,i,o){if(!n)return null;let c=M(e,t,r,i,o);return c||(c=n.addTextTrack(e,t,r),c.isEmbedded=o,c.isTTML=i),c},appendChild:function(e){n&&(n.appendChild(e),e.isTTML!==void 0&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},getBufferRange:k,getClientHeight:j,getClientWidth:A,getElement:function(){return n},getEnded:function(){return n?n.ended:null},getPlaybackQuality:function(){if(!n)return null;let e=`webkitDroppedFrameCount`in n&&`webkitDecodedFrameCount`in n,t=null;return`getVideoPlaybackQuality`in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},getPlaybackRate:function(){return n?n.playbackRate:null},getPlayedRanges:function(){return n?n.played:null},getReadyState:O,getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return e},getTextTrack:M,getTextTracks:function(){return n?n.textTracks:[]},getTime:function(){return n?isNaN(t)?n.currentTime:t:null},getVideoElementSize:function(){let e=g.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty(`devicePixelRatio`)?window.devicePixelRatio:1;return{elementWidth:A()*e,elementHeight:j()*e}},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetLeft:function(){if(n){let e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN}return NaN},getVideoRelativeOffsetTop:function(){if(n){let e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN}return NaN},getVideoWidth:function(){return n?n.videoWidth:NaN},getVttRenderingDiv:function(){return v},initialize:function(){b.on(m.default.PLAYBACK_PLAYING,T,this)},isPaused:function(){return n?n.paused:null},isSeeking:function(){return n?n.seeking||!isNaN(t):null},isStalled:C,pause:function(){n&&(n.pause(),n.autoplay=!1)},play:function(){if(n){n.autoplay=!0;let e=n.play();e&&e.catch&&typeof Promise<`u`&&e.catch((e=>{e.name===`NotAllowedError`&&b.trigger(m.default.PLAYBACK_NOT_ALLOWED),i.warn(`Caught pending play exception - continuing (${e})`)}))}},removeChild:function(e){n&&n.removeChild(e)},removeEventListener:D,reset:function(){clearTimeout(_),b.off(m.default.PLAYBACK_PLAYING,T,this),x.length=0,function(){try{c&&n&&(c.unobserve(n),c.disconnect(),c=null)}catch{}}()},setConfig:function(e){e&&e.settings&&(g=e.settings)},setCurrentTime:function(e,r){n&&(f&&f.func&&f.event&&D(f.event,f.func),t=e,f=N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(()=>{if(n)if(n.currentTime!==t)try{t=r?function(e){let t=k(),n=e,r=9999999999;if(t)for(let i=0;i<t.length;i++){let o=t.start(i),c=t.end(i),l=Math.abs(o-e),u=Math.abs(c-e);if(e>=o&&e<=c)return e;l<r&&(r=l,n=o),u<r&&(r=u,n=c)}return n}(t):t,isNaN(t)||(n.currentTime=t),t=NaN}catch(e){n.readyState===0&&e.code===e.INVALID_STATE_ERR&&(_=setTimeout((function(){n.currentTime=t,t=NaN}),400))}else t=NaN})))},setDisableRemotePlayback:function(e){n&&(n.disableRemotePlayback=e)},setElement:function(e){if(!(e==null||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw`element is not video or audio DOM type!`;n=e,function(e){try{if(!c||!e)return;c.observe(e)}catch{}}(n)},setPlaybackRate:S,setSource:function(e){n&&(e?n.src=e:(n.removeAttribute(`src`),n.load()))},setStallState:function(e,t){(function(e,t){t?function(e){if(e!==null&&n&&!n.seeking&&x.indexOf(e)===-1&&(x.push(e),g.get().streaming.buffer.syntheticStallEvents.enabled&&n&&x.length===1&&(g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState||O()>=h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA))){o=n.playbackRate,S(0,!0);let e=document.createEvent(`Event`);e.initEvent(`waiting`,!0,!1),n.dispatchEvent(e)}}(e):w(e)})(e,t)},setTTMLRenderingDiv:function(t){e=t,e.style.position=`absolute`,e.style.display=`flex`,e.style.overflow=`hidden`,e.style.pointerEvents=`none`,e.style.top=0,e.style.left=0},setVttRenderingDiv:function(e){v=e},waitForReadyState:N},i=(0,l.default)(y).getInstance().getLogger(r),g=(0,u.default)(y).getInstance(),t=NaN,function(){try{c=new ResizeObserver((()=>{b.trigger(m.default.VIDEO_ELEMENT_RESIZED)}))}catch{}}(),r}dc.__dashjs_factory_name=`VideoModel`;var fc=i.default.getSingletonFactory(dc),pc=r(8986);function mc(){let e=`You must first call initialize() and set a source before calling this method`,t=`You must first call initialize() and set a valid source and view before calling this method`,n=`You must first call attachView() to set the video element before calling this method`,r=`You must first call attachSource() with a valid source before calling this method`,o=`MediaPlayer not initialized!`,d=this.context,f=(0,p.default)(d).getInstance(),_=(0,u.default)(d).getInstance(),v=(0,l.default)(d).getInstance({settings:_}),y,b,x,S,C,w,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,ee,q,te,ne,re,ie,J,ae,oe,se,ce,le,ue,de;function fe(){Oe(null),Ee(null),S=null,P&&=(P.reset(),null),F&&=(F.reset(),null),B&&B.reset(),_.reset(),L&&=(L.reset(),null)}function pe(){return!!x&&!!se.getElement()}function me(){return(0,pc.getVersionString)()}function he(){if(!E)throw t;return q.isPaused()}function ge(){if(!E)throw t;return q.getIsDynamic()}function _e(e){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);return n?ve(n.range.start+e,n):0}function ve(e,t){let n=q.getOriginalLiveDelay();return e>t.range.end-n&&(e=t.range.end-n),e}function ye(e=``){if(!E)throw t;let n=we().currentTime;return e!==``&&(n=G.getTimeRelativeToStreamId(n,e)),n}function be(e){(0,Ve.checkParameterType)(e,`boolean`),D=e}function Se(){B.restoreDefaultUTCTimingSources()}function Ce(){return ie}function we(){if(!se.getElement())throw n;return se.getElement()}function Ee(e){if(!C)throw o;se.setElement(e),e&&(Pe(),function(){if(F||typeof dashjs>`u`)return;let e=dashjs.MetricsReporting;typeof e==`function`&&(F=e(d).create().createMetricsReporting({debug:v,eventBus:f,mediaElement:we(),adapter:R,dashMetrics:ie,mediaPlayerModel:z,events:m.default,constants:h.default,metricsConstants:c}))}(),function(){if(I||typeof dashjs>`u`)return;let e=dashjs.MssHandler;typeof e==`function`&&(Ne.extend(e.errors),I=e(d).create({eventBus:f,mediaPlayerModel:z,dashMetrics:ie,manifestModel:J,playbackController:q,streamController:G,protectionController:P,baseURLController:H,errHandler:V,events:m.default,constants:h.default,debug:v,initSegmentType:T.HTTPRequest.INIT_SEGMENT_TYPE,BASE64:Te,ISOBoxer:xr,settings:_}))}(),G&&G.switchToVideoElement(O)),E&&(Ae(),je()),Ie(O)}function De(t){if(!w)throw e;let n=G.getActiveStreamInfo();return n?N.getTracksFor(t,n.id).filter((e=>!P||P.areKeyIdsUsable(e.normalizedKeyIds))):[]}function Oe(e,t=NaN){if(!C)throw o;typeof e==`string`&&ce.initialize(e),t??=NaN,isNaN(t)||(t=Math.max(0,t)),O=t,x=e,(w||E)&&(Ae(),je()),pe()&&Ie(O)}function ke(){if(!w)throw e;let t=G.getActiveStreamInfo();return t?G.getStreamById(t.id):null}function Ae(){E=!1,w=!1,R.reset(),G.reset(),ee.reset(),re.reset(),q.reset(),te.reset(),ne.reset(),k.reset(),A.reset(),N.reset(),ue.reset(),P&&(_.get().streaming.protection.keepProtectionMediaKeys?P.stop():(P.reset(),P=null,Pe())),K.reset(),ae.reset(),oe.reset()}function je(){B.resetPlaybackSessionSpecificSettings()}function Me(){return ba(d).create({debug:v,errHandler:V,dashMetrics:ie,mediaPlayerModel:z,mssHandler:I,settings:_})}function Pe(){if(P)return P;if(typeof dashjs>`u`)return null;let e=dashjs.Protection;if(typeof e==`function`){let t=e(d).create();return m.default.extend(e.events),g.default.extend(e.events,{publicOnly:!0}),Ne.extend(e.errors),P=t.createProtectionSystem({debug:v,errHandler:V,videoModel:se,customParametersModel:B,capabilities:U,eventBus:f,events:m.default,BASE64:Te,constants:h.default,cmcdModel:ae,settings:_}),U||=(0,Tr.default)(d).getInstance(),U.setProtectionController(P),P}return null}function Fe(){if(!C)throw o;if(L)return L;if(typeof dashjs>`u`)return null;let e=dashjs.OfflineController;if(typeof e==`function`){m.default.extend(e.events),g.default.extend(e.events,{publicOnly:!0}),Ne.extend(e.errors);let t=Me(),n=Ea(d).create();return n.setConfig({manifestModel:J,adapter:R,manifestLoader:t,errHandler:V,contentSteeringController:ne}),L=e(d).create({debug:v,manifestUpdater:n,baseURLController:H,manifestLoader:t,manifestModel:J,mediaPlayerModel:z,abrController:k,playbackController:q,adapter:R,errHandler:V,dashMetrics:ie,timelineConverter:M,segmentBaseController:ue,schemeLoaderFactory:j,eventBus:f,events:m.default,errors:Ne,constants:h.default,settings:_,dashConstants:Y.default,urlUtils:ht(d).getInstance()}),L}return null}function Ie(e=NaN){L&&L.resetRecords(),!w&&x&&(w=!0,b.info(`Streaming Initialized`),function(){let e=Me();G||=fs(d).getInstance(),K||=ec(d).create({errHandler:V,manifestModel:J,adapter:R,mediaController:N,baseURLController:H,videoModel:se,settings:_}),W.setConfig({capabilities:U,customParametersModel:B,adapter:R,settings:_,protectionController:P,manifestModel:J,errHandler:V}),G.setConfig({capabilities:U,capabilitiesFilter:W,manifestLoader:e,manifestModel:J,mediaPlayerModel:z,customParametersModel:B,protectionController:P,textController:K,adapter:R,dashMetrics:ie,errHandler:V,timelineConverter:M,videoModel:se,playbackController:q,serviceDescriptionController:te,contentSteeringController:ne,abrController:k,throughputController:A,mediaController:N,settings:_,baseURLController:H,uriFragmentModel:ce,segmentBaseController:ue}),ee.setConfig({settings:_,playbackController:q,streamController:G,videoModel:se,timelineConverter:M,adapter:R}),q.setConfig({streamController:G,serviceDescriptionController:te,dashMetrics:ie,adapter:R,videoModel:se,timelineConverter:M,settings:_}),re.setConfig({streamController:G,playbackController:q,mediaPlayerModel:z,videoModel:se,settings:_}),A.setConfig({settings:_,playbackController:q}),k.setConfig({streamController:G,capabilities:U,domStorage:le,mediaPlayerModel:z,customParametersModel:B,throughputController:A,cmsdModel:oe,dashMetrics:ie,adapter:R,videoModel:se,settings:_}),ae.setConfig({abrController:k,dashMetrics:ie,playbackController:q,serviceDescriptionController:te,throughputController:A}),de.setConfig({serviceDescriptionController:te}),oe.setConfig({}),N.initialize(),A.initialize(),k.initialize(),G.initialize(D,S),K.initialize(),ee.initialize(),re.initialize(),ae.initialize(D),oe.initialize(),ne.initialize(),ue.initialize()}(),typeof x==`string`?G.load(x,e):G.loadWithManifest(x,e)),!E&&pe()&&(E=!0,f.trigger(g.default.PLAYBACK_INITIALIZED),b.info(`Playback Initialized`))}return y={addABRCustomRule:function(e,t,n){B.addAbrCustomRule(e,t,n)},addExternalSubtitle:function(e){e instanceof Ki.default||b.error(`Invalid external subtitle object. Must be an instance of dashjs.ExternalSubtitle`),B.addExternalSubtitle(e)},addRequestInterceptor:function(e){B.addRequestInterceptor(e)},addResponseInterceptor:function(e){B.addResponseInterceptor(e)},addUTCTimingSource:function(e,t){B.addUTCTimingSource(e,t)},attachProtectionController:function(e){P=e},attachSource:Oe,attachTTMLRenderingDiv:function(e){if(!se.getElement())throw n;se.setTTMLRenderingDiv(e)},attachView:Ee,attachVttRenderingDiv:function(e){if(!se.getElement())throw n;se.setVttRenderingDiv(e)},clearDefaultUTCTimingSources:function(){B.clearDefaultUTCTimingSources()},convertToTimeCode:function(e){e=Math.max(e,0);let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(t===0?``:t<10?`0`+t.toString()+`:`:t.toString()+`:`)+(n<10?`0`+n.toString():n.toString())+`:`+(r<10?`0`+r.toString():r.toString())},destroy:function(){fe(),i.default.deleteSingletonInstances(d)},duration:function(){if(!E)throw t;let e=we().duration;if(q.getIsDynamic()){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e},enableForcedTextStreaming:function(e){return!(!G.getActiveStreamInfo()||!K)&&K.enableForcedTextStreaming(e)},enableText:function(e){let t=G.getActiveStreamInfo();return!(!t||!K)&&K.enableText(t.id,e)},extend:function(e,t,n){i.default.extend(e,t,n,d)},formatUTC:function(e,t,n,r=!1){let i=new Date(1e3*e),o=i.toLocaleDateString(t),c=i.toLocaleTimeString(t,{hour12:n});return r?c+` `+o:c},getABRCustomRules:function(){return B.getAbrCustomRules()},getActiveStream:ke,getAutoPlay:function(){return D},getAvailableBaseUrls:function(){let e=J.getValue();return e?H.getBaseUrls(e):[]},getAvailableLocations:function(){let e=J.getValue();if(!e)return[];let t=R.getLocation(e),n=ne.getSynthesizedLocationElements(t);return t.concat(n)},getAverageLatency:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getAverageLatency(e,t,n):0},getAverageThroughput:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getAverageThroughput(e,t,n):0},getBufferLength:function(e){let t=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT];if(e)return t.indexOf(e)===-1?(b.warn(`getBufferLength requested for invalid type`),NaN):Ce().getCurrentBufferLevel(e)||NaN;{let e=t.map((e=>De(e).length>0?Ce().getCurrentBufferLevel(e):Number.MAX_VALUE)).reduce(((e,t)=>Math.min(e,t)));return e===Number.MAX_VALUE?NaN:e}},getCurrentLiveLatency:function(){if(!C)throw o;return E?q.getCurrentLiveLatency():NaN},getCurrentRepresentationForType:function(t){if(!w)throw e;if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return null;let n=ke();if(!n)return null;if(t===h.default.IMAGE){let e=n.getThumbnailController();return e?e.getCurrentTrack():-1}return n.getCurrentRepresentationForType(t)},getCurrentSteeringResponseData:function(){if(ne)return ne.getCurrentSteeringResponseData()},getCurrentTextTrackIndex:function(){let e=NaN,t=G.getActiveStreamInfo();if(t&&K)return e=K.getCurrentTrackIdx(t.id),e},getCurrentTrackFor:function(t){if(!w)throw e;let n=G.getActiveStreamInfo();return n?N.getCurrentTrackFor(t,n.id):null},getDashAdapter:function(){return R},getDashMetrics:Ce,getDebug:function(){return v},getDvrSeekOffset:_e,getDvrWindow:function(){if(!E)throw t;let e=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(e);if(!n)return{};let r=0,i=q.getIsDynamic();return i&&(r=n.manifestInfo.availableFrom.getTime()/1e3),{start:n.range.start,end:n.range.end,startAsUtc:i?r+n.range.start:NaN,endAsUtc:i?r+n.range.end:NaN,size:n.range.end-n.range.start}},getExternalSubtitles:function(){B.getExternalSubtitles()},getInitialMediaSettingsFor:function(e){if(!C)throw o;return N.getInitialSettings(e)},getLowLatencyModeEnabled:function(){if(!E)throw t;return q.getLowLatencyModeEnabled()},getManifest:function(){return J.getValue()},getOfflineController:function(){return Fe()},getPlaybackRate:function(){return we().playbackRate},getProtectionController:function(){return Pe()},getRawThroughputData:function(e=h.default.VIDEO){return A?A.getRawThroughputData(e):[]},getRepresentationsByType:function(t,n=null){if(!w)throw e;let r=n?G.getStreamById(n):ke();return r?r.getRepresentationsByType(t):[]},getSafeAverageThroughput:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getSafeAverageThroughput(e,t,n):0},getSettings:function(){return _.get()},getSource:function(){if(!x)throw r;return x},getStreamsFromManifest:function(t){if(!w)throw e;return R.getStreamsInfo(t)},getTTMLRenderingDiv:function(){return se?se.getTTMLRenderingDiv():null},getTargetLiveDelay:function(){if(!E)throw t;return q.getOriginalLiveDelay()},getTracksFor:De,getTracksForTypeFromManifest:function(t,n,r){if(!w)throw e;return(r||=R.getStreamsInfo(n,1)[0])?R.getAllMediaInfoForType(r,t,n):[]},getVersion:me,getVideoElement:we,getVolume:function(){return we().volume},getXHRWithCredentialsForType:function(e){return B.getXHRWithCredentialsForType(e)},initialize:function(e,t,n,r=NaN){U||(U=(0,Tr.default)(d).getInstance(),U.setConfig({settings:_,protectionController:P})),V||=Gi(d).getInstance(),U.supportsMediaSource()?(C||(C=!0,M=oc(d).getInstance(),A||=ic(d).getInstance(),k||=xe(d).getInstance(),j||=ir(d).getInstance(),q||=Na(d).getInstance(),N||=ka(d).getInstance(),G||=fs(d).getInstance(),ee||=Ji(d).getInstance(),re||=Nr(d).getInstance(),te||=Ja(d).getInstance(),ne||=ur(d).getInstance(),W||=jr(d).getInstance(),R=Ti(d).getInstance(),J=Sa(d).getInstance(),ae=Rn(d).getInstance(),oe=Gn(d).getInstance(),de=Xn(d).getInstance(),ie=Ui(d).getInstance({settings:_}),le=Vr(d).getInstance({settings:_}),R.setConfig({constants:h.default,cea608parser:new Ns,errHandler:V,BASE64:Te}),H||=gr(d).create(),H.setConfig({adapter:R,contentSteeringController:ne}),te.setConfig({adapter:R}),ue||=Ua(d).getInstance({dashMetrics:ie,mediaPlayerModel:z,errHandler:V,baseURLController:H,events:m.default,eventBus:f,debug:v,boxParser:wr(d).getInstance(),errors:Ne}),N.setConfig({domStorage:le,settings:_,mediaPlayerModel:z,customParametersModel:B,videoModel:se}),z.setConfig({playbackController:q,serviceDescriptionController:te}),ne.setConfig({adapter:R,errHandler:V,dashMetrics:ie,mediaPlayerModel:z,manifestModel:J,serviceDescriptionController:te,throughputController:A,eventBus:f}),Se(),be(n===void 0||n),Fe()),e&&Ee(e),t&&Oe(t,r),b.info(`[dash.js `+me()+`] MediaPlayer has been initialized`)):V.error(new Be.default(Ne.CAPABILITY_MEDIASOURCE_ERROR_CODE,Ne.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},isDynamic:ge,isMuted:function(){return we().muted},isPaused:he,isReady:pe,isSeeking:function(){if(!E)throw t;return q.isSeeking()},isTextEnabled:function(){let e=G.getActiveStreamInfo();return!(!e||!K)&&K.isTextEnabled(e)},off:function(e,t,n){f.off(e,t,n)},on:function(e,t,n,r){f.on(e,t,n,r)},pause:function(){if(!E)throw t;q.pause()},play:function(){if(!E)throw t;(!D||he()&&E)&&q.play(!0)},preload:function(){if(!se.getElement()&&!w){if(!x)throw r;Ie(O)}},provideThumbnail:function(e,t){if(typeof t!=`function`)return;if(e<0)return void t(null);let n=q.getIsDynamic()?_e(e):e,r=G.getStreamForTime(n);if(r===null)return void t(null);let i=r.getThumbnailController();if(i)return i.provide(n,t);t(null)},refreshManifest:function(e){if(!C)throw o;if(!pe())return e(null,r);let t=this;if(typeof e==`function`){let n=function(r){f.off(m.default.INTERNAL_MANIFEST_LOADED,n,t),r.error?e(null,r.error):e(r.manifest)};f.on(m.default.INTERNAL_MANIFEST_LOADED,n,t)}G.refreshManifest()},registerCustomCapabilitiesFilter:function(e){B.registerCustomCapabilitiesFilter(e)},registerLicenseRequestFilter:function(e){B.registerLicenseRequestFilter(e)},registerLicenseResponseFilter:function(e){B.registerLicenseResponseFilter(e)},removeABRCustomRule:function(e){B.removeAbrCustomRule(e)},removeAllABRCustomRule:function(){B.removeAllAbrCustomRule()},removeExternalSubtitleById:function(e){B.removeExternalSubtitleById(e)},removeExternalSubtitleByUrl:function(e){B.removeExternalSubtitleByUrl(e)},removeRequestInterceptor:function(e){B.removeRequestInterceptor(e)},removeResponseInterceptor:function(e){B.removeResponseInterceptor(e)},removeUTCTimingSource:function(e,t){B.removeUTCTimingSource(e,t)},reset:fe,resetCustomInitialTrackSelectionFunction:function(){B.resetCustomInitialTrackSelectionFunction(null)},resetSettings:function(){_.reset()},restoreDefaultUTCTimingSources:Se,retrieveManifest:function(e,t){let n=Me(),r=this,i=function(e){e.error?t(null,e.error):t(e.manifest),f.off(m.default.INTERNAL_MANIFEST_LOADED,i,r),n.reset()};f.on(m.default.INTERNAL_MANIFEST_LOADED,i,r),ce.initialize(e),n.load(e)},seek:function(e){if(!E)throw t;if((0,Ve.checkParameterType)(e,`number`),isNaN(e))throw h.default.BAD_ARGUMENT_ERROR;e<0&&(e=0);let n=q.getIsDynamic()?_e(e):e,r=we();!q.getIsDynamic()&&r.duration&&(n=Math.min(r.duration,n)),q.seek(n,!1,!1,!0)},seekToOriginalLive:function(){E&&ge()&&q.seekToOriginalLive()},seekToPresentationTime:function(e){if(!E)throw t;if((0,Ve.checkParameterType)(e,`number`),isNaN(e))throw h.default.BAD_ARGUMENT_ERROR;e<0&&(e=0);let n=we();if(!q.getIsDynamic()&&n.duration&&(e=Math.min(n.duration,e)),q.getIsDynamic()){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);if(!n)return;(e=ve(e,n))<n.range.start&&(e=n.range.start)}q.seek(e,!1,!1,!0)},setAutoPlay:be,setConfig:function(e){e&&(e.capabilities&&(U=e.capabilities),e.capabilitiesFilter&&(W=e.capabilitiesFilter),e.streamController&&(G=e.streamController),e.textController&&(K=e.textController),e.gapController&&(ee=e.gapController),e.throughputController&&(A=e.throughputController),e.playbackController&&(q=e.playbackController),e.serviceDescriptionController&&(te=e.serviceDescriptionController),e.contentSteeringController&&(ne=e.contentSteeringController),e.clientDataReportingController&&(de=e.clientDataReportingController),e.catchupController&&(re=e.catchupController),e.mediaPlayerModel&&(z=e.mediaPlayerModel),e.customParametersModel&&(B=e.customParametersModel),e.abrController&&(k=e.abrController),e.schemeLoaderFactory&&(j=e.schemeLoaderFactory),e.mediaController&&(N=e.mediaController),e.settings&&(_=e.settings),e.dashMetrics&&(ie=e.dashMetrics))},setCurrentTrack:function(t,n=!1){if(!w)throw e;!P||P.areKeyIdsUsable(t.normalizedKeyIds)?N.setTrack(t,{noSettingsSave:n}):b.error(`Can not switch to track with index ${t.index} because key is not usable`)},setCustomInitialTrackSelectionFunction:function(e){B.setCustomInitialTrackSelectionFunction(e)},setInitialMediaSettingsFor:function(e,t){if(!C)throw o;let n=function(e){let t=_.get().streaming.defaultSchemeIdUri,n={};function r(e,t,n){let r={};if(t){if(t instanceof Array)throw`Array type not supported for settings!`;return t instanceof Object?(r.schemeIdUri=t.schemeIdUri?t.schemeIdUri:``,r.value=t.value?t.value:``):(r.schemeIdUri=n,r.value=t,b.warn(`No schemeIdUri provided for `+e+`, using default "`+n+`"`)),r}return null}return e.id!==void 0&&(n.id=e.id),e.lang!==void 0&&(n.lang=e.lang),isNaN(e.index)||(n.index=e.index),e.viewpoint!==void 0&&(n.viewpoint=r(`viewpoint`,e.viewpoint,t.viewpoint)),e.audioChannelConfiguration!==void 0&&(n.audioChannelConfiguration=r(`audioChannelConfiguration`,e.audioChannelConfiguration,t.audioChannelConfiguration)),e.role!==void 0&&e.role!==null&&(n.role=r(`role`,e.role,t.role),n.role.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&n.role.value===`Main`&&(n.role.value=Y.default.MAIN)),e.accessibility!==void 0&&(n.accessibility=r(`accessibility`,e.accessibility,t.accessibility)),n}(t);N.setInitialSettings(e,n)},setMute:function(e){(0,Ve.checkParameterType)(e,`boolean`),we().muted=e},setPlaybackRate:function(e){we().playbackRate=e},setProtectionData:function(e){S=e,G&&G.setProtectionData(S)},setRepresentationForTypeById:function(t,n,r=!1){if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return;if(!w)throw e;let i=ke();if(i)if(t===h.default.IMAGE){let e=i.getThumbnailController();e&&e.setTrackById(n)}else{let e=i.getRepresentationForTypeById(t,n);e&&k.manuallySetPlaybackQuality(t,G.getActiveStreamInfo(),e,{forceReplace:r})}},setRepresentationForTypeByIndex:function(t,n,r=!1){if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return;if(!w)throw e;let i=ke();if(i)if(t===h.default.IMAGE){let e=i.getThumbnailController();e&&e.setTrackByIndex(n)}else{let e=i.getRepresentationForTypeByIndex(t,n);e&&k.manuallySetPlaybackQuality(t,G.getActiveStreamInfo(),e,{forceReplace:r})}},setTextTrack:function(e){if(!E)throw t;let n=G.getActiveStreamInfo();n&&K&&K.setTextTrack(n.id,e)},setVolume:function(e){if(typeof e!=`number`||isNaN(e)||e<0||e>1)throw h.default.BAD_ARGUMENT_ERROR;we().volume=e},setXHRWithCredentialsForType:function(e,t){B.setXHRWithCredentialsForType(e,t)},time:ye,timeAsUTC:function(){if(!E)throw t;if(!q.getIsDynamic()||ye()<0)return NaN;let e=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n,r,i=ie.getCurrentDVRInfo(e);return i?(n=i.manifestInfo.availableFrom.getTime()/1e3,r=n+ye(),r):0},timeInDvrWindow:function(){if(!E)throw t;if(!q.getIsDynamic())return ye();let e=we().currentTime,n=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,r=ie.getCurrentDVRInfo(n);return e=r===null||e===0?0:Math.max(0,e-r.range.start),e},trigger:function(e,t,n){f.trigger(e,t,n)},triggerSteeringRequest:function(){if(ne)return ne.loadSteeringData()},unregisterCustomCapabilitiesFilter:function(e){B.unregisterCustomCapabilitiesFilter(e)},unregisterLicenseRequestFilter:function(e){B.unregisterLicenseRequestFilter(e)},unregisterLicenseResponseFilter:function(e){B.unregisterLicenseResponseFilter(e)},updateSettings:function(e){_.update(e)},updateSource:function(e){x=e,G.load(x)}},b=v.getLogger(y),C=!1,E=!1,w=!1,D=!0,O=NaN,P=null,L=null,S=null,R=null,ue=null,m.default.extend(g.default),z=ja(d).getInstance(),B=(0,Kn.default)(d).getInstance(),se=fc(d).getInstance(),ce=lc(d).getInstance(),y}mc.__dashjs_factory_name=`MediaPlayer`;let hc=i.default.getClassFactory(mc);hc.events=g.default,hc.errors=Ne,i.default.updateClassFactory(mc.__dashjs_factory_name,hc);var gc=hc},1191:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.AST_IN_FUTURE=`astInFuture`,this.BASE_URLS_UPDATED=`baseUrlsUpdated`,this.BUFFER_EMPTY=`bufferStalled`,this.BUFFER_LOADED=`bufferLoaded`,this.BUFFER_LEVEL_STATE_CHANGED=`bufferStateChanged`,this.BUFFER_LEVEL_UPDATED=`bufferLevelUpdated`,this.DVB_FONT_DOWNLOAD_ADDED=`dvbFontDownloadAdded`,this.DVB_FONT_DOWNLOAD_COMPLETE=`dvbFontDownloadComplete`,this.DVB_FONT_DOWNLOAD_FAILED=`dvbFontDownloadFailed`,this.DYNAMIC_TO_STATIC=`dynamicToStatic`,this.ERROR=`error`,this.FRAGMENT_LOADING_COMPLETED=`fragmentLoadingCompleted`,this.FRAGMENT_LOADING_PROGRESS=`fragmentLoadingProgress`,this.FRAGMENT_LOADING_STARTED=`fragmentLoadingStarted`,this.FRAGMENT_LOADING_ABANDONED=`fragmentLoadingAbandoned`,this.LOG=`log`,this.MANIFEST_LOADING_STARTED=`manifestLoadingStarted`,this.MANIFEST_LOADING_FINISHED=`manifestLoadingFinished`,this.MANIFEST_LOADED=`manifestLoaded`,this.METRICS_CHANGED=`metricsChanged`,this.METRIC_CHANGED=`metricChanged`,this.METRIC_ADDED=`metricAdded`,this.METRIC_UPDATED=`metricUpdated`,this.PERIOD_SWITCH_STARTED=`periodSwitchStarted`,this.PERIOD_SWITCH_COMPLETED=`periodSwitchCompleted`,this.QUALITY_CHANGE_REQUESTED=`qualityChangeRequested`,this.QUALITY_CHANGE_RENDERED=`qualityChangeRendered`,this.NEW_TRACK_SELECTED=`newTrackSelected`,this.TRACK_CHANGE_RENDERED=`trackChangeRendered`,this.STREAM_INITIALIZING=`streamInitializing`,this.STREAM_UPDATED=`streamUpdated`,this.STREAM_ACTIVATED=`streamActivated`,this.STREAM_DEACTIVATED=`streamDeactivated`,this.STREAM_INITIALIZED=`streamInitialized`,this.STREAM_TEARDOWN_COMPLETE=`streamTeardownComplete`,this.TEXT_TRACKS_ADDED=`allTextTracksAdded`,this.TEXT_TRACK_ADDED=`textTrackAdded`,this.CUE_ENTER=`cueEnter`,this.CUE_EXIT=`cueExit`,this.THROUGHPUT_MEASUREMENT_STORED=`throughputMeasurementStored`,this.TTML_PARSED=`ttmlParsed`,this.TTML_TO_PARSE=`ttmlToParse`,this.CAPTION_RENDERED=`captionRendered`,this.CAPTION_CONTAINER_RESIZE=`captionContainerResize`,this.CAN_PLAY=`canPlay`,this.CAN_PLAY_THROUGH=`canPlayThrough`,this.PLAYBACK_ENDED=`playbackEnded`,this.PLAYBACK_ERROR=`playbackError`,this.PLAYBACK_INITIALIZED=`playbackInitialized`,this.PLAYBACK_NOT_ALLOWED=`playbackNotAllowed`,this.PLAYBACK_METADATA_LOADED=`playbackMetaDataLoaded`,this.PLAYBACK_LOADED_DATA=`playbackLoadedData`,this.PLAYBACK_PAUSED=`playbackPaused`,this.PLAYBACK_PLAYING=`playbackPlaying`,this.PLAYBACK_PROGRESS=`playbackProgress`,this.PLAYBACK_RATE_CHANGED=`playbackRateChanged`,this.PLAYBACK_SEEKED=`playbackSeeked`,this.PLAYBACK_SEEKING=`playbackSeeking`,this.PLAYBACK_STALLED=`playbackStalled`,this.PLAYBACK_STARTED=`playbackStarted`,this.PLAYBACK_TIME_UPDATED=`playbackTimeUpdated`,this.PLAYBACK_VOLUME_CHANGED=`playbackVolumeChanged`,this.PLAYBACK_WAITING=`playbackWaiting`,this.MANIFEST_VALIDITY_CHANGED=`manifestValidityChanged`,this.EVENT_MODE_ON_START=`eventModeOnStart`,this.EVENT_MODE_ON_RECEIVE=`eventModeOnReceive`,this.CONFORMANCE_VIOLATION=`conformanceViolation`,this.REPRESENTATION_SWITCH=`representationSwitch`,this.ADAPTATION_SET_REMOVED_NO_CAPABILITIES=`adaptationSetRemovedNoCapabilities`,this.CONTENT_STEERING_REQUEST_COMPLETED=`contentSteeringRequestCompleted`,this.INBAND_PRFT=`inbandPrft`,this.MANAGED_MEDIA_SOURCE_START_STREAMING=`managedMediaSourceStartStreaming`,this.MANAGED_MEDIA_SOURCE_END_STREAMING=`managedMediaSourceEndStreaming`}}t.default=new i},5212:function(e,t,n){n.r(t),t.default={STREAM:`stream`,VIDEO:`video`,ENHANCEMENT:`enhancement`,AUDIO:`audio`,TEXT:`text`,MUXED:`muxed`,IMAGE:`image`,STPP:`stpp`,TTML:`ttml`,VTT:`vtt`,WVTT:`wvtt`,CONTENT_STEERING:`contentSteering`,LIVE_CATCHUP_MODE_DEFAULT:`liveCatchupModeDefault`,LIVE_CATCHUP_MODE_LOLP:`liveCatchupModeLoLP`,MOVING_AVERAGE_SLIDING_WINDOW:`slidingWindow`,MOVING_AVERAGE_EWMA:`ewma`,BAD_ARGUMENT_ERROR:`Invalid Arguments`,MISSING_CONFIG_ERROR:`Missing config parameter(s)`,TRACK_SWITCH_MODE_ALWAYS_REPLACE:`alwaysReplace`,TRACK_SWITCH_MODE_NEVER_REPLACE:`neverReplace`,TRACK_SELECTION_MODE_FIRST_TRACK:`firstTrack`,TRACK_SELECTION_MODE_HIGHEST_BITRATE:`highestBitrate`,TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:`highestEfficiency`,TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY:`lowestStartupDelay`,TRACK_SELECTION_MODE_WIDEST_RANGE:`widestRange`,CMCD_QUERY_KEY:`CMCD`,CMCD_MODE_QUERY:`query`,CMCD_MODE_HEADER:`header`,CMCD_AVAILABLE_KEYS:[`br`,`d`,`ot`,`tb`,`bl`,`dl`,`mtp`,`nor`,`nrr`,`su`,`bs`,`rtp`,`cid`,`pr`,`sf`,`sid`,`st`,`v`],CMCD_V2_AVAILABLE_KEYS:[`msd`,`ltc`],CMCD_AVAILABLE_REQUESTS:[`segment`,`mpd`,`xlink`,`steering`,`other`],INITIALIZE:`initialize`,TEXT_SHOWING:`showing`,TEXT_HIDDEN:`hidden`,TEXT_DISABLED:`disabled`,ACCESSIBILITY_CEA608_SCHEME:`urn:scte:dash:cc:cea-608:2015`,CC1:`CC1`,CC3:`CC3`,UTF8:`utf-8`,SCHEME_ID_URI:`schemeIdUri`,START_TIME:`starttime`,SERVICE_DESCRIPTION_DVB_LL_SCHEME:`urn:dvb:dash:lowlatency:scope:2019`,SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME:`urn:dvb:dash:lowlatency:critical:2019`,CTA_5004_2023_SCHEME:`urn:mpeg:dash:cta-5004:2023`,THUMBNAILS_SCHEME_ID_URIS:[`http://dashif.org/thumbnail_tile`,`http://dashif.org/guidelines/thumbnail_tile`],FONT_DOWNLOAD_DVB_SCHEME:`urn:dvb:dash:fontdownload:2014`,COLOUR_PRIMARIES_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:ColourPrimaries`,URL_QUERY_INFO_SCHEME:`urn:mpeg:dash:urlparam:2014`,EXT_URL_QUERY_INFO_SCHEME:`urn:mpeg:dash:urlparam:2016`,MATRIX_COEFFICIENTS_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:MatrixCoefficients`,TRANSFER_CHARACTERISTICS_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:TransferCharacteristics`,SEGMENT_SEQUENCE_REPRESENTATION_SCHEME_ID_URI:`urn:mpeg:dash:ssr:2023`,HDR_METADATA_FORMAT_SCHEME_ID_URI:`urn:dvb:dash:hdr-dmi`,HDR_METADATA_FORMAT_VALUES:{ST2094_10:`ST2094-10`,SL_HDR2:`SL-HDR2`,ST2094_40:`ST2094-40`},MEDIA_CAPABILITIES_API:{COLORGAMUT:{SRGB:`srgb`,P3:`p3`,REC2020:`rec2020`},TRANSFERFUNCTION:{SRGB:`srgb`,PQ:`pq`,HLG:`hlg`},HDR_METADATATYPE:{SMPTE_ST_2094_10:`smpteSt2094-10`,SLHDR2:`slhdr2`,SMPTE_ST_2094_40:`smpteSt2094-40`}},XML:`XML`,ARRAY_BUFFER:`ArrayBuffer`,DVB_REPORTING_URL:`dvb:reportingUrl`,DVB_PROBABILITY:`dvb:probability`,OFF_MIMETYPE:`application/font-sfnt`,WOFF_MIMETYPE:`application/font-woff`,VIDEO_ELEMENT_READY_STATES:{HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},FILE_LOADER_TYPES:{FETCH:`fetch_loader`,XHR:`xhr_loader`},THROUGHPUT_TYPES:{LATENCY:`throughput_type_latency`,BANDWIDTH:`throughput_type_bandwidth`},THROUGHPUT_CALCULATION_MODES:{EWMA:`throughputCalculationModeEwma`,ZLEMA:`throughputCalculationModeZlema`,ARITHMETIC_MEAN:`throughputCalculationModeArithmeticMean`,BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:`throughputCalculationModeByteSizeWeightedArithmeticMean`,DATE_WEIGHTED_ARITHMETIC_MEAN:`throughputCalculationModeDateWeightedArithmeticMean`,HARMONIC_MEAN:`throughputCalculationModeHarmonicMean`,BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:`throughputCalculationModeByteSizeWeightedHarmonicMean`,DATE_WEIGHTED_HARMONIC_MEAN:`throughputCalculationModeDateWeightedHarmonicMean`},LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE:{MOOF_PARSING:`lowLatencyDownloadTimeCalculationModeMoofParsing`,DOWNLOADED_DATA:`lowLatencyDownloadTimeCalculationModeDownloadedData`,AAST:`lowLatencyDownloadTimeCalculationModeAast`},RULES_TYPES:{QUALITY_SWITCH_RULES:`qualitySwitchRules`,ABANDON_FRAGMENT_RULES:`abandonFragmentRules`},QUALITY_SWITCH_RULES:{BOLA_RULE:`BolaRule`,THROUGHPUT_RULE:`ThroughputRule`,INSUFFICIENT_BUFFER_RULE:`InsufficientBufferRule`,SWITCH_HISTORY_RULE:`SwitchHistoryRule`,DROPPED_FRAMES_RULE:`DroppedFramesRule`,LEARN_TO_ADAPT_RULE:`L2ARule`,LOL_PLUS_RULE:`LoLPRule`},ABANDON_FRAGMENT_RULES:{ABANDON_REQUEST_RULE:`AbandonRequestsRule`},ID3_SCHEME_ID_URI:`https://aomedia.org/emsg/ID3`,COMMON_ACCESS_TOKEN_HEADER:`common-access-token`,DASH_ROLE_SCHEME_ID:`urn:mpeg:dash:role:2011`,CODEC_FAMILIES:{MP3:`mp3`,AAC:`aac`,AC3:`ac3`,EC3:`ec3`,DTSX:`dtsx`,DTSC:`dtsc`,AVC:`avc`,HEVC:`hevc`}}},2861:function(e,t,n){n.r(t),t.default={CLEARKEY_KEYSTEM_STRING:`org.w3.clearkey`,WIDEVINE_KEYSTEM_STRING:`com.widevine.alpha`,PLAYREADY_KEYSTEM_STRING:`com.microsoft.playready`,PLAYREADY_RECOMMENDATION_KEYSTEM_STRING:`com.microsoft.playready.recommendation`,WIDEVINE_UUID:`edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`,PLAYREADY_UUID:`9a04f079-9840-4286-ab92-e65be0885f95`,CLEARKEY_UUID:`e2719d58-a985-b3c9-781a-b030af78d30e`,W3C_CLEARKEY_UUID:`1077efec-c0b2-4d02-ace3-3c1e52e2fb4b`,INITIALIZATION_DATA_TYPE_CENC:`cenc`,INITIALIZATION_DATA_TYPE_KEYIDS:`keyids`,INITIALIZATION_DATA_TYPE_WEBM:`webm`,ENCRYPTION_SCHEME_CENC:`cenc`,ENCRYPTION_SCHEME_CBCS:`cbcs`,MEDIA_KEY_MESSAGE_TYPES:{LICENSE_REQUEST:`license-request`,LICENSE_RENEWAL:`license-renewal`,LICENSE_RELEASE:`license-release`,INDIVIDUALIZATION_REQUEST:`individualization-request`},ROBUSTNESS_STRINGS:{WIDEVINE:{SW_SECURE_CRYPTO:`SW_SECURE_CRYPTO`,SW_SECURE_DECODE:`SW_SECURE_DECODE`,HW_SECURE_CRYPTO:`HW_SECURE_CRYPTO`,HW_SECURE_DECODE:`HW_SECURE_DECODE`,HW_SECURE_ALL:`HW_SECURE_ALL`}},MEDIA_KEY_STATUSES:{USABLE:`usable`,EXPIRED:`expired`,RELEASED:`released`,OUTPUT_RESTRICTED:`output-restricted`,OUTPUT_DOWNSCALED:`output-downscaled`,STATUS_PENDING:`status-pending`,INTERNAL_ERROR:`internal-error`}}},4469:function(e,t,n){n.r(t),n.d(t,{default:function(){return te}});class r{constructor(){this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null}}r.SSL_CONNECTION_FAILED_PREFIX=`SSL`,r.DNS_RESOLUTION_FAILED=`C00`,r.HOST_UNREACHABLE=`C01`,r.CONNECTION_REFUSED=`C02`,r.CONNECTION_ERROR=`C03`,r.CORRUPT_MEDIA_ISOBMFF=`M00`,r.CORRUPT_MEDIA_OTHER=`M01`,r.BASE_URL_CHANGED=`F00`,r.BECAME_REPORTER=`S00`;var i=r,o=n(913),c=n(138);function l(e){let t,n,r=(e||={}).eventBus,c=e.dashMetrics,l=e.metricsConstants,u=e.events;function d(e){let t=new i;if(n){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.mpdurl||=n.originalUrl||n.url,t.terror||=new Date,c.addDVBErrors(t)}}function f(e){e.error||(n=e.manifest)}function p(e){d({errorcode:i.BASE_URL_CHANGED,servicelocation:e.entry})}function m(){d({errorcode:i.BECAME_REPORTER})}function h(e){var t;e.metric===l.HTTP_REQUEST&&((t=e.value).responsecode===0||t.responsecode==null||t.responsecode>=400||t.responsecode<100||t.responsecode>=600)&&d({errorcode:t.responsecode||i.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}function g(e){let t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=i.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=i.CORRUPT_MEDIA_OTHER;break;default:return}d({errorcode:t})}return t={initialize:function(){r.on(u.MANIFEST_UPDATED,f,t),r.on(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,p,t),r.on(u.METRIC_ADDED,h,t),r.on(u.METRIC_UPDATED,h,t),r.on(u.PLAYBACK_ERROR,g,t),r.on(o.default.BECAME_REPORTING_PLAYER,m,t)},reset:function(){r.off(u.MANIFEST_UPDATED,f,t),r.off(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,p,t),r.off(u.METRIC_ADDED,h,t),r.off(u.METRIC_UPDATED,h,t),r.off(u.PLAYBACK_ERROR,g,t),r.off(o.default.BECAME_REPORTING_PLAYER,m,t)}},t}l.__dashjs_factory_name=`DVBErrorsTranslator`;var u=c.default.getSingletonFactory(l),d=n(7377);function f(e){e||={};let t,n,r=!1,i=this.context,o=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((e=>{let t=e.starttime,r=t+e.duration;n.add(t,r)})),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){let e,t=n.length;if(!t)return!0;e=r?new Date().getTime()/1e3:o.currentTime;for(let r=0;r<t;r+=1){let t=n.start(r),i=n.end(r);if(t<=e&&e<i)return!0}return!1}},n=(0,d.default)(i).create(),t}f.__dashjs_factory_name=`RangeController`;var p=c.default.getClassFactory(f);function m(){return{serialise:function e(t){let n,r,i=[],o=[];for(n in t)if(t.hasOwnProperty(n)&&n.indexOf(`_`)!==0){if(r=t[n],r??=``,Array.isArray(r)){if(!r.length)continue;o=[],r.forEach((function(t){let n=Object.prototype.toString.call(t).slice(8,-1)!==`Object`;o.push(n?t:e(t))})),r=o.map(encodeURIComponent).join(`,`)}else typeof r==`string`?r=encodeURIComponent(r):r instanceof Date?r=r.toISOString():typeof r==`number`&&(r=Math.round(r));i.push(n+`=`+r)}return i.join(`&`)}}}m.__dashjs_factory_name=`MetricSerialiser`;var h=c.default.getSingletonFactory(m);function g(){let e,t,n,r=window.crypto||window.msCrypto,i=Uint32Array,o=2**(8*i.BYTES_PER_ELEMENT)-1;function c(){r&&(e||=new i(10),r.getRandomValues(e),t=0)}return n={random:function(n,i){let l;return n||=0,i||=1,r?(t===e.length&&c(),l=e[t]/o,t+=1):l=Math.random(),l*(i-n)+n}},c(),n}g.__dashjs_factory_name=`RNG`;var _=c.default.getSingletonFactory(g),v=n(1926);function y(e){let t;e||={};let n,r,i,o,c,l,u,d=this.context,f=[],p=e.metricsConstants;function m(){o=!1,c=!1,l=null,u=null}return t={report:function(e,t){Array.isArray(t)||(t=[t]),c&&u.isEnabled()&&t.forEach((function(t){let i=n.serialise(t);e!==p.DVB_ERRORS&&(i=`metricname=${e}&${i}`),i=`${l}?${i}`,function(e,t,n){let i=new XMLHttpRequest;i.withCredentials=r.getXHRWithCredentialsForType(p.HTTP_REQUEST_DVB_REPORTING_TYPE);let o=function(){let e=f.indexOf(i);e!==-1&&(f.splice(e,1),!(i.status>=200&&i.status<300)&&n&&n())};f.push(i);try{i.open(`GET`,e),i.onloadend=o,i.onerror=o,i.send()}catch{i.onerror()}}(i,0,(function(){c=!1}))}))},initialize:function(e,t){let n;if(u=t,l=e.dvbReportingUrl,!l)throw Error(`required parameter missing (dvb:reportingUrl)`);o||=(n=e.dvbProbability,n&&(n===1e3||n/1e3>=i.random())&&(c=!0),!0)},reset:function(){m()}},n=h(d).getInstance(),i=_(d).getInstance(),r=(0,v.default)(d).getInstance(),m(),t}y.__dashjs_factory_name=`DVBReporting`;var b=c.default.getClassFactory(y);function x(e){e||={};let t={"urn:dvb:dash:reporting:2014":b},n=this.context,r,i=e.debug?e.debug.getLogger(r):{},o=e.metricsConstants,c=e.mediaPlayerModel||{};return r={create:function(e,r){let l;try{l=t[e.schemeIdUri](n).create({metricsConstants:o,mediaPlayerModel:c}),l.initialize(e,r)}catch(t){l=null,i.error(`ReportingFactory: could not create Reporting with schemeIdUri ${e.schemeIdUri} (${t.message})`)}return l},register:function(e,n){t[e]=n},unregister:function(e){delete t[e]}},r}x.__dashjs_factory_name=`ReportingFactory`;var S=c.default.getSingletonFactory(x);function C(e){let t,n=[],r=S(this.context).getInstance(e);return t={initialize:function(e,t){e.some((e=>{let i=r.create(e,t);if(i)return n.push(i),!0}))},reset:function(){n.forEach((e=>e.reset())),n=[]},report:function(e,t){n.forEach((n=>n.report(e,t)))}},t}C.__dashjs_factory_name=`ReportingController`;var w=c.default.getClassFactory(C);function T(){return{reconstructFullMetricName:function(e,t,n){let r=e;return t&&(r+=`(`+t,n&&n.length&&(r+=`,`+n),r+=`)`),r},validateN:function(e){if(!e)throw Error(`missing n`);if(isNaN(e))throw Error(`n is NaN`);if(e<0)throw Error(`n must be positive`);return e}}}T.__dashjs_factory_name=`HandlerHelpers`;var E=c.default.getSingletonFactory(T);function D(e){let t,n,r,i,o,c;e||={};let l=this.context,u=E(l).getInstance(),d=[],f=e.metricsConstants;function p(){let e=function(){try{return Object.keys(d).map((e=>d[e])).reduce(((e,t)=>e.level<t.level?e:t))}catch{return}}();e&&c!==e.t&&(c=e.t,n.report(i,e))}return t={initialize:function(e,t,c){t&&(r=u.validateN(c),n=t,i=u.reconstructFullMetricName(e,c),o=setInterval(p,r))},reset:function(){clearInterval(o),o=null,r=0,n=null,c=null},handleNewMetric:function(e,t,n){e===f.BUFFER_LEVEL&&(d[n]=t)}},t}D.__dashjs_factory_name=`BufferLevelHandler`;var O=c.default.getClassFactory(D),k=c.default.getClassFactory((function(e){let t,n,r=(e||={}).eventBus,i=e.metricsConstants;function c(){r.off(o.default.METRICS_INITIALISATION_COMPLETE,c,this),r.trigger(o.default.BECAME_REPORTING_PLAYER)}return t={initialize:function(e,t){t&&(n=t,r.on(o.default.METRICS_INITIALISATION_COMPLETE,c,this))},reset:function(){n=null},handleNewMetric:function(e,t){e===i.DVB_ERRORS&&n&&n.report(e,t)}},t}));function A(e){let t,n,r,i,o,c;e||={};let l=[],u=E(this.context).getInstance(),d=e.metricsConstants;function f(){var e=l;e.length&&n&&n.report(o,e),l=[]}return t={initialize:function(e,t,l,d){t&&(r=u.validateN(l),n=t,d&&d.length&&(i=d),o=u.reconstructFullMetricName(e,l,d),c=setInterval(f,r))},reset:function(){clearInterval(c),c=null,r=null,i=null,l=[],n=null},handleNewMetric:function(e,t){e===d.HTTP_REQUEST&&(i&&i!==t.type||l.push(t))}},t}A.__dashjs_factory_name=`HttpListHandler`;var j=c.default.getClassFactory(A);function M(){let e,t,n;return e={initialize:function(e,r){t=e,n=r},reset:function(){n=null,t=void 0},handleNewMetric:function(e,r){e===t&&n&&n.report(t,r)}},e}M.__dashjs_factory_name=`GenericMetricHandler`;var N=c.default.getClassFactory(M);function P(e){let t,n=(e||={}).debug?e.debug.getLogger(t):{},r=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/,i=this.context,o={BufferLevel:O,DVBErrors:k,HttpList:j,PlayList:N,RepSwitchList:N,TcpList:N};return t={create:function(t,c){var l,u=t.match(r);if(u){try{(l=o[u[1]](i).create({eventBus:e.eventBus,metricsConstants:e.metricsConstants})).initialize(u[1],c,u[3],u[5])}catch(e){l=null,n.error(`MetricsHandlerFactory: Could not create handler for type ${u[1]} with args ${u[3]}, ${u[5]} (${e.message})`)}return l}},register:function(e,t){o[e]=t},unregister:function(e){delete o[e]}},t}P.__dashjs_factory_name=`MetricsHandlerFactory`;var F=c.default.getSingletonFactory(P);function I(e){e||={};let t,n=[],r=this.context,i=e.eventBus,o=e.events,c=F(r).getInstance({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants});function l(e){n.forEach((t=>{t.handleNewMetric(e.metric,e.value,e.mediaType)}))}return t={initialize:function(e,r){e.split(`,`).forEach(((e,t,i)=>{let o;if(e.indexOf(`(`)!==-1&&e.indexOf(`)`)===-1){let n=i[t+1];n&&n.indexOf(`(`)===-1&&n.indexOf(`)`)!==-1&&(e+=`,`+n,delete i[t+1])}o=c.create(e,r),o&&n.push(o)})),i.on(o.METRIC_ADDED,l,t),i.on(o.METRIC_UPDATED,l,t)},reset:function(){i.off(o.METRIC_ADDED,l,t),i.off(o.METRIC_UPDATED,l,t),n.forEach((e=>e.reset())),n=[]}},t}I.__dashjs_factory_name=`MetricsHandlersController`;var L=c.default.getClassFactory(I);function R(e){let t,n,r,i;e||={};let o=this.context;function c(){t&&t.reset(),n&&n.reset(),r&&r.reset()}return i={initialize:function(i){try{r=p(o).create({mediaElement:e.mediaElement}),r.initialize(i.Range),n=w(o).create({debug:e.debug,metricsConstants:e.metricsConstants,mediaPlayerModel:e.mediaPlayerModel}),n.initialize(i.Reporting,r),t=L(o).create({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants,events:e.events}),t.initialize(i.metrics,n)}catch(e){throw c(),e}},reset:c},i}R.__dashjs_factory_name=`MetricsController`;var z=c.default.getClassFactory(R),B=class{constructor(){this.metrics=``,this.Range=[],this.Reporting=[]}},V=class{constructor(){this.starttime=0,this.duration=1/0,this._useWallClockTime=!1}},H=class{constructor(){this.schemeIdUri=``,this.value=``,this.dvbReportingUrl=``,this.dvbProbability=1e3}};function U(e){let t,n=(e||={}).adapter,r=e.constants;return t={getMetrics:function(e){let t=[];return e&&e.Metrics&&e.Metrics.forEach((i=>{var o=new B,c=n.getIsDynamic(e);i.hasOwnProperty(`metrics`)&&(o.metrics=i.metrics,i.Range&&i.Range.forEach((t=>{var i=new V;i.starttime=function(e,t,i){let o,c,l=0;return t?l=n.getAvailabilityStartTime(e)/1e3:(o=n.getRegularPeriods(e),o.length&&(l=o[0].start)),c=l,i&&i.hasOwnProperty(r.START_TIME)&&(c+=i.starttime),c}(e,c,t),t.hasOwnProperty(`duration`)?i.duration=t.duration:i.duration=n.getDuration(e),i._useWallClockTime=c,o.Range.push(i)})),i.Reporting&&(i.Reporting.forEach((e=>{var t=new H;e.hasOwnProperty(r.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty(`value`)&&(t.value=e.value),e.hasOwnProperty(r.DVB_REPORTING_URL)&&(t.dvbReportingUrl=e[r.DVB_REPORTING_URL]),e.hasOwnProperty(r.DVB_PROBABILITY)&&(t.dvbProbability=e[r.DVB_PROBABILITY]),o.Reporting.push(t))})),t.push(o)))})),t}},t}U.__dashjs_factory_name=`ManifestParsing`;var W=c.default.getSingletonFactory(U);function G(e){let t;e||={};let n={},r=this.context,i=e.eventBus,c=e.events;function l(t){if(t.error)return;let c=Object.keys(n);W(r).getInstance({adapter:e.adapter,constants:e.constants}).getMetrics(t.manifest).forEach((t=>{let i=JSON.stringify(t);if(n.hasOwnProperty(i))c.splice(i,1);else try{let o=z(r).create(e);o.initialize(t),n[i]=o}catch{}})),c.forEach((e=>{n[e].reset(),delete n[e]})),i.trigger(o.default.METRICS_INITIALISATION_COMPLETE)}function u(){Object.keys(n).forEach((e=>{n[e].reset()})),n={}}return t={reset:function(){i.off(c.MANIFEST_UPDATED,l,t),i.off(c.STREAM_TEARDOWN_COMPLETE,u,t)}},i.on(c.MANIFEST_UPDATED,l,t),i.on(c.STREAM_TEARDOWN_COMPLETE,u,t),t}G.__dashjs_factory_name=`MetricsCollectionController`;var K=c.default.getClassFactory(G);function ee(){let e,t,n=this.context;return e={createMetricsReporting:function(e){return t=u(n).getInstance({eventBus:e.eventBus,dashMetrics:e.dashMetrics,metricsConstants:e.metricsConstants,events:e.events}),t.initialize(),K(n).create(e)},getReportingFactory:function(){return S(n).getInstance()},getMetricsHandlerFactory:function(){return F(n).getInstance()}},e}ee.__dashjs_factory_name=`MetricsReporting`;let q=c.default.getClassFactory(ee);q.events=o.default,c.default.updateClassFactory(ee.__dashjs_factory_name,q);var te=q},913:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.METRICS_INITIALISATION_COMPLETE=`internal_metricsReportingInitialized`,this.BECAME_REPORTING_PLAYER=`internal_becameReportingPlayer`,this.CMCD_DATA_GENERATED=`cmcdDataGenerated`}}t.default=new i},1926:function(e,t,n){n.r(t);var r=n(5717),i=n(138),o=n(8261),c=n(656),l=n(5212),u=n(5560);function d(){let e,t,n,i,d,f,p,m,h,g,_,v=this.context,y=(0,o.default)(v).getInstance();function b(){i=[],d=[],f=[],p=[],m=[],_=[],h=null,t=[],g=new Set}function x(e,t){let n=-1;e.some(((e,r)=>{if(e===t)return n=r,!0})),n<0||e.splice(n,1)}function S(e){let t;for(t=0;t<_.length;t++)if(_[t].rulename===e)return t;return-1}function C(e,t){let n=!1;return g.forEach((r=>{r[e]===t&&(n=!0)})),n}function w(e,n){T(e,n);let i=new r.default;i.schemeIdUri=e,i.value=n,t.push(i)}function T(e,n){(0,c.checkParameterType)(e,`string`),(0,c.checkParameterType)(n,`string`),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={addAbrCustomRule:function(e,t,n){if(typeof e!=`string`||e!==l.default.RULES_TYPES.ABANDON_FRAGMENT_RULES&&e!==l.default.RULES_TYPES.QUALITY_SWITCH_RULES||typeof t!=`string`)throw l.default.BAD_ARGUMENT_ERROR;let r=S(t);r===-1?_.push({type:e,rulename:t,rule:n}):(_[r].type=e,_[r].rule=n)},addExternalSubtitle:function(e){if(!(e&&e.id!==void 0&&e.url&&e.language&&e.mimeType&&e.bandwidth!==void 0))return;let t=new u.default(e);C(`url`,t.url)||C(`id`,t.id)||g.add(t)},addRequestInterceptor:function(e){i.push(e)},addResponseInterceptor:function(e){d.push(e)},addUTCTimingSource:w,clearDefaultUTCTimingSources:function(){t=[]},getAbrCustomRules:function(){return _},getCustomCapabilitiesFilters:function(){return m},getCustomInitialTrackSelectionFunction:function(){return h},getExternalSubtitles:function(){return g},getLicenseRequestFilters:function(){return f},getLicenseResponseFilters:function(){return p},getRequestInterceptors:function(){return i},getResponseInterceptors:function(){return d},getUTCTimingSources:function(){return t},getXHRWithCredentialsForType:function(e){let t=n[e];return t===void 0?n.default:t},registerCustomCapabilitiesFilter:function(e){m.push(e)},registerLicenseRequestFilter:function(e){f.push(e)},registerLicenseResponseFilter:function(e){p.push(e)},removeAbrCustomRule:function(e){if(e){let t=S(e);t!==-1&&_.splice(t,1)}else _=[]},removeAllAbrCustomRule:function(){_=[]},removeExternalSubtitleById:function(e){g.forEach((t=>{t.id===e&&g.delete(t)}))},removeExternalSubtitleByUrl:function(e){g.forEach((t=>{t.url===e&&g.delete(t)}))},removeRequestInterceptor:function(e){x(i,e)},removeResponseInterceptor:function(e){x(d,e)},removeUTCTimingSource:T,reset:function(){b()},resetCustomInitialTrackSelectionFunction:function(){h=null},resetPlaybackSessionSpecificSettings:function(){g=new Set},restoreDefaultUTCTimingSources:function(){let e=y.get().streaming.utcSynchronization.defaultTimingSource;w(e.scheme,e.value)},setConfig:function(){},setCustomInitialTrackSelectionFunction:function(e){h=e},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach((t=>{e(t,r)}))},unregisterCustomCapabilitiesFilter:function(e){x(m,e)},unregisterLicenseRequestFilter:function(e){x(f,e)},unregisterLicenseResponseFilter:function(e){x(p,e)}},n={default:!1},b(),e}d.__dashjs_factory_name=`CustomParametersModel`,t.default=i.default.getSingletonFactory(d)},3888:function(e,t,n){n.r(t),n.d(t,{default:function(){return xe}});var r=n(8854),i=n(2861);let o={prefixes:[`clearkey`,`dashif`,`ck`]};class c{static findMp4ProtectionElement(e){let t=null;for(let n=0;n<e.length;++n){let o=e[n];o.schemeIdUri&&o.schemeIdUri.toLowerCase()===r.default.MP4_PROTECTION_SCHEME&&o.value&&(o.value.toLowerCase()===i.default.ENCRYPTION_SCHEME_CENC||o.value.toLowerCase()===i.default.ENCRYPTION_SCHEME_CBCS)&&(t=o)}return t}static getPSSHData(e){let t=8,n=new DataView(e),r=n.getUint8(t);return t+=20,r>0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}static getPSSHForKeySystem(e,t){let n=c.parsePSSHList(t);return e&&n.hasOwnProperty(e.uuid.toLowerCase())?n[e.uuid.toLowerCase()]:null}static parseInitDataFromContentProtection(e,t){return`pssh`in e&&e.pssh?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,``).replace(/\s+/g,``),t.decodeArray(e.pssh.__text).buffer):null}static parsePSSHList(e){if(e==null)return[];let t=new DataView(e.buffer||e),n={},r=0;for(;;){let e,i,o,c,l,u,d=r;if(r>=t.buffer.byteLength)break;if(e=t.getUint32(r),i=r+e,r+=4,t.getUint32(r)===1886614376)if(r+=4,o=t.getUint8(r),o===0||o===1){for(r++,r+=3,c=``,l=0;l<4;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=4,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<6;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;r+=6,c=c.toLowerCase(),r+=4,n[c]=t.buffer.slice(d,i),r=i}else r=i;else r=i}return n}static getLicenseServerUrlFromMediaInfo(e,t){try{if(!e||e.length===0)return null;let n=0,r=null;for(;n<e.length&&!r;){let i=e[n];if(i&&i.contentProtection&&i.contentProtection.length>0){let e=i.contentProtection.filter((e=>e.schemeIdUri&&e.schemeIdUri===t));if(e&&e.length>0){let t=0;for(;t<e.length&&!r;){let n=e[t];n.laUrl&&n.laUrl.__prefix&&o.prefixes.includes(n.laUrl.__prefix)&&n.laUrl.__text&&(r=n.laUrl.__text),t+=1}}}n+=1}return r}catch{return null}}static hexKidToBufferSource(e){let t=e.replace(/-/g,``);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer}}var l=c,u=class{constructor(e,t){this.contentType=e,this.robustness=t}},d=class{constructor(e,t,n,r,o,c){this.initDataTypes=c&&c.length>0?c:[i.default.INITIALIZATION_DATA_TYPE_CENC],e&&e.length&&(this.audioCapabilities=e),t&&t.length&&(this.videoCapabilities=t),this.distinctiveIdentifier=n,this.persistentState=r,this.sessionTypes=o}},f=n(1923),p=n(1944),m=class{constructor(e,t,n,r,i,o,c,l){this.url=e,this.method=t,this.responseType=n,this.headers=r,this.withCredentials=i,this.messageType=o,this.sessionId=c,this.data=l}},h=class{constructor(e,t,n){this.url=e,this.headers=t,this.data=n}},g=n(7568),_=n(7263),v=n(5212),y=n(138);function b(e){let t=(e||={}).BASE64,n=e.cmcdModel,r=e.constants,o=e.customParametersModel,c=e.debug,y=e.eventBus,b=e.events,x=e.protectionKeyController,S=e.settings,C,w,T,E,D,O,k,A,j,M,N,P,F=e.protectionModel,I=[];function L(){if(!(y&&y.hasOwnProperty(`on`)&&x&&x.hasOwnProperty(`getSupportedKeySystemMetadataFromContentProtection`)))throw Error(`Missing config parameter(s)`)}function R(e,n){N||E?N&&z():function(e,n){if(E)return;var r;E=!0;let i=function(e){let t=[];for(let n=0;n<e.length;n++){let r=B(e[n]);t.push({ks:e[n].ks,configs:[r],protData:e[n].protData})}return t}(e=(r=e).sort(((e,t)=>(C&&C[e.ks.systemString]&&C[e.ks.systemString].priority>=0?C[e.ks.systemString].priority:r.length)-(C&&C[t.ks.systemString]&&C[t.ks.systemString].priority>=0?C[t.ks.systemString].priority:r.length)))),o;F.requestKeySystemAccess(i).then((e=>(o=e.data,function(e){let t=e&&e.selectedSystemString?e.selectedSystemString:e.keySystem.systemString;return k.info(`DRM: KeySystem Access Granted for system string (`+t+`)! Selecting key system...`),F.selectKeySystem(e)}(o)))).then((e=>{(function(e,n){try{N=e,E=!1,y.trigger(b.KEY_SYSTEM_SELECTED,{data:n});let r=U(N);r&&r.serverCertificate&&r.serverCertificate.length>0&&F.setServerCertificate(t.decodeArray(r.serverCertificate).buffer),z()}catch(e){k.error(e)}})(e,o)})).catch((e=>{(function(e,t){N=null,E=!1,t||y.trigger(b.KEY_SYSTEM_SELECTED,{data:null,error:new p.default(f.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,f.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+`Error selecting key system! -- `+e.error)})})(e,n)}))}(e,n)}function z(){let e;for(let n=0;n<j.length;n++)for(e=0;e<j[n].length;e++)if(N===j[n][e].ks){t=j[n][e],x.isClearKey(N)&&function(e){if(e.protData&&e.protData.hasOwnProperty(`clearkeys`)&&Object.keys(e.protData.clearkeys).length!==0){let t={kids:Object.keys(e.protData.clearkeys)};e.initData=new TextEncoder().encode(JSON.stringify(t))}}(t),t.sessionId?V(t):t.initData!==null&&H(t);break}var t;j=[]}function B(e){let t=e.protData,n=[],o=[],c=t&&t.initDataTypes&&t.initDataTypes.length>0?t.initDataTypes:[i.default.INITIALIZATION_DATA_TYPE_CENC],l=t&&t.audioRobustness&&t.audioRobustness.length>0?t.audioRobustness:M,f=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:M,p=e.sessionType,m=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:`optional`,h=t&&t.persistentState?t.persistentState:p===`temporary`?`optional`:`required`;return A.forEach((e=>{e.type===r.AUDIO?n.push(new u(e.codec,l)):e.type===r.VIDEO&&o.push(new u(e.codec,f))})),new d(n,o,m,h,[p],c)}function V(e){L(),F.loadKeySession(e)}function H(e){if(e&&function(e){if(!e)return!1;try{let t=F.getSessionTokens();for(let n=0;n<t.length;n++)if(t[n].getKeyId()===e)return!0;return!1}catch{return!1}}(e.keyId))return;(function(){if(!S)return;let e=S.get().streaming.protection.keepProtectionMediaKeys,t=S.get().streaming.protection.keepProtectionMediaKeysMaximumOpenSessions;if(typeof t!=`number`||t<=0)return;if(!e)return void k.warn(`DRM: keepProtectionMediaKeysMaximumOpenSessions is set to `+t+`, but keepProtectionMediaKeys is not enabled. Therefore, keepProtectionMediaKeysMaximumOpenSessions will be ignored.`);if(!F||typeof F.getSessionTokens!=`function`)return;let n=F.getSessionTokens()||[];if(n.length<t)return;let r=n[0];r&&(k.info(`DRM: Maximum number of open MediaKeySessions reached (`+t+`), closing oldest session.`),G(r))})();let t=l.getPSSHForKeySystem(N,e?e.initData:null);if(t){if(W(t))return;try{e.initData=t,F.createKeySession(e)}catch(e){y.trigger(b.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e&&e.initData?F.createKeySession(e):y.trigger(b.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Selected key system is `+(N?N.systemString:null)+`. needkey/encrypted event contains no initData corresponding to that key system!`)})}function U(e){if(e){let t=e.systemString;if(C)return t in C?C[t]:null}return null}function W(e){if(!e)return!1;try{let t=F.getAllInitData();for(let n=0;n<t.length;n++)if(x.initDataEquals(e,t[n]))return k.debug(`DRM: Ignoring initData because we have already seen it!`),!0;return!1}catch{return!1}}function G(e){L(),F.closeKeySession(e)}function K(e){L(),e?(F.setMediaElement(e),y.on(b.NEED_KEY,ae,w)):e===null&&(F.setMediaElement(e),y.off(b.NEED_KEY,ae,w))}function ee(e){k.debug(`DRM: onKeyMessage`);let t=e.data;y.trigger(b.KEY_MESSAGE,{data:t});let n=t.messageType?t.messageType:i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,r=t.message,c=t.sessionToken,u=U(N),d=x.getLicenseServerModelInstance(N,u,n),v={sessionToken:c,messageType:n};if(r&&r.byteLength!==0){if(!d)return k.debug(`DRM: License server request not required for this message (type = `+e.data.messageType+`). Session ID = `+c.getSessionId()),void q(v);if(x.isClearKey(N)){let e=x.processClearKeyLicenseRequest(N,u,r);if(e&&e.keyPairs&&e.keyPairs.length>0)return k.debug(`DRM: ClearKey license request handled by application!`),q(v),void F.updateKeySession(c,e)}(function(e,t,n){let r=e.sessionToken,c=e.messageType?e.messageType:i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,u={sessionToken:r,messageType:c},d=N?N.systemString:null,v=function(e,t,n,r,i){let o=null,c=r.message;if(e&&e.serverURL){let n=e.serverURL;typeof n==`string`&&n!==``?o=n:typeof n==`object`&&n.hasOwnProperty(t)&&(o=n[t])}else if(e&&e.laURL&&e.laURL!==``)o=e.laURL;else if(o=l.getLicenseServerUrlFromMediaInfo(A,N.schemeIdURI),!o&&!x.isClearKey(N)){let e=l.getPSSHData(n.initData);o=N.getLicenseServerURLFromInitData(e),o||=r.laURL}return o=i.getServerURLFromMessage(o,c,t),o}(n,c,r,e,t);if(!v)return void q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));let y={},b=!1;n&&re(y,n.httpRequestHeaders);let C=e.message;re(y,N.getRequestHeadersFromMessage(C)),Object.keys(y).forEach((e=>{e.toLowerCase()===`authorization`&&(b=!0)})),n&&typeof n.withCredentials==`boolean`&&(b=n.withCredentials);let w=function(e){if(F)if(e.status>=200&&e.status<=299){let n=_.default.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),i=new h(e.responseURL,n,e.response);J(o.getLicenseResponseFilters(),i).then((()=>{let n=t.getLicenseMessage(i.data,d,c);n===null?ie(e,u,d,c,t):(q(u),F.updateKeySession(r,n))}))}else ie(e,u,d,c,t)},T=function(e){q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+d+` update, XHR aborted. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState))},E=function(e){q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+d+` update, XHR error. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState))},D=N.getLicenseRequestFromMessage(C),O=t.getHTTPMethod(c),k=t.getResponseType(d,c),j=n&&!isNaN(n.httpTimeout)?n.httpTimeout:8e3,M=r.getSessionId()||null,P=new m(v,O,k,y,b,c,M,D),I=isNaN(S.get().streaming.retryAttempts[g.HTTPRequest.LICENSE])?3:S.get().streaming.retryAttempts[g.HTTPRequest.LICENSE];J(o.getLicenseRequestFilters(),P).then((()=>{te(P,I,j,w,T,E)}))})(t,d,u)}else q(v,new p.default(f.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function q(e,t=null){y.trigger(b.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function te(e,t,r,i,o,c){let l=new XMLHttpRequest,u=n.getCmcdParametersFromManifest();if(n.isCmcdEnabled()&&(u.mode?u.mode:S.get().streaming.cmcd.mode)===v.default.CMCD_MODE_QUERY){let t=n.getQueryParameter({url:e.url,type:g.HTTPRequest.LICENSE});t&&(e.url=_.default.addAdditionalQueryParameterToUrl(e.url,[t]))}l.open(e.method,e.url,!0),l.responseType=e.responseType,l.withCredentials=e.withCredentials,r>0&&(l.timeout=r);for(let t in e.headers)l.setRequestHeader(t,e.headers[t]);if(n.isCmcdEnabled()&&(u.mode?u.mode:S.get().streaming.cmcd.mode)===v.default.CMCD_MODE_HEADER){let t=n.getHeaderParameters({url:e.url,type:g.HTTPRequest.LICENSE});if(t)for(let e in t){let n=t[e];n&&l.setRequestHeader(e,n)}}let d=function(){t--;let n=isNaN(S.get().streaming.retryIntervals[g.HTTPRequest.LICENSE])?1e3:S.get().streaming.retryIntervals[g.HTTPRequest.LICENSE];D=setTimeout((function(){te(e,t,r,i,o,c)}),n)};l.onload=function(){O=null,this.status>=200&&this.status<=299||t<=0?i(this):(k.warn(`License request failed (`+this.status+`). Retrying it... Pending retries: `+t),d())},l.ontimeout=l.onerror=function(){O=null,t<=0?c(this):(k.warn(`License request network request failed . Retrying it... Pending retries: `+t),d())},l.onabort=function(){o(this)},y.trigger(b.LICENSE_REQUEST_SENDING,{url:e.url,headers:e.headers,payload:e.data,sessionId:e.sessionId}),O=l,l.send(e.data)}function ne(){O&&=(O.onloadend=O.onerror=O.onprogress=void 0,O.abort(),null),D&&=(clearTimeout(D),null)}function re(e,t){if(t)for(let n in t)e[n]=t[n]}function ie(e,t,n,r,i){let o=`NONE`,c=null;e.response&&(o=i.getErrorResponse(e.response,n,r),c={serverResponse:e.response||null,responseCode:e.status||null,responseText:e.statusText||null}),q(t,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+` update, XHR complete. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState+`. Response is `+o,c))}function J(e,t){return e?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function ae(e,t){if(S.get().streaming.protection.ignoreEmeEncryptedEvent)return;if(k.debug(`DRM: onNeedKey`),e.key.initDataType!==i.default.INITIALIZATION_DATA_TYPE_CENC)return void k.warn(`DRM: Only 'cenc' initData is supported! Ignoring initData of type: `+e.key.initDataType);if(A.length===0&&(k.warn(`DRM: onNeedKey called before initializeForMedia, wait until initialized`),(t=t===void 0?1:t+1)<5))return void I.push(setTimeout((()=>{ae(e,t)}),500));let n=e.key.initData;if(ArrayBuffer.isView(n)&&(n=n.buffer),N){let e=l.getPSSHForKeySystem(N,n);if(e&&W(e))return}k.debug(`DRM: initData:`,String.fromCharCode.apply(null,new Uint8Array(n)));let r=x.getSupportedKeySystemMetadataFromSegmentPssh(n,C,P);r.length===0?k.debug(`DRM: Received needkey event with initData, but we don't support any of the key systems!`):function(e){j.push(e),R(e,!1)}(r)}function oe(e,t){if(e.size<=0)return!1;if(t.size>0&&[...e].every((e=>{let n=t.get(e);return n!==void 0&&n!==``})))return!0;let n=F.getSessionTokens();if(n&&n.length>0){let t=n.filter((t=>[...e].includes(t.normalizedKeyId)));if(t.some((e=>!e.hasTriggeredKeyStatusMapUpdate))||t.length===0)return!1}return!S.get().streaming.protection.ignoreKeyStatuses&&e&&e.size>0&&t&&t.size>0}return w={areKeyIdsExpired:function(e){try{return!!oe(e,T)&&[...e].every((e=>T.get(e)===i.default.MEDIA_KEY_STATUSES.EXPIRED))}catch(e){return k.error(e),!1}},areKeyIdsUsable:function(e){try{return!oe(e,T)||[...e].some((e=>{let t=T.get(e);return t&&t!==i.default.MEDIA_KEY_STATUSES.INTERNAL_ERROR&&t!==i.default.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED}))}catch(e){return k.error(e),!0}},clearMediaInfoArray:function(){A=[]},closeKeySession:G,createKeySession:H,getKeySystems:function(){return x?x.getKeySystems():[]},getSupportedKeySystemMetadataFromContentProtection:function(e){return L(),x.getSupportedKeySystemMetadataFromContentProtection(e,C,P)},handleKeySystemFromManifest:function(){if(!A||A.length===0)return;let e=[];A.forEach((t=>{let n=x.getSupportedKeySystemMetadataFromContentProtection(t.contentProtection,C,P);n.length>0&&(e.length===0&&(e=n),j.push(n))})),e&&e.length>0&&R(e,!0)},initializeForMedia:function(e){if(!e)throw Error(`mediaInfo can not be null or undefined`);L(),A.push(e)},loadKeySession:V,removeKeySession:function(e){L(),F.removeKeySession(e)},reset:function(){y.off(b.INTERNAL_KEY_MESSAGE,ee,w),L(),ne(),K(null),N=null,E=!1,T=new Map,F&&=(F.reset(),null),I.forEach((e=>clearTimeout(e))),I=[],A=[],j=[]},setKeySystems:function(e){x&&x.setKeySystems(e)},setMediaElement:K,setProtectionData:function(e){C=e,x.setProtectionData(e)},setRobustnessLevel:function(e){M=e},setServerCertificate:function(e){return L(),F.setServerCertificate(e)},setSessionType:function(e){P=e},stop:function(){ne(),F&&F.stop()},updateKeyStatusesMap:function(e){try{if(!e||!e.sessionToken||!e.parsedKeyStatuses)return;e.sessionToken.hasTriggeredKeyStatusMapUpdate=!0;let t=e.parsedKeyStatuses,n=_.default.parseUserAgent(),r=n&&n.browser&&n.browser.name&&n.browser.name.toLowerCase()===`edge`;t.forEach((e=>{r&&N.uuid===i.default.PLAYREADY_UUID&&e.keyId&&e.keyId.byteLength===16&&function(e){let t=_.default.bufferSourceToDataView(e),n=t.getUint32(0,!0),r=t.getUint16(4,!0),i=t.getUint16(6,!0);t.setUint32(0,n,!1),t.setUint16(4,r,!1),t.setUint16(6,i,!1)}(e.keyId);let t=_.default.bufferSourceToHex(e.keyId).slice(0,32);t&&t!==``&&T.set(t,e.status)})),y.trigger(b.KEY_STATUSES_MAP_UPDATED,{keyStatusMap:T})}catch(e){k.error(e)}}},k=c.getLogger(w),j=[],A=[],P=`temporary`,M=``,O=null,D=null,T=new Map,y.on(b.INTERNAL_KEY_MESSAGE,ee,w),w}b.__dashjs_factory_name=`ProtectionController`;var x=y.default.getClassFactory(b),S=class{constructor(e,t){this.keyID=e,this.key=t}},C=class{constructor(e,t){if(t&&t!==`persistent`&&t!==`temporary`)throw Error(`Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'`);this.keyPairs=e,this.type=t}toJWK(){let e,t=this.keyPairs.length,n={keys:[]};for(e=0;e<t;e++){let t={kty:`oct`,alg:`A128KW`,kid:this.keyPairs[e].keyID,k:this.keyPairs[e].key};n.keys.push(t)}this.type&&(n.type=this.type);let r=JSON.stringify(n),i=r.length,o=new ArrayBuffer(i),c=new Uint8Array(o);for(e=0;e<i;e++)c[e]=r.charCodeAt(e);return o}};let w=i.default.CLEARKEY_UUID,T=i.default.CLEARKEY_KEYSTEM_STRING,E=`urn:uuid:`+w;function D(e){let t,n=(e||={}).BASE64;return t={uuid:w,schemeIdURI:E,systemString:T,getInitData:function(e,t){try{let r=l.parseInitDataFromContentProtection(e,n);if(!r&&t){let e={kids:[function(e){try{let t=e.replace(/-/g,``);return t=btoa(t.match(/\w{2}/g).map((e=>String.fromCharCode(parseInt(e,16)))).join(``)),t.replace(/=/g,``).replace(/\//g,`_`).replace(/\+/g,`-`)}catch{return null}}(t.cencDefaultKid)]};r=new TextEncoder().encode(JSON.stringify(e))}return r}catch{return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":`application/json`}},getLicenseRequestFromMessage:function(e){return JSON.stringify(JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e))))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){let r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),i=[];for(let t=0;t<r.kids.length;t++){let n=r.kids[t],o=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!o)throw Error(`DRM: ClearKey keyID (`+n+`) is not known!`);i.push(new S(n,o))}n=new C(i)}return n}},t}D.__dashjs_factory_name=`KeySystemClearKey`;var O=y.default.getSingletonFactory(D);let k=i.default.W3C_CLEARKEY_UUID,A=i.default.CLEARKEY_KEYSTEM_STRING,j=`urn:uuid:`+k;function M(e){let t,n=e.BASE64,r=e.debug.getLogger(t);return t={uuid:k,schemeIdURI:j,systemString:A,getInitData:function(e){return l.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){let i=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),o=[];for(let t=0;t<i.kids.length;t++){let n=i.kids[t],r=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!r)throw Error(`DRM: ClearKey keyID (`+n+`) is not known!`);o.push(new S(n,r))}n=new C(o),r.warn(`ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4`)}return n}},t}M.__dashjs_factory_name=`KeySystemW3CClearKey`;var N=y.default.getSingletonFactory(M);let P=i.default.WIDEVINE_UUID,F=i.default.WIDEVINE_KEYSTEM_STRING,I=`urn:uuid:`+P;function L(e){let t,n=(e||={}).BASE64;return t={uuid:P,schemeIdURI:I,systemString:F,getInitData:function(e){return l.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null}},t}L.__dashjs_factory_name=`KeySystemWidevine`;var R=y.default.getSingletonFactory(L);let z=i.default.PLAYREADY_UUID,B=i.default.PLAYREADY_KEYSTEM_STRING,V=`urn:uuid:`+z;function H(e){let t,n=`utf-16`,r=(e||={}).BASE64,i=e.settings;function o(){if(!r||!r.hasOwnProperty(`decodeArray`)||!r.hasOwnProperty(`decodeArray`))throw Error(`Missing config parameter(s)`)}return t={uuid:z,schemeIdURI:V,systemString:B,getInitData:function(e){let t=new Uint8Array([112,115,115,104,0,0,0,0]),n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),i,c,u,d,f,p=0,m=null;if(o(),!e)return null;if(`pssh`in e&&e.pssh)return l.parseInitDataFromContentProtection(e,r);if(`pro`in e&&e.pro)m=r.decodeArray(e.pro.__text);else{if(!(`prheader`in e)||!e.prheader)return null;m=r.decodeArray(e.prheader.__text)}return i=m.length,c=4+t.length+n.length+4+i,u=new ArrayBuffer(c),d=new Uint8Array(u),f=new DataView(u),f.setUint32(p,c),p+=4,d.set(t,p),p+=t.length,d.set(n,p),p+=n.length,f.setUint32(p,i),p+=4,d.set(m,p),p+=i,d.buffer},getRequestHeadersFromMessage:function(e){let t,r,o={},c=new DOMParser;if(i&&i.get().streaming.protection.detectPlayreadyMessageFormat&&n===`utf-16`&&e&&e.byteLength%2==1)return o[`Content-Type`]=`text/xml; charset=utf-8`,o;let l=n===`utf-16`?new Uint16Array(e):new Uint8Array(e);t=String.fromCharCode.apply(null,l),r=c.parseFromString(t,`application/xml`);let u=r.getElementsByTagName(`name`),d=r.getElementsByTagName(`value`);for(let e=0;e<u.length;e++)o[u[e].childNodes[0].nodeValue]=d[e].childNodes[0].nodeValue;return o.hasOwnProperty(`Content`)&&(o[`Content-Type`]=o.Content,delete o.Content),o.hasOwnProperty(`Content-Type`)||(o[`Content-Type`]=`text/xml; charset=utf-8`),o},getLicenseRequestFromMessage:function(e){let t=null,c=new DOMParser;if(i&&i.get().streaming.protection.detectPlayreadyMessageFormat&&n===`utf-16`&&e&&e.byteLength%2==1)return e;let l=n===`utf-16`?new Uint16Array(e):new Uint8Array(e);o();let u=String.fromCharCode.apply(null,l),d=c.parseFromString(u,`application/xml`);if(!d.getElementsByTagName(`PlayReadyKeyMessage`)[0])return e;{let e=d.getElementsByTagName(`Challenge`)[0].childNodes[0].nodeValue;e&&(t=r.decode(e))}return t},getLicenseServerURLFromInitData:function(e){if(e){let t=new DataView(e),n=t.getUint16(4,!0),r=6,i=new DOMParser;for(let o=0;o<n;o++){let n=t.getUint16(r,!0);r+=2;let o=t.getUint16(r,!0);if(r+=2,n!==1){r+=o;continue}let c=e.slice(r,r+o),l=String.fromCharCode.apply(null,new Uint16Array(c)),u=i.parseFromString(l,`application/xml`);if(u.getElementsByTagName(`LA_URL`)[0]){let e=u.getElementsByTagName(`LA_URL`)[0].childNodes[0].nodeValue;if(e)return e}if(u.getElementsByTagName(`LUI_URL`)[0]){let e=u.getElementsByTagName(`LUI_URL`)[0].childNodes[0].nodeValue;if(e)return e}}}return null},getCDMData:function(e){let t,n,i,c;if(o(),!e)return null;for(t=[],c=0;c<e.length;++c)t.push(e.charCodeAt(c)),t.push(0);for(t=String.fromCharCode.apply(null,t),t=r.encode(t),n=`<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>`.replace(`%CUSTOMDATA%`,t),i=[],c=0;c<n.length;++c)i.push(n.charCodeAt(c)),i.push(0);return new Uint8Array(i).buffer},setPlayReadyMessageFormat:function(e){if(e!==`utf-8`&&e!==`utf-16`)throw Error(`Specified message format is not one of "utf-8" or "utf-16"`);n=e}},t}H.__dashjs_factory_name=`KeySystemPlayReady`;var U=y.default.getSingletonFactory(H);function W(e){let t=(e||={}).BASE64,n={},r;return n[i.default.WIDEVINE_KEYSTEM_STRING]={responseType:`json`,getLicenseMessage:function(e){return t.decodeArray(e.license)},getErrorResponse:function(e){return e}},n[i.default.PLAYREADY_KEYSTEM_STRING]={responseType:`arraybuffer`,getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},r={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(e){return n[e].responseType},getLicenseMessage:function(e,r){return function(){if(!t||!t.hasOwnProperty(`decodeArray`))throw Error(`Missing config parameter(s)`)}(),n[r].getLicenseMessage(e)},getErrorResponse:function(e,t){return n[t].getErrorResponse(e)}},r}W.__dashjs_factory_name=`DRMToday`;var G=y.default.getSingletonFactory(W);function K(){let e,t=`http://schemas.xmlsoap.org/soap/envelope/`;function n(e){let t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}function r(e){if(window.DOMParser){let r=n(e),i=new window.DOMParser().parseFromString(r,`text/xml`),o=i?i.getElementsByTagNameNS(t,`Envelope`)[0]:null,c=o?o.getElementsByTagNameNS(t,`Body`)[0]:null;if(c&&c.getElementsByTagNameNS(t,`Fault`)[0])return null}return e}function i(e){let r=``,i=``,o=``,c=-1,l=-1;if(window.DOMParser){let u=n(e),d=new window.DOMParser().parseFromString(u,`text/xml`),f=d?d.getElementsByTagNameNS(t,`Envelope`)[0]:null,p=f?f.getElementsByTagNameNS(t,`Body`)[0]:null,m=p?p.getElementsByTagNameNS(t,`Fault`)[0]:null,h=m?m.getElementsByTagName(`detail`)[0]:null,g=h?h.getElementsByTagName(`Exception`)[0]:null,_=null;if(m===null)return u;_=m.getElementsByTagName(`faultstring`)[0].firstChild,r=_?_.nodeValue:null,g!==null&&(_=g.getElementsByTagName(`StatusCode`)[0],i=_?_.firstChild.nodeValue:null,_=g.getElementsByTagName(`Message`)[0],o=_?_.firstChild.nodeValue:null,c=o?o.lastIndexOf(`[`)+1:-1,l=o?o.indexOf(`]`):-1,o=o?o.substring(c,l):``)}let u=`code: ${i}, name: ${r}`;return o&&(u+=`, message: ${o}`),u}return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`arraybuffer`},getLicenseMessage:function(e){return r.call(this,e)},getErrorResponse:function(e){return i.call(this,e)}},e}K.__dashjs_factory_name=`PlayReady`;var ee=y.default.getSingletonFactory(K);function q(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`arraybuffer`},getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}q.__dashjs_factory_name=`Widevine`;var te=y.default.getSingletonFactory(q);function ne(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`json`},getLicenseMessage:function(e){if(!e.hasOwnProperty(`keys`))return null;let t=[];for(let n=0;n<e.keys.length;n++){let r=e.keys[n],i=r.kid.replace(/=/g,``),o=r.k.replace(/=/g,``);t.push(new S(i,o))}return new C(t)},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}ne.__dashjs_factory_name=`ClearKey`;var re=y.default.getSingletonFactory(ne),ie=class{constructor(e){this.ks=e.ks,this.keyId=e.keyId,this.initData=e.initData,this.protData=e.protData,this.cdmData=e.cdmData,this.sessionId=e.sessionId,this.sessionType=e.sessionType}};function J(){let e,t,n,r,o,c,u,d,f=this.context;function p(e,t){return t&&e in t?t[e]:null}function m(e,t){return e&&e.sessionId?e.sessionId:t&&t.sessionId?t.sessionId:null}function h(e,t){return e&&e.sessionType?e.sessionType:t}return e={getKeySystemBySystemString:function(e){for(let t=0;t<r.length;t++)if(r[t].systemString===e)return r[t];return null},getKeySystems:function(){return r},getLicenseServerModelInstance:function(e,t,n){if(n===i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_RELEASE||n===i.default.MEDIA_KEY_MESSAGE_TYPES.INDIVIDUALIZATION_REQUEST)return null;let r=null;return t&&t.hasOwnProperty(`drmtoday`)?r=G(f).getInstance({BASE64:o}):e.systemString===i.default.WIDEVINE_KEYSTEM_STRING?r=te(f).getInstance():e.systemString===i.default.PLAYREADY_KEYSTEM_STRING?r=ee(f).getInstance():e.systemString===i.default.CLEARKEY_KEYSTEM_STRING&&(r=re(f).getInstance()),r},getSupportedKeySystemMetadataFromContentProtection:function(e,t,n){let i,o,c,u,d=[];if(!e||!e.length)return d;let f=l.findMp4ProtectionElement(e);for(c=0;c<r.length;c++){o=r[c];let l=p(o.systemString,t);for(u=0;u<e.length;u++)if(i=e[u],i.schemeIdUri.toLowerCase()===o.schemeIdURI){let e=o.getInitData(i,f),t=new ie({ks:r[c],keyId:i.keyId,initData:e,protData:l,cdmData:o.getCDMData(l?l.cdmData:null),sessionId:m(l,i),sessionType:h(l,n)});l?d.unshift(t):d.push(t)}}return d},getSupportedKeySystemMetadataFromSegmentPssh:function(e,t,n){let i,o,c=[],u=l.parsePSSHList(e);for(let e=0;e<r.length;++e){i=r[e],o=i.systemString;let l=p(o,t);i.uuid in u&&c.push({ks:i,initData:u[i.uuid],protData:l,cdmData:i.getCDMData(l?l.cdmData:null),sessionId:m(l),sessionType:h(l,n)})}return c},initDataEquals:function(e,t){if(e.byteLength===t.byteLength){let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}return!1},initialize:function(){let e;r=[],e=U(f).getInstance({BASE64:o,settings:c}),r.push(e),e=R(f).getInstance({BASE64:o}),r.push(e),e=O(f).getInstance({BASE64:o}),r.push(e),u=e,e=N(f).getInstance({BASE64:o,debug:t}),r.push(e),d=e},isClearKey:function(e){return e===u||e===d},processClearKeyLicenseRequest:function(e,t,r){try{return e.getClearKeysFromProtectionData(t,r)}catch{return n.error(`Failed to retrieve clearkeys from ProtectionData`),null}},setConfig:function(r){r&&(r.debug&&(t=r.debug,n=t.getLogger(e)),r.BASE64&&(o=r.BASE64),r.settings&&(c=r.settings))},setKeySystems:function(e){r=e},setProtectionData:function(e){for(var t,n,i=0;i<r.length;i++){var o=r[i];o.hasOwnProperty(`init`)&&o.init((t=o.systemString,n=void 0,n=null,e&&(n=t in e?e[t]:null),n))}}},e}J.__dashjs_factory_name=`ProtectionKeyController`;var ae=y.default.getSingletonFactory(J),oe=n(445),se=class{constructor(e,t){this.initData=e,this.initDataType=t}},ce=class{constructor(e,t,n,r){this.sessionToken=e,this.message=t,this.defaultURL=n,this.messageType=r||i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST}},le=class{constructor(e,t){this.keySystem=e,this.ksConfiguration=t,this.nativeMediaKeySystemAccessObject=null,this.selectedSystemString=null}};let ue={};function de(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c,l,u,d,m,h,g,_;function v(e,t,i,o){if(navigator.requestMediaKeySystemAccess===void 0||typeof navigator.requestMediaKeySystemAccess!=`function`){let e=`Insecure origins are not allowed`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),o({error:e});return}let c=e[t].protData&&e[t].protData.systemStringPriority?e[t].protData.systemStringPriority:null,l=e[t].configs,u=e[t].ks,d=u.systemString;(function(e,t){return new Promise(((n,r)=>{y(e,t,0,n,r)}))})(c||(ue[d]?ue[d]:[d]),l).then((e=>{let t=new le(u,e&&e.nativeMediaKeySystemAccessObject&&typeof e.nativeMediaKeySystemAccessObject.getConfiguration==`function`?e.nativeMediaKeySystemAccessObject.getConfiguration():null);t.selectedSystemString=e.selectedSystemString,t.nativeMediaKeySystemAccessObject=e.nativeMediaKeySystemAccessObject,n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:t}),i({data:t})})).catch((c=>{if(t+1<e.length)v(e,t+1,i,o);else{let e=`Key system access denied! `;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e+c.message}),o({error:e+c.message})}}))}function y(e,t,n,r,i){let o=e[n];l.debug(`Requesting key system access for system string ${o}`),navigator.requestMediaKeySystemAccess(o,t).then((e=>{r({nativeMediaKeySystemAccessObject:e,selectedSystemString:o})})).catch((o=>{n+1<e.length?y(e,t,n+1,r,i):i(o)}))}function b(e){if(!e||!e.session)return Promise.resolve;let t=e.session;return t.removeEventListener(`keystatuseschange`,e),t.removeEventListener(`message`,e),t.close()}function x(e){for(let t=0;t<h.length;t++)if(h[t]===e){h.splice(t,1);break}}function S(e,t){let o={session:e,keyId:t.keyId,normalizedKeyId:t&&t.keyId&&typeof t.keyId==`string`?t.keyId.replace(/-/g,``).toLowerCase():``,initData:t.initData,sessionId:t.sessionId,sessionType:t.sessionType,hasTriggeredKeyStatusMapUpdate:!1,handleEvent:function(e){switch(e.type){case`keystatuseschange`:this._onKeyStatusesChange(e);break;case`message`:this._onKeyMessage(e)}},_onKeyStatusesChange:function(e){n.trigger(r.KEY_STATUSES_CHANGED,{data:this});let t=[];e.target.keyStatuses.forEach((function(){t.push(C(arguments))})),n.trigger(r.INTERNAL_KEY_STATUSES_CHANGED,{parsedKeyStatuses:t,sessionToken:o})},_onKeyMessage:function(e){let t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,void 0,e.messageType)})},getKeyId:function(){return this.keyId},getSessionId:function(){return e.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){let t=!1;return e.keyStatuses.forEach((function(){C(arguments).status===i.default.MEDIA_KEY_STATUSES.USABLE&&(t=!0)})),t}};return e.addEventListener(`keystatuseschange`,o),e.addEventListener(`message`,o),e.closed.then((()=>{x(o),l.debug(`DRM: Session closed. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CLOSED,{data:o.getSessionId()})})),h.push(o),o}function C(e){let t,n;return e&&e.length>0&&(e[0]&&(typeof e[0]==`string`?t=e[0]:n=e[0]),e[1]&&(typeof e[1]==`string`?t=e[1]:n=e[1])),{status:t,keyId:n}}return c={closeKeySession:function(e){b(e).catch((function(t){x(e),n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:`Error closing session (`+e.getSessionId()+`) `+t.name})}))},createKeySession:function(e){if(!u||!m)throw Error(`Can not create sessions until you have selected a key system`);let t=m.createSession(e.sessionType),o=S(t,e),c=u.systemString===i.default.CLEARKEY_KEYSTEM_STRING&&(e.initData||e.protData&&e.protData.clearkeys)?i.default.INITIALIZATION_DATA_TYPE_KEYIDS:i.default.INITIALIZATION_DATA_TYPE_CENC;t.generateRequest(c,e.initData).then((function(){l.debug(`DRM: Session created. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:o})})).catch((function(e){x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Error generating key request -- `+e.name)})}))},getAllInitData:function(){let e=[];for(let t=0;t<h.length;t++)h[t].initData&&e.push(h[t].initData);return e},getSessionTokens:function(){return h},loadKeySession:function(e){if(!u||!m)throw Error(`Can not load sessions until you have selected a key system`);let t=e.sessionId;for(let e=0;e<h.length;e++)if(t===h[e].sessionId)return void l.warn(`DRM: Ignoring session ID because we have already seen it!`);let i=m.createSession(e.sessionType),o=S(i,e);o.hasTriggeredKeyStatusMapUpdate=!0,i.load(t).then((function(e){e?(l.debug(`DRM: Session loaded. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:o})):(x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Could not load session! Invalid Session ID (`+t+`)`)}))})).catch((function(e){x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Could not load session (`+t+`)! `+e.name)})}))},removeKeySession:function(e){e.session.remove().then((function(){l.debug(`DRM: Session removed. SessionID = `+e.getSessionId()),n.trigger(r.KEY_SESSION_REMOVED,{data:e.getSessionId()})}),(function(t){n.trigger(r.KEY_SESSION_REMOVED,{data:null,error:`Error removing session (`+e.getSessionId()+`). `+t.name})}))},requestKeySystemAccess:function(e){return new Promise(((t,n)=>{v(e,0,t,n)}))},reset:function(){let e=h.length,t;if(e!==0){let i=function(e){x(e),h.length===0&&(d?(d.removeEventListener(`encrypted`,g),d.setMediaKeys(null).then((function(){n.trigger(r.TEARDOWN_COMPLETE)}))):n.trigger(r.TEARDOWN_COMPLETE))};for(let n=0;n<e;n++)t=h[n],function(e){b(t),i(e)}(t)}else n.trigger(r.TEARDOWN_COMPLETE)},selectKeySystem:function(e){return new Promise(((t,n)=>{e.nativeMediaKeySystemAccessObject.createMediaKeys().then((t=>(u=e.keySystem,m=t,d?d.setMediaKeys(m):Promise.resolve()))).then((()=>{t(u)})).catch((function(){n({error:`Error selecting keys system (`+e.keySystem.systemString+`)! Could not create MediaKeys -- TODO`})}))}))},setMediaElement:function(e){d!==e&&(d&&(d.removeEventListener(`encrypted`,g),d.setMediaKeys&&d.setMediaKeys(null)),d=e,d&&(d.addEventListener(`encrypted`,g),d.setMediaKeys&&m&&d.setMediaKeys(m)))},setServerCertificate:function(e){return new Promise((t=>{m.setServerCertificate(e).then((function(){l.info(`DRM: License server certificate successfully updated.`),n.trigger(r.SERVER_CERTIFICATE_UPDATED),t()})).catch((e=>{n.trigger(r.SERVER_CERTIFICATE_UPDATED,{error:new p.default(f.default.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,f.default.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+e.name)}),t()}))}))},stop:function(){let e;for(let t=0;t<h.length;t++)e=h[t],e.getUsable()||(b(e),x(e))},updateKeySession:function(e,t){let i=e.session;_.isClearKey(u)&&(t=t.toJWK()),i.update(t).then((()=>{n.trigger(r.KEY_SESSION_UPDATED)})).catch((function(t){n.trigger(r.KEY_ERROR,{error:new p.default(f.default.MEDIA_KEYERR_CODE,`Error sending update() message! `+t.name,e)})}))}},l=o.getLogger(c),u=null,d=null,m=null,h=[],_=ae(t).getInstance(),g={handleEvent:function(e){if(e.type===`encrypted`&&e.initData){let t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(t,e.initDataType)})}}},c}ue[i.default.PLAYREADY_KEYSTEM_STRING]=[i.default.PLAYREADY_KEYSTEM_STRING,i.default.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING],ue[i.default.WIDEVINE_KEYSTEM_STRING]=[i.default.WIDEVINE_KEYSTEM_STRING],ue[i.default.CLEARKEY_KEYSTEM_STRING]=[i.default.CLEARKEY_KEYSTEM_STRING],de.__dashjs_factory_name=`DefaultProtectionModel`;var fe=y.default.getClassFactory(de);function pe(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c=e.api,l,u,m,h,g,_,v,y,b;function x(){try{for(let e=0;e<v.length;e++)S(v[e]);m&&m.removeEventListener(c.needkey,y),n.trigger(r.TEARDOWN_COMPLETE)}catch(e){n.trigger(r.TEARDOWN_COMPLETE,{error:`Error tearing down key sessions and MediaKeys! -- `+e.message})}}function S(e){let t=e.session;t.removeEventListener(c.error,e),t.removeEventListener(c.message,e),t.removeEventListener(c.ready,e),t.removeEventListener(c.close,e);for(let t=0;t<v.length;t++)if(v[t]===e){v.splice(t,1);break}t[c.release]()}function C(){let e=null,t=function(){m.removeEventListener(`loadedmetadata`,e),m[c.setMediaKeys](g),n.trigger(r.VIDEO_ELEMENT_SELECTED)};m.readyState>=1?t():(e=t.bind(this),m.addEventListener(`loadedmetadata`,e))}return l={getAllInitData:function(){let e=[];for(let t=0;t<v.length;t++)e.push(v[t].initData);return e},getSessionTokens:function(){return v},requestKeySystemAccess:function(e){return new Promise(((t,i)=>{let o=!1;for(let i=0;i<e.length;i++){let l=e[i].ks.systemString,u=e[i].configs,f=null,p=null;for(let e=0;e<u.length;e++){let i=u[e].audioCapabilities,m=u[e].videoCapabilities;if(i&&i.length!==0){f=[];for(let e=0;e<i.length;e++)window[c.MediaKeys].isTypeSupported(l,i[e].contentType)&&f.push(i[e])}if(m&&m.length!==0){p=[];for(let e=0;e<m.length;e++)window[c.MediaKeys].isTypeSupported(l,m[e].contentType)&&p.push(m[e])}if(!f&&!p||f&&f.length===0||p&&p.length===0)continue;o=!0;let h=new d(f,p),g=new le(b.getKeySystemBySystemString(l),h);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:g}),t({data:g});break}}if(!o){let e=`Key system access denied! -- No valid audio/video content configurations detected!`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),i({error:e})}}))},selectKeySystem:function(e){return new Promise(((t,n)=>{try{g=e.mediaKeys=new window[c.MediaKeys](e.keySystem.systemString),h=e.keySystem,_=e,m&&C(),t(h)}catch{n({error:`Error selecting keys system (`+h.systemString+`)! Could not create MediaKeys -- TODO`})}}))},setMediaElement:function(e){m!==e&&(m&&m.removeEventListener(c.needkey,y),m=e,m&&(m.addEventListener(c.needkey,y),g&&C()))},createKeySession:function(e){if(!h||!g||!_)throw Error(`Can not create sessions until you have selected a key system`);let t=null;if(_.ksConfiguration.videoCapabilities&&_.ksConfiguration.videoCapabilities.length>0&&(t=_.ksConfiguration.videoCapabilities[0]),t===null&&_.ksConfiguration.audioCapabilities&&_.ksConfiguration.audioCapabilities.length>0&&(t=_.ksConfiguration.audioCapabilities[0]),t===null)throw Error(`Can not create sessions for unknown content types.`);let i=t.contentType,o=g.createSession(i,new Uint8Array(e.initData),e.cdmData?new Uint8Array(e.cdmData):null),l=function(e,t){return{session:e,keyId:t.keyId,normalizedKeyId:t&&t.keyId&&typeof t.keyId==`string`?t.keyId.replace(/-/g,``).toLowerCase():``,initData:t.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return`temporary`},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}},handleEvent:function(e){switch(e.type){case c.error:n.trigger(r.KEY_ERROR,{error:new p.default(f.default.MEDIA_KEYERR_CODE,`KeyError`,this)});break;case c.message:let t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,e.destinationURL)});break;case c.ready:u.debug(`DRM: Key added.`),n.trigger(r.KEY_ADDED);break;case c.close:u.debug(`DRM: Session closed. SessionID = `+this.getSessionId()),n.trigger(r.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}}(o,e);o.addEventListener(c.error,l),o.addEventListener(c.message,l),o.addEventListener(c.ready,l),o.addEventListener(c.close,l),v.push(l),u.debug(`DRM: Session created. SessionID = `+l.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:l})},updateKeySession:function(e,t){let i=e.session;b.isClearKey(h)?i.update(new Uint8Array(t.toJWK())):i.update(new Uint8Array(t)),n.trigger(r.KEY_SESSION_UPDATED)},closeKeySession:S,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:x,reset:x},u=o.getLogger(l),m=null,h=null,g=null,_=null,v=[],b=ae(t).getInstance(),y={handleEvent:function(e){if(e.type===c.needkey&&e.initData){let t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(t,i.default.INITIALIZATION_DATA_TYPE_CENC)})}}},l}pe.__dashjs_factory_name=`ProtectionModel_3Feb2014`;var me=y.default.getClassFactory(pe);function he(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c=e.api,l=e.errHandler,u,m,h,g,_,v,y,b,x;function S(){h&&T();for(let e=0;e<y.length;e++)C(y[e]);n.trigger(r.TEARDOWN_COMPLETE)}function C(e){try{h[c.cancelKeyRequest](g.systemString,e.sessionId)}catch(t){n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:`Error closing session (`+e.sessionId+`) `+t.message})}}function w(e,t){if(t&&e){let n=e.length;for(let r=0;r<n;r++)if(e[r].sessionId==t)return e[r];return null}return null}function T(){h.removeEventListener(c.keyerror,x),h.removeEventListener(c.needkey,x),h.removeEventListener(c.keymessage,x),h.removeEventListener(c.keyadded,x)}return u={getAllInitData:function(){let e=[];for(let t=0;t<v.length;t++)e.push(v[t].initData);for(let t=0;t<y.length;t++)e.push(y[t].initData);return e},getSessionTokens:function(){return y.concat(v)},requestKeySystemAccess:function(e){return new Promise(((t,i)=>{let o=h;o||=document.createElement(`video`);let c=!1;for(let i=0;i<e.length;i++){let l=e[i].ks.systemString,u=e[i].configs,f=null;for(let e=0;e<u.length;e++){let i=u[e].videoCapabilities;if(i&&i.length!==0){f=[];for(let e=0;e<i.length;e++)o.canPlayType(i[e].contentType,l)!==``&&f.push(i[e])}if(!f||f&&f.length===0)continue;c=!0;let p=new d(null,f),m=new le(_.getKeySystemBySystemString(l),p);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:m}),t({data:m});break}}if(!c){let e=`Key system access denied! -- No valid audio/video content configurations detected!`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),i({error:e})}}))},selectKeySystem:function(e){return g=e.keySystem,Promise.resolve(g)},setMediaElement:function(e){if(h!==e){if(h){T();for(var t=0;t<y.length;t++)C(y[t]);y=[]}h=e,h&&(h.addEventListener(c.keyerror,x),h.addEventListener(c.needkey,x),h.addEventListener(c.keymessage,x),h.addEventListener(c.keyadded,x),n.trigger(r.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(e){if(!g)throw Error(`Can not create sessions until you have selected a key system`);if(b||y.length===0){let t={sessionId:null,keyId:e.keyId,normalizedKeyId:e&&e.keyId&&typeof e.keyId==`string`?e.keyId.replace(/-/g,``).toLowerCase():``,initData:e.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return`temporary`},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}}};return v.push(t),h[c.generateKeyRequest](g.systemString,new Uint8Array(e.initData)),t}throw Error(`Multiple sessions not allowed!`)},updateKeySession:function(e,t){let i=e.sessionId;if(_.isClearKey(g))for(let e=0;e<t.keyPairs.length;e++)h[c.addKey](g.systemString,t.keyPairs[e].key,t.keyPairs[e].keyID,i);else h[c.addKey](g.systemString,new Uint8Array(t),new Uint8Array(e.initData),i);n.trigger(r.KEY_SESSION_UPDATED)},closeKeySession:C,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:S,reset:S},m=o.getLogger(u),h=null,g=null,v=[],y=[],_=ae(t).getInstance(),x={handleEvent:function(e){let t=null;switch(e.type){case c.needkey:let o=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(o,i.default.INITIALIZATION_DATA_TYPE_CENC)});break;case c.keyerror:if(t=w(y,e.sessionId),t||=w(v,e.sessionId),t){let i=f.default.MEDIA_KEYERR_CODE,o=``;switch(e.errorCode.code){case 1:i=f.default.MEDIA_KEYERR_UNKNOWN_CODE,o+=`MEDIA_KEYERR_UNKNOWN - `+f.default.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:i=f.default.MEDIA_KEYERR_CLIENT_CODE,o+=`MEDIA_KEYERR_CLIENT - `+f.default.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:i=f.default.MEDIA_KEYERR_SERVICE_CODE,o+=`MEDIA_KEYERR_SERVICE - `+f.default.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:i=f.default.MEDIA_KEYERR_OUTPUT_CODE,o+=`MEDIA_KEYERR_OUTPUT - `+f.default.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:i=f.default.MEDIA_KEYERR_HARDWARECHANGE_CODE,o+=`MEDIA_KEYERR_HARDWARECHANGE - `+f.default.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:i=f.default.MEDIA_KEYERR_DOMAIN_CODE,o+=`MEDIA_KEYERR_DOMAIN - `+f.default.MEDIA_KEYERR_DOMAIN_MESSAGE}o+=` System Code = `+e.systemCode,n.trigger(r.KEY_ERROR,{error:new p.default(i,o,t)})}else m.error(`No session token found for key error`);break;case c.keyadded:t=w(y,e.sessionId),t||=w(v,e.sessionId),t?(m.debug(`DRM: Key added.`),n.trigger(r.KEY_ADDED,{data:t})):m.debug(`No session token found for key added`);break;case c.keymessage:if(b=e.sessionId!==null&&e.sessionId!==void 0,b?(t=w(y,e.sessionId),!t&&v.length>0&&(t=v.shift(),y.push(t),t.sessionId=e.sessionId,n.trigger(r.KEY_SESSION_CREATED,{data:t}))):v.length>0&&(t=v.shift(),y.push(t),v.length!==0&&l.error(new p.default(f.default.MEDIA_KEY_MESSAGE_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){let i=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=i,n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(t,i,e.defaultURL)})}else m.warn(`No session token found for key message`)}}},u}he.__dashjs_factory_name=`ProtectionModel_01b`;var ge=y.default.getClassFactory(he);let _e=[{generateKeyRequest:`generateKeyRequest`,addKey:`addKey`,cancelKeyRequest:`cancelKeyRequest`,needkey:`needkey`,keyerror:`keyerror`,keyadded:`keyadded`,keymessage:`keymessage`},{generateKeyRequest:`webkitGenerateKeyRequest`,addKey:`webkitAddKey`,cancelKeyRequest:`webkitCancelKeyRequest`,needkey:`webkitneedkey`,keyerror:`webkitkeyerror`,keyadded:`webkitkeyadded`,keymessage:`webkitkeymessage`}],ve=[{setMediaKeys:`setMediaKeys`,MediaKeys:`MediaKeys`,release:`close`,needkey:`needkey`,error:`keyerror`,message:`keymessage`,ready:`keyadded`,close:`keyclose`},{setMediaKeys:`msSetMediaKeys`,MediaKeys:`MSMediaKeys`,release:`close`,needkey:`msneedkey`,error:`mskeyerror`,message:`mskeymessage`,ready:`mskeyadded`,close:`mskeyclose`}];function ye(){let e,t=this.context;function n(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(typeof e[r[Object.keys(r)[0]]]==`function`)return r}return null}return e={createProtectionSystem:function(r){let i=null,o=ae(t).getInstance();o.setConfig({debug:r.debug,BASE64:r.BASE64,settings:r.settings}),o.initialize();let c=function(r){let i=r.debug,o=i.getLogger(e),c=r.eventBus,l=r.errHandler,u=r.videoModel?r.videoModel.getElement():null;return u&&u.onencrypted===void 0||u&&u.mediaKeys===void 0?n(u,ve)?(o.info(`EME detected on this user agent! (ProtectionModel_3Feb2014)`),me(t).create({debug:i,eventBus:c,events:r.events,api:n(u,ve)})):n(u,_e)?(o.info(`EME detected on this user agent! (ProtectionModel_01b)`),ge(t).create({debug:i,eventBus:c,errHandler:l,events:r.events,api:n(u,_e)})):(o.warn(`No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!`),null):(o.info(`EME detected on this user agent! (DefaultProtectionModel`),fe(t).create({debug:i,eventBus:c,events:r.events}))}(r);return c&&(i=x(t).create({BASE64:r.BASE64,cmcdModel:r.cmcdModel,constants:r.constants,customParametersModel:r.customParametersModel,debug:r.debug,eventBus:r.eventBus,events:r.events,protectionKeyController:o,protectionModel:c,settings:r.settings}),r.capabilities.setEncryptedMediaSupported(!0)),i}},e}ye.__dashjs_factory_name=`Protection`;let be=y.default.getClassFactory(ye);be.events=oe.default,be.errors=f.default,y.default.updateClassFactory(ye.__dashjs_factory_name,be);var xe=be},445:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.INTERNAL_KEY_MESSAGE=`internalKeyMessage`,this.INTERNAL_KEY_STATUSES_CHANGED=`internalkeyStatusesChanged`,this.KEY_ADDED=`public_keyAdded`,this.KEY_ERROR=`public_keyError`,this.KEY_MESSAGE=`public_keyMessage`,this.KEY_SESSION_CLOSED=`public_keySessionClosed`,this.KEY_SESSION_CREATED=`public_keySessionCreated`,this.KEY_SESSION_REMOVED=`public_keySessionRemoved`,this.KEY_STATUSES_CHANGED=`public_keyStatusesChanged`,this.KEY_STATUSES_MAP_UPDATED=`keyStatusesMapUpdated`,this.KEY_SYSTEM_ACCESS_COMPLETE=`public_keySystemAccessComplete`,this.KEY_SYSTEM_SELECTED=`public_keySystemSelected`,this.LICENSE_REQUEST_COMPLETE=`public_licenseRequestComplete`,this.LICENSE_REQUEST_SENDING=`public_licenseRequestSending`,this.NEED_KEY=`needkey`,this.PROTECTION_CREATED=`public_protectioncreated`,this.PROTECTION_DESTROYED=`public_protectiondestroyed`,this.SERVER_CERTIFICATE_UPDATED=`serverCertificateUpdated`,this.TEARDOWN_COMPLETE=`protectionTeardownComplete`,this.VIDEO_ELEMENT_SELECTED=`videoElementSelected`,this.KEY_SESSION_UPDATED=`public_keySessionUpdated`}}t.default=new i},1923:function(e,t,n){n.r(t);var r=n(8748);class i extends r.default{constructor(){super(),this.MEDIA_KEYERR_CODE=100,this.MEDIA_KEYERR_UNKNOWN_CODE=101,this.MEDIA_KEYERR_CLIENT_CODE=102,this.MEDIA_KEYERR_SERVICE_CODE=103,this.MEDIA_KEYERR_OUTPUT_CODE=104,this.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,this.MEDIA_KEYERR_DOMAIN_CODE=106,this.MEDIA_KEY_MESSAGE_ERROR_CODE=107,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,this.KEY_SESSION_CREATED_ERROR_CODE=113,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,this.MEDIA_KEYERR_UNKNOWN_MESSAGE=`An unspecified error occurred. This value is used for errors that don't match any of the other codes.`,this.MEDIA_KEYERR_CLIENT_MESSAGE=`The Key System could not be installed or updated.`,this.MEDIA_KEYERR_SERVICE_MESSAGE=`The message passed into update indicated an error from the license service.`,this.MEDIA_KEYERR_OUTPUT_MESSAGE=`There is no available output device with the required characteristics for the content protection system.`,this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE=`A hardware configuration change caused a content protection error.`,this.MEDIA_KEYERR_DOMAIN_MESSAGE=`An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.`,this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE=`Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!`,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE=`DRM: Empty key message from CDM`,this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE=`Error updating server certificate -- `,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE=`DRM: KeyStatusChange error! -- License has expired`,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE=`DRM: No license server URL specified!`,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE=`DRM: KeySystem Access Denied! -- `,this.KEY_SESSION_CREATED_ERROR_MESSAGE=`DRM: unable to create session! --`,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE=`DRM: licenser error! --`}}t.default=new i},4246:function(e,t,n){n.r(t);var r=n(138);let i={DEFAULT:.5,STRONG:1,WEAK:0};function o(e,t,n,r){let o,c,l,u,d;return c=e===void 0?null:e,l=function(e){let t=i.DEFAULT;return e!==i.DEFAULT&&e!==i.STRONG&&e!==i.WEAK||(t=e),t}(n),u=t===void 0?null:t,d=r===void 0?null:r,o={representation:c,reason:u,rule:d,priority:l},o}o.__dashjs_factory_name=`SwitchRequest`;let c=r.default.getClassFactory(o);c.NO_CHANGE=null,c.PRIORITY=i,r.default.updateClassFactory(o.__dashjs_factory_name,c),t.default=c},559:function(e,t,n){n.r(t),n.d(t,{supportsMediaSource:function(){return u}});var r=n(138),i=n(5212),o=n(2861),c=n(7393),l=n(649);function u(){let e=`ManagedMediaSource`in window,t=`WebKitMediaSource`in window,n=`MediaSource`in window;return e||t||n}function d(){let e,t,n,r,d,f,p=this.context,m=(0,c.default)(p).getInstance();function h(e,t){let n;t===i.default.VIDEO?n=function(e){let t={video:{}};return e?(e.width&&(t.video.width=e.width),e.height&&(t.video.height=e.height),e.framerate&&(t.video.framerate=parseFloat(e.framerate)),e.hdrMetadataType&&(t.video.hdrMetadataType=e.hdrMetadataType),e.colorGamut&&(t.video.colorGamut=e.colorGamut),e.transferFunction&&(t.video.transferFunction=e.transferFunction),t):t}(e):t===i.default.AUDIO&&(n=function(e){let t={audio:{}};return e.samplerate&&(t.audio.samplerate=e.samplerate),e.channels&&(t.audio.channels=e.channels),t}(e)),n[t].contentType=e.codec,n[t].bitrate=parseInt(e.bitrate),n.type=`media-source`;let r=e.codec;return e.width&&e.height&&(r+=`;width="`+e.width+`";height="`+e.height+`"`),n.mediaSourceCodecString=r,function(e,t,n){if(!t||!t.keySystemsMetadata||t.keySystemsMetadata.length===0)return[e];let r=[];return t.keySystemsMetadata.forEach((t=>{if(!t.ks)return void r.push({...e});let c=t.protData&&t.protData.systemStringPriority?t.protData.systemStringPriority:null,l=t.ks.systemString;(c||[l]).forEach((c=>{let l={...e};l.keySystemConfiguration={},c&&(l.keySystemConfiguration.keySystem=c);let u=``;t.ks.systemString===o.default.WIDEVINE_KEYSTEM_STRING&&(u=o.default.ROBUSTNESS_STRINGS.WIDEVINE.SW_SECURE_CRYPTO);let d=t.protData,f=d&&d.audioRobustness&&d.audioRobustness.length>0?d.audioRobustness:u,p=d&&d.videoRobustness&&d.videoRobustness.length>0?d.videoRobustness:u;n===i.default.AUDIO?l.keySystemConfiguration[n]={robustness:f}:n===i.default.VIDEO&&(l.keySystemConfiguration[n]={robustness:p}),r.push(l)}))})),r}(n,e,t)}function g(e){return t.get().streaming.enhancement.codecs.some((t=>e.includes(t)))}function _(e){if(r&&r.length!==0&&e)return r.find((t=>{let n=v(e,t,i.default.AUDIO),r=v(e,t,i.default.VIDEO),o=v(e,t,`keySystemConfiguration`);return n&&r&&o}))}function v(e,t,n){return!e[n]&&!t[n]||!(!e[n]||!t[n])&&m.areEqual(e[n],t[n])}function y(e,t){return(e=e.filter((e=>!(e.schemeIdUri&&t.some((t=>t.schemeIdUri===e.schemeIdUri)))))).push(...t),e}return e={areKeyIdsExpired:function(e){return!!(n&&e&&e.normalizedKeyIds&&e.normalizedKeyIds.size!==0)&&n.areKeyIdsExpired(e.normalizedKeyIds)},areKeyIdsUsable:function(e){return!(n&&e&&e.normalizedKeyIds&&e.normalizedKeyIds.size!==0)||n.areKeyIdsUsable(e.normalizedKeyIds)},isCodecSupportedBasedOnTestedConfigurations:function(e,t){if(!e||!e.codec||!1===e.isSupported)return!1;let n=h(e,t).map((e=>_(e))).filter((e=>e!=null));return!(n&&n.length>0)||function(e){return e.some((e=>e&&e.decodingInfo&&e.decodingInfo.supported))}(n)},isProtectionCompatible:function(e,t){return!t||!(!e.isEncrypted&&t.isEncrypted)},runCodecSupportCheck:function(e,n){if(n!==i.default.AUDIO&&n!==i.default.VIDEO)return Promise.resolve();if(t.get().streaming.enhancement.enabled&&g(e.codec))return r=r.filter((e=>!g(e.mediaSourceCodecString))),Promise.resolve(!0);let o=h(e,n);return function(e,n){return t.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(e.codec&&n===i.default.AUDIO||n===i.default.VIDEO&&e.codec&&e.width&&e.height&&e.bitrate&&e.framerate)}(e,n)?function(e){return new Promise((t=>{if(!e||e.length===0)return void t();let n=e.map((e=>function(e){return new Promise((t=>{_(e)?t():navigator.mediaCapabilities.decodingInfo(e).then((n=>{e.decodingInfo=n,r.push(e),t()})).catch((n=>{e.decodingInfo={supported:!1},r.push(e),f.error(n),t()}))}))}(e)));Promise.allSettled(n).then((()=>{t()})).catch((e=>{f.error(e),t()}))}))}(o):(function(e){if(!e||!e.length)return;let t=e[0];if(_(t))return;let n={supported:!1};(`ManagedMediaSource`in window&&ManagedMediaSource.isTypeSupported(t.mediaSourceCodecString)||`MediaSource`in window&&MediaSource.isTypeSupported(t.mediaSourceCodecString)||`WebKitMediaSource`in window&&WebKitMediaSource.isTypeSupported(t.mediaSourceCodecString))&&(n.supported=!0),t.decodingInfo=n,r.push(t)}(o),Promise.resolve())},setConfig:function(e){e&&(e.settings&&(t=e.settings),e.protectionController&&(n=e.protectionController))},setEncryptedMediaSupported:function(e){d=e},setProtectionController:function(e){n=e},supportsChangeType:function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType},supportsEncryptedMedia:function(){return d},supportsEssentialProperty:function(e){let n=t.get().streaming.capabilities.supportedEssentialProperties;t.get().streaming.capabilities.useMediaCapabilitiesApi&&t.get().streaming.capabilities.filterVideoColorimetryEssentialProperties&&(n=y(n,[{schemeIdUri:i.default.COLOUR_PRIMARIES_SCHEME_ID_URI},{schemeIdUri:i.default.MATRIX_COEFFICIENTS_SCHEME_ID_URI},{schemeIdUri:i.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI}])),t.get().streaming.capabilities.useMediaCapabilitiesApi&&t.get().streaming.capabilities.filterHDRMetadataFormatEssentialProperties&&(n=y(n,[{schemeIdUri:i.default.HDR_METADATA_FORMAT_SCHEME_ID_URI}]));try{return e.inArray(n)}catch{return!0}},supportsMediaSource:u},d=!1,r=[],f=(0,l.default)(p).getInstance().getLogger(e),e}d.__dashjs_factory_name=`Capabilities`,t.default=r.default.getSingletonFactory(d)},7377:function(e,t,n){n.r(t);var r=n(138),i=n(656);function o(){return{customTimeRangeArray:[],length:0,add:function(e,t){let n;for(n=0;n<this.customTimeRangeArray.length&&e>this.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n<this.customTimeRangeArray.length-1;n++)this.mergeRanges(n,n+1)&&n--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(e,t){for(let n=0;n<this.customTimeRangeArray.length;n++)if(e<=this.customTimeRangeArray[n].start&&t>=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end){this.customTimeRangeArray.splice(n+1,0,{start:t,end:this.customTimeRangeArray[n].end}),this.customTimeRangeArray[n].end=e;break}e>this.customTimeRangeArray[n].start&&e<this.customTimeRangeArray[n].end?this.customTimeRangeArray[n].end=e:t>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end&&(this.customTimeRangeArray[n].start=t)}this.length=this.customTimeRangeArray.length},mergeRanges:function(e,t){let n=this.customTimeRangeArray[e],r=this.customTimeRangeArray[t];return n.start<=r.start&&r.start<=n.end&&n.end<=r.end?(n.end=r.end,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&r.end<=n.end?(n.start=r.start,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&n.end<=r.end?(this.customTimeRangeArray.splice(e,1),!0):n.start<=r.start&&r.start<=n.end&&r.end<=n.end&&(this.customTimeRangeArray.splice(t,1),!0)},start:function(e){return(0,i.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return(0,i.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}o.__dashjs_factory_name=`CustomTimeRanges`,t.default=r.default.getClassFactory(o)},7393:function(e,t,n){n.r(t);var r=n(138),i=n(7316);function o(){let e;return e={areEqual:function(e,t){return i(e,t)}},e}o.__dashjs_factory_name=`ObjectUtils`,t.default=r.default.getSingletonFactory(o)},656:function(e,t,n){n.r(t),n.d(t,{checkInteger:function(){return o},checkIsVideoOrAudioType:function(){return l},checkParameterType:function(){return i},checkRange:function(){return c}});var r=n(5212);function i(e,t){if(typeof e!==t)throw r.default.BAD_ARGUMENT_ERROR}function o(e){if(e===null||isNaN(e)||e%1!=0)throw r.default.BAD_ARGUMENT_ERROR+` : argument is not an integer`}function c(e,t,n){if(e<t||e>n)throw r.default.BAD_ARGUMENT_ERROR+` : argument out of range`}function l(e){if(typeof e!=`string`||e!==r.default.AUDIO&&e!==r.default.VIDEO)throw r.default.BAD_ARGUMENT_ERROR}},1944:function(e,t,n){n.r(t),t.default=class{constructor(e,t,n){this.code=e||null,this.message=t||null,this.data=n||null}}},5560:function(e,t,n){n.r(t);var r=n(8854);t.default=class{constructor(e){this.id=e.id,this.url=e.url,this.language=e.language,this.mimeType=e.mimeType,this.bandwidth=e.bandwidth,this.periodId=e.periodId||null}serializeToMpdParserFormat(){return{tagName:r.default.ADAPTATION_SET,mimeType:this.mimeType,lang:this.language,Representation:[{tagName:r.default.REPRESENTATION,id:this.id,bandwidth:this.bandwidth,BaseURL:[{tagName:r.default.BASE_URL,__text:this.url}],mimeType:this.mimeType}]}}}},7568:function(e,t,n){n.r(t),n.d(t,{HTTPRequest:function(){return r},HTTPRequestTrace:function(){return i}});class r{constructor(){this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this.cmsd=null,this._stream=null,this._tfinish=null,this._mediaduration=null,this._responseHeaders=null,this._serviceLocation=null,this._fileLoaderType=null,this._resourceTimingValues=null}}class i{constructor(){this.s=null,this.d=null,this.b=[]}}r.GET=`GET`,r.HEAD=`HEAD`,r.MPD_TYPE=`MPD`,r.XLINK_EXPANSION_TYPE=`XLinkExpansion`,r.INIT_SEGMENT_TYPE=`InitializationSegment`,r.INDEX_SEGMENT_TYPE=`IndexSegment`,r.MEDIA_SEGMENT_TYPE=`MediaSegment`,r.BITSTREAM_SWITCHING_SEGMENT_TYPE=`BitstreamSwitchingSegment`,r.MSS_FRAGMENT_INFO_SEGMENT_TYPE=`FragmentInfoSegment`,r.DVB_REPORTING_TYPE=`DVBReporting`,r.LICENSE=`license`,r.CONTENT_STEERING_TYPE=`ContentSteering`,r.OTHER_TYPE=`other`}},ud={},cd.amdO={},cd.d=function(e,t){for(var n in t)cd.o(t,n)&&!cd.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},cd.g=function(){if(typeof globalThis==`object`)return globalThis;try{return this||Function(`return this`)()}catch{if(typeof window==`object`)return window}}(),cd.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},cd.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})},dd={},cd.r(dd),cd.d(dd,{Constants:function(){return bd.default},Debug:function(){return yd.default},ExternalSubtitle:function(){return Sd.default},MediaPlayer:function(){return fd.MediaPlayer},MediaPlayerFactory:function(){return vd},MetricsReporting:function(){return pd.default},Protection:function(){return md.default},default:function(){return Cd},supportsMediaSource:function(){return xd.supportsMediaSource}}),fd=cd(5393),pd=cd(4469),md=cd(3888),hd=cd(8200),_d=function(){let e=`application/dash+xml`,t;function n(n,r,i){if(!n||!/^VIDEO$/i.test(n.nodeName))return null;if(n._dashjs_player)return n._dashjs_player;let o,c=n.id||n.name||`video element`;if(!(r||=[].slice.call(n.querySelectorAll(`source`)).filter((function(t){return t.type==e}))[0])&&n.src)(r=document.createElement(`source`)).src=n.src;else if(!r&&!n.src)return null;return i||={},o=(0,hd.default)(i).create(),o.initialize(n,r.src,n.autoplay),t||=o.getDebug().getLogger(),t.debug(`Converted `+c+` to dash.js player and added content: `+r.src),n._dashjs_player=o,o}function r(e){return/^VIDEO$/i.test(e.nodeName)?e:r(e.parentNode)}return{create:n,createAll:function(t,i){let o=[];t||=`[data-dashjs-player]`;let c=(i||=document).querySelectorAll(t);for(let e=0;e<c.length;e++){let t=n(c[e],null);o.push(t)}let l=i.querySelectorAll(`source[type="`+e+`"]`);for(let e=0;e<l.length;e++){let t=n(r(l[e]),null);o.push(t)}return o}}}(),!(typeof window<`u`&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&typeof window<`u`&&window&&window.addEventListener&&(window.document.readyState===`complete`?window.dashjs?_d.createAll():gd=window.setInterval((function(){window.dashjs&&(window.clearInterval(gd),_d.createAll())}),500):window.addEventListener(`load`,(function e(){window.removeEventListener(`load`,e),_d.createAll()}))),vd=_d,yd=cd(649),bd=cd(5212),xd=cd(559),Sd=cd(5560),dashjs.Protection=md.default,dashjs.MetricsReporting=pd.default,dashjs.MediaPlayerFactory=vd,dashjs.Debug=yd.default,dashjs.supportsMediaSource=xd.supportsMediaSource,dashjs.Constants=bd.default,dashjs.ExternalSubtitle=Sd.default,Cd=dashjs,wd=(dd=dd.default).Constants,Td=dd.Debug,Ed=dd.ExternalSubtitle,Dd=dd.MediaPlayer,Od=dd.MediaPlayerFactory,kd=dd.MetricsReporting,Ad=dd.Protection,jd=dd.default,Md=dd.supportsMediaSource})),Pd,Fd=n((()=>{Pd=class{id=`dash`;isNative=!1;video=null;player=null;dashjs=null;loadVersion=0;cancelPendingLoad;lastSource=null;retryCount=0;maxRetries=2;runtimeConfig={performance:{startupMode:`balanced`,startupBufferSeconds:1.2,manifestFastPath:!1},abr:{startupProfile:`balanced`,upgradeAggression:`medium`,rebufferSafetyBias:`medium`}};lastRebufferDowngradeAt=0;listeners=new Map;domListeners=[];setRuntimeConfig(e){this.runtimeConfig={performance:{startupMode:e.performance?.startupMode??this.runtimeConfig.performance.startupMode,startupBufferSeconds:e.performance?.startupBufferSeconds??this.runtimeConfig.performance.startupBufferSeconds,manifestFastPath:e.performance?.manifestFastPath??this.runtimeConfig.performance.manifestFastPath},abr:{startupProfile:e.abr?.startupProfile??this.runtimeConfig.abr.startupProfile,upgradeAggression:e.abr?.upgradeAggression??this.runtimeConfig.abr.upgradeAggression,rebufferSafetyBias:e.abr?.rebufferSafetyBias??this.runtimeConfig.abr.rebufferSafetyBias}}}canPlayType(e){return e===`dash`}canPlaySource(e){return e.toLowerCase().includes(`.mpd`)}async preload(){await this.ensureDashJs()}async ensureDashJs(){return this.dashjs||=await Promise.resolve().then(()=>(Nd(),sd)),this.dashjs}attach(e){this.video=e,this.bindDomEvents(),this.player&&this.player.attachView(e)}bindDomEvents(){if(!this.video)return;this.unbindDomEvents();let e=(e,t,n=()=>void 0)=>{let r=r=>{let i=n(r);e===`waiting`&&this.rebufferAwareDowngrade(),this.emit(t,i)};this.video.addEventListener(e,r),this.domListeners.push({event:e,handler:r})};e(`play`,`play`),e(`pause`,`pause`),e(`playing`,`playing`),e(`ended`,`ended`),e(`waiting`,`waiting`),e(`seeked`,`seeked`,()=>({currentTime:this.video.currentTime})),e(`canplay`,`ready`),e(`timeupdate`,`timeupdate`,()=>({currentTime:this.video.currentTime})),e(`durationchange`,`durationchange`,()=>({duration:this.video.duration,isLive:this.player?.isDynamic?.()})),e(`volumechange`,`volumechange`,()=>({volume:this.video.volume,muted:this.video.muted})),e(`ratechange`,`ratechange`,()=>({playbackRate:this.video.playbackRate})),e(`progress`,`progress`,()=>{let e=[],t=this.video.buffered;for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return{buffered:e}})}unbindDomEvents(){this.video&&(this.domListeners.forEach(({event:e,handler:t})=>{this.video.removeEventListener(e,t)}),this.domListeners=[])}async load(e){if(!this.video)throw Error(`Video element not attached`);this.video.poster=e.poster||``;let t=++this.loadVersion;this.lastSource=e,this.retryCount=0;let n=await this.ensureDashJs();if(t!==this.loadVersion)return;this.player&&this.player.destroy(),this.player=n.MediaPlayer().create(),this.emit(`telemetry`,{name:`manifest_parse_started`,at:Date.now()});let r=this.runtimeConfig.abr.startupProfile,i=this.runtimeConfig.performance.startupMode,o=this.runtimeConfig.performance.manifestFastPath||i===`fast-first-frame`;e.drm&&this.player.setProtectionData(e.drm);let c=r===`fast`?350:r===`quality`?1400:800;this.player.updateSettings({streaming:{buffer:{fastSwitchEnabled:o,bufferTimeDefault:o?4:12},trackSwitchMode:{audio:`alwaysReplace`,video:`neverReplace`},cacheInitSegments:o,scheduling:{scheduleWhilePaused:!0},abr:{autoSwitchBitrate:{video:!0},initialBitrate:{video:c}},text:{defaultEnabled:!o}}}),this.registerTrackSyncEvents(),this.player.on(n.MediaPlayer.events.QUALITY_CHANGE_RENDERED,e=>{if(e.mediaType===`video`){let e=this.player.getSettings().streaming?.abr?.autoSwitchBitrate?.video;this.emit(`qualitychange`,{level:e?`auto`:this.currentQualityIndex()}),this.syncTracks()}}),this.player.on(n.MediaPlayer.events.TRACK_CHANGE_RENDERED,()=>{this.syncTracks()}),await new Promise((t,r)=>{this.cancelPendingLoad=()=>r(new DOMException(`Load superseded`,`AbortError`));let i=!1,o=()=>{this.player&&(this.player.off(n.MediaPlayer.events.STREAM_INITIALIZED,c),this.player.off(n.MediaPlayer.events.PLAYBACK_METADATA_LOADED,c),this.player.off(n.MediaPlayer.events.ERROR,l))},c=()=>{i||(i=!0,this.emit(`telemetry`,{name:`manifest_parse_completed`,at:Date.now()}),this.emit(`telemetry`,{name:`first_append_completed`,at:Date.now()}),this.syncTracks(),o(),this.cancelPendingLoad=void 0,t())},l=e=>{let t=e?.error?.code||`UNKNOWN`,n=String(e?.error?.message||`Dash error`),c=n.toLowerCase();if((c.includes(`manifest`)||c.includes(`segment`)||c.includes(`download`))&&this.retryCount<this.maxRetries&&this.lastSource){this.retryCount+=1,this.player?.attachSource?.(this.lastSource.src),this.emit(`error`,{error:{code:`DASH_${String(t)}_RETRY`,message:`Recovered load failure (${this.retryCount}/${this.maxRetries})`,engine:this.id,recoverable:!0,originalError:e}});return}this.emit(`error`,{error:{code:`DASH_${String(t)}`,message:n,engine:this.id,recoverable:!1,originalError:e}}),i||(o(),r(Error(e?.error?.message||`Dash load failed`)))};this.player.on(n.MediaPlayer.events.STREAM_INITIALIZED,c),this.player.on(n.MediaPlayer.events.PLAYBACK_METADATA_LOADED,c);for(let[e,t]of[[`MANIFEST_LOADING`,`manifest_request_started`],[`MANIFEST_LOADED`,`manifest_received`],[`FRAGMENT_LOADING_STARTED`,`first_segment_request_started`],[`FRAGMENT_LOADING_COMPLETED`,`first_segment_received`]]){let r=n.MediaPlayer.events[e];r&&this.player.on(r,()=>{this.emit(`telemetry`,{name:t,at:Date.now()})})}this.player.on(n.MediaPlayer.events.ERROR,l),this.emit(`telemetry`,{name:`manifest_request_started`,at:Date.now()}),this.player.initialize(this.video,e.src,!1)})}registerTrackSyncEvents(){if(!this.player||!this.dashjs)return;for(let e of[`STREAM_INITIALIZED`,`PLAYBACK_METADATA_LOADED`,`CAN_PLAY`,`PERIOD_SWITCH_COMPLETED`,`MANIFEST_LOADED`,`TEXT_TRACKS_ADDED`,`TEXT_TRACK_ADDED`,`TRACK_CHANGE_RENDERED`]){let t=this.dashjs.MediaPlayer.events[e];t&&this.player.on(t,()=>{this.syncTracks()})}let e=this.dashjs.MediaPlayer.events.ERROR;e&&this.player.on(e,e=>{this.handleDashRuntimeError(e)})}handleDashRuntimeError(e){let t=String(e?.error?.code||``).toLowerCase(),n=String(e?.error?.message||``).toLowerCase(),r=t.includes(`buffer_stalled`)||t.includes(`bufferstalled`)||n.includes(`buffer stalled`),i=t.includes(`manifest`)||t.includes(`download`)||n.includes(`segment`)||n.includes(`manifest`),o=t.includes(`media`)||n.includes(`decode`);if(r){this.emit(`error`,{error:{code:`DASH_BUFFER_STALL`,message:`Buffer stall detected`,engine:this.id,recoverable:!0,originalError:e}});return}if(i&&this.retryCount<this.maxRetries&&this.lastSource){this.retryCount+=1,this.player.attachSource?.(this.lastSource.src),this.emit(`error`,{error:{code:`DASH_NETWORK_RETRY`,message:`Retrying network/segment request (${this.retryCount}/${this.maxRetries})`,engine:this.id,recoverable:!0,originalError:e}});return}if(o){let t=this.currentQualityIndex();if(typeof t==`number`&&t>0){this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.player.setRepresentationForTypeByIndex?.(`video`,t-1),this.emit(`error`,{error:{code:`DASH_DECODE_FALLBACK`,message:`Decode issue detected, switched to lower quality`,engine:this.id,recoverable:!0,originalError:e}});return}}}currentQualityIndex(){let e=this.player?.getCurrentRepresentationForType(`video`)?.id;return this.getQualityLadder().findIndex(t=>t.id===e)}getQualityLadder(){if(!this.player)return[];let e=this.player,t=e.getBitrateInfoListFor?.(`video`);if(Array.isArray(t)&&t.length>0)return t;let n=e.getRepresentationsByType?.(`video`);return Array.isArray(n)&&n.length>0?n.map((e,t)=>({qualityIndex:e.qualityIndex??t,bitrate:e.bandwidth??e.bitrate,width:e.width,height:e.height,id:e.id})):[]}getTracks(e){if(!this.player)return[];let t=this.player.getTracksFor?.(e);return Array.isArray(t)&&t.length>0?t:this.video&&e===`text`&&this.video.textTracks?Array.from(this.video.textTracks).map((e,t)=>({id:String(t),index:t,lang:e.language,label:e.label,kind:e.kind,_native:e})):[]}normalizeTrackLabel(e,t,n){let r=e?.roles?.[0]?.value??e?.roles?.[0],i=typeof r==`string`?` (`+r+`)`:``,o=e?.lang||e?.language||``;return`${e?.label||e?.name||o||`${t} ${n+1}`}${i}`}getTrackId(e,t){return String(t)}enforceSingleNativeTextTrack(e){if(!this.video?.textTracks)return;let t=this.video.textTracks;for(let n=0;n<t.length;n+=1){let r=t[n];if(e===null){r.mode=`disabled`;continue}r.mode=n===e?`showing`:`disabled`}}matchesTrackId(e,t,n){return this.getTrackId(e,t)===n}syncTracks(){if(!this.player)return;let e=this.getQualityLadder().map((e,t)=>{let n=e.qualityIndex??t,r=e.bandwidth??e.bitrate;return{id:n,label:e.height?`${e.height}p (${Math.round((r||0)/1e3)}kbps)`:`Quality ${t+1} (${Math.round((r||0)/1e3)}kbps)`,bitrate:r,width:e.width,height:e.height,selected:!this.player.getSettings().streaming?.abr?.autoSwitchBitrate?.video&&this.currentQualityIndex()===n}}),t=this.getTracks(`text`),n=new Set,r=t.filter(e=>{let t=`${String(e?.lang||e?.language||``)}|${String(e?.label||e?.name||``)}|${String(e?.kind||``)}`;return n.has(t)?!1:(n.add(t),!0)}),i=this.player.getCurrentTrackFor?.(`text`),o=r.map(e=>({id:String(t.indexOf(e)),label:this.normalizeTrackLabel(e,`Subtitle`,t.indexOf(e)),language:e.lang||e.language,selected:i?i.index===e.index:e._native?.mode===`showing`})),c=this.getTracks(`audio`),l=this.player.getCurrentTrackFor?.(`audio`),u=c.map((e,t)=>({id:this.getTrackId(e,t),label:this.normalizeTrackLabel(e,`Audio`,t),language:e.lang||e.language,selected:l?l.index===e.index:!!e?.selected}));this.emit(`trackschange`,{qualities:e,subtitles:o,audioTracks:u})}rebufferAwareDowngrade(){if(!this.player)return;let e=Date.now();if(e-this.lastRebufferDowngradeAt<2500||!this.video||this.video.currentTime<.5)return;let t=this.currentQualityIndex();if(typeof t!=`number`||t<=0)return;let n=this.runtimeConfig.abr.rebufferSafetyBias,r=Math.max(0,t-(n===`high`?2:1));try{this.player.setRepresentationForTypeByIndex(`video`,r),this.lastRebufferDowngradeAt=e,this.emit(`telemetry`,{name:`abr_rebuffer_downgrade`,at:e,data:{from:t,to:r,bias:n}}),this.syncTracks()}catch{}}async play(){await this.video?.play()}pause(){this.video?.pause()}async destroy(){++this.loadVersion,this.cancelPendingLoad?.(),this.cancelPendingLoad=void 0,this.unbindDomEvents(),this.player&&=(this.player.destroy(),null),this.video&&(this.video.src=``,this.video.removeAttribute(`src`)),this.video=null,this.listeners.clear()}seek(e){this.video&&(this.video.currentTime=e)}setVolume(e){this.video&&(this.video.volume=e)}setMuted(e){this.video&&(this.video.muted=e)}setPlaybackRate(e){this.video&&(this.video.playbackRate=e)}setQuality(e){this.player&&(e===`auto`?(this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}),this.emit(`qualitychange`,{level:`auto`})):(this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.player.setRepresentationForTypeByIndex(`video`,Number(e)),this.emit(`qualitychange`,{level:e})))}setSubtitle(e){if(this.player){if(e===null)this.player.setTextTrack(-1),this.enforceSingleNativeTextTrack(null);else{let t=this.player.getTracksFor(`text`).findIndex((t,n)=>this.matchesTrackId(t,n,e));t>=0&&(typeof this.player.enableText==`function`&&this.player.enableText(!0),this.player.setTextTrack(t),this.enforceSingleNativeTextTrack(t))}this.syncTracks()}}setAudioTrack(e){if(this.player){let t=this.player.getTracksFor(`audio`),n=t.findIndex((t,n)=>this.matchesTrackId(t,n,e));if(n>=0){let e=t[n];typeof this.player.setInitialMediaSettingsFor==`function`&&this.player.setInitialMediaSettingsFor(`audio`,{lang:e?.lang,index:e?.index,role:Array.isArray(e?.roles)?e.roles[0]:void 0}),this.player.setCurrentTrack(e)}this.syncTracks()}}on(e,t){let n=e;return this.listeners.has(n)||this.listeners.set(n,[]),this.listeners.get(n).push(t),()=>this.off(e,t)}off(e,t){let n=e,r=this.listeners.get(n);if(!r)return;let i=r.indexOf(t);i>-1&&r.splice(i,1)}emit(e,t){let n=e,r=this.listeners.get(n);if(r)for(let e of[...r])e(t)}}})),Id=r({DashEngine:()=>Pd}),Ld=n((()=>{Fd()})),Rd=new WeakSet,zd=new Map;function Bd(e,t){let n=new m;n.setPerformance(t.performance),n.setAbr(t.abr);let r=new O,i=typeof e==`string`?document.querySelector(e):e;if(!i)throw Error(`Player target element not found`);if(Rd.has(i))throw Error(`Player target already mounted. Destroy previous instance before creating a new one.`);Rd.add(i),n.registry.register(new h);let o=!1,c=!1,l=null,u=null,d=null,p=null,g;t.ui?.headless?(g=document.createElement(`video`),g.setAttribute(`playsinline`,``),g.preload=`auto`,g.muted=!!(t.source?.muted??!0),i.appendChild(g),n.attachVideo(g)):l=new w(n,e,t.ui),i&&(C(i.querySelector(`.flux-player-wrapper`)||i,t.theme||`dark`),u=new _(n,i)),t.analytics&&(d=new T(n,t.analytics.adapter)),t.devtools&&(p=new E(n,i||document.body));let v=async e=>{let t=e.type&&e.type!==`auto`?e.type:f(e.src,e.mimeType);if((t===`hls`||t===`auto`)&&!o)try{let e=new(await(Promise.resolve().then(()=>(od(),ad)))).HlsEngine;await e.preload?.(),n.registry.register(e),o=!0}catch(e){console.warn(`Failed to lazy load HLS engine`,e)}if((t===`dash`||t===`auto`)&&!c)try{let e=new(await(Promise.resolve().then(()=>(Ld(),Id)))).DashEngine;await e.preload?.(),n.registry.register(e),c=!0}catch(e){console.warn(`Failed to lazy load DASH engine`,e)}},y=e=>{if(!t.performance?.manifestFastPath)return()=>void 0;let n=document.createElement(`link`);return n.rel=`preload`,n.as=`fetch`,n.href=e,n.setAttribute(`fetchpriority`,`high`),n.crossOrigin=`anonymous`,document.head.appendChild(n),()=>{n.parentNode&&n.parentNode.removeChild(n)}},b=e=>{if(!t.performance?.manifestFastPath)return()=>void 0;let n=new URL(e,window.location.href).origin;if(zd.has(n))return()=>void 0;let r=[],i=(e,t)=>{let n=document.createElement(`link`);n.rel=e,n.href=t,e===`preconnect`&&(n.crossOrigin=`anonymous`),document.head.appendChild(n),r.push(n)};return i(`preconnect`,n),i(`dns-prefetch`,n),zd.set(n,r),()=>void 0},x=!1,S=null,D=()=>{let e=navigator;return typeof e.userAgentData?.mobile==`boolean`?e.userAgentData.mobile:/android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent||``)},k=e=>{let t=e.currentTime,n=e.buffered;for(let e=0;e<n.length;e+=1){let r=n.start(e),i=n.end(e);if(t>=r-.25&&t<=i+.05)return Math.max(0,i-t)}return 0},A=()=>{let e=t.performance,r;if(typeof e?.startupBufferSeconds==`number`&&Number.isFinite(e.startupBufferSeconds))r=Math.max(0,e.startupBufferSeconds);else{let t=e?.startupStrategy??(e?.startupMode===`fast-first-frame`?`aggressive`:`balanced`),i=n.getState(),o=D(),c=!!(i.isLive||i.isDvr);r=t===`aggressive`?c?o?.12:.08:o?.18:.12:t===`safe`?c?o?.55:.45:o?.9:.75:c?o?.35:.28:o?.55:.45}let i=navigator.connection,o=1;switch(i?.saveData&&(o*=1.2),(i?.effectiveType||``).toLowerCase()){case`slow-2g`:o*=1.7;break;case`2g`:o*=1.45;break;case`3g`:o*=1.2;break;case`4g`:o*=.9;break;default:break}typeof i?.downlink==`number`&&Number.isFinite(i.downlink)&&(i.downlink>=12?o*=.82:i.downlink>=6?o*=.9:i.downlink<=1.5&&(o*=1.22)),typeof i?.rtt==`number`&&Number.isFinite(i.rtt)&&i.rtt>250&&(o*=1.1);let c=r*o;return Math.max(.12,Math.min(1.5,c))},j=()=>{if((t.performance?.startupBufferSeconds??0)>=.5)return 4500;let e=t.performance?.startupStrategy??(t.performance?.startupMode===`fast-first-frame`?`aggressive`:`balanced`);return e===`safe`?3500:e===`aggressive`?1200:2200},M=async()=>{let e=i.querySelector(`video`);if(!e)return;let t=Math.max(0,A()),o=j(),c=Date.now(),l=HTMLMediaElement.HAVE_FUTURE_DATA,u=``,d=()=>{let t=k(e),r=n.getStartupReadiness(),i=!r||r.mediaSourceReadyState===null||r?.mediaSourceReadyState===`open`,o=r?.sourceBuffersUpdating!==!0,c=e.buffered.length>0;return{ahead:t,readyEnough:e.readyState>=l,hasBufferedRange:c,mediaSourceOpen:i,sourceBuffersIdle:o,engineReadiness:r}},f=(n,r)=>{let i=t;return e.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA&&n.ahead>=.25&&(i=Math.min(i,Math.max(.2,t*.65))),r>900&&n.hasBufferedRange&&n.sourceBuffersIdle&&n.mediaSourceOpen&&(i=Math.min(i,.28)),i},p=(e,t)=>{let n=[];return e.hasBufferedRange||n.push(`no_buffered_range`),e.ahead<t&&n.push(`insufficient_buffer_ahead`),e.readyEnough||n.push(`ready_state_below_have_future_data`),e.mediaSourceOpen||n.push(`media_source_not_open`),e.sourceBuffersIdle||n.push(`source_buffer_updating`),(e.engineReadiness?.appendQueueDepth??0)>0&&n.push(`append_queue_not_empty`),e.engineReadiness?.appendWaitActive&&n.push(`append_wait_active`),n},m=(n,i,o)=>{let c=p(n,o),l=c.join(`|`);!l||l===u||(u=l,r.onTelemetry(`startup_gate_pending`,Date.now(),{waitedMs:i,minAhead:o,baseMinAhead:t,ahead:n.ahead,readyState:e.readyState,reasons:c,mediaSourceReadyState:n.engineReadiness?.mediaSourceReadyState??null,sourceBuffersUpdating:n.engineReadiness?.sourceBuffersUpdating??null,appendQueueDepth:n.engineReadiness?.appendQueueDepth??null,appendWaitActive:n.engineReadiness?.appendWaitActive??null,appendBackpressureCount:n.engineReadiness?.appendBackpressureCount??null}))},h=d();if(h.hasBufferedRange&&h.readyEnough&&h.ahead>=f(h,0)&&h.mediaSourceOpen&&h.sourceBuffersIdle){r.onTelemetry(`startup_gate_ready`,Date.now(),{minAhead:f(h,0),baseMinAhead:t,ahead:h.ahead,readyState:e.readyState,waitedMs:0});return}await new Promise(n=>{let i=!1,l=null,u=null,p=()=>{l!==null&&window.cancelAnimationFrame(l),u!==null&&window.clearTimeout(u);for(let t of[`progress`,`loadeddata`,`canplay`,`canplaythrough`])e.removeEventListener(t,_)},h=(e,t)=>{i||(i=!0,p(),r.onTelemetry(e,Date.now(),t),n())},g=()=>{if(i||x){p(),n();return}let r=Date.now()-c,u=d(),_=f(u,r),{ahead:v,readyEnough:y,hasBufferedRange:b,mediaSourceOpen:S,sourceBuffersIdle:C}=u;if(b&&y&&v>=_&&S&&C){h(`startup_gate_ready`,{minAhead:_,baseMinAhead:t,ahead:v,readyState:e.readyState,waitedMs:r});return}if(m(u,r,_),r>=o){h(`startup_gate_timeout`,{minAhead:_,baseMinAhead:t,ahead:v,readyState:e.readyState,waitedMs:r});return}l=window.requestAnimationFrame(g)},_=()=>{g()};for(let t of[`progress`,`loadeddata`,`canplay`,`canplaythrough`])e.addEventListener(t,_);u=window.setTimeout(g,o),g()})},N=()=>{S?.(),S=null;let e=e=>{if(`requestVideoFrameCallback`in HTMLVideoElement.prototype){let t=e,n=t.requestVideoFrameCallback(()=>{r.onFirstFrame()});S=()=>{t.cancelVideoFrameCallback?.(n)};return}{let t=null,n=Date.now(),i=()=>{if(!e.paused&&e.currentTime>0&&e.readyState>=2){r.onFirstFrame();return}Date.now()-n>15e3||(t=window.requestAnimationFrame(i))};t=window.requestAnimationFrame(i);let o=S;S=()=>{o?.(),t!==null&&window.cancelAnimationFrame(t)}}},t=i.querySelector(`video`);if(t){e(t);return}let n=new MutationObserver(()=>{let t=i.querySelector(`video`);t&&(n.disconnect(),e(t))});n.observe(i,{childList:!0,subtree:!0}),S=()=>{n.disconnect()}},P=0,F=0,I=null,L=async e=>{if(x)throw Error(`Player has been destroyed`);let t=++P;S?.(),r.resetForNewSource(),r.onSourceLoadRequested();let i=b(e.src),o=f(e.src,e.mimeType),c=[e.type,o].some(e=>e===`dash`||e===`hls`)?y(e.src):()=>void 0;try{await v(e),!x&&t===P&&await n.load(e)}finally{i(),c()}},R=e=>{++F;let t=L(e);I=t;let n=()=>{I===t&&(I=null)};return t.then(n,n),t};t.source&&R(t.source).catch(e=>console.error(`Autoload failed`,e));let z={load:R,play:async()=>{let e=++F;if(r.onPlayCalled(),I&&await I,x||e!==F)return;let i=t.performance;if(!(i?.startupMode===`fast-first-frame`&&i.startupBufferSeconds===void 0&&i.startupStrategy!==`safe`)&&n.getState().currentTime===0&&await M(),!(x||e!==F))return n.play()},pause:()=>{++F,n.pause()},destroy:async()=>{x||(x=!0,l&&l.destroy(),u&&u.destroy(),d&&d.destroy(),p&&p.destroy(),S?.(),await n.destroy(),g?.remove(),Rd.delete(i))},seek:e=>n.seek(e),setVolume:e=>n.setVolume(e),setMuted:e=>n.setMuted(e),setPlaybackRate:e=>n.setPlaybackRate(e),setToolbar:e=>l?.setToolbar(e),setTheme:e=>{i&&C(i.querySelector(`.flux-player-wrapper`)||i,e)},setQuality:e=>n.setQuality(e),setSubtitle:e=>n.setSubtitle(e),setAudioTrack:e=>n.setAudioTrack(e),getState:()=>n.getState(),getStats:()=>n.getStats(),getStartupMetrics:()=>r.getStartupMetrics(),printStartupReport:()=>r.printStartupReport(),on:(e,t)=>n.on(e,t)};return z.setDevtoolsVisible=e=>{p?.setVisible(e)},z.isDevtoolsVisible=()=>p?.isVisible()??!1,z.getSessionTrace=()=>{let e=d?.getSessionTrace()??[],t=r.getSessionTrace();return[...e,...t].sort((e,t)=>e.at-t.at)},n.on(`telemetry`,e=>{r.onTelemetry(e?.name||`telemetry`,e?.at||Date.now(),e?.data)}),n.on(`waiting`,()=>{r.onWaiting()}),n.on(`playback_requested`,()=>r.onPlayCalled()),n.on(`play`,()=>{N(),r.onPlayCalled()}),n.on(`playing`,()=>{r.onPlaying()}),n.on(`error`,e=>{r.onError(e)}),z}var Vd=`[data-flux-player]`,Hd=e=>{if(e!==null)return e===`true`||e===`1`},Ud=e=>{let t=e.getAttribute(`data-src`);if(!t)throw Error(`Missing data-src for data-flux-player element.`);let n=e.getAttribute(`data-type`)||`auto`,r=e.getAttribute(`data-poster`)||void 0,i=e.getAttribute(`data-thumbnail-vtt`)||void 0,o=e.getAttribute(`data-theme`)||`dark`,c=e.getAttribute(`data-startup-mode`)||`fast-first-frame`;return{source:{src:t,type:n,poster:r,thumbnailVtt:i,autoplay:Hd(e.getAttribute(`data-autoplay`)),muted:Hd(e.getAttribute(`data-muted`))},theme:o,performance:{startupMode:c}}},Wd=(e={})=>{let t=e.selector||Vd,n=e.root||document,r=Array.from(n.querySelectorAll(t)).filter(e=>e instanceof HTMLElement),i=[];for(let e of r){if(e.dataset.fluxMounted===`true`)continue;let t=Bd(e,Ud(e));i.push(t),e.dataset.fluxMounted=`true`}return i};typeof window<`u`&&typeof document<`u`&&window.__FLUX_AUTO_INIT__!==!1&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Wd(),{once:!0}):Wd());var Gd={createPlayer:Bd,autoInitFluxPlayers:Wd};typeof window<`u`&&(window.Flux=Gd),e.Flux=Gd,e.autoInitFluxPlayers=Wd,e.createPlayer=Bd});
59
+ `)}else c=e[t],c.match(i)||(o=c);return o}return t={parse:function(e){let t=[],c,l;if(!e)return t;c=(e=e.split(r)).length,l=-1;for(let r=0;r<c;r++){let c=e[r];if(c.length>0&&c!==`WEBVTT`&&c.match(i)){let i=d(c),f=i.cuePoints,m=i.styles,h=p(e,r+1),g=u(f[0].replace(o,``)),_=u(f[1].replace(o,``));!isNaN(g)&&!isNaN(_)&&g>=l&&_>g?h===``?n.error(`Skipping cue due to empty/malformed cue text`):(l=g,t.push({start:g,end:_,data:h,styles:m})):n.error(`Skipping cue due to incorrect cue timing`)}}return t},getCaptionStyles:f},n=(0,l.default)(e).getInstance().getLogger(t),r=/(?:\r\n|\r|\n)/gm,i=/-->/,o=/(^[\s]+|[\s]+$)/g,c=/\s\b/g,t}$.__dashjs_factory_name=`VTTParser`;var Ks=i.default.getSingletonFactory($);function qs(){let e,t;return e={parse:function(e){let n=[];return t.oncue=function(e){e.start=e.startTime,e.end=e.endTime,e.data=e.text,e.styles={align:e.align,line:e.line,position:e.position,size:e.size},n.push(e)},t.parse(e),n}},function(){try{window&&window.WebVTT&&window.WebVTT.Parser&&(t=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()))}catch{}}(),e}qs.__dashjs_factory_name=`VttCustomRenderingParser`;var Js=i.default.getSingletonFactory(qs);function Ys(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i=0;function o(){let e=`cue_TTML_`+i;return i++,e}return n={parse:function(e,n,i,c,l){let u=``,d=[],f,p,h,_={},v={},y=``,b=``,x={onOpenTag:function(e,n,i){if(i[` imagetype`]&&!i[` imageType`]&&(t.trigger(g.default.CONFORMANCE_VIOLATION,{level:cs.LEVELS.ERROR,event:cs.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[` imageType`]=i[` imagetype`]),n===`image`&&(e===`http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt`||e===`http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt`)){if(!i[` imageType`]||i[` imageType`].value!==`PNG`)return void r.warn(`smpte-tt imageType != PNG. Discarded`);y=i[`http://www.w3.org/XML/1998/namespace id`].value}},onCloseTag:function(){y&&(v[y]=b.trim()),b=``,y=``},onText:function(e){y&&(b+=e)}};if(!e)throw u=`no ttml data to parse`,Error(u);_.data=e,t.trigger(m.default.TTML_TO_PARSE,_);let S=(0,Hs.fromXML)(_.data,(function(e){u=e}),x);t.trigger(m.default.TTML_PARSED,{ttmlString:_.data,ttmlDoc:S});let C=S.getMediaTimeEvents();for(h=0;h<C.length;h++){let e=(0,Hs.generateISD)(S,C[h],(function(e){u=e}));e.contents.some((e=>e.contents.length))&&(f=C[h]+n,p=C[h+1]+n,f<p&&d.push({start:f,end:p,type:`html`,cueID:o(),isd:e,images:l,embeddedImages:v}))}if(u!==``)throw r.error(u),Error(u);return d}},r=(0,l.default)(e).getInstance().getLogger(n),n}Ys.__dashjs_factory_name=`TTMLParser`;var Xs=i.default.getSingletonFactory(Ys);function Zs(e){let t=this.context,n=(0,p.default)(t).getInstance(),r=ht(t).getInstance(),i=e.adapter,o=e.baseURLController,c,u,d;function f(e,t){let n,c,l=!1;if(o.resolve()){let t=i.getVoRepresentations(e);t&&t.length>0&&(n=o.resolve(t[0].path).url)}let u=e.essentialProperties.filter((e=>e.schemeIdUri&&e.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME)),f=e.supplementalProperties.filter((e=>e.schemeIdUri&&e.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME));u.length>0?(l=!0,c=u):c=f,c.forEach((i=>{if(function(e){return!(!(e.value&&parseInt(e.value)===1&&e.dvbUrl&&e.dvbUrl.length>0&&e.dvbFontFamily&&e.dvbFontFamily.length>0&&e.dvbMimeType)||e.dvbMimeType!==h.default.OFF_MIMETYPE&&e.dvbMimeType!==h.default.WOFF_MIMETYPE)}(i)){let u=(o=i.dvbUrl,c=n,r.isPathAbsolute(o)?o:r.isRelative(o)?c?r.resolve(o,c):r.resolve(o):o);d.push({fontFamily:i.dvbFontFamily,url:u,mimeType:i.dvbMimeType,trackId:e.id,streamId:t,isEssential:l,status:`unloaded`,fontFace:new FontFace(i.dvbFontFamily,`url(${u})`,{display:`swap`})})}var o,c}))}function m(e,t){let n=d[e];d[e]={...n,status:t}}function _(){d=[]}return c={addFontsFromTracks:function(e,t){if(e&&Array.isArray(e)&&t)for(let n=0;n<e.length;n++)f(e[n],t)},downloadFonts:function(){for(let e=0;e<d.length;e++){let t=d[e];document.fonts.add(t.fontFace),n.trigger(g.default.DVB_FONT_DOWNLOAD_ADDED,t),t.fontFace.load().then((()=>{m(e,`loaded`),n.trigger(g.default.DVB_FONT_DOWNLOAD_COMPLETE,t)}),(r=>{m(e,`error`),u.debug(`Font download error: `,r),n.trigger(g.default.DVB_FONT_DOWNLOAD_FAILED,t)}))}},getFonts:function(){return d},getFontsForTrackId:function(e){return d.filter((t=>t.trackId&&t.trackId===e))},reset:function(){(function(){for(let e of d){let t=document.fonts.delete(e.fontFace);u.debug(`Removal of fontFamily: ${e.fontFamily} was ${t?`successful`:`unsuccessful`}`)}})(),_()}},u=(0,l.default)(t).getInstance().getLogger(c),_(),c}Zs.__dashjs_factory_name=`DVBFonts`;var Qs=i.default.getClassFactory(Zs);function $s(e){let t=this.context,n=e.adapter,r=e.errHandler,i=e.manifestModel,o=e.mediaController,c=e.baseURLController,u=e.videoModel,d=e.settings,f,_,v,y,b,x,S,C,w,T,E,D,O,k;function A(e){if(k.error(`Could not download ${e.isEssential?`an essential`:`a`} font - fontFamily: ${e.fontFamily}, url: ${e.url}`),e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_DISABLED)}}function j(e){if(k.debug(`Successfully downloaded ${e.isEssential?`an essential`:`a`} font - fontFamily: ${e.fontFamily}, url: ${e.url}`),e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);t===y[e.streamId].getCurrentTrackIdx()?y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_SHOWING):y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_HIDDEN)}}function M(e){let t=e.tracks,n=e.index,r=e.streamId;if(!1===d.get().streaming.text.defaultEnabled&&!L()||D)R(r,-1);else{let e=o.getCurrentTrackFor(h.default.TEXT,r);if(e){let i={lang:e.lang,role:e.roles[0],index:e.index,codec:e.codec,accessibility:e.accessibility[0]};t.some(((e,t)=>{if(o.matchSettings(i,e))return R(r,t),n=t,!0}))}w=!1}_[r].lastEnabledIndex=n,C.trigger(g.default.TEXT_TRACKS_ADDED,{enabled:L(),index:n,tracks:t,streamId:r}),E=!0,O.addFontsFromTracks(t,r),O.getFonts().forEach((e=>{if(e.isEssential){let t=y[e.streamId].getTrackIdxForId(e.trackId);y[e.streamId].setModeForTrackIdx(t,h.default.TEXT_DISABLED)}})),O.downloadFonts()}function N(e){try{let t=e.streamId,n=y[t];if(!n||isNaN(e.time))return;n.updateTextTrackWindow(e.time),d.get().streaming.text.webvtt.customRenderingEnabled&&n.manualCueProcessing(e.time)}catch{}}function P(e){try{let t=e.streamId;if(!y[t])return;y[t].disableManualTracks()}catch{}}function F(e){try{let t=y[e.streamId];if(!t)return;let n=u.getTime()||0;t.updateTextTrackWindow(n,!0)}catch(e){k.error(e)}}function I(e){try{if(!e||!e.mediaType||e.mediaType!==h.default.AUDIO||!e.currentMediaInfo)return;let t=y[e.streamId].getCurrentTextTrackInfo(),n=NaN;w?n=z(e.streamId):B(t)&&e.currentMediaInfo.lang&&e.currentMediaInfo.lang!==t.lang&&(n=z(e.streamId),isNaN(n)&&(n=-1)),isNaN(n)||R(e.streamId,n)}catch(e){k.error(e)}}function L(){let e=!0;return w&&!T&&(e=!1),e}function R(e,t){w=t===-1,w&&o&&o.saveTextSettingsDisabled();let n=V(e);if(n===t||!y[e])return;y[e].disableManualTracks(),y[e].invalidateCueWindow();let r=y[e].getCurrentTextTrackInfo(),i=r?u.getTextTrack(r.kind,r.id,r.lang,r.isTTML,r.isEmbedded):null;i&&i.mode!==h.default.TEXT_DISABLED&&y[e].setModeForTrackIdx(n,h.default.TEXT_HIDDEN),y[e].setCurrentTrackIdx(t),r=y[e].getCurrentTextTrackInfo();let c=d.get().streaming.text.dispatchForManualRendering;if(r&&!c&&r.mode!==h.default.TEXT_DISABLED&&y[e].setModeForTrackIdx(t,h.default.TEXT_SHOWING),r&&r.isFragmented&&!r.isEmbedded)(function(e,t,n){if(!v[e])return;let r=v[e].getConfig().fragmentedTracks;for(let i=0;i<r.length;i++){let c=r[i];if(t.lang===c.lang&&(c.id?t.id===c.id:t.index===c.index)){let t=o.getCurrentTrackFor(h.default.TEXT,e);(c.id?t.id!==c.id:t.index!==c.index)?(y[e].deleteCuesFromTrackIdx(n),v[e].setCurrentFragmentedTrackIdx(i)):n===-1&&C.trigger(m.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,{},{streamId:e,mediaType:h.default.TEXT})}}})(e,r,n);else if(r&&!r.isFragmented)(function(e,t){C.trigger(m.default.SET_NON_FRAGMENTED_TEXT,{currentTrackInfo:t},{streamId:e,mediaType:h.default.TEXT})})(e,r);else if(!r&&w){let t=z(e);isNaN(t)||R(e,t);return}o.setTrack(r)}function z(e){let t=function(e){return y[e].getTextTrackInfos().filter(((e,t)=>(e._indexToSelect=t,!!(e&&e.roles&&e.roles.length>0)&&B(e))))}(e);if(!t||t.length<=0)return NaN;let n=o.getCurrentTrackFor(h.default.AUDIO,e);if(!n)return NaN;let r=t.find((e=>n.lang===e.lang));return r?r._indexToSelect:NaN}function B(e){return!(!e||!e.roles||e.roles.length===0)&&e.roles.some((e=>e.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&e.value===Y.default.FORCED_SUBTITLE))}function V(e){return y[e].getCurrentTrackIdx()}function H(){v={},y={},_={},w=!0,E=!1,D=!1}return f={addEmbeddedTrack:function(e,t){let n=e.id;v[n]&&v[n].addEmbeddedTrack(t)},addMediaInfosToBuffer:function(e,t,n,r=null){let i=e.id;v[i]&&v[i].addMediaInfos(t,n,r)},createTracks:function(e){let t=e.id;y[t]&&y[t].createTracks()},deactivateStream:function(e){if(!e)return;let t=e.id;v[t]&&v[t].resetMediaInfos(),y[t]&&y[t].deleteAllTextTracks()},enableForcedTextStreaming:function(e){return(0,Ve.checkParameterType)(e,`boolean`),T=e,!0},enableText:function(e,t){return(0,Ve.checkParameterType)(t,`boolean`),L()!==t&&(t&&R(e,_[e].lastEnabledIndex),t||(_[e].lastEnabledIndex=V(e),E?R(e,-1):D=!0)),!0},getAllTracksAreDisabled:function(){return w},getCurrentTrackIdx:V,getTextSourceBuffer:function(e){let t=e.id;if(v&&v[t])return v[t]},initialize:function(){O=Qs(t).create({adapter:n,baseURLController:c}),C.on(m.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,f),C.on(m.default.DVB_FONT_DOWNLOAD_FAILED,A,f),C.on(m.default.DVB_FONT_DOWNLOAD_COMPLETE,j,f),C.on(m.default.MEDIAINFO_UPDATED,I,f),C.on(m.default.PLAYBACK_TIME_UPDATED,N,f),d.get().streaming.text.webvtt.customRenderingEnabled&&C.on(m.default.PLAYBACK_SEEKING,P,f),C.on(m.default.PLAYBACK_SEEKED,F,f)},initializeForStream:function(e){let c=e.id,l=Gs(t).create({videoModel:u,settings:d,streamInfo:e});l.initialize(),y[c]=l;let f=Bs(t).create({errHandler:r,adapter:n,dvbFonts:O,manifestModel:i,mediaController:o,videoModel:u,textTracks:l,vttParser:b,vttCustomRenderingParser:x,ttmlParser:S,streamInfo:e,settings:d});f.initialize(),v[c]=f,_[c]={},_[c].lastEnabledIndex=-1},isTextEnabled:L,reset:function(){Object.keys(v).forEach((e=>{v[e].resetEmbedded(),v[e].reset()})),O.reset(),H(),C.off(m.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,f),C.off(m.default.DVB_FONT_DOWNLOAD_FAILED,A,f),C.off(m.default.DVB_FONT_DOWNLOAD_COMPLETE,j,f),C.off(m.default.MEDIAINFO_UPDATED,I,f),C.off(m.default.PLAYBACK_TIME_UPDATED,N,f),d.get().streaming.text.webvtt.customRenderingEnabled&&C.off(m.default.PLAYBACK_SEEKING,P,f),C.off(m.default.PLAYBACK_SEEKED,F,f)},setTextTrack:R,clearDataForStream:function(e){v[e]&&(v[e].resetEmbedded(),v[e].reset(),delete v[e]),y[e]&&(y[e].deleteAllTextTracks(),delete y[e]),_[e]&&delete _[e]}},T=!1,E=!1,D=!1,b=Ks(t).getInstance(),x=Js(t).getInstance(),S=Xs(t).getInstance(),C=(0,p.default)(t).getInstance(),k=(0,l.default)(t).getInstance().getLogger(f),H(),f}$s.__dashjs_factory_name=`TextController`;var ec=i.default.getClassFactory($s);function tc(e){e||={};let t=this.context,n=(0,l.default)(t).getInstance(),r=e.settings,i=(0,p.default)(t).getInstance(),o,c,u,d,f,m;function _(){return navigator&&navigator.connection&&!isNaN(navigator.connection.downlink)&&navigator.connection.downlink>0?1e3*navigator.connection.downlink:NaN}function v(e,t,n,r){let i=.5**(n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;let o=.5**(n/r.slow);e.slowEstimate=(1-o)*t+o*e.slowEstimate,e.totalWeight+=n}function y(){o={},c={},u={},d={}}let b={addEntry:function(e,t){try{if(!(e&&t&&t.trace&&t.trace.length))return;(function(e){o[e]=o[e]||[],c[e]=c[e]||[],u[e]=u[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},d[e]=d[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}})(e);let n=t.tresponse.getTime()-t.trequest.getTime()||1,l=function(e,t){return e._fileLoaderType&&e._fileLoaderType===h.default.FILE_LOADER_TYPES.FETCH?function(e){let t=e.trace.reduce(((e,t)=>e+t.b[0]),0),n=e.trace.reduce(((e,t)=>e+t.d),0),i=NaN;return r.get().streaming.abr.throughput.useNetworkInformationApi.fetch&&(i=_()),isNaN(i)&&(i=Math.round(8*t/n)),{downloadedBytes:t,value:i,downloadTimeInMs:n}}(e):function(e,t){let n=NaN,i=NaN,o=!1;if(r.get().streaming.abr.throughput.useResourceTimingApi&&e._resourceTimingValues)n=e._resourceTimingValues.transferSize,i=e._resourceTimingValues.responseEnd-e._resourceTimingValues.responseStart,o=!0;else{if(e.trace.length<=1)return{throughput:NaN,downloadTimeInMs:NaN};n=e.trace.reduce(((e,t)=>e+t.b[0]),0)-e.trace[0].b[0],i=Math.max(e.trace.reduce(((e,t)=>e+t.d),0)-e.trace[0].d,1)}let c=NaN;if(!o&&r.get().streaming.abr.throughput.useNetworkInformationApi.xhr&&(c=_()),isNaN(c)){let e=r.get().streaming.abr.throughput.useDeadTimeLatency?i:i+t;c=Math.round(8*n/e)}return{downloadedBytes:n,value:c,downloadTimeInMs:i}}(e,t)}(t,n);if(l.latencyInMs=n,isNaN(l.value)||!isFinite(l.value))return;if(t.cmsd){let e=t.cmsd.dynamic&&t.cmsd.dynamic.etp?t.cmsd.dynamic.etp:null;if(e){let t=r.get().streaming.cmsd.abr.etpWeightRatio;t>0&&t<=1&&(l.value=l.value*(1-t)+e*t)}}if(function(e,t,n){return r.get().streaming.abr.throughput.useResourceTimingApi&&n._resourceTimingValues?n._resourceTimingValues.transferSize===0&&n._resourceTimingValues.decodedBodySize>0:!isNaN(t)&&(e===h.default.VIDEO?t<r.get().streaming.cacheLoadThresholds[h.default.VIDEO]:e===h.default.AUDIO?t<r.get().streaming.cacheLoadThresholds[h.default.AUDIO]:void 0)}(e,t._tfinish.getTime()-t.trequest.getTime(),t))return void m.debug(`${e} Assuming segment ${t.url} came from cache, ignoring it for throughput calculation`);m.debug(`Added throughput entry for ${e}: ${l.value} kbit/s`),l.serviceLocation=t._serviceLocation,o[e].push(l),c[e].push({value:n}),function(e){o[e].length>r.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&o[e].shift(),c[e].length>r.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&c[e].shift()}(e),i.trigger(g.default.THROUGHPUT_MEASUREMENT_STORED,{throughputValues:l}),t.type!==T.HTTPRequest.MPD_TYPE&&(v(u[e],l.value,r.get().streaming.abr.throughput.ewma.weightDownloadTimeMultiplicationFactor*l.downloadTimeInMs,f.bandwidthHalfLife),v(d[e],n,1,f.latencyHalfLife))}catch(e){m.error(e)}},getThroughputDict:function(e){return e?o[e]:o},getEwmaThroughputDict:function(e){return e?u[e]:u},getEwmaLatencyDict:function(e){return e?d[e]:d},getEwmaHalfLife:function(){return f},getLatencyDict:function(e){return e?c[e]:c},reset:y};return m=n.getLogger(b),f={bandwidthHalfLife:{fast:r.get().streaming.abr.throughput.ewma.throughputFastHalfLifeSeconds,slow:r.get().streaming.abr.throughput.ewma.throughputSlowHalfLifeSeconds},latencyHalfLife:{fast:r.get().streaming.abr.throughput.ewma.latencyFastHalfLifeCount,slow:r.get().streaming.abr.throughput.ewma.latencySlowHalfLifeCount}},y(),b}tc.__dashjs_factory_name=`ThroughputModel`;var nc=i.default.getClassFactory(tc);function rc(){let e=this.context,t=(0,p.default)(e).getInstance(),n,r,i;function o(){performance.clearResourceTimings()}function l(e){e.metric!==c.HTTP_REQUEST||!e.value||e.value.type!==T.HTTPRequest.MPD_TYPE&&(e.value.type!==T.HTTPRequest.MEDIA_SEGMENT_TYPE||e.mediaType!==h.default.AUDIO&&e.mediaType!==h.default.VIDEO)||n.addEntry(e.mediaType,e.value)}function u(e,t,o=null,c=NaN){let l,u=null,p=n.getEwmaHalfLife(),g=null,C=!0;switch(o||=i.get().streaming.abr.throughput.averageCalculationMode,e){case h.default.THROUGHPUT_TYPES.BANDWIDTH:u=o===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?n.getEwmaThroughputDict(t):n.getThroughputDict(t),g=p.bandwidthHalfLife,C=!0,c=isNaN(c)?r.getIsDynamic()?i.get().streaming.abr.throughput.sampleSettings.live:i.get().streaming.abr.throughput.sampleSettings.vod:c;break;case h.default.THROUGHPUT_TYPES.LATENCY:u=o===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?n.getEwmaLatencyDict(t):n.getLatencyDict(t),g=p.latencyHalfLife,C=!1,c=isNaN(c)?i.get().streaming.abr.throughput.sampleSettings.averageLatencySampleAmount:c}if(!u||u.length===0)return NaN;switch(o){case h.default.THROUGHPUT_CALCULATION_MODES.ARITHMETIC_MEAN:return l=d(u,c,e),f(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:return l=d(u,c,e),m(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_ARITHMETIC_MEAN:return l=d(u,c,e),_(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.HARMONIC_MEAN:return l=d(u,c,e),v(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:return l=d(u,c,e),y(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_HARMONIC_MEAN:return l=d(u,c,e),b(u,l);case h.default.THROUGHPUT_CALCULATION_MODES.EWMA:return x(u,g,C);case h.default.THROUGHPUT_CALCULATION_MODES.ZLEMA:return l=d(u,c,e),S(u,l)}}function d(e,t,n){if(e){if(t>=e.length)t=e.length;else if(n===h.default.THROUGHPUT_TYPES.BANDWIDTH&&i.get().streaming.abr.throughput.sampleSettings.enableSampleSizeAdjustment)for(let n=1;n<t;++n){let r=e[e.length-n].value/e[e.length-n-1].value;if((r>=i.get().streaming.abr.throughput.sampleSettings.increaseScale||r<=i.get().streaming.abr.throughput.sampleSettings.decreaseScale)&&(t+=1)===e.length)break}}else t=0;return t}function f(e,t){let n=e;return t!==0&&n&&n.length!==0?(n=n.slice(-t),n.reduce(((e,t)=>e+t.value),0)/n.length):NaN}function m(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0;return n.reduce(((e,t)=>{let n=Math.sqrt(t.downloadedBytes);return r+=n,e+t.value*n}),0)/r}function _(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0;return n.reduce(((e,t,n)=>{let i=n+1;return r+=i,e+t.value*i}),0)/r}function v(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=n.reduce(((e,t)=>e+1/t.value),0);return n.length/r}function y(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0,i=n.reduce(((e,t)=>{let n=Math.sqrt(t.downloadedBytes);return r+=n,e+1/t.value*n}),0);return r/i}function b(e,t){let n=e;if(t===0||!n||n.length===0)return NaN;n=n.slice(-t);let r=0,i=n.reduce(((e,t,n)=>{let i=n+1;return r+=i,e+1/t.value*i}),0);return r/i}function x(e,t,n=!0){if(!e||e.totalWeight<=0)return NaN;let r=e.fastEstimate/(1-.5**(e.totalWeight/t.fast)),i=e.slowEstimate/(1-.5**(e.totalWeight/t.slow));return n?Math.min(r,i):Math.max(r,i)}function S(e,t){if(t===0||!e||e.length===0)return NaN;let n=e.slice(-t).map((e=>e.value)),r=2/(n.length+1),i=n[n.length-1],o=n[n.length-1];for(let e=0;e<n.length;e++)i=r*n[e]+(1-r)*i,o=r*i+(1-r)*o;return o}function C(e,t=null,n=NaN){let r=u(h.default.THROUGHPUT_TYPES.BANDWIDTH,e,t,n);return Math.round(r)}let w={getArithmeticMean:f,getAverageLatency:function(e,t=null,n=NaN){let r=u(h.default.THROUGHPUT_TYPES.LATENCY,e,t,n);return Math.round(r)},getAverageThroughput:C,getByteSizeWeightedArithmeticMean:m,getByteSizeWeightedHarmonicMean:y,getDateWeightedArithmeticMean:_,getDateWeightedHarmonicMean:b,getEwma:x,getHarmonicMean:v,getRawThroughputData:function(e){return e?n.getThroughputDict(e):[]},getSafeAverageThroughput:function(e,t=null,n=NaN){let r=C(e,t,n);return isNaN(r)||(r*=i.get().streaming.abr.throughput.bandwidthSafetyFactor),r},getZlema:S,initialize:function(){n=nc(e).create({settings:i}),t.on(g.default.METRIC_ADDED,l,w),window.performance?.addEventListener?.(`resourcetimingbufferfull`,o)},reset:function(){n.reset(),t.off(g.default.METRIC_ADDED,l,w),window.performance?.removeEventListener?.(`resourcetimingbufferfull`,o)},setConfig:function(e){e.settings&&(i=e.settings),e.playbackController&&(r=e.playbackController)}};return w}rc.__dashjs_factory_name=`ThroughputController`;var ic=i.default.getSingletonFactory(rc);function ac(){let e=this.context,t=(0,p.default)(e).getInstance(),n=(0,u.default)(e).getInstance(),r,i,o,c;function l(e){c=e}function d(e,t,n,r){let i,o=t.adaptation.period.mpd,c=o.availabilityStartTime;if(r)i=n&&o.timeShiftBufferDepth!==1/0?new Date(c.getTime()+1e3*(e+o.timeShiftBufferDepth)):o.availabilityEndTime;else if(n){let n=t.availabilityTimeOffset;i=new Date(c.getTime()+1e3*(e-n))}else i=c;return i}function f(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*c)/1e3}function _(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function v(e){let t={start:NaN,end:NaN},n=e[0].getAdapter().getRegularPeriods()[0],r=f(new Date,n);if(!e||e.length===0)return{range:t,now:r};e.forEach((e=>{let n=e.getCurrentRepresentationForType(h.default.VIDEO);if(n||=e.getCurrentRepresentationForType(h.default.AUDIO),!n){let t=e.getAdapter(),r=t.getMediaInfoForType(e.getStreamInfo(),h.default.VIDEO)||t.getMediaInfoForType(e.getStreamInfo(),h.default.AUDIO);n=t.getVoRepresentations(r)[0]}let o={start:NaN,end:NaN};if(n)if(n.segmentInfoType===Y.default.SEGMENT_TIMELINE)o=function(e){let t=e.adaptation.period.mpd.manifest.Period[e.adaptation.period.index].AdaptationSet[e.adaptation.index],n=i.getRepresentationFor(e.index,t),r=n.SegmentTemplate||n.SegmentList,o=r.SegmentTimeline,c=r.timescale,l=o.S,u={start:0,end:0},d=l[0].t,f=!isNaN(d),p=f?d:0,m,h,g,v,y=0;for(f&&(u.start=_(p/c,e)),g=0,v=l.length;g<v;g++)m=l[g],h=0,m.hasOwnProperty(`r`)&&(h=m.r),y+=m.d*(1+h);return u.end=_((p+y)/c,e),u}(n);else{let e=n.adaptation.period;o.start=e.start,o.end=Math.max(r,e.start+e.duration)}!isNaN(o.start)&&(isNaN(t.start)||t.start>o.start)&&(t.start=o.start),!isNaN(o.end)&&(isNaN(t.end)||t.end<o.end)&&(t.end=o.end)})),t.end=Math.min(r,t.end);let o=b(e,t.end,!0);return t.end=isNaN(o)?t.end:o,t.start=n&&n.mpd&&n.mpd.timeShiftBufferDepth&&!isNaN(n.mpd.timeShiftBufferDepth)&&!isNaN(t.end)?Math.max(t.end-n.mpd.timeShiftBufferDepth,t.start):t.start,t.start=b(e,t.start),{range:t,now:r}}function y(e,t){o=e-t.end}function b(e,t,n=!1){try{let r=0,i=!1,o=NaN;for(;!i&&r<e.length;){let c=e[r].getStreamInfo();c.start<=t&&(!isFinite(c.duration)||c.start+c.duration>=t)?(o=t,i=!0):!n&&c.start>t&&(isNaN(o)||c.start<o)?o=c.start:n&&c.start+c.duration<t&&(isNaN(o)||c.start+c.duration>o)&&(o=c.start+c.duration),r+=1}return o}catch{return t}}function x(e){e.offset===void 0||isNaN(e.offset)||l(e.offset/1e3)}function S(){c=0,o=0}function C(){t.off(m.default.UPDATE_TIME_SYNC_OFFSET,x,this),S()}return r={calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return d(e,t,n,!0)},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return d(e,t,n)},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcPresentationTimeFromMediaTime:_,calcPresentationTimeFromWallTime:f,calcTimeShiftBufferWindow:function(e,r){if(!r)return function(e){let t={start:NaN,end:NaN},n=0,r=NaN;return e.forEach((e=>{let t=e.getStreamInfo();n+=t.duration,(isNaN(r)||t.start<r)&&(r=t.start)})),t.start=r,t.end=r+n,t}(e);if(n.get().streaming.timeShiftBuffer.calcFromSegmentTimeline){let t=v(e);return y(t.now,t.range),t.range}return function(e){let r={start:NaN,end:NaN};if(!e||e.length===0)return r;let i=e[0].getAdapter().getRegularPeriods()[0],o=f(new Date,i),c=i.mpd.timeShiftBufferDepth;if(r.start=b(e,isNaN(c)?0:o-c),r.end=!isNaN(r.start)&&o<r.start?o:b(e,o,!0),!isNaN(c)&&r.end<o-c&&(r.end=NaN),n.get().streaming.timeShiftBuffer.fallbackToSegmentTimeline){let n=v(e);if(n.range.end<r.start)return t.trigger(g.default.CONFORMANCE_VIOLATION,{level:cs.LEVELS.WARNING,event:cs.EVENTS.INVALID_DVR_WINDOW}),y(n.now,n.range),n.range}return r}(e)},calcWallTimeForSegment:function(e,t){let n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},getClientReferenceTime:function(){return Date.now()-1e3*o+1e3*c},getClientTimeOffset:function(){return c},initialize:function(){S(),t.on(m.default.UPDATE_TIME_SYNC_OFFSET,x,this)},reset:C,setClientTimeOffset:l,setConfig:function(e){e&&e.dashManifestModel&&(i=e.dashManifestModel)}},i=yt(e).getInstance(),C(),r}ac.__dashjs_factory_name=`TimelineConverter`;var oc=i.default.getSingletonFactory(ac),sc=class{constructor(){this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null}};function cc(){let e,t;return e={initialize:function(e){if(t=new sc,!e)return null;let n=e.indexOf(`#`);if(n!==-1){let r=e.substr(n+1).split(`&`);for(let e=0,n=r.length;e<n;++e){let n=r[e],i=n.indexOf(`=`);if(i!==-1){let e=n.substring(0,i);t.hasOwnProperty(e)&&(t[e]=n.substr(i+1))}}}},getURIFragmentData:function(){return t}},e}cc.__dashjs_factory_name=`URIFragmentModel`;var lc=i.default.getSingletonFactory(cc);let uc=new Map([[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,`loadedmetadata`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA,`loadeddata`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,`canplay`],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA,`canplaythrough`]]);function dc(){let e,t,n,r,i,o,c,d,f,g,_,v,y=this.context,b=(0,p.default)(y).getInstance(),x=[];function S(e,t=!1){n&&(t?n.playbackRate=e:N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,(()=>{n.playbackRate=e})))}function C(){return x.length>0}function w(e){let t=x.indexOf(e);if(e!==null&&(t!==-1&&x.splice(t,1),g.get().streaming.buffer.syntheticStallEvents.enabled&&n&&!C())){let e=()=>{if(S(o||1,g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState),!n.paused){let e=document.createEvent(`Event`);e.initEvent(`playing`,!0,!1),n.dispatchEvent(e)}};g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState?e():(d&&d.func&&d.event&&D(d.event,d.func),d=N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,e))}}function T(){if(n&&C()&&n.playbackRate===0){let e=document.createEvent(`Event`);e.initEvent(`waiting`,!0,!1),n.dispatchEvent(e)}}function E(e,t){n&&n.addEventListener(e,t)}function D(e,t){n&&n.removeEventListener(e,t)}function O(){return n?n.readyState:NaN}function k(){return n?n.buffered:null}function A(){return n?n.clientWidth:NaN}function j(){return n?n.clientHeight:NaN}function M(e,t,r,i,o){if(n){for(let c=0;c<n.textTracks.length;c++)if(n.textTracks[c].kind===e&&(!t||n.textTracks[c].label==t)&&n.textTracks[c].language===r&&n.textTracks[c].isTTML===i&&n.textTracks[c].isEmbedded===o)return n.textTracks[c]}return null}function N(e,t){return e===h.default.VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING||O()>=e?(t(),null):function(e,t){let n=()=>{D(e,n),t(e)};return E(e,n),{func:n,event:e}}(uc.get(e),t)}return r={addEventListener:E,addTextTrack:function(e,t,r,i,o){if(!n)return null;let c=M(e,t,r,i,o);return c||(c=n.addTextTrack(e,t,r),c.isEmbedded=o,c.isTTML=i),c},appendChild:function(e){n&&(n.appendChild(e),e.isTTML!==void 0&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},getBufferRange:k,getClientHeight:j,getClientWidth:A,getElement:function(){return n},getEnded:function(){return n?n.ended:null},getPlaybackQuality:function(){if(!n)return null;let e=`webkitDroppedFrameCount`in n&&`webkitDecodedFrameCount`in n,t=null;return`getVideoPlaybackQuality`in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},getPlaybackRate:function(){return n?n.playbackRate:null},getPlayedRanges:function(){return n?n.played:null},getReadyState:O,getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return e},getTextTrack:M,getTextTracks:function(){return n?n.textTracks:[]},getTime:function(){return n?isNaN(t)?n.currentTime:t:null},getVideoElementSize:function(){let e=g.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty(`devicePixelRatio`)?window.devicePixelRatio:1;return{elementWidth:A()*e,elementHeight:j()*e}},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetLeft:function(){if(n){let e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN}return NaN},getVideoRelativeOffsetTop:function(){if(n){let e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN}return NaN},getVideoWidth:function(){return n?n.videoWidth:NaN},getVttRenderingDiv:function(){return v},initialize:function(){b.on(m.default.PLAYBACK_PLAYING,T,this)},isPaused:function(){return n?n.paused:null},isSeeking:function(){return n?n.seeking||!isNaN(t):null},isStalled:C,pause:function(){n&&(n.pause(),n.autoplay=!1)},play:function(){if(n){n.autoplay=!0;let e=n.play();e&&e.catch&&typeof Promise<`u`&&e.catch((e=>{e.name===`NotAllowedError`&&b.trigger(m.default.PLAYBACK_NOT_ALLOWED),i.warn(`Caught pending play exception - continuing (${e})`)}))}},removeChild:function(e){n&&n.removeChild(e)},removeEventListener:D,reset:function(){clearTimeout(_),b.off(m.default.PLAYBACK_PLAYING,T,this),x.length=0,function(){try{c&&n&&(c.unobserve(n),c.disconnect(),c=null)}catch{}}()},setConfig:function(e){e&&e.settings&&(g=e.settings)},setCurrentTime:function(e,r){n&&(f&&f.func&&f.event&&D(f.event,f.func),t=e,f=N(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(()=>{if(n)if(n.currentTime!==t)try{t=r?function(e){let t=k(),n=e,r=9999999999;if(t)for(let i=0;i<t.length;i++){let o=t.start(i),c=t.end(i),l=Math.abs(o-e),u=Math.abs(c-e);if(e>=o&&e<=c)return e;l<r&&(r=l,n=o),u<r&&(r=u,n=c)}return n}(t):t,isNaN(t)||(n.currentTime=t),t=NaN}catch(e){n.readyState===0&&e.code===e.INVALID_STATE_ERR&&(_=setTimeout((function(){n.currentTime=t,t=NaN}),400))}else t=NaN})))},setDisableRemotePlayback:function(e){n&&(n.disableRemotePlayback=e)},setElement:function(e){if(!(e==null||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw`element is not video or audio DOM type!`;n=e,function(e){try{if(!c||!e)return;c.observe(e)}catch{}}(n)},setPlaybackRate:S,setSource:function(e){n&&(e?n.src=e:(n.removeAttribute(`src`),n.load()))},setStallState:function(e,t){(function(e,t){t?function(e){if(e!==null&&n&&!n.seeking&&x.indexOf(e)===-1&&(x.push(e),g.get().streaming.buffer.syntheticStallEvents.enabled&&n&&x.length===1&&(g.get().streaming.buffer.syntheticStallEvents.ignoreReadyState||O()>=h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA))){o=n.playbackRate,S(0,!0);let e=document.createEvent(`Event`);e.initEvent(`waiting`,!0,!1),n.dispatchEvent(e)}}(e):w(e)})(e,t)},setTTMLRenderingDiv:function(t){e=t,e.style.position=`absolute`,e.style.display=`flex`,e.style.overflow=`hidden`,e.style.pointerEvents=`none`,e.style.top=0,e.style.left=0},setVttRenderingDiv:function(e){v=e},waitForReadyState:N},i=(0,l.default)(y).getInstance().getLogger(r),g=(0,u.default)(y).getInstance(),t=NaN,function(){try{c=new ResizeObserver((()=>{b.trigger(m.default.VIDEO_ELEMENT_RESIZED)}))}catch{}}(),r}dc.__dashjs_factory_name=`VideoModel`;var fc=i.default.getSingletonFactory(dc),pc=r(8986);function mc(){let e=`You must first call initialize() and set a source before calling this method`,t=`You must first call initialize() and set a valid source and view before calling this method`,n=`You must first call attachView() to set the video element before calling this method`,r=`You must first call attachSource() with a valid source before calling this method`,o=`MediaPlayer not initialized!`,d=this.context,f=(0,p.default)(d).getInstance(),_=(0,u.default)(d).getInstance(),v=(0,l.default)(d).getInstance({settings:_}),y,b,x,S,C,w,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,ee,q,te,ne,re,ie,J,ae,oe,se,ce,le,ue,de;function fe(){Oe(null),Ee(null),S=null,P&&=(P.reset(),null),F&&=(F.reset(),null),B&&B.reset(),_.reset(),L&&=(L.reset(),null)}function pe(){return!!x&&!!se.getElement()}function me(){return(0,pc.getVersionString)()}function he(){if(!E)throw t;return q.isPaused()}function ge(){if(!E)throw t;return q.getIsDynamic()}function _e(e){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);return n?ve(n.range.start+e,n):0}function ve(e,t){let n=q.getOriginalLiveDelay();return e>t.range.end-n&&(e=t.range.end-n),e}function ye(e=``){if(!E)throw t;let n=we().currentTime;return e!==``&&(n=G.getTimeRelativeToStreamId(n,e)),n}function be(e){(0,Ve.checkParameterType)(e,`boolean`),D=e}function Se(){B.restoreDefaultUTCTimingSources()}function Ce(){return ie}function we(){if(!se.getElement())throw n;return se.getElement()}function Ee(e){if(!C)throw o;se.setElement(e),e&&(Pe(),function(){if(F||typeof dashjs>`u`)return;let e=dashjs.MetricsReporting;typeof e==`function`&&(F=e(d).create().createMetricsReporting({debug:v,eventBus:f,mediaElement:we(),adapter:R,dashMetrics:ie,mediaPlayerModel:z,events:m.default,constants:h.default,metricsConstants:c}))}(),function(){if(I||typeof dashjs>`u`)return;let e=dashjs.MssHandler;typeof e==`function`&&(Ne.extend(e.errors),I=e(d).create({eventBus:f,mediaPlayerModel:z,dashMetrics:ie,manifestModel:J,playbackController:q,streamController:G,protectionController:P,baseURLController:H,errHandler:V,events:m.default,constants:h.default,debug:v,initSegmentType:T.HTTPRequest.INIT_SEGMENT_TYPE,BASE64:Te,ISOBoxer:xr,settings:_}))}(),G&&G.switchToVideoElement(O)),E&&(Ae(),je()),Ie(O)}function De(t){if(!w)throw e;let n=G.getActiveStreamInfo();return n?N.getTracksFor(t,n.id).filter((e=>!P||P.areKeyIdsUsable(e.normalizedKeyIds))):[]}function Oe(e,t=NaN){if(!C)throw o;typeof e==`string`&&ce.initialize(e),t??=NaN,isNaN(t)||(t=Math.max(0,t)),O=t,x=e,(w||E)&&(Ae(),je()),pe()&&Ie(O)}function ke(){if(!w)throw e;let t=G.getActiveStreamInfo();return t?G.getStreamById(t.id):null}function Ae(){E=!1,w=!1,R.reset(),G.reset(),ee.reset(),re.reset(),q.reset(),te.reset(),ne.reset(),k.reset(),A.reset(),N.reset(),ue.reset(),P&&(_.get().streaming.protection.keepProtectionMediaKeys?P.stop():(P.reset(),P=null,Pe())),K.reset(),ae.reset(),oe.reset()}function je(){B.resetPlaybackSessionSpecificSettings()}function Me(){return ba(d).create({debug:v,errHandler:V,dashMetrics:ie,mediaPlayerModel:z,mssHandler:I,settings:_})}function Pe(){if(P)return P;if(typeof dashjs>`u`)return null;let e=dashjs.Protection;if(typeof e==`function`){let t=e(d).create();return m.default.extend(e.events),g.default.extend(e.events,{publicOnly:!0}),Ne.extend(e.errors),P=t.createProtectionSystem({debug:v,errHandler:V,videoModel:se,customParametersModel:B,capabilities:U,eventBus:f,events:m.default,BASE64:Te,constants:h.default,cmcdModel:ae,settings:_}),U||=(0,Tr.default)(d).getInstance(),U.setProtectionController(P),P}return null}function Fe(){if(!C)throw o;if(L)return L;if(typeof dashjs>`u`)return null;let e=dashjs.OfflineController;if(typeof e==`function`){m.default.extend(e.events),g.default.extend(e.events,{publicOnly:!0}),Ne.extend(e.errors);let t=Me(),n=Ea(d).create();return n.setConfig({manifestModel:J,adapter:R,manifestLoader:t,errHandler:V,contentSteeringController:ne}),L=e(d).create({debug:v,manifestUpdater:n,baseURLController:H,manifestLoader:t,manifestModel:J,mediaPlayerModel:z,abrController:k,playbackController:q,adapter:R,errHandler:V,dashMetrics:ie,timelineConverter:M,segmentBaseController:ue,schemeLoaderFactory:j,eventBus:f,events:m.default,errors:Ne,constants:h.default,settings:_,dashConstants:Y.default,urlUtils:ht(d).getInstance()}),L}return null}function Ie(e=NaN){L&&L.resetRecords(),!w&&x&&(w=!0,b.info(`Streaming Initialized`),function(){let e=Me();G||=fs(d).getInstance(),K||=ec(d).create({errHandler:V,manifestModel:J,adapter:R,mediaController:N,baseURLController:H,videoModel:se,settings:_}),W.setConfig({capabilities:U,customParametersModel:B,adapter:R,settings:_,protectionController:P,manifestModel:J,errHandler:V}),G.setConfig({capabilities:U,capabilitiesFilter:W,manifestLoader:e,manifestModel:J,mediaPlayerModel:z,customParametersModel:B,protectionController:P,textController:K,adapter:R,dashMetrics:ie,errHandler:V,timelineConverter:M,videoModel:se,playbackController:q,serviceDescriptionController:te,contentSteeringController:ne,abrController:k,throughputController:A,mediaController:N,settings:_,baseURLController:H,uriFragmentModel:ce,segmentBaseController:ue}),ee.setConfig({settings:_,playbackController:q,streamController:G,videoModel:se,timelineConverter:M,adapter:R}),q.setConfig({streamController:G,serviceDescriptionController:te,dashMetrics:ie,adapter:R,videoModel:se,timelineConverter:M,settings:_}),re.setConfig({streamController:G,playbackController:q,mediaPlayerModel:z,videoModel:se,settings:_}),A.setConfig({settings:_,playbackController:q}),k.setConfig({streamController:G,capabilities:U,domStorage:le,mediaPlayerModel:z,customParametersModel:B,throughputController:A,cmsdModel:oe,dashMetrics:ie,adapter:R,videoModel:se,settings:_}),ae.setConfig({abrController:k,dashMetrics:ie,playbackController:q,serviceDescriptionController:te,throughputController:A}),de.setConfig({serviceDescriptionController:te}),oe.setConfig({}),N.initialize(),A.initialize(),k.initialize(),G.initialize(D,S),K.initialize(),ee.initialize(),re.initialize(),ae.initialize(D),oe.initialize(),ne.initialize(),ue.initialize()}(),typeof x==`string`?G.load(x,e):G.loadWithManifest(x,e)),!E&&pe()&&(E=!0,f.trigger(g.default.PLAYBACK_INITIALIZED),b.info(`Playback Initialized`))}return y={addABRCustomRule:function(e,t,n){B.addAbrCustomRule(e,t,n)},addExternalSubtitle:function(e){e instanceof Ki.default||b.error(`Invalid external subtitle object. Must be an instance of dashjs.ExternalSubtitle`),B.addExternalSubtitle(e)},addRequestInterceptor:function(e){B.addRequestInterceptor(e)},addResponseInterceptor:function(e){B.addResponseInterceptor(e)},addUTCTimingSource:function(e,t){B.addUTCTimingSource(e,t)},attachProtectionController:function(e){P=e},attachSource:Oe,attachTTMLRenderingDiv:function(e){if(!se.getElement())throw n;se.setTTMLRenderingDiv(e)},attachView:Ee,attachVttRenderingDiv:function(e){if(!se.getElement())throw n;se.setVttRenderingDiv(e)},clearDefaultUTCTimingSources:function(){B.clearDefaultUTCTimingSources()},convertToTimeCode:function(e){e=Math.max(e,0);let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(t===0?``:t<10?`0`+t.toString()+`:`:t.toString()+`:`)+(n<10?`0`+n.toString():n.toString())+`:`+(r<10?`0`+r.toString():r.toString())},destroy:function(){fe(),i.default.deleteSingletonInstances(d)},duration:function(){if(!E)throw t;let e=we().duration;if(q.getIsDynamic()){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e},enableForcedTextStreaming:function(e){return!(!G.getActiveStreamInfo()||!K)&&K.enableForcedTextStreaming(e)},enableText:function(e){let t=G.getActiveStreamInfo();return!(!t||!K)&&K.enableText(t.id,e)},extend:function(e,t,n){i.default.extend(e,t,n,d)},formatUTC:function(e,t,n,r=!1){let i=new Date(1e3*e),o=i.toLocaleDateString(t),c=i.toLocaleTimeString(t,{hour12:n});return r?c+` `+o:c},getABRCustomRules:function(){return B.getAbrCustomRules()},getActiveStream:ke,getAutoPlay:function(){return D},getAvailableBaseUrls:function(){let e=J.getValue();return e?H.getBaseUrls(e):[]},getAvailableLocations:function(){let e=J.getValue();if(!e)return[];let t=R.getLocation(e),n=ne.getSynthesizedLocationElements(t);return t.concat(n)},getAverageLatency:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getAverageLatency(e,t,n):0},getAverageThroughput:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getAverageThroughput(e,t,n):0},getBufferLength:function(e){let t=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT];if(e)return t.indexOf(e)===-1?(b.warn(`getBufferLength requested for invalid type`),NaN):Ce().getCurrentBufferLevel(e)||NaN;{let e=t.map((e=>De(e).length>0?Ce().getCurrentBufferLevel(e):Number.MAX_VALUE)).reduce(((e,t)=>Math.min(e,t)));return e===Number.MAX_VALUE?NaN:e}},getCurrentLiveLatency:function(){if(!C)throw o;return E?q.getCurrentLiveLatency():NaN},getCurrentRepresentationForType:function(t){if(!w)throw e;if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return null;let n=ke();if(!n)return null;if(t===h.default.IMAGE){let e=n.getThumbnailController();return e?e.getCurrentTrack():-1}return n.getCurrentRepresentationForType(t)},getCurrentSteeringResponseData:function(){if(ne)return ne.getCurrentSteeringResponseData()},getCurrentTextTrackIndex:function(){let e=NaN,t=G.getActiveStreamInfo();if(t&&K)return e=K.getCurrentTrackIdx(t.id),e},getCurrentTrackFor:function(t){if(!w)throw e;let n=G.getActiveStreamInfo();return n?N.getCurrentTrackFor(t,n.id):null},getDashAdapter:function(){return R},getDashMetrics:Ce,getDebug:function(){return v},getDvrSeekOffset:_e,getDvrWindow:function(){if(!E)throw t;let e=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(e);if(!n)return{};let r=0,i=q.getIsDynamic();return i&&(r=n.manifestInfo.availableFrom.getTime()/1e3),{start:n.range.start,end:n.range.end,startAsUtc:i?r+n.range.start:NaN,endAsUtc:i?r+n.range.end:NaN,size:n.range.end-n.range.start}},getExternalSubtitles:function(){B.getExternalSubtitles()},getInitialMediaSettingsFor:function(e){if(!C)throw o;return N.getInitialSettings(e)},getLowLatencyModeEnabled:function(){if(!E)throw t;return q.getLowLatencyModeEnabled()},getManifest:function(){return J.getValue()},getOfflineController:function(){return Fe()},getPlaybackRate:function(){return we().playbackRate},getProtectionController:function(){return Pe()},getRawThroughputData:function(e=h.default.VIDEO){return A?A.getRawThroughputData(e):[]},getRepresentationsByType:function(t,n=null){if(!w)throw e;let r=n?G.getStreamById(n):ke();return r?r.getRepresentationsByType(t):[]},getSafeAverageThroughput:function(e=h.default.VIDEO,t=null,n=NaN){return A?A.getSafeAverageThroughput(e,t,n):0},getSettings:function(){return _.get()},getSource:function(){if(!x)throw r;return x},getStreamsFromManifest:function(t){if(!w)throw e;return R.getStreamsInfo(t)},getTTMLRenderingDiv:function(){return se?se.getTTMLRenderingDiv():null},getTargetLiveDelay:function(){if(!E)throw t;return q.getOriginalLiveDelay()},getTracksFor:De,getTracksForTypeFromManifest:function(t,n,r){if(!w)throw e;return(r||=R.getStreamsInfo(n,1)[0])?R.getAllMediaInfoForType(r,t,n):[]},getVersion:me,getVideoElement:we,getVolume:function(){return we().volume},getXHRWithCredentialsForType:function(e){return B.getXHRWithCredentialsForType(e)},initialize:function(e,t,n,r=NaN){U||(U=(0,Tr.default)(d).getInstance(),U.setConfig({settings:_,protectionController:P})),V||=Gi(d).getInstance(),U.supportsMediaSource()?(C||(C=!0,M=oc(d).getInstance(),A||=ic(d).getInstance(),k||=xe(d).getInstance(),j||=ir(d).getInstance(),q||=Na(d).getInstance(),N||=ka(d).getInstance(),G||=fs(d).getInstance(),ee||=Ji(d).getInstance(),re||=Nr(d).getInstance(),te||=Ja(d).getInstance(),ne||=ur(d).getInstance(),W||=jr(d).getInstance(),R=Ti(d).getInstance(),J=Sa(d).getInstance(),ae=Rn(d).getInstance(),oe=Gn(d).getInstance(),de=Xn(d).getInstance(),ie=Ui(d).getInstance({settings:_}),le=Vr(d).getInstance({settings:_}),R.setConfig({constants:h.default,cea608parser:new Ns,errHandler:V,BASE64:Te}),H||=gr(d).create(),H.setConfig({adapter:R,contentSteeringController:ne}),te.setConfig({adapter:R}),ue||=Ua(d).getInstance({dashMetrics:ie,mediaPlayerModel:z,errHandler:V,baseURLController:H,events:m.default,eventBus:f,debug:v,boxParser:wr(d).getInstance(),errors:Ne}),N.setConfig({domStorage:le,settings:_,mediaPlayerModel:z,customParametersModel:B,videoModel:se}),z.setConfig({playbackController:q,serviceDescriptionController:te}),ne.setConfig({adapter:R,errHandler:V,dashMetrics:ie,mediaPlayerModel:z,manifestModel:J,serviceDescriptionController:te,throughputController:A,eventBus:f}),Se(),be(n===void 0||n),Fe()),e&&Ee(e),t&&Oe(t,r),b.info(`[dash.js `+me()+`] MediaPlayer has been initialized`)):V.error(new Be.default(Ne.CAPABILITY_MEDIASOURCE_ERROR_CODE,Ne.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},isDynamic:ge,isMuted:function(){return we().muted},isPaused:he,isReady:pe,isSeeking:function(){if(!E)throw t;return q.isSeeking()},isTextEnabled:function(){let e=G.getActiveStreamInfo();return!(!e||!K)&&K.isTextEnabled(e)},off:function(e,t,n){f.off(e,t,n)},on:function(e,t,n,r){f.on(e,t,n,r)},pause:function(){if(!E)throw t;q.pause()},play:function(){if(!E)throw t;(!D||he()&&E)&&q.play(!0)},preload:function(){if(!se.getElement()&&!w){if(!x)throw r;Ie(O)}},provideThumbnail:function(e,t){if(typeof t!=`function`)return;if(e<0)return void t(null);let n=q.getIsDynamic()?_e(e):e,r=G.getStreamForTime(n);if(r===null)return void t(null);let i=r.getThumbnailController();if(i)return i.provide(n,t);t(null)},refreshManifest:function(e){if(!C)throw o;if(!pe())return e(null,r);let t=this;if(typeof e==`function`){let n=function(r){f.off(m.default.INTERNAL_MANIFEST_LOADED,n,t),r.error?e(null,r.error):e(r.manifest)};f.on(m.default.INTERNAL_MANIFEST_LOADED,n,t)}G.refreshManifest()},registerCustomCapabilitiesFilter:function(e){B.registerCustomCapabilitiesFilter(e)},registerLicenseRequestFilter:function(e){B.registerLicenseRequestFilter(e)},registerLicenseResponseFilter:function(e){B.registerLicenseResponseFilter(e)},removeABRCustomRule:function(e){B.removeAbrCustomRule(e)},removeAllABRCustomRule:function(){B.removeAllAbrCustomRule()},removeExternalSubtitleById:function(e){B.removeExternalSubtitleById(e)},removeExternalSubtitleByUrl:function(e){B.removeExternalSubtitleByUrl(e)},removeRequestInterceptor:function(e){B.removeRequestInterceptor(e)},removeResponseInterceptor:function(e){B.removeResponseInterceptor(e)},removeUTCTimingSource:function(e,t){B.removeUTCTimingSource(e,t)},reset:fe,resetCustomInitialTrackSelectionFunction:function(){B.resetCustomInitialTrackSelectionFunction(null)},resetSettings:function(){_.reset()},restoreDefaultUTCTimingSources:Se,retrieveManifest:function(e,t){let n=Me(),r=this,i=function(e){e.error?t(null,e.error):t(e.manifest),f.off(m.default.INTERNAL_MANIFEST_LOADED,i,r),n.reset()};f.on(m.default.INTERNAL_MANIFEST_LOADED,i,r),ce.initialize(e),n.load(e)},seek:function(e){if(!E)throw t;if((0,Ve.checkParameterType)(e,`number`),isNaN(e))throw h.default.BAD_ARGUMENT_ERROR;e<0&&(e=0);let n=q.getIsDynamic()?_e(e):e,r=we();!q.getIsDynamic()&&r.duration&&(n=Math.min(r.duration,n)),q.seek(n,!1,!1,!0)},seekToOriginalLive:function(){E&&ge()&&q.seekToOriginalLive()},seekToPresentationTime:function(e){if(!E)throw t;if((0,Ve.checkParameterType)(e,`number`),isNaN(e))throw h.default.BAD_ARGUMENT_ERROR;e<0&&(e=0);let n=we();if(!q.getIsDynamic()&&n.duration&&(e=Math.min(n.duration,e)),q.getIsDynamic()){let t=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n=ie.getCurrentDVRInfo(t);if(!n)return;(e=ve(e,n))<n.range.start&&(e=n.range.start)}q.seek(e,!1,!1,!0)},setAutoPlay:be,setConfig:function(e){e&&(e.capabilities&&(U=e.capabilities),e.capabilitiesFilter&&(W=e.capabilitiesFilter),e.streamController&&(G=e.streamController),e.textController&&(K=e.textController),e.gapController&&(ee=e.gapController),e.throughputController&&(A=e.throughputController),e.playbackController&&(q=e.playbackController),e.serviceDescriptionController&&(te=e.serviceDescriptionController),e.contentSteeringController&&(ne=e.contentSteeringController),e.clientDataReportingController&&(de=e.clientDataReportingController),e.catchupController&&(re=e.catchupController),e.mediaPlayerModel&&(z=e.mediaPlayerModel),e.customParametersModel&&(B=e.customParametersModel),e.abrController&&(k=e.abrController),e.schemeLoaderFactory&&(j=e.schemeLoaderFactory),e.mediaController&&(N=e.mediaController),e.settings&&(_=e.settings),e.dashMetrics&&(ie=e.dashMetrics))},setCurrentTrack:function(t,n=!1){if(!w)throw e;!P||P.areKeyIdsUsable(t.normalizedKeyIds)?N.setTrack(t,{noSettingsSave:n}):b.error(`Can not switch to track with index ${t.index} because key is not usable`)},setCustomInitialTrackSelectionFunction:function(e){B.setCustomInitialTrackSelectionFunction(e)},setInitialMediaSettingsFor:function(e,t){if(!C)throw o;let n=function(e){let t=_.get().streaming.defaultSchemeIdUri,n={};function r(e,t,n){let r={};if(t){if(t instanceof Array)throw`Array type not supported for settings!`;return t instanceof Object?(r.schemeIdUri=t.schemeIdUri?t.schemeIdUri:``,r.value=t.value?t.value:``):(r.schemeIdUri=n,r.value=t,b.warn(`No schemeIdUri provided for `+e+`, using default "`+n+`"`)),r}return null}return e.id!==void 0&&(n.id=e.id),e.lang!==void 0&&(n.lang=e.lang),isNaN(e.index)||(n.index=e.index),e.viewpoint!==void 0&&(n.viewpoint=r(`viewpoint`,e.viewpoint,t.viewpoint)),e.audioChannelConfiguration!==void 0&&(n.audioChannelConfiguration=r(`audioChannelConfiguration`,e.audioChannelConfiguration,t.audioChannelConfiguration)),e.role!==void 0&&e.role!==null&&(n.role=r(`role`,e.role,t.role),n.role.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&n.role.value===`Main`&&(n.role.value=Y.default.MAIN)),e.accessibility!==void 0&&(n.accessibility=r(`accessibility`,e.accessibility,t.accessibility)),n}(t);N.setInitialSettings(e,n)},setMute:function(e){(0,Ve.checkParameterType)(e,`boolean`),we().muted=e},setPlaybackRate:function(e){we().playbackRate=e},setProtectionData:function(e){S=e,G&&G.setProtectionData(S)},setRepresentationForTypeById:function(t,n,r=!1){if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return;if(!w)throw e;let i=ke();if(i)if(t===h.default.IMAGE){let e=i.getThumbnailController();e&&e.setTrackById(n)}else{let e=i.getRepresentationForTypeById(t,n);e&&k.manuallySetPlaybackQuality(t,G.getActiveStreamInfo(),e,{forceReplace:r})}},setRepresentationForTypeByIndex:function(t,n,r=!1){if(t!==h.default.IMAGE&&t!==h.default.VIDEO&&t!==h.default.AUDIO)return;if(!w)throw e;let i=ke();if(i)if(t===h.default.IMAGE){let e=i.getThumbnailController();e&&e.setTrackByIndex(n)}else{let e=i.getRepresentationForTypeByIndex(t,n);e&&k.manuallySetPlaybackQuality(t,G.getActiveStreamInfo(),e,{forceReplace:r})}},setTextTrack:function(e){if(!E)throw t;let n=G.getActiveStreamInfo();n&&K&&K.setTextTrack(n.id,e)},setVolume:function(e){if(typeof e!=`number`||isNaN(e)||e<0||e>1)throw h.default.BAD_ARGUMENT_ERROR;we().volume=e},setXHRWithCredentialsForType:function(e,t){B.setXHRWithCredentialsForType(e,t)},time:ye,timeAsUTC:function(){if(!E)throw t;if(!q.getIsDynamic()||ye()<0)return NaN;let e=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,n,r,i=ie.getCurrentDVRInfo(e);return i?(n=i.manifestInfo.availableFrom.getTime()/1e3,r=n+ye(),r):0},timeInDvrWindow:function(){if(!E)throw t;if(!q.getIsDynamic())return ye();let e=we().currentTime,n=G&&G.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,r=ie.getCurrentDVRInfo(n);return e=r===null||e===0?0:Math.max(0,e-r.range.start),e},trigger:function(e,t,n){f.trigger(e,t,n)},triggerSteeringRequest:function(){if(ne)return ne.loadSteeringData()},unregisterCustomCapabilitiesFilter:function(e){B.unregisterCustomCapabilitiesFilter(e)},unregisterLicenseRequestFilter:function(e){B.unregisterLicenseRequestFilter(e)},unregisterLicenseResponseFilter:function(e){B.unregisterLicenseResponseFilter(e)},updateSettings:function(e){_.update(e)},updateSource:function(e){x=e,G.load(x)}},b=v.getLogger(y),C=!1,E=!1,w=!1,D=!0,O=NaN,P=null,L=null,S=null,R=null,ue=null,m.default.extend(g.default),z=ja(d).getInstance(),B=(0,Kn.default)(d).getInstance(),se=fc(d).getInstance(),ce=lc(d).getInstance(),y}mc.__dashjs_factory_name=`MediaPlayer`;let hc=i.default.getClassFactory(mc);hc.events=g.default,hc.errors=Ne,i.default.updateClassFactory(mc.__dashjs_factory_name,hc);var gc=hc},1191:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.AST_IN_FUTURE=`astInFuture`,this.BASE_URLS_UPDATED=`baseUrlsUpdated`,this.BUFFER_EMPTY=`bufferStalled`,this.BUFFER_LOADED=`bufferLoaded`,this.BUFFER_LEVEL_STATE_CHANGED=`bufferStateChanged`,this.BUFFER_LEVEL_UPDATED=`bufferLevelUpdated`,this.DVB_FONT_DOWNLOAD_ADDED=`dvbFontDownloadAdded`,this.DVB_FONT_DOWNLOAD_COMPLETE=`dvbFontDownloadComplete`,this.DVB_FONT_DOWNLOAD_FAILED=`dvbFontDownloadFailed`,this.DYNAMIC_TO_STATIC=`dynamicToStatic`,this.ERROR=`error`,this.FRAGMENT_LOADING_COMPLETED=`fragmentLoadingCompleted`,this.FRAGMENT_LOADING_PROGRESS=`fragmentLoadingProgress`,this.FRAGMENT_LOADING_STARTED=`fragmentLoadingStarted`,this.FRAGMENT_LOADING_ABANDONED=`fragmentLoadingAbandoned`,this.LOG=`log`,this.MANIFEST_LOADING_STARTED=`manifestLoadingStarted`,this.MANIFEST_LOADING_FINISHED=`manifestLoadingFinished`,this.MANIFEST_LOADED=`manifestLoaded`,this.METRICS_CHANGED=`metricsChanged`,this.METRIC_CHANGED=`metricChanged`,this.METRIC_ADDED=`metricAdded`,this.METRIC_UPDATED=`metricUpdated`,this.PERIOD_SWITCH_STARTED=`periodSwitchStarted`,this.PERIOD_SWITCH_COMPLETED=`periodSwitchCompleted`,this.QUALITY_CHANGE_REQUESTED=`qualityChangeRequested`,this.QUALITY_CHANGE_RENDERED=`qualityChangeRendered`,this.NEW_TRACK_SELECTED=`newTrackSelected`,this.TRACK_CHANGE_RENDERED=`trackChangeRendered`,this.STREAM_INITIALIZING=`streamInitializing`,this.STREAM_UPDATED=`streamUpdated`,this.STREAM_ACTIVATED=`streamActivated`,this.STREAM_DEACTIVATED=`streamDeactivated`,this.STREAM_INITIALIZED=`streamInitialized`,this.STREAM_TEARDOWN_COMPLETE=`streamTeardownComplete`,this.TEXT_TRACKS_ADDED=`allTextTracksAdded`,this.TEXT_TRACK_ADDED=`textTrackAdded`,this.CUE_ENTER=`cueEnter`,this.CUE_EXIT=`cueExit`,this.THROUGHPUT_MEASUREMENT_STORED=`throughputMeasurementStored`,this.TTML_PARSED=`ttmlParsed`,this.TTML_TO_PARSE=`ttmlToParse`,this.CAPTION_RENDERED=`captionRendered`,this.CAPTION_CONTAINER_RESIZE=`captionContainerResize`,this.CAN_PLAY=`canPlay`,this.CAN_PLAY_THROUGH=`canPlayThrough`,this.PLAYBACK_ENDED=`playbackEnded`,this.PLAYBACK_ERROR=`playbackError`,this.PLAYBACK_INITIALIZED=`playbackInitialized`,this.PLAYBACK_NOT_ALLOWED=`playbackNotAllowed`,this.PLAYBACK_METADATA_LOADED=`playbackMetaDataLoaded`,this.PLAYBACK_LOADED_DATA=`playbackLoadedData`,this.PLAYBACK_PAUSED=`playbackPaused`,this.PLAYBACK_PLAYING=`playbackPlaying`,this.PLAYBACK_PROGRESS=`playbackProgress`,this.PLAYBACK_RATE_CHANGED=`playbackRateChanged`,this.PLAYBACK_SEEKED=`playbackSeeked`,this.PLAYBACK_SEEKING=`playbackSeeking`,this.PLAYBACK_STALLED=`playbackStalled`,this.PLAYBACK_STARTED=`playbackStarted`,this.PLAYBACK_TIME_UPDATED=`playbackTimeUpdated`,this.PLAYBACK_VOLUME_CHANGED=`playbackVolumeChanged`,this.PLAYBACK_WAITING=`playbackWaiting`,this.MANIFEST_VALIDITY_CHANGED=`manifestValidityChanged`,this.EVENT_MODE_ON_START=`eventModeOnStart`,this.EVENT_MODE_ON_RECEIVE=`eventModeOnReceive`,this.CONFORMANCE_VIOLATION=`conformanceViolation`,this.REPRESENTATION_SWITCH=`representationSwitch`,this.ADAPTATION_SET_REMOVED_NO_CAPABILITIES=`adaptationSetRemovedNoCapabilities`,this.CONTENT_STEERING_REQUEST_COMPLETED=`contentSteeringRequestCompleted`,this.INBAND_PRFT=`inbandPrft`,this.MANAGED_MEDIA_SOURCE_START_STREAMING=`managedMediaSourceStartStreaming`,this.MANAGED_MEDIA_SOURCE_END_STREAMING=`managedMediaSourceEndStreaming`}}t.default=new i},5212:function(e,t,n){n.r(t),t.default={STREAM:`stream`,VIDEO:`video`,ENHANCEMENT:`enhancement`,AUDIO:`audio`,TEXT:`text`,MUXED:`muxed`,IMAGE:`image`,STPP:`stpp`,TTML:`ttml`,VTT:`vtt`,WVTT:`wvtt`,CONTENT_STEERING:`contentSteering`,LIVE_CATCHUP_MODE_DEFAULT:`liveCatchupModeDefault`,LIVE_CATCHUP_MODE_LOLP:`liveCatchupModeLoLP`,MOVING_AVERAGE_SLIDING_WINDOW:`slidingWindow`,MOVING_AVERAGE_EWMA:`ewma`,BAD_ARGUMENT_ERROR:`Invalid Arguments`,MISSING_CONFIG_ERROR:`Missing config parameter(s)`,TRACK_SWITCH_MODE_ALWAYS_REPLACE:`alwaysReplace`,TRACK_SWITCH_MODE_NEVER_REPLACE:`neverReplace`,TRACK_SELECTION_MODE_FIRST_TRACK:`firstTrack`,TRACK_SELECTION_MODE_HIGHEST_BITRATE:`highestBitrate`,TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:`highestEfficiency`,TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY:`lowestStartupDelay`,TRACK_SELECTION_MODE_WIDEST_RANGE:`widestRange`,CMCD_QUERY_KEY:`CMCD`,CMCD_MODE_QUERY:`query`,CMCD_MODE_HEADER:`header`,CMCD_AVAILABLE_KEYS:[`br`,`d`,`ot`,`tb`,`bl`,`dl`,`mtp`,`nor`,`nrr`,`su`,`bs`,`rtp`,`cid`,`pr`,`sf`,`sid`,`st`,`v`],CMCD_V2_AVAILABLE_KEYS:[`msd`,`ltc`],CMCD_AVAILABLE_REQUESTS:[`segment`,`mpd`,`xlink`,`steering`,`other`],INITIALIZE:`initialize`,TEXT_SHOWING:`showing`,TEXT_HIDDEN:`hidden`,TEXT_DISABLED:`disabled`,ACCESSIBILITY_CEA608_SCHEME:`urn:scte:dash:cc:cea-608:2015`,CC1:`CC1`,CC3:`CC3`,UTF8:`utf-8`,SCHEME_ID_URI:`schemeIdUri`,START_TIME:`starttime`,SERVICE_DESCRIPTION_DVB_LL_SCHEME:`urn:dvb:dash:lowlatency:scope:2019`,SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME:`urn:dvb:dash:lowlatency:critical:2019`,CTA_5004_2023_SCHEME:`urn:mpeg:dash:cta-5004:2023`,THUMBNAILS_SCHEME_ID_URIS:[`http://dashif.org/thumbnail_tile`,`http://dashif.org/guidelines/thumbnail_tile`],FONT_DOWNLOAD_DVB_SCHEME:`urn:dvb:dash:fontdownload:2014`,COLOUR_PRIMARIES_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:ColourPrimaries`,URL_QUERY_INFO_SCHEME:`urn:mpeg:dash:urlparam:2014`,EXT_URL_QUERY_INFO_SCHEME:`urn:mpeg:dash:urlparam:2016`,MATRIX_COEFFICIENTS_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:MatrixCoefficients`,TRANSFER_CHARACTERISTICS_SCHEME_ID_URI:`urn:mpeg:mpegB:cicp:TransferCharacteristics`,SEGMENT_SEQUENCE_REPRESENTATION_SCHEME_ID_URI:`urn:mpeg:dash:ssr:2023`,HDR_METADATA_FORMAT_SCHEME_ID_URI:`urn:dvb:dash:hdr-dmi`,HDR_METADATA_FORMAT_VALUES:{ST2094_10:`ST2094-10`,SL_HDR2:`SL-HDR2`,ST2094_40:`ST2094-40`},MEDIA_CAPABILITIES_API:{COLORGAMUT:{SRGB:`srgb`,P3:`p3`,REC2020:`rec2020`},TRANSFERFUNCTION:{SRGB:`srgb`,PQ:`pq`,HLG:`hlg`},HDR_METADATATYPE:{SMPTE_ST_2094_10:`smpteSt2094-10`,SLHDR2:`slhdr2`,SMPTE_ST_2094_40:`smpteSt2094-40`}},XML:`XML`,ARRAY_BUFFER:`ArrayBuffer`,DVB_REPORTING_URL:`dvb:reportingUrl`,DVB_PROBABILITY:`dvb:probability`,OFF_MIMETYPE:`application/font-sfnt`,WOFF_MIMETYPE:`application/font-woff`,VIDEO_ELEMENT_READY_STATES:{HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},FILE_LOADER_TYPES:{FETCH:`fetch_loader`,XHR:`xhr_loader`},THROUGHPUT_TYPES:{LATENCY:`throughput_type_latency`,BANDWIDTH:`throughput_type_bandwidth`},THROUGHPUT_CALCULATION_MODES:{EWMA:`throughputCalculationModeEwma`,ZLEMA:`throughputCalculationModeZlema`,ARITHMETIC_MEAN:`throughputCalculationModeArithmeticMean`,BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:`throughputCalculationModeByteSizeWeightedArithmeticMean`,DATE_WEIGHTED_ARITHMETIC_MEAN:`throughputCalculationModeDateWeightedArithmeticMean`,HARMONIC_MEAN:`throughputCalculationModeHarmonicMean`,BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:`throughputCalculationModeByteSizeWeightedHarmonicMean`,DATE_WEIGHTED_HARMONIC_MEAN:`throughputCalculationModeDateWeightedHarmonicMean`},LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE:{MOOF_PARSING:`lowLatencyDownloadTimeCalculationModeMoofParsing`,DOWNLOADED_DATA:`lowLatencyDownloadTimeCalculationModeDownloadedData`,AAST:`lowLatencyDownloadTimeCalculationModeAast`},RULES_TYPES:{QUALITY_SWITCH_RULES:`qualitySwitchRules`,ABANDON_FRAGMENT_RULES:`abandonFragmentRules`},QUALITY_SWITCH_RULES:{BOLA_RULE:`BolaRule`,THROUGHPUT_RULE:`ThroughputRule`,INSUFFICIENT_BUFFER_RULE:`InsufficientBufferRule`,SWITCH_HISTORY_RULE:`SwitchHistoryRule`,DROPPED_FRAMES_RULE:`DroppedFramesRule`,LEARN_TO_ADAPT_RULE:`L2ARule`,LOL_PLUS_RULE:`LoLPRule`},ABANDON_FRAGMENT_RULES:{ABANDON_REQUEST_RULE:`AbandonRequestsRule`},ID3_SCHEME_ID_URI:`https://aomedia.org/emsg/ID3`,COMMON_ACCESS_TOKEN_HEADER:`common-access-token`,DASH_ROLE_SCHEME_ID:`urn:mpeg:dash:role:2011`,CODEC_FAMILIES:{MP3:`mp3`,AAC:`aac`,AC3:`ac3`,EC3:`ec3`,DTSX:`dtsx`,DTSC:`dtsc`,AVC:`avc`,HEVC:`hevc`}}},2861:function(e,t,n){n.r(t),t.default={CLEARKEY_KEYSTEM_STRING:`org.w3.clearkey`,WIDEVINE_KEYSTEM_STRING:`com.widevine.alpha`,PLAYREADY_KEYSTEM_STRING:`com.microsoft.playready`,PLAYREADY_RECOMMENDATION_KEYSTEM_STRING:`com.microsoft.playready.recommendation`,WIDEVINE_UUID:`edef8ba9-79d6-4ace-a3c8-27dcd51d21ed`,PLAYREADY_UUID:`9a04f079-9840-4286-ab92-e65be0885f95`,CLEARKEY_UUID:`e2719d58-a985-b3c9-781a-b030af78d30e`,W3C_CLEARKEY_UUID:`1077efec-c0b2-4d02-ace3-3c1e52e2fb4b`,INITIALIZATION_DATA_TYPE_CENC:`cenc`,INITIALIZATION_DATA_TYPE_KEYIDS:`keyids`,INITIALIZATION_DATA_TYPE_WEBM:`webm`,ENCRYPTION_SCHEME_CENC:`cenc`,ENCRYPTION_SCHEME_CBCS:`cbcs`,MEDIA_KEY_MESSAGE_TYPES:{LICENSE_REQUEST:`license-request`,LICENSE_RENEWAL:`license-renewal`,LICENSE_RELEASE:`license-release`,INDIVIDUALIZATION_REQUEST:`individualization-request`},ROBUSTNESS_STRINGS:{WIDEVINE:{SW_SECURE_CRYPTO:`SW_SECURE_CRYPTO`,SW_SECURE_DECODE:`SW_SECURE_DECODE`,HW_SECURE_CRYPTO:`HW_SECURE_CRYPTO`,HW_SECURE_DECODE:`HW_SECURE_DECODE`,HW_SECURE_ALL:`HW_SECURE_ALL`}},MEDIA_KEY_STATUSES:{USABLE:`usable`,EXPIRED:`expired`,RELEASED:`released`,OUTPUT_RESTRICTED:`output-restricted`,OUTPUT_DOWNSCALED:`output-downscaled`,STATUS_PENDING:`status-pending`,INTERNAL_ERROR:`internal-error`}}},4469:function(e,t,n){n.r(t),n.d(t,{default:function(){return te}});class r{constructor(){this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null}}r.SSL_CONNECTION_FAILED_PREFIX=`SSL`,r.DNS_RESOLUTION_FAILED=`C00`,r.HOST_UNREACHABLE=`C01`,r.CONNECTION_REFUSED=`C02`,r.CONNECTION_ERROR=`C03`,r.CORRUPT_MEDIA_ISOBMFF=`M00`,r.CORRUPT_MEDIA_OTHER=`M01`,r.BASE_URL_CHANGED=`F00`,r.BECAME_REPORTER=`S00`;var i=r,o=n(913),c=n(138);function l(e){let t,n,r=(e||={}).eventBus,c=e.dashMetrics,l=e.metricsConstants,u=e.events;function d(e){let t=new i;if(n){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.mpdurl||=n.originalUrl||n.url,t.terror||=new Date,c.addDVBErrors(t)}}function f(e){e.error||(n=e.manifest)}function p(e){d({errorcode:i.BASE_URL_CHANGED,servicelocation:e.entry})}function m(){d({errorcode:i.BECAME_REPORTER})}function h(e){var t;e.metric===l.HTTP_REQUEST&&((t=e.value).responsecode===0||t.responsecode==null||t.responsecode>=400||t.responsecode<100||t.responsecode>=600)&&d({errorcode:t.responsecode||i.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}function g(e){let t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=i.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=i.CORRUPT_MEDIA_OTHER;break;default:return}d({errorcode:t})}return t={initialize:function(){r.on(u.MANIFEST_UPDATED,f,t),r.on(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,p,t),r.on(u.METRIC_ADDED,h,t),r.on(u.METRIC_UPDATED,h,t),r.on(u.PLAYBACK_ERROR,g,t),r.on(o.default.BECAME_REPORTING_PLAYER,m,t)},reset:function(){r.off(u.MANIFEST_UPDATED,f,t),r.off(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,p,t),r.off(u.METRIC_ADDED,h,t),r.off(u.METRIC_UPDATED,h,t),r.off(u.PLAYBACK_ERROR,g,t),r.off(o.default.BECAME_REPORTING_PLAYER,m,t)}},t}l.__dashjs_factory_name=`DVBErrorsTranslator`;var u=c.default.getSingletonFactory(l),d=n(7377);function f(e){e||={};let t,n,r=!1,i=this.context,o=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((e=>{let t=e.starttime,r=t+e.duration;n.add(t,r)})),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){let e,t=n.length;if(!t)return!0;e=r?new Date().getTime()/1e3:o.currentTime;for(let r=0;r<t;r+=1){let t=n.start(r),i=n.end(r);if(t<=e&&e<i)return!0}return!1}},n=(0,d.default)(i).create(),t}f.__dashjs_factory_name=`RangeController`;var p=c.default.getClassFactory(f);function m(){return{serialise:function e(t){let n,r,i=[],o=[];for(n in t)if(t.hasOwnProperty(n)&&n.indexOf(`_`)!==0){if(r=t[n],r??=``,Array.isArray(r)){if(!r.length)continue;o=[],r.forEach((function(t){let n=Object.prototype.toString.call(t).slice(8,-1)!==`Object`;o.push(n?t:e(t))})),r=o.map(encodeURIComponent).join(`,`)}else typeof r==`string`?r=encodeURIComponent(r):r instanceof Date?r=r.toISOString():typeof r==`number`&&(r=Math.round(r));i.push(n+`=`+r)}return i.join(`&`)}}}m.__dashjs_factory_name=`MetricSerialiser`;var h=c.default.getSingletonFactory(m);function g(){let e,t,n,r=window.crypto||window.msCrypto,i=Uint32Array,o=2**(8*i.BYTES_PER_ELEMENT)-1;function c(){r&&(e||=new i(10),r.getRandomValues(e),t=0)}return n={random:function(n,i){let l;return n||=0,i||=1,r?(t===e.length&&c(),l=e[t]/o,t+=1):l=Math.random(),l*(i-n)+n}},c(),n}g.__dashjs_factory_name=`RNG`;var _=c.default.getSingletonFactory(g),v=n(1926);function y(e){let t;e||={};let n,r,i,o,c,l,u,d=this.context,f=[],p=e.metricsConstants;function m(){o=!1,c=!1,l=null,u=null}return t={report:function(e,t){Array.isArray(t)||(t=[t]),c&&u.isEnabled()&&t.forEach((function(t){let i=n.serialise(t);e!==p.DVB_ERRORS&&(i=`metricname=${e}&${i}`),i=`${l}?${i}`,function(e,t,n){let i=new XMLHttpRequest;i.withCredentials=r.getXHRWithCredentialsForType(p.HTTP_REQUEST_DVB_REPORTING_TYPE);let o=function(){let e=f.indexOf(i);e!==-1&&(f.splice(e,1),!(i.status>=200&&i.status<300)&&n&&n())};f.push(i);try{i.open(`GET`,e),i.onloadend=o,i.onerror=o,i.send()}catch{i.onerror()}}(i,0,(function(){c=!1}))}))},initialize:function(e,t){let n;if(u=t,l=e.dvbReportingUrl,!l)throw Error(`required parameter missing (dvb:reportingUrl)`);o||=(n=e.dvbProbability,n&&(n===1e3||n/1e3>=i.random())&&(c=!0),!0)},reset:function(){m()}},n=h(d).getInstance(),i=_(d).getInstance(),r=(0,v.default)(d).getInstance(),m(),t}y.__dashjs_factory_name=`DVBReporting`;var b=c.default.getClassFactory(y);function x(e){e||={};let t={"urn:dvb:dash:reporting:2014":b},n=this.context,r,i=e.debug?e.debug.getLogger(r):{},o=e.metricsConstants,c=e.mediaPlayerModel||{};return r={create:function(e,r){let l;try{l=t[e.schemeIdUri](n).create({metricsConstants:o,mediaPlayerModel:c}),l.initialize(e,r)}catch(t){l=null,i.error(`ReportingFactory: could not create Reporting with schemeIdUri ${e.schemeIdUri} (${t.message})`)}return l},register:function(e,n){t[e]=n},unregister:function(e){delete t[e]}},r}x.__dashjs_factory_name=`ReportingFactory`;var S=c.default.getSingletonFactory(x);function C(e){let t,n=[],r=S(this.context).getInstance(e);return t={initialize:function(e,t){e.some((e=>{let i=r.create(e,t);if(i)return n.push(i),!0}))},reset:function(){n.forEach((e=>e.reset())),n=[]},report:function(e,t){n.forEach((n=>n.report(e,t)))}},t}C.__dashjs_factory_name=`ReportingController`;var w=c.default.getClassFactory(C);function T(){return{reconstructFullMetricName:function(e,t,n){let r=e;return t&&(r+=`(`+t,n&&n.length&&(r+=`,`+n),r+=`)`),r},validateN:function(e){if(!e)throw Error(`missing n`);if(isNaN(e))throw Error(`n is NaN`);if(e<0)throw Error(`n must be positive`);return e}}}T.__dashjs_factory_name=`HandlerHelpers`;var E=c.default.getSingletonFactory(T);function D(e){let t,n,r,i,o,c;e||={};let l=this.context,u=E(l).getInstance(),d=[],f=e.metricsConstants;function p(){let e=function(){try{return Object.keys(d).map((e=>d[e])).reduce(((e,t)=>e.level<t.level?e:t))}catch{return}}();e&&c!==e.t&&(c=e.t,n.report(i,e))}return t={initialize:function(e,t,c){t&&(r=u.validateN(c),n=t,i=u.reconstructFullMetricName(e,c),o=setInterval(p,r))},reset:function(){clearInterval(o),o=null,r=0,n=null,c=null},handleNewMetric:function(e,t,n){e===f.BUFFER_LEVEL&&(d[n]=t)}},t}D.__dashjs_factory_name=`BufferLevelHandler`;var O=c.default.getClassFactory(D),k=c.default.getClassFactory((function(e){let t,n,r=(e||={}).eventBus,i=e.metricsConstants;function c(){r.off(o.default.METRICS_INITIALISATION_COMPLETE,c,this),r.trigger(o.default.BECAME_REPORTING_PLAYER)}return t={initialize:function(e,t){t&&(n=t,r.on(o.default.METRICS_INITIALISATION_COMPLETE,c,this))},reset:function(){n=null},handleNewMetric:function(e,t){e===i.DVB_ERRORS&&n&&n.report(e,t)}},t}));function A(e){let t,n,r,i,o,c;e||={};let l=[],u=E(this.context).getInstance(),d=e.metricsConstants;function f(){var e=l;e.length&&n&&n.report(o,e),l=[]}return t={initialize:function(e,t,l,d){t&&(r=u.validateN(l),n=t,d&&d.length&&(i=d),o=u.reconstructFullMetricName(e,l,d),c=setInterval(f,r))},reset:function(){clearInterval(c),c=null,r=null,i=null,l=[],n=null},handleNewMetric:function(e,t){e===d.HTTP_REQUEST&&(i&&i!==t.type||l.push(t))}},t}A.__dashjs_factory_name=`HttpListHandler`;var j=c.default.getClassFactory(A);function M(){let e,t,n;return e={initialize:function(e,r){t=e,n=r},reset:function(){n=null,t=void 0},handleNewMetric:function(e,r){e===t&&n&&n.report(t,r)}},e}M.__dashjs_factory_name=`GenericMetricHandler`;var N=c.default.getClassFactory(M);function P(e){let t,n=(e||={}).debug?e.debug.getLogger(t):{},r=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/,i=this.context,o={BufferLevel:O,DVBErrors:k,HttpList:j,PlayList:N,RepSwitchList:N,TcpList:N};return t={create:function(t,c){var l,u=t.match(r);if(u){try{(l=o[u[1]](i).create({eventBus:e.eventBus,metricsConstants:e.metricsConstants})).initialize(u[1],c,u[3],u[5])}catch(e){l=null,n.error(`MetricsHandlerFactory: Could not create handler for type ${u[1]} with args ${u[3]}, ${u[5]} (${e.message})`)}return l}},register:function(e,t){o[e]=t},unregister:function(e){delete o[e]}},t}P.__dashjs_factory_name=`MetricsHandlerFactory`;var F=c.default.getSingletonFactory(P);function I(e){e||={};let t,n=[],r=this.context,i=e.eventBus,o=e.events,c=F(r).getInstance({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants});function l(e){n.forEach((t=>{t.handleNewMetric(e.metric,e.value,e.mediaType)}))}return t={initialize:function(e,r){e.split(`,`).forEach(((e,t,i)=>{let o;if(e.indexOf(`(`)!==-1&&e.indexOf(`)`)===-1){let n=i[t+1];n&&n.indexOf(`(`)===-1&&n.indexOf(`)`)!==-1&&(e+=`,`+n,delete i[t+1])}o=c.create(e,r),o&&n.push(o)})),i.on(o.METRIC_ADDED,l,t),i.on(o.METRIC_UPDATED,l,t)},reset:function(){i.off(o.METRIC_ADDED,l,t),i.off(o.METRIC_UPDATED,l,t),n.forEach((e=>e.reset())),n=[]}},t}I.__dashjs_factory_name=`MetricsHandlersController`;var L=c.default.getClassFactory(I);function R(e){let t,n,r,i;e||={};let o=this.context;function c(){t&&t.reset(),n&&n.reset(),r&&r.reset()}return i={initialize:function(i){try{r=p(o).create({mediaElement:e.mediaElement}),r.initialize(i.Range),n=w(o).create({debug:e.debug,metricsConstants:e.metricsConstants,mediaPlayerModel:e.mediaPlayerModel}),n.initialize(i.Reporting,r),t=L(o).create({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants,events:e.events}),t.initialize(i.metrics,n)}catch(e){throw c(),e}},reset:c},i}R.__dashjs_factory_name=`MetricsController`;var z=c.default.getClassFactory(R),B=class{constructor(){this.metrics=``,this.Range=[],this.Reporting=[]}},V=class{constructor(){this.starttime=0,this.duration=1/0,this._useWallClockTime=!1}},H=class{constructor(){this.schemeIdUri=``,this.value=``,this.dvbReportingUrl=``,this.dvbProbability=1e3}};function U(e){let t,n=(e||={}).adapter,r=e.constants;return t={getMetrics:function(e){let t=[];return e&&e.Metrics&&e.Metrics.forEach((i=>{var o=new B,c=n.getIsDynamic(e);i.hasOwnProperty(`metrics`)&&(o.metrics=i.metrics,i.Range&&i.Range.forEach((t=>{var i=new V;i.starttime=function(e,t,i){let o,c,l=0;return t?l=n.getAvailabilityStartTime(e)/1e3:(o=n.getRegularPeriods(e),o.length&&(l=o[0].start)),c=l,i&&i.hasOwnProperty(r.START_TIME)&&(c+=i.starttime),c}(e,c,t),t.hasOwnProperty(`duration`)?i.duration=t.duration:i.duration=n.getDuration(e),i._useWallClockTime=c,o.Range.push(i)})),i.Reporting&&(i.Reporting.forEach((e=>{var t=new H;e.hasOwnProperty(r.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty(`value`)&&(t.value=e.value),e.hasOwnProperty(r.DVB_REPORTING_URL)&&(t.dvbReportingUrl=e[r.DVB_REPORTING_URL]),e.hasOwnProperty(r.DVB_PROBABILITY)&&(t.dvbProbability=e[r.DVB_PROBABILITY]),o.Reporting.push(t))})),t.push(o)))})),t}},t}U.__dashjs_factory_name=`ManifestParsing`;var W=c.default.getSingletonFactory(U);function G(e){let t;e||={};let n={},r=this.context,i=e.eventBus,c=e.events;function l(t){if(t.error)return;let c=Object.keys(n);W(r).getInstance({adapter:e.adapter,constants:e.constants}).getMetrics(t.manifest).forEach((t=>{let i=JSON.stringify(t);if(n.hasOwnProperty(i))c.splice(i,1);else try{let o=z(r).create(e);o.initialize(t),n[i]=o}catch{}})),c.forEach((e=>{n[e].reset(),delete n[e]})),i.trigger(o.default.METRICS_INITIALISATION_COMPLETE)}function u(){Object.keys(n).forEach((e=>{n[e].reset()})),n={}}return t={reset:function(){i.off(c.MANIFEST_UPDATED,l,t),i.off(c.STREAM_TEARDOWN_COMPLETE,u,t)}},i.on(c.MANIFEST_UPDATED,l,t),i.on(c.STREAM_TEARDOWN_COMPLETE,u,t),t}G.__dashjs_factory_name=`MetricsCollectionController`;var K=c.default.getClassFactory(G);function ee(){let e,t,n=this.context;return e={createMetricsReporting:function(e){return t=u(n).getInstance({eventBus:e.eventBus,dashMetrics:e.dashMetrics,metricsConstants:e.metricsConstants,events:e.events}),t.initialize(),K(n).create(e)},getReportingFactory:function(){return S(n).getInstance()},getMetricsHandlerFactory:function(){return F(n).getInstance()}},e}ee.__dashjs_factory_name=`MetricsReporting`;let q=c.default.getClassFactory(ee);q.events=o.default,c.default.updateClassFactory(ee.__dashjs_factory_name,q);var te=q},913:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.METRICS_INITIALISATION_COMPLETE=`internal_metricsReportingInitialized`,this.BECAME_REPORTING_PLAYER=`internal_becameReportingPlayer`,this.CMCD_DATA_GENERATED=`cmcdDataGenerated`}}t.default=new i},1926:function(e,t,n){n.r(t);var r=n(5717),i=n(138),o=n(8261),c=n(656),l=n(5212),u=n(5560);function d(){let e,t,n,i,d,f,p,m,h,g,_,v=this.context,y=(0,o.default)(v).getInstance();function b(){i=[],d=[],f=[],p=[],m=[],_=[],h=null,t=[],g=new Set}function x(e,t){let n=-1;e.some(((e,r)=>{if(e===t)return n=r,!0})),n<0||e.splice(n,1)}function S(e){let t;for(t=0;t<_.length;t++)if(_[t].rulename===e)return t;return-1}function C(e,t){let n=!1;return g.forEach((r=>{r[e]===t&&(n=!0)})),n}function w(e,n){T(e,n);let i=new r.default;i.schemeIdUri=e,i.value=n,t.push(i)}function T(e,n){(0,c.checkParameterType)(e,`string`),(0,c.checkParameterType)(n,`string`),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={addAbrCustomRule:function(e,t,n){if(typeof e!=`string`||e!==l.default.RULES_TYPES.ABANDON_FRAGMENT_RULES&&e!==l.default.RULES_TYPES.QUALITY_SWITCH_RULES||typeof t!=`string`)throw l.default.BAD_ARGUMENT_ERROR;let r=S(t);r===-1?_.push({type:e,rulename:t,rule:n}):(_[r].type=e,_[r].rule=n)},addExternalSubtitle:function(e){if(!(e&&e.id!==void 0&&e.url&&e.language&&e.mimeType&&e.bandwidth!==void 0))return;let t=new u.default(e);C(`url`,t.url)||C(`id`,t.id)||g.add(t)},addRequestInterceptor:function(e){i.push(e)},addResponseInterceptor:function(e){d.push(e)},addUTCTimingSource:w,clearDefaultUTCTimingSources:function(){t=[]},getAbrCustomRules:function(){return _},getCustomCapabilitiesFilters:function(){return m},getCustomInitialTrackSelectionFunction:function(){return h},getExternalSubtitles:function(){return g},getLicenseRequestFilters:function(){return f},getLicenseResponseFilters:function(){return p},getRequestInterceptors:function(){return i},getResponseInterceptors:function(){return d},getUTCTimingSources:function(){return t},getXHRWithCredentialsForType:function(e){let t=n[e];return t===void 0?n.default:t},registerCustomCapabilitiesFilter:function(e){m.push(e)},registerLicenseRequestFilter:function(e){f.push(e)},registerLicenseResponseFilter:function(e){p.push(e)},removeAbrCustomRule:function(e){if(e){let t=S(e);t!==-1&&_.splice(t,1)}else _=[]},removeAllAbrCustomRule:function(){_=[]},removeExternalSubtitleById:function(e){g.forEach((t=>{t.id===e&&g.delete(t)}))},removeExternalSubtitleByUrl:function(e){g.forEach((t=>{t.url===e&&g.delete(t)}))},removeRequestInterceptor:function(e){x(i,e)},removeResponseInterceptor:function(e){x(d,e)},removeUTCTimingSource:T,reset:function(){b()},resetCustomInitialTrackSelectionFunction:function(){h=null},resetPlaybackSessionSpecificSettings:function(){g=new Set},restoreDefaultUTCTimingSources:function(){let e=y.get().streaming.utcSynchronization.defaultTimingSource;w(e.scheme,e.value)},setConfig:function(){},setCustomInitialTrackSelectionFunction:function(e){h=e},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach((t=>{e(t,r)}))},unregisterCustomCapabilitiesFilter:function(e){x(m,e)},unregisterLicenseRequestFilter:function(e){x(f,e)},unregisterLicenseResponseFilter:function(e){x(p,e)}},n={default:!1},b(),e}d.__dashjs_factory_name=`CustomParametersModel`,t.default=i.default.getSingletonFactory(d)},3888:function(e,t,n){n.r(t),n.d(t,{default:function(){return xe}});var r=n(8854),i=n(2861);let o={prefixes:[`clearkey`,`dashif`,`ck`]};class c{static findMp4ProtectionElement(e){let t=null;for(let n=0;n<e.length;++n){let o=e[n];o.schemeIdUri&&o.schemeIdUri.toLowerCase()===r.default.MP4_PROTECTION_SCHEME&&o.value&&(o.value.toLowerCase()===i.default.ENCRYPTION_SCHEME_CENC||o.value.toLowerCase()===i.default.ENCRYPTION_SCHEME_CBCS)&&(t=o)}return t}static getPSSHData(e){let t=8,n=new DataView(e),r=n.getUint8(t);return t+=20,r>0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}static getPSSHForKeySystem(e,t){let n=c.parsePSSHList(t);return e&&n.hasOwnProperty(e.uuid.toLowerCase())?n[e.uuid.toLowerCase()]:null}static parseInitDataFromContentProtection(e,t){return`pssh`in e&&e.pssh?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,``).replace(/\s+/g,``),t.decodeArray(e.pssh.__text).buffer):null}static parsePSSHList(e){if(e==null)return[];let t=new DataView(e.buffer||e),n={},r=0;for(;;){let e,i,o,c,l,u,d=r;if(r>=t.buffer.byteLength)break;if(e=t.getUint32(r),i=r+e,r+=4,t.getUint32(r)===1886614376)if(r+=4,o=t.getUint8(r),o===0||o===1){for(r++,r+=3,c=``,l=0;l<4;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=4,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<2;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;for(r+=2,c+=`-`,l=0;l<6;l++)u=t.getUint8(r+l).toString(16),c+=u.length===1?`0`+u:u;r+=6,c=c.toLowerCase(),r+=4,n[c]=t.buffer.slice(d,i),r=i}else r=i;else r=i}return n}static getLicenseServerUrlFromMediaInfo(e,t){try{if(!e||e.length===0)return null;let n=0,r=null;for(;n<e.length&&!r;){let i=e[n];if(i&&i.contentProtection&&i.contentProtection.length>0){let e=i.contentProtection.filter((e=>e.schemeIdUri&&e.schemeIdUri===t));if(e&&e.length>0){let t=0;for(;t<e.length&&!r;){let n=e[t];n.laUrl&&n.laUrl.__prefix&&o.prefixes.includes(n.laUrl.__prefix)&&n.laUrl.__text&&(r=n.laUrl.__text),t+=1}}}n+=1}return r}catch{return null}}static hexKidToBufferSource(e){let t=e.replace(/-/g,``);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer}}var l=c,u=class{constructor(e,t){this.contentType=e,this.robustness=t}},d=class{constructor(e,t,n,r,o,c){this.initDataTypes=c&&c.length>0?c:[i.default.INITIALIZATION_DATA_TYPE_CENC],e&&e.length&&(this.audioCapabilities=e),t&&t.length&&(this.videoCapabilities=t),this.distinctiveIdentifier=n,this.persistentState=r,this.sessionTypes=o}},f=n(1923),p=n(1944),m=class{constructor(e,t,n,r,i,o,c,l){this.url=e,this.method=t,this.responseType=n,this.headers=r,this.withCredentials=i,this.messageType=o,this.sessionId=c,this.data=l}},h=class{constructor(e,t,n){this.url=e,this.headers=t,this.data=n}},g=n(7568),_=n(7263),v=n(5212),y=n(138);function b(e){let t=(e||={}).BASE64,n=e.cmcdModel,r=e.constants,o=e.customParametersModel,c=e.debug,y=e.eventBus,b=e.events,x=e.protectionKeyController,S=e.settings,C,w,T,E,D,O,k,A,j,M,N,P,F=e.protectionModel,I=[];function L(){if(!(y&&y.hasOwnProperty(`on`)&&x&&x.hasOwnProperty(`getSupportedKeySystemMetadataFromContentProtection`)))throw Error(`Missing config parameter(s)`)}function R(e,n){N||E?N&&z():function(e,n){if(E)return;var r;E=!0;let i=function(e){let t=[];for(let n=0;n<e.length;n++){let r=B(e[n]);t.push({ks:e[n].ks,configs:[r],protData:e[n].protData})}return t}(e=(r=e).sort(((e,t)=>(C&&C[e.ks.systemString]&&C[e.ks.systemString].priority>=0?C[e.ks.systemString].priority:r.length)-(C&&C[t.ks.systemString]&&C[t.ks.systemString].priority>=0?C[t.ks.systemString].priority:r.length)))),o;F.requestKeySystemAccess(i).then((e=>(o=e.data,function(e){let t=e&&e.selectedSystemString?e.selectedSystemString:e.keySystem.systemString;return k.info(`DRM: KeySystem Access Granted for system string (`+t+`)! Selecting key system...`),F.selectKeySystem(e)}(o)))).then((e=>{(function(e,n){try{N=e,E=!1,y.trigger(b.KEY_SYSTEM_SELECTED,{data:n});let r=U(N);r&&r.serverCertificate&&r.serverCertificate.length>0&&F.setServerCertificate(t.decodeArray(r.serverCertificate).buffer),z()}catch(e){k.error(e)}})(e,o)})).catch((e=>{(function(e,t){N=null,E=!1,t||y.trigger(b.KEY_SYSTEM_SELECTED,{data:null,error:new p.default(f.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,f.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+`Error selecting key system! -- `+e.error)})})(e,n)}))}(e,n)}function z(){let e;for(let n=0;n<j.length;n++)for(e=0;e<j[n].length;e++)if(N===j[n][e].ks){t=j[n][e],x.isClearKey(N)&&function(e){if(e.protData&&e.protData.hasOwnProperty(`clearkeys`)&&Object.keys(e.protData.clearkeys).length!==0){let t={kids:Object.keys(e.protData.clearkeys)};e.initData=new TextEncoder().encode(JSON.stringify(t))}}(t),t.sessionId?V(t):t.initData!==null&&H(t);break}var t;j=[]}function B(e){let t=e.protData,n=[],o=[],c=t&&t.initDataTypes&&t.initDataTypes.length>0?t.initDataTypes:[i.default.INITIALIZATION_DATA_TYPE_CENC],l=t&&t.audioRobustness&&t.audioRobustness.length>0?t.audioRobustness:M,f=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:M,p=e.sessionType,m=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:`optional`,h=t&&t.persistentState?t.persistentState:p===`temporary`?`optional`:`required`;return A.forEach((e=>{e.type===r.AUDIO?n.push(new u(e.codec,l)):e.type===r.VIDEO&&o.push(new u(e.codec,f))})),new d(n,o,m,h,[p],c)}function V(e){L(),F.loadKeySession(e)}function H(e){if(e&&function(e){if(!e)return!1;try{let t=F.getSessionTokens();for(let n=0;n<t.length;n++)if(t[n].getKeyId()===e)return!0;return!1}catch{return!1}}(e.keyId))return;(function(){if(!S)return;let e=S.get().streaming.protection.keepProtectionMediaKeys,t=S.get().streaming.protection.keepProtectionMediaKeysMaximumOpenSessions;if(typeof t!=`number`||t<=0)return;if(!e)return void k.warn(`DRM: keepProtectionMediaKeysMaximumOpenSessions is set to `+t+`, but keepProtectionMediaKeys is not enabled. Therefore, keepProtectionMediaKeysMaximumOpenSessions will be ignored.`);if(!F||typeof F.getSessionTokens!=`function`)return;let n=F.getSessionTokens()||[];if(n.length<t)return;let r=n[0];r&&(k.info(`DRM: Maximum number of open MediaKeySessions reached (`+t+`), closing oldest session.`),G(r))})();let t=l.getPSSHForKeySystem(N,e?e.initData:null);if(t){if(W(t))return;try{e.initData=t,F.createKeySession(e)}catch(e){y.trigger(b.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e&&e.initData?F.createKeySession(e):y.trigger(b.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Selected key system is `+(N?N.systemString:null)+`. needkey/encrypted event contains no initData corresponding to that key system!`)})}function U(e){if(e){let t=e.systemString;if(C)return t in C?C[t]:null}return null}function W(e){if(!e)return!1;try{let t=F.getAllInitData();for(let n=0;n<t.length;n++)if(x.initDataEquals(e,t[n]))return k.debug(`DRM: Ignoring initData because we have already seen it!`),!0;return!1}catch{return!1}}function G(e){L(),F.closeKeySession(e)}function K(e){L(),e?(F.setMediaElement(e),y.on(b.NEED_KEY,ae,w)):e===null&&(F.setMediaElement(e),y.off(b.NEED_KEY,ae,w))}function ee(e){k.debug(`DRM: onKeyMessage`);let t=e.data;y.trigger(b.KEY_MESSAGE,{data:t});let n=t.messageType?t.messageType:i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,r=t.message,c=t.sessionToken,u=U(N),d=x.getLicenseServerModelInstance(N,u,n),v={sessionToken:c,messageType:n};if(r&&r.byteLength!==0){if(!d)return k.debug(`DRM: License server request not required for this message (type = `+e.data.messageType+`). Session ID = `+c.getSessionId()),void q(v);if(x.isClearKey(N)){let e=x.processClearKeyLicenseRequest(N,u,r);if(e&&e.keyPairs&&e.keyPairs.length>0)return k.debug(`DRM: ClearKey license request handled by application!`),q(v),void F.updateKeySession(c,e)}(function(e,t,n){let r=e.sessionToken,c=e.messageType?e.messageType:i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,u={sessionToken:r,messageType:c},d=N?N.systemString:null,v=function(e,t,n,r,i){let o=null,c=r.message;if(e&&e.serverURL){let n=e.serverURL;typeof n==`string`&&n!==``?o=n:typeof n==`object`&&n.hasOwnProperty(t)&&(o=n[t])}else if(e&&e.laURL&&e.laURL!==``)o=e.laURL;else if(o=l.getLicenseServerUrlFromMediaInfo(A,N.schemeIdURI),!o&&!x.isClearKey(N)){let e=l.getPSSHData(n.initData);o=N.getLicenseServerURLFromInitData(e),o||=r.laURL}return o=i.getServerURLFromMessage(o,c,t),o}(n,c,r,e,t);if(!v)return void q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));let y={},b=!1;n&&re(y,n.httpRequestHeaders);let C=e.message;re(y,N.getRequestHeadersFromMessage(C)),Object.keys(y).forEach((e=>{e.toLowerCase()===`authorization`&&(b=!0)})),n&&typeof n.withCredentials==`boolean`&&(b=n.withCredentials);let w=function(e){if(F)if(e.status>=200&&e.status<=299){let n=_.default.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),i=new h(e.responseURL,n,e.response);J(o.getLicenseResponseFilters(),i).then((()=>{let n=t.getLicenseMessage(i.data,d,c);n===null?ie(e,u,d,c,t):(q(u),F.updateKeySession(r,n))}))}else ie(e,u,d,c,t)},T=function(e){q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+d+` update, XHR aborted. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState))},E=function(e){q(u,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+d+` update, XHR error. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState))},D=N.getLicenseRequestFromMessage(C),O=t.getHTTPMethod(c),k=t.getResponseType(d,c),j=n&&!isNaN(n.httpTimeout)?n.httpTimeout:8e3,M=r.getSessionId()||null,P=new m(v,O,k,y,b,c,M,D),I=isNaN(S.get().streaming.retryAttempts[g.HTTPRequest.LICENSE])?3:S.get().streaming.retryAttempts[g.HTTPRequest.LICENSE];J(o.getLicenseRequestFilters(),P).then((()=>{te(P,I,j,w,T,E)}))})(t,d,u)}else q(v,new p.default(f.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function q(e,t=null){y.trigger(b.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function te(e,t,r,i,o,c){let l=new XMLHttpRequest,u=n.getCmcdParametersFromManifest();if(n.isCmcdEnabled()&&(u.mode?u.mode:S.get().streaming.cmcd.mode)===v.default.CMCD_MODE_QUERY){let t=n.getQueryParameter({url:e.url,type:g.HTTPRequest.LICENSE});t&&(e.url=_.default.addAdditionalQueryParameterToUrl(e.url,[t]))}l.open(e.method,e.url,!0),l.responseType=e.responseType,l.withCredentials=e.withCredentials,r>0&&(l.timeout=r);for(let t in e.headers)l.setRequestHeader(t,e.headers[t]);if(n.isCmcdEnabled()&&(u.mode?u.mode:S.get().streaming.cmcd.mode)===v.default.CMCD_MODE_HEADER){let t=n.getHeaderParameters({url:e.url,type:g.HTTPRequest.LICENSE});if(t)for(let e in t){let n=t[e];n&&l.setRequestHeader(e,n)}}let d=function(){t--;let n=isNaN(S.get().streaming.retryIntervals[g.HTTPRequest.LICENSE])?1e3:S.get().streaming.retryIntervals[g.HTTPRequest.LICENSE];D=setTimeout((function(){te(e,t,r,i,o,c)}),n)};l.onload=function(){O=null,this.status>=200&&this.status<=299||t<=0?i(this):(k.warn(`License request failed (`+this.status+`). Retrying it... Pending retries: `+t),d())},l.ontimeout=l.onerror=function(){O=null,t<=0?c(this):(k.warn(`License request network request failed . Retrying it... Pending retries: `+t),d())},l.onabort=function(){o(this)},y.trigger(b.LICENSE_REQUEST_SENDING,{url:e.url,headers:e.headers,payload:e.data,sessionId:e.sessionId}),O=l,l.send(e.data)}function ne(){O&&=(O.onloadend=O.onerror=O.onprogress=void 0,O.abort(),null),D&&=(clearTimeout(D),null)}function re(e,t){if(t)for(let n in t)e[n]=t[n]}function ie(e,t,n,r,i){let o=`NONE`,c=null;e.response&&(o=i.getErrorResponse(e.response,n,r),c={serverResponse:e.response||null,responseCode:e.status||null,responseText:e.statusText||null}),q(t,new p.default(f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+` update, XHR complete. status is "`+e.statusText+`" (`+e.status+`), readyState is `+e.readyState+`. Response is `+o,c))}function J(e,t){return e?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function ae(e,t){if(S.get().streaming.protection.ignoreEmeEncryptedEvent)return;if(k.debug(`DRM: onNeedKey`),e.key.initDataType!==i.default.INITIALIZATION_DATA_TYPE_CENC)return void k.warn(`DRM: Only 'cenc' initData is supported! Ignoring initData of type: `+e.key.initDataType);if(A.length===0&&(k.warn(`DRM: onNeedKey called before initializeForMedia, wait until initialized`),(t=t===void 0?1:t+1)<5))return void I.push(setTimeout((()=>{ae(e,t)}),500));let n=e.key.initData;if(ArrayBuffer.isView(n)&&(n=n.buffer),N){let e=l.getPSSHForKeySystem(N,n);if(e&&W(e))return}k.debug(`DRM: initData:`,String.fromCharCode.apply(null,new Uint8Array(n)));let r=x.getSupportedKeySystemMetadataFromSegmentPssh(n,C,P);r.length===0?k.debug(`DRM: Received needkey event with initData, but we don't support any of the key systems!`):function(e){j.push(e),R(e,!1)}(r)}function oe(e,t){if(e.size<=0)return!1;if(t.size>0&&[...e].every((e=>{let n=t.get(e);return n!==void 0&&n!==``})))return!0;let n=F.getSessionTokens();if(n&&n.length>0){let t=n.filter((t=>[...e].includes(t.normalizedKeyId)));if(t.some((e=>!e.hasTriggeredKeyStatusMapUpdate))||t.length===0)return!1}return!S.get().streaming.protection.ignoreKeyStatuses&&e&&e.size>0&&t&&t.size>0}return w={areKeyIdsExpired:function(e){try{return!!oe(e,T)&&[...e].every((e=>T.get(e)===i.default.MEDIA_KEY_STATUSES.EXPIRED))}catch(e){return k.error(e),!1}},areKeyIdsUsable:function(e){try{return!oe(e,T)||[...e].some((e=>{let t=T.get(e);return t&&t!==i.default.MEDIA_KEY_STATUSES.INTERNAL_ERROR&&t!==i.default.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED}))}catch(e){return k.error(e),!0}},clearMediaInfoArray:function(){A=[]},closeKeySession:G,createKeySession:H,getKeySystems:function(){return x?x.getKeySystems():[]},getSupportedKeySystemMetadataFromContentProtection:function(e){return L(),x.getSupportedKeySystemMetadataFromContentProtection(e,C,P)},handleKeySystemFromManifest:function(){if(!A||A.length===0)return;let e=[];A.forEach((t=>{let n=x.getSupportedKeySystemMetadataFromContentProtection(t.contentProtection,C,P);n.length>0&&(e.length===0&&(e=n),j.push(n))})),e&&e.length>0&&R(e,!0)},initializeForMedia:function(e){if(!e)throw Error(`mediaInfo can not be null or undefined`);L(),A.push(e)},loadKeySession:V,removeKeySession:function(e){L(),F.removeKeySession(e)},reset:function(){y.off(b.INTERNAL_KEY_MESSAGE,ee,w),L(),ne(),K(null),N=null,E=!1,T=new Map,F&&=(F.reset(),null),I.forEach((e=>clearTimeout(e))),I=[],A=[],j=[]},setKeySystems:function(e){x&&x.setKeySystems(e)},setMediaElement:K,setProtectionData:function(e){C=e,x.setProtectionData(e)},setRobustnessLevel:function(e){M=e},setServerCertificate:function(e){return L(),F.setServerCertificate(e)},setSessionType:function(e){P=e},stop:function(){ne(),F&&F.stop()},updateKeyStatusesMap:function(e){try{if(!e||!e.sessionToken||!e.parsedKeyStatuses)return;e.sessionToken.hasTriggeredKeyStatusMapUpdate=!0;let t=e.parsedKeyStatuses,n=_.default.parseUserAgent(),r=n&&n.browser&&n.browser.name&&n.browser.name.toLowerCase()===`edge`;t.forEach((e=>{r&&N.uuid===i.default.PLAYREADY_UUID&&e.keyId&&e.keyId.byteLength===16&&function(e){let t=_.default.bufferSourceToDataView(e),n=t.getUint32(0,!0),r=t.getUint16(4,!0),i=t.getUint16(6,!0);t.setUint32(0,n,!1),t.setUint16(4,r,!1),t.setUint16(6,i,!1)}(e.keyId);let t=_.default.bufferSourceToHex(e.keyId).slice(0,32);t&&t!==``&&T.set(t,e.status)})),y.trigger(b.KEY_STATUSES_MAP_UPDATED,{keyStatusMap:T})}catch(e){k.error(e)}}},k=c.getLogger(w),j=[],A=[],P=`temporary`,M=``,O=null,D=null,T=new Map,y.on(b.INTERNAL_KEY_MESSAGE,ee,w),w}b.__dashjs_factory_name=`ProtectionController`;var x=y.default.getClassFactory(b),S=class{constructor(e,t){this.keyID=e,this.key=t}},C=class{constructor(e,t){if(t&&t!==`persistent`&&t!==`temporary`)throw Error(`Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'`);this.keyPairs=e,this.type=t}toJWK(){let e,t=this.keyPairs.length,n={keys:[]};for(e=0;e<t;e++){let t={kty:`oct`,alg:`A128KW`,kid:this.keyPairs[e].keyID,k:this.keyPairs[e].key};n.keys.push(t)}this.type&&(n.type=this.type);let r=JSON.stringify(n),i=r.length,o=new ArrayBuffer(i),c=new Uint8Array(o);for(e=0;e<i;e++)c[e]=r.charCodeAt(e);return o}};let w=i.default.CLEARKEY_UUID,T=i.default.CLEARKEY_KEYSTEM_STRING,E=`urn:uuid:`+w;function D(e){let t,n=(e||={}).BASE64;return t={uuid:w,schemeIdURI:E,systemString:T,getInitData:function(e,t){try{let r=l.parseInitDataFromContentProtection(e,n);if(!r&&t){let e={kids:[function(e){try{let t=e.replace(/-/g,``);return t=btoa(t.match(/\w{2}/g).map((e=>String.fromCharCode(parseInt(e,16)))).join(``)),t.replace(/=/g,``).replace(/\//g,`_`).replace(/\+/g,`-`)}catch{return null}}(t.cencDefaultKid)]};r=new TextEncoder().encode(JSON.stringify(e))}return r}catch{return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":`application/json`}},getLicenseRequestFromMessage:function(e){return JSON.stringify(JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e))))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){let r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),i=[];for(let t=0;t<r.kids.length;t++){let n=r.kids[t],o=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!o)throw Error(`DRM: ClearKey keyID (`+n+`) is not known!`);i.push(new S(n,o))}n=new C(i)}return n}},t}D.__dashjs_factory_name=`KeySystemClearKey`;var O=y.default.getSingletonFactory(D);let k=i.default.W3C_CLEARKEY_UUID,A=i.default.CLEARKEY_KEYSTEM_STRING,j=`urn:uuid:`+k;function M(e){let t,n=e.BASE64,r=e.debug.getLogger(t);return t={uuid:k,schemeIdURI:j,systemString:A,getInitData:function(e){return l.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){let i=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),o=[];for(let t=0;t<i.kids.length;t++){let n=i.kids[t],r=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!r)throw Error(`DRM: ClearKey keyID (`+n+`) is not known!`);o.push(new S(n,r))}n=new C(o),r.warn(`ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4`)}return n}},t}M.__dashjs_factory_name=`KeySystemW3CClearKey`;var N=y.default.getSingletonFactory(M);let P=i.default.WIDEVINE_UUID,F=i.default.WIDEVINE_KEYSTEM_STRING,I=`urn:uuid:`+P;function L(e){let t,n=(e||={}).BASE64;return t={uuid:P,schemeIdURI:I,systemString:F,getInitData:function(e){return l.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null}},t}L.__dashjs_factory_name=`KeySystemWidevine`;var R=y.default.getSingletonFactory(L);let z=i.default.PLAYREADY_UUID,B=i.default.PLAYREADY_KEYSTEM_STRING,V=`urn:uuid:`+z;function H(e){let t,n=`utf-16`,r=(e||={}).BASE64,i=e.settings;function o(){if(!r||!r.hasOwnProperty(`decodeArray`)||!r.hasOwnProperty(`decodeArray`))throw Error(`Missing config parameter(s)`)}return t={uuid:z,schemeIdURI:V,systemString:B,getInitData:function(e){let t=new Uint8Array([112,115,115,104,0,0,0,0]),n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),i,c,u,d,f,p=0,m=null;if(o(),!e)return null;if(`pssh`in e&&e.pssh)return l.parseInitDataFromContentProtection(e,r);if(`pro`in e&&e.pro)m=r.decodeArray(e.pro.__text);else{if(!(`prheader`in e)||!e.prheader)return null;m=r.decodeArray(e.prheader.__text)}return i=m.length,c=4+t.length+n.length+4+i,u=new ArrayBuffer(c),d=new Uint8Array(u),f=new DataView(u),f.setUint32(p,c),p+=4,d.set(t,p),p+=t.length,d.set(n,p),p+=n.length,f.setUint32(p,i),p+=4,d.set(m,p),p+=i,d.buffer},getRequestHeadersFromMessage:function(e){let t,r,o={},c=new DOMParser;if(i&&i.get().streaming.protection.detectPlayreadyMessageFormat&&n===`utf-16`&&e&&e.byteLength%2==1)return o[`Content-Type`]=`text/xml; charset=utf-8`,o;let l=n===`utf-16`?new Uint16Array(e):new Uint8Array(e);t=String.fromCharCode.apply(null,l),r=c.parseFromString(t,`application/xml`);let u=r.getElementsByTagName(`name`),d=r.getElementsByTagName(`value`);for(let e=0;e<u.length;e++)o[u[e].childNodes[0].nodeValue]=d[e].childNodes[0].nodeValue;return o.hasOwnProperty(`Content`)&&(o[`Content-Type`]=o.Content,delete o.Content),o.hasOwnProperty(`Content-Type`)||(o[`Content-Type`]=`text/xml; charset=utf-8`),o},getLicenseRequestFromMessage:function(e){let t=null,c=new DOMParser;if(i&&i.get().streaming.protection.detectPlayreadyMessageFormat&&n===`utf-16`&&e&&e.byteLength%2==1)return e;let l=n===`utf-16`?new Uint16Array(e):new Uint8Array(e);o();let u=String.fromCharCode.apply(null,l),d=c.parseFromString(u,`application/xml`);if(!d.getElementsByTagName(`PlayReadyKeyMessage`)[0])return e;{let e=d.getElementsByTagName(`Challenge`)[0].childNodes[0].nodeValue;e&&(t=r.decode(e))}return t},getLicenseServerURLFromInitData:function(e){if(e){let t=new DataView(e),n=t.getUint16(4,!0),r=6,i=new DOMParser;for(let o=0;o<n;o++){let n=t.getUint16(r,!0);r+=2;let o=t.getUint16(r,!0);if(r+=2,n!==1){r+=o;continue}let c=e.slice(r,r+o),l=String.fromCharCode.apply(null,new Uint16Array(c)),u=i.parseFromString(l,`application/xml`);if(u.getElementsByTagName(`LA_URL`)[0]){let e=u.getElementsByTagName(`LA_URL`)[0].childNodes[0].nodeValue;if(e)return e}if(u.getElementsByTagName(`LUI_URL`)[0]){let e=u.getElementsByTagName(`LUI_URL`)[0].childNodes[0].nodeValue;if(e)return e}}}return null},getCDMData:function(e){let t,n,i,c;if(o(),!e)return null;for(t=[],c=0;c<e.length;++c)t.push(e.charCodeAt(c)),t.push(0);for(t=String.fromCharCode.apply(null,t),t=r.encode(t),n=`<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>`.replace(`%CUSTOMDATA%`,t),i=[],c=0;c<n.length;++c)i.push(n.charCodeAt(c)),i.push(0);return new Uint8Array(i).buffer},setPlayReadyMessageFormat:function(e){if(e!==`utf-8`&&e!==`utf-16`)throw Error(`Specified message format is not one of "utf-8" or "utf-16"`);n=e}},t}H.__dashjs_factory_name=`KeySystemPlayReady`;var U=y.default.getSingletonFactory(H);function W(e){let t=(e||={}).BASE64,n={},r;return n[i.default.WIDEVINE_KEYSTEM_STRING]={responseType:`json`,getLicenseMessage:function(e){return t.decodeArray(e.license)},getErrorResponse:function(e){return e}},n[i.default.PLAYREADY_KEYSTEM_STRING]={responseType:`arraybuffer`,getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},r={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(e){return n[e].responseType},getLicenseMessage:function(e,r){return function(){if(!t||!t.hasOwnProperty(`decodeArray`))throw Error(`Missing config parameter(s)`)}(),n[r].getLicenseMessage(e)},getErrorResponse:function(e,t){return n[t].getErrorResponse(e)}},r}W.__dashjs_factory_name=`DRMToday`;var G=y.default.getSingletonFactory(W);function K(){let e,t=`http://schemas.xmlsoap.org/soap/envelope/`;function n(e){let t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}function r(e){if(window.DOMParser){let r=n(e),i=new window.DOMParser().parseFromString(r,`text/xml`),o=i?i.getElementsByTagNameNS(t,`Envelope`)[0]:null,c=o?o.getElementsByTagNameNS(t,`Body`)[0]:null;if(c&&c.getElementsByTagNameNS(t,`Fault`)[0])return null}return e}function i(e){let r=``,i=``,o=``,c=-1,l=-1;if(window.DOMParser){let u=n(e),d=new window.DOMParser().parseFromString(u,`text/xml`),f=d?d.getElementsByTagNameNS(t,`Envelope`)[0]:null,p=f?f.getElementsByTagNameNS(t,`Body`)[0]:null,m=p?p.getElementsByTagNameNS(t,`Fault`)[0]:null,h=m?m.getElementsByTagName(`detail`)[0]:null,g=h?h.getElementsByTagName(`Exception`)[0]:null,_=null;if(m===null)return u;_=m.getElementsByTagName(`faultstring`)[0].firstChild,r=_?_.nodeValue:null,g!==null&&(_=g.getElementsByTagName(`StatusCode`)[0],i=_?_.firstChild.nodeValue:null,_=g.getElementsByTagName(`Message`)[0],o=_?_.firstChild.nodeValue:null,c=o?o.lastIndexOf(`[`)+1:-1,l=o?o.indexOf(`]`):-1,o=o?o.substring(c,l):``)}let u=`code: ${i}, name: ${r}`;return o&&(u+=`, message: ${o}`),u}return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`arraybuffer`},getLicenseMessage:function(e){return r.call(this,e)},getErrorResponse:function(e){return i.call(this,e)}},e}K.__dashjs_factory_name=`PlayReady`;var ee=y.default.getSingletonFactory(K);function q(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`arraybuffer`},getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}q.__dashjs_factory_name=`Widevine`;var te=y.default.getSingletonFactory(q);function ne(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return`POST`},getResponseType:function(){return`json`},getLicenseMessage:function(e){if(!e.hasOwnProperty(`keys`))return null;let t=[];for(let n=0;n<e.keys.length;n++){let r=e.keys[n],i=r.kid.replace(/=/g,``),o=r.k.replace(/=/g,``);t.push(new S(i,o))}return new C(t)},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}ne.__dashjs_factory_name=`ClearKey`;var re=y.default.getSingletonFactory(ne),ie=class{constructor(e){this.ks=e.ks,this.keyId=e.keyId,this.initData=e.initData,this.protData=e.protData,this.cdmData=e.cdmData,this.sessionId=e.sessionId,this.sessionType=e.sessionType}};function J(){let e,t,n,r,o,c,u,d,f=this.context;function p(e,t){return t&&e in t?t[e]:null}function m(e,t){return e&&e.sessionId?e.sessionId:t&&t.sessionId?t.sessionId:null}function h(e,t){return e&&e.sessionType?e.sessionType:t}return e={getKeySystemBySystemString:function(e){for(let t=0;t<r.length;t++)if(r[t].systemString===e)return r[t];return null},getKeySystems:function(){return r},getLicenseServerModelInstance:function(e,t,n){if(n===i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_RELEASE||n===i.default.MEDIA_KEY_MESSAGE_TYPES.INDIVIDUALIZATION_REQUEST)return null;let r=null;return t&&t.hasOwnProperty(`drmtoday`)?r=G(f).getInstance({BASE64:o}):e.systemString===i.default.WIDEVINE_KEYSTEM_STRING?r=te(f).getInstance():e.systemString===i.default.PLAYREADY_KEYSTEM_STRING?r=ee(f).getInstance():e.systemString===i.default.CLEARKEY_KEYSTEM_STRING&&(r=re(f).getInstance()),r},getSupportedKeySystemMetadataFromContentProtection:function(e,t,n){let i,o,c,u,d=[];if(!e||!e.length)return d;let f=l.findMp4ProtectionElement(e);for(c=0;c<r.length;c++){o=r[c];let l=p(o.systemString,t);for(u=0;u<e.length;u++)if(i=e[u],i.schemeIdUri.toLowerCase()===o.schemeIdURI){let e=o.getInitData(i,f),t=new ie({ks:r[c],keyId:i.keyId,initData:e,protData:l,cdmData:o.getCDMData(l?l.cdmData:null),sessionId:m(l,i),sessionType:h(l,n)});l?d.unshift(t):d.push(t)}}return d},getSupportedKeySystemMetadataFromSegmentPssh:function(e,t,n){let i,o,c=[],u=l.parsePSSHList(e);for(let e=0;e<r.length;++e){i=r[e],o=i.systemString;let l=p(o,t);i.uuid in u&&c.push({ks:i,initData:u[i.uuid],protData:l,cdmData:i.getCDMData(l?l.cdmData:null),sessionId:m(l),sessionType:h(l,n)})}return c},initDataEquals:function(e,t){if(e.byteLength===t.byteLength){let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}return!1},initialize:function(){let e;r=[],e=U(f).getInstance({BASE64:o,settings:c}),r.push(e),e=R(f).getInstance({BASE64:o}),r.push(e),e=O(f).getInstance({BASE64:o}),r.push(e),u=e,e=N(f).getInstance({BASE64:o,debug:t}),r.push(e),d=e},isClearKey:function(e){return e===u||e===d},processClearKeyLicenseRequest:function(e,t,r){try{return e.getClearKeysFromProtectionData(t,r)}catch{return n.error(`Failed to retrieve clearkeys from ProtectionData`),null}},setConfig:function(r){r&&(r.debug&&(t=r.debug,n=t.getLogger(e)),r.BASE64&&(o=r.BASE64),r.settings&&(c=r.settings))},setKeySystems:function(e){r=e},setProtectionData:function(e){for(var t,n,i=0;i<r.length;i++){var o=r[i];o.hasOwnProperty(`init`)&&o.init((t=o.systemString,n=void 0,n=null,e&&(n=t in e?e[t]:null),n))}}},e}J.__dashjs_factory_name=`ProtectionKeyController`;var ae=y.default.getSingletonFactory(J),oe=n(445),se=class{constructor(e,t){this.initData=e,this.initDataType=t}},ce=class{constructor(e,t,n,r){this.sessionToken=e,this.message=t,this.defaultURL=n,this.messageType=r||i.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST}},le=class{constructor(e,t){this.keySystem=e,this.ksConfiguration=t,this.nativeMediaKeySystemAccessObject=null,this.selectedSystemString=null}};let ue={};function de(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c,l,u,d,m,h,g,_;function v(e,t,i,o){if(navigator.requestMediaKeySystemAccess===void 0||typeof navigator.requestMediaKeySystemAccess!=`function`){let e=`Insecure origins are not allowed`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),o({error:e});return}let c=e[t].protData&&e[t].protData.systemStringPriority?e[t].protData.systemStringPriority:null,l=e[t].configs,u=e[t].ks,d=u.systemString;(function(e,t){return new Promise(((n,r)=>{y(e,t,0,n,r)}))})(c||(ue[d]?ue[d]:[d]),l).then((e=>{let t=new le(u,e&&e.nativeMediaKeySystemAccessObject&&typeof e.nativeMediaKeySystemAccessObject.getConfiguration==`function`?e.nativeMediaKeySystemAccessObject.getConfiguration():null);t.selectedSystemString=e.selectedSystemString,t.nativeMediaKeySystemAccessObject=e.nativeMediaKeySystemAccessObject,n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:t}),i({data:t})})).catch((c=>{if(t+1<e.length)v(e,t+1,i,o);else{let e=`Key system access denied! `;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e+c.message}),o({error:e+c.message})}}))}function y(e,t,n,r,i){let o=e[n];l.debug(`Requesting key system access for system string ${o}`),navigator.requestMediaKeySystemAccess(o,t).then((e=>{r({nativeMediaKeySystemAccessObject:e,selectedSystemString:o})})).catch((o=>{n+1<e.length?y(e,t,n+1,r,i):i(o)}))}function b(e){if(!e||!e.session)return Promise.resolve;let t=e.session;return t.removeEventListener(`keystatuseschange`,e),t.removeEventListener(`message`,e),t.close()}function x(e){for(let t=0;t<h.length;t++)if(h[t]===e){h.splice(t,1);break}}function S(e,t){let o={session:e,keyId:t.keyId,normalizedKeyId:t&&t.keyId&&typeof t.keyId==`string`?t.keyId.replace(/-/g,``).toLowerCase():``,initData:t.initData,sessionId:t.sessionId,sessionType:t.sessionType,hasTriggeredKeyStatusMapUpdate:!1,handleEvent:function(e){switch(e.type){case`keystatuseschange`:this._onKeyStatusesChange(e);break;case`message`:this._onKeyMessage(e)}},_onKeyStatusesChange:function(e){n.trigger(r.KEY_STATUSES_CHANGED,{data:this});let t=[];e.target.keyStatuses.forEach((function(){t.push(C(arguments))})),n.trigger(r.INTERNAL_KEY_STATUSES_CHANGED,{parsedKeyStatuses:t,sessionToken:o})},_onKeyMessage:function(e){let t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,void 0,e.messageType)})},getKeyId:function(){return this.keyId},getSessionId:function(){return e.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){let t=!1;return e.keyStatuses.forEach((function(){C(arguments).status===i.default.MEDIA_KEY_STATUSES.USABLE&&(t=!0)})),t}};return e.addEventListener(`keystatuseschange`,o),e.addEventListener(`message`,o),e.closed.then((()=>{x(o),l.debug(`DRM: Session closed. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CLOSED,{data:o.getSessionId()})})),h.push(o),o}function C(e){let t,n;return e&&e.length>0&&(e[0]&&(typeof e[0]==`string`?t=e[0]:n=e[0]),e[1]&&(typeof e[1]==`string`?t=e[1]:n=e[1])),{status:t,keyId:n}}return c={closeKeySession:function(e){b(e).catch((function(t){x(e),n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:`Error closing session (`+e.getSessionId()+`) `+t.name})}))},createKeySession:function(e){if(!u||!m)throw Error(`Can not create sessions until you have selected a key system`);let t=m.createSession(e.sessionType),o=S(t,e),c=u.systemString===i.default.CLEARKEY_KEYSTEM_STRING&&(e.initData||e.protData&&e.protData.clearkeys)?i.default.INITIALIZATION_DATA_TYPE_KEYIDS:i.default.INITIALIZATION_DATA_TYPE_CENC;t.generateRequest(c,e.initData).then((function(){l.debug(`DRM: Session created. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:o})})).catch((function(e){x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Error generating key request -- `+e.name)})}))},getAllInitData:function(){let e=[];for(let t=0;t<h.length;t++)h[t].initData&&e.push(h[t].initData);return e},getSessionTokens:function(){return h},loadKeySession:function(e){if(!u||!m)throw Error(`Can not load sessions until you have selected a key system`);let t=e.sessionId;for(let e=0;e<h.length;e++)if(t===h[e].sessionId)return void l.warn(`DRM: Ignoring session ID because we have already seen it!`);let i=m.createSession(e.sessionType),o=S(i,e);o.hasTriggeredKeyStatusMapUpdate=!0,i.load(t).then((function(e){e?(l.debug(`DRM: Session loaded. SessionID = `+o.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:o})):(x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Could not load session! Invalid Session ID (`+t+`)`)}))})).catch((function(e){x(o),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new p.default(f.default.KEY_SESSION_CREATED_ERROR_CODE,f.default.KEY_SESSION_CREATED_ERROR_MESSAGE+`Could not load session (`+t+`)! `+e.name)})}))},removeKeySession:function(e){e.session.remove().then((function(){l.debug(`DRM: Session removed. SessionID = `+e.getSessionId()),n.trigger(r.KEY_SESSION_REMOVED,{data:e.getSessionId()})}),(function(t){n.trigger(r.KEY_SESSION_REMOVED,{data:null,error:`Error removing session (`+e.getSessionId()+`). `+t.name})}))},requestKeySystemAccess:function(e){return new Promise(((t,n)=>{v(e,0,t,n)}))},reset:function(){let e=h.length,t;if(e!==0){let i=function(e){x(e),h.length===0&&(d?(d.removeEventListener(`encrypted`,g),d.setMediaKeys(null).then((function(){n.trigger(r.TEARDOWN_COMPLETE)}))):n.trigger(r.TEARDOWN_COMPLETE))};for(let n=0;n<e;n++)t=h[n],function(e){b(t),i(e)}(t)}else n.trigger(r.TEARDOWN_COMPLETE)},selectKeySystem:function(e){return new Promise(((t,n)=>{e.nativeMediaKeySystemAccessObject.createMediaKeys().then((t=>(u=e.keySystem,m=t,d?d.setMediaKeys(m):Promise.resolve()))).then((()=>{t(u)})).catch((function(){n({error:`Error selecting keys system (`+e.keySystem.systemString+`)! Could not create MediaKeys -- TODO`})}))}))},setMediaElement:function(e){d!==e&&(d&&(d.removeEventListener(`encrypted`,g),d.setMediaKeys&&d.setMediaKeys(null)),d=e,d&&(d.addEventListener(`encrypted`,g),d.setMediaKeys&&m&&d.setMediaKeys(m)))},setServerCertificate:function(e){return new Promise((t=>{m.setServerCertificate(e).then((function(){l.info(`DRM: License server certificate successfully updated.`),n.trigger(r.SERVER_CERTIFICATE_UPDATED),t()})).catch((e=>{n.trigger(r.SERVER_CERTIFICATE_UPDATED,{error:new p.default(f.default.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,f.default.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+e.name)}),t()}))}))},stop:function(){let e;for(let t=0;t<h.length;t++)e=h[t],e.getUsable()||(b(e),x(e))},updateKeySession:function(e,t){let i=e.session;_.isClearKey(u)&&(t=t.toJWK()),i.update(t).then((()=>{n.trigger(r.KEY_SESSION_UPDATED)})).catch((function(t){n.trigger(r.KEY_ERROR,{error:new p.default(f.default.MEDIA_KEYERR_CODE,`Error sending update() message! `+t.name,e)})}))}},l=o.getLogger(c),u=null,d=null,m=null,h=[],_=ae(t).getInstance(),g={handleEvent:function(e){if(e.type===`encrypted`&&e.initData){let t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(t,e.initDataType)})}}},c}ue[i.default.PLAYREADY_KEYSTEM_STRING]=[i.default.PLAYREADY_KEYSTEM_STRING,i.default.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING],ue[i.default.WIDEVINE_KEYSTEM_STRING]=[i.default.WIDEVINE_KEYSTEM_STRING],ue[i.default.CLEARKEY_KEYSTEM_STRING]=[i.default.CLEARKEY_KEYSTEM_STRING],de.__dashjs_factory_name=`DefaultProtectionModel`;var fe=y.default.getClassFactory(de);function pe(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c=e.api,l,u,m,h,g,_,v,y,b;function x(){try{for(let e=0;e<v.length;e++)S(v[e]);m&&m.removeEventListener(c.needkey,y),n.trigger(r.TEARDOWN_COMPLETE)}catch(e){n.trigger(r.TEARDOWN_COMPLETE,{error:`Error tearing down key sessions and MediaKeys! -- `+e.message})}}function S(e){let t=e.session;t.removeEventListener(c.error,e),t.removeEventListener(c.message,e),t.removeEventListener(c.ready,e),t.removeEventListener(c.close,e);for(let t=0;t<v.length;t++)if(v[t]===e){v.splice(t,1);break}t[c.release]()}function C(){let e=null,t=function(){m.removeEventListener(`loadedmetadata`,e),m[c.setMediaKeys](g),n.trigger(r.VIDEO_ELEMENT_SELECTED)};m.readyState>=1?t():(e=t.bind(this),m.addEventListener(`loadedmetadata`,e))}return l={getAllInitData:function(){let e=[];for(let t=0;t<v.length;t++)e.push(v[t].initData);return e},getSessionTokens:function(){return v},requestKeySystemAccess:function(e){return new Promise(((t,i)=>{let o=!1;for(let i=0;i<e.length;i++){let l=e[i].ks.systemString,u=e[i].configs,f=null,p=null;for(let e=0;e<u.length;e++){let i=u[e].audioCapabilities,m=u[e].videoCapabilities;if(i&&i.length!==0){f=[];for(let e=0;e<i.length;e++)window[c.MediaKeys].isTypeSupported(l,i[e].contentType)&&f.push(i[e])}if(m&&m.length!==0){p=[];for(let e=0;e<m.length;e++)window[c.MediaKeys].isTypeSupported(l,m[e].contentType)&&p.push(m[e])}if(!f&&!p||f&&f.length===0||p&&p.length===0)continue;o=!0;let h=new d(f,p),g=new le(b.getKeySystemBySystemString(l),h);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:g}),t({data:g});break}}if(!o){let e=`Key system access denied! -- No valid audio/video content configurations detected!`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),i({error:e})}}))},selectKeySystem:function(e){return new Promise(((t,n)=>{try{g=e.mediaKeys=new window[c.MediaKeys](e.keySystem.systemString),h=e.keySystem,_=e,m&&C(),t(h)}catch{n({error:`Error selecting keys system (`+h.systemString+`)! Could not create MediaKeys -- TODO`})}}))},setMediaElement:function(e){m!==e&&(m&&m.removeEventListener(c.needkey,y),m=e,m&&(m.addEventListener(c.needkey,y),g&&C()))},createKeySession:function(e){if(!h||!g||!_)throw Error(`Can not create sessions until you have selected a key system`);let t=null;if(_.ksConfiguration.videoCapabilities&&_.ksConfiguration.videoCapabilities.length>0&&(t=_.ksConfiguration.videoCapabilities[0]),t===null&&_.ksConfiguration.audioCapabilities&&_.ksConfiguration.audioCapabilities.length>0&&(t=_.ksConfiguration.audioCapabilities[0]),t===null)throw Error(`Can not create sessions for unknown content types.`);let i=t.contentType,o=g.createSession(i,new Uint8Array(e.initData),e.cdmData?new Uint8Array(e.cdmData):null),l=function(e,t){return{session:e,keyId:t.keyId,normalizedKeyId:t&&t.keyId&&typeof t.keyId==`string`?t.keyId.replace(/-/g,``).toLowerCase():``,initData:t.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return`temporary`},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}},handleEvent:function(e){switch(e.type){case c.error:n.trigger(r.KEY_ERROR,{error:new p.default(f.default.MEDIA_KEYERR_CODE,`KeyError`,this)});break;case c.message:let t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,e.destinationURL)});break;case c.ready:u.debug(`DRM: Key added.`),n.trigger(r.KEY_ADDED);break;case c.close:u.debug(`DRM: Session closed. SessionID = `+this.getSessionId()),n.trigger(r.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}}(o,e);o.addEventListener(c.error,l),o.addEventListener(c.message,l),o.addEventListener(c.ready,l),o.addEventListener(c.close,l),v.push(l),u.debug(`DRM: Session created. SessionID = `+l.getSessionId()),n.trigger(r.KEY_SESSION_CREATED,{data:l})},updateKeySession:function(e,t){let i=e.session;b.isClearKey(h)?i.update(new Uint8Array(t.toJWK())):i.update(new Uint8Array(t)),n.trigger(r.KEY_SESSION_UPDATED)},closeKeySession:S,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:x,reset:x},u=o.getLogger(l),m=null,h=null,g=null,_=null,v=[],b=ae(t).getInstance(),y={handleEvent:function(e){if(e.type===c.needkey&&e.initData){let t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(t,i.default.INITIALIZATION_DATA_TYPE_CENC)})}}},l}pe.__dashjs_factory_name=`ProtectionModel_3Feb2014`;var me=y.default.getClassFactory(pe);function he(e){e||={};let t=this.context,n=e.eventBus,r=e.events,o=e.debug,c=e.api,l=e.errHandler,u,m,h,g,_,v,y,b,x;function S(){h&&T();for(let e=0;e<y.length;e++)C(y[e]);n.trigger(r.TEARDOWN_COMPLETE)}function C(e){try{h[c.cancelKeyRequest](g.systemString,e.sessionId)}catch(t){n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:`Error closing session (`+e.sessionId+`) `+t.message})}}function w(e,t){if(t&&e){let n=e.length;for(let r=0;r<n;r++)if(e[r].sessionId==t)return e[r];return null}return null}function T(){h.removeEventListener(c.keyerror,x),h.removeEventListener(c.needkey,x),h.removeEventListener(c.keymessage,x),h.removeEventListener(c.keyadded,x)}return u={getAllInitData:function(){let e=[];for(let t=0;t<v.length;t++)e.push(v[t].initData);for(let t=0;t<y.length;t++)e.push(y[t].initData);return e},getSessionTokens:function(){return y.concat(v)},requestKeySystemAccess:function(e){return new Promise(((t,i)=>{let o=h;o||=document.createElement(`video`);let c=!1;for(let i=0;i<e.length;i++){let l=e[i].ks.systemString,u=e[i].configs,f=null;for(let e=0;e<u.length;e++){let i=u[e].videoCapabilities;if(i&&i.length!==0){f=[];for(let e=0;e<i.length;e++)o.canPlayType(i[e].contentType,l)!==``&&f.push(i[e])}if(!f||f&&f.length===0)continue;c=!0;let p=new d(null,f),m=new le(_.getKeySystemBySystemString(l),p);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:m}),t({data:m});break}}if(!c){let e=`Key system access denied! -- No valid audio/video content configurations detected!`;n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:e}),i({error:e})}}))},selectKeySystem:function(e){return g=e.keySystem,Promise.resolve(g)},setMediaElement:function(e){if(h!==e){if(h){T();for(var t=0;t<y.length;t++)C(y[t]);y=[]}h=e,h&&(h.addEventListener(c.keyerror,x),h.addEventListener(c.needkey,x),h.addEventListener(c.keymessage,x),h.addEventListener(c.keyadded,x),n.trigger(r.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(e){if(!g)throw Error(`Can not create sessions until you have selected a key system`);if(b||y.length===0){let t={sessionId:null,keyId:e.keyId,normalizedKeyId:e&&e.keyId&&typeof e.keyId==`string`?e.keyId.replace(/-/g,``).toLowerCase():``,initData:e.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return`temporary`},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}}};return v.push(t),h[c.generateKeyRequest](g.systemString,new Uint8Array(e.initData)),t}throw Error(`Multiple sessions not allowed!`)},updateKeySession:function(e,t){let i=e.sessionId;if(_.isClearKey(g))for(let e=0;e<t.keyPairs.length;e++)h[c.addKey](g.systemString,t.keyPairs[e].key,t.keyPairs[e].keyID,i);else h[c.addKey](g.systemString,new Uint8Array(t),new Uint8Array(e.initData),i);n.trigger(r.KEY_SESSION_UPDATED)},closeKeySession:C,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:S,reset:S},m=o.getLogger(u),h=null,g=null,v=[],y=[],_=ae(t).getInstance(),x={handleEvent:function(e){let t=null;switch(e.type){case c.needkey:let o=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new se(o,i.default.INITIALIZATION_DATA_TYPE_CENC)});break;case c.keyerror:if(t=w(y,e.sessionId),t||=w(v,e.sessionId),t){let i=f.default.MEDIA_KEYERR_CODE,o=``;switch(e.errorCode.code){case 1:i=f.default.MEDIA_KEYERR_UNKNOWN_CODE,o+=`MEDIA_KEYERR_UNKNOWN - `+f.default.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:i=f.default.MEDIA_KEYERR_CLIENT_CODE,o+=`MEDIA_KEYERR_CLIENT - `+f.default.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:i=f.default.MEDIA_KEYERR_SERVICE_CODE,o+=`MEDIA_KEYERR_SERVICE - `+f.default.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:i=f.default.MEDIA_KEYERR_OUTPUT_CODE,o+=`MEDIA_KEYERR_OUTPUT - `+f.default.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:i=f.default.MEDIA_KEYERR_HARDWARECHANGE_CODE,o+=`MEDIA_KEYERR_HARDWARECHANGE - `+f.default.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:i=f.default.MEDIA_KEYERR_DOMAIN_CODE,o+=`MEDIA_KEYERR_DOMAIN - `+f.default.MEDIA_KEYERR_DOMAIN_MESSAGE}o+=` System Code = `+e.systemCode,n.trigger(r.KEY_ERROR,{error:new p.default(i,o,t)})}else m.error(`No session token found for key error`);break;case c.keyadded:t=w(y,e.sessionId),t||=w(v,e.sessionId),t?(m.debug(`DRM: Key added.`),n.trigger(r.KEY_ADDED,{data:t})):m.debug(`No session token found for key added`);break;case c.keymessage:if(b=e.sessionId!==null&&e.sessionId!==void 0,b?(t=w(y,e.sessionId),!t&&v.length>0&&(t=v.shift(),y.push(t),t.sessionId=e.sessionId,n.trigger(r.KEY_SESSION_CREATED,{data:t}))):v.length>0&&(t=v.shift(),y.push(t),v.length!==0&&l.error(new p.default(f.default.MEDIA_KEY_MESSAGE_ERROR_CODE,f.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){let i=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=i,n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new ce(t,i,e.defaultURL)})}else m.warn(`No session token found for key message`)}}},u}he.__dashjs_factory_name=`ProtectionModel_01b`;var ge=y.default.getClassFactory(he);let _e=[{generateKeyRequest:`generateKeyRequest`,addKey:`addKey`,cancelKeyRequest:`cancelKeyRequest`,needkey:`needkey`,keyerror:`keyerror`,keyadded:`keyadded`,keymessage:`keymessage`},{generateKeyRequest:`webkitGenerateKeyRequest`,addKey:`webkitAddKey`,cancelKeyRequest:`webkitCancelKeyRequest`,needkey:`webkitneedkey`,keyerror:`webkitkeyerror`,keyadded:`webkitkeyadded`,keymessage:`webkitkeymessage`}],ve=[{setMediaKeys:`setMediaKeys`,MediaKeys:`MediaKeys`,release:`close`,needkey:`needkey`,error:`keyerror`,message:`keymessage`,ready:`keyadded`,close:`keyclose`},{setMediaKeys:`msSetMediaKeys`,MediaKeys:`MSMediaKeys`,release:`close`,needkey:`msneedkey`,error:`mskeyerror`,message:`mskeymessage`,ready:`mskeyadded`,close:`mskeyclose`}];function ye(){let e,t=this.context;function n(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(typeof e[r[Object.keys(r)[0]]]==`function`)return r}return null}return e={createProtectionSystem:function(r){let i=null,o=ae(t).getInstance();o.setConfig({debug:r.debug,BASE64:r.BASE64,settings:r.settings}),o.initialize();let c=function(r){let i=r.debug,o=i.getLogger(e),c=r.eventBus,l=r.errHandler,u=r.videoModel?r.videoModel.getElement():null;return u&&u.onencrypted===void 0||u&&u.mediaKeys===void 0?n(u,ve)?(o.info(`EME detected on this user agent! (ProtectionModel_3Feb2014)`),me(t).create({debug:i,eventBus:c,events:r.events,api:n(u,ve)})):n(u,_e)?(o.info(`EME detected on this user agent! (ProtectionModel_01b)`),ge(t).create({debug:i,eventBus:c,errHandler:l,events:r.events,api:n(u,_e)})):(o.warn(`No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!`),null):(o.info(`EME detected on this user agent! (DefaultProtectionModel`),fe(t).create({debug:i,eventBus:c,events:r.events}))}(r);return c&&(i=x(t).create({BASE64:r.BASE64,cmcdModel:r.cmcdModel,constants:r.constants,customParametersModel:r.customParametersModel,debug:r.debug,eventBus:r.eventBus,events:r.events,protectionKeyController:o,protectionModel:c,settings:r.settings}),r.capabilities.setEncryptedMediaSupported(!0)),i}},e}ye.__dashjs_factory_name=`Protection`;let be=y.default.getClassFactory(ye);be.events=oe.default,be.errors=f.default,y.default.updateClassFactory(ye.__dashjs_factory_name,be);var xe=be},445:function(e,t,n){n.r(t);var r=n(7252);class i extends r.default{constructor(){super(),this.INTERNAL_KEY_MESSAGE=`internalKeyMessage`,this.INTERNAL_KEY_STATUSES_CHANGED=`internalkeyStatusesChanged`,this.KEY_ADDED=`public_keyAdded`,this.KEY_ERROR=`public_keyError`,this.KEY_MESSAGE=`public_keyMessage`,this.KEY_SESSION_CLOSED=`public_keySessionClosed`,this.KEY_SESSION_CREATED=`public_keySessionCreated`,this.KEY_SESSION_REMOVED=`public_keySessionRemoved`,this.KEY_STATUSES_CHANGED=`public_keyStatusesChanged`,this.KEY_STATUSES_MAP_UPDATED=`keyStatusesMapUpdated`,this.KEY_SYSTEM_ACCESS_COMPLETE=`public_keySystemAccessComplete`,this.KEY_SYSTEM_SELECTED=`public_keySystemSelected`,this.LICENSE_REQUEST_COMPLETE=`public_licenseRequestComplete`,this.LICENSE_REQUEST_SENDING=`public_licenseRequestSending`,this.NEED_KEY=`needkey`,this.PROTECTION_CREATED=`public_protectioncreated`,this.PROTECTION_DESTROYED=`public_protectiondestroyed`,this.SERVER_CERTIFICATE_UPDATED=`serverCertificateUpdated`,this.TEARDOWN_COMPLETE=`protectionTeardownComplete`,this.VIDEO_ELEMENT_SELECTED=`videoElementSelected`,this.KEY_SESSION_UPDATED=`public_keySessionUpdated`}}t.default=new i},1923:function(e,t,n){n.r(t);var r=n(8748);class i extends r.default{constructor(){super(),this.MEDIA_KEYERR_CODE=100,this.MEDIA_KEYERR_UNKNOWN_CODE=101,this.MEDIA_KEYERR_CLIENT_CODE=102,this.MEDIA_KEYERR_SERVICE_CODE=103,this.MEDIA_KEYERR_OUTPUT_CODE=104,this.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,this.MEDIA_KEYERR_DOMAIN_CODE=106,this.MEDIA_KEY_MESSAGE_ERROR_CODE=107,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,this.KEY_SESSION_CREATED_ERROR_CODE=113,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,this.MEDIA_KEYERR_UNKNOWN_MESSAGE=`An unspecified error occurred. This value is used for errors that don't match any of the other codes.`,this.MEDIA_KEYERR_CLIENT_MESSAGE=`The Key System could not be installed or updated.`,this.MEDIA_KEYERR_SERVICE_MESSAGE=`The message passed into update indicated an error from the license service.`,this.MEDIA_KEYERR_OUTPUT_MESSAGE=`There is no available output device with the required characteristics for the content protection system.`,this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE=`A hardware configuration change caused a content protection error.`,this.MEDIA_KEYERR_DOMAIN_MESSAGE=`An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.`,this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE=`Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!`,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE=`DRM: Empty key message from CDM`,this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE=`Error updating server certificate -- `,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE=`DRM: KeyStatusChange error! -- License has expired`,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE=`DRM: No license server URL specified!`,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE=`DRM: KeySystem Access Denied! -- `,this.KEY_SESSION_CREATED_ERROR_MESSAGE=`DRM: unable to create session! --`,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE=`DRM: licenser error! --`}}t.default=new i},4246:function(e,t,n){n.r(t);var r=n(138);let i={DEFAULT:.5,STRONG:1,WEAK:0};function o(e,t,n,r){let o,c,l,u,d;return c=e===void 0?null:e,l=function(e){let t=i.DEFAULT;return e!==i.DEFAULT&&e!==i.STRONG&&e!==i.WEAK||(t=e),t}(n),u=t===void 0?null:t,d=r===void 0?null:r,o={representation:c,reason:u,rule:d,priority:l},o}o.__dashjs_factory_name=`SwitchRequest`;let c=r.default.getClassFactory(o);c.NO_CHANGE=null,c.PRIORITY=i,r.default.updateClassFactory(o.__dashjs_factory_name,c),t.default=c},559:function(e,t,n){n.r(t),n.d(t,{supportsMediaSource:function(){return u}});var r=n(138),i=n(5212),o=n(2861),c=n(7393),l=n(649);function u(){let e=`ManagedMediaSource`in window,t=`WebKitMediaSource`in window,n=`MediaSource`in window;return e||t||n}function d(){let e,t,n,r,d,f,p=this.context,m=(0,c.default)(p).getInstance();function h(e,t){let n;t===i.default.VIDEO?n=function(e){let t={video:{}};return e?(e.width&&(t.video.width=e.width),e.height&&(t.video.height=e.height),e.framerate&&(t.video.framerate=parseFloat(e.framerate)),e.hdrMetadataType&&(t.video.hdrMetadataType=e.hdrMetadataType),e.colorGamut&&(t.video.colorGamut=e.colorGamut),e.transferFunction&&(t.video.transferFunction=e.transferFunction),t):t}(e):t===i.default.AUDIO&&(n=function(e){let t={audio:{}};return e.samplerate&&(t.audio.samplerate=e.samplerate),e.channels&&(t.audio.channels=e.channels),t}(e)),n[t].contentType=e.codec,n[t].bitrate=parseInt(e.bitrate),n.type=`media-source`;let r=e.codec;return e.width&&e.height&&(r+=`;width="`+e.width+`";height="`+e.height+`"`),n.mediaSourceCodecString=r,function(e,t,n){if(!t||!t.keySystemsMetadata||t.keySystemsMetadata.length===0)return[e];let r=[];return t.keySystemsMetadata.forEach((t=>{if(!t.ks)return void r.push({...e});let c=t.protData&&t.protData.systemStringPriority?t.protData.systemStringPriority:null,l=t.ks.systemString;(c||[l]).forEach((c=>{let l={...e};l.keySystemConfiguration={},c&&(l.keySystemConfiguration.keySystem=c);let u=``;t.ks.systemString===o.default.WIDEVINE_KEYSTEM_STRING&&(u=o.default.ROBUSTNESS_STRINGS.WIDEVINE.SW_SECURE_CRYPTO);let d=t.protData,f=d&&d.audioRobustness&&d.audioRobustness.length>0?d.audioRobustness:u,p=d&&d.videoRobustness&&d.videoRobustness.length>0?d.videoRobustness:u;n===i.default.AUDIO?l.keySystemConfiguration[n]={robustness:f}:n===i.default.VIDEO&&(l.keySystemConfiguration[n]={robustness:p}),r.push(l)}))})),r}(n,e,t)}function g(e){return t.get().streaming.enhancement.codecs.some((t=>e.includes(t)))}function _(e){if(r&&r.length!==0&&e)return r.find((t=>{let n=v(e,t,i.default.AUDIO),r=v(e,t,i.default.VIDEO),o=v(e,t,`keySystemConfiguration`);return n&&r&&o}))}function v(e,t,n){return!e[n]&&!t[n]||!(!e[n]||!t[n])&&m.areEqual(e[n],t[n])}function y(e,t){return(e=e.filter((e=>!(e.schemeIdUri&&t.some((t=>t.schemeIdUri===e.schemeIdUri)))))).push(...t),e}return e={areKeyIdsExpired:function(e){return!!(n&&e&&e.normalizedKeyIds&&e.normalizedKeyIds.size!==0)&&n.areKeyIdsExpired(e.normalizedKeyIds)},areKeyIdsUsable:function(e){return!(n&&e&&e.normalizedKeyIds&&e.normalizedKeyIds.size!==0)||n.areKeyIdsUsable(e.normalizedKeyIds)},isCodecSupportedBasedOnTestedConfigurations:function(e,t){if(!e||!e.codec||!1===e.isSupported)return!1;let n=h(e,t).map((e=>_(e))).filter((e=>e!=null));return!(n&&n.length>0)||function(e){return e.some((e=>e&&e.decodingInfo&&e.decodingInfo.supported))}(n)},isProtectionCompatible:function(e,t){return!t||!(!e.isEncrypted&&t.isEncrypted)},runCodecSupportCheck:function(e,n){if(n!==i.default.AUDIO&&n!==i.default.VIDEO)return Promise.resolve();if(t.get().streaming.enhancement.enabled&&g(e.codec))return r=r.filter((e=>!g(e.mediaSourceCodecString))),Promise.resolve(!0);let o=h(e,n);return function(e,n){return t.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(e.codec&&n===i.default.AUDIO||n===i.default.VIDEO&&e.codec&&e.width&&e.height&&e.bitrate&&e.framerate)}(e,n)?function(e){return new Promise((t=>{if(!e||e.length===0)return void t();let n=e.map((e=>function(e){return new Promise((t=>{_(e)?t():navigator.mediaCapabilities.decodingInfo(e).then((n=>{e.decodingInfo=n,r.push(e),t()})).catch((n=>{e.decodingInfo={supported:!1},r.push(e),f.error(n),t()}))}))}(e)));Promise.allSettled(n).then((()=>{t()})).catch((e=>{f.error(e),t()}))}))}(o):(function(e){if(!e||!e.length)return;let t=e[0];if(_(t))return;let n={supported:!1};(`ManagedMediaSource`in window&&ManagedMediaSource.isTypeSupported(t.mediaSourceCodecString)||`MediaSource`in window&&MediaSource.isTypeSupported(t.mediaSourceCodecString)||`WebKitMediaSource`in window&&WebKitMediaSource.isTypeSupported(t.mediaSourceCodecString))&&(n.supported=!0),t.decodingInfo=n,r.push(t)}(o),Promise.resolve())},setConfig:function(e){e&&(e.settings&&(t=e.settings),e.protectionController&&(n=e.protectionController))},setEncryptedMediaSupported:function(e){d=e},setProtectionController:function(e){n=e},supportsChangeType:function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType},supportsEncryptedMedia:function(){return d},supportsEssentialProperty:function(e){let n=t.get().streaming.capabilities.supportedEssentialProperties;t.get().streaming.capabilities.useMediaCapabilitiesApi&&t.get().streaming.capabilities.filterVideoColorimetryEssentialProperties&&(n=y(n,[{schemeIdUri:i.default.COLOUR_PRIMARIES_SCHEME_ID_URI},{schemeIdUri:i.default.MATRIX_COEFFICIENTS_SCHEME_ID_URI},{schemeIdUri:i.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI}])),t.get().streaming.capabilities.useMediaCapabilitiesApi&&t.get().streaming.capabilities.filterHDRMetadataFormatEssentialProperties&&(n=y(n,[{schemeIdUri:i.default.HDR_METADATA_FORMAT_SCHEME_ID_URI}]));try{return e.inArray(n)}catch{return!0}},supportsMediaSource:u},d=!1,r=[],f=(0,l.default)(p).getInstance().getLogger(e),e}d.__dashjs_factory_name=`Capabilities`,t.default=r.default.getSingletonFactory(d)},7377:function(e,t,n){n.r(t);var r=n(138),i=n(656);function o(){return{customTimeRangeArray:[],length:0,add:function(e,t){let n;for(n=0;n<this.customTimeRangeArray.length&&e>this.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n<this.customTimeRangeArray.length-1;n++)this.mergeRanges(n,n+1)&&n--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(e,t){for(let n=0;n<this.customTimeRangeArray.length;n++)if(e<=this.customTimeRangeArray[n].start&&t>=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end){this.customTimeRangeArray.splice(n+1,0,{start:t,end:this.customTimeRangeArray[n].end}),this.customTimeRangeArray[n].end=e;break}e>this.customTimeRangeArray[n].start&&e<this.customTimeRangeArray[n].end?this.customTimeRangeArray[n].end=e:t>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end&&(this.customTimeRangeArray[n].start=t)}this.length=this.customTimeRangeArray.length},mergeRanges:function(e,t){let n=this.customTimeRangeArray[e],r=this.customTimeRangeArray[t];return n.start<=r.start&&r.start<=n.end&&n.end<=r.end?(n.end=r.end,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&r.end<=n.end?(n.start=r.start,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&n.end<=r.end?(this.customTimeRangeArray.splice(e,1),!0):n.start<=r.start&&r.start<=n.end&&r.end<=n.end&&(this.customTimeRangeArray.splice(t,1),!0)},start:function(e){return(0,i.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return(0,i.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}o.__dashjs_factory_name=`CustomTimeRanges`,t.default=r.default.getClassFactory(o)},7393:function(e,t,n){n.r(t);var r=n(138),i=n(7316);function o(){let e;return e={areEqual:function(e,t){return i(e,t)}},e}o.__dashjs_factory_name=`ObjectUtils`,t.default=r.default.getSingletonFactory(o)},656:function(e,t,n){n.r(t),n.d(t,{checkInteger:function(){return o},checkIsVideoOrAudioType:function(){return l},checkParameterType:function(){return i},checkRange:function(){return c}});var r=n(5212);function i(e,t){if(typeof e!==t)throw r.default.BAD_ARGUMENT_ERROR}function o(e){if(e===null||isNaN(e)||e%1!=0)throw r.default.BAD_ARGUMENT_ERROR+` : argument is not an integer`}function c(e,t,n){if(e<t||e>n)throw r.default.BAD_ARGUMENT_ERROR+` : argument out of range`}function l(e){if(typeof e!=`string`||e!==r.default.AUDIO&&e!==r.default.VIDEO)throw r.default.BAD_ARGUMENT_ERROR}},1944:function(e,t,n){n.r(t),t.default=class{constructor(e,t,n){this.code=e||null,this.message=t||null,this.data=n||null}}},5560:function(e,t,n){n.r(t);var r=n(8854);t.default=class{constructor(e){this.id=e.id,this.url=e.url,this.language=e.language,this.mimeType=e.mimeType,this.bandwidth=e.bandwidth,this.periodId=e.periodId||null}serializeToMpdParserFormat(){return{tagName:r.default.ADAPTATION_SET,mimeType:this.mimeType,lang:this.language,Representation:[{tagName:r.default.REPRESENTATION,id:this.id,bandwidth:this.bandwidth,BaseURL:[{tagName:r.default.BASE_URL,__text:this.url}],mimeType:this.mimeType}]}}}},7568:function(e,t,n){n.r(t),n.d(t,{HTTPRequest:function(){return r},HTTPRequestTrace:function(){return i}});class r{constructor(){this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this.cmsd=null,this._stream=null,this._tfinish=null,this._mediaduration=null,this._responseHeaders=null,this._serviceLocation=null,this._fileLoaderType=null,this._resourceTimingValues=null}}class i{constructor(){this.s=null,this.d=null,this.b=[]}}r.GET=`GET`,r.HEAD=`HEAD`,r.MPD_TYPE=`MPD`,r.XLINK_EXPANSION_TYPE=`XLinkExpansion`,r.INIT_SEGMENT_TYPE=`InitializationSegment`,r.INDEX_SEGMENT_TYPE=`IndexSegment`,r.MEDIA_SEGMENT_TYPE=`MediaSegment`,r.BITSTREAM_SWITCHING_SEGMENT_TYPE=`BitstreamSwitchingSegment`,r.MSS_FRAGMENT_INFO_SEGMENT_TYPE=`FragmentInfoSegment`,r.DVB_REPORTING_TYPE=`DVBReporting`,r.LICENSE=`license`,r.CONTENT_STEERING_TYPE=`ContentSteering`,r.OTHER_TYPE=`other`}},ud={},cd.amdO={},cd.d=function(e,t){for(var n in t)cd.o(t,n)&&!cd.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},cd.g=function(){if(typeof globalThis==`object`)return globalThis;try{return this||Function(`return this`)()}catch{if(typeof window==`object`)return window}}(),cd.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},cd.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})},dd={},cd.r(dd),cd.d(dd,{Constants:function(){return bd.default},Debug:function(){return yd.default},ExternalSubtitle:function(){return Sd.default},MediaPlayer:function(){return fd.MediaPlayer},MediaPlayerFactory:function(){return vd},MetricsReporting:function(){return pd.default},Protection:function(){return md.default},default:function(){return Cd},supportsMediaSource:function(){return xd.supportsMediaSource}}),fd=cd(5393),pd=cd(4469),md=cd(3888),hd=cd(8200),_d=function(){let e=`application/dash+xml`,t;function n(n,r,i){if(!n||!/^VIDEO$/i.test(n.nodeName))return null;if(n._dashjs_player)return n._dashjs_player;let o,c=n.id||n.name||`video element`;if(!(r||=[].slice.call(n.querySelectorAll(`source`)).filter((function(t){return t.type==e}))[0])&&n.src)(r=document.createElement(`source`)).src=n.src;else if(!r&&!n.src)return null;return i||={},o=(0,hd.default)(i).create(),o.initialize(n,r.src,n.autoplay),t||=o.getDebug().getLogger(),t.debug(`Converted `+c+` to dash.js player and added content: `+r.src),n._dashjs_player=o,o}function r(e){return/^VIDEO$/i.test(e.nodeName)?e:r(e.parentNode)}return{create:n,createAll:function(t,i){let o=[];t||=`[data-dashjs-player]`;let c=(i||=document).querySelectorAll(t);for(let e=0;e<c.length;e++){let t=n(c[e],null);o.push(t)}let l=i.querySelectorAll(`source[type="`+e+`"]`);for(let e=0;e<l.length;e++){let t=n(r(l[e]),null);o.push(t)}return o}}}(),!(typeof window<`u`&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&typeof window<`u`&&window&&window.addEventListener&&(window.document.readyState===`complete`?window.dashjs?_d.createAll():gd=window.setInterval((function(){window.dashjs&&(window.clearInterval(gd),_d.createAll())}),500):window.addEventListener(`load`,(function e(){window.removeEventListener(`load`,e),_d.createAll()}))),vd=_d,yd=cd(649),bd=cd(5212),xd=cd(559),Sd=cd(5560),dashjs.Protection=md.default,dashjs.MetricsReporting=pd.default,dashjs.MediaPlayerFactory=vd,dashjs.Debug=yd.default,dashjs.supportsMediaSource=xd.supportsMediaSource,dashjs.Constants=bd.default,dashjs.ExternalSubtitle=Sd.default,Cd=dashjs,wd=(dd=dd.default).Constants,Td=dd.Debug,Ed=dd.ExternalSubtitle,Dd=dd.MediaPlayer,Od=dd.MediaPlayerFactory,kd=dd.MetricsReporting,Ad=dd.Protection,jd=dd.default,Md=dd.supportsMediaSource})),Pd,Fd=n((()=>{Pd=class{id=`dash`;isNative=!1;video=null;player=null;dashjs=null;loadVersion=0;cancelPendingLoad;lastSource=null;retryCount=0;maxRetries=2;runtimeConfig={performance:{startupMode:`balanced`,startupBufferSeconds:1.2,manifestFastPath:!1},abr:{startupProfile:`balanced`,upgradeAggression:`medium`,rebufferSafetyBias:`medium`}};lastRebufferDowngradeAt=0;listeners=new Map;domListeners=[];setRuntimeConfig(e){this.runtimeConfig={performance:{startupMode:e.performance?.startupMode??this.runtimeConfig.performance.startupMode,startupBufferSeconds:e.performance?.startupBufferSeconds??this.runtimeConfig.performance.startupBufferSeconds,manifestFastPath:e.performance?.manifestFastPath??this.runtimeConfig.performance.manifestFastPath},abr:{startupProfile:e.abr?.startupProfile??this.runtimeConfig.abr.startupProfile,upgradeAggression:e.abr?.upgradeAggression??this.runtimeConfig.abr.upgradeAggression,rebufferSafetyBias:e.abr?.rebufferSafetyBias??this.runtimeConfig.abr.rebufferSafetyBias}}}canPlayType(e){return e===`dash`}canPlaySource(e){return e.toLowerCase().includes(`.mpd`)}async preload(){await this.ensureDashJs()}async ensureDashJs(){return this.dashjs||=await Promise.resolve().then(()=>(Nd(),sd)),this.dashjs}attach(e){this.video=e,this.bindDomEvents(),this.player&&this.player.attachView(e)}bindDomEvents(){if(!this.video)return;this.unbindDomEvents();let e=(e,t,n=()=>void 0)=>{let r=r=>{let i=n(r);e===`waiting`&&this.rebufferAwareDowngrade(),this.emit(t,i)};this.video.addEventListener(e,r),this.domListeners.push({event:e,handler:r})};e(`play`,`play`),e(`pause`,`pause`),e(`playing`,`playing`),e(`ended`,`ended`),e(`waiting`,`waiting`),e(`seeked`,`seeked`,()=>({currentTime:this.video.currentTime})),e(`canplay`,`ready`),e(`timeupdate`,`timeupdate`,()=>({currentTime:this.video.currentTime})),e(`durationchange`,`durationchange`,()=>({duration:this.video.duration,isLive:this.player?.isDynamic?.()})),e(`volumechange`,`volumechange`,()=>({volume:this.video.volume,muted:this.video.muted})),e(`ratechange`,`ratechange`,()=>({playbackRate:this.video.playbackRate})),e(`progress`,`progress`,()=>{let e=[],t=this.video.buffered;for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return{buffered:e}})}unbindDomEvents(){this.video&&(this.domListeners.forEach(({event:e,handler:t})=>{this.video.removeEventListener(e,t)}),this.domListeners=[])}async load(e){if(!this.video)throw Error(`Video element not attached`);this.video.poster=e.poster||``;let t=++this.loadVersion;this.lastSource=e,this.retryCount=0;let n=await this.ensureDashJs();if(t!==this.loadVersion)return;this.player&&this.player.destroy(),this.player=n.MediaPlayer().create(),this.emit(`telemetry`,{name:`manifest_parse_started`,at:Date.now()});let r=this.runtimeConfig.abr.startupProfile,i=this.runtimeConfig.performance.startupMode,o=this.runtimeConfig.performance.manifestFastPath||i===`fast-first-frame`;e.drm&&this.player.setProtectionData(e.drm);let c=r===`fast`?350:r===`quality`?1400:800;this.player.updateSettings({streaming:{buffer:{fastSwitchEnabled:o,bufferTimeDefault:o?4:12},trackSwitchMode:{audio:`alwaysReplace`,video:`neverReplace`},cacheInitSegments:o,scheduling:{scheduleWhilePaused:!0},abr:{autoSwitchBitrate:{video:!0},initialBitrate:{video:c}},text:{defaultEnabled:!o}}}),this.registerTrackSyncEvents(),this.player.on(n.MediaPlayer.events.QUALITY_CHANGE_RENDERED,e=>{if(e.mediaType===`video`){let e=this.player.getSettings().streaming?.abr?.autoSwitchBitrate?.video;this.emit(`qualitychange`,{level:e?`auto`:this.currentQualityIndex()}),this.syncTracks()}}),this.player.on(n.MediaPlayer.events.TRACK_CHANGE_RENDERED,()=>{this.syncTracks()}),await new Promise((t,r)=>{this.cancelPendingLoad=()=>r(new DOMException(`Load superseded`,`AbortError`));let i=!1,o=()=>{this.player&&(this.player.off(n.MediaPlayer.events.STREAM_INITIALIZED,c),this.player.off(n.MediaPlayer.events.PLAYBACK_METADATA_LOADED,c),this.player.off(n.MediaPlayer.events.ERROR,l))},c=()=>{i||(i=!0,this.emit(`telemetry`,{name:`manifest_parse_completed`,at:Date.now()}),this.emit(`telemetry`,{name:`first_append_completed`,at:Date.now()}),this.syncTracks(),o(),this.cancelPendingLoad=void 0,t())},l=e=>{let t=e?.error?.code||`UNKNOWN`,n=String(e?.error?.message||`Dash error`),c=n.toLowerCase();if((c.includes(`manifest`)||c.includes(`segment`)||c.includes(`download`))&&this.retryCount<this.maxRetries&&this.lastSource){this.retryCount+=1,this.player?.attachSource?.(this.lastSource.src),this.emit(`error`,{error:{code:`DASH_${String(t)}_RETRY`,message:`Recovered load failure (${this.retryCount}/${this.maxRetries})`,engine:this.id,recoverable:!0,originalError:e}});return}this.emit(`error`,{error:{code:`DASH_${String(t)}`,message:n,engine:this.id,recoverable:!1,originalError:e}}),i||(o(),r(Error(e?.error?.message||`Dash load failed`)))};this.player.on(n.MediaPlayer.events.STREAM_INITIALIZED,c),this.player.on(n.MediaPlayer.events.PLAYBACK_METADATA_LOADED,c);for(let[e,t]of[[`MANIFEST_LOADING`,`manifest_request_started`],[`MANIFEST_LOADED`,`manifest_received`],[`FRAGMENT_LOADING_STARTED`,`first_segment_request_started`],[`FRAGMENT_LOADING_COMPLETED`,`first_segment_received`]]){let r=n.MediaPlayer.events[e];r&&this.player.on(r,()=>{this.emit(`telemetry`,{name:t,at:Date.now()})})}this.player.on(n.MediaPlayer.events.ERROR,l),this.emit(`telemetry`,{name:`manifest_request_started`,at:Date.now()}),this.player.initialize(this.video,e.src,!1)})}registerTrackSyncEvents(){if(!this.player||!this.dashjs)return;for(let e of[`STREAM_INITIALIZED`,`PLAYBACK_METADATA_LOADED`,`CAN_PLAY`,`PERIOD_SWITCH_COMPLETED`,`MANIFEST_LOADED`,`TEXT_TRACKS_ADDED`,`TEXT_TRACK_ADDED`,`TRACK_CHANGE_RENDERED`]){let t=this.dashjs.MediaPlayer.events[e];t&&this.player.on(t,()=>{this.syncTracks()})}let e=this.dashjs.MediaPlayer.events.ERROR;e&&this.player.on(e,e=>{this.handleDashRuntimeError(e)})}handleDashRuntimeError(e){let t=String(e?.error?.code||``).toLowerCase(),n=String(e?.error?.message||``).toLowerCase(),r=t.includes(`buffer_stalled`)||t.includes(`bufferstalled`)||n.includes(`buffer stalled`),i=t.includes(`manifest`)||t.includes(`download`)||n.includes(`segment`)||n.includes(`manifest`),o=t.includes(`media`)||n.includes(`decode`);if(r){this.emit(`error`,{error:{code:`DASH_BUFFER_STALL`,message:`Buffer stall detected`,engine:this.id,recoverable:!0,originalError:e}});return}if(i&&this.retryCount<this.maxRetries&&this.lastSource){this.retryCount+=1,this.player.attachSource?.(this.lastSource.src),this.emit(`error`,{error:{code:`DASH_NETWORK_RETRY`,message:`Retrying network/segment request (${this.retryCount}/${this.maxRetries})`,engine:this.id,recoverable:!0,originalError:e}});return}if(o){let t=this.currentQualityIndex();if(typeof t==`number`&&t>0){this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.player.setRepresentationForTypeByIndex?.(`video`,t-1),this.emit(`error`,{error:{code:`DASH_DECODE_FALLBACK`,message:`Decode issue detected, switched to lower quality`,engine:this.id,recoverable:!0,originalError:e}});return}}}currentQualityIndex(){let e=this.player?.getCurrentRepresentationForType(`video`)?.id;return this.getQualityLadder().findIndex(t=>t.id===e)}getQualityLadder(){if(!this.player)return[];let e=this.player,t=e.getBitrateInfoListFor?.(`video`);if(Array.isArray(t)&&t.length>0)return t;let n=e.getRepresentationsByType?.(`video`);return Array.isArray(n)&&n.length>0?n.map((e,t)=>({qualityIndex:e.qualityIndex??t,bitrate:e.bandwidth??e.bitrate,width:e.width,height:e.height,id:e.id})):[]}getTracks(e){if(!this.player)return[];let t=this.player.getTracksFor?.(e);return Array.isArray(t)&&t.length>0?t:this.video&&e===`text`&&this.video.textTracks?Array.from(this.video.textTracks).map((e,t)=>({id:String(t),index:t,lang:e.language,label:e.label,kind:e.kind,_native:e})):[]}normalizeTrackLabel(e,t,n){let r=e?.roles?.[0]?.value??e?.roles?.[0],i=typeof r==`string`?` (`+r+`)`:``,o=e?.lang||e?.language||``;return`${e?.label||e?.name||o||`${t} ${n+1}`}${i}`}getTrackId(e,t){return String(t)}enforceSingleNativeTextTrack(e){if(!this.video?.textTracks)return;let t=this.video.textTracks;for(let n=0;n<t.length;n+=1){let r=t[n];if(e===null){r.mode=`disabled`;continue}r.mode=n===e?`showing`:`disabled`}}matchesTrackId(e,t,n){return this.getTrackId(e,t)===n}syncTracks(){if(!this.player)return;let e=this.getQualityLadder().map((e,t)=>{let n=e.qualityIndex??t,r=e.bandwidth??e.bitrate;return{id:n,label:e.height?`${e.height}p (${Math.round((r||0)/1e3)}kbps)`:`Quality ${t+1} (${Math.round((r||0)/1e3)}kbps)`,bitrate:r,width:e.width,height:e.height,selected:!this.player.getSettings().streaming?.abr?.autoSwitchBitrate?.video&&this.currentQualityIndex()===n}}),t=this.getTracks(`text`),n=new Set,r=t.filter(e=>{let t=`${String(e?.lang||e?.language||``)}|${String(e?.label||e?.name||``)}|${String(e?.kind||``)}`;return n.has(t)?!1:(n.add(t),!0)}),i=this.player.getCurrentTrackFor?.(`text`),o=r.map(e=>({id:String(t.indexOf(e)),label:this.normalizeTrackLabel(e,`Subtitle`,t.indexOf(e)),language:e.lang||e.language,selected:i?i.index===e.index:e._native?.mode===`showing`})),c=this.getTracks(`audio`),l=this.player.getCurrentTrackFor?.(`audio`),u=c.map((e,t)=>({id:this.getTrackId(e,t),label:this.normalizeTrackLabel(e,`Audio`,t),language:e.lang||e.language,selected:l?l.index===e.index:!!e?.selected}));this.emit(`trackschange`,{qualities:e,subtitles:o,audioTracks:u})}rebufferAwareDowngrade(){if(!this.player)return;let e=Date.now();if(e-this.lastRebufferDowngradeAt<2500||!this.video||this.video.currentTime<.5)return;let t=this.currentQualityIndex();if(typeof t!=`number`||t<=0)return;let n=this.runtimeConfig.abr.rebufferSafetyBias,r=Math.max(0,t-(n===`high`?2:1));try{this.player.setRepresentationForTypeByIndex(`video`,r),this.lastRebufferDowngradeAt=e,this.emit(`telemetry`,{name:`abr_rebuffer_downgrade`,at:e,data:{from:t,to:r,bias:n}}),this.syncTracks()}catch{}}async play(){await this.video?.play()}pause(){this.video?.pause()}async destroy(){++this.loadVersion,this.cancelPendingLoad?.(),this.cancelPendingLoad=void 0,this.unbindDomEvents(),this.player&&=(this.player.destroy(),null),this.video&&(this.video.src=``,this.video.removeAttribute(`src`)),this.video=null,this.listeners.clear()}seek(e){this.video&&(this.video.currentTime=e)}setVolume(e){this.video&&(this.video.volume=e)}setMuted(e){this.video&&(this.video.muted=e)}setPlaybackRate(e){this.video&&(this.video.playbackRate=e)}setQuality(e){this.player&&(e===`auto`?(this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}}),this.emit(`qualitychange`,{level:`auto`})):(this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.player.setRepresentationForTypeByIndex(`video`,Number(e)),this.emit(`qualitychange`,{level:e})))}setSubtitle(e){if(this.player){if(e===null)this.player.setTextTrack(-1),this.enforceSingleNativeTextTrack(null);else{let t=this.player.getTracksFor(`text`).findIndex((t,n)=>this.matchesTrackId(t,n,e));t>=0&&(typeof this.player.enableText==`function`&&this.player.enableText(!0),this.player.setTextTrack(t),this.enforceSingleNativeTextTrack(t))}this.syncTracks()}}setAudioTrack(e){if(this.player){let t=this.player.getTracksFor(`audio`),n=t.findIndex((t,n)=>this.matchesTrackId(t,n,e));if(n>=0){let e=t[n];typeof this.player.setInitialMediaSettingsFor==`function`&&this.player.setInitialMediaSettingsFor(`audio`,{lang:e?.lang,index:e?.index,role:Array.isArray(e?.roles)?e.roles[0]:void 0}),this.player.setCurrentTrack(e)}this.syncTracks()}}on(e,t){let n=e;return this.listeners.has(n)||this.listeners.set(n,[]),this.listeners.get(n).push(t),()=>this.off(e,t)}off(e,t){let n=e,r=this.listeners.get(n);if(!r)return;let i=r.indexOf(t);i>-1&&r.splice(i,1)}emit(e,t){let n=e,r=this.listeners.get(n);if(r)for(let e of[...r])e(t)}}})),Id=r({DashEngine:()=>Pd}),Ld=n((()=>{Fd()})),Rd=new WeakSet,zd=new Map;function Bd(e,t){let n=new m;n.setPerformance(t.performance),n.setAbr(t.abr);let r=new O,i=typeof e==`string`?document.querySelector(e):e;if(!i)throw Error(`Player target element not found`);if(Rd.has(i))throw Error(`Player target already mounted. Destroy previous instance before creating a new one.`);Rd.add(i),n.registry.register(new h);let o=!1,c=!1,l=null,u=null,d=null,p=null,g;t.ui?.headless?(g=document.createElement(`video`),g.setAttribute(`playsinline`,``),g.preload=`auto`,g.muted=!!(t.source?.muted??!0),i.appendChild(g),n.attachVideo(g)):l=new w(n,e,t.ui),i&&(C(i.querySelector(`.flux-player-wrapper`)||i,t.theme||`dark`),u=new _(n,i)),t.analytics&&(d=new T(n,t.analytics.adapter)),t.devtools&&(p=new E(n,i||document.body));let v=async e=>{let t=e.type&&e.type!==`auto`?e.type:f(e.src,e.mimeType);if((t===`hls`||t===`auto`)&&!o)try{let e=new(await(Promise.resolve().then(()=>(od(),ad)))).HlsEngine;await e.preload?.(),n.registry.register(e),o=!0}catch(e){console.warn(`Failed to lazy load HLS engine`,e)}if((t===`dash`||t===`auto`)&&!c)try{let e=new(await(Promise.resolve().then(()=>(Ld(),Id)))).DashEngine;await e.preload?.(),n.registry.register(e),c=!0}catch(e){console.warn(`Failed to lazy load DASH engine`,e)}},y=e=>{if(!t.performance?.manifestFastPath)return()=>void 0;let n=document.createElement(`link`);return n.rel=`preload`,n.as=`fetch`,n.href=e,n.setAttribute(`fetchpriority`,`high`),n.crossOrigin=`anonymous`,document.head.appendChild(n),()=>{n.parentNode&&n.parentNode.removeChild(n)}},b=e=>{if(!t.performance?.manifestFastPath)return()=>void 0;let n=new URL(e,window.location.href).origin;if(zd.has(n))return()=>void 0;let r=[],i=(e,t)=>{let n=document.createElement(`link`);n.rel=e,n.href=t,e===`preconnect`&&(n.crossOrigin=`anonymous`),document.head.appendChild(n),r.push(n)};return i(`preconnect`,n),i(`dns-prefetch`,n),zd.set(n,r),()=>void 0},x=!1,S=null,D=()=>{let e=navigator;return typeof e.userAgentData?.mobile==`boolean`?e.userAgentData.mobile:/android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent||``)},k=e=>{let t=e.currentTime,n=e.buffered;for(let e=0;e<n.length;e+=1){let r=n.start(e),i=n.end(e);if(t>=r-.25&&t<=i+.05)return Math.max(0,i-t)}return 0},A=()=>{let e=t.performance,r;if(typeof e?.startupBufferSeconds==`number`&&Number.isFinite(e.startupBufferSeconds))r=Math.max(0,e.startupBufferSeconds);else{let t=e?.startupStrategy??(e?.startupMode===`fast-first-frame`?`aggressive`:`balanced`),i=n.getState(),o=D(),c=!!(i.isLive||i.isDvr);r=t===`aggressive`?c?o?.12:.08:o?.18:.12:t===`safe`?c?o?.55:.45:o?.9:.75:c?o?.35:.28:o?.55:.45}let i=navigator.connection,o=1;switch(i?.saveData&&(o*=1.2),(i?.effectiveType||``).toLowerCase()){case`slow-2g`:o*=1.7;break;case`2g`:o*=1.45;break;case`3g`:o*=1.2;break;case`4g`:o*=.9;break;default:break}typeof i?.downlink==`number`&&Number.isFinite(i.downlink)&&(i.downlink>=12?o*=.82:i.downlink>=6?o*=.9:i.downlink<=1.5&&(o*=1.22)),typeof i?.rtt==`number`&&Number.isFinite(i.rtt)&&i.rtt>250&&(o*=1.1);let c=r*o;return Math.max(.12,Math.min(1.5,c))},j=()=>{if((t.performance?.startupBufferSeconds??0)>=.5)return 4500;let e=t.performance?.startupStrategy??(t.performance?.startupMode===`fast-first-frame`?`aggressive`:`balanced`);return e===`safe`?3500:e===`aggressive`?1200:2200},M=async()=>{let e=i.querySelector(`video`);if(!e)return;let t=Math.max(0,A()),o=j(),c=Date.now(),l=HTMLMediaElement.HAVE_FUTURE_DATA,u=``,d=()=>{let t=k(e),r=n.getStartupReadiness(),i=!r||r.mediaSourceReadyState===null||r?.mediaSourceReadyState===`open`,o=r?.sourceBuffersUpdating!==!0,c=e.buffered.length>0;return{ahead:t,readyEnough:e.readyState>=l,hasBufferedRange:c,mediaSourceOpen:i,sourceBuffersIdle:o,engineReadiness:r}},f=(n,r)=>{let i=t;return e.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA&&n.ahead>=.25&&(i=Math.min(i,Math.max(.2,t*.65))),r>900&&n.hasBufferedRange&&n.sourceBuffersIdle&&n.mediaSourceOpen&&(i=Math.min(i,.28)),i},p=(e,t)=>{let n=[];return e.hasBufferedRange||n.push(`no_buffered_range`),e.ahead<t&&n.push(`insufficient_buffer_ahead`),e.readyEnough||n.push(`ready_state_below_have_future_data`),e.mediaSourceOpen||n.push(`media_source_not_open`),e.sourceBuffersIdle||n.push(`source_buffer_updating`),(e.engineReadiness?.appendQueueDepth??0)>0&&n.push(`append_queue_not_empty`),e.engineReadiness?.appendWaitActive&&n.push(`append_wait_active`),n},m=(n,i,o)=>{let c=p(n,o),l=c.join(`|`);!l||l===u||(u=l,r.onTelemetry(`startup_gate_pending`,Date.now(),{waitedMs:i,minAhead:o,baseMinAhead:t,ahead:n.ahead,readyState:e.readyState,reasons:c,mediaSourceReadyState:n.engineReadiness?.mediaSourceReadyState??null,sourceBuffersUpdating:n.engineReadiness?.sourceBuffersUpdating??null,appendQueueDepth:n.engineReadiness?.appendQueueDepth??null,appendWaitActive:n.engineReadiness?.appendWaitActive??null,appendBackpressureCount:n.engineReadiness?.appendBackpressureCount??null}))},h=d();if(h.hasBufferedRange&&h.readyEnough&&h.ahead>=f(h,0)&&h.mediaSourceOpen&&h.sourceBuffersIdle){r.onTelemetry(`startup_gate_ready`,Date.now(),{minAhead:f(h,0),baseMinAhead:t,ahead:h.ahead,readyState:e.readyState,waitedMs:0});return}await new Promise(n=>{let i=!1,l=null,u=null,p=()=>{l!==null&&window.cancelAnimationFrame(l),u!==null&&window.clearTimeout(u);for(let t of[`progress`,`loadeddata`,`canplay`,`canplaythrough`])e.removeEventListener(t,_)},h=(e,t)=>{i||(i=!0,p(),r.onTelemetry(e,Date.now(),t),n())},g=()=>{if(i||x){p(),n();return}let r=Date.now()-c,u=d(),_=f(u,r),{ahead:v,readyEnough:y,hasBufferedRange:b,mediaSourceOpen:S,sourceBuffersIdle:C}=u;if(b&&y&&v>=_&&S&&C){h(`startup_gate_ready`,{minAhead:_,baseMinAhead:t,ahead:v,readyState:e.readyState,waitedMs:r});return}if(m(u,r,_),r>=o){h(`startup_gate_timeout`,{minAhead:_,baseMinAhead:t,ahead:v,readyState:e.readyState,waitedMs:r});return}l=window.requestAnimationFrame(g)},_=()=>{g()};for(let t of[`progress`,`loadeddata`,`canplay`,`canplaythrough`])e.addEventListener(t,_);u=window.setTimeout(g,o),g()})},N=()=>{S?.(),S=null;let e=e=>{if(`requestVideoFrameCallback`in HTMLVideoElement.prototype){let t=e,n=t.requestVideoFrameCallback(()=>{r.onFirstFrame()});S=()=>{t.cancelVideoFrameCallback?.(n)};return}{let t=null,n=Date.now(),i=()=>{if(!e.paused&&e.currentTime>0&&e.readyState>=2){r.onFirstFrame();return}Date.now()-n>15e3||(t=window.requestAnimationFrame(i))};t=window.requestAnimationFrame(i);let o=S;S=()=>{o?.(),t!==null&&window.cancelAnimationFrame(t)}}},t=i.querySelector(`video`);if(t){e(t);return}let n=new MutationObserver(()=>{let t=i.querySelector(`video`);t&&(n.disconnect(),e(t))});n.observe(i,{childList:!0,subtree:!0}),S=()=>{n.disconnect()}},P=0,F=0,I=null,L=async e=>{if(x)throw Error(`Player has been destroyed`);let t=++P;S?.(),r.resetForNewSource(),r.onSourceLoadRequested();let i=b(e.src),o=f(e.src,e.mimeType),c=[e.type,o].some(e=>e===`dash`||e===`hls`)?y(e.src):()=>void 0;try{await v(e),!x&&t===P&&await n.load(e)}finally{i(),c()}},R=e=>{++F;let t=L(e);I=t;let n=()=>{I===t&&(I=null)};return t.then(n,n),t};t.source&&R(t.source).catch(e=>console.error(`Autoload failed`,e));let z={load:R,play:async()=>{let e=++F;if(r.onPlayCalled(),I&&await I,x||e!==F)return;let i=t.performance;if(!(i?.startupMode===`fast-first-frame`&&i.startupBufferSeconds===void 0&&i.startupStrategy!==`safe`)&&n.getState().currentTime===0&&await M(),!(x||e!==F))return n.play()},pause:()=>{++F,n.pause()},destroy:async()=>{x||(x=!0,l&&l.destroy(),u&&u.destroy(),d&&d.destroy(),p&&p.destroy(),S?.(),await n.destroy(),g?.remove(),Rd.delete(i))},seek:e=>n.seek(e),setVolume:e=>n.setVolume(e),setMuted:e=>n.setMuted(e),setPlaybackRate:e=>n.setPlaybackRate(e),setIcons:e=>l?.setIcons(e),setToolbar:e=>l?.setToolbar(e),setTheme:e=>{i&&C(i.querySelector(`.flux-player-wrapper`)||i,e)},setQuality:e=>n.setQuality(e),setSubtitle:e=>n.setSubtitle(e),setAudioTrack:e=>n.setAudioTrack(e),getState:()=>n.getState(),getStats:()=>n.getStats(),getStartupMetrics:()=>r.getStartupMetrics(),printStartupReport:()=>r.printStartupReport(),on:(e,t)=>n.on(e,t)};return z.setDevtoolsVisible=e=>{p?.setVisible(e)},z.isDevtoolsVisible=()=>p?.isVisible()??!1,z.getSessionTrace=()=>{let e=d?.getSessionTrace()??[],t=r.getSessionTrace();return[...e,...t].sort((e,t)=>e.at-t.at)},n.on(`telemetry`,e=>{r.onTelemetry(e?.name||`telemetry`,e?.at||Date.now(),e?.data)}),n.on(`waiting`,()=>{r.onWaiting()}),n.on(`playback_requested`,()=>r.onPlayCalled()),n.on(`play`,()=>{N(),r.onPlayCalled()}),n.on(`playing`,()=>{r.onPlaying()}),n.on(`error`,e=>{r.onError(e)}),z}var Vd=`[data-flux-player]`,Hd=e=>{if(e!==null)return e===`true`||e===`1`},Ud=e=>{let t=e.getAttribute(`data-src`);if(!t)throw Error(`Missing data-src for data-flux-player element.`);let n=e.getAttribute(`data-type`)||`auto`,r=e.getAttribute(`data-poster`)||void 0,i=e.getAttribute(`data-thumbnail-vtt`)||void 0,o=e.getAttribute(`data-theme`)||`dark`,c=e.getAttribute(`data-startup-mode`)||`fast-first-frame`;return{source:{src:t,type:n,poster:r,thumbnailVtt:i,autoplay:Hd(e.getAttribute(`data-autoplay`)),muted:Hd(e.getAttribute(`data-muted`))},theme:o,performance:{startupMode:c}}},Wd=(e={})=>{let t=e.selector||Vd,n=e.root||document,r=Array.from(n.querySelectorAll(t)).filter(e=>e instanceof HTMLElement),i=[];for(let e of r){if(e.dataset.fluxMounted===`true`)continue;let t=Bd(e,Ud(e));i.push(t),e.dataset.fluxMounted=`true`}return i};typeof window<`u`&&typeof document<`u`&&window.__FLUX_AUTO_INIT__!==!1&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Wd(),{once:!0}):Wd());var Gd={createPlayer:Bd,autoInitFluxPlayers:Wd};typeof window<`u`&&(window.Flux=Gd),e.Flux=Gd,e.autoInitFluxPlayers=Wd,e.createPlayer=Bd});