PageSourceSearch

https://ayurvedika.pro/wp-content/plugins/fluent-player/assets/fluent-player.js?ver=2.11.0

js ayurvedika.pro collected 2026-10-09 21:27:14 UTC 1,124,286 bytes, 107 lines download raw bytes

1var kU=Object.defineProperty;var RU=(n,e,t)=>e in n?kU(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var L=(n,e,t)=>(RU(n,typeof e!="symbol"?e+"":e,t),t),bx=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)};var u=(n,e,t)=>(bx(n,e,"read from private field"),t?t.call(n):e.get(n)),p=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},A=(n,e,t,i)=>(bx(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t);var w3=(n,e,t,i)=>({set _(s){A(n,e,s,t)},get _(){return u(n,e,i)}}),m=(n,e,t)=>(bx(n,e,"access private method"),t);const PU="modulepreload",DU=function(n,e){return new URL(n,e).href},C3={},se=function(e,t,i){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(r=>{if(r=DU(r,i),r in C3)return;C3[r]=!0;const a=r.endsWith(".css"),o=a?'[rel="stylesheet"]':"";if(!!i)for(let h=s.length-1;h>=0;h--){const d=s[h];if(d.href===r&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${o}`))return;const c=document.createElement("link");if(c.rel=a?"stylesheet":PU,a||(c.as="script",c.crossOrigin=""),c.href=r,document.head.appendChild(c),a)return new Promise((h,d)=>{c.addEventListener("load",h),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>e()).catch(r=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r})},Qs=Symbol(0);let jg=!1,TL=!1,us=null,Bl=null,$i=null,Si=0,Rl=[],WI={};const OU=()=>{},zu=0,h2=1,Wg=2,WA=3;function MU(){jg=!0,queueMicrotask(d2)}function d2(){if(!Rl.length){jg=!1;return}TL=!0;for(let n=0;n<Rl.length;n++)Rl[n].$st!==zu&&$U(Rl[n]);Rl=[],jg=!1,TL=!1}function $U(n){let e=[n];for(;n=n[Qs];)n.$e&&n.$st!==zu&&e.push(n);for(let t=e.length-1;t>=0;t--)JI(e[t])}function NU(n){const e=ma();return xm(e,n.length?n.bind(null,Fu.bind(e)):n,null)}function Y(n){return xm(us,n,null)}function Nu(n){return xm(null,n,null)}function zn(){TL||d2()}function YA(){return us}function Gt(n,e){try{return xm(e,n,null)}catch(t){YI(e,t);return}}function f2(n,e=us){return e==null?void 0:e.$cx[n]}function FU(n,e,t=us){t&&(t.$cx={...t.$cx,[n]:e})}function ge(n){if(!n||!us)return n||OU;const e=us;return e.$d?Array.isArray(e.$d)?e.$d.push(n):e.$d=[e.$d,n]:e.$d=n,function(){e.$st!==WA&&(n.call(null),zA(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(n),1))}}function Fu(n=!0){if(this.$st!==WA){if(this.$h)if(Array.isArray(this.$h))for(let e=this.$h.length-1;e>=0;e--)Fu.call(this.$h[e]);else Fu.call(this.$h);if(n){const e=this[Qs];e&&(Array.isArray(e.$h)?e.$h.splice(e.$h.indexOf(this),1):e.$h=null),BU(this)}}}function BU(n){n.$st=WA,n.$d&&p2(n),n.$s&&bL(n,0),n[Qs]=null,n.$s=null,n.$o=null,n.$h=null,n.$cx=WI,n.$eh=null}function p2(n){try{if(Array.isArray(n.$d))for(let e=n.$d.length-1;e>=0;e--){const t=n.$d[e];t.call(t)}else n.$d.call(n.$d);n.$d=null}catch(e){YI(n,e)}}function xm(n,e,t){const i=us,s=Bl;us=n,Bl=t;try{return e.call(n)}finally{us=i,Bl=s}}function YI(n,e){if(!n||!n.$eh)throw e;let t=0,i=n.$eh.length,s=e;for(t=0;t<i;t++)try{n.$eh[t](s);break}catch(r){s=r}if(t===i)throw s}function zI(){return this.$st===WA?this.$v:(Bl&&!this.$e&&(!$i&&Bl.$s&&Bl.$s[Si]==this?Si++:$i?$i.push(this):$i=[this]),this.$c&&JI(this),this.$v)}function m2(n){const e=zA(n)?n(this.$v):n;if(this.$ch(this.$v,e)&&(this.$v=e,this.$o))for(let t=0;t<this.$o.length;t++)v2(this.$o[t],Wg);return this.$v}const QI=function(){this[Qs]=null,this.$h=null,us&&us.append(this)},ml=QI.prototype;ml.$cx=WI;ml.$eh=null;ml.$c=null;ml.$d=null;ml.append=function(n){n[Qs]=this,this.$h?Array.isArray(this.$h)?this.$h.push(n):this.$h=[this.$h,n]:this.$h=n,n.$cx=n.$cx===WI?this.$cx:{...this.$cx,...n.$cx},this.$eh&&(n.$eh=n.$eh?[...n.$eh,...this.$eh]:this.$eh)};ml.dispose=function(){Fu.call(this)};function ma(){return new QI}const g2=function(e,t,i){QI.call(this),this.$st=t?Wg:zu,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,t&&(this.$c=t),i&&i.dirty&&(this.$ch=i.dirty)},XI=g2.prototype;Object.setPrototypeOf(XI,ml);XI.$ch=UU;XI.call=zI;function ZI(n,e,t){return new g2(n,e,t)}function UU(n,e){return n!==e}function zA(n){return typeof n=="function"}function JI(n){if(n.$st===h2)for(let e=0;e<n.$s.length&&(JI(n.$s[e]),n.$st!==Wg);e++);n.$st===Wg?y2(n):n.$st=zu}function VU(n){n.$h&&Fu.call(n,!1),n.$d&&p2(n),n.$eh=n[Qs]?n[Qs].$eh:null}function y2(n){let e=$i,t=Si;$i=null,Si=0;try{VU(n);const i=xm(n,n.$c,n);I3(n),!n.$e&&n.$i?m2.call(n,i):(n.$v=i,n.$i=!0)}catch(i){I3(n),YI(n,i)}finally{$i=e,Si=t,n.$st=zu}}function I3(n){if($i){if(n.$s&&bL(n,Si),n.$s&&Si>0){n.$s.length=Si+$i.length;for(let t=0;t<$i.length;t++)n.$s[Si+t]=$i[t]}else n.$s=$i;let e;for(let t=Si;t<n.$s.length;t++)e=n.$s[t],e.$o?e.$o.push(n):e.$o=[n]}else n.$s&&Si<n.$s.length&&(bL(n,Si),n.$s.length=Si)}function v2(n,e){if(!(n.$st>=e)&&(n.$e&&n.$st===zu&&(Rl.push(n),jg||MU()),n.$st=e,n.$o))for(let t=0;t<n.$o.length;t++)v2(n.$o[t],h2)}function bL(n,e){let t,i;for(let s=e;s<n.$s.length;s++)t=n.$s[s],t.$o&&(i=t.$o.indexOf(n),t.$o[i]=t.$o[t.$o.length-1],t.$o.pop())}function Yg(...n){}function Ys(n){return n===null}function Vt(n){return typeof n>"u"}function HU(n){return Ys(n)||Vt(n)}function T2(n){return(n==null?void 0:n.constructor)===Object}function At(n){return typeof n=="number"&&!Number.isNaN(n)}function te(n){return typeof n=="string"}function b2(n){return typeof n=="boolean"}function hs(n){return typeof n=="function"}function Ut(n){return Array.isArray(n)}const qU=Event,E2=Symbol("DOM_EVENT");var Die;class ve extends qU{constructor(t,...i){var r,a;super(t,i[0]);L(this,Die,!0);L(this,"detail");
1L(this,"triggers",new GU);this.detail=(r=i[0])==null?void 0:r.detail;const s=(a=i[0])==null?void 0:a.trigger;s&&this.triggers.add(s)}get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){var t;return((t=this.triggers.origin)==null?void 0:t.isTrusted)??!1}}Die=E2;class GU{constructor(){L(this,"chain",[])}get source(){return this.chain[0]}get origin(){return this.chain[this.chain.length-1]}add(e){this.chain.push(e),KU(e)&&this.chain.push(...e.triggers)}remove(e){return this.chain.splice(this.chain.indexOf(e),1)[0]}has(e){return this.chain.some(t=>t===e)}hasType(e){return!!this.findType(e)}findType(e){return this.chain.find(t=>t.type===e)}walk(e){for(const t of this.chain){const i=e(t);if(i)return[t,i]}}[Symbol.iterator](){return this.chain.values()}}function KU(n){return!!(n!=null&&n[E2])}class S2 extends EventTarget{constructor(){super(...arguments);L(this,"$ts__events")}addEventListener(t,i,s){return super.addEventListener(t,i,s)}removeEventListener(t,i,s){return super.removeEventListener(t,i,s)}}function Fe(n,e,t,i){return n.addEventListener(e,t,i),ge(()=>n.removeEventListener(e,t,i))}var Gl,Kl;class Ve{constructor(e){p(this,Gl,void 0);p(this,Kl,void 0);A(this,Gl,e),A(this,Kl,new AbortController),ge(this.abort.bind(this))}get signal(){return u(this,Kl).signal}add(e,t,i){if(this.signal.aborted)throw Error("aborted");return u(this,Gl).addEventListener(e,t,{...i,signal:i!=null&&i.signal?jU(this.signal,i.signal):this.signal}),this}remove(e,t){return u(this,Gl).removeEventListener(e,t),this}abort(e){u(this,Kl).abort(e)}}Gl=new WeakMap,Kl=new WeakMap;function jU(...n){const e=new AbortController,t={signal:e.signal};function i(s){e.abort(s.target.reason)}for(const s of n){if(s.aborted){e.abort(s.reason);break}s.addEventListener("abort",i,t)}return e.signal}function k3(n){return!!(n!=null&&n.type.startsWith("pointer"))}function lg(n){return!!(n!=null&&n.type.startsWith("touch"))}function WU(n){return/^(click|mouse)/.test((n==null?void 0:n.type)??"")}function QA(n){return!!(n!=null&&n.type.startsWith("key"))}function YU(n){return QA(n)&&n.key==="Enter"}function _2(n){return QA(n)&&(n.key==="Enter"||n.key===" ")}function zU(n){return n instanceof Node}function J(n,e,t){if(n)if(!t&&t!==""&&t!==0)n.removeAttribute(e);else{const i=t===!0?"":t+"";n.getAttribute(e)!==i&&n.setAttribute(e,i)}else return}function di(n,e,t){if(n)!t&&t!==0?n.style.removeProperty(e):n.style.setProperty(e,t+"");else return}function ae(n,e){const t=ZI(n,null,e),i=zI.bind(t);return i[Qs]=!0,i.set=m2.bind(t),i}function QU(n){return zA(n)&&Qs in n}function ds(n,e){const t=ZI(e==null?void 0:e.initial,n,e),i=zI.bind(t);return i[Qs]=!0,i}function XU(n,e){const t=ZI(null,function(){let s=n();return zA(s)&&ge(s),null},void 0);return t.$e=!0,y2(t),Fu.bind(t,!0)}function ZU(n){return QU(n)&&"set"in n}const D=XU;function ba(n){return{id:Symbol(),provide:n}}function xi(n,e,t=YA()){var s;const i=!Vt(e);FU(n.id,i?e:(s=n.provide)==null?void 0:s.call(n),t)}function tt(n){return f2(n.id)}function Li(n){return!Vt(f2(n.id))}const bh=Symbol(0),Eh=Symbol(0),A2=Symbol(0),Ex={};var Oie,jl,Wl,Ya,Yl,Iy,x2,ky,L2,Ry,w2,Py,C2;class JU{constructor(e,t,i){p(this,Iy);p(this,ky);p(this,Ry);p(this,Py);L(this,"$ts__events");L(this,"$ts__vars");L(this,Oie,null);L(this,"$el",ae(null));L(this,"el",null);L(this,"scope",null);L(this,"attachScope",null);L(this,"connectScope",null);L(this,"component",null);L(this,"destroyed",!1);
1L(this,"props",Ex);L(this,"attrs",null);L(this,"styles",null);L(this,"state");L(this,"$state");p(this,jl,[]);p(this,Wl,[]);p(this,Ya,[]);p(this,Yl,[]);var a;this.scope=t,i!=null&&i.scope&&i.scope.append(t);let s=e.state,r=e.props;if(s&&(this.$state=s.create(),this.state=new Proxy(this.$state,{get:(o,l)=>this.$state[l]()}),xi(s,this.$state)),r&&(this.props=eV(r),i!=null&&i.props))for(const o of Object.keys(i.props))(a=this.props[o])==null||a.set(i.props[o]);ge(this.destroy.bind(this))}setup(){Gt(()=>{for(const e of u(this,jl))e()},this.scope)}attach(e){this.el||(this.el=e,this.$el.set(e),Gt(()=>{this.attachScope=ma(),Gt(()=>{for(const t of u(this,Wl))t(this.el);m(this,Iy,x2).call(this),m(this,ky,L2).call(this)},this.attachScope)},this.scope),e.dispatchEvent(new Event("attached")))}detach(){var e;(e=this.attachScope)==null||e.dispose(),this.attachScope=null,this.connectScope=null,this.el=null,this.$el.set(null)}connect(){!this.el||!this.attachScope||!u(this,Ya).length||Gt(()=>{this.connectScope=ma(),Gt(()=>{for(const e of u(this,Ya))e(this.el)},this.connectScope)},this.attachScope)}disconnect(){var e;(e=this.connectScope)==null||e.dispose(),this.connectScope=null}destroy(){if(this.destroyed)return;this.destroyed=!0,Gt(()=>{for(const t of u(this,Yl))t(this.el)},this.scope);const e=this.el;this.detach(),this.scope.dispose(),u(this,jl).length=0,u(this,Wl).length=0,u(this,Ya).length=0,u(this,Yl).length=0,this.component=null,this.attrs=null,this.styles=null,this.props=Ex,this.scope=null,this.state=Ex,this.$state=null,e&&delete e.$}addHooks(e){e.onSetup&&u(this,jl).push(e.onSetup.bind(e)),e.onAttach&&u(this,Wl).push(e.onAttach.bind(e)),e.onConnect&&u(this,Ya).push(e.onConnect.bind(e)),e.onDestroy&&u(this,Yl).push(e.onDestroy.bind(e))}}Oie=A2,jl=new WeakMap,Wl=new WeakMap,Ya=new WeakMap,Yl=new WeakMap,Iy=new WeakSet,x2=function(){if(this.attrs)for(const e of Object.keys(this.attrs))hs(this.attrs[e])?D(m(this,Ry,w2).bind(this,e)):J(this.el,e,this.attrs[e])},ky=new WeakSet,L2=function(){if(this.styles)for(const e of Object.keys(this.styles))hs(this.styles[e])?D(m(this,Py,C2).bind(this,e)):di(this.el,e,this.styles[e])},Ry=new WeakSet,w2=function(e){J(this.el,e,this.attrs[e].call(this.component))},Py=new WeakSet,C2=function(e){di(this.el,e,this.styles[e].call(this.component))};function eV(n){const e={};for(const t of Object.keys(n)){const i=n[t];e[t]=ae(i,i)}return e}let Sh={$$:null};function tV(n,e){return NU(()=>{Sh.$$=new JU(n,YA(),e);const t=new n;return Sh.$$.component=t,Sh.$$=null,t})}class Fi extends EventTarget{constructor(){super();L(this,"$$");Sh.$$&&this.attach(Sh)}get el(){return this.$$.el}get $el(){return this.$$.$el()}get scope(){return this.$$.scope}get attachScope(){return this.$$.attachScope}get connectScope(){return this.$$.connectScope}get $props(){return this.$$.props}get $state(){return this.$$.$state}get state(){return this.$$.state}attach({$$:t}){return this.$$=t,t.addHooks(this),this}addEventListener(t,i,s){this.listen(t,i,s)}removeEventListener(t,i,s){var r;(r=this.el)==null||r.removeEventListener(t,i,s)}setAttributes(t){this.$$.attrs||(this.$$.attrs={}),Object.assign(this.$$.attrs,t)}setStyles(t){this.$$.styles||(this.$$.styles={}),Object.assign(this.$$.styles,t)}setCSSVars(t){this.setStyles(t)}createEvent(t,...i){return new ve(t,i[0])}dispatch(t,...i){if(!this.el)return!1;const s=t instanceof Event?t:new ve(t,i[0]);return Object.defineProperty(s,"target",{get:()=>this.$$.component}),Nu(()=>{var r,a;return(a=(r=this.$$)[A2])==null||a.call(r,s),this.el.dispatchEvent(s)})}dispatchEvent(t){return this.dispatch(t)}listen(t,i,s){return this.el?Fe(this.el,t,i,s):Yg}}class oe extends Fi{subscribe(e){return Gt(()=>D(()=>e(this.state)),this.$$.scope)}destroy(){this.$$.destroy()}}function Se(n,e,t){n[bh]||(n[bh]=new Set),n[bh].add(e)}function at(n,e,t){n[Eh]||(n[Eh]=new Set),n[Eh].add(e)}var zl,u2;let Ea=(u2=class{constructor(e){L(this,"id",Symbol(0));L(this,"record");p(this,zl,void 0);this.record=e,A(this,zl,Object.getOwnPropertyDescriptors(e))}create(){const e={},t=new Proxy(e,{get:(i,s)=>e[s]()});for(const i of Object.keys(this.record)){const s=u(this,zl)[i].get;e[i]=s?ds(s.bind(t)):ae(this.record[i])}return e}reset(e,t){for(const i of Object.keys(e))!u(this,zl)[i].get&&(!t||t(i))&&e[i].set(this.record[i])}},zl=new WeakMap,u2);function Qu(n){return tt(n)}function iV(n,e){for(const t of n)t(e)}function XA(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function sV(n){return n.replace(/-./g,e=>e[1].toUpperCase())}function nV(n){return n.charAt(0).toUpperCase()+n.slice(1)}function zg(n){return n?"true":"false"}function R3(n){return Object.keys(n)}function Bu(){let n,e;return{promise:new Promise((i,s)=>{n=i,e=s}),resolve:n,reject:e}}function rV(n){return new Promise(e=>setTimeout(e,n))}function Xu(n){let e=-1,t;function i(...s){t=s,!(e>=0)&&(e=window.requestAnimationFrame(()=>{n.apply(this,t),e=-1,t=void 0}))}return i}const aV=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:n=>window.setTimeout(n,1):Yg;function oV(n,e){return new Promise(t=>{aV(i=>{n==null||n(i),t()},e)})}var pi={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},P3=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],D3=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],O3=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],li=typeof window<"u"&&typeof window.document<"u"?window.document:{},ki="fullscreenEnabled"in li&&Object.keys(pi)||P3[0]in li&&P3||D3[0]in li&&D3||O3[0]in li&&O3||[],sl={requestFullscreen:function(n){return n[ki[pi.requestFullscreen]]()},requestFullscreenFunction:function(n){return n[ki[pi.requestFullscreen]]},get exitFullscreen(){return li[ki[pi.exitFullscreen]].bind(li)},get fullscreenPseudoClass(){return":"+ki[pi.fullscreen]},addEventListener:function(n,e,t){return li.addEventListener(ki[pi[n]],e,t)},removeEventListener:function(n,e,t){return li.removeEventListener(ki[pi[n]],e,t)},get fullscreenEnabled(){return!!li[ki[pi.fullscreenEnabled]]},set fullscreenEnabled(n){},get fullscreenElement(){return li[ki[pi.fullscreenElement]]},set fullscreenElement(n){},get onfullscreenchange(){return li[("on"+ki[pi.fullscreenchange]).toLowerCase()]},set onfullscreenchange(n){return li[("on"+ki[pi.fullscreenchange]).toLowerCase()]=n},get onfullscreenerror(){return li[("on"+ki[pi.fullscreenerror]).toLowerCase()]},set onfullscreenerror(n){return li[("on"+ki[pi.fullscreenerror]).toLowerCase()]=n}},gl=lV;function lV(n,e,t){var i=null,s=null,r=t&&t.leading,a=t&&t.trailing;r==null&&(r=!0),a==null&&(a=!r),r==!0&&(a=!1);var o=function(){i&&(clearTimeout(i),i=null)},l=function(){var h=s;o(),h&&h()},c=function(){var h=r&&!i,d=this,f=arguments;if(s=function(){return n.apply(d,f)},i||(i=setTimeout(function(){if(i=null,a)return s()},e)),h)return h=!1,s()};return c.cancel=o,c.flush=l,c}var ek=cV;function cV(n,e,t){var i=null,s=null,r=function(){i&&(clearTimeout(i),s=null,i=null)},a=function(){var l=s;r(),l&&l()},o=function(){if(!e)return n.apply(this,arguments);var l=this,c=arguments,h=t&&!i;
1if(r(),s=function(){n.apply(l,c)},i=setTimeout(function(){if(i=null,!h){var d=s;return s=null,d()}},e),h)return s()};return o.cancel=r,o.flush=a,o}const M3=n=>typeof n=="object"&&n!=null&&n.nodeType===1,$3=(n,e)=>(!e||n!=="hidden")&&n!=="visible"&&n!=="clip",Dm=(n,e)=>{if(n.clientHeight<n.scrollHeight||n.clientWidth<n.scrollWidth){const t=getComputedStyle(n,null);return $3(t.overflowY,e)||$3(t.overflowX,e)||(i=>{const s=(r=>{if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch{return null}})(i);return!!s&&(s.clientHeight<i.scrollHeight||s.clientWidth<i.scrollWidth)})(n)}return!1},Om=(n,e,t,i,s,r,a,o)=>r<n&&a>e||r>n&&a<e?0:r<=n&&o<=t||a>=e&&o>=t?r-n-i:a>e&&o<t||r<n&&o>t?a-e+s:0,uV=n=>{const e=n.parentElement;return e??(n.getRootNode().host||null)},hV=(n,e)=>{var t,i,s,r;if(typeof document>"u")return[];const{scrollMode:a,block:o,inline:l,boundary:c,skipOverflowHiddenElements:h}=e,d=typeof c=="function"?c:U=>U!==c;if(!M3(n))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,g=[];let y=n;for(;M3(y)&&d(y);){if(y=uV(y),y===f){g.push(y);break}y!=null&&y===document.body&&Dm(y)&&!Dm(document.documentElement)||y!=null&&Dm(y,h)&&g.push(y)}const v=(i=(t=window.visualViewport)==null?void 0:t.width)!=null?i:innerWidth,T=(r=(s=window.visualViewport)==null?void 0:s.height)!=null?r:innerHeight,{scrollX:b,scrollY:E}=window,{height:_,width:x,top:w,right:R,bottom:C,left:k}=n.getBoundingClientRect(),{top:P,right:I,bottom:O,left:G}=(U=>{const V=window.getComputedStyle(U);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(n);let j=o==="start"||o==="nearest"?w-P:o==="end"?C+O:w+_/2-P+O,K=l==="center"?k+x/2-G+I:l==="end"?R+I:k-G;const W=[];for(let U=0;U<g.length;U++){const V=g[U],{height:q,width:z,top:F,right:N,bottom:H,left:ne}=V.getBoundingClientRect();if(a==="if-needed"&&w>=0&&k>=0&&C<=T&&R<=v&&(V===f&&!Dm(V)||w>=F&&C<=H&&k>=ne&&R<=N))return W;const be=getComputedStyle(V),ue=parseInt(be.borderLeftWidth,10),ye=parseInt(be.borderTopWidth,10),dt=parseInt(be.borderRightWidth,10),ot=parseInt(be.borderBottomWidth,10);let ft=0,Tt=0;const Ci="offsetWidth"in V?V.offsetWidth-V.clientWidth-ue-dt:0,_l="offsetHeight"in V?V.offsetHeight-V.clientHeight-ye-ot:0,_a="offsetWidth"in V?V.offsetWidth===0?0:z/V.offsetWidth:0,Aa="offsetHeight"in V?V.offsetHeight===0?0:q/V.offsetHeight:0;if(f===V)ft=o==="start"?j:o==="end"?j-T:o==="nearest"?Om(E,E+T,T,ye,ot,E+j,E+j+_,_):j-T/2,Tt=l==="start"?K:l==="center"?K-v/2:l==="end"?K-v:Om(b,b+v,v,ue,dt,b+K,b+K+x,x),ft=Math.max(0,ft+E),Tt=Math.max(0,Tt+b);else{ft=o==="start"?j-F-ye:o==="end"?j-H+ot+_l:o==="nearest"?Om(F,H,q,ye,ot+_l,j,j+_,_):j-(F+q/2)+_l/2,Tt=l==="start"?K-ne-ue:l==="center"?K-(ne+z/2)+Ci/2:l==="end"?K-N+dt+Ci:Om(ne,N,z,ue,dt+Ci,K,K+x,x);const{scrollLeft:Tx,scrollTop:we}=V;ft=Aa===0?0:Math.max(0,Math.min(we+ft/Aa,V.scrollHeight-q/Aa+_l)),Tt=_a===0?0:Math.max(0,Math.min(Tx+Tt/_a,V.scrollWidth-z/_a+Ci)),j+=we-ft,K+=Tx-Tt}W.push({el:V,top:ft,left:Tt})}return W},Sx=n=>n===null?"":n+"",dV=n=>n===null?null:n+"",fV=n=>n===null?0:Number(n),I2=n=>n!==null,pV=()=>null,mV=n=>n===null?[]:JSON.parse(n),gV=n=>n===null?{}:JSON.parse(n);function yV(n){if(n===null)return dV;switch(typeof n){case"undefined":return Sx;case"string":return Sx;case"boolean":return I2;case"number":return fV;case"function":return pV;case"object":return Ut(n)?mV:gV;default:return Sx}}const sr=Symbol(0),k2=Symbol(0),nl=Symbol(0),Ga=Symbol(0);var Qn;(function(n){n[n.Idle=0]="Idle";const t=1;n[n.Pending=t]="Pending";const i=2;n[n.Ready=i]="Ready"})(Qn||(Qn={}));function le(n,e){var i,s,r;class t extends n{constructor(...l){super(...l);L(this,"$");L(this,s,Qn.Idle);L(this,r,null);L(this,"keepAlive",!1);L(this,"forwardKeepAlive",!0);if(this.$=Gt(()=>tV(e),null),this.$.$$.addHooks(this),e.props){const c=this.$props,h=Object.getOwnPropertyDescriptors(this);for(const d of Object.keys(h))d in e.props&&(c[d].set(this[d]),delete this[d])}}static get observedAttributes(){var l;if(!this[sr]&&e.props){const c=new Map;for(const h of Object.keys(e.props)){let d=(l=this.attrs)==null?void 0:l[h],f=te(d)?d:d&&(d==null?void 0:d.attr);
1f!==!1&&(f||(f=XA(h)),c.set(f,{prop:h,converter:d&&!te(d)&&(d==null?void 0:d.converter)||yV(e.props[h])}))}this[sr]=c}return this[sr]?Array.from(this[sr].keys()):[]}get scope(){return this.$.$$.scope}get attachScope(){return this.$.$$.attachScope}get connectScope(){return this.$.$$.connectScope}get $props(){return this.$.$$.props}get $state(){return this.$.$$.$state}get state(){return this.$.state}attributeChangedCallback(l,c,h){var g;const d=this.constructor;if(!d[sr]){(g=super.attributeChangedCallback)==null||g.call(this,l,c,h);return}const f=d[sr].get(l);f&&(this[f.prop]=f.converter(h))}connectedCallback(){var h;const l=(h=this.$)==null?void 0:h.$$;if(!l||l.destroyed)return;if(this[nl]!==Qn.Ready){TV.call(this);return}if(!this.isConnected)return;this.hasAttribute("keep-alive")&&(this.keepAlive=!0),l.connect(),Ut(this[Ga])&&iV(this[Ga],this),this[Ga]=null;const c=super.connectedCallback;c&&Gt(()=>c.call(this),this.connectScope)}disconnectedCallback(){var h;const l=(h=this.$)==null?void 0:h.$$;if(!l||l.destroyed)return;l.disconnect();const c=super.disconnectedCallback;c&&c.call(this),!this.keepAlive&&!this.hasAttribute("keep-alive")&&setTimeout(()=>{requestAnimationFrame(()=>{this.isConnected||l.destroy()})},0)}[(i=sr,s=nl,r=Ga,k2)](){const l=this.$.$$,c=this.constructor;if(l.destroyed)return;const h=c[sr];if(h)for(const d of this.attributes){let f=h.get(d.name);f&&f.converter&&l.props[f.prop].set(f.converter(this.getAttribute(d.name)))}l.setup(),l.attach(this),this[nl]=Qn.Ready,this.connectedCallback()}subscribe(l){return this.$.subscribe(l)}destroy(){this.disconnectedCallback(),this.$.destroy()}}return L(t,"attrs"),L(t,i,null),vV(t,e),t}function vV(n,e){const t=n.prototype,i=e.prototype;if(e.props)for(const s of Object.keys(e.props))Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get(){return this.$props[s]()},set(r){this.$props[s].set(r)}});if(i[bh])for(const s of i[bh])Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get(){return this.$[s]},set(r){this.$[s]=r}});if(i[Eh])for(const s of i[Eh])t[s]=function(...r){return this.$[s](...r)}}function TV(){if(this[nl]!==Qn.Idle)return;this[nl]=Qn.Pending;const n=EV(this),e=n&&window.customElements.get(n.localName),t=n&&n[nl]===Qn.Ready;if(n&&(!e||!t)){bV.call(this,n);return}R2.call(this,n)}async function bV(n){await window.customElements.whenDefined(n.localName),n[nl]!==Qn.Ready&&await new Promise(e=>(n[Ga]??(n[Ga]=[])).push(e)),R2.call(this,n)}function R2(n){if(this.isConnected){if(n){n.keepAlive&&n.forwardKeepAlive&&(this.keepAlive=!0,this.setAttribute("keep-alive",""));const e=this.$.$$.scope;e&&n.$.$$.attachScope.append(e)}this[k2]()}}function EV(n){let e=n.parentNode,t=n.localName.split("-",1)[0]+"-";for(;e;){if(e.nodeType===1&&e.localName.startsWith(t))return e;e=e.parentNode}return null}function re(n,e=!1){(e||!window.customElements.get(n.tagName))&&window.customElements.define(n.tagName,n)}var SV='<path fill-rule="evenodd" clip-rule="evenodd" d="M6 7C5.63181 7 5.33333 7.29848 5.33333 7.66667V14.8667C5.33333 14.9403 5.39361 14.9999 5.46724 15.0009C10.8844 15.0719 15.2614 19.449 15.3325 24.8661C15.3334 24.9397 15.393 25 15.4667 25H26C26.3682 25 26.6667 24.7015 26.6667 24.3333V7.66667C26.6667 7.29848 26.3682 7 26 7H6ZM17.0119 22.2294C17.0263 22.29 17.0802 22.3333 17.1425 22.3333H23.3333C23.7015 22.3333 24 22.0349 24 21.6667V10.3333C24 9.96514 23.7015 9.66667 23.3333 9.66667H8.66667C8.29848 9.66667 8 9.96514 8 10.3333V13.1909C8 13.2531 8.04332 13.3071 8.10392 13.3214C12.5063 14.3618 15.9715 17.827 17.0119 22.2294Z" fill="currentColor"/> <path d="M13.2 25C13.2736 25 13.3334 24.9398 13.3322 24.8661C13.2615 20.5544 9.77889 17.0718 5.46718 17.0011C5.39356 16.9999 5.33333 17.0597 5.33333 17.1333V18.8667C5.33333 18.9403 5.39348 18.9999 5.4671 19.0015C8.67465 19.0716 11.2617 21.6587 11.3319 24.8662C11.3335 24.9399 11.393 25 11.4667 25H13.2Z" fill="currentColor"/> <path d="M5.33333 21.1333C5.33333 21.0597 5.39332 20.9998 5.46692 21.0022C7.57033 21.0712 9.26217 22.763 9.33114 24.8664C9.33356 24.94 9.27364 25 9.2 25H6C5.63181 25 5.33333 24.7015 5.33333 24.3333V21.1333Z" fill="currentColor"/>';const P2=ba();function Te(){return tt(P2)}const _V=(navigator==null?void 0:navigator.userAgent.toLowerCase())||"",ZA=/iphone|ipad|ipod|ios|crios|fxios/i.test(_V),D2=/(iphone|ipod)/gi.test((navigator==null?void 0:navigator.platform)||""),JA=!!window.chrome,Qg=!!window.safari||ZA;function O2(){return AV()&&hs(screen.orientation.unlock)}function AV(){return!Vt(window.screen.orientation)&&!Vt(window.screen.orientation.lock)}function M2(n,e){return n||(n=document.createElement("audio")),n.canPlayType(e).length>0}function $2(n,e){return n||(n=document.createElement("video")),n.canPlayType(e).length>0}function N2(n){return n||(n=document.createElement("video")),n.canPlayType("application/vnd.apple.mpegurl").length>0}function F2(n){return!!document.pictureInPictureEnabled&&!(n!=null&&n.disablePictureInPicture)}function B2(n){return hs(n==null?void 0:n.webkitSupportsPresentationMode)&&hs(n==null?void 0:n.webkitSetPresentationMode)}async function xV(){const n=document.createElement("video");return n.volume=.5,await rV(0),n.volume===.5}function LV(){return(window==null?void 0:window.ManagedMediaSource)??(window==null?void 0:window.MediaSource)??(window==null?void 0:window.WebKitMediaSource)}
1function wV(){return(window==null?void 0:window.SourceBuffer)??(window==null?void 0:window.WebKitSourceBuffer)}function ex(){const n=LV();if(Vt(n))return!1;const e=n&&hs(n.isTypeSupported)&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),t=wV(),i=Vt(t)||!Vt(t.prototype)&&hs(t.prototype.appendBuffer)&&hs(t.prototype.remove);return!!e&&!!i}function U2(){return ex()}const CV=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i,IV=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp3","audio/webm","audio/flac","audio/m4a","audio/m4b","audio/mp4a","audio/mp4"]),kV=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,RV=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),PV=/\.(m3u8)($|\?)/i,DV=/\.(mpd)($|\?)/i,OV=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]),MV=new Set(["application/dash+xml"]);function V2({src:n,type:e}){return te(n)?CV.test(n)||IV.has(e)||n.startsWith("blob:")&&e==="audio/object":e==="audio/object"}function H2(n){return te(n.src)?kV.test(n.src)||RV.has(n.type)||n.src.startsWith("blob:")&&n.type==="video/object"||Zu(n)&&N2():n.type==="video/object"}function Zu({src:n,type:e}){return te(n)&&PV.test(n)||OV.has(e)}function tk({src:n,type:e}){return te(n)&&DV.test(n)||MV.has(e)}function q2(n){return te(n.src)&&(V2(n)||H2(n)||Zu(n))}function $V(n){return typeof window.MediaStream<"u"&&n instanceof window.MediaStream}var hn;class yt{constructor(e,t){p(this,hn,void 0);Ut(e)?A(this,hn,e):!Vt(e)&&!Vt(t)?A(this,hn,[[e,t]]):A(this,hn,[])}get length(){return u(this,hn).length}start(e){return u(this,hn)[e][0]??1/0}end(e){return u(this,hn)[e][1]??1/0}}hn=new WeakMap;function N3(n){if(!n.length)return null;let e=n.start(0);for(let t=1;t<n.length;t++){const i=n.start(t);i<e&&(e=i)}return e}function Va(n){if(!n.length)return null;let e=n.end(0);for(let t=1;t<n.length;t++){const i=n.end(t);i>e&&(e=i)}return e}function NV(n){if(n.length<=1)return n;n.sort((i,s)=>i[0]-s[0]);let e=[],t=n[0];for(let i=1;i<n.length;i++){const s=n[i];t[1]>=s[0]-1?t=[t[0],Math.max(t[1],s[1])]:(e.push(t),t=s)}return e.push(t),e}function FV(n,e,t){let i=e[0],s=e[1];return t<i?[t,-1]:t===i?e:i===-1?(e[0]=t,e):(t>i&&(e[1]=t,s===-1&&n.push(e)),NV(n),e)}function BV(n,e){const t=new URL(n);for(const i of Object.keys(e))t.searchParams.set(i,e[i]+"");return t.toString()}function tr(n,e="preconnect"){const t=document.querySelector(`link[href="${n}"]`);if(!Ys(t))return!0;const i=document.createElement("link");return i.rel=e,i.href=n,i.crossOrigin="true",document.head.append(i),!0}const sh={};function ik(n){if(sh[n])return sh[n].promise;const e=Bu(),t=document.querySelector(`script[src="${n}"]`);if(!Ys(t))return e.resolve(),e.promise;sh[n]=e;const i=document.createElement("script");return i.src=n,i.onload=()=>{e.resolve(),delete sh[n]},i.onerror=()=>{e.reject(),delete sh[n]},setTimeout(()=>document.head.append(i),0),e.promise}function _h(n){return n==="use-credentials"?"include":te(n)?"same-origin":void 0}function EL(n,e){return e>=n.startTime&&e<n.endTime}function tx(n,e,t){let i=null,s=YA();function r(){const a=te(e)?[e]:e,o=n.toArray().find(l=>a.includes(l.kind)&&l.mode==="showing");if(o!==i){if(!o){t(null),i=null;return}o.readyState==2?t(o):(t(null),Gt(()=>{const l=Fe(o,"load",()=>{t(o),l()},{once:!0})},s)),i=o}}return r(),Fe(n,"mode-change",r)}function UV(n,e,t){tx(n,e,i=>{if(!i){t("");return}const s=()=>{const r=i==null?void 0:i.activeCues[0];t((r==null?void 0:r.text)||"")};s(),Fe(i,"cue-change",s)})}const VV=Symbol(0),HV=Symbol(0),qV=Symbol(0),GV=Symbol(0),KV=Symbol(0),jV=Symbol(0),WV=Symbol(0),de={crossOrigin:VV,readyState:HV,updateActiveCues:qV,canLoad:GV,onModeChange:KV,native:jV,nativeHLS:WV};var Yh,dn,za,zh,Qa,Dt,fn,Mie,$ie,Nie,Fie,Dy,G2,Qh,SL,Xa,hh,Xh,_L,Zh,AL,Jh,xL;class ga extends S2{constructor(t){super();p(this,Dy);p(this,Qh);p(this,Xa);p(this,Xh);p(this,Zh);p(this,Jh);L(this,"src");L(this,"content");L(this,"type");L(this,"encoding");L(this,"id","");L(this,"label","");L(this,"language","");L(this,"kind");L(this,"default",!1);p(this,Yh,!1);p(this,dn,0);p(this,za,"disabled");p(this,zh,{});p(this,Qa,[]);p(this,Dt,[]);p(this,fn,[]);L(this,Mie,0);L(this,$ie);L(this,Nie,null);L(this,Fie,null);for(const i of Object.keys(t))this[i]=t[i];
1this.type||(this.type="vtt"),t.content?m(this,Dy,G2).call(this,t):t.src||(this[de.readyState]=2)}static createId(t){return`vds-${t.type}-${t.kind}-${t.src??t.label??"?"}`}get metadata(){return u(this,zh)}get regions(){return u(this,Qa)}get cues(){return u(this,Dt)}get activeCues(){return u(this,fn)}get readyState(){return this[de.readyState]}get mode(){return u(this,za)}set mode(t){this.setMode(t)}addCue(t,i){var a;let s=0,r=u(this,Dt).length;for(s=0;s<r&&!(t.endTime<=u(this,Dt)[s].startTime);s++);s===r?u(this,Dt).push(t):u(this,Dt).splice(s,0,t),t instanceof TextTrackCue||(a=this[de.native])==null||a.track.addCue(t),this.dispatchEvent(new ve("add-cue",{detail:t,trigger:i})),EL(t,u(this,dn))&&this[de.updateActiveCues](u(this,dn),i)}removeCue(t,i){var r;const s=u(this,Dt).indexOf(t);if(s>=0){const a=u(this,fn).includes(t);u(this,Dt).splice(s,1),(r=this[de.native])==null||r.track.removeCue(t),this.dispatchEvent(new ve("remove-cue",{detail:t,trigger:i})),a&&this[de.updateActiveCues](u(this,dn),i)}}setMode(t,i){var s;u(this,za)!==t&&(A(this,za,t),t==="disabled"?(A(this,fn,[]),m(this,Jh,xL).call(this)):this.readyState===2?this[de.updateActiveCues](u(this,dn),i):m(this,Qh,SL).call(this),this.dispatchEvent(new ve("mode-change",{detail:this,trigger:i})),(s=this[de.onModeChange])==null||s.call(this))}[(Mie=de.readyState,$ie=de.crossOrigin,Nie=de.onModeChange,Fie=de.native,de.updateActiveCues)](t,i){if(A(this,dn,t),this.mode==="disabled"||!u(this,Dt).length)return;const s=[];for(let a=0,o=u(this,Dt).length;a<o;a++){const l=u(this,Dt)[a];EL(l,t)&&s.push(l)}let r=s.length!==u(this,fn).length;if(!r){for(let a=0;a<s.length;a++)if(!u(this,fn).includes(s[a])){r=!0;break}}A(this,fn,s),r&&m(this,Jh,xL).call(this,i)}[de.canLoad](){A(this,Yh,!0),u(this,za)!=="disabled"&&m(this,Qh,SL).call(this)}}Yh=new WeakMap,dn=new WeakMap,za=new WeakMap,zh=new WeakMap,Qa=new WeakMap,Dt=new WeakMap,fn=new WeakMap,Dy=new WeakSet,G2=function(t){se(()=>Promise.resolve().then(()=>hy),void 0,import.meta.url).then(({parseText:i,VTTCue:s,VTTRegion:r})=>{!te(t.content)||t.type==="json"?(m(this,Zh,AL).call(this,t.content,s,r),this.readyState!==3&&m(this,Xa,hh).call(this)):i(t.content,{type:t.type}).then(({cues:a,regions:o})=>{A(this,Dt,a),A(this,Qa,o),m(this,Xa,hh).call(this)})})},Qh=new WeakSet,SL=async function(){var t,i;if(!(!u(this,Yh)||this[de.readyState]>0)){if(this[de.readyState]=1,this.dispatchEvent(new ve("load-start")),!this.src){m(this,Xa,hh).call(this);return}try{const{parseResponse:s,VTTCue:r,VTTRegion:a}=await se(()=>Promise.resolve().then(()=>hy),void 0,import.meta.url),o=(t=this[de.crossOrigin])==null?void 0:t.call(this),l=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:_h(o)});if(this.type==="json")m(this,Zh,AL).call(this,await(await l).text(),r,a);else{const{errors:c,metadata:h,regions:d,cues:f}
1=await s(l,{type:this.type,encoding:this.encoding});if(((i=c[0])==null?void 0:i.code)===0)throw c[0];A(this,zh,h),A(this,Qa,d),A(this,Dt,f)}m(this,Xa,hh).call(this)}catch(s){m(this,Xh,_L).call(this,s)}}},Xa=new WeakSet,hh=function(){if(this[de.readyState]=2,!this.src||this.type!=="vtt"){const i=this[de.native];if(i&&!i.managed)for(const s of u(this,Dt))i.track.addCue(s)}const t=new ve("load");this[de.updateActiveCues](u(this,dn),t),this.dispatchEvent(t)},Xh=new WeakSet,_L=function(t){this[de.readyState]=3,this.dispatchEvent(new ve("error",{detail:t}))},Zh=new WeakSet,AL=function(t,i,s){try{const{regions:r,cues:a}=zV(t,i,s);A(this,Qa,r),A(this,Dt,a)}catch(r){m(this,Xh,_L).call(this,r)}},Jh=new WeakSet,xL=function(t){this.dispatchEvent(new ve("cue-change",{trigger:t}))};const YV=/captions|subtitles/;function Kt(n){return YV.test(n.kind)}function zV(n,e,t){const i=te(n)?JSON.parse(n):n;let s=[],r=[];return i.regions&&t&&(s=i.regions.map(a=>Object.assign(new t,a))),(i.cues||Ut(i))&&(r=(Ut(i)?i:i.cues).filter(a=>At(a.startTime)&&At(a.endTime)).map(a=>Object.assign(new e(0,0,""),a))),{regions:s,cues:r}}const QV=Symbol(0),XV=Symbol(0),ZV=Symbol(0),JV=Symbol(0),eH=Symbol(0),tH=Symbol(0),iH=Symbol(0),sH=Symbol(0),nH=Symbol(0),he={add:QV,remove:XV,reset:ZV,select:JV,readonly:eH,setReadonly:tH,onReset:iH,onRemove:sH,onUserSelect:nH},rH=Symbol(0),aH=Symbol(0),Ft={setAuto:rH,enableAuto:aH};function Ah(n){return n instanceof Error?n:Error(typeof n=="string"?n:JSON.stringify(n))}function sn(n,e){if(!n)throw Error("Assertion failed.")}const Xg=Math.min,rl=Math.max,Zg=Math.round,Mm=Math.floor,zs=n=>({x:n,y:n}),oH={left:"right",right:"left",bottom:"top",top:"bottom"},lH={start:"end",end:"start"};function F3(n,e,t){return rl(n,Xg(e,t))}function sk(n,e){return typeof n=="function"?n(e):n}function Uu(n){return n.split("-")[0]}function nk(n){return n.split("-")[1]}function K2(n){return n==="x"?"y":"x"}function j2(n){return n==="y"?"height":"width"}function Oh(n){return["top","bottom"].includes(Uu(n))?"y":"x"}function W2(n){return K2(Oh(n))}function cH(n,e,t){t===void 0&&(t=!1);const i=nk(n),s=W2(n),r=j2(s);let a=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(a=Jg(a)),[a,Jg(a)]}function uH(n){const e=Jg(n);return[LL(n),e,LL(e)]}function LL(n){return n.replace(/start|end/g,e=>lH[e])}function hH(n,e,t){const i=["left","right"],s=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:i:e?i:s;case"left":case"right":return e?r:a;default:return[]}}function dH(n,e,t,i){const s=nk(n);let r=hH(Uu(n),t==="start",i);return s&&(r=r.map(a=>a+"-"+s),e&&(r=r.concat(r.map(LL)))),r}function Jg(n){return n.replace(/left|right|bottom|top/g,e=>oH[e])}function fH(n){return{top:0,right:0,bottom:0,left:0,...n}}function pH(n){return typeof n!="number"?fH(n):{top:n,right:n,bottom:n,left:n}}function ey(n){const{x:e,y:t,width:i,height:s}=n;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function B3(n,e,t){let{reference:i,floating:s}=n;const r=Oh(e),a=W2(e),o=j2(a),l=Uu(e),c=r==="y",h=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,f=i[o]/2-s[o]/2;let g;switch(l){case"top":g={x:h,y:i.y-s.height};break;case"bottom":g={x:h,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:d};break;case"left":g={x:i.x-s.width,y:d};break;default:g={x:i.x,y:i.y}}switch(nk(e)){case"start":g[a]-=f*(t&&c?-1:1);break;case"end":g[a]+=f*(t&&c?-1:1);break}return g}const mH=async(n,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:r=[],platform:a}=t,o=r.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:n,floating:e,strategy:s}),{x:h,y:d}=B3(c,i,l),f=i,g={},y=0;for(let v=0;v<o.length;v++){const{name:T,fn:b}=o[v],{x:E,y:_,data:x,reset:w}=await b({x:h,y:d,initialPlacement:i,placement:f,strategy:s,middlewareData:g,rects:c,platform:a,elements:{reference:n,floating:e}});h=E??h,d=_??d,g={...g,[T]:{...g[T],...x}},w&&y<=50&&(y++,typeof w=="object"&&(w.placement&&(f=w.placement),w.rects&&(c=w.rects===!0?await a.getElementRects({reference:n,floating:e,strategy:s}):w.rects),{x:h,y:d}=B3(c,f,l)),v=-1)}return{x:h,y:d,placement:f,strategy:s,middlewareData:g}};async function Y2(n,e){var t;e===void 0&&(e={});
vendor: 10,829 bytes, line 1
1const{x:i,y:s,platform:r,rects:a,elements:o,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:f=!1,padding:g=0}=sk(e,n),y=pH(g),T=o[f?d==="floating"?"reference":"floating":d],b=ey(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(T)))==null||t?T:T.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(o.floating)),boundary:c,rootBoundary:h,strategy:l})),E=d==="floating"?{x:i,y:s,width:a.floating.width,height:a.floating.height}:a.reference,_=await(r.getOffsetParent==null?void 0:r.getOffsetParent(o.floating)),x=await(r.isElement==null?void 0:r.isElement(_))?await(r.getScale==null?void 0:r.getScale(_))||{x:1,y:1}:{x:1,y:1},w=ey(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:E,offsetParent:_,strategy:l}):E);return{top:(b.top-w.top+y.top)/x.y,bottom:(w.bottom-b.bottom+y.bottom)/x.y,left:(b.left-w.left+y.left)/x.x,right:(w.right-b.right+y.right)/x.x}}const gH=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:s,middlewareData:r,rects:a,initialPlacement:o,platform:l,elements:c}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...T}=sk(n,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const b=Uu(s),E=Oh(o),_=Uu(o)===o,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=f||(_||!v?[Jg(o)]:uH(o)),R=y!=="none";!f&&R&&w.push(...dH(o,v,y,x));const C=[o,...w],k=await Y2(e,T),P=[];let I=((i=r.flip)==null?void 0:i.overflows)||[];if(h&&P.push(k[b]),d){const K=cH(s,a,x);P.push(k[K[0]],k[K[1]])}if(I=[...I,{placement:s,overflows:P}],!P.every(K=>K<=0)){var O,G;const K=(((O=r.flip)==null?void 0:O.index)||0)+1,W=C[K];if(W)return{data:{index:K,overflows:I},reset:{placement:W}};let U=(G=I.filter(V=>V.overflows[0]<=0).sort((V,q)=>V.overflows[1]-q.overflows[1])[0])==null?void 0:G.placement;if(!U)switch(g){case"bestFit":{var j;const V=(j=I.filter(q=>{if(R){const z=Oh(q.placement);return z===E||z==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(z=>z>0).reduce((z,F)=>z+F,0)]).sort((q,z)=>q[1]-z[1])[0])==null?void 0:j[0];V&&(U=V);break}case"initialPlacement":U=o;break}if(s!==U)return{reset:{placement:U}}}return{}}}},yH=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:r=!0,crossAxis:a=!1,limiter:o={fn:T=>{let{x:b,y:E}=T;return{x:b,y:E}}},...l}=sk(n,e),c={x:t,y:i},h=await Y2(e,l),d=Oh(Uu(s)),f=K2(d);let g=c[f],y=c[d];if(r){const T=f==="y"?"top":"left",b=f==="y"?"bottom":"right",E=g+h[T],_=g-h[b];g=F3(E,g,_)}if(a){const T=d==="y"?"top":"left",b=d==="y"?"bottom":"right",E=y+h[T],_=y-h[b];y=F3(E,y,_)}const v=o.fn({...e,[f]:g,[d]:y});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[f]:r,[d]:a}}}}}};function ix(){return typeof window<"u"}function Ju(n){return z2(n)?(n.nodeName||"").toLowerCase():"#document"}function _i(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function en(n){var e;return(e=(z2(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function z2(n){return ix()?n instanceof Node||n instanceof _i(n).Node:!1}function fs(n){return ix()?n instanceof Element||n instanceof _i(n).Element:!1}function Xs(n){return ix()?n instanceof HTMLElement||n instanceof _i(n).HTMLElement:!1}function U3(n){return!ix()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof _i(n).ShadowRoot}function Lm(n){const{overflow:e,overflowX:t,overflowY:i,display:s}=ps(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(s)}function vH(n){return["table","td","th"].includes(Ju(n))}function sx(n){return[":popover-open",":modal"].some(e=>{try{return n.matches(e)}catch{return!1}})}function rk(n){const e=ak(),t=fs(n)?ps(n):n;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function TH(n){let e=ya(n);for(;Xs(e)&&!Vu(e);){if(rk(e))return e;if(sx(e))return null;e=ya(e)}return null}function ak(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vu(n){return["html","body","#document"].includes(Ju(n))}function ps(n){return _i(n).getComputedStyle(n)}function nx(n){return fs(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ya(n){if(Ju(n)==="html")return n;const e=n.assignedSlot||n.parentNode||U3(n)&&n.host||en(n);return U3(e)?e.host:e}function Q2(n){const e=ya(n);return Vu(e)?n.ownerDocument?n.ownerDocument.body:n.body:Xs(e)&&Lm(e)?e:Q2(e)}function Mh(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=Q2(n),r=s===((i=n.ownerDocument)==null?void 0:i.body),a=_i(s);if(r){const o=wL(a);return e.concat(a,a.visualViewport||[],Lm(s)?s:[],o&&t?Mh(o):[])}return e.concat(s,Mh(s,[],t))}function wL(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function X2(n){const e=ps(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Xs(n),r=s?n.offsetWidth:t,a=s?n.offsetHeight:i,o=Zg(t)!==r||Zg(i)!==a;return o&&(t=r,i=a),{width:t,height:i,$:o}}function ok(n){return fs(n)?n:n.contextElement}function Ul(n){const e=ok(n);if(!Xs(e))return zs(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:r}=X2(e);let a=(r?Zg(t.width):t.width)/i,o=(r?Zg(t.height):t.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const bH=zs(0);function Z2(n){const e=_i(n);return!ak()||!e.visualViewport?bH:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EH(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==_i(n)?!1:e}function ll(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),r=ok(n);let a=zs(1);e&&(i?fs(i)&&(a=Ul(i)):a=Ul(n));const o=EH(r,t,i)?Z2(r):zs(0);let l=(s.left+o.x)/a.x,c=(s.top+o.y)/a.y,h=s.width/a.x,d=s.height/a.y;if(r){const f=_i(r),g=i&&fs(i)?_i(i):i;let y=f,v=wL(y);for(;v&&i&&g!==y;){const T=Ul(v),b=v.getBoundingClientRect(),E=ps(v),_=b.left+(v.clientLeft+parseFloat(E.paddingLeft))*T.x,x=b.top+(v.clientTop+parseFloat(E.paddingTop))*T.y;l*=T.x,c*=T.y,h*=T.x,d*=T.y,l+=_,c+=x,y=_i(v),v=wL(y)}}return ey({width:h,height:d,x:l,y:c})}function lk(n,e){const t=nx(n).scrollLeft;return e?e.left+t:ll(en(n)).left+t}function J2(n,e,t){t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:lk(n,i)),r=i.top+e.scrollTop;return{x:s,y:r}}function SH(n){let{elements:e,rect:t,offsetParent:i,strategy:s}=n;const r=s==="fixed",a=en(i),o=e?sx(e.floating):!1;if(i===a||o&&r)return t;let l={scrollLeft:0,scrollTop:0},c=zs(1);const h=zs(0),d=Xs(i);if((d||!d&&!r)&&((Ju(i)!=="body"||Lm(a))&&(l=nx(i)),Xs(i))){const g=ll(i);c=Ul(i),h.x=g.x+i.clientLeft,h.y=g.y+i.clientTop}const f=a&&!d&&!r?J2(a,l,!0):zs(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+h.x+f.x,y:t.y*c.y-l.scrollTop*c.y+h.y+f.y}}function _H(n){return Array.from(n.getClientRects())}function AH(n){const e=en(n),t=nx(n),i=n.ownerDocument.body,s=rl(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=rl(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let a=-t.scrollLeft+lk(n);const o=-t.scrollTop;return ps(i).direction==="rtl"&&(a+=rl(e.clientWidth,i.clientWidth)-s),{width:s,height:r,x:a,y:o}}function xH(n,e){const t=_i(n),i=en(n),s=t.visualViewport;let r=i.clientWidth,a=i.clientHeight,o=0,l=0;if(s){r=s.width,a=s.height;const c=ak();(!c||c&&e==="fixed")&&(o=s.offsetLeft,l=s.offsetTop)}return{width:r,height:a,x:o,y:l}}function LH(n,e){const t=ll(n,!0,e==="fixed"),i=t.top+n.clientTop,s=t.left+n.clientLeft,r=Xs(n)?Ul(n):zs(1),a=n.clientWidth*r.x,o=n.clientHeight*r.y,l=s*r.x,c=i*r.y;return{width:a,height:o,x:l,y:c}}function V3(n,e,t){let i;if(e==="viewport")i=xH(n,t);else if(e==="document")i=AH(en(n));else if(fs(e))i=LH(e,t);else{const s=Z2(n);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ey(i)}function e6(n,e){const t=ya(n);return t===e||!fs(t)||Vu(t)?!1:ps(t).position==="fixed"||e6(t,e)}function wH(n,e){const t=e.get(n);if(t)return t;let i=Mh(n,[],!1).filter(o=>fs(o)&&Ju(o)!=="body"),s=null;const r=ps(n).position==="fixed";let a=r?ya(n):n;for(;fs(a)&&!Vu(a);){const o=ps(a),l=rk(a);!l&&o.position==="fixed"&&(s=null),(r?!l&&!s:!l&&o.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Lm(a)&&!l&&e6(n,a))?i=i.filter(h=>h!==a):s=o,a=ya(a)}return e.set(n,i),i}function CH(n){let{element:e,boundary:t,rootBoundary:i,strategy:s}=n;const a=[...t==="clippingAncestors"?sx(e)?[]:wH(e,this._c):[].concat(t),i],o=a[0],l=a.reduce((c,h)=>{const d=V3(e,h,s);return c.top=rl(d.top,c.top),c.right=Xg(d.right,c.right),c.bottom=Xg(d.bottom,c.bottom),c.left=rl(d.left,c.left),c},V3(e,o,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function IH(n){const{width:e,height:t}=X2(n);return{width:e,height:t}}function kH(n,e,t){const i=Xs(e),s=en(e),r=t==="fixed",a=ll(n,!0,r,e);let o={scrollLeft:0,scrollTop:0};const l=zs(0);if(i||!i&&!r)if((Ju(e)!=="body"||Lm(s))&&(o=nx(e)),i){const f=ll(e,!0,r,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&(l.x=lk(s));const c=s&&!i&&!r?J2(s,o):zs(0),h=a.left+o.scrollLeft-l.x-c.x,d=a.top+o.scrollTop-l.y-c.y;return{x:h,y:d,width:a.width,height:a.height}}function _x(n){return ps(n).position==="static"}function H3(n,e){if(!Xs(n)||ps(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return en(n)===t&&(t=t.ownerDocument.body),t}function t6(n,e){const t=_i(n);if(sx(n))return t;if(!Xs(n)){let s=ya(n);for(;s&&!Vu(s);){if(fs(s)&&!_x(s))return s;s=ya(s)}return t}let i=H3(n,e);for(;i&&vH(i)&&_x(i);)i=H3(i,e);return i&&Vu(i)&&_x(i)&&!rk(i)?t:i||TH(n)||t}const RH=async function(n){const e=this.getOffsetParent||t6,t=this.getDimensions,i=await t(n.floating);return{reference:kH(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function PH(n){return ps(n).direction==="rtl"}const DH={convertOffsetParentRelativeRectToViewportRelativeRect:SH,getDocumentElement:en,getClippingRect:CH,getOffsetParent:t6,getElementRects:RH,getClientRects:_H,getDimensions:IH,getScale:Ul,isElement:fs,isRTL:PH};function OH(n,e){let t=null,i;const s=en(n);function r(){var o;clearTimeout(i),(o=t)==null||o.disconnect(),t=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),r();const{left:c,top:h,width:d,height:f}=n.getBoundingClientRect();if(o||e(),!d||!f)return;const g=Mm(h),y=Mm(s.clientWidth-(c+d)),v=Mm(s.clientHeight-(h+f)),T=
1Mm(c),E={rootMargin:-g+"px "+-y+"px "+-v+"px "+-T+"px",threshold:rl(0,Xg(1,l))||1};let _=!0;function x(w){const R=w[0].intersectionRatio;if(R!==l){if(!_)return a();R?a(!1,R):i=setTimeout(()=>{a(!1,1e-7)},1e3)}_=!1}try{t=new IntersectionObserver(x,{...E,root:s.ownerDocument})}catch{t=new IntersectionObserver(x,E)}t.observe(n)}return a(!0),r}function MH(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=ok(n),h=s||r?[...c?Mh(c):[],...Mh(e)]:[];h.forEach(b=>{s&&b.addEventListener("scroll",t,{passive:!0}),r&&b.addEventListener("resize",t)});const d=c&&o?OH(c,t):null;let f=-1,g=null;a&&(g=new ResizeObserver(b=>{let[E]=b;E&&E.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var _;(_=g)==null||_.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let y,v=l?ll(n):null;l&&T();function T(){const b=ll(n);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&t(),v=b,y=requestAnimationFrame(T)}return t(),()=>{var b;h.forEach(E=>{s&&E.removeEventListener("scroll",t),r&&E.removeEventListener("resize",t)}),d==null||d(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(y)}}const $H=yH,NH=gH,FH=(n,e,t)=>{const i=new Map,s={platform:DH,...t},r={...s.platform,_c:i};return mH(n,e,{...s,platform:r})};function q3(n,e){const t=e.composedPath()[0];return zU(t)&&n.contains(t)}const CL=new Set;{let n=function(){for(const e of CL)try{e()}catch{}window.requestAnimationFrame(n)};n()}function BH(n){return CL.add(n),()=>CL.delete(n)}function Be(n,e,t){n.hasAttribute(e)||n.setAttribute(e,t)}function Sa(n,e){if(n.hasAttribute("aria-label")||n.hasAttribute("data-no-label"))return;if(!hs(e)){J(n,"aria-label",e);return}function t(){J(n,"aria-label",e())}D(t)}function i6(n){const e=getComputedStyle(n);return e.display!=="none"&&parseInt(e.opacity)>0}function UH(n){return!!n&&("checkVisibility"in n?n.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):i6(n))}function s6(n,e){return BH(()=>e(UH(n)))}function n6(n,e,t){for(;e;){if(e===n)return!0;if(t!=null&&t(e))break;e=e.parentElement}return!1}function va(n,e){return new Ve(n).add("pointerup",t=>{t.button===0&&!t.defaultPrevented&&e(t)}).add("keydown",t=>{_2(t)&&e(t)})}function ck(n){return lg(n)&&(n.touches.length>1||n.changedTouches.length>1)}function Zn(n){let e=YA(),t=window.requestAnimationFrame(()=>{Gt(n,e),t=-1});return()=>void window.cancelAnimationFrame(t)}function uk(n,e,t){let i,s=n,r=n.parentElement,a=n.content.firstElementChild,o=[];!a&&n.firstElementChild&&(n.innerHTML=n.firstElementChild.outerHTML,n.firstElementChild.remove(),a=n.content.firstElementChild);for(let l=0;l<e;l++)i=document.importNode(a,!0),t==null||t(i,l),r.insertBefore(i,s.nextSibling),o.push(i),s=i;return ge(()=>{for(let l=0;l<o.length;l++)o[l].remove()}),o}function hk(n){const e=document.createElement("template");return e.innerHTML=n,e.content}function dk(n){return n.cloneNode(!0).firstElementChild}function r6(n,e,t,{offsetVarName:i,xOffset:s,yOffset:r,...a}){if(!n)return;const o=t.replace(" ","-").replace("-center","");if(di(n,"visibility",e?null:"hidden"),!e)return;let l=t.includes("top");const c=d=>t.includes("left")?`calc(-1 * ${d})`:d,h=d=>l?`calc(-1 * ${d})`:d;return MH(e,n,()=>{FH(e,n,{placement:o,middleware:[...a.middleware??[],NH({fallbackAxisSideDirection:"start",crossAxis:!1}),$H()],...a}).then(({x:d,y:f,middlewareData:g})=>{var v;const y=!!((v=g.flip)!=null&&v.index);l=t.includes(y?"bottom":"top"),n.setAttribute("data-placement",y?t.startsWith("top")?t.replace("top","bottom"):t.replace("bottom","top"):t),Object.assign(n.style,{top:`calc(${f+"px"} + ${h(r?r+"px":`var(--${i}-y-offset, 0px)`)})`,left:`calc(${d+"px"} + ${c(s?s+"px":`var(--${i}-x-offset, 0px)`)})`})})})}function VH(n){return getComputedStyle(n).animationName!=="none"}function cl(n){return n instanceof HTMLElement}function HH(n){return n?"true":"false"}function Ht(n){return()=>HH(n())}function qH(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function xt(n,e=2){return Number(n.toFixed(e))}function IL(n){var e;return((e=String(n).split(".")[1])==null?void 0:e.length)??0}function fk(n,e,t){return Math.max(n,Math.min(t,e))}let ty=ae(!1);Fe(document,"pointerdown",()=>{ty.set(!1)}),Fe(document,"keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||ty.set(!0)});var gr,Oy,a6,My,o6,$y,l6,Ny,c6;class ms extends Fi{constructor(){super(...arguments);p(this,Oy);p(this,My);p(this,$y);p(this,Ny);p(this,gr,ae(!1))}onConnect(t){D(()=>{const i=new Ve(t);if(!ty()){u(this,gr).set(!1),$m(t,!1),i.add("pointerenter",m(this,$y,l6).bind(this)).add("pointerleave",m(this,Ny,c6).bind(this));return}const s=document.activeElement===t;u(this,gr).set(s),$m(t,s),i.add("focus",m(this,Oy,a6).bind(this)).add("blur",m(this,My,o6).bind(this))})}focused(){return u(this,gr).call(this)}}gr=new WeakMap,Oy=new WeakSet,a6=function(){u(this,gr).set(!0),$m(this.el,!0)},My=new WeakSet,o6=function(){u(this,gr).set(!1),$m(this.el,!1)},$y=new WeakSet,l6=function(){G3(this.el,!0)},Ny=new WeakSet,c6=function(){G3(this.el,!1)};
1function $m(n,e){J(n,"data-focus",e),J(n,"data-hocus",e)}function G3(n,e){J(n,"data-hocus",e),J(n,"data-hover",e)}var Bie;class u6 extends S2{constructor(){super(...arguments);L(this,"items",[]);L(this,Bie,!1)}get length(){return this.items.length}get readonly(){return this[he.readonly]}indexOf(t){return this.items.indexOf(t)}getById(t){return t===""?null:this.items.find(i=>i.id===t)??null}toArray(){return[...this.items]}[(Bie=he.readonly,Symbol.iterator)](){return this.items.values()}[he.add](t,i){const s=this.items.length;""+s in this||Object.defineProperty(this,s,{get(){return this.items[s]}}),!this.items.includes(t)&&(this.items.push(t),this.dispatchEvent(new ve("add",{detail:t,trigger:i})))}[he.remove](t,i){var r;const s=this.items.indexOf(t);s>=0&&((r=this[he.onRemove])==null||r.call(this,t,i),this.items.splice(s,1),this.dispatchEvent(new ve("remove",{detail:t,trigger:i})))}[he.reset](t){var i;for(const s of[...this.items])this[he.remove](s,t);this.items=[],this[he.setReadonly](!1,t),(i=this[he.onReset])==null||i.call(this)}[he.setReadonly](t,i){this[he.readonly]!==t&&(this[he.readonly]=t,this.dispatchEvent(new ve("readonly-change",{detail:t,trigger:i})))}}const kL=sl.fullscreenEnabled;var yr,Ql,Fy,h6,By,d6,Uy,f6;class GH extends Fi{constructor(){super(...arguments);p(this,Fy);p(this,By);p(this,Uy);p(this,yr,!1);p(this,Ql,!1)}get active(){return u(this,Ql)}get supported(){return kL}onConnect(){new Ve(sl).add("fullscreenchange",m(this,By,d6).bind(this)).add("fullscreenerror",m(this,Uy,f6).bind(this)),ge(m(this,Fy,h6).bind(this))}async enter(){try{return A(this,yr,!0),!this.el||Ax(this.el)?void 0:(K3(),sl.requestFullscreen(this.el))}catch(t){throw A(this,yr,!1),t}}async exit(){if(!(!this.el||!Ax(this.el)))return K3(),sl.exitFullscreen()}}yr=new WeakMap,Ql=new WeakMap,Fy=new WeakSet,h6=async function(){kL&&await this.exit()},By=new WeakSet,d6=function(t){const i=Ax(this.el);i!==u(this,Ql)&&(i||A(this,yr,!1),A(this,Ql,i),this.dispatch("fullscreen-change",{detail:i,trigger:t}))},Uy=new WeakSet,f6=function(t){u(this,yr)&&(this.dispatch("fullscreen-error",{detail:null,trigger:t}),A(this,yr,!1))};function Ax(n){if(sl.fullscreenElement===n)return!0;try{return n.matches(sl.fullscreenPseudoClass)}catch{return!1}}function K3(){if(!kL)throw Error("[vidstack] no fullscreen API")}var vr,pn,Za,Vy,p6,ed,RL,td,PL,id,DL;const Hy=class Hy extends Fi{constructor(){super(...arguments);p(this,Vy);p(this,ed);p(this,td);p(this,id);p(this,vr,ae(m(this,id,DL).call(this)));p(this,pn,ae(!1));p(this,Za,void 0)}get type(){return u(this,vr).call(this)}get locked(){return u(this,pn).call(this)}get portrait(){return u(this,vr).call(this).startsWith("portrait")}get landscape(){return u(this,vr).call(this).startsWith("landscape")}get supported(){return Hy.supported}onConnect(){if(this.supported)Fe(screen.orientation,"change",m(this,ed,RL).bind(this));else{const t=window.matchMedia("(orientation: landscape)");t.onchange=m(this,ed,RL).bind(this),ge(()=>t.onchange=null)}ge(m(this,Vy,p6).bind(this))}async lock(t){Y(u(this,pn))||u(this,Za)===t||(m(this,td,PL).call(this),await screen.orientation.lock(t),u(this,pn).set(!0),A(this,Za,t))}async unlock(){Y(u(this,pn))&&(m(this,td,PL).call(this),A(this,Za,void 0),await screen.orientation.unlock(),u(this,pn).set(!1))}};vr=new WeakMap,pn=new WeakMap,Za=new WeakMap,Vy=new WeakSet,p6=async function(){this.supported&&u(this,pn).call(this)&&await this.unlock()},ed=new WeakSet,RL=function(t){u(this,vr).set(m(this,id,DL).call(this)),this.dispatch("orientation-change",{detail:{orientation:Y(u(this,vr)),lock:u(this,Za)},trigger:t})},td=new WeakSet,PL=function(){if(!this.supported)throw Error("[vidstack] no orientation API")},id=new WeakSet,DL=function(){return this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"},L(Hy,"supported",O2());let iy=Hy;function OL(n){return!te(n)&&"width"in n&&"height"in n&&At(n.width)&&At(n.height)}const m6=new Ea({artist:"",artwork:null,audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,audioGain:null,buffered:new yt,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:O2(),canPictureInPicture:!1,canPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,get iOSControl
vendor: 1,709 bytes, line 1
1s(){return D2&&this.mediaType==="video"&&(!this.playsInline||!sl.fullscreenEnabled&&this.fullscreen)},get nativeControls(){return this.controls||this.iOSControls},controlsVisible:!1,get controlsHidden(){return!this.controlsVisible},crossOrigin:null,ended:!1,error:null,fullscreen:!1,get loop(){return this.providedLoop||this.userPrefersLoop},logLevel:"silent",mediaType:"unknown",muted:!1,paused:!0,played:new yt,playing:!1,playsInline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,canSetPlaybackRate:!0,canSetVolume:!1,canSetAudioGain:!1,seekable:new yt,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(Kt).length>0},volume:1,waiting:!1,realCurrentTime:0,get currentTime(){return this.ended?this.duration:this.clipStartTime>0?Math.max(0,Math.min(this.realCurrentTime-this.clipStartTime,this.duration)):this.realCurrentTime},providedDuration:-1,intrinsicDuration:0,get duration(){return this.seekableWindow},get title(){return this.providedTitle||this.inferredTitle},get poster(){return this.providedPoster||this.inferredPoster},get viewType(){return this.providedViewType!=="unknown"?this.providedViewType:this.inferredViewType},get streamType(){return this.providedStreamType!=="unknown"?this.providedStreamType:this.inferredStreamType},get currentSrc(){return this.source},get bufferedStart(){const n=N3(this.buffered)??0;return Math.max(n,this.clipStartTime)},get bufferedEnd(){const n=Va(this.buffered)??0;return Math.min(this.seekableEnd,Math.max(0,n-this.clipStartTime))},get bufferedWindow(){return Math.max(0,this.bufferedEnd-this.bufferedStart)}
1,get seekableStart(){if(this.isLiveDVR&&this.liveDVRWindow>0)return Math.max(0,this.seekableEnd-this.liveDVRWindow);const n=N3(this.seekable)??0;return Math.max(n,this.clipStartTime)},get seekableEnd(){if(this.providedDuration>0)return this.providedDuration;const n=this.liveSyncPosition>0?this.liveSyncPosition:this.canPlay?Va(this.seekable)??1/0:0;return this.clipEndTime>0?Math.min(this.clipEndTime,n):n},get seekableWindow(){const n=this.seekableEnd-this.seekableStart;return isNaN(n)?1/0:Math.max(0,n)},canAirPlay:!1,canGoogleCast:!1,remotePlaybackState:"disconnected",remotePlaybackType:"none",remotePlaybackLoader:null,remotePlaybackInfo:null,get isAirPlayConnected(){return this.remotePlaybackType==="airplay"&&this.remotePlaybackState==="connected"},get isGoogleCastConnected(){return this.remotePlaybackType==="google-cast"&&this.remotePlaybackState==="connected"},pointer:"fine",orientation:"landscape",width:0,height:0,mediaWidth:0,mediaHeight:0,lastKeyboardAction:null,userBehindLiveEdge:!1,liveEdgeTolerance:10,minLiveDVRWindow:60,get canSeek(){return/unknown|on-demand|:dvr/.test(this.streamType)&&Number.isFinite(this.duration)&&(!this.isLiveDVR||this.duration>=this.liveDVRWindow)},get live(){return this.streamType.includes("live")||!Number.isFinite(this.duration)},get liveEdgeStart(){return this.live&&Number.isFinite(this.seekableEnd)?Math.max(0,this.seekableEnd-this.liveEdgeTolerance):0},get liveEdge(){return this.live&&(!this.canSeek||!this.userBehindLiveEdge&&this.currentTime>=this.liveEdgeStart)},get liveEdgeWindow(){return this.live&&Number.isFinite(this.seekableEnd)?this.seekableEnd-this.liveEdgeStart:0},get isLiveDVR(){return/:dvr/.test(this.streamType)},get liveDVRWindow(){return Math.max(this.inferredLiveDVRWindow,this.minLiveDVRWindow)},autoPlaying:!1,providedTitle:"",inferredTitle:"",providedLoop:!1,userPrefersLoop:!1,providedPoster:"",inferredPoster:"",inferredViewType:"unknown",providedViewType:"unknown",providedStreamType:"unknown",inferredStreamType:"unknown",liveSyncPosition:null,inferredLiveDVRWindow:0,savedState:null}),g6=new Set(["autoPlayError","autoPlaying","buffered","canPlay","error","paused","played","playing","seekable","seeking","waiting"]),KH=new Set([...g6,"ended","inferredPoster","inferredStreamType","inferredTitle","intrinsicDuration","inferredLiveDVRWindow","liveSyncPosition","realCurrentTime","savedState","started","userBehindLiveEdge"]);function j3(n,e=!1){const t=e?g6:KH;m6.reset(n,i=>t.has(i)),zn()}function y6(n,e){const t=n+e.clipStartTime(),i=Math.floor(n)===Math.floor(e.seekableStart()),s=Math.floor(t)===Math.floor(e.seekableEnd());return i?e.seekableStart():s?e.seekableEnd():e.isLiveDVR()&&e.liveDVRWindow()>0&&t<e.seekableEnd()-e.liveDVRWindow()?e.bufferedStart():Math.min(Math.max(e.seekableStart()+.1,t),e.seekableEnd()-.1)}var Ja,yi,Xl,qy,Ne,Ue,BI,WH;class jH{constructor(e=void 0){p(this,Ne);p(this,BI);p(this,Ja,null);p(this,yi,null);p(this,Xl,-1);p(this,qy,void 0);A(this,qy,e)}setTarget(e){A(this,Ja,e)}getPlayer(e){var t;return u(this,yi)?u(this,yi):((t=e??u(this,Ja))==null||t.dispatchEvent(new ve("find-media-player",{detail:i=>void A(this,yi,i),bubbles:!0,composed:!0})),u(this,yi))}setPlayer(e){A(this,yi,e)}startLoading(e){m(this,Ne,Ue).call(this,"media-start-loading",e)}startLoadingPoster(e){m(this,Ne,Ue).call(this,"media-poster-start-loading",e)}requestAirPlay(e){m(this,Ne,Ue).call(this,"media-airplay-request",e)}requestGoogleCast(e){m(this,Ne,Ue).call(this,"media-google-cast-request",e)}play(e){m(this,Ne,Ue).call(this,"media-play-request",e)}pause(e){m(this,Ne,Ue).call(this,"media-pause-request",e)}mute(e){m(this,Ne,Ue).call(this,"media-mute-request",e)}unmute(e){m(this,Ne,Ue).call(this,"media-unmute-request",e)}enterFullscreen(e,t){m(this,Ne,Ue).call(this,"media-enter-fullscreen-request",t,e)}exitFullscreen(e,t){m(this,Ne,Ue).call(this,"media-exit-fullscreen-request",t,e)}lockScreenOrientation(e,t){m(this,Ne,Ue).call(this,"media-orientation-lock-request",t,e)}unlockScreenOrientation(e){m(this,Ne,Ue).call(this,"media-orientation-unlock-request",e)}enterPictureInPicture(e){m(this,Ne,Ue).call(this,"media-enter-pip-request",e)}exitPictureInPicture(e){m(this,Ne,Ue).call(this,"media-exit-pip-request",e)}seeking(e,t){m(this,Ne,Ue).call(this,"media-seeking-request",t,e)}seek(e,t){m(this,Ne,Ue).call(this,"media-seek-request",t,e)}seekToLiveEdge(e){m(this,Ne,Ue).call(this,"media-live-edge-request",e)}changeDuration(e,t){m(this,Ne,Ue).call(this,"media-duration-change-request",t,e)}changeClipStart(e,t){m(this,Ne,Ue).call(this,"media-clip-start-change-request",t,e)}changeClipEnd(e,t){m(this,Ne,Ue).call(this,"media-clip-end-change-request",t,e)}changeVolume(e,t){m(this,Ne,Ue).call(this,"media-volume-change-request",t,Math.max(0,Math.min(1,e)))}changeAudioTrack(e,t){m(this,Ne,Ue).call(this,"media-audio-track-change-request",t,e)}changeQuality(e,t){m(this,Ne,Ue).call(this,"media-quality-change-request",t,e)}requestAutoQuality(e){this.changeQuality(-1,e)}changeTextTrackMode(e,t,i){m(this,Ne,Ue).call(this,"media-text-track-change-request",i,{index:e,mode:t})}changePlaybackRate(e,t){m(this,Ne,Ue).call(this,"media-rate-change-request",t,e)}changeAudioGain(e,t){m(this,Ne,Ue).call(this,"media-audio-gain-change-request",t,e)}
1resumeControls(e){m(this,Ne,Ue).call(this,"media-resume-controls-request",e)}pauseControls(e){m(this,Ne,Ue).call(this,"media-pause-controls-request",e)}togglePaused(e){const t=this.getPlayer(e==null?void 0:e.target);t&&(t.state.paused?this.play(e):this.pause(e))}toggleControls(e){const t=this.getPlayer(e==null?void 0:e.target);t&&(t.controls.showing?t.controls.hide(0,e):t.controls.show(0,e))}toggleMuted(e){const t=this.getPlayer(e==null?void 0:e.target);t&&(t.state.muted?this.unmute(e):this.mute(e))}toggleFullscreen(e,t){const i=this.getPlayer(t==null?void 0:t.target);i&&(i.state.fullscreen?this.exitFullscreen(e,t):this.enterFullscreen(e,t))}togglePictureInPicture(e){const t=this.getPlayer(e==null?void 0:e.target);t&&(t.state.pictureInPicture?this.exitPictureInPicture(e):this.enterPictureInPicture(e))}showCaptions(e){const t=this.getPlayer(e==null?void 0:e.target);if(!t)return;let i=t.state.textTracks,s=u(this,Xl);(!i[s]||!Kt(i[s]))&&(s=-1),s===-1&&(s=i.findIndex(r=>Kt(r)&&r.default)),s===-1&&(s=i.findIndex(r=>Kt(r))),s>=0&&this.changeTextTrackMode(s,"showing",e),A(this,Xl,-1)}disableCaptions(e){const t=this.getPlayer(e==null?void 0:e.target);if(!t)return;const i=t.state.textTracks,s=t.state.textTrack;if(s){const r=i.indexOf(s);this.changeTextTrackMode(r,"disabled",e),A(this,Xl,r)}}toggleCaptions(e){const t=this.getPlayer(e==null?void 0:e.target);t&&(t.state.textTrack?this.disableCaptions():this.showCaptions())}userPrefersLoopChange(e,t){m(this,Ne,Ue).call(this,"media-user-loop-change-request",t,e)}}Ja=new WeakMap,yi=new WeakMap,Xl=new WeakMap,qy=new WeakMap,Ne=new WeakSet,Ue=function(e,t,i){var o,l;const s=new ve(e,{bubbles:!0,composed:!0,cancelable:!0,detail:i,trigger:t});let r=(t==null?void 0:t.target)||null;r&&r instanceof oe&&(r=r.el),r=!r||r===document||r===window||r===document.body||((o=u(this,yi))==null?void 0:o.el)&&r instanceof Node&&!u(this,yi).el.contains(r)?u(this,Ja)??((l=this.getPlayer())==null?void 0:l.el):r??u(this,Ja),u(this,yi)?e==="media-play-request"&&!u(this,yi).state.canLoad?r==null||r.dispatchEvent(s):u(this,yi).canPlayQueue.enqueue(e,()=>r==null?void 0:r.dispatchEvent(s)):r==null||r.dispatchEvent(s)},BI=new WeakSet,WH=function(e){};var ut;class YH{constructor(){L(this,"playerId","vds-player");L(this,"mediaId",null);p(this,ut,{volume:null,muted:null,audioGain:null,time:null,lang:null,captions:null,rate:null,quality:null});L(this,"saveTimeThrottled",gl(this.saveTime.bind(this),1e3))}async getVolume(){return u(this,ut).volume}async setVolume(e){u(this,ut).volume=e,this.save()}async getMuted(){return u(this,ut).muted}async setMuted(e){u(this,ut).muted=e,this.save()}async getTime(){return u(this,ut).time}async setTime(e,t){const i=e<0;u(this,ut).time=i?null:e,i||t?this.saveTime():this.saveTimeThrottled()}async getLang(){return u(this,ut).lang}async setLang(e){u(this,ut).lang=e,this.save()}async getCaptions(){return u(this,ut).captions}async setCaptions(e){u(this,ut).captions=e,this.save()}async getPlaybackRate(){return u(this,ut).rate}async setPlaybackRate(e){u(this,ut).rate=e,this.save()}async getAudioGain(){return u(this,ut).audioGain}async setAudioGain(e){u(this,ut).audioGain=e,this.save()}async getVideoQuality(){return u(this,ut).quality}async setVideoQuality(e){u(this,ut).quality=e,this.save()}onChange(e,t,i="vds-player"){const s=i?localStorage.getItem(i):null,r=t?localStorage.getItem(t):null;this.playerId=i,this.mediaId=t,A(this,ut,{volume:null,muted:null,audioGain:null,lang:null,captions:null,rate:null,quality:null,...s?JSON.parse(s):{},time:r?+r:null})}save(){if(!this.playerId)return;const e=JSON.stringify({...u(this,ut),time:void 0});localStorage.setItem(this.playerId,e)}saveTime(){if(!this.mediaId)return;const e=(u(this,ut).time??0).toString();localStorage.setItem(this.mediaId,e)}}ut=new WeakMap;const nh=Symbol(0);class v6 extends u6{get selected(){return this.items.find(e=>e.selected)??null}get selectedIndex(){return this.items.findIndex(e=>e.selected)}[he.onRemove](e,t){this[he.select](e,!1,t)}[he.add](e,t){e[nh]=!1,Object.defineProperty(e,"selected",{get(){return this[nh]},set:i=>{var s;
1this.readonly||((s=this[he.onUserSelect])==null||s.call(this),this[he.select](e,i))}}),super[he.add](e,t)}[he.select](e,t,i){if(t===(e==null?void 0:e[nh]))return;const s=this.selected;e&&(e[nh]=t),(t?s!==e:s===e)&&(s&&(s[nh]=!1),this.dispatchEvent(new ve("change",{detail:{prev:s,current:this.selected},trigger:i})))}}class zH extends v6{}var sd,mn,nd,Tr,Gy,T6,Ky,b6,rd,ML,ad,$L;class QH{constructor(){p(this,Gy);p(this,Ky);p(this,rd);p(this,ad);L(this,"priority",0);p(this,sd,!0);p(this,mn,null);p(this,nd,null);p(this,Tr,new Set)}canRender(e,t){return!!t}attach(e){A(this,mn,e),e&&(e.textTracks.onchange=m(this,ad,$L).bind(this))}addTrack(e){u(this,Tr).add(e),m(this,Gy,T6).call(this,e)}removeTrack(e){var t,i;(i=(t=e[de.native])==null?void 0:t.remove)==null||i.call(t),e[de.native]=null,u(this,Tr).delete(e)}changeTrack(e){const t=e==null?void 0:e[de.native];t&&t.track.mode!=="showing"&&(t.track.mode="showing"),A(this,nd,e)}setDisplay(e){A(this,sd,e),m(this,ad,$L).call(this)}detach(){u(this,mn)&&(u(this,mn).textTracks.onchange=null);for(const e of u(this,Tr))this.removeTrack(e);u(this,Tr).clear(),A(this,mn,null),A(this,nd,null)}}sd=new WeakMap,mn=new WeakMap,nd=new WeakMap,Tr=new WeakMap,Gy=new WeakSet,T6=function(e){var i;if(!u(this,mn))return;const t=e[i=de.native]??(e[i]=m(this,Ky,b6).call(this,e));cl(t)&&(u(this,mn).append(t),t.track.mode=t.default?"showing":"disabled")},Ky=new WeakSet,b6=function(e){const t=document.createElement("track"),i=e.default||e.mode==="showing",s=e.src&&e.type==="vtt";return t.id=e.id,t.src=s?e.src:"",t.label=e.label,t.kind=e.kind,t.default=i,e.language&&(t.srclang=e.language),i&&!s&&m(this,rd,ML).call(this,e,t.track),t},rd=new WeakSet,ML=function(e,t){var i;if(!(e.src&&e.type==="vtt"||(i=t.cues)!=null&&i.length))for(const s of e.cues)t.addCue(s)},ad=new WeakSet,$L=function(e){for(const t of u(this,Tr)){const i=t[de.native];if(!i)continue;if(!u(this,sd)){i.track.mode=i.managed?"hidden":"disabled";continue}const s=i.track.mode==="showing";s&&m(this,rd,ML).call(this,t,i.track),t.setMode(s?"showing":"disabled",e)}};var eo,Zl,to,od,ld,vi,_s,jy,E6,cd,NL,Wy,S6,Yy,_6,zy,A6,br,Pl,Qy,x6;class XH{constructor(e){p(this,jy);p(this,cd);p(this,Wy);p(this,Yy);p(this,zy);p(this,br);p(this,Qy);p(this,eo,null);p(this,Zl,void 0);p(this,to,[]);p(this,od,void 0);p(this,ld,!1);p(this,vi,null);p(this,_s,null);A(this,od,e);const t=e.textTracks;A(this,Zl,t),D(m(this,jy,E6).bind(this)),ge(m(this,Qy,x6).bind(this)),new Ve(t).add("add",m(this,Yy,_6).bind(this)).add("remove",m(this,zy,A6).bind(this)).add("mode-change",m(this,br,Pl).bind(this))}add(e){u(this,to).push(e),Nu(m(this,br,Pl).bind(this))}remove(e){e.detach(),u(this,to).splice(u(this,to).indexOf(e),1),Nu(m(this,br,Pl).bind(this))}attachVideo(e){requestAnimationFrame(()=>{if(A(this,eo,e),e){A(this,vi,new QH),u(this,vi).attach(e);for(const t of u(this,Zl))m(this,cd,NL).call(this,t)}m(this,br,Pl).call(this)})}}eo=new WeakMap,Zl=new WeakMap,to=new WeakMap,od=new WeakMap,ld=new WeakMap,vi=new WeakMap,_s=new WeakMap,jy=new WeakSet,E6=function(){const{nativeControls:e}=u(this,od).$state;A(this,ld,e()),m(this,br,Pl).call(this)},cd=new WeakSet,NL=function(e){var t;Kt(e)&&((t=u(this,vi))==null||t.addTrack(e))},Wy=new WeakSet,S6=function(e){var t;Kt(e)&&((t=u(this,vi))==null||t.removeTrack(e))},Yy=new WeakSet,_6=function(e){m(this,cd,NL).call(this,e.detail)},zy=new WeakSet,A6=function(e){m(this,Wy,S6).call(this,e.detail)},br=new WeakSet,Pl=function(){var i,s,r,a,o,l,c;const e=u(this,Zl).selected;if(u(this,eo)&&(u(this,ld)||e!=null&&e[de.nativeHLS])){(i=u(this,_s))==null||i.changeTrack(null),(s=u(this,vi))==null||s.setDisplay(!0),(r=u(this,vi))==null||r.changeTrack(e);return}if((a=u(this,vi))==null||a.setDisplay(!1),(o=u(this,vi))==null||o.changeTrack(null),!e){(l=u(this,_s))==null||l.changeTrack(null);return}const t=u(this,to).sort((h,d)=>h.priority-d.priority).find(h=>h.canRender(e,u(this,eo)));u(this,_s)!==t&&((c=u(this,_s))==null||c.detach(),t==null||t.attach(u(this,eo)),A(this,_s,t??null)),t==null||t.changeTrack(e)},Qy=new WeakSet,x6=function(){var e,t;(e=u(this,vi))==null||e.detach(),A(this,vi,null),(t=u(this,_s))==null||t.detach(),A(this,_s,null)};var io,As,xs,Ls,Uie,ud,Jl,hd,Xy,L6,dd,FL,fd,BL;class ZH extends u6{constructor(){super();p(this,Xy);p(this,dd);p(this,fd);p(this,io,!1);p(this,As,{});p(this,xs,null);p(this,Ls,null);L(this,Uie);p(this,ud,ek(async()=>{var s;if(!u(this,io))return;!u(this,Ls)&&u(this,xs)&&A(this,Ls,await u(this,xs).getLang());const t=await((s=u(this,xs))==null?void 0:s.getCaptions()),i=[["captions","subtitles"],"chapters","descriptions","metadata"];for(const r of i){const a=this.getByKind(r);if(a.find(d=>d.mode==="showing"))continue;const o=u(this,Ls)?a.find(d=>d.language===u(this,Ls)):null,l=Ut(r)?u(this,As)[r.find(d=>u(this,As)[d])||""]:u(this,As)[r],c=o??l,h=c&&Kt(c);c&&(!h||t!==!1)&&(c.mode="showing",h&&m(this,dd,FL).call(this,c))}},300));p(this,Jl,null);p(this,hd,m(this,Xy,L6).bind(this))}get selected(){return this.items.find(i=>i.mode==="showing"&&Kt(i))??null}get selectedIndex(){const t=this.selected;return t?this.indexOf(t):-1}
1get preferredLang(){return u(this,Ls)}set preferredLang(t){A(this,Ls,t),m(this,fd,BL).call(this,t)}add(t,i){const s=t instanceof ga,r=s?t:new ga(t),a=t.kind==="captions"||t.kind==="subtitles"?"captions":t.kind;return u(this,As)[a]&&t.default&&delete t.default,r.addEventListener("mode-change",u(this,hd)),this[he.add](r,i),r[de.crossOrigin]=this[de.crossOrigin],u(this,io)&&r[de.canLoad](),t.default&&(u(this,As)[a]=r),u(this,ud).call(this),this}remove(t,i){if(A(this,Jl,t),!!this.items.includes(t))return t===u(this,As)[t.kind]&&delete u(this,As)[t.kind],t.mode="disabled",t[de.onModeChange]=null,t.removeEventListener("mode-change",u(this,hd)),this[he.remove](t,i),A(this,Jl,null),this}clear(t){for(const i of[...this.items])this.remove(i,t);return this}getByKind(t){const i=Array.isArray(t)?t:[t];return this.items.filter(s=>i.includes(s.kind))}[(Uie=de.crossOrigin,de.canLoad)](){if(!u(this,io)){for(const t of this.items)t[de.canLoad]();A(this,io,!0),u(this,ud).call(this)}}setStorage(t){A(this,xs,t)}}io=new WeakMap,As=new WeakMap,xs=new WeakMap,Ls=new WeakMap,ud=new WeakMap,Jl=new WeakMap,hd=new WeakMap,Xy=new WeakSet,L6=function(t){const i=t.detail;if(u(this,xs)&&Kt(i)&&i!==u(this,Jl)&&m(this,dd,FL).call(this,i),i.mode==="showing"){const s=Kt(i)?["captions","subtitles"]:[i.kind];for(const r of this.items)r.mode==="showing"&&r!=i&&s.includes(r.kind)&&(r.mode="disabled")}this.dispatchEvent(new ve("mode-change",{detail:t.detail,trigger:t}))},dd=new WeakSet,FL=function(t){var i,s;t.mode!=="disabled"&&m(this,fd,BL).call(this,t.language),(s=(i=u(this,xs))==null?void 0:i.setCaptions)==null||s.call(i,t.mode==="showing")},fd=new WeakSet,BL=function(t){var i,s;(s=(i=u(this,xs))==null?void 0:i.setLang)==null||s.call(i,A(this,Ls,t))};var so,Vie;class JH extends v6{constructor(){super(...arguments);p(this,so,!1);L(this,"switch","current");L(this,Vie)}get auto(){return u(this,so)||this.readonly}[(Vie=Ft.enableAuto,he.onUserSelect)](){this[Ft.setAuto](!1)}[he.onReset](t){this[Ft.enableAuto]=void 0,this[Ft.setAuto](!1,t)}autoSelect(t){var i;this.readonly||u(this,so)||!this[Ft.enableAuto]||((i=this[Ft.enableAuto])==null||i.call(this,t),this[Ft.setAuto](!0,t))}getBySrc(t){return this.items.find(i=>i.src===t)}[Ft.setAuto](t,i){u(this,so)!==t&&(A(this,so,t),this.dispatchEvent(new ve("auto-change",{detail:t,trigger:i})))}}so=new WeakMap;function eq(n){return(n==null?void 0:n.$$PROVIDER_TYPE)==="HLS"}function tq(n){return n instanceof HTMLAudioElement}function iq(n){return n instanceof HTMLVideoElement}function sq(n){return tq(n)||iq(n)}class yl extends Fi{}const nq={togglePaused:"k Space",toggleMuted:"m",toggleFullscreen:"f",togglePictureInPicture:"i",toggleCaptions:"c",seekBackward:"j J ArrowLeft",seekForward:"l L ArrowRight",volumeUp:"ArrowUp",volumeDown:"ArrowDown",speedUp:">",slowDown:"<"},dh=new Set(["Shift","Alt","Meta","Ctrl"]),rq='button, [role="button"]',W3='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]';var Ct,Zy,w6,Jy,C6,e0,I6,t0,k6,ec,cg,no,i0,R6,gn,pd,UL,s0,P6;class aq extends yl{constructor(t){super();p(this,Zy);p(this,Jy);p(this,e0);p(this,t0);p(this,ec);p(this,i0);p(this,pd);p(this,s0);p(this,Ct,void 0);p(this,no,void 0);p(this,gn,null);A(this,Ct,t)}onConnect(){D(m(this,Zy,w6).bind(this))}}Ct=new WeakMap,Zy=new WeakSet,w6=function(){const{keyDisabled:t,keyTarget:i}=this.$props;if(t())return;const s=i()==="player"?this.el:document,r=ae(!1);s===this.el?new Ve(this.el).add("focusin",()=>r.set(!0)).add("focusout",a=>{this.el.contains(a.target)||r.set(!1)}):(Y(r)||r.set(document.querySelector("[data-media-player]")===this.el),Fe(document,"focusin",a=>{const o=a.composedPath().find(l=>l instanceof Element&&l.localName==="media-player");o!==void 0&&r.set(this.el===o)})),D(()=>{r()&&new Ve(s).add("keyup",m(this,Jy,C6).bind(this)).add("keydown",m(this,e0,I6).bind(this)).add("keydown",m(this,t0,k6).bind(this),{capture:!0})})},Jy=new WeakSet,C6=function(t){var a,o;const i=document.activeElement;if(!t.key||!this.$state.canSeek()||i!=null&&i.matches(W3))return;let{method:s,value:r}=m(this,ec,cg).call(this,t);if(!te(r)&&!Ut(r)){(a=r==null?void 0:r.onKeyUp)==null||a.call(r,{event:t,player:u(this,Ct).player,remote:u(this,Ct).remote}),(o=r==null?void 0:r.callback)==null||o.call(r,t,u(this,Ct).remote);return}if(s!=null&&s.startsWith("seek")&&(t.preventDefault(),t.stopPropagation(),u(this,gn)?(m(this,pd,UL).call(this,t,s==="seekForward"),A(this,gn,null)):(u(this,Ct).remote.seek(u(this,no),t),A(this,no,void 0))),s!=null&&s.startsWith("volume")){const l=this.el.querySelector("[data-media-volume-slider]");l==null||l.dispatchEvent(new KeyboardEvent("keyup",{key:s==="volumeUp"?"Up":"Down",shiftKey:t.shiftKey,trigger:t}))}},e0=new WeakSet,I6=function(t){var o,l,c,h;if(!t.key||dh.has(t.key))return;const i=document.activeElement;if(i!=null&&i.matches(W3)||_2(t)&&(i!=null&&i.matches(rq)))return;let{method:s,value:r}=m(this,ec,cg).call(this,t),a=!t.metaKey&&/^[0-9]$/.test(t.key);if(!te(r)&&!Ut(r)&&!a){(o=r==null?void 0:r.onKeyDown)==null||o.call(r,{event:t,player:u(this,Ct).player,remote:u(this,Ct).remote}),(l=r==null?void 0:r.callback)==null||l.call(r,t,u(this,Ct).remote);return}if(!s&&a&&!cq(t)){t.preventDefault(),t.stopPropagation(),u(this,Ct).remote.seek(this.$state.duration()/10*Number(t.key),t);return}if(s){switch(t.preventDefault(),t.stopPropagation(),s){case"seekForward":case"seekBackward":m(this,s0,P6).call(this,t,s,s==="seekForward");break;case"volumeUp":case"volumeDown":const d=this.el.querySelector("[data-media-volume-slider]");if(d)d.dispatchEvent(new KeyboardEvent("keydown",{key:s==="volumeUp"?"Up":"Down",shiftKey:t.shiftKey,trigger:t}));else{const g=t.shiftKey?.1:.05;u(this,Ct).remote.changeVolume(this.$state.volume()+(s==="volumeUp"?+g:-g),t)}break;case"toggleFullscreen":u(this,Ct).remote.toggleFullscreen("prefer-media",t);break;case"speedUp":case"slowDown":const f=this.$state.playbackRate();u(this,Ct).remote.changePlaybackRate(Math.max(.25,Math.min(2,f+(s==="speedUp"?.25:-.25))),t);break;default:(h=(c=u(this,Ct).remote)[s])==null||h.call(c,t)}this.$state.lastKeyboardAction.set({action:s,event:t})}},t0=new WeakSet,k6=function(t){sq(t.target)&&m(this,ec,cg).call(this,t).method&&t.preventDefault()},ec=new WeakSet,cg=function(t){const i={...this.$props.keyShortcuts(),...u(this,Ct).ariaKeys},s=Object.keys(i).find(r=>{var c;const a=i[r],o=Ut(a)?a.join(" "):te(a)?a:a==null?void 0:a.keys,l=(c=Ut(o)?o:o==null?void 0:o.split(" "))==null?void 0:c.map(h=>lq(h).replace(/Control/g,"Ctrl").split("+"));return l==null?void 0:l.some(h=>{const d=new Set(h.filter(f=>dh.has(f)));for(const f of dh){const g=f.toLowerCase()+"Key";if(!d.has(f)&&t[g])return!1}return h.every(f=>dh.has(f)?t[f.toLowerCase()+"Key"]:t.key===f.replace("Space"," "))})});return{method:s,value:s?i[s]:null}},no=new WeakMap,i0=new WeakSet,R6=function(t,i){const s=t.shiftKey?10:5;return A(this,no,Math.max(0,Math.min((u(this,no)??this.$state.currentTime())+(i==="seekForward"?+s:-s),this.$state.duration())))},gn=new WeakMap,pd=new WeakSet,UL=function(t,i){var s;(s=u(this,gn))==null||s.dispatchEvent(new KeyboardEvent(t.type,{key:i?"Right":"Left",shiftKey:t.shiftKey,trigger:t}))},s0=new WeakSet,P6=function(t,i,s){this.$state.canSeek()&&(u(this,gn)||A(this,gn,this.el.querySelector("[data-media-time-slider]")),u(this,gn)?m(this,pd,UL).call(this,t,s):u(this,Ct).remote.seeking(m(this,i0,R6).call(this,t,i),t))};const oq=["!","@","#","$","%","^","&","*","(",")"];function lq(n){return n.replace(/Shift\+(\d)/g,(e,t)=>oq[t-1])}function cq(n){for(const e of dh)if(n[e.toLowerCase()+"Key"])return!0;return!1}var tc,yn,md,ic,Er,sc,n0,D6,r0,O6,a0,M6,o0,$6,l0,N6,c0,F6,u0,B6,h0,U6,nc,ug,gd,VL,ro,fh,yd,HL;class uq extends yl{constructor(){super(...arguments);p(this,n0);p(this,r0);p(this,a0);p(this,o0);p(this,l0);p(this,c0);p(this,u0);p(this,h0);p(this,nc);p(this,gd);p(this,ro);p(this,yd);p(this,tc,-2);p(this,yn,!1);p(this,md,ae(!1));p(this,ic,ae(!1));p(this,Er,null);p(this,sc,ae(!0));L(this,"defaultDelay",2e3)}get canIdle(){return u(this,sc).call(this)}set canIdle(t){u(this,sc).set(t)}get hideOnMouseLeave(){const{hideControlsOnMouseLeave:t}=this.$props;return u(this,md).call(this)||t()}set hideOnMouseLeave(t){u(this,md).set(t)}get showing(){return this.$state.controlsVisible()}show(t=0,i){m(this,nc,ug).call(this),u(this,yn)||m(this,ro,fh).call(this,!0,t,i)}hide(t=this.defaultDelay,i){m(this,nc,ug).call(this),u(this,yn)||m(this,ro,fh).call(this,!1,t,i)}pause(t){A(this,yn,!0),m(this,nc,ug).call(this),m(this,ro,fh).call(this,!0,0,t)}resume(t){A(this,yn,!1),!this.$state.paused()&&m(this,ro,fh).call(this,!1,this.defaultDelay,t)}onConnect(){D(m(this,n0,D6).bind(this))}}tc=new WeakMap,yn=new WeakMap,md=new WeakMap,ic=new WeakMap,Er=new WeakMap,sc=new WeakMap,n0=new WeakSet,D6=function(){const{viewT
1ype:t}=this.$state;if(!this.el||!u(this,sc).call(this))return;if(t()==="audio"){this.show();return}D(m(this,r0,O6).bind(this)),D(m(this,a0,M6).bind(this));const i=m(this,o0,$6).bind(this),s=m(this,l0,N6).bind(this),r=m(this,c0,F6).bind(this);new Ve(this.el).add("can-play",a=>this.show(0,a)).add("play",i).add("pause",s).add("end",r).add("auto-play-fail",s)},r0=new WeakSet,O6=function(){if(!this.el)return;const{started:t,pointer:i,paused:s}=this.$state;if(!t()||i()!=="fine")return;const r=new Ve(this.el),a=this.hideOnMouseLeave;(!a||!u(this,ic).call(this))&&D(()=>{s()||r.add("pointermove",m(this,gd,VL).bind(this))}),a&&r.add("mouseenter",m(this,u0,B6).bind(this)).add("mouseleave",m(this,h0,U6).bind(this))},a0=new WeakSet,M6=function(){const{paused:t,started:i,autoPlayError:s}=this.$state;if(t()||s()&&!i())return;const r=m(this,gd,VL).bind(this);D(()=>{if(!this.el)return;const a=this.$state.pointer(),o=a==="coarse",l=new Ve(this.el),c=[o?"touchend":"pointerup","keydown"];for(const h of c)l.add(h,r,{passive:!1})})},o0=new WeakSet,$6=function(t){t.triggers.hasType("ended")||(this.show(0,t),this.hide(void 0,t))},l0=new WeakSet,N6=function(t){this.show(0,t)},c0=new WeakSet,F6=function(t){const{loop:i}=this.$state;i()&&this.hide(0,t)},u0=new WeakSet,B6=function(t){u(this,ic).set(!1),this.show(0,t),this.hide(void 0,t)},h0=new WeakSet,U6=function(t){u(this,ic).set(!0),this.hide(0,t)},nc=new WeakSet,ug=function(){window.clearTimeout(u(this,tc)),A(this,tc,-1)},gd=new WeakSet,VL=function(t){var i;t.MEDIA_GESTURE||u(this,yn)||ck(t)||(QA(t)&&(t.key==="Escape"?((i=this.el)==null||i.focus(),A(this,Er,null)):u(this,Er)&&(t.preventDefault(),requestAnimationFrame(()=>{var s;(s=u(this,Er))==null||s.focus(),A(this,Er,null)}))),this.show(0,t),this.hide(this.defaultDelay,t))},ro=new WeakSet,fh=function(t,i,s){if(i===0){m(this,yd,HL).call(this,t,s);return}A(this,tc,window.setTimeout(()=>{this.scope&&m(this,yd,HL).call(this,t&&!u(this,yn),s)},i))},yd=new WeakSet,HL=function(t,i){var s;this.$state.controlsVisible()!==t&&(this.$state.controlsVisible.set(t),!t&&document.activeElement&&((s=this.el)!=null&&s.contains(document.activeElement))&&(A(this,Er,document.activeElement),requestAnimationFrame(()=>{var r;(r=this.el)==null||r.focus({preventScroll:!0})}
1)),this.dispatch("controls-change",{detail:t,trigger:i}))};class hq{constructor(){L(this,"name","audio");L(this,"target")}canPlay(e){return V2(e)?!te(e.src)||e.type==="?"||M2(this.target,e.type):!1}mediaType(){return"audio"}async load(e){return new(await se(()=>Promise.resolve().then(()=>Zj),void 0,import.meta.url)).AudioProvider(this.target,e)}}class pk{constructor(){L(this,"name","video");L(this,"target")}canPlay(e){return H2(e)?!te(e.src)||e.type==="?"||$2(this.target,e.type):!1}mediaType(){return"video"}async load(e){return new(await se(()=>Promise.resolve().then(()=>rW),void 0,import.meta.url)).VideoProvider(this.target,e)}}const d0=class d0 extends pk{constructor(){super(...arguments);L(this,"name","hls")}canPlay(t){return d0.supported&&Zu(t)}async load(t){return new(await se(()=>Promise.resolve().then(()=>dW),void 0,import.meta.url)).HLSProvider(this.target,t)}};L(d0,"supported",ex());let qL=d0;const f0=class f0 extends pk{constructor(){super(...arguments);L(this,"name","dash")}canPlay(t){return f0.supported&&tk(t)}async load(t){return new(await se(()=>Promise.resolve().then(()=>bW),void 0,import.meta.url)).DASHProvider(this.target,t)}};L(f0,"supported",U2());let GL=f0;class dq{constructor(){L(this,"name","vimeo");L(this,"target")}preconnect(){const e=["https://i.vimeocdn.com","https://f.vimeocdn.com","https://fresnel.vimeocdn.com"];for(const t of e)tr(t)}canPlay(e){return te(e.src)&&e.type==="video/vimeo"}mediaType(){return"video"}async load(e){return new(await se(()=>Promise.resolve().then(()=>xW),void 0,import.meta.url)).VimeoProvider(this.target,e)}async loadPoster(e,t,i){const{resolveVimeoVideoId:s,getVimeoVideoInfo:r}=await se(()=>Promise.resolve().then(()=>SW),void 0,import.meta.url);if(!te(e.src))return null;const{videoId:a,hash:o}=s(e.src);return a?r(a,i,o).then(l=>l?l.poster:null):null}}class fq{constructor(){L(this,"name","youtube");L(this,"target")}preconnect(){const e=["https://www.google.com","https://i.ytimg.com","https://googleads.g.doubleclick.net","https://static.doubleclick.net"];for(const t of e)tr(t)}canPlay(e){return te(e.src)&&e.type==="video/youtube"}mediaType(){return"video"}async load(e){return new(await se(()=>Promise.resolve().then(()=>DW),void 0,import.meta.url)).YouTubeProvider(this.target,e)}async loadPoster(e,t,i){const{findYouTubePoster:s,resolveYouTubeVideoId:r}=await se(()=>Promise.resolve().then(()=>IW),void 0,import.meta.url),a=te(e.src)&&r(e.src);return a?s(a,i):null}}const xx=Symbol(0),pq=["autoPlay","canAirPlay","canFullscreen","canGoogleCast","canLoad","canLoadPoster","canPictureInPicture","canPlay","canSeek","ended","fullscreen","isAirPlayConnected","isGoogleCastConnected","live","liveEdge","loop","mediaType","muted","paused","pictureInPicture","playing","playsInline","remotePlaybackState","remotePlaybackType","seeking","started","streamType","viewType","waiting"],mq={artist:"",artwork:null,autoplay:!1,autoPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,currentTime:0,crossorigin:null,crossOrigin:null,duration:-1,fullscreenOrientation:"landscape",googleCast:{},load:"visible",posterLoad:"visible",logLevel:"silent",loop:!1,muted:!1,paused:!0,playsinline:!1,playsInline:!1,playbackRate:1,poster:"",preload:"metadata",preferNativeHLS:!1,src:"",title:"",controlsDelay:2e3,hideControlsOnMouseLeave:!1,viewType:"unknown",streamType:"unknown",volume:1,liveEdgeTolerance:10,minLiveDVRWindow:60,keyDisabled:!1,keyTarget:"player",keyShortcuts:nq,storage:null};var vd,ao;class Y3 extends yl{constructor(t,i){super();p(this,vd,void 0);p(this,ao,void 0);A(this,vd,t),A(this,ao,i)}async onAttach(t){const i=this.$props[u(this,vd)]();if(i==="eager")requestAnimationFrame(u(this,ao));else if(i==="idle")oV(u(this,ao));else if(i==="visible"){let s,r=new IntersectionObserver(a=>{this.scope&&a[0].isIntersecting&&(s==null||s(),s=void 0,u(this,ao).call(this))});r.observe(t),s=ge(()=>r.disconnect())}}}vd=new WeakMap,ao=new WeakMap;var Td,ji,p0,V6;class gq{constructor(e,t){p(this,p0);p(this,Td,void 0);p(this,ji,void 0);A(this,Td,e),A(this,ji,t)}notify(e,...t){u(this,Td).call(this,new ve(e,{detail:t==null?void 0:t[0],trigger:t==null?void 0:t[1]}))}async ready(e,t){return Nu(async()=>{var O,G,j,K,W,U,V;u(this,ji);const{autoPlay:i,canPlay:s,started:r,duration:a,seekable:o,buffered:l,remotePlaybackInfo:c,playsInl
1ine:h,savedState:d,source:f}=u(this,ji).$state;if(s())return;const g={duration:(e==null?void 0:e.duration)??a(),seekable:(e==null?void 0:e.seekable)??o(),buffered:(e==null?void 0:e.buffered)??l(),provider:u(this,ji).$provider()};this.notify("can-play",g,t),zn();let y=u(this,ji).$provider(),{storage:v,qualities:T}=u(this,ji),{muted:b,volume:E,clipStartTime:_,playbackRate:x}=u(this,ji).$props;await((O=v==null?void 0:v.onLoad)==null?void 0:O.call(v,f()));const w=(G=d())==null?void 0:G.currentTime,R=(j=d())==null?void 0:j.paused,C=await(v==null?void 0:v.getTime()),k=w??C??_(),P=R===!1||R!==!0&&!r()&&i();if(y){y.setVolume(await(v==null?void 0:v.getVolume())??E()),y.setMuted(b()||!!await(v==null?void 0:v.getMuted()));const q=await(v==null?void 0:v.getAudioGain())??1;q>1&&((W=(K=y.audioGain)==null?void 0:K.setGain)==null||W.call(K,q)),(U=y.setPlaybackRate)==null||U.call(y,await(v==null?void 0:v.getPlaybackRate())??x()),(V=y.setPlaysInline)==null||V.call(y,h()),k>0&&y.setCurrentTime(k)}const I=await(v==null?void 0:v.getVideoQuality());if(I&&T.length){let q=null,z=1/0;for(const F of T){const N=Math.abs(I.width-F.width)+Math.abs(I.height-F.height)+(I.bitrate?Math.abs(I.bitrate-(F.bitrate??0)):0);N<z&&(q=F,z=N)}q&&(q.selected=!0)}s()&&P?await m(this,p0,V6).call(this,t):C&&C>0&&this.notify("started",void 0,t),c.set(null)})}}Td=new WeakMap,ji=new WeakMap,p0=new WeakSet,V6=async function(e){const{player:t,$state:{autoPlaying:i,muted:s}}=u(this,ji);i.set(!0);const r=new ve("auto-play-attempt",{trigger:e});try{await t.play(r)}catch{}};var Sr;class yq{constructor(){p(this,Sr,new Map)}enqueue(e,t){u(this,Sr).set(e,t)}serve(e){const t=this.peek(e);return u(this,Sr).delete(e),t}peek(e){return u(this,Sr).get(e)}delete(e){u(this,Sr).delete(e)}clear(){u(this,Sr).clear()}}Sr=new WeakMap;var _r,rc,Wi,bd,KL,Ed,jL;class H6{constructor(){p(this,bd);p(this,Ed);p(this,_r,!1);p(this,rc,Bu());p(this,Wi,new Map)}get size(){return u(this,Wi).size}get isServing(){return u(this,_r)}async waitForFlush(){u(this,_r)||await u(this,rc).promise}enqueue(e,t){if(u(this,_r)){t();return}u(this,Wi).delete(e),u(this,Wi).set(e,t)}serve(e){var t;(t=u(this,Wi).get(e))==null||t(),u(this,Wi).delete(e)}start(){m(this,bd,KL).call(this),A(this,_r,!0),u(this,Wi).size>0&&m(this,bd,KL).call(this)}stop(){A(this,_r,!1)}reset(){this.stop(),u(this,Wi).clear(),m(this,Ed,jL).call(this)}}_r=new WeakMap,rc=new WeakMap,Wi=new WeakMap,bd=new WeakSet,KL=function(){for(const e of u(this,Wi).keys())this.serve(e);m(this,Ed,jL).call(this)},Ed=new WeakSet,jL=function(){u(this,rc).resolve(),A(this,rc,Bu())};var vn,pe,Tn,oo,bn,Ze,Ar,m0,q6,g0,G6,y0,K6,Sd,WL,ac,_d,YL,Ad,zL,v0,j6,T0,W6,b0,Y6,E0,z6,S0,Q6,_0,X6,lo,A0,Z6,xd,QL,Ld,XL,UI,Tq;class vq extends yl{constructor(t,i,s){super();p(this,m0);p(this,g0);p(this,y0);p(this,Sd);p(this,_d);p(this,Ad);p(this,v0);p(this,T0);p(this,b0);p(this,E0);p(this,S0);p(this,_0);p(this,A0);p(this,xd);p(this,Ld);p(this,UI);p(this,vn,void 0);p(this,pe,void 0);p(this,Tn,void 0);L(this,"controls");p(this,oo,void 0);p(this,bn,void 0);p(this,Ze,void 0);p(this,Ar,new H6);p(this,ac,!1);p(this,lo,void 0);A(this,vn,t),A(this,pe,i),A(this,Tn,s),A(this,Ze,s.$provider),this.controls=new uq,A(this,oo,new GH),A(this,bn,new iy)}onAttach(){this.listen("fullscreen-change",m(this,A0,Z6).bind(this))}onConnect(t){const i=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),s=new Ve(t),r=m(this,y0,K6).bind(this);for(const a of i)a.startsWith("media-")&&s.add(a,r);m(this,m0,q6).call(this),D(m(this,g0,G6).bind(this)),D(m(this,v0,j6).bind(this)),D(m(this,T0,W6).bind(this)),D(m(this,b0,Y6).bind(this)),D(m(this,E0,z6).bind(this)),D(m(this,S0,Q6).bind(this)),D(m(this,_0,X6).bind(this))}onDestroy(){try{const t=this.createEvent("destroy"),{pictureInPicture:i,fullscreen:s}=this.$state;s()&&this.exitFullscreen("prefer-media",t),i()&&this.exitPictureInPicture(t)}catch{}u(this,Ar).reset()}async play(t){const{canPlay:i,paused:s,autoPlaying:r}=this.$state;if(m(this,Sd,WL).call(this,t)||!Y(s))return;t&&u(this,pe).queue.enqueue("media-play-request",t);const a=Y(r);try{const o=Y(u(this,Ze));return Lx(o,Y(i)),bq(a),await o.play()}catch(o){const l=this.createEvent("play-fail",{detail:Ah(o),trigger:t});throw l.autoPlay=a,u(this,vn).handle(l),o}}async pause(t){const{canPlay:i,paused:s}=this.$state;if(!Y(s)){t&&u(this,pe).queue.enqueue("media-pause-request",t);try{const r=Y(u(this,Ze));return Lx(r,Y(i)),await r.pause()}catch(r){throw u(this,pe).queue.delete("media-pause-request"),r}}}setAudioGain(t,i){const{audioGain:s,canSetAudioGain:r}=this.$state;if(s()===t)return;const a=u(this,Ze).call(this);if(!(a!=null&&a.audioGain)||!r())throw Error("[vidstack] audio gain api not available");i&&u(this,pe).queue.enqueue("media-audio-gain-change-request",i),a.audioGain.setGain(t)}seekToLiveEdge(t){const{canPlay:i,live:s,liveEdge:r,canSeek:a,liveSyncPosition:o,seekableEnd:l,userBehindLiveEdge:c}=this.$state;if(c.set(!1),Y(()=>!s()||r()||!a()))return;const h=Y(u(this,Ze));Lx(h,Y(i)),t&&u(this,pe).queue.enqueue("media-seek-request",t);const d=l()-2;h.setCurrentTime(Math.min(d,o()??d))}async enterFullscreen(t="prefer-media",i){const s=m(this,_d,YL).call(this,t);if(z3(t,s),!s.active)return Y(this.$state.pictureInPicture)&&(A(this,ac,!0),await this.exitPictureInPicture(i)),i&&u(this,pe).queue.enqueue("media-enter-fullscreen-request",i),s.enter()}async exitFullscreen(t="prefer-media",i){const s=m(this,_d,YL).call(this,t);if(z3(t,s),!!s.active){i&&u(this,pe).queue.enqueue("media-exit-fullscreen-request",i);try{const r=await s.exit();return u(this,ac)&&Y(this.$state.canPictureInPicture)&&await this.enterPictureInPicture(),r}finally{A(this,ac,!1)}}}async enterPictureInPicture(t){if(m(this,Ad,zL).call(this),!this.$state.pictureInPicture())return t&&u(this,pe).queue.enqueue("media-enter-pip-request",t),await u(this,Ze).call(this).pictureInPicture.enter()}async exitPictureInPicture(t){if(m(this,Ad,zL).call(this),!!this.$state.pictureInPicture())return t&&u(this,pe).queue.enqueue("media-exit-pip-request",t),await u(this,Ze).call(this).pictureInPicture.exit()}async"media-airplay-request"(t){try{await this.requestAirPlay(t)}catch{}}async requestAirPlay(t){var i;try{const s=(i=u(this,Ze).call(this))==null?void 0:i.airPlay;if(!(s!=null&&s.supported))throw Error("No AirPlay adapter.");return t&&u(this,pe).queue.enqueue("media-airplay-request",t),await s.prompt()}catch(s){throw u(this,pe).queue.delete("media-airplay-request"),s}}async"media-google-cast-request"(t){try{await this.requestGoogleCast(t)}
1catch{}}async requestGoogleCast(t){try{const{canGoogleCast:i}=this.$state;if(!Y(i)){const r=Error("Cast not available.");throw r.code="CAST_NOT_AVAILABLE",r}if(tr("https://www.gstatic.com"),!u(this,lo)){const r=await se(()=>Promise.resolve().then(()=>UW),void 0,import.meta.url);A(this,lo,new r.GoogleCastLoader)}await u(this,lo).prompt(u(this,Tn)),t&&u(this,pe).queue.enqueue("media-google-cast-request",t);const s=Y(this.$state.remotePlaybackState)!=="disconnected";s&&this.$state.savedState.set({paused:Y(this.$state.paused),currentTime:Y(this.$state.currentTime)}),this.$state.remotePlaybackLoader.set(s?u(this,lo):null)}catch(i){throw u(this,pe).queue.delete("media-google-cast-request"),i}}"media-clip-start-change-request"(t){const{clipStartTime:i}=this.$state;i.set(t.detail)}"media-clip-end-change-request"(t){const{clipEndTime:i}=this.$state;i.set(t.detail),this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-duration-change-request"(t){const{providedDuration:i,clipEndTime:s}=this.$state;i.set(t.detail),s()<=0&&this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-audio-track-change-request"(t){const{logger:i,audioTracks:s}=u(this,Tn);if(s.readonly)return;const r=t.detail,a=s[r];if(a){const o=t.type;u(this,pe).queue.enqueue(o,t),a.selected=!0}}async"media-enter-fullscreen-request"(t){try{await this.enterFullscreen(t.detail,t)}catch(i){m(this,xd,QL).call(this,i,t)}}async"media-exit-fullscreen-request"(t){try{await this.exitFullscreen(t.detail,t)}catch(i){m(this,xd,QL).call(this,i,t)}}async"media-orientation-lock-request"(t){const i=t.type;try{u(this,pe).queue.enqueue(i,t),await u(this,bn).lock(t.detail)}catch{u(this,pe).queue.delete(i)}}async"media-orientation-unlock-request"(t){const i=t.type;try{u(this,pe).queue.enqueue(i,t),await u(this,bn).unlock()}catch{u(this,pe).queue.delete(i)}}async"media-enter-pip-request"(t){try{await this.enterPictureInPicture(t)}catch(i){m(this,Ld,XL).call(this,i,t)}}async"media-exit-pip-request"(t){try{await this.exitPictureInPicture(t)}catch(i){m(this,Ld,XL).call(this,i,t)}}"media-live-edge-request"(t){const{live:i,liveEdge:s,canSeek:r}=this.$state;if(!(!i()||s()||!r())){u(this,pe).queue.enqueue("media-seek-request",t);try{this.seekToLiveEdge()}catch{u(this,pe).queue.delete("media-seek-request")}}}async"media-loop-request"(t){try{u(this,pe).looping=!0,u(this,pe).replaying=!0,await this.play(t)}catch{u(this,pe).looping=!1}}"media-user-loop-change-request"(t){this.$state.userPrefersLoop.set(t.detail)}async"media-pause-request"(t){if(!this.$state.paused())try{await this.pause(t)}catch{}}async"media-play-request"(t){if(this.$state.paused())try{await this.play(t)}catch{}}"media-rate-change-request"(t){const{playbackRate:i,canSetPlaybackRate:s}=this.$state;if(i()===t.detail||!s())return;const r=u(this,Ze).call(this);r!=null&&r.setPlaybackRate&&(u(this,pe).queue.enqueue("media-rate-change-request",t),r.setPlaybackRate(t.detail))}"media-audio-gain-change-request"(t){try{this.setAudioGain(t.detail,t)}catch{}}"media-quality-change-request"(t){var o,l;const{qualities:i,storage:s,logger:r}=u(this,Tn);if(i.readonly)return;u(this,pe).queue.enqueue("media-quality-change-request",t);const a=t.detail;if(a<0)i.autoSelect(t),t.isOriginTrusted&&((o=s==null?void 0:s.setVideoQuality)==null||o.call(s,null));else{const c=i[a];c&&(c.selected=!0,t.isOriginTrusted&&((l=s==null?void 0:s.setVideoQuality)==null||l.call(s,{id:c.id,width:c.width,height:c.height,bitrate:c.bitrate})))}}"media-pause-controls-request"(t){const i=t.type;u(this,pe).queue.enqueue(i,t),this.controls.pause(t)}"media-resume-controls-request"(t){const i=t.type;u(this,pe).queue.enqueue(i,t),this.controls.resume(t)}"media-seek-request"(t){const{canSeek:i,ended:s,live:r,seekableEnd:a,userBehindLiveEdge:o}=this.$state,l=t.detail;s()&&(u(this,pe).replaying=!0);const c=t.type;u(this,pe).seeking=!1,u(this,pe).queue.delete(c);const h=y6(l,this.$state);!Number.isFinite(h)||!i()||(u(this,pe).queue.enqueue(c,t),u(this,Ze).call(this).setCurrentTime(h),r()&&t.isOriginTrusted&&Math.abs(a()-h)>=2&&o.set(!0))}"media-seeking-request"(t){const i=t.type;u(this,pe).queue.enqueue(i,t),this.$state.seeking.set(!0),u(this,pe).seeking=!0}"media-start-loading"(t){if(this.$state.canLoad())return;const i=t.type;u(this,pe).queue.enqueue(i,t),u(this,vn).handle(this.createEvent("can-load"))}"media-poster-start-loading"(t){if(this.$state.canLoadPoster())return;const i=t.type;u(this,pe).queue.enqueue(i,t),u(this,vn).handle(this.createEvent("can-load-poster"))}"media-text-track-change-request"(t){const{index:i,mode:s}=t.detail,r=u(this,Tn).textTracks[i];if(r){const a=t.type;u(this,pe).queue.enqueue(a,t),r.setMode(s,t)}}"media-mute-request"(t){if(this.$state.muted())return;const i=t.type;u(this,pe).queue.enqueue(i,t),u(this,Ze).call(this).setMuted(!0)}"media-unmute-request"(t){const{muted:i,volume:s}=this.$state;if(!i())return;const r=t.type;u(this,pe).queue.enqueue(r,t),u(this,Tn).$provider().setMuted(!1),s()===0&&(u(this,pe).queue.enqueue(r,t),u(this,Ze).call(this).setVolume(.25))}"media-volume-change-request"(t){const{muted:i,volume:s}=this.$state,r=t.detail;if(s()===r)return;const a=t.type;u(this,pe).queue.enqueue(a,t),u(this,Ze).call(this).setVolume(r),r>0&&i()&&(u(this,pe).queue.enqueue(a,t),u(this,Ze).call(this).setMuted(!1))}}vn=new WeakMap,pe=new WeakMap,Tn=new WeakMap,oo=new WeakMap,bn=new WeakMap,Ze
1=new WeakMap,Ar=new WeakMap,m0=new WeakSet,q6=function(){const{load:t}=this.$props,{canLoad:i}=this.$state;if(t()!=="play"||i())return;const s=this.listen("media-play-request",r=>{m(this,Sd,WL).call(this,r),s()})},g0=new WeakSet,G6=function(){const t=u(this,Ze).call(this),i=this.$state.canPlay();return t&&i&&u(this,Ar).start(),()=>{u(this,Ar).stop()}},y0=new WeakSet,K6=function(t){t.stopPropagation(),!t.defaultPrevented&&this[t.type]&&(Y(u(this,Ze))?this[t.type](t):u(this,Ar).enqueue(t.type,()=>{Y(u(this,Ze))&&this[t.type](t)}))},Sd=new WeakSet,WL=function(t){const{load:i}=this.$props,{canLoad:s}=this.$state;if(i()==="play"&&!s()){const r=this.createEvent("media-start-loading",{trigger:t});return this.dispatchEvent(r),u(this,Ar).enqueue("media-play-request",async()=>{try{await this.play(r)}catch{}}),!0}return!1},ac=new WeakMap,_d=new WeakSet,YL=function(t){const i=Y(u(this,Ze));return t==="prefer-media"&&u(this,oo).supported||t==="media"?u(this,oo):i==null?void 0:i.fullscreen},Ad=new WeakSet,zL=function(){if(!this.$state.canPictureInPicture())throw Error("[vidstack] no pip support")},v0=new WeakSet,j6=function(){this.controls.defaultDelay=this.$props.controlsDelay()},T0=new WeakSet,W6=function(){var s,r;const{canSetAudioGain:t}=this.$state,i=!!((r=(s=u(this,Ze).call(this))==null?void 0:s.audioGain)!=null&&r.supported);t.set(i)},b0=new WeakSet,Y6=function(){var s,r;const{canAirPlay:t}=this.$state,i=!!((r=(s=u(this,Ze).call(this))==null?void 0:s.airPlay)!=null&&r.supported);t.set(i)},E0=new WeakSet,z6=function(){const{canGoogleCast:t,source:i}=this.$state,s=JA&&!ZA&&q2(i());t.set(s)},S0=new WeakSet,Q6=function(){var s,r;const{canFullscreen:t}=this.$state,i=u(this,oo).supported||!!((r=(s=u(this,Ze).call(this))==null?void 0:s.fullscreen)!=null&&r.supported);t.set(i)},_0=new WeakSet,X6=function(){var s,r;const{canPictureInPicture:t}=this.$state,i=!!((r=(s=u(this,Ze).call(this))==null?void 0:s.pictureInPicture)!=null&&r.supported);t.set(i)},lo=new WeakMap,A0=new WeakSet,Z6=async function(t){const i=Y(this.$props.fullscreenOrientation),s=t.detail;if(!(Vt(i)||i==="none"||!u(this,bn).supported))if(s){if(u(this,bn).locked)return;this.dispatch("media-orientation-lock-request",{detail:i,trigger:t})}else u(this,bn).locked&&this.dispatch("media-orientation-unlock-request",{trigger:t})},xd=new WeakSet,QL=function(t,i){u(this,vn).handle(this.createEvent("fullscreen-error",{detail:Ah(t)}))},Ld=new WeakSet,XL=function(t,i){u(this,vn).handle(this.createEvent("picture-in-picture-error",{detail:Ah(t)}))},UI=new WeakSet,Tq=function(t,i,s){};function Lx(n,e){if(!(n&&e))throw Error("[vidstack] media not ready")}function z3(n,e){if(!(e!=null&&e.supported))throw Error("[vidstack] no fullscreen support")}function bq(n){if(!(!qH()||!n))throw Error("[vidstack] autoplay blocked")}class Eq{constructor(){L(this,"seeking",!1);L(this,"looping",!1);L(this,"replaying",!1);L(this,"queue",new yq)}}const Sq=new Set(["auto-play","auto-play-fail","can-load","sources-change","source-change","load-start","abort","error","loaded-metadata","loaded-data","can-play","play","play-fail","pause","playing","seeking","seeked","waiting"]);var Yt,Pe,Ge,co,oc,uo,ho,En,xr,x0,J6,L0,eD,ws,or,Je,rt,w0,tD,C0,iD,I0,sD,lc,hg,wd,ZL,Cd,JL,k0,nD,Id,ew,R0,rD,P0,aD,cc,kd,tw,uc,dg,D0,oD,O0,lD,M0,cD,Rd,iw,Pd,sw,Dd,nw,$0,uD,Od,rw,N0,hD,hc,F0,dD,Md,aw;class _q extends yl{constructor(t,i){super();p(this,x0);p(this,L0);p(this,ws);p(this,Je);p(this,w0);p(this,C0);p(this,I0);p(this,lc);p(this,wd);p(this,Cd);p(this,k0);p(this,Id);p(this,R0);p(this,P0);p(this,kd);p(this,uc);p(this,D0);p(this,O0);p(this,M0);p(this,Rd);p(this,Pd);p(this,Dd);p(this,$0);p(this,Od);p(this,N0);p(this,F0);p(this,Md);p(this,Yt,void 0);p(this,Pe,void 0);p(this,Ge,new Map);p(this,co,!1);p(this,oc,[]);p(this,uo,[-1,-1]);p(this,ho,!1);p(this,En,void 0);p(this,xr,!1);p(this,cc,null);L(this,"seeking",gl(t=>{const{seeking:i,realCurrentTime:s,paused:r}=this.$state;i.set(!0),s.set(t.detail),m(this,Je,rt).call(this,"media-seeking-request",t),r()&&(A(this,En,t),u(this,hc).call(this)),A(this,uo,[-1,-1])},150,{leading:!0}));p(this,hc,ek(()=>
1{if(!u(this,En))return;A(this,ho,!0);const{waiting:t,playing:i}=this.$state;t.set(!0),i.set(!1);const s=this.createEvent("waiting",{trigger:u(this,En)});u(this,Ge).set("waiting",s),this.dispatch(s),A(this,En,void 0),A(this,ho,!1)},300));A(this,Yt,t),A(this,Pe,i)}onAttach(t){t.setAttribute("aria-busy","true"),new Ve(this).add("fullscreen-change",this["fullscreen-change"].bind(this)).add("fullscreen-error",this["fullscreen-error"].bind(this)).add("orientation-change",this["orientation-change"].bind(this))}onConnect(t){D(m(this,O0,lD).bind(this)),m(this,w0,tD).call(this),m(this,C0,iD).call(this),m(this,I0,sD).call(this),m(this,x0,J6).call(this),ge(m(this,L0,eD).bind(this))}onDestroy(){const{audioTracks:t,qualities:i,textTracks:s}=u(this,Pe);t[he.reset](),i[he.reset](),s[he.reset](),m(this,uc,dg).call(this)}handle(t){if(!this.scope)return;const i=t.type;Nu(()=>{var s;return(s=this[t.type])==null?void 0:s.call(this,t)}),Sq.has(i)&&u(this,Ge).set(i,t),this.dispatch(t)}"provider-change"(t){var r,a;const i=u(this,Pe).$provider(),s=t.detail;(i==null?void 0:i.type)!==(s==null?void 0:s.type)&&((r=i==null?void 0:i.destroy)==null||r.call(i),(a=i==null?void 0:i.scope)==null||a.dispose(),u(this,Pe).$provider.set(t.detail),i&&t.detail===null&&m(this,Rd,iw).call(this,t))}"provider-loader-change"(t){}"auto-play"(t){this.$state.autoPlayError.set(null)}"auto-play-fail"(t){this.$state.autoPlayError.set(t.detail),m(this,ws,or).call(this)}"can-load"(t){this.$state.canLoad.set(!0),u(this,Ge).set("can-load",t),u(this,Pe).textTracks[de.canLoad](),m(this,Je,rt).call(this,"media-start-loading",t)}"can-load-poster"(t){this.$state.canLoadPoster.set(!0),u(this,Ge).set("can-load-poster",t),m(this,Je,rt).call(this,"media-poster-start-loading",t)}"media-type-change"(t){const i=u(this,Ge).get("source-change");i&&t.triggers.add(i);const s=this.$state.viewType();this.$state.mediaType.set(t.detail);const r=this.$state.providedViewType(),a=r==="unknown"?t.detail:r;s!==a&&setTimeout(()=>{requestAnimationFrame(()=>{this.scope&&(this.$state.inferredViewType.set(t.detail),this.dispatch("view-type-change",{detail:a,trigger:t}))})},0)}"stream-type-change"(t){const i=u(this,Ge).get("source-change");i&&t.triggers.add(i);const{streamType:s,inferredStreamType:r}=this.$state;r.set(t.detail),t.detail=s()}"rate-change"(t){var r;const{storage:i}=u(this,Pe),{canPlay:s}=this.$state;this.$state.playbackRate.set(t.detail),m(this,Je,rt).call(this,"media-rate-change-request",t),s()&&((r=i==null?void 0:i.setPlaybackRate)==null||r.call(i,t.detail))}"remote-playback-change"(t){const{remotePlaybackState:i,remotePlaybackType:s}=this.$state,{type:r,state:a}=t.detail,o=a==="connected";s.set(r),i.set(a);const l=r==="airplay"?"media-airplay-request":"media-google-cast-request";if(o)m(this,Je,rt).call(this,l,t);else{const c=u(this,Yt).queue.peek(l);c&&(t.request=c,t.triggers.add(c))}}"sources-change"(t){const i=this.$state.sources(),s=t.detail;this.$state.sources.set(s),m(this,M0,cD).call(this,i,s,t)}"source-change"(t){var s,r;t.isQualityChange=((s=t.originEvent)==null?void 0:s.type)==="quality-change";const i=t.detail;m(this,Rd,iw).call(this,t,t.isQualityChange),u(this,Ge).set(t.type,t),this.$state.source.set(i),(r=this.el)==null||r.setAttribute("aria-busy","true")}abort(t){const i=u(this,Ge).get("source-change");i&&t.triggers.add(i);const s=u(this,Ge).get("can-load");s&&!t.triggers.hasType("can-load")&&t.triggers.add(s)}"load-start"(t){const i=u(this,Ge).get("source-change");i&&t.triggers.add(i)}error(t){this.$state.error.set(t.detail);const i=u(this,Ge).get("abort");i&&t.triggers.add(i)}"loaded-metadata"(t){const i=u(this,Ge).get("load-start");i&&t.triggers.add(i)}"loaded-data"(t){const i=u(this,Ge).get("load-start");i&&t.triggers.add(i)}"can-play"(t){var s;const i=u(this,Ge).get("loaded-metadata");i&&t.triggers.add(i),m(this,Pd,sw).call(this,t.detail),(s=this.el)==null||s.setAttribute("aria-busy","false")}"can-play-through"(t){m(this,Pd,sw).call(this,t.detail);const i=u(this,Ge).get("can-play");i&&t.triggers.add(i)}"duration-change"(t){const{live:i,intrinsicDuration:s,providedDuration:r,clipEndTime:a,ended:o}=this.$state,l=t.detail;if(!i()){const c=Number.isNaN(l)?0:l;s.set(c),o()&&m(this,Od,rw).call(this,t)}(r()>0||a()>0)&&t.stopImmediatePropagation()}progress(t){const{buffered:i,seekable:s}=this.$state,{buffered:r,seekable:a}=t.detail,o=Va(r),l=r.length!==i().length,c=o!==Va(i()),h=Va(a),d=a.length!==s().length,f=h!==Va(s());(l||c)&&i.set(r),(d||f)&&s.set(a)}play(t){const{paused:i,autoPlayError:s,ended:r,autoPlaying:a,playsInl
1ine:o,pointer:l,muted:c,viewType:h,live:d,userBehindLiveEdge:f}=this.$state;if(m(this,Dd,nw).call(this),!i()){t.stopImmediatePropagation();return}t.autoPlay=a();const g=u(this,Ge).get("waiting");g&&t.triggers.add(g),m(this,Je,rt).call(this,"media-play-request",t),u(this,Ge).set("play",t),i.set(!1),s.set(null),t.autoPlay&&(this.handle(this.createEvent("auto-play",{detail:{muted:c()},trigger:t})),a.set(!1)),(r()||u(this,Yt).replaying)&&(u(this,Yt).replaying=!1,r.set(!1),this.handle(this.createEvent("replay",{trigger:t}))),!o()&&h()==="video"&&l()==="coarse"&&u(this,Pe).remote.enterFullscreen("prefer-media",t),d()&&!f()&&u(this,Pe).remote.seekToLiveEdge(t)}"play-fail"(t){const{muted:i,autoPlaying:s}=this.$state,r=u(this,Ge).get("play");r&&t.triggers.add(r),m(this,Je,rt).call(this,"media-play-request",t);const{paused:a,playing:o}=this.$state;a.set(!0),o.set(!1),m(this,ws,or).call(this),u(this,Ge).set("play-fail",t),t.autoPlay&&(this.handle(this.createEvent("auto-play-fail",{detail:{muted:i(),error:t.detail},trigger:t})),s.set(!1))}playing(t){const i=u(this,Ge).get("play"),s=u(this,Ge).get("seeked");i?t.triggers.add(i):s&&t.triggers.add(s),setTimeout(()=>m(this,ws,or).call(this),0);const{paused:r,playing:a,live:o,liveSyncPosition:l,seekableEnd:c,started:h,currentTime:d,seeking:f,ended:g}=this.$state;if(r.set(!1),a.set(!0),f.set(!1),g.set(!1),u(this,Yt).looping){u(this,Yt).looping=!1;return}if(o()&&!h()&&d()===0){const y=l()??c()-2;Number.isFinite(y)&&u(this,Pe).$provider().setCurrentTime(y)}this.started(t)}started(t){const{started:i}=this.$state;i()||(i.set(!0),this.handle(this.createEvent("started",{trigger:t})))}pause(t){var a;(a=this.el)!=null&&a.isConnected||A(this,xr,!0),m(this,Je,rt).call(this,"media-pause-request",t);const i=u(this,Ge).get("seeked");i&&t.triggers.add(i);const{paused:s,playing:r}=this.$state;s.set(!0),r.set(!1),u(this,co)&&setTimeout(()=>{this.handle(this.createEvent("end",{trigger:t})),A(this,co,!1)},0),m(this,ws,or).call(this)}"time-change"(t){if(u(this,Yt).looping){t.stopImmediatePropagation();return}let{waiting:i,played:s,clipEndTime:r,realCurrentTime:a,currentTime:o}=this.$state,l=t.detail,c=r();a.set(l),m(this,$0,uD).call(this),i.set(!1);for(const h of u(this,Pe).textTracks)h[de.updateActiveCues](l,t);c>0&&l>=c&&(A(this,co,!0),this.dispatch("media-pause-request",{trigger:t})),m(this,N0,hD).call(this),this.dispatch("time-update",{detail:{currentTime:o(),played:s()},trigger:t})}"audio-gain-change"(t){var a;const{storage:i}=u(this,Pe),{canPlay:s,audioGain:r}=this.$state;r.set(t.detail),m(this,Je,rt).call(this,"media-audio-gain-change-request",t),s()&&((a=i==null?void 0:i.setAudioGain)==null||a.call(i,r()))}"volume-change"(t){var l,c;const{storage:i}=u(this,Pe),{volume:s,muted:r,canPlay:a}=this.$state,o=t.detail;s.set(o.volume),r.set(o.muted||o.volume===0),m(this,Je,rt).call(this,"media-volume-change-request",t),m(this,Je,rt).call(this,o.muted?"media-mute-request":"media-unmute-request",t),a()&&((l=i==null?void 0:i.setVolume)==null||l.call(i,s()),(c=i==null?void 0:i.setMuted)==null||c.call(i,r()))}seeked(t){const{seeking:i,currentTime:s,realCurrentTime:r,paused:a,seekableEnd:o,ended:l,live:c}=this.$state;if(u(this,Yt).seeking)i.set(!0),t.stopImmediatePropagation();else if(i()){const h=u(this,Ge).get("waiting");h&&t.triggers.add(h);const d=u(this,Ge).get("seeking");d&&!t.triggers.has(d)&&t.triggers.add(d),a()&&m(this,Md,aw).call(this),i.set(!1),r.set(t.detail),m(this,Je,rt).call(this,"media-seek-request",t);const f=t==null?void 0:t.originEvent;f!=null&&f.isTrusted&&!(f instanceof MessageEvent)&&!/seek/.test(f.type)&&this.started(t)}c()||(Math.floor(s())!==Math.floor(o())?l.set(!1):this.end(t))}waiting(t){u(this,ho)||u(this,Yt).seeking||(t.stopImmediatePropagation(),A(this,En,t),u(this,hc).call(this))}end(t){const{loop:i,ended:s}=this.$state;if(!(!i()&&s())){if(i()){setTimeout(()=>{requestAnimationFrame(()=>{m(this,Dd,nw).call(this,t),this.dispatch("media-loop-request",{trigger:t})})},10);return}setTimeout(()=>m(this,F0,dD).call(this,t),0)}}"fullscreen-change"(t){const i=t.detail;this.$state.fullscreen.set(i),m(this,Je,rt).call(this,i?"media-enter-fullscreen-request":"media-exit-fullscreen-request",t)}"fullscreen-error"(t){m(this,Je,rt).call(this,"media-enter-fullscreen-request",t),m(this,Je,rt).call(this,"media-exit-fullscreen-request",t)}"orientation-change"(t){const i=t.detail.lock;m(this,Je,rt).call(this,i?"media-orientation-lock-request":"media-orientation-unlock-request",t)}"picture-in-picture-change"(t){const i=t.detail;this.$state.pictureInPicture.set(i),m(this,Je,rt).call(this,i?"media-enter-pip-request":"media-exit-pip-request",t)}"picture-in-picture-error"(t){m(this,Je,rt).call(this,"media-enter-pip-request",t),m(this,Je,rt).call(this,"media-exit-pip-request",t)}"title-change"(t){t.trigger&&(t.stopImmediatePropagation(),this.$state.inferredTitle.set(t.detail))}"poster-change"(t){t.trigger&&(t.stopImmediatePropagation(),this.$state.inferredPoster.set(t.detail))}}Yt=new WeakMap,Pe=new WeakMap,Ge=new WeakMap,co=new WeakMap,oc=new WeakMap,uo=new WeakMap,ho=new WeakMap,En=new WeakMap,xr=new WeakMap,x0=new WeakSet,J6=function(){u(this,xr)&&(requestAnimationFrame(()=>{this.scope&&u(this,Pe).remote.play(new ve("dom-connect"))}),A(this,xr,!1))},L0=new WeakSet,eD=function(){var t;u(this,xr)||(A(this,xr,!this.$state.paused()),(t=u(this,Pe).$provider())==null||t.pause())},ws=new WeakSet,or=function(){m(this,Md,aw).call(this),A(this,co,!1),u(this,Yt).replaying=!1,u(this,Yt).looping=!1,A(this,ho,!1),A(this,En,void 0),u(this,Ge).clear()},Je=new WeakSet,rt=function(t,i){const s=u(this,Yt).queue.serve(t);s&&(i.request=s,i.triggers.add(s))},w0=new WeakSet,tD=function(){m(this,lc,hg).call(this),m(this,wd,ZL).call(this);const t=u(this,Pe).textTracks;new Ve(t).add("add",m(this,lc,hg).bind(this)).add("remove",m(this,lc,hg).bind(this)).add("mode-change",m(this,wd,ZL).bind(this))},C0=new WeakSet,iD=function(){const t=u(this,Pe).qualities;new Ve(t).add("add",m(this,Id,ew).bind(this)).add("remove",m(this,Id,ew).bind(this)).add("change",m(this,R0,rD).bind(this)).add("auto-change",m(this,P0,aD).bind(this)).add("readonly-change",m(this,D0,oD).bind(this))},I0=new WeakSet,sD=function(){const t=u(this,Pe).audioTracks;new Ve(t).add("add",m(this,Cd,JL).bind(this)).add("remove",m(this,Cd,JL).bind(this)).add("change",m(this,k0,nD).bind(this))},lc=new WeakSet,hg=function(t){const{textTracks:i}=this.$state;i.set(u(this,Pe).textTracks.toArray()),this.dispatch("text-tracks-change",{detail:i(),trigger:t})},wd=new WeakSet,ZL=function(t){t&&m(this,Je,rt).call(this,"media-text-track-change-request",t);const i=u(this,Pe).textTracks.selected,{textTrack:s}=this.$state;s()!==i&&(s.set(i),this.dispatch("text-track-change",{detail:i,trigger:t}))},Cd=new WeakSet,JL=function(t){const{audioTracks:i}=this.$state;i.set(u(this,Pe).audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:i(),trigger:t})},k0=new WeakSet,nD=function(t){const{audioTrack:i}=this.$state;i.set(u(this,Pe).audioTracks.selected),t&&m(this,Je,rt).call(this,"media-audio-track-change-request",t),this.dispatch("audio-track-change",{detail:i(),trigger:t})},Id=new WeakSet,ew=function(t){const{qualities:i}=this.$state;i.set(u(this,Pe).qualities.toArray()),this.dispatch("qualities-change",{detail:i(),trigger:t})},R0=new WeakSet,rD=function(t){const{quality:i}=this.$state;i.set(u(this,Pe).qualities.selected),t&&m(this,Je,rt).call(this,"media-quality-change-request",t),this.dispatch("quality-change",{detail:i(),trigger:t})},P0=new WeakSet,aD=function(){const{qualities:t}=u(this,Pe),i=t.auto;this.$state.autoQuality.set(i),i||m(this,uc,dg).call(this)},cc=new WeakMap,kd=new WeakSet,tw=function(){m(this,uc,dg).call(this),A(this,cc,D(()=>{const{qualities:t}=u(this,Pe),{mediaWidth:i,mediaHeight:s}=this.$state,r=i(),a=s();if(r===0||a===0)return;let o=null,l=1/0;for(const c of t){const h=Math.abs(c.width-r)+Math.abs(c.height-a);h<l&&(l=h,o=c)}o&&t[he.select](o,!0,new ve("resize",{detail:{width:r,height:a}}))}))},uc=new WeakSet,dg=function(){var t;(t=u(this,cc))==null||t.call(this),A(this,cc,null)},D0=new WeakSet,oD=function(){this.$state.canSetQuality.set(!u(this,Pe).qualities.readonly)},O0=new WeakSet,lD=function(){const{canSetVolume:t,isGoogleCastConnected:i}=this.$state;if(i()){t.set(!1);return}xV().then(t.set)},M0=new WeakSet,cD=function(t,i,s){let{qualities:r}=u(this,Pe),a=!1,o=!1;for(const l of t){if(!OL(l))continue;if(!i.some(h=>h.src===l.src)){const h=r.getBySrc(l.src);h&&(r[he.remove](h,s),o=!0)}}o&&!r.length&&(this.$state.savedState.set(null),r[he.reset](s));for(const l of i){if(!OL(l)||r.getBySrc(l.src))continue;const c={id:l.id??l.height+"p",bitrate:null,codec:null,...l,selected:!1};r[he.add](c,s),a=!0}a&&!r[Ft.enableAuto]&&(m(this,kd,tw).call(this),r[Ft.enableAuto]=m(this,kd,tw).bind(this),r[Ft.setAuto](!0,s))},Rd=new WeakSet,iw=function(t,i=!1){const{audioTracks:s,qualities:r}=u(this,Pe);if(!i){A(this,oc,[]),A(this,uo,[-1,-1]),s[he.reset](t),r[he.reset](t),j3(this.$state,i),m(this,ws,or).call(this);return}j3(this.$state,i),m(this,ws,or).call(this)},Pd=new WeakSet,sw=function(t){const{seekable:i,buffered:s,intrinsicDuration:r,canPlay:a}=this.$state;a.set(!0),s.set(t.buffered),i.set(t.seekable);const o=Va(t.seekable)??1/0;r.set(o)},Dd=new WeakSet,nw=function(t){if(!Y(u(this,Pe).$provider))return;const{ended:s,seekableStart:r,clipEndTime:a,currentTime:o,realCurrentTime:l,duration:c}=this.$state,h=s()||l()<r()||a()>0&&l()>=a()||Math.abs(o()-c())<.1;return h&&this.dispatch("media-seek-request",{detail:r(),trigger:t}),h},$0=new WeakSet,uD=function(){const{currentTime:t,played:i,paused:s}=this.$state;s()||(A(this,uo,FV(u(this,oc),u(this,uo),t())),i.set(new yt(u(this,oc))))},Od=new WeakSet,rw=function(t){const{clipStartTime:i,clipEndTime:s,duration:r}=this.$state;i()>0||s()>0||this.handle(this.createEvent("time-change",{detail:r(),trigger:t}))},N0=new WeakSet,hD=function(){var r;const{storage:t}=u(this,Pe),{canPlay:i,realCurrentTime:s}=this.$state;i()&&((r=t==null?void 0:t.setTime)==null||r.call(t,s()))},hc=new WeakMap,F0=new WeakSet,dD=function(t){var l;const{storage:i}=u(this,Pe),{paused:s,seeking:r,ended:a,duration:o}=this.$state;m(this,Od,rw).call(this,t),s()||this.dispatch("pause",{trigger:t}),r()&&this.dispatch("seeked",{detail:o(),trigger:t}),a.set(!0),m(this,ws,or).call(this),(l=i==null?void 0:i.setTime)==null||l.call(i,o(),!0),this.dispatch("ended",{trigger:t})},Md=new WeakSet,aw=function(){u(this,hc).cancel(),this.$state.waiting.set(!1)};var B0,fD,U0,pD,VI,xq,V0,mD,H0,gD,q0,yD,G0,vD,K0,TD,j0,bD,W0,ED,Y0,SD,z0,_D,Q0,AD,X0,xD,Z0,LD,J0,wD,ev,CD;class Aq extends yl{constructor(){super(...arguments);p(this,B0);p(this,U0);p(this,VI);p(this,V0);p(this,H0);p(this,q0);p(this,G0);p(this,K0);p(this,j0);p(this,W0);p(this,Y0);p(this,z0);p(this,Q0);p(this,X0);p(this,Z0);p(this,J0);p(this,ev)}onSetup(){m(this,B0,fD).call(this);const t=[m(this,V0,mD),m(this,q0,yD),m(this,Q0,AD),m(this,X0,xD),m(this,K0,TD),m(this,W0,ED),m(this,Y0,SD),m(this,Z0,LD),m(this,ev,CD),m(this,J0,wD),m(this,G0,vD),m(this,z0,_D),m(this,j0,bD),m(this,U0,pD),m(this,H0,gD)];for(const i of t)D(i.bind(this))}}B0=new WeakSet,fD=function(){var s;const t={duration:"providedDuration",loop:"providedLoop",poster:"providedPoster",streamType:"providedStreamType",title:"providedTitle",viewType:"providedViewType"},i=new Set(["currentTime","paused","playbackRate","volume"]);for(const r of Object.keys(this.$props))i.has(r)||(s=this.$state[t[r]??r])==null||s.set(this.$props[r]());this.$state.muted.set(this.$props.muted()||this.$props.volume()===0)}
1,U0=new WeakSet,pD=function(){const{viewType:t,streamType:i,title:s,poster:r,loop:a}=this.$props,o=this.$state;o.providedPoster.set(r()),o.providedStreamType.set(i()),o.providedViewType.set(t()),o.providedTitle.set(s()),o.providedLoop.set(a())},VI=new WeakSet,xq=function(){},V0=new WeakSet,mD=function(){const{artist:t,artwork:i}=this.$props;this.$state.artist.set(t()),this.$state.artwork.set(i())},H0=new WeakSet,gD=function(){const{title:t}=this.$state;this.dispatch("title-change",{detail:t()})},q0=new WeakSet,yD=function(){const t=this.$props.autoPlay()||this.$props.autoplay();this.$state.autoPlay.set(t),this.dispatch("auto-play-change",{detail:t})},G0=new WeakSet,vD=function(){const t=this.$state.loop();this.dispatch("loop-change",{detail:t})},K0=new WeakSet,TD=function(){const t=this.$props.controls();this.$state.controls.set(t)},j0=new WeakSet,bD=function(){const{poster:t}=this.$state;this.dispatch("poster-change",{detail:t()})},W0=new WeakSet,ED=function(){const t=this.$props.crossOrigin()??this.$props.crossorigin(),i=t===!0?"":t;this.$state.crossOrigin.set(i)},Y0=new WeakSet,SD=function(){const{duration:t}=this.$props;this.dispatch("media-duration-change-request",{detail:t()})},z0=new WeakSet,_D=function(){const t=this.$props.playsInline()||this.$props.playsinline();this.$state.playsInline.set(t),this.dispatch("plays-inline-change",{detail:t})},Q0=new WeakSet,AD=function(){const{clipStartTime:t}=this.$props;this.dispatch("media-clip-start-change-request",{detail:t()})},X0=new WeakSet,xD=function(){const{clipEndTime:t}=this.$props;this.dispatch("media-clip-end-change-request",{detail:t()})},Z0=new WeakSet,LD=function(){this.dispatch("live-change",{detail:this.$state.live()})},J0=new WeakSet,wD=function(){this.$state.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()),this.$state.minLiveDVRWindow.set(this.$props.minLiveDVRWindow())},ev=new WeakSet,CD=function(){this.dispatch("live-edge-change",{detail:this.$state.liveEdge()})};const Q3=["play","pause","seekforward","seekbackward","seekto"];var tv,ID,iv,kD,sv,RD,nv,PD;class Lq extends yl{constructor(){super(...arguments);p(this,tv);p(this,iv);p(this,sv);p(this,nv)}onConnect(){D(m(this,iv,kD).bind(this)),D(m(this,sv,RD).bind(this));const t=m(this,nv,PD).bind(this);for(const i of Q3)navigator.mediaSession.setActionHandler(i,t);ge(m(this,tv,ID).bind(this))}}tv=new WeakSet,ID=function(){for(const t of Q3)navigator.mediaSession.setActionHandler(t,null)},iv=new WeakSet,kD=function(){const{title:t,artist:i,artwork:s,poster:r}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:t(),artist:i(),artwork:s()??[{src:r()}]})},sv=new WeakSet,RD=function(){const{canPlay:t,paused:i}=this.$state;navigator.mediaSession.playbackState=t()?i()?"paused":"playing":"none"},nv=new WeakSet,PD=function(t){const i=new ve("media-session-action",{detail:t});switch(t.action){case"play":this.dispatch("media-play-request",{trigger:i});break;case"pause":this.dispatch("media-pause-request",{trigger:i});break;case"seekto":case"seekforward":case"seekbackward":this.dispatch("media-seek-request",{detail:At(t.seekTime)?t.seekTime:this.$state.currentTime()+(t.seekOffset??(t.action==="seekforward"?10:-10)),trigger:i});break}};var Ot,fo,Mt,zt,mi,dc,fg,fc,rv,DD,av,OD,ov,MD,lv,$D,cv,ND,po,ph,$d,ow,uv,FD,Nd,lw,hv,BD,Fd,cw,dv,UD,Bd,uw,fv,VD,Ud,hw,pv,HD,Vd,dw,mv,qD,gv,GD,yv,KD,vv,jD;const qa=class qa extends oe{constructor(){super();p(this,zt);p(this,dc);p(this,rv);p(this,av);p(this,ov);p(this,lv);p(this,cv);p(this,po);p(this,$d);p(this,uv);p(this,Nd);p(this,hv);p(this,Fd);p(this,dv);p(this,Bd);p(this,fv);p(this,Ud);p(this,pv);p(this,Vd);p(this,mv);p(this,gv);p(this,yv);p(this,vv);p(this,Ot,void 0);p(this,fo,void 0);p(this,Mt,void 0);L(this,"canPlayQueue",new H6);L(this,"remoteControl");p(this,fc,!1);L(this,"orientation");new Aq;const t={player:this,qualities:new JH,audioTracks:new zH,storage:null,$provider:ae(null),$providerSetup:ae(!1),$props:this.$props,$state:this.$state};t.remote=this.remoteControl=new jH(void 0),t.remote.setPlayer(this),t.textTracks=new ZH,t.textTracks[de.crossOrigin]=this.$state.crossOrigin,t.textRenderers=new XH(t),t.ariaKeys={},A(this,Ot,t),xi(P2,t),this.orientation=new iy,new ms,new aq(t);const i=new Eq;A(this,fo,new _q(i,t)),A(this,Mt,new vq(u(this,fo),i,t)),t.delegate=new gq(u(this,fo).handle.bind(u(this,fo)),t),t.notify=t.delegate.notify.bind(t.delegate),typeof navigator<"u"&&"mediaSession"in navigator&&new Lq,new Y3("load",this.startLoading.bind(this)),new Y3("posterLoad",this.startLoadingPoster.bind(this))}onSetup(){m(this,lv,$D).call(this),D(m(this,ov,MD).bind(this)),D(m(this,hv,BD).bind(this)),D(m(this,uv,FD).bind(this)),D(m(this,fv,VD).bind(this)),D(m(this,dv,UD).bind(this)),D(m(this,mv,qD).bind(this)),D(m(this,pv,HD).bind(this))}onAttach(t){t.setAttribute("data-media-player",""),Be(t,"tabindex","0"),Be(t,"role","regi
1on"),D(m(this,yv,KD).bind(this)),D(m(this,rv,DD).bind(this)),D(m(this,av,OD).bind(this)),Fe(t,"find-media-player",m(this,cv,ND).bind(this))}onConnect(t){D2&&J(t,"data-iphone","");const i=window.matchMedia("(pointer: coarse)");m(this,$d,ow).call(this,i),i.onchange=m(this,$d,ow).bind(this);const s=new ResizeObserver(Xu(m(this,po,ph).bind(this)));s.observe(t),D(m(this,po,ph).bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),ge(()=>{s.disconnect(),i.onchange=null})}onDestroy(){u(this,Ot).player=null,this.canPlayQueue.reset()}get provider(){return u(this,zt,mi)}get controls(){return u(this,Mt).controls}set controls(t){u(this,dc,fg).controls.set(t)}get title(){return Y(this.$state.title)}set title(t){if(u(this,fc)){A(this,fc,!1);return}u(this,dc,fg).title.set(t)}get qualities(){return u(this,Ot).qualities}get audioTracks(){return u(this,Ot).audioTracks}get textTracks(){return u(this,Ot).textTracks}get textRenderers(){return u(this,Ot).textRenderers}get duration(){return this.$state.duration()}set duration(t){u(this,dc,fg).duration.set(t)}get paused(){return Y(this.$state.paused)}set paused(t){m(this,Nd,lw).call(this,t)}get muted(){return Y(this.$state.muted)}set muted(t){m(this,Fd,cw).call(this,t)}get currentTime(){return Y(this.$state.currentTime)}set currentTime(t){m(this,Bd,uw).call(this,t)}get volume(){return Y(this.$state.volume)}set volume(t){m(this,Ud,hw).call(this,t)}get playbackRate(){return Y(this.$state.playbackRate)}set playbackRate(t){m(this,Vd,dw).call(this,t)}async play(t){return u(this,Mt).play(t)}async pause(t){return u(this,Mt).pause(t)}async enterFullscreen(t,i){return u(this,Mt).enterFullscreen(t,i)}async exitFullscreen(t,i){return u(this,Mt).exitFullscreen(t,i)}enterPictureInPicture(t){return u(this,Mt).enterPictureInPicture(t)}exitPictureInPicture(t){return u(this,Mt).exitPictureInPicture(t)}seekToLiveEdge(t){u(this,Mt).seekToLiveEdge(t)}startLoading(t){u(this,Ot).notify("can-load",void 0,t)}startLoadingPoster(t){u(this,Ot).notify("can-load-poster",void 0,t)}requestAirPlay(t){return u(this,Mt).requestAirPlay(t)}requestGoogleCast(t){return u(this,Mt).requestGoogleCast(t)}setAudioGain(t,i){return u(this,Mt).setAudioGain(t,i)}destroy(){super.destroy(),u(this,Ot).remote.setPlayer(null),this.dispatch("destroy")}};Ot=new WeakMap,fo=new WeakMap,Mt=new WeakMap,zt=new WeakSet,mi=function(){return u(this,Ot).$provider()},dc=new WeakSet,fg=function(){return this.$props},fc=new WeakMap,rv=new WeakSet,DD=function(){const t=this.$el,{title:i,live:s,viewType:r,providedTitle:a}=this.$state,o=s(),l=nV(r()),c=l!=="Unknown"?`${o?"Live ":""}${l}`:o?"Live":"Media",h=i();J(this.el,"aria-label",`${c} Player`+(h?` - ${h}`:"")),t!=null&&t.hasAttribute("title")&&(A(this,fc,!0),t==null||t.removeAttribute("title"))},av=new WeakSet,OD=function(){const t=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(t),J(this.el,"data-orientation",t),m(this,po,ph).call(this)},ov=new WeakSet,MD=function(){this.$state.canPlay()&&u(this,zt,mi)?this.canPlayQueue.start():this.canPlayQueue.stop()},lv=new WeakSet,$D=function(){if(qa[xx]){this.setAttributes(qa[xx]);return}const t={"data-load":function(){return this.$props.load()},"data-captions":function(){const s=this.$state.textTrack();return!!s&&Kt(s)},"data-ios-controls":function(){return this.$state.iOSControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){const{canLoad:s,canPlay:r,waiting:a}=this.$state;return s()&&(!r()||a())},"data-error":function(){const{error:s}=this.$state;return!!s()},"data-autoplay-error":function(){const{autoPlayError:s}=this.$state;return!!s()}},i={autoPlay:"autoplay",canAirPlay:"can-airplay",canPictureInPicture:"can-pip",pictureInPicture:"pip",playsInline:"playsinline",remotePlaybackState:"remote-state",remotePlaybackType:"remote-type",isAirPlayConnected:"airplay",isGoogleCastConnected:"google-cast"};for(const s of pq){const r="data-"+(i[s]??XA(s));t[r]=function(){return this.$state[s]()}}delete t.title,qa[xx]=t,this.setAttributes(t)},cv=new WeakSet,ND=function(t){t.detail(this)},po=new WeakSet,ph=function(){if(!this.el)return;const t=this.el.clientWidth,i=this.el.clientHeight;this.$state.width.set(t),this.$state.height.set(i),di(this.el,"--player-width",t+"px"),di(this.el,"--player-height",i+"px")},$d=new WeakSet,ow=function(t){const i=t.matches?"coarse":"fine";
1J(this.el,"data-pointer",i),this.$state.pointer.set(i),m(this,po,ph).call(this)},uv=new WeakSet,FD=function(){m(this,Nd,lw).call(this,this.$props.paused())},Nd=new WeakSet,lw=function(t){t?this.canPlayQueue.enqueue("paused",()=>u(this,Mt).pause()):this.canPlayQueue.enqueue("paused",()=>u(this,Mt).play())},hv=new WeakSet,BD=function(){m(this,Fd,cw).call(this,this.$props.muted())},Fd=new WeakSet,cw=function(t){this.canPlayQueue.enqueue("muted",()=>{u(this,zt,mi)&&u(this,zt,mi).setMuted(t)})},dv=new WeakSet,UD=function(){m(this,Bd,uw).call(this,this.$props.currentTime())},Bd=new WeakSet,uw=function(t){this.canPlayQueue.enqueue("currentTime",()=>{const{currentTime:i}=this.$state;t!==Y(i)&&Y(()=>{if(!u(this,zt,mi))return;const s=y6(t,this.$state);Number.isFinite(s)&&u(this,zt,mi).setCurrentTime(s)})})},fv=new WeakSet,VD=function(){m(this,Ud,hw).call(this,this.$props.volume())},Ud=new WeakSet,hw=function(t){const i=fk(0,t,1);this.canPlayQueue.enqueue("volume",()=>{u(this,zt,mi)&&u(this,zt,mi).setVolume(i)})},pv=new WeakSet,HD=function(){m(this,Vd,dw).call(this,this.$props.playbackRate())},Vd=new WeakSet,dw=function(t){this.canPlayQueue.enqueue("rate",()=>{var i,s;u(this,zt,mi)&&((s=(i=u(this,zt,mi)).setPlaybackRate)==null||s.call(i,t))})},mv=new WeakSet,qD=function(){m(this,gv,GD).call(this,this.$props.playsInline())},gv=new WeakSet,GD=function(t){this.canPlayQueue.enqueue("playsinline",()=>{var i,s;u(this,zt,mi)&&((s=(i=u(this,zt,mi)).setPlaysInline)==null||s.call(i,t))})},yv=new WeakSet,KD=function(){var s;let t=this.$props.storage(),i=te(t)?new YH:t;if(i!=null&&i.onChange){const{source:r}=this.$state,a=te(t)?t:(s=this.el)==null?void 0:s.id,o=ds(m(this,vv,jD).bind(this));D(()=>i.onChange(r(),o(),a||void 0))}u(this,Ot).storage=i,u(this,Ot).textTracks.setStorage(i),ge(()=>{var r;(r=i==null?void 0:i.onDestroy)==null||r.call(i),u(this,Ot).storage=null,u(this,Ot).textTracks.setStorage(null)})},vv=new WeakSet,jD=function(){const{clipStartTime:t,clipEndTime:i}=this.$props,{source:s}=this.$state,r=s();return r.src?`${r.src}:${t()}:${i()}`:null},L(qa,"props",mq),L(qa,"state",m6);let sy=qa;const Ye=sy.prototype;Se(Ye,"canPlayQueue");Se(Ye,"remoteControl");Se(Ye,"provider");Se(Ye,"controls");Se(Ye,"orientation");Se(Ye,"title");Se(Ye,"qualities");Se(Ye,"audioTracks");Se(Ye,"textTracks");Se(Ye,"textRenderers");Se(Ye,"duration");Se(Ye,"paused");Se(Ye,"muted");Se(Ye,"currentTime");Se(Ye,"volume");Se(Ye,"playbackRate");at(Ye,"play");at(Ye,"pause");at(Ye,"enterFullscreen");at(Ye,"exitFullscreen");at(Ye,"enterPictureInPicture");at(Ye,"exitPictureInPicture");at(Ye,"seekToLiveEdge");at(Ye,"startLoading");at(Ye,"startLoadingPoster");at(Ye,"requestAirPlay");at(Ye,"requestGoogleCast");at(Ye,"setAudioGain");function wq(n,e){return fetch(n,e).then(t=>t.text()).then(t=>/type="static"/.test(t)?"on-demand":"live")}function WD(n,e){return fetch(n,e).then(t=>t.text()).then(t=>{const i=Cq(t);if(i)return WD(/^https?:/.test(i)?i:new URL(i,n).href,e);const s=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(t)?"on-demand":"live";return s==="live"&&Iq(t)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(t)||t.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":s})}function Cq(n){const e=n.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return e?e[0].split(`
2`)[1].trim():null}function Iq(n){const e=n.split(`
3`);for(const t of e)if(t.startsWith("#EXT-X-TARGETDURATION")){const i=parseFloat(t.split(":")[1]);if(!isNaN(i))return i}return-1}const fw=new Map;var pc,mc,Hd,De,Sn,Tv,YD,bv,zD,qd,pw,Gd,mw,Kd,gw,Ev,QD,Sv,XD,_v,ZD;class kq{constructor(e,t,i,s=[]){p(this,Tv);p(this,bv);p(this,qd);p(this,Gd);p(this,Kd);p(this,Ev);p(this,Sv);p(this,_v);p(this,pc,!1);p(this,mc,void 0);p(this,Hd,void 0);p(this,De,void 0);p(this,Sn,void 0);A(this,Hd,e),A(this,De,t),A(this,Sn,i);const r=new GL,a=new qL,o=new pk,l=new hq,c=new fq,h=new dq,d=[c,h];A(this,mc,ds(()=>{const g=t.$state.remotePlaybackLoader(),y=t.$props.preferNativeHLS()?[o,l,r,a,...d,...s]:[a,o,l,r,...d,...s];return g?[g,...y]:y}));const{$state:f}=t;f.sources.set(X3(t.$props.src()));for(const g of f.sources()){const y=u(this,mc).call(this).find(T=>T.canPlay(g));if(!y)continue;const v=y.mediaType(g);t.$state.source.set(g),t.$state.mediaType.set(v),t.$state.inferredViewType.set(v),u(this,Sn).set(y),A(this,pc,!0);break}}connect(){const e=u(this,Sn).call(this);u(this,pc)&&(m(this,Gd,mw).call(this,u(this,De).$state.source(),e),m(this,Kd,gw
3).call(this,e),A(this,pc,!1)),D(m(this,Tv,YD).bind(this)),D(m(this,bv,zD).bind(this)),D(m(this,Ev,QD).bind(this)),D(m(this,Sv,XD).bind(this)),D(m(this,_v,ZD).bind(this))}}pc=new WeakMap,mc=new WeakMap,Hd=new WeakMap,De=new WeakMap,Sn=new WeakMap,Tv=new WeakSet,YD=function(){u(this,De).notify("sources-change",[...X3(u(this,De).$props.src()),...u(this,Hd).call(this)])},bv=new WeakSet,zD=function(){var a;const{$state:e}=u(this,De),t=e.sources(),i=Y(e.source),s=m(this,qd,pw).call(this,i,t);if(((a=t[0])==null?void 0:a.src)&&!s.src&&!s.type){const{crossOrigin:o}=e,l=_h(o()),c=new AbortController;return Promise.all(t.map(h=>te(h.src)&&h.type==="?"?fetch(h.src,{method:"HEAD",credentials:l,signal:c.signal}).then(d=>(h.type=d.headers.get("content-type")||"??",fw.set(h.src,h.type),h)).catch(()=>h):h)).then(h=>{if(c.signal.aborted)return;const d=m(this,qd,pw).call(this,Y(e.source),h);zn(),d.src||u(this,De).notify("error",{message:"Failed to load resource.",code:4})}),()=>c.abort()}zn()},qd=new WeakSet,pw=function(e,t){let i={src:"",type:""},s=null,r=new ve("sources-change",{detail:{sources:t}}),a=u(this,mc).call(this),{started:o,paused:l,currentTime:c,quality:h,savedState:d}=u(this,De).$state;for(const f of t){const g=a.find(y=>y.canPlay(f));
3if(g){i=f,s=g;break}}if(OL(i)){const f=h(),g=t.find(y=>y.src===(f==null?void 0:f.src));Y(o)?d.set({paused:Y(l),currentTime:Y(c)}):d.set(null),g&&(i=g,r=new ve("quality-change",{detail:{quality:f}}))}return J3(e,i)||m(this,Gd,mw).call(this,i,s,r),s!==Y(u(this,Sn))&&m(this,Kd,gw).call(this,s,r),i},Gd=new WeakSet,mw=function(e,t,i){u(this,De).notify("source-change",e,i),u(this,De).notify("media-type-change",(t==null?void 0:t.mediaType(e))||"unknown",i)},Kd=new WeakSet,gw=function(e,t){u(this,De).$providerSetup.set(!1),u(this,De).notify("provider-change",null,t),e&&Y(()=>{var i;return(i=e.preconnect)==null?void 0:i.call(e,u(this,De))}),u(this,Sn).set(e),u(this,De).notify("provider-loader-change",e,t)},Ev=new WeakSet,QD=function(){const e=u(this,De).$provider();if(!(!e||Y(u(this,De).$providerSetup))){if(u(this,De).$state.canLoad()){Gt(()=>e.setup(),e.scope),u(this,De).$providerSetup.set(!0);return}Y(()=>{var t;return(t=e.preconnect)==null?void 0:t.call(e)})}},Sv=new WeakSet,XD=function(){if(!u(this,De).$providerSetup())return;const e=u(this,De).$provider(),t=u(this,De).$state.source(),i=Y(u(this,De).$state.crossOrigin),s=Y(u(this,De).$props.preferNativeHLS);if(!J3(e==null?void 0:e.currentSrc,t)){if(u(this,De).$state.canLoad()){const r=new AbortController;return Zu(t)?(s||!ex())&&WD(t.src,{credentials:_h(i),signal:r.signal}).then(a=>{u(this,De).notify("stream-type-change",a)}).catch(Yg):tk(t)?wq(t.src,{credentials:_h(i),signal:r.signal}).then(a=>{u(this,De).notify("stream-type-change",a)}).catch(Yg):u(this,De).notify("stream-type-change","on-demand"),Y(()=>{const a=Y(u(this,De).$state.preload);return e==null?void 0:e.loadSource(t,a).catch(o=>{})}),()=>r.abort()}try{te(t.src)&&tr(new URL(t.src).origin)}catch{}}},_v=new WeakSet,ZD=function(){const e=u(this,Sn).call(this),{providedPoster:t,source:i,canLoadPoster:s}=u(this,De).$state;if(!e||!e.loadPoster||!i()||!s()||t())return;const r=new AbortController,a=new ve("source-change",{detail:i});return e.loadPoster(i(),u(this,De),r).then(o=>{u(this,De).notify("poster-change",o||"",a)}).catch(()=>{u(this,De).notify("poster-change","",a)}),()=>{r.abort()}};function X3(n){return(Ut(n)?n:[n]).map(e=>te(e)?{src:e,type:Z3(e)}:{...e,type:Z3(e.src,e.type)})}function Z3(n,e){return te(e)&&e.length?e:te(n)&&fw.has(n)?fw.get(n):!e&&Zu({src:n,type:""})?"application/x-mpegurl":!e&&tk({src:n,type:""})?"application/dash+xml":!te(n)||n.startsWith("blob:")?"video/object":n.includes("youtube")||n.includes("youtu.be")?"video/youtube":n.includes("vimeo")&&!n.includes("progressive_redirect")&&!n.includes(".m3u8")?"video/vimeo":"?"}function J3(n,e){return(n==null?void 0:n.src)===(e==null?void 0:e.src)&&(n==null?void 0:n.type)===(e==null?void 0:e.type)}var jd,Lr,Wd,Av,JD;class Rq{constructor(e,t){p(this,Av);p(this,jd,void 0);p(this,Lr,void 0);p(this,Wd,[]);A(this,jd,e),A(this,Lr,t),D(m(this,Av,JD).bind(this))}}jd=new WeakMap,Lr=new WeakMap,Wd=new WeakMap,Av=new WeakSet,JD=function(){const e=u(this,jd).call(this);for(const t of u(this,Wd))if(!e.some(i=>i.id===t.id)){const i=t.id&&u(this,Lr).textTracks.getById(t.id);i&&u(this,Lr).textTracks.remove(i)}for(const t of e){const i=t.id||ga.createId(t);u(this,Lr).textTracks.getById(i)||(t.id=i,u(this,Lr).textTracks.add(t))}A(this,Wd,e)};var Yi,Yd,zd,Qd,gc,yc,xv,eO,Xd,yw,Zd,vw,Jd,Tw;class ny extends oe{constructor(){super(...arguments);p(this,xv);p(this,Xd);p(this,Zd);p(this,Jd);p(this,Yi,void 0);p(this,Yd,void 0);p(this,zd,ae([]));p(this,Qd,ae([]));p(this,gc,null);p(this,yc,-1)}onSetup(){A(this,Yi,Te()),A(this,Yd,new kq(u(this,zd),u(this,Yi),this.$state.loader,this.$props.loaders()))}onAttach(t){t.setAttribute("data-media-provider","")}onConnect(t){u(this,Yd).connect(),new Rq(u(this,Qd),u(this,Yi));const i=new ResizeObserver(Xu(m(this,Zd,vw).bind(this)));i.observe(t);const s=new MutationObserver(m(this,Jd,Tw).bind(this));s.observe(t,{attributes:!0,childList:!0}),m(this,Zd,vw).call(this),m(this,Jd,Tw).call(this),ge(()=>{i.disconnect(),s.disconnect()})}load(t){t==null||t.setAttribute("aria-hidden","true"),window.cancelAnimationFrame(u(this,yc)),A(this,yc,requestAnimationFrame(()=>m(this,xv,eO).call(this,t))),ge(()=>{window.cancelAnimationFrame(u(this,yc))})}onDestroy(){A(this,gc,null),m(this,Xd,yw).call(this)}}Yi=new WeakMap,Yd=new WeakMap,zd=new WeakMap,Qd=new WeakMap,gc=new WeakMap,yc=new WeakMap,xv=new WeakSet,eO=function(t){if(!this.scope)return;const i=this.$state.loader(),{$provider:s}=u(this,Yi);u(this,gc)===i&&(i==null?void 0:i.target)===t&&Y(s)||(m(this,Xd,yw).call(this),A(this,gc,i),i&&(i.target=t||null),!(!i||!t)&&i.load(u(this,Yi)).then(r=>{this.scope&&Y(this.$state.loader)===i&&u(this,Yi).notify("provider-change",r)}))},Xd=new WeakSet,yw=function(){var t;(t=u(this,Yi))==null||t.notify("provider-change",null)},Zd=new WeakSet,vw=function(){if(!this.el)return;const{player:t,$state:i}=u(this,Yi),s=this.el.offsetWidth,r=this.el.offsetHeight;t&&(i.mediaWidth.set(s),i.mediaHeight.set(r),t.el&&(di(t.el,"--media-width",s+"px"),di(t.el,"--media-height",r+"px")))},Jd=new WeakSet,Tw=function(){const t=[],i=[],s=this.el.children;for(const r of s)if(!r.hasAttribute("data-vds")){if(r instanceof HTMLSourceElement){const a={id:r.id,src:r.src,type:r.type};for(const o of["id","src","width","height","bitrate","codec"]){const l=r.getAttribute(`data-${o}`);te(l)&&(a[o]=/id|src|codec/.test(o)?l:Number(l))}t.push(a)}else if(r instanceof HTMLTrackElement){const a={src:r.src,kind:r.track.kind,language:r.srclang,label:r.label,default:r.default,type:r.getAttribute("data-type")};i.push({id:r.id||ga.createId(a),...a}
3)}}u(this,zd).set(t),u(this,Qd).set(i),zn()},L(ny,"props",{loaders:[]}),L(ny,"state",new Ea({loader:null}));const Pq=ny.prototype;at(Pq,"load");var _n,$t,ti,Lv,iO,wv,sO,Cv,nO,Iv,rO;class tO extends le(HTMLElement,ny){constructor(){super(...arguments);p(this,Lv);p(this,wv);p(this,Cv);p(this,Iv);p(this,_n,void 0);p(this,$t,null);p(this,ti,null)}onSetup(){A(this,_n,Te()),this.setAttribute("keep-alive","")}onDestroy(){var t,i;(t=u(this,ti))==null||t.remove(),A(this,ti,null),(i=u(this,$t))==null||i.remove(),A(this,$t,null)}onConnect(){D(()=>{var l,c,h;const t=this.$state.loader(),i=(t==null?void 0:t.name)==="youtube",s=(t==null?void 0:t.name)==="vimeo",r=i||s,a=(t==null?void 0:t.name)==="google-cast",o=t?a?m(this,Iv,rO).call(this):r?m(this,Cv,nO).call(this):t.mediaType()==="audio"?m(this,Lv,iO).call(this):m(this,wv,sO).call(this):null;if(u(this,$t)!==o){const d=((l=u(this,$t))==null?void 0:l.parentElement)??this;(c=u(this,$t))==null||c.remove(),A(this,$t,o),o&&d.prepend(o),r&&o&&D(()=>{var b;const{nativeControls:f,viewType:g}=u(this,_n).$state,y=f(),v=g()==="audio";!y&&!v?(A(this,ti,this.querySelector(".vds-blocker")),u(this,ti)||(A(this,ti,document.createElement("div")),u(this,ti).classList.add("vds-blocker"),o.after(u(this,ti)))):((b=u(this,ti))==null||b.remove(),A(this,ti,null)),J(o,"data-no-controls",!y)})}i?o==null||o.classList.add("vds-youtube"):s&&(o==null||o.classList.add("vds-vimeo")),r||((h=u(this,ti))==null||h.remove(),A(this,ti,null)),this.load(o)})}}_n=new WeakMap,$t=new WeakMap,ti=new WeakMap,Lv=new WeakSet,iO=function(){const t=u(this,$t)instanceof HTMLAudioElement?u(this,$t):document.createElement("audio"),{controls:i,crossOrigin:s}=u(this,_n).$state;return D(()=>{J(t,"controls",i()),J(t,"crossorigin",s())}),t},wv=new WeakSet,sO=function(){const t=u(this,$t)instanceof HTMLVideoElement?u(this,$t):document.createElement("video"),{crossOrigin:i,poster:s,nativeControls:r}=u(this,_n).$state,a=ds(()=>r()?"true":null),o=ds(()=>s()&&r()?s():null);return D(()=>{J(t,"controls",a()),J(t,"crossorigin",i()),J(t,"poster",o())}),t},Cv=new WeakSet,nO=function(){const t=u(this,$t)instanceof HTMLIFrameElement?u(this,$t):document.createElement("iframe"),{nativeControls:i}=u(this,_n).$state;return D(()=>J(t,"tabindex",i()?null:-1)),t},Iv=new WeakSet,rO=function(){var i;if((i=u(this,$t))!=null&&i.classList.contains("vds-google-cast"))return u(this,$t);const t=document.createElement("div");return t.classList.add("vds-google-cast"),se(()=>Promise.resolve().then(()=>qW),void 0,import.meta.url).then(({insertContent:s})=>{s(t,u(this,_n).$state)}),t},L(tO,"tagName","media-provider");class bw extends le(HTMLElement,sy){}L(bw,"tagName","media-player"),L(bw,"attrs",{autoPlay:"autoplay",crossOrigin:"crossorigin",playsInline:"playsinline",preferNativeHLS:"prefer-native-hls",minLiveDVRWindow:"min-live-dvr-window"});re(bw);re(tO);function aO(n,e){return[...n].sort(e?Oq:Dq)}function Dq(n,e){return n.height===e.height?(n.bitrate??0)-(e.bitrate??0):n.height-e.height}function Oq(n,e){return e.height===n.height?(e.bitrate??0)-(n.bitrate??0):e.height-n.height}var mo;class Mq extends Fi{constructor(t){super();p(this,mo,void 0);A(this,mo,t)}onAttach(t){const{$props:i,ariaKeys:s}=Te(),r=t.getAttribute("aria-keyshortcuts");if(r){s[u(this,mo)]=r,ge(()=>{delete s[u(this,mo)]});return}const a=i.keyShortcuts()[u(this,mo)];if(a){const o=Ut(a)?a.join(" "):te(a)?a:a==null?void 0:a.keys;t.setAttribute("aria-keyshortcuts",Ut(o)?o.join(" "):o)}}}mo=new WeakMap;function wx(n,e){const t=String(n),i=t.length;if(i<e){const r=e-i;return`${"0".repeat(r)}${n}`}return t}function oO(n){const e=Math.trunc(n/3600),t=Math.trunc(n%3600/60),i=Math.trunc(n%60),s=Number((n-Math.trunc(n)).toPrecision(3));return{hours:e,minutes:t,seconds:i,fraction:s}}function rx(n,{padHrs:e=null,padMins:t=null,showHrs:i=!1,showMs:s=!1}={}){const{hours:r,minutes:a,seconds:o,fraction:l}=oO(n),c=e?wx(r,2):r,h=t||Ys(t)&&n>=3600?wx(a,2):a,d=wx(o,2),f=s&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",g=`${h}:${d}${f}`;return r>0||i?`${c}:${g}`:g}function ry(n){const e=[],{hours:t,minutes:i,seconds:s}=oO(n);return t>0&&e.push(`${t} hour`),i>0&&e.push(`${i} min`),(s>0||e.length===0)&&e.push(`${s} sec`),e.join(" ")}var zi,kv,cO,go,yo,Cs,vc,pg;class lO extends Fi{constructor(t){super();p(this,kv);p(this,vc);p(this,zi,void 0);p(this,go,-1);p(this,yo,-1);p(this,Cs,null);A(this,zi,t),D(m(this,kv,cO).bind(this))}onDestroy(){var t;(t=u(this,Cs))==null||t.call(this),A(this,Cs,null)}show(t){var i,s,r;m(this,vc,pg).call(this),window.cancelAnimationFrame(u(this,yo)),A(this,yo,-1),(i=u(this,Cs))==null||i.call(this),A(this,Cs,null),A(this,go,window.setTimeout(()=>{A(this,go,-1);const a=u(this,zi).content();a&&a.style.removeProperty("display"),Y(()=>u(this,zi).onChange(!0,t))},((r=(s=u(this,zi)).showDelay)==null?void 0:r.call(s))??0))}hide(t){m(this,vc,pg).call(this),Y(()=>u(this,zi).onChange(!1,t)),A(this,yo,requestAnimationFrame(()=>{var s;m(this,vc,pg).call(this),A(this,yo,-1);const i=u(this,zi).content();if(i){const r=()=>{i.style.display="none",A(this,Cs,null)};if(VH(i)){(s=u(this,Cs))==null||s.call(this);const o=Fe(i,"animationend",r,{once:!0});A(this,Cs,o)}else r()}}))}}zi=new WeakMap,kv=new WeakSet,cO=function(){const t=u(this,zi).trigger();if(!t){this.hide();return}const i=this.show.bind(this),s=this.hide.bind(this);u(this,zi).listen(t,i,s)},go=new WeakMap,yo=new WeakMap,Cs=new WeakMap,vc=new WeakSet,pg=function(){window.clearTimeout(u(this,go)),A(this,go,-1)};var An,Rv,uO,Pv,hO,Dv,dO,Ov,fO;class jt extends Fi{constructor(t){super();p(this,Rv);p(this,Pv);p(this,Dv);p(this,Ov);p(this,An,void 0);A(this,An,t),new ms,t.keyShortcut&&new Mq(t.keyShortcut)}onSetup(){const{disabled:t}=this.$props;this.setAttributes({"data-pressed":u(this,An).isPresssed,"aria-pressed":m(this,Rv,uO).bind(this),"aria-disabled":()=>t()?"true":null})}onAttach(t){Be(t,"tabindex","0"),Be(t,"role","button"),Be(t,"type","button")}onConnect(t){const i=va(t,m(this,Dv,dO).bind(this));for(const s of["click","touchstart"])i.add(s,m(this,Ov,fO).bind(this),{passive:!0})}}An=new WeakMap,Rv=new WeakSet,uO=function(){return zg(u(this,An).isPresssed())},Pv=new WeakSet,hO=function(t){ZU(u(this,An).isPresssed)&&u(this,An).isPresssed.set(i=>!i)},Dv=new WeakSet,dO=function(t){if(this.$props.disabled()||this.el.hasAttribute("data-disabled")){t.preventDefault(),t.stopImmediatePropagation();return}t.preventDefault(),(u(this,An).onPress??m(this,Pv,hO)).call(this,t)},Ov=new WeakSet,fO=function(t){this.$props.disabled()&&(t.preventDefault(),t.stopImmediatePropagation())},L(jt,"props",{disabled:!1});var xn,Mv,mO,$v,gO,Nv,yO,Fv,vO;class pO extends oe{constructor(){super();p(this,Mv);p(this,$v);p(this,Nv);p(this,Fv);p(this,xn,void 0);new jt({isPresssed:m(this,$v,gO).bind(this),onPress:m(this,Mv,mO).bind(this)})}onSetup(){A(this,xn,Te());const{canAirPlay:t,isAirPlayConnected:i}=u(this,xn).$state;this.setAttributes({"data-active":i,"data-supported":t,"data-state":m(this,Nv,yO).bind(this),"aria-hidden":Ht(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),Sa(t,m(this,Fv,vO).bind(this))}}xn=new WeakMap,Mv=new WeakSet,mO=function(t){u(this,xn).remote.requestAirPlay(t)},$v=new WeakSet,gO=function(){const{remotePlaybackType:t,remotePlaybackState:i}=u(this,xn).$state;return t()==="airplay"&&i()!=="disconnected"},Nv=new WeakSet,yO=function(){const{remotePlaybackType:t,remotePlaybackState:i}=u(this,xn).$state;return t()==="airplay"&&i()},Fv=new WeakSet,vO=function(){const{remotePlaybackState:t}=u(this,xn).$state;return`AirPlay ${t()}`},L(pO,"props",jt.props);var vo,Bv,bO,ef,Ew;class TO extends oe{constructor(){super();p(this,Bv);p(this,ef);p(this,vo,void 0);new jt({isPresssed:m(this,ef,Ew).bind(this),keyShortcut:"togglePaused",onPress:m(this,Bv,bO).bind(this)})}onSetup(){A(this,vo,Te());const{paused:t,ended:i}=u(this,vo).$state;this.setAttributes({"data-paused":t,"data-ended":i})}onAttach(t){t.setAttribute("data-media-tooltip","play"),Sa(t,"Play")}}vo=new WeakMap,Bv=new WeakSet,bO=function(t){const i=u(this,vo).remote;m(this,ef,Ew).call(this)?i.pause(t):i.play(t)},ef=new WeakSet,Ew=function(){const{paused:t}=u(this,vo).$state;return!t()},L(TO,"props",jt.props);var To,Uv,SO,tf,Sw,sf,_w;class EO extends oe{constructor(){super();p(this,Uv);p(this,tf);p(this,sf);p(this,To,void 0);new jt({isPresssed:m(this,tf,Sw).bind(this),keyShortcut:"toggleCaptions",onPress:m(this,Uv,SO).bind(this)})}onSetup(){A(this,To,Te()),this.setAttributes({"data-active":m(this,tf,Sw).bind(this),"data-supported":()=>!m(this,sf,_w).call(this),"aria-hidden":Ht(m(this,sf,_w).bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),Sa(t,"Captions")}}To=new WeakMap,Uv=new WeakSet,SO=function(t){u(this,To).remote.toggleCaptions(t)},tf=new WeakSet,Sw=function(){const{textTrack:t}=u(this,To).$state,i=t();return!!i&&Kt(i)},sf=new WeakSet,_w=function(){const{hasCaptions:t}=u(this,To).$state;return!t()},L(EO,"props",jt.props);var wr,Vv,AO,nf,Aw,Hv,xO;class _O extends oe{constructor(){super();p(this,Vv);p(this,nf);p(this,Hv);p(this,wr,void 0);new jt({isPresssed:m(this,nf,Aw).bind(this),keyShortcut:"toggleFullscreen",onPress:m(this,Vv,AO).bind(this)})}onSetup(){A(this,wr,Te());const{fullscreen:t}=u(this,wr).$state,i=m(this,Hv,xO).bind(this);this.setAttributes({"data-active":t,"data-supported":i,"aria-hidden":Ht(()=>!i())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),Sa(t,"Fullscreen")}}wr=new WeakMap,Vv=new WeakSet,AO=function(t){const i=u(this,wr).remote,s=this.$props.target();
3m(this,nf,Aw).call(this)?i.exitFullscreen(s,t):i.enterFullscreen(s,t)},nf=new WeakSet,Aw=function(){const{fullscreen:t}=u(this,wr).$state;return t()},Hv=new WeakSet,xO=function(){const{canFullscreen:t}=u(this,wr).$state;return t()},L(_O,"props",{...jt.props,target:"prefer-media"});var bo,qv,wO,Tc,mg,Gv,CO;class LO extends oe{constructor(){super();p(this,qv);p(this,Tc);p(this,Gv);p(this,bo,void 0);new jt({isPresssed:m(this,Tc,mg).bind(this),keyShortcut:"toggleMuted",onPress:m(this,qv,wO).bind(this)})}onSetup(){A(this,bo,Te()),this.setAttributes({"data-muted":m(this,Tc,mg).bind(this),"data-state":m(this,Gv,CO).bind(this)})}onAttach(t){t.setAttribute("data-media-mute-button",""),t.setAttribute("data-media-tooltip","mute"),Sa(t,"Mute")}}bo=new WeakMap,qv=new WeakSet,wO=function(t){const i=u(this,bo).remote;m(this,Tc,mg).call(this)?i.unmute(t):i.mute(t)},Tc=new WeakSet,mg=function(){const{muted:t,volume:i}=u(this,bo).$state;return t()||i()===0},Gv=new WeakSet,CO=function(){const{muted:t,volume:i}=u(this,bo).$state,s=i();if(t()||s===0)return"muted";if(s>=.5)return"high";if(s<.5)return"low"},L(LO,"props",jt.props);var Cr,Kv,kO,rf,xw,jv,RO;class IO extends oe{constructor(){super();p(this,Kv);p(this,rf);p(this,jv);p(this,Cr,void 0);new jt({isPresssed:m(this,rf,xw).bind(this),keyShortcut:"togglePictureInPicture",onPress:m(this,Kv,kO).bind(this)})}onSetup(){A(this,Cr,Te());const{pictureInPicture:t}=u(this,Cr).$state,i=m(this,jv,RO).bind(this);this.setAttributes({"data-active":t,"data-supported":i,"aria-hidden":Ht(()=>!i())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),Sa(t,"PiP")}}Cr=new WeakMap,Kv=new WeakSet,kO=function(t){const i=u(this,Cr).remote;m(this,rf,xw).call(this)?i.exitPictureInPicture(t):i.enterPictureInPicture(t)},rf=new WeakSet,xw=function(){const{pictureInPicture:t}=u(this,Cr).$state;return t()},jv=new WeakSet,RO=function(){const{canPictureInPicture:t}=u(this,Cr).$state;return t()},L(IO,"props",jt.props);var Ir,Wv,DO,Yv,OO,zv,MO;class PO extends oe{constructor(){super();p(this,Wv);p(this,Yv);p(this,zv);p(this,Ir,void 0);new ms}onSetup(){A(this,Ir,Te());const{seeking:t}=u(this,Ir).$state,{seconds:i}=this.$props,s=m(this,Wv,DO).bind(this);this.setAttributes({seconds:i,"data-seeking":t,"data-supported":s,"aria-hidden":Ht(()=>!s())})}onAttach(t){Be(t,"tabindex","0"),Be(t,"role","button"),Be(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),Sa(t,m(this,Yv,OO).bind(this))}onConnect(t){va(t,m(this,zv,MO).bind(this))}}Ir=new WeakMap,Wv=new WeakSet,DO=function(){const{canSeek:t}=u(this,Ir).$state;return t()},Yv=new WeakSet,OO=function(){const{seconds:t}=this.$props;return`Seek ${t()>0?"forward":"backward"} ${t()} seconds`},zv=new WeakSet,MO=function(t){const{seconds:i,disabled:s}=this.$props;if(s())return;const{currentTime:r}=u(this,Ir).$state,a=r()+i();u(this,Ir).remote.seek(a,t)},L(PO,"props",{disabled:!1,seconds:30});var Eo,Qv,NO;class $O extends oe{constructor(){super();p(this,Qv);p(this,Eo,void 0);new ms}onSetup(){A(this,Eo,Te());const{disabled:t}=this.$props,{live:i,liveEdge:s}=u(this,Eo).$state,r=()=>!i();this.setAttributes({"data-edge":s,"data-hidden":r,"aria-disabled":Ht(()=>t()||s()),"aria-hidden":Ht(r)})}onAttach(t){Be(t,"tabindex","0"),Be(t,"role","button"),Be(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){va(t,m(this,Qv,NO).bind(this))}}Eo=new WeakMap,Qv=new WeakSet,NO=function(t){const{disabled:i}=this.$props,{liveEdge:s}=u(this,Eo).$state;i()||s()||u(this,Eo).remote.seekToLiveEdge(t)},L($O,"props",{disabled:!1});const vl=new Ea({min:0,max:100,value:0,step:1,pointerValue:0,focused:!1,dragging:!1,pointing:!1,hidden:!1,get active(){return this.dragging||this.focused||this.pointing},get fillRate(){return eR(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return eR(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function eR(n,e,t){const i=e-n,s=t-n;return i>0?s/i:0}var bc,kr,Xv,BO;class FO extends Fi{constructor(t){super();p(this,Xv);p(this,bc,void 0);p(this,kr,void 0);A(this,bc,t)}onConnect(t){A(this,kr,new IntersectionObserver(i=>{var s,r;(r=(s=u(this,bc)).callback)==null||r.call(s,i,u(this,kr))},u(this,bc))),u(this,kr).observe(t),ge(m(this,Xv,BO).bind(this))}}bc=new WeakMap,kr=new WeakMap,Xv=new WeakSet,BO=function(){var t;(t=u(this,kr))==null||t.disconnect(),A(this,kr,void 0)};const mk=ba(),xh=ba();function $q(n,e,t,i){return fk(n,xt(t,IL(i)),e)}function Nq(n,e,t,i){const s=fk(0,t,1),r=e-n,a=r*s,o=a/i,l=i*Math.round(o);return n+l}const Cx={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};var Nt,Rr,Ec,Zv,UO,Pr,Qi,Ln,Jv,VO,eT,HO,tT,qO,iT,GO,sT,KO,Sc,gg,Is,lr,So,mh,nT,jO,rT,WO,aT,YO,oT,zO,_c,yg,af,Lw,Ac,wn,lT,QO,cT,XO,of,ww,lf,Cw,uT,ZO,hT,JO,dT;class Fq extends Fi{constructor(t,i){super();p(this,Zv);p(this,Jv);p(this,eT);p(this,tT);p(this,iT);p(this,sT);p(this,Sc);p(this,Is);p(this,So);p(this,nT);p(this,rT);p(this,aT);p(this,oT);p(this,_c);p(this,af);p(this,lT);p(this,cT);p(this,of);p(this,lf);p(this,uT);p(this,hT);p(this,Nt,void 0);p(this,Rr,void 0);p(this,Ec,void 0);p(this,Pr,null);p(this,Qi,null);p(this,Ln,null);p(this,Ac,void 0);p(this,wn,!1);p(this,dT,gl(t=>{m(this,Is,lr).call(this,m(this,So,mh).call(this,t),t)},20,{leading:!0}));A(this,Nt,t),A(this,Rr,i)}onSetup(){Li(xh)&&A(this,Ec,tt(xh))}onConnect(t){D(m(this,tT,qO).bind(this,t)),D(m(this,iT,GO).bind(this,t)),u(this,Nt).swipeGesture&&D(m(this,Zv,UO).bind(this))}}Nt=new WeakMap,Rr=new WeakMap,Ec=new WeakMap,Zv=new WeakSet,UO=function(){var i;const{pointer:t}=u(this,Rr).$state;if(t()!=="coarse"||!u(this,Nt).swipeGesture()){A(this,Pr,null);return}A(this,Pr,(i=u(this,Rr).player.el)==null?void 0:i.querySelector("media-provider,[data-media-provider]")),u(this,Pr)&&new Ve(u(this,Pr)).add("touchstart",m(this,Jv,VO).bind(this),{passive:!0}).add("touchmove",m(this,eT,HO).bind(this),{passive:!1})},Pr=new WeakMap,Qi=new WeakMap,Ln=new WeakMap,Jv=new WeakSet,VO=function(t){A(this,Qi,t.touches[0])},eT=new WeakSet,HO=function(t){if(Ys(u(this,Qi))||ck(t))return;const i=t.touches[0],s=i.clientX-u(this,Qi).clientX,r=i.clientY-u(this,Qi).clientY,a=this.$state.dragging();!a&&Math.abs(r)>5||a||(t.preventDefault(),Math.abs(s)>20&&(A(this,Qi,i),A(this,Ln,this.$state.value()),m(this,_c,yg).call(this,u(this,Ln),t)))}
3,tT=new WeakSet,qO=function(t){const{hidden:i}=this.$props;Fe(t,"focus",m(this,sT,KO).bind(this)),!(i()||u(this,Nt).isDisabled())&&new Ve(t).add("keyup",m(this,cT,XO).bind(this)).add("keydown",m(this,lT,QO).bind(this)).add("pointerenter",m(this,nT,jO).bind(this)).add("pointermove",m(this,rT,WO).bind(this)).add("pointerleave",m(this,aT,YO).bind(this)).add("pointerdown",m(this,oT,zO).bind(this))},iT=new WeakSet,GO=function(t){u(this,Nt).isDisabled()||!this.$state.dragging()||new Ve(document).add("pointerup",m(this,uT,ZO).bind(this),{capture:!0}).add("pointermove",u(this,dT).bind(this)).add("touchmove",m(this,hT,JO).bind(this),{passive:!1})},sT=new WeakSet,KO=function(){m(this,Is,lr).call(this,this.$state.value())},Sc=new WeakSet,gg=function(t,i){var h,d,f,g;const{value:s,min:r,max:a,dragging:o}=this.$state,l=Math.max(r(),Math.min(t,a()));s.set(l);const c=this.createEvent("value-change",{detail:l,trigger:i});if(this.dispatch(c),(d=(h=u(this,Nt)).onValueChange)==null||d.call(h,c),o()){const y=this.createEvent("drag-value-change",{detail:l,trigger:i});this.dispatch(y),(g=(f=u(this,Nt)).onDragValueChange)==null||g.call(f,y)}},Is=new WeakSet,lr=function(t,i){const{pointerValue:s,dragging:r}=this.$state;s.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:i}),r()&&m(this,Sc,gg).call(this,t,i)},So=new WeakSet,mh=function(t){let i,s=this.el.getBoundingClientRect(),{min:r,max:a}=this.$state;if(this.$props.orientation()==="vertical"){const{bottom:o,height:l}=s;i=(o-t.clientY)/l}else if(u(this,Qi)&&At(u(this,Ln))){const{width:o}=u(this,Pr).getBoundingClientRect(),l=(t.clientX-u(this,Qi).clientX)/o,c=a()-r(),h=c*Math.abs(l);i=(l<0?u(this,Ln)-h:u(this,Ln)+h)/c}else{const{left:o,width:l}=s;i=(t.clientX-o)/l}return Math.max(r(),Math.min(a(),u(this,Nt).roundValue(Nq(r(),a(),i,u(this,Nt).getStep()))))},nT=new WeakSet,jO=function(t){this.$state.pointing.set(!0)},rT=new WeakSet,WO=function(t){const{dragging:i}=this.$state;i()||m(this,Is,lr).call(this,m(this,So,mh).call(this,t),t)},aT=new WeakSet,YO=function(t){this.$state.pointing.set(!1)},oT=new WeakSet,zO=function(t){if(t.button!==0)return;const i=m(this,So,mh).call(this,t);m(this,_c,yg).call(this,i,t),m(this,Is,lr).call(this,i,t)},_c=new WeakSet,yg=function(t,i){var a,o,l,c;const{dragging:s}=this.$state;if(s())return;s.set(!0),u(this,Rr).remote.pauseControls(i);const r=this.createEvent("drag-start",{detail:t,trigger:i});this.dispatch(r),(o=(a=u(this,Nt)).onDragStart)==null||o.call(a,r),(c=(l=u(this,Ec))==null?void 0:l.onDragStart)==null||c.call(l)},af=new WeakSet,Lw=function(t,i){var a,o,l,c;const{dragging:s}=this.$state;if(!s())return;s.set(!1),u(this,Rr).remote.resumeControls(i);const r=this.createEvent("drag-end",{detail:t,trigger:i});this.dispatch(r),(o=(a=u(this,Nt)).onDragEnd)==null||o.call(a,r),A(this,Qi,null),A(this,Ln,null),(c=(l=u(this,Ec))==null?void 0:l.onDragEnd)==null||c.call(l)},Ac=new WeakMap,wn=new WeakMap,lT=new WeakSet,QO=function(t){if(!Object.keys(Cx).includes(t.key))return;const{key:s}=t,r=m(this,of,ww).call(this,t);if(!Ys(r)){m(this,Is,lr).call(this,r,t),m(this,Sc,gg).call(this,r,t);return}const a=m(this,lf,Cw).call(this,t);u(this,wn)||(A(this,wn,s===u(this,Ac)),!this.$state.dragging()&&u(this,wn)&&m(this,_c,yg).call(this,a,t)),m(this,Is,lr).call(this,a,t),A(this,Ac,s)},cT=new WeakSet,XO=function(t){if(!Object.keys(Cx).includes(t.key)||!Ys(m(this,of,ww).call(this,t)))return;const s=u(this,wn)?this.$state.pointerValue():m(this,lf,Cw).call(this,t);m(this,Sc,gg).call(this,s,t),m(this,af,Lw).call(this,s,t),A(this,Ac,""),A(this,wn,!1)},of=new WeakSet,ww=function(t){let i=t.key,{min:s,max:r}=this.$state;return i==="Home"||i==="PageUp"?s():i==="End"||i==="PageDown"?r():!t.metaKey&&/^[0-9]$/.test(i)?(r()-s())/10*Number(i):null},lf=new WeakSet,Cw=function(t){var b,E;const{key:i,shiftKey:s}=t;t.preventDefault(),t.stopPropagation();const{shiftKeyMultiplier:r}=this.$props,{min:a,max:o,value:l,pointerValue:c}=this.$state,h=u(this,Nt).getStep(),d=u(this,Nt).getKeyStep(),f=s?d*r():d,g=Number(Cx[i]),y=f*g,v=u(this,wn)?c():((E=(b=u(this,Nt)).getValue)==null?void 0:E.call(b))??l(),T=(v+y)/h;return Math.max(a(),Math.min(o(),Number((h*T).toFixed(3))))},uT=new WeakSet,ZO=function(t){if(t.button!==0)return;t.preventDefault(),t.stopImmediatePropagation();const i=m(this,So,mh).call(this,t);m(this,Is,lr).call(this,i,t),m(this,af,Lw).call(this,i,t)},hT=new WeakSet,JO=function(t){t.preventDefault()},dT=new WeakMap;const Hu=ba(()=>({}));var cf,ii,uf,hf,fT,eM,pT,tM,mT,iM,gT,sM,yT,nM,vT,rM,TT,aM,bT,oM,ET;class wi extends Fi{constructor(t){super();p(this,fT);p(this,pT);p(this,mT);p(this,gT);p(this,yT);p(this,vT);p(this,TT);p(this,bT);p(this,cf,void 0);p(this,ii,void 0);p(this,uf,ae(!0));p(this,hf,ae(!0));p(this,ET,Xu((t,i)=>{var s,r;(s=this.el)==null||s.style.setProperty("--slider-fill",t+"%"),(r=this.el)==null||r.style.setProperty("--slider-pointer",i+"%")}));A(this,ii,t)}
3onSetup(){A(this,cf,Te());const t=new ms;t.attach(this),this.$state.focused=t.focused.bind(t),Li(Hu)||xi(Hu,{default:"value"}),xi(mk,{orientation:this.$props.orientation,disabled:u(this,ii).isDisabled,preview:ae(null)}),D(m(this,mT,iM).bind(this)),D(m(this,gT,sM).bind(this)),D(m(this,yT,nM).bind(this)),m(this,TT,aM).call(this),new Fq(u(this,ii),u(this,cf)).attach(this),new FO({callback:m(this,fT,eM).bind(this)}).attach(this)}onAttach(t){Be(t,"role","slider"),Be(t,"tabindex","0"),Be(t,"autocomplete","off"),D(m(this,bT,oM).bind(this))}onConnect(t){ge(s6(t,u(this,uf).set)),D(m(this,pT,tM).bind(this))}}cf=new WeakMap,ii=new WeakMap,uf=new WeakMap,hf=new WeakMap,fT=new WeakSet,eM=function(t){u(this,hf).set(t[0].isIntersecting)},pT=new WeakSet,tM=function(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!u(this,uf).call(this)||!u(this,hf).bind(this))},mT=new WeakSet,iM=function(){const{dragging:t,value:i,min:s,max:r}=this.$state;Y(t)||i.set($q(s(),r(),i(),u(this,ii).getStep()))},gT=new WeakSet,sM=function(){this.$state.step.set(u(this,ii).getStep())},yT=new WeakSet,nM=function(){if(!u(this,ii).isDisabled())return;const{dragging:t,pointing:i}=this.$state;t.set(!1),i.set(!1)},vT=new WeakSet,rM=function(){return zg(u(this,ii).isDisabled())},TT=new WeakSet,aM=function(){const{orientation:t}=this.$props,{dragging:i,active:s,pointing:r}=this.$state;this.setAttributes({"data-dragging":i,"data-pointing":r,"data-active":s,"aria-disabled":m(this,vT,rM).bind(this),"aria-valuemin":u(this,ii).aria.valueMin??this.$state.min,"aria-valuemax":u(this,ii).aria.valueMax??this.$state.max,"aria-valuenow":u(this,ii).aria.valueNow,"aria-valuetext":u(this,ii).aria.valueText,"aria-orientation":t})},bT=new WeakSet,oM=function(){const{fillPercent:t,pointerPercent:i}=this.$state;u(this,ET).call(this,xt(t(),3),xt(i(),3))},ET=new WeakMap,L(wi,"props",{hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5});var ST,lM,_T,cM,AT,uM,xT,hM;class ul extends oe{constructor(){super();p(this,ST);p(this,_T);p(this,AT);p(this,xT);new wi({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.$props.disabled,aria:{valueNow:m(this,ST,lM).bind(this),valueText:m(this,_T,cM).bind(this)}})}onSetup(){D(m(this,AT,uM).bind(this)),D(m(this,xT,hM).bind(this))}}ST=new WeakSet,lM=function(){const{value:t}=this.$state;return Math.round(t())},_T=new WeakSet,cM=function(){const{value:t,max:i}=this.$state;return xt(t()/i()*100,2)+"%"},AT=new WeakSet,uM=function(){const{value:t}=this.$props;this.$state.value.set(t())},xT=new WeakSet,hM=function(){const{min:t,max:i}=this.$props;this.$state.min.set(t()),this.$state.max.set(i())},L(ul,"props",{...wi.props,min:0,max:100,value:0}),L(ul,"state",vl);const nn=new Map,Nm=new Map;var df,xc,ff,LT,dM,wT,fM,pf,kw,mf,Rw,gf,Pw,yf,Dw,CT,pM,Lc,vg;const E3=class E3{constructor(e,t,i){p(this,LT);p(this,wT);p(this,pf);p(this,mf);p(this,gf);p(this,yf);p(this,CT);p(this,Lc);p(this,df,void 0);p(this,xc,void 0);p(this,ff,void 0);L(this,"$images",ae([]));A(this,xc,e),A(this,ff,t),A(this,df,i),D(m(this,LT,dM).bind(this))}static create(e,t){const i=Te();return new E3(e,t,i)}};df=new WeakMap,xc=new WeakMap,ff=new WeakMap,LT=new WeakSet,dM=function(){var i;const{canLoad:e}=u(this,df).$state;if(!e())return;const t=u(this,xc).call(this);if(t){if(te(t)&&nn.has(t)){const s=nn.get(t);if(nn.delete(t),nn.set(t,s),nn.size>99){const r=nn.keys().next().value;nn.delete(r)}this.$images.set(nn.get(t))}else if(te(t)){const s=u(this,ff).call(this),r=t+"::"+s;if(!Nm.has(r)){const a=new Promise(async(o,l)=>{try{const c=await fetch(t,{credentials:_h(s)});if(c.headers.get("content-type")==="application/json"){const d=await c.json();if(Ut(d))if(d[0]&&"text"in d[0])o(m(this,mf,Rw).call(this,d));else{for(let f=0;f<d.length;f++){const g=d[f];sn(T2(g),!1),sn("url"in g&&te(g.url),!1),sn("startTime"in g&&At(g.startTime),!1)}o(d)}else o(m(this,pf,kw).call(this,d));return}se(()=>Promise.resolve().then(()=>hy),void 0,import.meta.url).then(async({parseResponse:d})=>{try{const{cues:f}=await d(c);o(m(this,mf,Rw).call(this,f))}catch(f){l(f)}})}catch(c){l(c)}}).then(o=>(nn.set(r,o),o)).catch(o=>{m(this,Lc,vg).call(this,t,o)}).finally(()=>{te(r)&&Nm.delete(r)});Nm.set(r,a)}(i=Nm.get(r))==null||i.then(a=>{this.$images.set(a||[])})}else if(Ut(t))try{this.$images.set(m(this,wT,fM).call(this,t))}catch(s){m(this,Lc,vg).call(this,t,s)}else try{this.$images.set(m(this,pf,kw).call(this,t))}catch(s){m(this,Lc,vg).call(this,t,s)}return()=>{this.$images.set([])}}},wT=new WeakSet,fM=function(e){const t=m(this,gf,Pw).call(this);return e.map((i,s)=>(sn(i.url&&te(i.url)),sn("startTime"in i&&At(i.startTime)),{...i,url:te(i.url)?m(this,yf,Dw).call(this,i.url,t):i.url}))},pf=new WeakSet,kw=function(e){var a;sn(te(e.url)),sn(Ut(e.tiles)&&((a=e.tiles)==null?void 0:a.length));const t=new URL(e.url),i=[],s="tile_width"in e?e.tile_width:e.tileWidth,r="tile_height"in e?e.tile_height:e.tileHeight;for(const o of e.tiles)i.push({url:t,startTime:"start"in o?o.start:o.startTime,width:s,height:r,coords:{x:o.x,y:o.y}});return i},mf=new WeakSet,Rw=function(e){for(let s=0;s<e.length;s++){const r=e[s];sn("startTime"in r&&At(r.startTime)),sn("text"in r&&te(r.text))}const t=[],i=m(this,gf,Pw).call(this);for(const s of e){const[r,a]=s.text.split("#"),o=m(this,CT,pM).call(this,a);t.push({url:m(this,yf,Dw).call(this,r,i),startTime:s.startTime,endTime:s.endTime,width:o==null?void 0:o.w,height:o==null?void 0:o.h,coords:o&&At(o.x)&&At(o.y)?{x:o.x,y:o.y}:void 0})}return t},gf=new WeakSet,Pw=function(){let e=Y(u(this,xc));return!te(e)||!/^https?:/.test(e)?location.href:e},yf=new WeakSet,Dw=function(e,t){return/^https?:/.test(e)?new URL(e):new URL(e,t)},CT=new WeakSet,pM=function(e){if(!e)return{};const[t,i]=e.split("="),s=i==null?void 0:i.split(","),r={};if(!t||!s)return null;for(let a=0;a<t.length;a++){const o=+s[a];isNaN(o)||(r[t[a]]=o)}return r},Lc=new WeakSet,vg=function(e,t){};let Iw=E3;var wc,Cc,IT,mM,vf,Mw,kT,gM,RT,yM,PT,vM,DT,TM,Tf,$w,OT,bM,MT,EM,bf,Nw,ks,cr,$T,SM;class Ow extends oe{constructor(){super(...arguments);p(this,IT);p(this,vf);p(this,kT);p(this,RT);p(this,PT);p(this,DT);p(this,Tf);p(this,OT);p(this,MT);p(this,bf);p(this,ks);p(this,$T);L(this,"media");p(this,wc,void 0);p(this,Cc,[])}
3onSetup(){this.media=Te(),A(this,wc,Iw.create(this.$props.src,this.$state.crossOrigin)),m(this,vf,Mw).call(this),this.setAttributes({"data-loading":m(this,DT,TM).bind(this),"data-error":m(this,Tf,$w).bind(this),"data-hidden":this.$state.hidden,"aria-hidden":Ht(this.$state.hidden)})}onConnect(t){D(m(this,IT,mM).bind(this)),D(m(this,OT,bM).bind(this)),D(m(this,vf,Mw).bind(this)),D(m(this,kT,gM).bind(this)),D(m(this,MT,EM).bind(this)),D(m(this,bf,Nw).bind(this))}getTime(){return this.$props.time()}}wc=new WeakMap,Cc=new WeakMap,IT=new WeakSet,mM=function(){const t=this.$state.img();t&&new Ve(t).add("load",m(this,RT,yM).bind(this)).add("error",m(this,PT,vM).bind(this))},vf=new WeakSet,Mw=function(){const{crossOrigin:t}=this.$props,{crossOrigin:i}=this.$state,{crossOrigin:s}=this.media.$state,r=t()!==null?t():s();i.set(r===!0?"anonymous":r)},kT=new WeakSet,gM=function(){const{src:t,loading:i,error:s}=this.$state;return t()&&(i.set(!0),s.set(null)),()=>{m(this,$T,SM).call(this),i.set(!1),s.set(null)}},RT=new WeakSet,yM=function(){const{loading:t,error:i}=this.$state;m(this,bf,Nw).call(this),t.set(!1),i.set(null)},PT=new WeakSet,vM=function(t){const{loading:i,error:s}=this.$state;i.set(!1),s.set(t)},DT=new WeakSet,TM=function(){const{loading:t,hidden:i}=this.$state;return!i()&&t()},Tf=new WeakSet,$w=function(){const{error:t}=this.$state;return!Ys(t())},OT=new WeakSet,bM=function(){const{hidden:t}=this.$state,{duration:i}=this.media.$state,s=u(this,wc).$images();t.set(m(this,Tf,$w).call(this)||!Number.isFinite(i())||s.length===0)},MT=new WeakSet,EM=function(){let t=u(this,wc).$images();if(!t.length)return;let i=this.getTime(),{src:s,activeThumbnail:r}=this.$state,a=-1,o=null;for(let l=t.length-1;l>=0;l--){const c=t[l];if(i>=c.startTime&&(!c.endTime||i<c.endTime)){a=l;break}}t[a]&&(o=t[a]),r.set(o),s.set((o==null?void 0:o.url.href)||"")},bf=new WeakSet,Nw=function(){if(!this.scope||this.$state.hidden())return;const t=this.el,i=this.$state.img(),s=this.$state.activeThumbnail();if(!i||!s||!t)return;let r=s.width??i.naturalWidth,a=(s==null?void 0:s.height)??i.naturalHeight,{maxWidth:o,maxHeight:l,minWidth:c,minHeight:h,width:d,height:f}=getComputedStyle(this.el);c==="100%"&&(c=parseFloat(d)+""),h==="100%"&&(h=parseFloat(f)+"");let g=Math.max(parseInt(c)/r,parseInt(h)/a),y=Math.min(Math.max(parseInt(c),parseInt(o))/r,Math.max(parseInt(h),parseInt(l))/a),v=!isNaN(y)&&y<1?y:g>1?g:1;m(this,ks,cr).call(this,t,"--thumbnail-width",`${r*v}px`),m(this,ks,cr).call(this,t,"--thumbnail-height",`${a*v}px`),m(this,ks,cr).call(this,t,"--thumbnail-aspect-ratio",String(xt(r/a,5))),m(this,ks,cr).call(this,i,"width",`${i.naturalWidth*v}px`),m(this,ks,cr).call(this,i,"height",`${i.naturalHeight*v}px`),m(this,ks,cr).call(this,i,"transform",s.coords?`translate(-${s.coords.x*v}px, -${s.coords.y*v}px)`:""),m(this,ks,cr).call(this,i,"max-width","none")},ks=new WeakSet,cr=function(t,i,s){t.style.setProperty(i,s),u(this,Cc).push(()=>t.style.removeProperty(i))},$T=new WeakSet,SM=function(){for(const t of u(this,Cc))t();A(this,Cc,[])},L(Ow,"props",{src:null,time:0,crossOrigin:null}),L(Ow,"state",new Ea({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1}));var Dr,NT,Ef;class gk extends oe{constructor(){super(...arguments);p(this,Dr,void 0);p(this,NT,void 0);p(this,Ef,void 0)}onSetup(){A(this,Ef,Qu(ul.state)),A(this,Dr,tt(Hu)),A(this,NT,ds(this.getValueText.bind(this)))}getValueText(){var v,T;const{type:t,format:i,decimalPlaces:s,padHours:r,padMinutes:a,showHours:o,showMs:l}=this.$props,{value:c,pointerValue:h,min:d,max:f}=u(this,Ef),g=(i==null?void 0:i())??u(this,Dr).default,y=t()==="current"?c():h();if(g==="percent"){const b=f()-d(),E=y/b*100;return(u(this,Dr).percent??xt)(E,s())+"%"}else return g==="time"?(u(this,Dr).time??rx)(y,{padHrs:r(),padMins:a(),showHrs:o(),showMs:l()}):(((T=(v=u(this,Dr)).value)==null?void 0:T.call(v,y))??y.toFixed(2))+""}}Dr=new WeakMap,NT=new WeakMap,Ef=new WeakMap,L(gk,"props",{type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2});const Bq=gk.prototype;at(Bq,"getValueText");var Ic,Sf;class _M extends oe{constructor(){super(...arguments);p(this,Ic,void 0);p(this,Sf,Xu(()=>{const{disabled:t,orientation:i}=u(this,Ic);if(t())return;const s=this.el,{offset:r,noClamp:a}=this.$props;s&&Uq(s,{clamp:!a(),offset:r(),orientation:i()})}))}onSetup(){A(this,Ic,tt(mk));const{active:t}=Qu(ul.state);this.setAttributes({"data-visible":t})}onAttach(t){Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){const{preview:i}=u(this,Ic);i.set(t),ge(()=>i.set(null)),D(u(this,Sf).bind(this));const s=new ResizeObserver(u(this,Sf).bind(this));s.observe(t),ge(()=>s.disconnect())}}Ic=new WeakMap,Sf=new WeakMap,L(_M,"props",{offset:0,noClamp:!1});function Uq(n,{clamp:e,offset:t,orientation:i}){const s=getComputedStyle(n),r=parseFloat(s.width),a=parseFloat(s.height),o={top:null,right:null,bottom:null,left:null};if(o[i==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${t}px))`,i==="horizontal"){const l=r/2;if(!e)o.left=`calc(var(--slider-pointer) - ${l}
3px)`;else{const c=`max(0px, calc(var(--slider-pointer) - ${l}px))`,h=`calc(100% - ${r}px)`;o.left=`min(${c}, ${h})`}}else{const l=a/2;if(!e)o.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{const c=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,h=`calc(100% - ${a}px)`;o.bottom=`min(${c}, ${h})`}}Object.assign(n.style,o)}var Ri,FT,AM,BT,xM,UT,LM,VT,wM,HT,CM,_f,qT,IM,GT,kM,KT,RM;class Fw extends oe{constructor(){super(...arguments);p(this,FT);p(this,BT);p(this,UT);p(this,VT);p(this,HT);p(this,qT);p(this,GT);p(this,KT);p(this,Ri,void 0);p(this,_f,gl(m(this,qT,IM).bind(this),25))}onSetup(){A(this,Ri,Te());const{audioGain:t}=u(this,Ri).$state;xi(Hu,{default:"percent",value(i){return(i*(t()??1)).toFixed(2)},percent(i){return Math.round(i*(t()??1))}}),new wi({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:m(this,VT,wM).bind(this),aria:{valueMax:m(this,UT,LM).bind(this),valueNow:m(this,FT,AM).bind(this),valueText:m(this,BT,xM).bind(this)},onDragValueChange:m(this,KT,RM).bind(this),onValueChange:m(this,GT,kM).bind(this)}).attach(this),D(m(this,HT,CM).bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),Be(t,"aria-label","Volume");const{canSetVolume:i}=u(this,Ri).$state;this.setAttributes({"data-supported":i,"aria-hidden":Ht(()=>!i())})}}Ri=new WeakMap,FT=new WeakSet,AM=function(){const{value:t}=this.$state,{audioGain:i}=u(this,Ri).$state;return Math.round(t()*(i()??1))},BT=new WeakSet,xM=function(){const{value:t,max:i}=this.$state,{audioGain:s}=u(this,Ri).$state;return xt(t()/i()*(s()??1)*100,2)+"%"},UT=new WeakSet,LM=function(){const{audioGain:t}=u(this,Ri).$state;return this.$state.max()*(t()??1)},VT=new WeakSet,wM=function(){const{disabled:t}=this.$props,{canSetVolume:i}=u(this,Ri).$state;return t()||!i()},HT=new WeakSet,CM=function(){const{muted:t,volume:i}=u(this,Ri).$state,s=t()?0:i()*100;this.$state.value.set(s),this.dispatch("value-change",{detail:s})},_f=new WeakMap,qT=new WeakSet,IM=function(t){if(!t.trigger)return;const i=xt(t.detail/100,3);u(this,Ri).remote.changeVolume(i,t)},GT=new WeakSet,kM=function(t){u(this,_f).call(this,t)},KT=new WeakSet,RM=function(t){u(this,_f).call(this,t)},L(Fw,"props",{...wi.props,keyStep:5,shiftKeyMultiplier:2}),L(Fw,"state",vl);var et,kc,Af,jT,PM,WT,DM,YT,OM,zT,MM,QT,$M,xf,Bw,XT,NM,Rc,ZT,FM,JT,BM,Lf,Uw,eb,UM,wf,Vw,tb,VM,ib,HM,sb,qM,nb,GM,rb,KM,ab,jM,Cn,Oa,ob,WM,lb,YM,cb,zM;class ay extends oe{constructor(){super();p(this,jT);p(this,WT);p(this,YT);p(this,zT);p(this,QT);p(this,xf);p(this,XT);p(this,ZT);p(this,JT);p(this,Lf);p(this,eb);p(this,wf);p(this,tb);p(this,ib);p(this,sb);p(this,nb);p(this,rb);p(this,ab);p(this,Cn);p(this,ob);p(this,lb);p(this,cb);p(this,et,void 0);p(this,kc,void 0);p(this,Af,ae(null));p(this,Rc,!1);const{noSwipeGesture:t}=this.$props;new wi({swipeGesture:()=>!t(),getValue:m(this,wf,Vw).bind(this),getStep:m(this,tb,VM).bind(this),getKeyStep:m(this,ib,HM).bind(this),roundValue:m(this,sb,qM),isDisabled:m(this,nb,GM).bind(this),aria:{valueNow:m(this,rb,KM).bind(this),valueText:m(this,ab,jM).bind(this)},onDragStart:m(this,ZT,FM).bind(this),onDragValueChange:m(this,JT,BM).bind(this),onDragEnd:m(this,Lf,Uw).bind(this),onValueChange:m(this,eb,UM).bind(this)})}onSetup(){A(this,et,Te()),xi(Hu,{default:"time",value:m(this,lb,YM).bind(this),time:m(this,cb,zM).bind(this)}),this.setAttributes({"data-chapters":m(this,WT,DM).bind(this)}),this.setStyles({"--slider-progress":m(this,jT,PM).bind(this)}),D(m(this,zT,MM).bind(this)),D(m(this,YT,OM).bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),Be(t,"aria-label","Seek")}onConnect(t){D(m(this,QT,$M).bind(this)),tx(u(this,et).textTracks,"chapters",u(this,Af).set)}}et=new WeakMap,kc=new WeakMap,Af=new WeakMap,jT=new WeakSet,PM=function(){const{bufferedEnd:t,duration:i}=u(this,et).$state;return xt(Math.min(t()/Math.max(i(),1),1)*100,3)+"%"},WT=new WeakSet,DM=function(){var i;const{duration:t}=u(this,et).$state;return((i=u(this,Af).call(this))==null?void 0:i.cues.length)&&Number.isFinite(t())&&t()>0},YT=new WeakSet,OM=function(){A(this,kc,gl(m(this,xf,Bw).bind(this),this.$props.seekingRequestThrottle()))},zT=new WeakSet,MM=function(){if(this.$state.hidden())return;const{value:t,dragging:i}=this.$state,s=m(this,wf,Vw).call(this);Y(i)||(t.set(s),this.dispatch("value-change",{detail:s}))},QT=new WeakSet,$M=function(){const t=u(this,et).player.el,{preview:i}=tt(mk);
3t&&i()&&J(t,"data-preview",this.$state.active())},xf=new WeakSet,Bw=function(t,i){u(this,et).remote.seeking(t,i)},XT=new WeakSet,NM=function(t,i,s){u(this,kc).cancel();const{live:r}=u(this,et).$state;if(r()&&i>=99){u(this,et).remote.seekToLiveEdge(s);return}u(this,et).remote.seek(t,s)},Rc=new WeakMap,ZT=new WeakSet,FM=function(t){const{pauseWhileDragging:i}=this.$props;if(i()){const{paused:s}=u(this,et).$state;A(this,Rc,!s()),u(this,et).remote.pause(t)}},JT=new WeakSet,BM=function(t){u(this,kc).call(this,m(this,Cn,Oa).call(this,t.detail),t)},Lf=new WeakSet,Uw=function(t){const{seeking:i}=u(this,et).$state;Y(i)||m(this,xf,Bw).call(this,m(this,Cn,Oa).call(this,t.detail),t);const s=t.detail;m(this,XT,NM).call(this,m(this,Cn,Oa).call(this,s),s,t);const{pauseWhileDragging:r}=this.$props;r()&&u(this,Rc)&&(u(this,et).remote.play(t),A(this,Rc,!1))},eb=new WeakSet,UM=function(t){const{dragging:i}=this.$state;i()||!t.trigger||m(this,Lf,Uw).call(this,t)},wf=new WeakSet,Vw=function(){const{currentTime:t}=u(this,et).$state;return m(this,ob,WM).call(this,t())},tb=new WeakSet,VM=function(){const t=this.$props.step()/u(this,et).$state.duration()*100;return Number.isFinite(t)?t:1},ib=new WeakSet,HM=function(){const t=this.$props.keyStep()/u(this,et).$state.duration()*100;return Number.isFinite(t)?t:1},sb=new WeakSet,qM=function(t){return xt(t,3)},nb=new WeakSet,GM=function(){const{disabled:t}=this.$props,{canSeek:i}=u(this,et).$state;return t()||!i()},rb=new WeakSet,KM=function(){const{value:t}=this.$state;return Math.round(t())},ab=new WeakSet,jM=function(){const t=m(this,Cn,Oa).call(this,this.$state.value()),{duration:i}=u(this,et).$state;return Number.isFinite(t)?`${ry(t)} out of ${ry(i())}`:"live"},Cn=new WeakSet,Oa=function(t){const{duration:i}=u(this,et).$state;return xt(t/100*i(),5)},ob=new WeakSet,WM=function(t){const{liveEdge:i,duration:s}=u(this,et).$state,r=Math.max(0,Math.min(1,i()?1:Math.min(t,s())/s()));return Number.isNaN(r)?0:Number.isFinite(r)?r*100:100},lb=new WeakSet,YM=function(t){const i=m(this,Cn,Oa).call(this,t),{live:s,duration:r}=u(this,et).$state;return Number.isFinite(i)?(s()?i-r():i).toFixed(0):"LIVE"},cb=new WeakSet,zM=function(t,i){const s=m(this,Cn,Oa).call(this,t),{live:r,duration:a}=u(this,et).$state,o=r()?s-a():s;return Number.isFinite(s)?`${o<0?"-":""}${rx(Math.abs(o),i)}`:"LIVE"},L(ay,"props",{...wi.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100}),L(ay,"state",vl);const Lt=ba();function Vq(n,e){const t=hV(n,e);for(const{el:i,top:s,left:r}of t)i.scroll({top:s,left:r,behavior:e.behavior})}function Hq(n,e={}){Vq(n,{scrollMode:"if-needed",block:"center",inline:"center",...e})}const qq=["a[href]","[tabindex]","input","select","button"].map(n=>`${n}:not([aria-hidden='true'])`).join(","),Gq=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);var Or,Xi,si,Cf,In,Ma,If,Hw,ub,QM,kf,qw,hb,XM,db,ZM,Pc,Tg,fb,JM;class Kq{constructor(e){p(this,In);p(this,If);p(this,ub);p(this,kf);p(this,hb);p(this,db);p(this,Pc);p(this,fb);p(this,Or,-1);p(this,Xi,null);p(this,si,[]);p(this,Cf,void 0);A(this,Cf,e)}get items(){return u(this,si)}attachMenu(e){Fe(e,"focus",m(this,ub,QM).bind(this)),A(this,Xi,e),ge(()=>{A(this,Xi,null)})}listen(){u(this,Xi)&&(this.update(),new Ve(u(this,Xi)).add("keyup",m(this,hb,XM).bind(this)).add("keydown",m(this,db,ZM).bind(this)),ge(()=>{A(this,Or,-1),A(this,si,[])}))}update(){A(this,Or,0),A(this,si,m(this,fb,JM).call(this))}scroll(e=m(this,If,Hw).call(this)){const t=u(this,si)[e];t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{Hq(t,{behavior:"smooth",boundary:i=>!i.hasAttribute("data-root")})})})}focusActive(e=!0){const t=m(this,If,Hw).call(this);m(this,In,Ma).call(this,t>=0?t:0,e)}}Or=new WeakMap,Xi=new WeakMap,si=new WeakMap,Cf=new WeakMap,In=new WeakSet,Ma=function(e,t=!0){var i;A(this,Or,e),u(this,si)[e]?(u(this,si)[e].focus({preventScroll:!0}),t&&this.scroll(e)):(i=u(this,Xi))==null||i.focus({preventScroll:!0})},If=new WeakSet,Hw=function(){return u(this,si).findIndex(e=>document.activeElement===e||e.getAttribute("role")==="menuitemradio"&&e.getAttribute("aria-checked")==="true")},ub=new WeakSet,QM=function(){u(this,Or)>=0||(this.update(),this.focusActive())},kf=new WeakSet,qw=function(e){const t=e.target;if(YU(e)&&t instanceof Element){const i=t.getAttribute("role");return!/a|input|select|button/.test(t.localName)&&!i}return Gq.has(e.key)},hb=new WeakSet,XM=function(e){m(this,kf,qw).call(this,e)&&(e.stopPropagation(),e.preventDefault())},db=new WeakSet,ZM=function(e){if(m(this,kf,qw).call(this,e))switch(e.stopPropagation(),e.preventDefault(),e.key){case"Escape":u(this,Cf).closeMenu(e);break;case"Tab":m(this,In,Ma).call(this,m(this,Pc,Tg).call(this,e.shiftKey?-1:1));break;case"ArrowUp":m(this,In,Ma).call(this,m(this,Pc,Tg).call(this,-1));break;case"ArrowDown":m(this,In,Ma).call(this,m(this,Pc,Tg).call(this,1));break;case"Home":case"PageUp":m(this,In,Ma).call(this,0);break;case"End":case"PageDown":m(this,In,Ma).call(this,u(this,si).length-1);break}},Pc=new WeakSet,Tg=function(e){var i;let t=u(this,Or);do t=(t+e+u(this,si).length)%u(this,si).length;while(((i=u(this,si)[t])==null?void 0:i.offsetParent)===null);return t},fb=new WeakSet,JM=function(){if(!u(this,Xi))return[];const e=u(this,Xi).querySelectorAll(qq),t=[],i=s=>s.getAttribute("role")==="menu";for(const s of e)cl(s)&&s.offsetParent!==null&&n6(u(this,Xi),s,i)&&t.pu
3sh(s);return t};var jq=Object.defineProperty,Wq=Object.getOwnPropertyDescriptor,wm=(n,e,t,i)=>{for(var s=Wq(e,t),r=n.length-1,a;r>=0;r--)(a=n[r])&&(s=a(e,t,s)||s);return s&&jq(e,t,s),s};let Yq=0;var Zi,Dc,Oc,Qt,Rf,Rs,It,Mr,$r,_o,Ao,kn,xo,Pf,Lo,pb,e$,mb,t$,gb,i$,yb,s$,vb,n$,Df,Gw,Tb,r$,Mc,bb,a$,Of,Kw,Eb,o$,wo,gh,Sb,l$,_b,c$,Ab,u$,xb,h$,Lb,d$,wb,f$,Cb,Ib,p$,$c,kb,Rb,m$,Pb,Db,g$,Nc,Fc,Ob,y$;class Tl extends oe{constructor(){super();p(this,pb);p(this,mb);p(this,gb);p(this,yb);p(this,vb);p(this,Df);p(this,Tb);p(this,bb);p(this,Of);p(this,Eb);p(this,wo);p(this,Sb);p(this,_b);p(this,Ab);p(this,xb);p(this,Lb);p(this,wb);p(this,Ib);p(this,Rb);p(this,Db);p(this,Ob);p(this,Zi,void 0);p(this,Dc,void 0);p(this,Oc,void 0);p(this,Qt,ae(!1));p(this,Rf,ae(!1));p(this,Rs,ae(null));p(this,It,ae(null));p(this,Mr,void 0);p(this,$r,new Set);p(this,_o,null);p(this,Ao,void 0);p(this,kn,void 0);p(this,xo,!1);p(this,Pf,ae(!1));p(this,Lo,new Set);p(this,Mc,!1);p(this,Cb,m(this,Ib,p$).bind(this));p(this,$c,!1);p(this,kb,m(this,Rb,m$).bind(this));p(this,Pb,m(this,Db,g$).bind(this));p(this,Nc,Xu(()=>{const t=Y(u(this,It));if(!t)return;let i=0,s=getComputedStyle(t),r=[...t.children];for(const a of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])i+=parseFloat(s[a])||0;for(const a of r)if(cl(a)&&a.style.display==="contents")r.push(...a.children);else if(a.nodeType===3)i+=parseFloat(getComputedStyle(a).fontSize);else if(cl(a)){if(!i6(a))continue;const o=getComputedStyle(a);i+=a.offsetHeight+(parseFloat(o.marginTop)||0)+(parseFloat(o.marginBottom)||0)}di(t,"--menu-height",i+"px")}));p(this,Fc,!1);const{showDelay:t}=this.$props;A(this,Ao,new lO({trigger:u(this,Rs),content:u(this,It),showDelay:t,listen:(i,s,r)=>{va(i,o=>{u(this,Qt).call(this)?r(o):s(o)});const a=m(this,xb,h$).call(this);a&&va(a,o=>{o.stopPropagation(),r(o)})},onChange:m(this,bb,a$).bind(this)}))}get triggerElement(){return u(this,Rs).call(this)}get contentElement(){return u(this,It).call(this)}get isSubmenu(){return!!u(this,Mr)}onSetup(){A(this,Zi,Te());const t=++Yq;A(this,Dc,`media-menu-${t}`),A(this,Oc,`media-menu-button-${t}`),A(this,kn,new Kq({closeMenu:this.close.bind(this)})),Li(Lt)&&A(this,Mr,tt(Lt)),m(this,pb,e$).call(this),this.setAttributes({"data-open":u(this,Qt),"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":m(this,wo,gh).bind(this)}),xi(Lt,{button:u(this,Rs),content:u(this,It),expanded:u(this,Qt),hint:ae(""),submenu:!!u(this,Mr),disable:m(this,Sb,l$).bind(this),attachMenuButton:m(this,gb,i$).bind(this),attachMenuItems:m(this,yb,s$).bind(this),attachObserver:m(this,vb,n$).bind(this),disableMenuButton:m(this,Tb,r$).bind(this),addSubmenu:m(this,wb,f$).bind(this),onTransitionEvent:i=>{u(this,Lo).add(i),ge(()=>{u(this,Lo).delete(i)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){var i;D(m(this,mb,t$).bind(this)),this.isSubmenu&&((i=u(this,Mr))==null||i.addSubmenu(this))}onDestroy(){u(this,Rs).set(null),u(this,It).set(null),A(this,_o,null),u(this,Lo).clear()}open(t){Y(u(this,Qt))||(u(this,Ao).show(t),zn())}close(t){Y(u(this,Qt))&&(u(this,Ao).hide(t),zn())}}Zi=new WeakMap,Dc=new WeakMap,Oc=new WeakMap,Qt=new WeakMap,Rf=new WeakMap,Rs=new WeakMap,It=new WeakMap,Mr=new WeakMap,$r=new WeakMap,_o=new WeakMap,Ao=new WeakMap,kn=new WeakMap,xo=new WeakMap,Pf=new WeakMap,Lo=new WeakMap,pb=new WeakSet,e$=function(){let t=-1,i=Li(xh)?tt(xh):null;xi(xh,{onDragStart:()=>{var s;(s=i==null?void 0:i.onDragStart)==null||s.call(i),window.clearTimeout(t),t=-1,A(this,xo,!0)},onDragEnd:()=>{var s;(s=i==null?void 0:i.onDragEnd)==null||s.call(i),t=window.setTimeout(()=>{A(this,xo,!1),t=-1},300)}})},mb=new WeakSet,t$=function(){const t=m(this,Eb,o$).call(this);this.isSubmenu||u(this,Nc).call(this),m(this,Df,Gw).call(this,t),t&&(D(()=>{const{height:i}=u(this,Zi).$state,s=u(this,It).call(this);s&&di(s,"--player-height",i()+"px")}),u(this,kn).listen(),this.listen("pointerup",m(this,_b,c$).bind(this)),Fe(window,"pointerup",m(this,Ab,u$).bind(this)))},gb=new WeakSet,i$=function(t){const i=t.el,s=this.isSubmenu,r=Ht(m(this,wo,gh).bind(this));Be(i,"tabindex",s?"-1":"0"),Be(i,"role",s?"menuitem":"button"),J(i,"id",u(this,Oc)),J(i,"aria-haspopup","menu"),J(i,"aria-expanded","fal
3se"),J(i,"data-root",!this.isSubmenu),J(i,"data-submenu",this.isSubmenu),D(()=>{J(i,"data-open",u(this,Qt).call(this)),J(i,"aria-disabled",r())}),u(this,Rs).set(i),ge(()=>{u(this,Rs).set(null)})},yb=new WeakSet,s$=function(t){var a;const i=t.el;i.style.setProperty("display","none"),J(i,"id",u(this,Dc)),Be(i,"role","menu"),Be(i,"tabindex","-1"),J(i,"data-root",!this.isSubmenu),J(i,"data-submenu",this.isSubmenu),u(this,It).set(i),ge(()=>u(this,It).set(null)),D(()=>J(i,"data-open",u(this,Qt).call(this))),u(this,kn).attachMenu(i),m(this,Df,Gw).call(this,!1);const r=m(this,Ob,y$).bind(this);this.isSubmenu?(a=u(this,Mr))==null||a.onTransitionEvent(r):(t.listen("transitionstart",r),t.listen("transitionend",r),t.listen("animationend",u(this,Nc)),t.listen("vds-menu-resize",u(this,Nc)))},vb=new WeakSet,n$=function(t){A(this,_o,t)},Df=new WeakSet,Gw=function(t){const i=Y(u(this,It));i&&J(i,"aria-hidden",zg(!t))},Tb=new WeakSet,r$=function(t){u(this,Pf).set(t)},Mc=new WeakMap,bb=new WeakSet,a$=function(t,i){var a,o,l,c,h,d;if(A(this,Mc,QA(i)),i==null||i.stopPropagation(),u(this,Qt).call(this)===t)return;if(m(this,wo,gh).call(this)){t&&u(this,Ao).hide(i);return}(a=this.el)==null||a.dispatchEvent(new Event("vds-menu-resize",{bubbles:!0,composed:!0}));const s=u(this,Rs).call(this),r=u(this,It).call(this);if(s&&(J(s,"aria-controls",t&&u(this,Dc)),J(s,"aria-expanded",zg(t))),r&&J(r,"aria-labelledby",t&&u(this,Oc)),u(this,Qt).set(t),m(this,Lb,d$).call(this,i),zn(),u(this,Mc)){t?r==null||r.focus():s==null||s.focus();for(const f of[this.el,r])f&&f.setAttribute("data-keyboard","")}else for(const f of[this.el,r])f&&f.removeAttribute("data-keyboard");if(this.dispatch(t?"open":"close",{trigger:i}),t)!this.isSubmenu&&u(this,Zi).activeMenu!==this&&((o=u(this,Zi).activeMenu)==null||o.close(i),u(this,Zi).activeMenu=this),(c=(l=u(this,_o))==null?void 0:l.onOpen)==null||c.call(l,i);else{if(this.isSubmenu)for(const f of u(this,$r))f.close(i);else u(this,Zi).activeMenu=null;(d=(h=u(this,_o))==null?void 0:h.onClose)==null||d.call(h,i)}t&&requestAnimationFrame(m(this,Of,Kw).bind(this))},Of=new WeakSet,Kw=function(){u(this,Fc)||u(this,$c)||(u(this,kn).update(),requestAnimationFrame(()=>{u(this,Mc)?u(this,kn).focusActive():u(this,kn).scroll()}))},Eb=new WeakSet,o$=function(){return!m(this,wo,gh).call(this)&&u(this,Qt).call(this)},wo=new WeakSet,gh=function(){return u(this,Rf).call(this)||u(this,Pf).call(this)},Sb=new WeakSet,l$=function(t){u(this,Rf).set(t)},_b=new WeakSet,c$=function(t){const i=u(this,It).call(this);u(this,xo)||i&&q3(i,t)||t.stopPropagation()},Ab=new WeakSet,u$=function(t){const i=u(this,It).call(this);u(this,xo)||i&&q3(i,t)||this.close(t)},xb=new WeakSet,h$=function(){var i;const t=(i=this.el)==null?void 0:i.querySelector('[data-part="close-target"]');return this.el&&t&&n6(this.el,t,s=>s.getAttribute("role")==="menu")?t:null},Lb=new WeakSet,d$=function(t){this.isSubmenu||(u(this,Qt).call(this)?u(this,Zi).remote.pauseControls(t):u(this,Zi).remote.resumeControls(t))},wb=new WeakSet,f$=function(t){u(this,$r).add(t),new Ve(t).add("open",u(this,kb)).add("close",u(this,Pb)),ge(u(this,Cb))},Cb=new WeakMap,Ib=new WeakSet,p$=function(t){u(this,$r).delete(t)},$c=new WeakMap,kb=new WeakMap,Rb=new WeakSet,m$=function(t){var s;A(this,$c,!0);const i=u(this,It).call(this);this.isSubmenu&&((s=this.triggerElement)==null||s.setAttribute("aria-hidden","true"));for(const r of u(this,$r))if(r!==t.target)for(const a of[r.el,r.triggerElement])a==null||a.setAttribute("aria-hidden","true");if(i){const r=t.target.el;for(const a of i.children)a.contains(r)?a.setAttribute("data-open",""):a!==r&&a.setAttribute("data-hidden","")}},Pb=new WeakMap,Db=new WeakSet,g$=function(t){var s;A(this,$c,!1);const i=u(this,It).call(this);this.isSubmenu&&((s=this.triggerElement)==null||s.setAttribute("aria-hidden","false"));for(const r of u(this,$r))for(const a of[r.el,r.triggerElement])a==null||a.setAttribute("aria-hidden","false");if(i)for(const r of i.children)r.removeAttribute("data-open"),r.removeAttribute("data-hidden")},Nc=new WeakMap,Fc=new WeakMap,Ob=new WeakSet,y$=function(t){const i=u(this,It).call(this);i&&t.propertyName==="height"&&(A(this,Fc,t.type==="transitionstart"),J(i,"data-transition",u(this,Fc)?"height":null),u(this,Qt).call(this)&&m(this,Of,Kw).call(this));for(const s of u(this,Lo))s(t)},L(Tl,"props",{showDelay:0});wm([Se],Tl.prototype,"triggerElement");wm([Se],Tl.prototype,"contentElement");wm([Se],Tl.prototype,"isSubmenu");wm([at],Tl.prototype,"open");wm([at],Tl.prototype,"close");var Nr,Mf,Mb,v$,$b,T$,$f,jw;class ax extends oe{constructor(){super();p(this,Mb);p(this,$b);p(this,$f);p(this,Nr,void 0);p(this,Mf,ae(null));new ms}get expanded(){var t;return((t=u(this,Nr))==null?void 0:t.expanded())??!1}onSetup(){A(this,Nr,tt(Lt))}onAttach(t){u(this,Nr).attachMenuButton(this),D(m(this,Mb,v$).bind(this)),Be(t,"type","button")}onConnect(t){D(m(this,$b,T$).bind(this)),m(this,$f,jw).call(this);const i=new MutationObserver(m(this,$f,jw).bind(this));i.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),ge(()=>i.disconnect()),va(t,s=>{this.dispatch("select",{trigger:s})})}}Nr=new WeakMap,Mf=new WeakMap,Mb=new WeakSet,v$=function(){u(this,Nr).disableMenuButton(this.$props.disabled())},$b=new WeakSet,T$=function(){const t=u(this,Mf).call(this);t&&D(()=>{const i=u(this,Nr).hint();i&&(t.textContent=i)})},$f=new WeakSet,jw=function(){var i;const t=(i=this.el)==null?void 0:i.querySelector('[data-part="hint"]');u(this,Mf).set(t??null)},L(ax,"props",{disabled:!1});const zq=ax.prototype;Se(zq,"expanded");class Qq extends ax{}var ni,Nf,Nb,E$,Fb,S$,Ff,Ww,Bb,_$;class b$ extends oe{constructor(){super(...arguments);p(this,Nb);p(this,Fb);p(this,Ff);p(this,Bb);p(this,ni,null);p(this,Nf,void 0)}onSetup(){A(this,Nf,Te()),xi(bg,{attach:m(this,Nb,E$).bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){}onDestroy(){var t;(t=u(this,ni))==null||t.remove(),A(this,ni,null)}}ni=new WeakMap,Nf=new WeakMap,Nb=new WeakSet,E$=function(t){m(this,Ff,Ww).call(this,!1),A(this,ni,t),Zn(()=>{Zn(()=>{this.connectScope&&D(m(this,Fb,S$).bind(this))})})},Fb=new WeakSet,S$=function(){const{fullscreen:t}=u(this,Nf).$state,{disabled:i}=this.$props;m(this,Ff,Ww).call(this,i()==="fullscreen"?!t():!i())},Ff=new WeakSet,Ww=function(t){var r;if(!u(this,ni))return;let i=m(this,Bb,_$).call(this,this.$props.container());if(!i)return;const s=u(this,ni).parentElement===i;J(u(this,ni),"data-portal",t),t?s||(u(this,ni).remove(),i.append(u(this,ni))):s&&u(this,ni).parentElement===i&&(u(this,ni).remove(),(r=this.el)==null||r.append(u(this,ni)))},Bb=new WeakSet,_$=function(t){return cl(t)?t:t?document.querySelector(t):document.body},L(b$,"props",{container:null,disabled:!1});const bg=ba();var Co,Ub,x$,Vb,L$,Hb,w$;class A$ extends oe{constructor(){super();p(this,Ub);p(this,Vb);p(this,Hb);p(this,Co,void 0);new ms;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(A(this,Co,tt(Lt)),u(this,Co).attachMenuItems(this),Li(bg)){const i=tt(bg);
3i&&(xi(bg,null),i.attach(t),ge(()=>i.attach(null)))}}onConnect(t){D(m(this,Ub,x$).bind(this))}}Co=new WeakMap,Ub=new WeakSet,x$=function(){const{expanded:t}=u(this,Co);if(!this.el||!t())return;const i=this.$props.placement();if(!i)return;Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});const{offset:s,alignOffset:r}=this.$props;ge(r6(this.el,m(this,Hb,w$).call(this),i,{offsetVarName:"media-menu",xOffset:r(),yOffset:s()})),ge(m(this,Vb,L$).bind(this))},Vb=new WeakSet,L$=function(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")},Hb=new WeakSet,w$=function(){return u(this,Co).button()},L(A$,"props",{placement:null,offset:0,alignOffset:0});const Yw=ba();var Rn,Fr,HI,qb,C$,Gb,I$,Kb,Bf,zw,Uf,Qw;class bl extends Fi{constructor(){super(...arguments);p(this,qb);p(this,Gb);p(this,Bf);p(this,Uf);p(this,Rn,new Set);p(this,Fr,ae(""));p(this,HI,null);L(this,"onValueChange");p(this,Kb,m(this,Bf,zw).bind(this))}get values(){return Array.from(u(this,Rn)).map(t=>t.value())}get value(){return u(this,Fr).call(this)}set value(t){m(this,Bf,zw).call(this,t)}onSetup(){xi(Yw,{add:m(this,qb,C$).bind(this),remove:m(this,Gb,I$).bind(this)})}onAttach(t){Li(Lt)||Be(t,"role","radiogroup"),this.setAttributes({value:u(this,Fr)})}onDestroy(){u(this,Rn).clear()}}Rn=new WeakMap,Fr=new WeakMap,HI=new WeakMap,qb=new WeakSet,C$=function(t){u(this,Rn).has(t)||(u(this,Rn).add(t),t.onCheck=u(this,Kb),t.check(t.value()===u(this,Fr).call(this)))},Gb=new WeakSet,I$=function(t){t.onCheck=null,u(this,Rn).delete(t)},Kb=new WeakMap,Bf=new WeakSet,zw=function(t,i){var o;const s=Y(u(this,Fr));if(!t||t===s)return;const r=m(this,Uf,Qw).call(this,s),a=m(this,Uf,Qw).call(this,t);r==null||r.check(!1,i),a==null||a.check(!0,i),u(this,Fr).set(t),(o=this.onValueChange)==null||o.call(this,t,i)},Uf=new WeakSet,Qw=function(t){for(const i of u(this,Rn))if(t===Y(i.value))return i;return null};var Ps,Io,jb,k$,Wb,R$,Yb,P$,zb,D$,Qb,O$,Vf,Xw,Xb,M$;class yk extends oe{constructor(){super();p(this,jb);p(this,Wb);p(this,Yb);p(this,zb);p(this,Qb);p(this,Vf);p(this,Xb);p(this,Ps,ae(!1));p(this,Io,{value:this.$props.value,check:m(this,Qb,O$).bind(this),onCheck:null});new ms}get checked(){return u(this,Ps).call(this)}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":u(this,Ps),"aria-checked":Ht(u(this,Ps))})}onAttach(t){const i=Li(Lt);Be(t,"tabindex",i?"-1":"0"),Be(t,"role",i?"menuitemradio":"radio"),D(m(this,Yb,P$).bind(this))}onConnect(t){m(this,Wb,R$).call(this),va(t,m(this,zb,D$).bind(this)),ge(m(this,jb,k$).bind(this))}}Ps=new WeakMap,Io=new WeakMap,jb=new WeakSet,k$=function(){Gt(()=>{tt(Yw).remove(u(this,Io))},this.connectScope)},Wb=new WeakSet,R$=function(){tt(Yw).add(u(this,Io))},Yb=new WeakSet,P$=function(){var s,r;const{value:t}=this.$props,i=t();Y(u(this,Ps))&&((r=(s=u(this,Io)).onCheck)==null||r.call(s,i))},zb=new WeakSet,D$=function(t){var i,s;Y(u(this,Ps))||(m(this,Vf,Xw).call(this,!0,t),m(this,Xb,M$).call(this,t),(s=(i=u(this,Io)).onCheck)==null||s.call(i,Y(this.$props.value),t))},Qb=new WeakSet,O$=function(t,i){Y(u(this,Ps))!==t&&m(this,Vf,Xw).call(this,t,i)},Vf=new WeakSet,Xw=function(t,i){u(this,Ps).set(t),this.dispatch("change",{detail:t,trigger:i})},Xb=new WeakSet,M$=function(t){this.dispatch("select",{trigger:t})},L(yk,"props",{value:""});const Xq=yk.prototype;Se(Xq,"checked");var Bc,Ji,ko,Zb,$$,Jb,N$,e1,F$,t1,B$,i1,U$;class vk extends oe{constructor(){super();p(this,Zb);p(this,Jb);p(this,e1);p(this,t1);p(this,i1);p(this,Bc,void 0);p(this,Ji,void 0);p(this,ko,void 0);A(this,ko,new bl),u(this,ko).onValueChange=m(this,i1,U$).bind(this)}get value(){return u(this,ko).value}get disabled(){const{audioTracks:t}=u(this,Ji).$state;return t().length<=1}onSetup(){A(this,Ji,Te()),Li(Lt)&&A(this,Bc,tt(Lt))}onConnect(t){D(m(this,Zb,$$).bind(this)),D(m(this,e1,F$).bind(this)),D(m(this,Jb,N$).bind(this))}getOptions(){const{audioTracks:t}=u(this,Ji).$state;return t().map(i=>({track:i,label:i.label,value:i.label.toLowerCase()}))}}Bc=new WeakMap,Ji=new WeakMap,ko=new WeakMap,Zb=new WeakSet,$$=function(){u(this,ko).value=m(this,t1,B$).call(this)},Jb=new WeakSet,N$=function(){var r;const{emptyLabel:t}=this.$props,{audioTrack:i}=u(this,Ji).$state,s=i();(r=u(this,Bc))==null||r.hint.set((s==null?void 0:s.label)??t())},e1=new WeakSet,F$=function(){var t;(t=u(this,Bc))==null||t.disable(this.disabled)},t1=new WeakSet,B$=function(){const{audioTrack:t}=u(this,Ji).$state,i=t();return i?i.label.toLowerCase():""},i1=new WeakSet,U$=function(t,i){if(this.disabled)return;const s=u(this,Ji).audioTracks.toArray().findIndex(r=>r.label.toLowerCase()===t);if(s>=0){const r=u(this,Ji).audioTracks[s];u(this,Ji).remote.changeAudioTrack(s,i),this.dispatch("change",{detail:r,trigger:i})}},L(vk,"props",{emptyLabel:"Default"});const Tk=vk.prototype;Se(Tk,"value");Se(Tk,"disabled");at(Tk,"getOptions");var ri,Uc,Ro,s1,V$,n1,H$,r1,q$,a1,G$,o1,K$,Vc,Eg;class bk extends oe{constructor(){super();p(this,s1);p(this,n1);p(this,r1);p(this,a1);p(this,o1);p(this,Vc);p(this,ri,void 0);p(this,Uc,void 0);p(this,Ro,void 0);A(this,Ro,new bl),u(this,Ro).onValueChange=m(this,o1,K$).bind(this)}get value(){return u(this,Ro).value}get disabled(){const{hasCaptions:t}=u(this,ri).$state;return!t()}onSetup(){A(this,ri,Te()),Li(Lt)&&A(this,Uc,tt(Lt))}onConnect(t){var i;(i=super.onConnect)==null||i.call(this,t),D(m(this,s1,V$).bind(this)),D(m(this,r1,q$).bind(this)),D(m(this,n1,H$).bind(this))}getOptions(){const{offLabel:t}=this.$props,{textTracks:i}=u(this,ri).$state;return[{value:"off",label:t},...i().filter(Kt).map(s=>({track:s,label:s.label,value:m(this,Vc,Eg).call(this,s)}))]}}ri=new WeakMap,Uc=new WeakMap,Ro=new WeakMap,s1=new WeakSet,V$=function(){u(this,Ro).value=m(this,a1,G$).call(this)},n1=new WeakSet,H$=function(){var r;const{offLabel:t}=this.$props,{textTrack:i}=u(this,ri).$state,s=i();(r=u(this,Uc))==null||r.hint.set(s&&Kt(s)&&s.mode==="showing"?s.label:t())},r1=new WeakSet,q$=function(){var t;(t=u(this,Uc))==null||t.disable(this.disabled)},a1=new WeakSet,G$=function(){const{textTrack:t}=u(this,ri).$state,i=t();return i&&Kt(i)&&i.mode==="showing"?m(this,Vc,Eg).call(this,i):"off"},o1=new WeakSet,K$=function(t,i){if(this.disabled)return;if(t==="off"){const r=u(this,ri).textTracks.selected;if(r){const a=u(this,ri).textTracks.indexOf(r);u(this,ri).remote.changeTextTrackMode(a,"disabled",i),this.dispatch("change",{detail:null,trigger:i})}return}const s=u(this,ri).textTracks.toArray().findIndex(r=>m(this,Vc,Eg).call(this,r)===t);if(s>=0){const r=u(this,ri).textTracks[s];u(this,ri).remote.changeTextTrackMode(s,"showing",i),this.dispatch("change",{detail:r,trigger:i})}},Vc=new WeakSet,Eg=function(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()},L(bk,"props",{offLabel:"Off"});const Ek=bk.prototype;Se(Ek,"value");Se(Ek,"disabled");at(Ek,"getOptions");const Zq=[.25,.5,.75,1,1.25,1.5,1.75,2];var Br,Hc,Po,l1,j$,c1,W$,u1,Y$,h1,z$,d1,Q$;class Sk extends oe{constructor(){super();p(this,l1);p(this,c1);p(this,u1);p(this,h1);p(this,d1);p(this,Br,void 0);p(this,Hc,void 0);p(this,Po,void 0);A(this,Po,new bl),u(this,Po).onValueChange=m(this,d1,Q$).bind(this)}get value(){return u(this,Po).value}get disabled(){const{rates:t}=this.$props,{canSetPlaybackRate:i}=u(this,Br).$state;return!i()||t().length===0}onSetup(){A(this,Br,Te()),Li(Lt)&&A(this,Hc,tt(Lt))}onConnect(t){D(m(this,l1,j$).bind(this)),D(m(this,c1,W$).bind(this)),D(m(this,u1,Y$).bind(this))}getOptions(){const{rates:t,normalLabel:i}=this.$props;return t().map(s=>({label:s===1?i:s+"×",value:s.toString()}))}}Br=new WeakMap,Hc=new WeakMap,Po=new WeakMap,l1=new WeakSet,j$=function(){u(this,Po).value=m(this,h1,z$).call(this)},c1=new WeakSet,W$=function(){var r;const{normalLabel:t}=this.$props,{playbackRate:i}=u(this,Br).$state,s=i();(r=u(this,Hc))==null||r.hint.set(s===1?t():s+"×")},u1=new WeakSet,Y$=function(){var t;(t=u(this,Hc))==null||t.disable(this.disabled)},h1=new WeakSet,z$=function(){const{playbackRate:t}=u(this,Br).$state;return t().toString()},d1=new WeakSet,Q$=function(t,i){if(this.disabled)return;const s=+t;u(this,Br).remote.changePlaybackRate(s,i),this.dispatch("change",{detail:s,trigger:i})},L(Sk,"props",{normalLabel:"Normal",rates:Zq});const _k=Sk.prototype;Se(_k,"value");Se(_k,"disabled");at(_k,"getOptions");var es,qc,Do,f1,p1,X$,m1,Z$,g1,J$,y1,e9,v1,t9,Gc,Sg;class Ak extends oe{constructor(){super();p(this,p1);p(this,m1);p(this,g1);p(this,y1);p(this,v1);p(this,Gc);p(this,es,void 0);p(this,qc,void 0);p(this,Do,void 0);p(this,f1,ds(()=>{const{sort:t}=this.$props,{qualities:i}=u(this,es).$state;return aO(i(),t()==="descending")}));A(this,Do,new bl),u(this,Do).onValueChange=m(this,y1,e9).bind(this)}get value(){return u(this,Do).value}get disabled(){const{canSetQuality:t,qualities:i}=u(this,es).$state;return!t()||i().length<=1}onSetup(){A(this,es,Te()),Li(Lt)&&A(this,qc,tt(Lt))}onConnect(t){D(m(this,p1,X$).bind(this)),D(m(this,g1,J$).bind(this)),D(m(this,m1,Z$).bind(this))}getOptions(){const{autoLabel:t,hideBitrate:i}=this.$props;return[{value:"auto",label:t},...u(this,f1).call(this).map(s=>{const r=s.bitrate&&s.bitrate>=0?`${xt(s.bitrate/1e6,2)} Mbps`:null;return{quality:s,label:s.height+"p",value:m(this,Gc,Sg).call(this,s),bitrate:()=>i()?null:r}})]}}es=new WeakMap,qc=new WeakMap,Do=new WeakMap,f1=new WeakMap,p1=new WeakSet,X$=function(){u(this,Do).value=m(this,v1,t9).call(this)},m1=new WeakSet,Z$=function(){var a;const{autoLabel:t}=this.$props,{autoQuality:i,quality:s}=u(this,es).$state,r=s()?s().height+"p":"";(a=u(this,qc))==null||a.hint.set(i()?t()+(r?` (${r})`:""):r)},g1=new WeakSet,J$=function(){var t;(t=u(this,qc))==null||t.disable(this.disabled)},y1=new WeakSet,e9=function(t,i){if(this.disabled)return;if(t==="auto"){u(this,es).remote.changeQuality(-1,i),this.dispatch("change",{detail:"auto",trigger:i});return}const{qualities:s}=u(this,es).$state,r=Y(s).findIndex(a=>m(this,Gc,Sg).call(this,a)===t);if(r>=0){const a=Y(s)[r];
3u(this,es).remote.changeQuality(r,i),this.dispatch("change",{detail:a,trigger:i})}},v1=new WeakSet,t9=function(){const{quality:t,autoQuality:i}=u(this,es).$state;if(i())return"auto";const s=t();return s?m(this,Gc,Sg).call(this,s):"auto"},Gc=new WeakSet,Sg=function(t){return t.height+"_"+t.bitrate},L(Ak,"props",{autoLabel:"Auto",hideBitrate:!1,sort:"descending"});const xk=Ak.prototype;Se(xk,"value");Se(xk,"disabled");at(xk,"getOptions");var Kc,Ur,Hf,qf,T1,i9,b1,s9,E1,n9,Gf,Jw,S1,r9,_1,a9,Kf,eC,A1,o9;class Zw extends oe{constructor(){super(...arguments);p(this,T1);p(this,b1);p(this,E1);p(this,Gf);p(this,S1);p(this,_1);p(this,Kf);p(this,A1);p(this,Kc,void 0);p(this,Ur,ae(null));p(this,Hf,ae(!0));p(this,qf,ae(!0))}onSetup(){A(this,Kc,Te()),m(this,Gf,Jw).call(this);const{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":m(this,Kf,eC).bind(this)}),new FO({callback:m(this,T1,i9).bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||D(m(this,S1,r9).bind(this)),D(m(this,Gf,Jw).bind(this))}onConnect(t){ge(s6(t,u(this,Hf).set)),D(m(this,b1,s9).bind(this)),D(m(this,E1,n9).bind(this))}}Kc=new WeakMap,Ur=new WeakMap,Hf=new WeakMap,qf=new WeakMap,T1=new WeakSet,i9=function(t){u(this,qf).set(t[0].isIntersecting)},b1=new WeakSet,s9=function(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!u(this,Hf).call(this)||!u(this,qf).call(this))},E1=new WeakSet,n9=function(){if(!this.$props.toggle()){u(this,Ur).set(null);return}this.el&&va(this.el,m(this,A1,o9).bind(this))},Gf=new WeakSet,Jw=function(){const{hidden:t,timeText:i}=this.$state,{duration:s}=u(this,Kc).$state;if(t())return;const{type:r,padHours:a,padMinutes:o,showHours:l}=this.$props,c=m(this,_1,a9).call(this,r()),h=s(),d=m(this,Kf,eC).call(this);if(!Number.isFinite(c+h)){i.set("LIVE");return}const f=d?Math.max(0,h-c):c,g=rx(f,{padHrs:a(),padMins:o(),showHrs:l()});i.set((d?"-":"")+g)},S1=new WeakSet,r9=function(){if(!this.el)return;const{toggle:t}=this.$props;J(this.el,"role",t()?"timer":null),J(this.el,"tabindex",t()?0:null)},_1=new WeakSet,a9=function(t){const{bufferedEnd:i,duration:s,currentTime:r}=u(this,Kc).$state;switch(t){case"buffered":return i();case"duration":return s();default:return r()}},Kf=new WeakSet,eC=function(){return this.$props.remainder()&&u(this,Ur).call(this)!==!1},A1=new WeakSet,o9=function(t){if(t.preventDefault(),u(this,Ur).call(this)===null){u(this,Ur).set(!this.$props.remainder());return}u(this,Ur).set(i=>!i)},L(Zw,"props",{type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1}),L(Zw,"state",new Ea({timeText:"",hidden:!1}));var Ds,jc,x1,l9,L1,c9,w1,u9,C1,h9,I1,d9,Vr,Wc,k1,f9,Yc,_g,R1,p9,Pn,$a;class tC extends oe{constructor(){super(...arguments);p(this,x1);p(this,L1);p(this,w1);p(this,C1);p(this,I1);p(this,k1);p(this,Yc);p(this,R1);p(this,Pn);p(this,Ds,void 0);p(this,jc,!1);p(this,Vr,-1);p(this,Wc,-1)}onSetup(){A(this,Ds,Te())}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),Be(t,"role","status"),Be(t,"aria-live","polite");const{busy:i}=this.$state;this.setAttributes({"aria-busy":()=>i()?"true":null}),A(this,jc,!0),D(m(this,x1,l9).bind(this)),D(m(this,I1,d9).bind(this)),D(m(this,C1,h9).bind(this)),D(m(this,L1,c9).bind(this)),D(m(this,w1,u9).bind(this)),D(m(this,k1,f9).bind(this)),D(m(this,R1,p9).bind(this)),zn(),A(this,jc,!1)}}Ds=new WeakMap,jc=new WeakMap,x1=new WeakSet,l9=function(){const{paused:t}=u(this,Ds).$state;m(this,Pn,$a).call(this,t()?"Pause":"Play")},L1=new WeakSet,c9=function(){const{fullscreen:t}=u(this,Ds).$state;m(this,Pn,$a).call(this,t()?"Enter Fullscreen":"Exit Fullscreen")},w1=new WeakSet,u9=function(){const{pictureInPicture:t}=u(this,Ds).$state;m(this,Pn,$a).call(this,t()?"Enter PiP":"Exit PiP")},C1=new WeakSet,h9=function(){const{textTrack:t}=u(this,Ds).$state;m(this,Pn,$a).call(this,t()?"Closed-Captions On":"Closed-Captions Off")},I1=new WeakSet,d9=function(){const{muted:t,volume:i,audioGain:s}=u(this,Ds).$state;m(this,Pn,$a).call(this,t()||i()===0?"Mute":`${Math.round(i()*(s()??1)*100)}% ${m(this,Yc,_g).call(this,"Volume")}`)},Vr=new WeakMap,Wc=new WeakMap,k1=new WeakSet,f9=function(){const{seeking:t,currentTime:i}=u(this,Ds).$state,s=t();u(this,Vr)>0?(window.clearTimeout(u(this,Wc)),A(this,Wc,window.setTimeout(()=>{if(!this.scope)return;const r=Y(i),a=Math.abs(r-u(this,Vr));if(a>=1){const o=r>=u(this,Vr),l=ry(a);m(this,Pn,$a).call(this,`${m(this,Yc,_g).call(this,o?"Seek Forward":"Seek Backward")} ${l}`)}A(this,Vr,-1),A(this,Wc,-1)},300))):s&&A(this,Vr,Y(i))},Yc=new WeakSet,_g=function(t){var s;const{translations:i}=this.$props;return((s=i==null?void 0:i())==null?void 0:s[t||""])??t},R1=new WeakSet,p9=function(){const{label:t,busy:i}=this.$state,s=m(this,Yc,_g).call(this,t());if(u(this,jc))return;i.set(!0);const r=window.setTimeout(()=>void i.set(!1),150);return this.el&&J(this.el,"aria-label",s),te(s)&&this.dispatch("change",{detail:s}),()=>window.clearTimeout(r)},Pn=new WeakSet,$a=function(t){const{label:i}=this.$state;i.set(t)},L(tC,"props",{translations:null}),L(tC,"state",new Ea({label:null,busy:!1}));var Dn,P1,g9,D1,y9,jf,iC;class m9 extends oe{constructor(){super(...arguments);p(this,P1);p(this,D1);p(this,jf);p(this,Dn,void 0)}onSetup(){A(this,Dn,Te()),D(m(this,D1,y9).bind(this))}onAttach(t){const{pictureInPicture:i,fullscreen:s}=u(this,Dn).$state;di(t,"pointer-events","none"),Be(t,"role","group"),this.setAttributes({"data-visible":m(this,jf,iC).bind(this),"data-fullscreen":s,"data-pip":i}),D(()=>{this.dispatch("change",{detail:m(this,jf,iC).call(this)})}),D(m(this,P1,g9).bind(this)),D(()=>{const r=s();for(const a of["top","right","bottom","left"])di(t,`padding-${a}`,r&&`env(safe-area-inset-${a})`)})}}Dn=new WeakMap,P1=new WeakSet,g9=function(){if(!this.el)return;const{nativeControls:t}=u(this,Dn).$state,i=t();J(this.el,"aria-hidden",i?"true":null),di(this.el,"display",i?"none":null)},D1=new WeakSet,y9=function(){const{controls:t}=u(this,Dn).player,{hideDelay:i,hideOnMouseLeave:s}=this.$props;t.defaultDelay=i()===2e3?u(this,Dn).$props.controlsDelay():i(),t.hideOnMouseLeave=s()},jf=new WeakSet,iC=function(){const{controlsVisible:t}=u(this,Dn).$state;return t()},L(m9,"props",{hideDelay:2e3,hideOnMouseLeave:!1});class Jq extends oe{onAttach(e){e.style.pointerEvents||di(e,"pointer-events","auto")}}const Ka=ba();let eG=0;var zc,Hr,qr,Wf,O1,T9,M1,b9,$1,E9,N1,S9,F1,_9;class v9 extends oe{constructor(){super();p(this,O1);p(this,M1);p(this,$1);p(this,N1);p(this,F1);p(this,zc,`media-tooltip-${++eG}`);p(this,Hr,ae(null));p(this,qr,ae(null));p(this,Wf,ae(!1));new ms;const{showDelay:t}=this.$props;new lO({trigger:u(this,Hr),content:u(this,qr),showDelay:t,listen(i,s,r){D(()=>
3{ty()&&Fe(i,"focus",s),Fe(i,"blur",r)}),new Ve(i).add("touchstart",a=>a.preventDefault(),{passive:!1}).add("mouseenter",s).add("mouseleave",r)},onChange:m(this,F1,_9).bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){xi(Ka,{trigger:u(this,Hr),content:u(this,qr),showing:u(this,Wf),attachTrigger:m(this,O1,T9).bind(this),detachTrigger:m(this,M1,b9).bind(this),attachContent:m(this,$1,E9).bind(this),detachContent:m(this,N1,S9).bind(this)})}}zc=new WeakMap,Hr=new WeakMap,qr=new WeakMap,Wf=new WeakMap,O1=new WeakSet,T9=function(t){var s;u(this,Hr).set(t);let i=t.getAttribute("data-media-tooltip");i&&((s=this.el)==null||s.setAttribute(`data-media-${i}-tooltip`,"")),J(t,"data-describedby",u(this,zc))},M1=new WeakSet,b9=function(t){t.removeAttribute("data-describedby"),t.removeAttribute("aria-describedby"),u(this,Hr).set(null)},$1=new WeakSet,E9=function(t){t.setAttribute("id",u(this,zc)),t.style.display="none",Be(t,"role","tooltip"),u(this,qr).set(t)},N1=new WeakSet,S9=function(t){t.removeAttribute("id"),t.removeAttribute("role"),u(this,qr).set(null)},F1=new WeakSet,_9=function(t){const i=u(this,Hr).call(this),s=u(this,qr).call(this);i&&J(i,"aria-describedby",t?u(this,zc):null);for(const r of[this.el,i,s])r&&J(r,"data-visible",t);u(this,Wf).set(t)},L(v9,"props",{showDelay:700});var B1,A9,Yf,sC;class tG extends oe{constructor(){super();p(this,B1);p(this,Yf);new ms}onConnect(t){ge(Zn(()=>{if(!this.connectScope)return;m(this,B1,A9).call(this);const i=tt(Ka);ge(()=>{const s=m(this,Yf,sC).call(this);s&&i.detachTrigger(s)})}))}}B1=new WeakSet,A9=function(){const t=m(this,Yf,sC).call(this),i=tt(Ka);t&&i.attachTrigger(t)},Yf=new WeakSet,sC=function(){const t=this.el.firstElementChild;return(t==null?void 0:t.localName)==="button"||(t==null?void 0:t.getAttribute("role"))==="button"?t:this.el};var zf,nC,U1,L9,V1,w9;class x9 extends oe{constructor(){super();p(this,zf);p(this,U1);p(this,V1);new ms;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){m(this,zf,nC).call(this,t),Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){m(this,zf,nC).call(this,t);const i=tt(Ka);ge(()=>i.detachContent(t)),ge(Zn(()=>{this.connectScope&&D(m(this,U1,L9).bind(this))}))}}zf=new WeakSet,nC=function(t){tt(Ka).attachContent(t)},U1=new WeakSet,L9=function(){const{showing:t}=tt(Ka);if(!t())return;const{placement:i,offset:s,alignOffset:r}=this.$props;return r6(this.el,m(this,V1,w9).call(this),i(),{offsetVarName:"media-tooltip",xOffset:r(),yOffset:s()})},V1=new WeakSet,w9=function(){return tt(Ka).trigger()},L(x9,"props",{placement:"top center",offset:0,alignOffset:0});var Qf;class Lk extends oe{constructor(){super();p(this,Qf,ae(!1));new jt({isPresssed:u(this,Qf)})}get pressed(){return u(this,Qf).call(this)}}Qf=new WeakMap,L(Lk,"props",{disabled:!1,defaultPressed:!1});const iG=Lk.prototype;Se(iG,"pressed");var On,H1,I9,q1,k9,G1,R9,K1,P9;class C9 extends oe{constructor(){super();p(this,H1);p(this,q1);p(this,G1);p(this,K1);p(this,On,void 0);new jt({isPresssed:m(this,q1,k9).bind(this),onPress:m(this,H1,I9).bind(this)})}onSetup(){A(this,On,Te());const{canGoogleCast:t,isGoogleCastConnected:i}=u(this,On).$state;this.setAttributes({"data-active":i,"data-supported":t,"data-state":m(this,G1,R9).bind(this),"aria-hidden":Ht(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),Sa(t,m(this,K1,P9).bind(this))}}On=new WeakMap,H1=new WeakSet,I9=function(t){u(this,On).remote.requestGoogleCast(t)},q1=new WeakSet,k9=function(){const{remotePlaybackType:t,remotePlaybackState:i}=u(this,On).$state;return t()==="google-cast"&&i()!=="disconnected"},G1=new WeakSet,R9=function(){const{remotePlaybackType:t,remotePlaybackState:i}=u(this,On).$state;return t()==="google-cast"&&i()},K1=new WeakSet,P9=function(){const{remotePlaybackState:t}=u(this,On).$state;return`Google Cast ${t()}`},L(C9,"props",jt.props);var Gr,Xf,j1,D9,W1,O9,Zf,rC,Y1,M9,Jf,aC,z1,$9,Q1,N9,ep,oC,X1,F9,Z1,B9;class oy extends oe{constructor(){super(...arguments);p(this,j1);p(this,W1);p(this,Zf);p(this,Y1);p(this,Jf);p(this,z1);p(this,Q1);p(this,ep);p(this,X1);p(this,Z1);p(this,Gr,void 0);p(this,Xf,void 0)}get video(){return this.$state.video()}onSetup(){A(this,Gr,Te()),A(this,Xf,Qu(ul.state)),m(this,Zf,rC).call(this),this.setAttributes({"data-loading":m(this,Y1,M9).bind(this),"data-hidden":this.$state.hidden,"data-error":m(this,Jf,aC).bind(this),"aria-hidden":Ht(this.$state.hidden)})}onAttach(t){D(m(this,j1,D9).bind(this)),D(m(this,W1,O9).bind(this)),D(m(this,Zf,rC).bind(this)),D(m(this,z1,$9).bind(this)),D(m(this,Q1,N9).bind(this)),D(m(this,Z1,B9).bind(this))}}
3Gr=new WeakMap,Xf=new WeakMap,j1=new WeakSet,D9=function(){const t=this.$state.video();t&&(t.readyState>=2&&m(this,ep,oC).call(this),new Ve(t).add("canplay",m(this,ep,oC).bind(this)).add("error",m(this,X1,F9).bind(this)))},W1=new WeakSet,O9=function(){const{src:t}=this.$state,{canLoad:i}=u(this,Gr).$state;t.set(i()?this.$props.src():null)},Zf=new WeakSet,rC=function(){const{crossOrigin:t}=this.$props,{crossOrigin:i}=this.$state,{crossOrigin:s}=u(this,Gr).$state,r=t()!==null?t():s();i.set(r===!0?"anonymous":r)},Y1=new WeakSet,M9=function(){const{canPlay:t,hidden:i}=this.$state;return!t()&&!i()},Jf=new WeakSet,aC=function(){const{error:t}=this.$state;return!Ys(t)},z1=new WeakSet,$9=function(){const{src:t,hidden:i}=this.$state,{canLoad:s,duration:r}=u(this,Gr).$state;i.set(s()&&(!t()||m(this,Jf,aC).call(this)||!Number.isFinite(r())))},Q1=new WeakSet,N9=function(){const{src:t,canPlay:i,error:s}=this.$state;t(),i.set(!1),s.set(null)},ep=new WeakSet,oC=function(t){const{canPlay:i,error:s}=this.$state;i.set(!0),s.set(null),this.dispatch("can-play",{trigger:t})},X1=new WeakSet,F9=function(t){const{canPlay:i,error:s}=this.$state;i.set(!1),s.set(t),this.dispatch("error",{trigger:t})},Z1=new WeakSet,B9=function(){const{video:t,canPlay:i}=this.$state,{duration:s}=u(this,Gr).$state,{pointerRate:r}=u(this,Xf),a=t();i()&&a&&Number.isFinite(s())&&Number.isFinite(r())&&(a.currentTime=r()*s())},L(oy,"props",{src:null,crossOrigin:null}),L(oy,"state",new Ea({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1}));const sG=oy.prototype;Se(sG,"video");var Kr,J1,U9,eE,V9,tE,H9,iE,q9,sE,G9,tp,cC,nE,K9,rE,j9;class lC extends oe{constructor(){super(...arguments);p(this,J1);p(this,eE);p(this,tE);p(this,iE);p(this,sE);p(this,tp);p(this,nE);p(this,rE);p(this,Kr,void 0)}onSetup(){A(this,Kr,Te()),xi(Hu,{default:"percent",percent:(t,i)=>xt(this.$state.value(),i)+"%"}),new wi({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:m(this,sE,G9).bind(this),aria:{valueNow:m(this,J1,U9).bind(this),valueText:m(this,eE,V9).bind(this)},onDragValueChange:m(this,rE,j9).bind(this),onValueChange:m(this,nE,K9).bind(this)}).attach(this),D(m(this,tE,H9).bind(this)),D(m(this,iE,q9).bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),Be(t,"aria-label","Audio Boost");const{canSetAudioGain:i}=u(this,Kr).$state;this.setAttributes({"data-supported":i,"aria-hidden":Ht(()=>!i())})}}Kr=new WeakMap,J1=new WeakSet,U9=function(){const{value:t}=this.$state;return Math.round(t())},eE=new WeakSet,V9=function(){const{value:t}=this.$state;return t()+"%"},tE=new WeakSet,H9=function(){const{min:t,max:i}=this.$props;this.$state.min.set(t()),this.$state.max.set(i())},iE=new WeakSet,q9=function(){const{audioGain:t}=u(this,Kr).$state,i=((t()??1)-1)*100;this.$state.value.set(i),this.dispatch("value-change",{detail:i})},sE=new WeakSet,G9=function(){const{disabled:t}=this.$props,{canSetAudioGain:i}=u(this,Kr).$state;return t()||!i()},tp=new WeakSet,cC=function(t){if(!t.trigger)return;const i=xt(1+t.detail/100,2);u(this,Kr).remote.changeAudioGain(i,t)},nE=new WeakSet,K9=function(t){m(this,tp,cC).call(this,t)},rE=new WeakSet,j9=function(t){m(this,tp,cC).call(this,t)},L(lC,"props",{...wi.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300}),L(lC,"state",vl);var jr,aE,W9,oE,Y9,lE,z9,cE,Q9,uE,X9,hE,Z9,ip,dE,J9,fE,eN,pE,tN;class uC extends oe{constructor(){super(...arguments);p(this,aE);p(this,oE);p(this,lE);p(this,cE);p(this,uE);p(this,hE);p(this,dE);p(this,fE);p(this,pE);p(this,jr,void 0);p(this,ip,gl(m(this,dE,J9).bind(this),25))}onSetup(){A(this,jr,Te()),new wi({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:m(this,uE,X9),isDisabled:m(this,hE,Z9).bind(this),aria:{valueNow:m(this,aE,W9).bind(this),valueText:m(this,oE,Y9).bind(this)},onDragValueChange:m(this,pE,tN).bind(this),onValueChange:m(this,fE,eN).bind(this)}).attach(this),D(m(this,lE,z9).bind(this)),D(m(this,cE,Q9).bind(this))}onAttach(t){t.setAttribute("data-media-speed-slider",""),Be(t,"aria-label","Speed");const{canSetPlaybackRate:i}=u(this,jr).$state;this.setAttributes({"data-supported":i,"aria-hidden":Ht(()=>!i())})}}jr=new WeakMap,aE=new WeakSet,W9=function(){const{value:t}=this.$state;return t()},oE=new WeakSet,Y9=function(){const{value:t}=this.$state;return t()+"x"},lE=new WeakSet,z9=function(){const{min:t,max:i}=this.$props;this.$state.min.set(t()),this.$state.max.set(i())},cE=new WeakSet,Q9=function(){const{playbackRate:t}=u(this,jr).$state,i=t();this.$state.value.set(i),this.dispatch("value-change",{detail:i})},uE=new WeakSet,X9=function(t){return xt(t,2)},hE=new WeakSet,Z9=function(){const{disabled:t}=this.$props,{canSetPlaybackRate:i}=u(this,jr).$state;return t()||!i()},ip=new WeakMap,dE=new WeakSet,J9=function(t){if(!t.trigger)return;const i=t.detail;u(this,jr).remote.changePlaybackRate(i,t)},fE=new WeakSet,eN=function(t){u(this,ip).call(this,t)},pE=new WeakSet,tN=function(t){u(this,ip).call(this,t)},L(uC,"props",{...wi.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2}),L(uC,"state",vl);var ts,Qc,mE,iN,gE,sN,yE,nN,vE,rN,TE,aN,sp,bE,oN,EE,lN,SE,cN;class hC extends oe{constructor(){super(...arguments);p(this,mE);p(this,gE);p(this,yE);p(this,vE);p(this,TE);p(this,bE);p(this,EE);p(this,SE);p(this,ts,void 0);p(this,Qc,ds(()=>{const{qualities:t}=u(this,ts).$state;return aO(t())}));p(this,sp,gl(m(this,bE,oN).bind(this),25))}onSetup(){A(this,ts,Te()),new wi({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:m(this,TE,aN).bind(this),aria:{valueNow:m(this,mE,iN).bind(this),valueText:m(this,gE,sN).bind(this)},onDragValueChange:m(this,SE,cN).bind(this),onValueChange:m(this,EE,lN).bind(this)}).attach(this),D(m(this,yE,nN).bind(this)),D(m(this,vE,rN).bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),Be(t,"aria-label","Video Quality");const{qualities:i,canSetQuality:s}=u(this,ts).$state,r=ds(()=>s()&&i().length>0);this.setAttributes({"data-supported":r,"aria-hidden":Ht(()=>!r())})}}ts=new WeakMap,Qc=new WeakMap,mE=new WeakSet,iN=function(){const{value:t}=this.$state;return t()},gE=new WeakSet,sN=function(){const{quality:t}=u(this,ts).$state;if(!t())return"";const{height:i,bitrate:s}=t(),r=s&&s>0?`${(s/1e6).toFixed(2)} Mbps`:null;return i?`${i}p${r?` (${r})`:""}`:"Auto"},yE=new WeakSet,nN=function(){const t=u(this,Qc).call(this);this.$state.max.set(Math.max(0,t.length-1))},vE=new WeakSet,rN=function(){let{quality:t}=u(this,ts).$state,i=u(this,Qc).call(this),s=Math.max(0,i.indexOf(t()));this.$state.value.set(s),this.dispatch("value-change",{detail:s})},TE=new WeakSet,aN=function(){const{disabled:t}=this.$props,{canSetQuality:i,qualities:s}=u(this,ts).$state;return t()||s().length<=1||!i()},sp=new WeakMap,bE=new WeakSet,oN=function(t){if(!t.trigger)return;const{qualities:i}=u(this,ts),s=Y(u(this,Qc))[t.detail];u(this,ts).remote.changeQuality(i.indexOf(s),t)},EE=new WeakSet,lN=function(t){u(this,sp).call(this,t)},SE=new WeakSet,cN=function(t){u(this,sp).call(this,t)},L(hC,"props",{...wi.props,step:1,keyStep:1,shiftKeyMultiplier:1}),L(hC,"state",vl);var ai,Oo,Xc,Os,Xt,Mo,Zt,Mn,$o,Wr,np,dC,rp,fC,_E,uN,AE,hN,xE,dN,LE,fN,wE,pN,Zc,Ag,ap,pC,op,mC,CE,mN,IE,kE,RE,gN,Jc,xg,eu,Lg,PE,yN,DE,vN,OE,TN,ME,bN,lp,$E,EN,NE,SN,FE,_N;class wk extends oe{constructor(){super(...arguments);p(this,np);p(this,rp);p(this,_E);p(this,AE);p(this,xE);p(this,LE);p(this,wE);p(this,Zc);p(this,ap);p(this,op);p(this,CE);p(this,RE);p(this,Jc);p(this,eu);p(this,PE);p(this,DE);p(this,OE);p(this,ME);p(this,$E);p(this,NE);p(this,FE);p(this,ai,void 0);p(this,Oo,void 0);p(this,Xc,void 0);p(this,Os,null);p(this,Xt,[]);p(this,Mo,ae(null));p(this,Zt,ae([]));p(this,Mn,ae(-1));p(this,$o,ae(-1));p(this,Wr,0);p(this,IE,Xu(t=>{var l;let i,s=u(this,Zt).call(this),{seekableStart:r}=u(this,ai).$state,a=r(),o=m(this,Jc,xg).call(this,s);for(let c=u(this,Wr);c<u(this,Xt).length;c++)if(i=m(this,eu,Lg).call(this,s[c],t,a,o),(l=u(this,Xt)[c])==null||l.style.setProperty("--chapter-progress",i+"%"),i<100){A(this,Wr,c);break}}
3));p(this,kE,ds(m(this,RE,gN).bind(this)));p(this,lp,ek(()=>{const t=Y(u(this,Mo));!this.scope||!t||!t.cues.length||(u(this,Zt).set(m(this,PE,yN).call(this,t.cues)),u(this,Mn).set(0),A(this,Wr,0))},150,!0))}get cues(){return u(this,Zt).call(this)}get activeCue(){return u(this,Zt).call(this)[u(this,Mn).call(this)]||null}get activePointerCue(){return u(this,Zt).call(this)[u(this,$o).call(this)]||null}onSetup(){A(this,ai,Te()),A(this,Oo,Qu(ay.state))}onAttach(t){tx(u(this,ai).textTracks,"chapters",m(this,np,dC).bind(this)),D(m(this,DE,vN).bind(this))}onConnect(){ge(()=>m(this,rp,fC).bind(this))}onDestroy(){m(this,np,dC).call(this,null)}setRefs(t){var i;if(A(this,Xt,t),(i=u(this,Xc))==null||i.dispose(),u(this,Xt).length===1){const s=u(this,Xt)[0];s.style.width="100%",s.style.setProperty("--chapter-fill","var(--slider-fill)"),s.style.setProperty("--chapter-progress","var(--slider-progress)")}else u(this,Xt).length>0&&Gt(()=>m(this,_E,uN).call(this),A(this,Xc,ma()))}}ai=new WeakMap,Oo=new WeakMap,Xc=new WeakMap,Os=new WeakMap,Xt=new WeakMap,Mo=new WeakMap,Zt=new WeakMap,Mn=new WeakMap,$o=new WeakMap,Wr=new WeakMap,np=new WeakSet,dC=function(t){Y(u(this,Mo))!==t&&(m(this,rp,fC).call(this),u(this,Mo).set(t))},rp=new WeakSet,fC=function(){var t;A(this,Xt,[]),u(this,Zt).set([]),u(this,Mn).set(-1),u(this,$o).set(-1),A(this,Wr,0),(t=u(this,Xc))==null||t.dispose()},_E=new WeakSet,uN=function(){u(this,Xt).length&&D(m(this,AE,hN).bind(this))},AE=new WeakSet,hN=function(){const{hidden:t}=u(this,Oo);t()||(D(m(this,xE,dN).bind(this)),D(m(this,LE,fN).bind(this)),D(m(this,wE,pN).bind(this)),D(m(this,CE,mN).bind(this)))},xE=new WeakSet,dN=function(){const t=u(this,Zt).call(this);if(!t.length)return;let i,{seekableStart:s,seekableEnd:r}=u(this,ai).$state,a=s(),o=r()||t[t.length-1].endTime,l=o-a,c=100;for(let h=0;h<t.length;h++)if(i=t[h],u(this,Xt)[h]){const d=h===t.length-1?c:xt((i.endTime-Math.max(a,i.startTime))/l*100,3);u(this,Xt)[h].style.width=d+"%",c-=d}},LE=new WeakSet,fN=function(){let{liveEdge:t,seekableStart:i,seekableEnd:s}=u(this,ai).$state,{fillPercent:r,value:a}=u(this,Oo),o=u(this,Zt).call(this),l=t(),c=Y(u(this,Mn)),h=o[c],d=l?u(this,Zt).length-1:m(this,op,mC).call(this,h&&h.startTime/s()*100<=Y(a)?c:0,r());l||!h?m(this,Zc,Ag).call(this,0,o.length,100):d>c?m(this,Zc,Ag).call(this,c,d,100):d<c&&m(this,Zc,Ag).call(this,d+1,c+1,0);const f=l?100:m(this,eu,Lg).call(this,o[d],r(),i(),m(this,Jc,xg).call(this,o));m(this,ap,pC).call(this,u(this,Xt)[d],f),u(this,Mn).set(d)},wE=new WeakSet,pN=function(){let{hidden:t,pointerPercent:i}=u(this,Oo);if(t()){u(this,$o).set(-1);return}const s=m(this,op,mC).call(this,0,i());u(this,$o).set(s)},Zc=new WeakSet,Ag=function(t,i,s){for(let r=t;r<i;r++)m(this,ap,pC).call(this,u(this,Xt)[r],s)},ap=new WeakSet,pC=function(t,i){t&&(t.style.setProperty("--chapter-fill",i+"%"),J(t,"data-active",i>0&&i<100),J(t,"data-ended",i===100))},op=new WeakSet,mC=function(t,i){let s=0,r=u(this,Zt).call(this);if(i===0)return 0;if(i===100)return r.length-1;let{seekableStart:a}=u(this,ai).$state,o=a(),l=m(this,Jc,xg).call(this,r);for(let c=t;c<r.length;c++)if(s=m(this,eu,Lg).call(this,r[c],i,o,l),s>=0&&s<100)return c;return 0},CE=new WeakSet,mN=function(){u(this,IE).call(this,u(this,kE).call(this))},IE=new WeakMap,kE=new WeakMap,RE=new WeakSet,gN=function(){const{bufferedEnd:t,duration:i}=u(this,ai).$state;return xt(Math.min(t()/Math.max(i(),1),1),3)*100},Jc=new WeakSet,xg=function(t){var r;const{seekableEnd:i}=u(this,ai).$state,s=i();return Number.isFinite(s)?s:((r=t[t.length-1])==null?void 0:r.endTime)||0},eu=new WeakSet,Lg=function(t,i,s,r){if(!t||u(this,Zt).call(this).length===0)return 0;const o=r-s,l=Math.max(0,t.startTime-s),c=Math.min(r,t.endTime)-s,h=l/o,d=h*100,f=Math.min(1,h+(c-l)/o)*100;return Math.max(0,xt(i>=f?100:(i-d)/(f-d)*100,3))},PE=new WeakSet,yN=function(t){let i=[],{seekableStart:s,seekableEnd:r,duration:a}=u(this,ai).$state,o=s(),l=r();t=t.filter(d=>d.startTime<=l&&d.endTime>=o);const c=t[0];c&&c.startTime>o&&i.push(new window.VTTCue(o,c.startTime,""));for(let d=0;d<t.length-1;d++){const f=t[d],g=t[d+1];if(i.push(f),g){const y=g.startTime-f.endTime;y>0&&i.push(new window.VTTCue(f.endTime,f.endTime+y,""))}}const h=t[t.length-1];if(h){i.push(h);const d=a();d>=0&&d-h.endTime>1&&i.push(new window.VTTCue(h.endTime,a(),""))}return i},DE=new WeakSet,vN=function(){const{source:t}=u(this,ai).$state;t(),m(this,OE,TN).call(this)},OE=new WeakSet,TN=function(){if(!this.scope)return;const{disabled:t}=this.$props;if(t()){u(this,Zt).set([]),u(this,Mn).set(0),A(this,Wr,0);return}const i=u(this,Mo).call(this);if(i){const s=u(this,lp).bind(this);s(),new Ve(i).add("add-cue",s).add("remove-cue",s),D(m(this,ME,bN).bind(this))}return A(this,Os,m(this,FE,_N).call(this)),u(this,Os)&&D(m(this,$E,EN).bind(this)),()=>{u(this,Os)&&(u(this,Os).textContent="",A(this,Os,null))}},ME=new WeakSet,bN=function(){u(this,ai).$state.duration(),u(this,lp).call(this)},lp=new WeakMap,$E=new WeakSet,EN=function(){const t=this.activePointerCue||this.activeCue;u(this,Os)&&(u(this,Os).textContent=(t==null?void 0:t.text)||"")},NE=new WeakSet,SN=function(){let t=this.el;
3for(;t&&t.getAttribute("role")!=="slider";)t=t.parentElement;return t},FE=new WeakSet,_N=function(){const t=m(this,NE,SN).call(this);return t?t.querySelector('[data-part="chapter-title"]'):null},L(wk,"props",{disabled:!1});const ox=wk.prototype;Se(ox,"cues");Se(ox,"activeCue");Se(ox,"activePointerCue");at(ox,"setRefs");var $n,BE,AN,UE,xN;class Ck extends oe{constructor(){super();p(this,BE);p(this,UE);p(this,$n,void 0);A(this,$n,new bl),u(this,$n).onValueChange=m(this,UE,xN).bind(this)}get values(){return u(this,$n).values}get value(){return u(this,$n).value}set value(t){u(this,$n).value=t}onSetup(){D(m(this,BE,AN).bind(this))}}$n=new WeakMap,BE=new WeakSet,AN=function(){u(this,$n).value=this.$props.value()},UE=new WeakSet,xN=function(t,i){const s=this.createEvent("change",{detail:t,trigger:i});this.dispatch(s)},L(Ck,"props",{value:""});const LN=Ck.prototype;Se(LN,"values");Se(LN,"value");var nG=Object.defineProperty,rG=Object.getOwnPropertyDescriptor,Ik=(n,e,t,i)=>{for(var s=rG(e,t),r=n.length-1,a;r>=0;r--)(a=n[r])&&(s=a(e,t,s)||s);return s&&nG(e,t,s),s},Ms,No,Nn,tu,$s,VE,wN,HE,CN,qE,IN,cp,gC,GE,kN,KE,RN;class Cm extends oe{constructor(){super();p(this,VE);p(this,HE);p(this,qE);p(this,cp);p(this,GE);p(this,KE);p(this,Ms,void 0);p(this,No,void 0);p(this,Nn,void 0);p(this,tu,ae(null));p(this,$s,ae([]));A(this,Nn,new bl),u(this,Nn).onValueChange=m(this,KE,RN).bind(this)}get value(){return u(this,Nn).value}get disabled(){var t;return!((t=u(this,$s).call(this))!=null&&t.length)}onSetup(){A(this,Ms,Te()),Li(Lt)&&A(this,No,tt(Lt));const{thumbnails:t}=this.$props;this.setAttributes({"data-thumbnails":()=>!!t()})}onAttach(t){var i;(i=u(this,No))==null||i.attachObserver({onOpen:m(this,VE,wN).bind(this)})}getOptions(){const{seekableStart:t,seekableEnd:i}=u(this,Ms).$state,s=t(),r=i();return u(this,$s).call(this).map((a,o)=>({cue:a,value:o.toString(),label:a.text,startTime:rx(Math.max(0,a.startTime-s)),duration:ry(Math.min(r,a.endTime)-Math.max(s,a.startTime))}))}onConnect(t){D(m(this,cp,gC).bind(this)),D(m(this,GE,kN).bind(this)),D(m(this,HE,CN).bind(this)),tx(u(this,Ms).textTracks,"chapters",u(this,tu).set)}}Ms=new WeakMap,No=new WeakMap,Nn=new WeakMap,tu=new WeakMap,$s=new WeakMap,VE=new WeakSet,wN=function(){Y(()=>m(this,cp,gC).call(this))},HE=new WeakSet,CN=function(){const t=u(this,tu).call(this);if(!t)return;const i=m(this,qE,IN).bind(this,t);return i(),new Ve(t).add("add-cue",i).add("remove-cue",i),()=>{u(this,$s).set([])}},qE=new WeakSet,IN=function(t){const{seekableStart:i,seekableEnd:s}=u(this,Ms).$state,r=i(),a=s();u(this,$s).set([...t.cues].filter(o=>o.startTime<=a&&o.endTime>=r))},cp=new WeakSet,gC=function(){var h;if(!((h=u(this,No))!=null&&h.expanded()))return;if(!u(this,tu).call(this)){u(this,Nn).value="-1";return}const{realCurrentTime:i,seekableStart:s,seekableEnd:r}=u(this,Ms).$state,a=s(),o=r(),l=i(),c=u(this,$s).call(this).findIndex(d=>EL(d,l));u(this,Nn).value=c.toString(),c>=0&&Zn(()=>{if(!this.connectScope)return;const d=u(this,$s).call(this)[c],f=this.el.querySelector("[aria-checked='true']"),g=Math.max(a,d.startTime),y=Math.min(o,d.endTime)-g,v=Math.max(0,l-g)/y*100;f&&di(f,"--progress",xt(v,3)+"%")})},GE=new WeakSet,kN=function(){var t;(t=u(this,No))==null||t.disable(this.disabled)},KE=new WeakSet,RN=function(t,i){if(this.disabled||!i)return;const s=+t,r=u(this,$s).call(this),{clipStartTime:a}=u(this,Ms).$state;At(s)&&(r!=null&&r[s])&&(u(this,Nn).value=s.toString(),u(this,Ms).remote.seek(r[s].startTime-a(),i),this.dispatch("change",{detail:r[s],trigger:i}))},L(Cm,"props",{thumbnails:null});Ik([Se],Cm.prototype,"value");Ik([Se],Cm.prototype,"disabled");Ik([at],Cm.prototype,"getOptions");const aG=[1,1.25,1.5,1.75,2,2.5,3,4];var Yr,iu,Fo,jE,PN,WE,DN,YE,ON,zE,MN,QE,$N;class kk extends oe{constructor(){super();p(this,jE);p(this,WE);p(this,YE);p(this,zE);p(this,QE);p(this,Yr,void 0);p(this,iu,void 0);p(this,Fo,void 0);A(this,Fo,new bl),u(this,Fo).onValueChange=m(this,QE,$N).bind(this)}get value(){return u(this,Fo).value}get disabled(){const{gains:t}=this.$props,{canSetAudioGain:i}=u(this,Yr).$state;return!i()||t().length===0}onSetup(){A(this,Yr,Te()),Li(Lt)&&A(this,iu,tt(Lt))}onConnect(t){D(m(this,jE,PN).bind(this)),D(m(this,WE,DN).bind(this)),D(m(this,YE,ON).bind(this))}getOptions(){const{gains:t,normalLabel:i}=this.$props;return t().map(s=>({label:s===1||s===null?i:String(s*100)+"%",value:s.toString()}))}}Yr=new WeakMap,iu=new WeakMap,Fo=new WeakMap,jE=new WeakSet,PN=function(){u(this,Fo).value=m(this,zE,MN).call(this)},WE=new WeakSet,DN=function(){var r;const{normalLabel:t}=this.$props,{audioGain:i}=u(this,Yr).$state,s=i();(r=u(this,iu))==null||r.hint.set(s===1||s==null?t():String(s*100)+"%")},YE=new WeakSet,ON=function(){var t;(t=u(this,iu))==null||t.disable(this.disabled)},zE=new WeakSet,MN=function(){var i;const{audioGain:t}=u(this,Yr).$state;return((i=t())==null?void 0:i.toString())??"1"},QE=new WeakSet,$N=function(t,i){if(this.disabled)return;const s=+t;u(this,Yr).remote.changeAudioGain(s,i),this.dispatch("change",{detail:s,trigger:i})},L(kk,"props",{normalLabel:"Disabled",gains:aG});const Rk=kk.prototype;Se(Rk,"value");Se(Rk,"disabled");at(Rk,"getOptions");var Ti,su,XE,FN,Ns,up,ZE,BN,hp,yC,JE,UN,eS,VN,tS,HN;class NN extends oe{constructor(){super(...arguments);p(this,XE);p(this,ZE);p(this,hp);p(this,JE);p(this,eS);p(this,tS);p(this,Ti,void 0);p(this,su,null);p(this,Ns,0);p(this,up,-1)}onSetup(){A(this,Ti,Te());const{event:t,action:i}=this.$props;this.setAttributes({event:t,action:i})}onAttach(t){t.setAttribute("data-media-gesture",""),t.style.setProperty("pointer-events","none")}onConnect(t){var i;A(this,su,(i=u(this,Ti).player.el)==null?void 0:i.querySelector("[data-media-provider]")),D(m(this,XE,FN).bind(this))}}Ti=new WeakMap,su=new WeakMap,XE=new WeakSet,FN=function(){let t=this.$props.event(),i=this.$props.disabled();
3!u(this,su)||!t||i||(/^dbl/.test(t)&&(t=t.split(/^dbl/)[1]),(t==="pointerup"||t==="pointerdown")&&u(this,Ti).$state.pointer()==="coarse"&&(t=t==="pointerup"?"touchend":"touchstart"),Fe(u(this,su),t,m(this,ZE,BN).bind(this),{passive:!1}))},Ns=new WeakMap,up=new WeakMap,ZE=new WeakSet,BN=function(t){if(this.$props.disabled()||k3(t)&&(t.button!==0||u(this,Ti).activeMenu)||lg(t)&&u(this,Ti).activeMenu||ck(t)||!m(this,JE,UN).call(this,t))return;t.MEDIA_GESTURE=!0,t.preventDefault();const i=Y(this.$props.event);if(!(i==null?void 0:i.startsWith("dbl")))u(this,Ns)===0&&setTimeout(()=>{u(this,Ns)===1&&m(this,hp,yC).call(this,t)},250);else if(u(this,Ns)===1){queueMicrotask(()=>m(this,hp,yC).call(this,t)),clearTimeout(u(this,up)),A(this,Ns,0);return}u(this,Ns)===0&&A(this,up,window.setTimeout(()=>{A(this,Ns,0)},275)),w3(this,Ns)._++},hp=new WeakSet,yC=function(t){this.el.setAttribute("data-triggered",""),requestAnimationFrame(()=>{m(this,eS,VN).call(this)&&m(this,tS,HN).call(this,Y(this.$props.action),t),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})},JE=new WeakSet,UN=function(t){if(!this.el)return!1;if(k3(t)||WU(t)||lg(t)){const i=lg(t)?t.changedTouches[0]??t.touches[0]:void 0,s=(i==null?void 0:i.clientX)??t.clientX,r=(i==null?void 0:i.clientY)??t.clientY,a=this.el.getBoundingClientRect(),o=r>=a.top&&r<=a.bottom&&s>=a.left&&s<=a.right;return t.type.includes("leave")?!o:o}return!0},eS=new WeakSet,VN=function(){const t=u(this,Ti).player.el.querySelectorAll("[data-media-gesture][data-triggered]");return Array.from(t).sort((i,s)=>+getComputedStyle(s).zIndex-+getComputedStyle(i).zIndex)[0]===this.el},tS=new WeakSet,HN=function(t,i){if(!t)return;const s=new ve("will-trigger",{detail:t,cancelable:!0,trigger:i});if(this.dispatchEvent(s),s.defaultPrevented)return;const[r,a]=t.replace(/:([a-z])/,"-$1").split(":");t.includes(":fullscreen")?u(this,Ti).remote.toggleFullscreen("prefer-media",i):t.includes("seek:")?u(this,Ti).remote.seek(Y(u(this,Ti).$state.currentTime)+(+a||0),i):u(this,Ti).remote[sV(r)](i),this.dispatch("trigger",{detail:t,trigger:i})},L(NN,"props",{disabled:!1,event:void 0,action:void 0});var nu,Fn,Bn,dp,vC;class oG{constructor(e){p(this,dp);L(this,"priority",10);p(this,nu,null);p(this,Fn,void 0);p(this,Bn,void 0);A(this,Fn,e)}attach(){}canRender(){return!0}detach(){var e;(e=u(this,Bn))==null||e.abort(),A(this,Bn,void 0),u(this,Fn).reset(),A(this,nu,null)}changeTrack(e){var t;!e||u(this,nu)===e||((t=u(this,Bn))==null||t.abort(),A(this,Bn,new Ve(e)),e.readyState<2?(u(this,Fn).reset(),u(this,Bn).add("load",()=>m(this,dp,vC).call(this,e),{once:!0})):m(this,dp,vC).call(this,e),u(this,Bn).add("add-cue",i=>{u(this,Fn).addCue(i.detail)}).add("remove-cue",i=>{u(this,Fn).removeCue(i.detail)}),A(this,nu,e))}}nu=new WeakMap,Fn=new WeakMap,Bn=new WeakMap,dp=new WeakSet,vC=function(e){u(this,Fn).changeTrack({cues:[...e.cues],regions:[...e.regions]})};var oi,ru,wg,iS,qN,sS,GN,nS,KN,fp,bC,rS,jN,aS,WN,oS,YN,lS,zN,pp,EC,cS,QN,uS,XN,Un,mp,SC,au,Cg,gp,_C,yp,AC;const Ss=class Ss extends oe{constructor(){super(...arguments);p(this,ru);p(this,iS);p(this,sS);p(this,nS);p(this,fp);p(this,rS);p(this,aS);p(this,oS);p(this,lS);p(this,pp);p(this,cS);p(this,uS);p(this,mp);p(this,au);p(this,gp);p(this,yp);p(this,oi,void 0);p(this,Un,-1)}onSetup(){A(this,oi,Te()),this.setAttributes({"aria-hidden":Ht(m(this,ru,wg).bind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){Ss.lib()||se(()=>Promise.resolve().then(()=>hy),void 0,import.meta.url).then(i=>Ss.lib.set(i)),D(m(this,iS,qN).bind(this))}};oi=new WeakMap,ru=new WeakSet,wg=function(){const{textTrack:t,remotePlaybackState:i,iOSControl
3s:s}=u(this,oi).$state,r=t();return s()||i()==="connected"||!r||!Kt(r)},iS=new WeakSet,qN=function(){if(!Ss.lib())return;const{viewType:t}=u(this,oi).$state;return t()==="audio"?m(this,sS,GN).call(this):m(this,aS,WN).call(this)},sS=new WeakSet,GN=function(){return D(m(this,nS,KN).bind(this)),m(this,pp,EC).call(this,null),()=>{this.el.textContent=""}},nS=new WeakSet,KN=function(){if(m(this,ru,wg).call(this))return;m(this,fp,bC).call(this);const{textTrack:t}=u(this,oi).$state;Fe(t(),"cue-change",m(this,fp,bC).bind(this)),D(m(this,rS,jN).bind(this))},fp=new WeakSet,bC=function(){this.el.textContent="",u(this,Un)>=0&&m(this,au,Cg).call(this);const{realCurrentTime:t,textTrack:i}=u(this,oi).$state,{renderVTTCueString:s}=Ss.lib(),r=Y(t),a=Y(i).activeCues;for(const o of a){const l=m(this,gp,_C).call(this),c=m(this,yp,AC).call(this);c.innerHTML=s(o,r),l.append(c),this.el.append(c)}},rS=new WeakSet,jN=function(){const{realCurrentTime:t}=u(this,oi).$state,{updateTimedVTTCueNodes:i}=Ss.lib();i(this.el,t())},aS=new WeakSet,WN=function(){const{CaptionsRenderer:t}=Ss.lib(),i=new t(this.el),s=new oG(i);return u(this,oi).textRenderers.add(s),D(m(this,oS,YN).bind(this,i)),D(m(this,lS,zN).bind(this,i)),m(this,pp,EC).call(this,i),()=>{this.el.textContent="",u(this,oi).textRenderers.remove(s),i.destroy()}},oS=new WeakSet,YN=function(t){t.dir=this.$props.textDir()},lS=new WeakSet,zN=function(t){var r;if(m(this,ru,wg).call(this))return;const{realCurrentTime:i,textTrack:s}=u(this,oi).$state;t.currentTime=i(),u(this,Un)>=0&&((r=s())!=null&&r.activeCues[0])&&m(this,au,Cg).call(this)},pp=new WeakSet,EC=function(t){const i=u(this,oi).player;if(!i)return;const s=m(this,cS,QN).bind(this,t);Fe(i,"vds-font-change",s)},cS=new WeakSet,QN=function(t){var s;if(u(this,Un)>=0){m(this,mp,SC).call(this);return}const{textTrack:i}=u(this,oi).$state;(s=i())!=null&&s.activeCues[0]?t==null||t.update(!0):m(this,uS,XN).call(this)},uS=new WeakSet,XN=function(){var s,r;const t=m(this,gp,_C).call(this);J(t,"data-example","");const i=m(this,yp,AC).call(this);J(i,"data-example",""),i.textContent=this.$props.exampleText(),t==null||t.append(i),(s=this.el)==null||s.append(t),(r=this.el)==null||r.setAttribute("data-example",""),m(this,mp,SC).call(this)},Un=new WeakMap,mp=new WeakSet,SC=function(){window.clearTimeout(u(this,Un)),A(this,Un,window.setTimeout(m(this,au,Cg).bind(this),2500))},au=new WeakSet,Cg=function(){var t,i;(t=this.el)==null||t.removeAttribute("data-example"),(i=this.el)!=null&&i.querySelector("[data-example]")&&(this.el.textContent=""),A(this,Un,-1)},gp=new WeakSet,_C=function(){const t=document.createElement("div");return J(t,"data-part","cue-display"),t},yp=new WeakSet,AC=function(){const t=document.createElement("div");return J(t,"data-part","cue"),t},L(Ss,"props",{textDir:"ltr",exampleText:"Captions look like this."}),L(Ss,"lib",ae(null));let TC=Ss;/**
4 * @license
5 * Copyright 2017 Google LLC
6 * SPDX-License-Identifier: BSD-3-Clause
7 */var Ix;const ly=window,qu=ly.trustedTypes,tR=qu?qu.createPolicy("lit-html",{createHTML:n=>n}):void 0,xC="$lit$",pr=`lit$${(Math.random()+"").slice(9)}$`,ZN="?"+pr,lG=`<${ZN}>`,hl=document,$h=()=>hl.createComment(""),Nh=n=>n===null||typeof n!="object"&&typeof n!="function",JN=Array.isArray,cG=n=>JN(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",kx=`[ 	
8\f\r]`,rh=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,iR=/-->/g,sR=/>/g,wa=RegExp(`>|${kx}(?:([^\\s"'>=/]+)(${kx}*=${kx}*(?:[^ 	
9\f\r"'\`<>=]|("|')|))|$)`,"g"),nR=/'/g,rR=/"/g,e4=/^(?:script|style|textarea|title)$/i,uG=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),hG=uG(1),Fh=Symbol.for("lit-noChange"),kt=Symbol.for("lit-nothing"),aR=new WeakMap,ja=hl.createTreeWalker(hl,129,null,!1);function t4(n,e){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return tR!==void 0?tR.createHTML(e):e}const dG=(n,e)=>{const t=n.length-1,i=[];let s,r=e===2?"<svg>":"",a=rh;for(let o=0;o<t;o++){const l=n[o];let c,h,d=-1,f=0;for(;f<l.length&&(a.lastIndex=f,h=a.exec(l),h!==null);)f=a.lastIndex,a===rh?h[1]==="!--"?a=iR:h[1]!==void 0?a=sR:h[2]!==void 0?(e4.test(h[2])&&(s=RegExp("</"+h[2],"g")),a=wa):h[3]!==void 0&&(a=wa):a===wa?h[0]===">"?(a=s??rh,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?wa:h[3]==='"'?rR:nR):a===rR||a===nR?a=wa:a===iR||a===sR?a=rh:(a=wa,s=void 0);const g=a===wa&&n[o+1].startsWith("/>")?" ":"";r+=a===rh?l+lG:d>=0?(i.push(c),l.slice(0,d)+xC+l.slice(d)+pr+g):l+pr+(d===-2?(i.push(void 0),o):g)}return[t4(n,r+(n[t]||"<?>")+(e===2?"</svg>":"")),i]};let LC=class i4{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[c,h]=dG(e,t);if(this.el=i4.createElement(c,i),ja.currentNode=this.el.content,t===2){const d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(s=ja.nextNode())!==null&&l.length<o;){if(s.nodeType===1){if(s.hasAttributes()){const d=[];for(const f of s.getAttributeNames())if(f.endsWith(xC)||f.startsWith(pr)){const g=h[a++];if(d.push(f),g!==void 0){const y=s.getAttribute(g.toLowerCase()+xC).split(pr),v=/([.?@])?(.*)/.exec(g);l.push({type:1,index:r,name:v[2],strings:y,ctor:v[1]==="."?pG:v[1]==="?"?gG:v[1]==="@"?yG:lx})}else l.push({type:6,index:r})}for(const f of d)s.removeAttribute(f)}if(e4.test(s.tagName)){const d=s.textContent.split(pr),f=d.length-1;if(f>0){s.textContent=qu?qu.emptyScript:"";for(let g=0;g<f;g++)s.append(d[g],$h()),ja.nextNode(),l.push({type:2,index:++r});s.append(d[f],$h())}}}else if(s.nodeType===8)if(s.data===ZN)l.push({type:2,index:r});else{let d=-1;for(;(d=s.data.indexOf(pr,d+1))!==-1;)l.push({type:7,index:r}),d+=pr.length-1}r++}}static createElement(e,t){const i=hl.createElement("template");return i.innerHTML=e,i}};function Gu(n,e,t=n,i){var s,r,a,o;if(e===Fh)return e;
vendor: 5,458 bytes, line 9
9let l=i!==void 0?(s=t._$Co)===null||s===void 0?void 0:s[i]:t._$Cl;const c=Nh(e)?void 0:e._$litDirective$;return(l==null?void 0:l.constructor)!==c&&((r=l==null?void 0:l._$AO)===null||r===void 0||r.call(l,!1),c===void 0?l=void 0:(l=new c(n),l._$AT(n,t,i)),i!==void 0?((a=(o=t)._$Co)!==null&&a!==void 0?a:o._$Co=[])[i]=l:t._$Cl=l),l!==void 0&&(e=Gu(n,l._$AS(n,e.values),l,i)),e}let fG=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:i},parts:s}=this._$AD,r=((t=e==null?void 0:e.creationScope)!==null&&t!==void 0?t:hl).importNode(i,!0);ja.currentNode=r;let a=ja.nextNode(),o=0,l=0,c=s[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new Im(a,a.nextSibling,this,e):c.type===1?h=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(h=new vG(a,this,e)),this._$AV.push(h),c=s[++l]}o!==(c==null?void 0:c.index)&&(a=ja.nextNode(),o++)}return ja.currentNode=hl,r}v(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}};class Im{constructor(e,t,i,s){var r;this.type=2,this._$AH=kt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cp=(r=s==null?void 0:s.isConnected)===null||r===void 0||r}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Gu(this,e,t),Nh(e)?e===kt||e==null||e===""?(this._$AH!==kt&&this._$AR(),this._$AH=kt):e!==this._$AH&&e!==Fh&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):cG(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==kt&&Nh(this._$AH)?this._$AA.nextSibling.data=e:this.$(hl.createTextNode(e)),this._$AH=e}g(e){var t;const{values:i,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=LC.createElement(t4(s.h,s.h[0]),this.options)),s);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===r)this._$AH.v(i);else{const a=new fG(r,this),o=a.u(this.options);a.v(i),this.$(o),this._$AH=a}}_$AC(e){let t=aR.get(e.strings);return t===void 0&&aR.set(e.strings,t=new LC(e)),t}T(e){JN(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const r of e)s===t.length?t.push(i=new Im(this.k($h()),this.k($h()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class lx{constructor(e,t,i,s,r){this.type=1,this._$AH=kt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=kt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,s){const r=this.strings;let a=!1;if(r===void 0)e=Gu(this,e,t,0),a=!Nh(e)||e!==this._$AH&&e!==Fh,a&&(this._$AH=e);else{const o=e;let l,c;for(e=r[0],l=0;l<r.length-1;l++)c=Gu(this,o[i+l],t,l),c===Fh&&(c=this._$AH[l]),a||(a=!Nh(c)||c!==this._$AH[l]),c===kt?e=kt:e!==kt&&(e+=(c??"")+r[l+1]),this._$AH[l]=c}a&&!s&&this.j(e)}j(e){e===kt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}let pG=class extends lx{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===kt?void 0:e}};const mG=qu?qu.emptyScript:"";class gG extends lx{constructor(){super(...arguments),this.type=4}j(e){e&&e!==kt?this.element.setAttribute(this.name,mG):this.element.removeAttribute(this.name)}}class yG extends lx{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){var i;if((e=(i=Gu(this,e,t,0))!==null&&i!==void 0?i:kt)===Fh)return;const s=this._$AH,r=e===kt&&s!==kt||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,a=e!==kt&&(s===kt||r);r&&this.element.removeEventListener(this.name,this,s),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class vG{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Gu(this,e)}}const oR=ly.litHtmlPolyfillSupport;oR==null||oR(LC,Im),((Ix=ly.litHtmlVersions)!==null&&Ix!==void 0?Ix:ly.litHtmlVersions=[]).push("2.8.0");const lR=(n,e,t)=>{var i,s;const r=(i=t==null?void 0:t.renderBefore)!==null&&i!==void 0?i:e;let a=r._$litPart$;if(a===void 0){const o=(s=t==null?void 0:t.renderBefore)!==null&&s!==void 0?s:null;r._$litPart$=a=new Im(e.insertBefore($h(),o),o,void 0,t??{})}return a._$AI(n),a};class TG extends HTMLElement{constructor(){super(...arguments);L(this,"rootPart",null)}connectedCallback(){this.rootPart=lR(this.render(),this,{renderBefore:this.firstChild}),this.rootPart.setConnected(!0)}disconnectedCallback(){var t;(t=this.rootPart)==null||t.setConnected(!1),this.rootPart=null,lR(null,this)}}
9const bG=hk('<img loading="eager" decoding="async" aria-hidden="true">');var hS,zr,dS,s4;class cy extends le(HTMLElement,Ow){constructor(){super(...arguments);p(this,dS);p(this,hS,void 0);p(this,zr,m(this,dS,s4).call(this))}onSetup(){A(this,hS,Te()),this.$state.img.set(u(this,zr))}onConnect(){const{src:t,crossOrigin:i}=this.$state;u(this,zr).parentNode!==this&&this.prepend(u(this,zr)),D(()=>{J(u(this,zr),"src",t()),J(u(this,zr),"crossorigin",i())})}}hS=new WeakMap,zr=new WeakMap,dS=new WeakSet,s4=function(){return dk(bG)},L(cy,"tagName","media-thumbnail"),L(cy,"attrs",{crossOrigin:"crossorigin"});class n4 extends le(HTMLElement,Zw){onConnect(){D(()=>{this.textContent=this.$state.timeText()})}}L(n4,"tagName","media-time");class r4 extends le(HTMLElement,pO){}L(r4,"tagName","media-airplay-button");class a4 extends le(HTMLElement,EO){}L(a4,"tagName","media-caption-button");class o4 extends le(HTMLElement,_O){}L(o4,"tagName","media-fullscreen-button");class l4 extends le(HTMLElement,$O){}L(l4,"tagName","media-live-button");class c4 extends le(HTMLElement,LO){}L(c4,"tagName","media-mute-button");class u4 extends le(HTMLElement,IO){}L(u4,"tagName","media-pip-button");class h4 extends le(HTMLElement,TO){}L(h4,"tagName","media-play-button");class d4 extends le(HTMLElement,PO){}L(d4,"tagName","media-seek-button");function eh(n,e){Zn(()=>{if(!n.connectScope)return;const t=n.querySelector("template");t&&D(()=>{const i=n.getOptions();uk(t,i.length,(s,r)=>{const{label:a,value:o}=i[r],l=s.querySelector('[data-part="label"]');s.setAttribute("value",o),l&&(te(a)?l.textContent=a:D(()=>{l.textContent=a()})),e==null||e(s,i[r],r)})})})}class f4 extends le(HTMLElement,vk){onConnect(){eh(this)}}L(f4,"tagName","media-audio-radio-group");class p4 extends le(HTMLElement,bk){onConnect(){eh(this)}}L(p4,"tagName","media-captions-radio-group");class m4 extends le(HTMLElement,Tl){}L(m4,"tagName","media-menu");class g4 extends le(HTMLElement,ax){}L(g4,"tagName","media-menu-button");class y4 extends le(HTMLElement,Qq){}L(y4,"tagName","media-menu-item");class v4 extends le(HTMLElement,A$){}L(v4,"tagName","media-menu-items");class T4 extends le(HTMLElement,Sk){onConnect(){eh(this)}}L(T4,"tagName","media-speed-radio-group");class b4 extends le(HTMLElement,Ak){onConnect(){eh(this,(e,t)=>{const i=t.bitrate,s=e.querySelector('[data-part="bitrate"]');i&&s&&D(()=>{s.textContent=i()||""})})}}L(b4,"tagName","media-quality-radio-group");class E4 extends le(HTMLElement,yk){}L(E4,"tagName","media-radio");var vp,Tp,fS,_4;class S4 extends cy{constructor(){super(...arguments);p(this,fS);p(this,vp,void 0);p(this,Tp,void 0)}onSetup(){super.onSetup(),A(this,vp,Te()),A(this,Tp,Qu(ul.state))}onConnect(){super.onConnect(),D(m(this,fS,_4).bind(this))}}vp=new WeakMap,Tp=new WeakMap,fS=new WeakSet,_4=function(){const{duration:t,clipStartTime:i}=u(this,vp).$state;this.time=i()+u(this,Tp).pointerRate()*t()},L(S4,"tagName","media-slider-thumbnail");class wC extends le(HTMLElement,gk){onConnect(){D(()=>{this.textContent=this.getValueText()})}}L(wC,"tagName","media-slider-value"),L(wC,"attrs",{padMinutes:{converter:I2}});class A4 extends le(HTMLElement,ay){}L(A4,"tagName","media-time-slider");class x4 extends le(HTMLElement,_M){}L(x4,"tagName","media-slider-preview");class L4 extends le(HTMLElement,Fw){}L(L4,"tagName","media-volume-slider");class w4 extends le(HTMLElement,TC){}L(w4,"tagName","media-captions");class C4 extends le(HTMLElement,NN){}L(C4,"tagName","media-gesture");class I4 extends le(HTMLElement,tC){}L(I4,"tagName","media-announcer");class k4 extends le(HTMLElement,m9){}L(k4,"tagName","media-controls");class R4 extends le(HTMLElement,Jq){}L(R4,"tagName","media-controls-group");class EG extends oe{}var bp,pS,D4;class P4 extends le(HTMLElement,EG){constructor(){super(...arguments);p(this,pS);p(this,bp,void 0)}onSetup(){A(this,bp,Te())}onConnect(){D(m(this,pS,D4).bind(this))}}bp=new WeakMap,pS=new WeakSet,D4=function(){const{title:t}=u(this,bp).$state;this.textContent=t()},L(P4,"tagName","media-title");class O4 extends oe{}L(O4,"props",{defaultText:""});var Ep,ou,mS,$4;class M4 extends le(HTMLElement,O4){constructor(){super(...arguments);p(this,mS);p(this,Ep,void 0);p(this,ou,void 0)}onSetup(){A(this,Ep,Te()),A(this,ou,ae(""))}onConnect(){const t=u(this,Ep).textTracks;UV(t,"chapters",u(this,ou).set),D(m(this,mS,$4).bind(this))}}Ep=new WeakMap,ou=new WeakMap,mS=new WeakSet,$4=function(){const{defaultText:t}=this.$props;this.textContent=u(this,ou).call(this)||t()},L(M4,"tagName","media-chapter-title");var gS,F4;class N4 extends oe{constructor(){super(...arguments);p(this,gS)}onConnect(t){Zn(()=>
9{if(!this.connectScope)return;const i=t.querySelector("svg"),s=i.firstElementChild,r=s.nextElementSibling;D(m(this,gS,F4).bind(this,i,s,r))})}}gS=new WeakSet,F4=function(t,i,s){const{size:r,trackWidth:a,fillPercent:o}=this.$props;J(t,"width",r()),J(t,"height",r()),J(i,"stroke-width",a()),J(s,"stroke-width",a()),J(s,"stroke-dashoffset",100-o())},L(N4,"props",{size:96,trackWidth:8,fillPercent:50});class B4 extends le(TG,N4){render(){return hG`
10      <svg fill="none" viewBox="0 0 120 120" aria-hidden="true" data-part="root">
11        <circle cx="60" cy="60" r="54" stroke="currentColor" data-part="track"></circle>
12        <circle
13          cx="60"
14          cy="60"
15          r="54"
16          stroke="currentColor"
17          pathLength="100"
18          stroke-dasharray="100"
19          data-part="track-fill"
20        ></circle>
21      </svg>
22    `}}L(B4,"tagName","media-spinner");class U4 extends oe{}L(U4,"props",{when:!1});var Sp,yS,H4;class V4 extends le(HTMLElement,U4){constructor(){super(...arguments);p(this,yS);p(this,Sp,void 0)}onSetup(){A(this,Sp,Te())}onConnect(){D(m(this,yS,H4).bind(this))}}Sp=new WeakMap,yS=new WeakSet,H4=function(){const t=this.firstElementChild,i=(t==null?void 0:t.localName)==="template",s=this.$props.when();if(!(b2(s)?s:ds(()=>s(u(this,Sp).player.state))())){i?(this.textContent="",this.appendChild(t)):cl(t)&&(t.style.display="none");return}i?this.append(t.content.cloneNode(!0)):cl(t)&&(t.style.display="")},L(V4,"tagName","media-layout");class q4 extends le(HTMLElement,C9){}L(q4,"tagName","media-google-cast-button");class G4 extends le(HTMLElement,Lk){}L(G4,"tagName","media-toggle-button");class K4 extends le(HTMLElement,v9){}L(K4,"tagName","media-tooltip");class j4 extends le(HTMLElement,tG){onConnect(){this.style.display="contents"}}L(j4,"tagName","media-tooltip-trigger");class W4 extends le(HTMLElement,x9){}L(W4,"tagName","media-tooltip-content");class CC extends le(HTMLElement,b$){}L(CC,"tagName","media-menu-portal"),L(CC,"attrs",{disabled:{converter(e){return te(e)?e:e!==null}}});class Y4 extends le(HTMLElement,Cm){onConnect(){eh(this,(e,t)=>{const{cue:i,startTime:s,duration:r}=t,a=e.querySelector(".vds-thumbnail,media-thumbnail"),o=e.querySelector('[data-part="start-time"]'),l=e.querySelector('[data-part="duration"]');o&&(o.textContent=s),l&&(l.textContent=r),a&&(a.setAttribute("time",i.startTime+""),D(()=>{const c=this.$props.thumbnails();"src"in a?a.src=c:te(c)&&a.setAttribute("src",c)}))})}}L(Y4,"tagName","media-chapters-radio-group");class z4 extends le(HTMLElement,kk){onConnect(){eh(this)}}L(z4,"tagName","media-audio-gain-radio-group");class Q4 extends le(HTMLElement,Ck){}L(Q4,"tagName","media-radio-group");class X4 extends le(HTMLElement,ul){}L(X4,"tagName","media-slider");const SG=hk('<video muted playsinline preload="none" style="max-width: unset;"></video>');var _p,Vn,vS,J4;class Z4 extends le(HTMLElement,oy){constructor(){super(...arguments);p(this,vS);p(this,_p,void 0);p(this,Vn,m(this,vS,J4).call(this))}onSetup(){A(this,_p,Te()),this.$state.video.set(u(this,Vn))}onConnect(){const{canLoad:t}=u(this,_p).$state,{src:i,crossOrigin:s}=this.$state;u(this,Vn).parentNode!==this&&this.prepend(u(this,Vn)),D(()=>{J(u(this,Vn),"crossorigin",s()),J(u(this,Vn),"preload",t()?"auto":"none"),J(u(this,Vn),"src",i())})}}_p=new WeakMap,Vn=new WeakMap,vS=new WeakSet,J4=function(){return dk(SG)},L(Z4,"tagName","media-slider-video");class eF extends le(HTMLElement,lC){}L(eF,"tagName","media-audio-gain-slider");class tF extends le(HTMLElement,uC){}L(tF,"tagName","media-speed-slider");class iF extends le(HTMLElement,hC){}L(iF,"tagName","media-quality-slider");var lu,TS,nF;class sF extends le(HTMLElement,wk){constructor(){super(...arguments);p(this,TS);p(this,lu,null)}onConnect(){Zn(()=>{if(!this.connectScope)return;const t=this.querySelector("template");t&&(A(this,lu,t),D(m(this,TS,nF).bind(this)))})}}lu=new WeakMap,TS=new WeakSet,nF=function(){if(!u(this,lu))return;const t=uk(u(this,lu),this.cues.length||1);this.setRefs(t)},L(sF,"tagName","media-slider-chapters");class _G extends oe{}
22var Bo,bS,aF;class rF extends le(HTMLElement,_G){constructor(){super(...arguments);p(this,bS);p(this,Bo,null)}onConnect(t){Zn(()=>{this.connectScope&&(A(this,Bo,t.querySelector("template")),u(this,Bo)&&D(m(this,bS,aF).bind(this)))})}}Bo=new WeakMap,bS=new WeakSet,aF=function(){if(!u(this,Bo))return;const{min:t,max:i,step:s}=Qu(vl),r=(i()-t())/s();uk(u(this,Bo),Math.floor(r)+1)},L(rF,"tagName","media-slider-steps");var Pi,Ap,kC,ES,oF,xp,RC,SS,lF,_S,cF,Lp,wp,PC,Cp,DC,Ip,OC,AS,uF,kp,MC,xS,hF;class IC extends oe{constructor(){super(...arguments);p(this,Ap);p(this,ES);p(this,xp);p(this,SS);p(this,_S);p(this,wp);p(this,Cp);p(this,Ip);p(this,AS);p(this,kp);p(this,xS);p(this,Pi,void 0);p(this,Lp,"")}onSetup(){A(this,Pi,Te()),m(this,wp,PC).call(this),m(this,Cp,DC).call(this),m(this,Ip,OC).call(this),m(this,xp,RC).call(this)}onAttach(t){t.style.setProperty("pointer-events","none"),D(m(this,_S,cF).bind(this)),D(m(this,wp,PC).bind(this)),D(m(this,Cp,DC).bind(this)),D(m(this,Ip,OC).bind(this)),D(m(this,xp,RC).bind(this));const{started:i}=u(this,Pi).$state;this.setAttributes({"data-visible":()=>!i()&&!this.$state.hidden(),"data-loading":m(this,SS,lF).bind(this),"data-error":m(this,Ap,kC).bind(this),"data-hidden":this.$state.hidden})}onConnect(t){D(m(this,ES,oF).bind(this)),D(m(this,AS,uF).bind(this))}}Pi=new WeakMap,Ap=new WeakSet,kC=function(){const{error:t}=this.$state;return!Ys(t())},ES=new WeakSet,oF=function(){const{canLoadPoster:t,poster:i}=u(this,Pi).$state;!t()&&i()&&tr(i(),"preconnect")},xp=new WeakSet,RC=function(){const{src:t}=this.$props,{poster:i,nativeControls:s}=u(this,Pi).$state;this.el&&J(this.el,"display",s()?"none":null),this.$state.hidden.set(m(this,Ap,kC).call(this)||!(t()||i())||s())},SS=new WeakSet,lF=function(){const{loading:t,hidden:i}=this.$state;return!i()&&t()},_S=new WeakSet,cF=function(){const t=this.$state.img();t&&(new Ve(t).add("load",m(this,kp,MC).bind(this)).add("error",m(this,xS,hF).bind(this)),t.complete&&m(this,kp,MC).call(this))},Lp=new WeakMap,wp=new WeakSet,PC=function(){const{poster:t}=u(this,Pi).$props,{canLoadPoster:i,providedPoster:s,inferredPoster:r}=u(this,Pi).$state,a=this.$props.src()||"",o=a||t()||r();u(this,Lp)===s()&&s.set(a),this.$state.src.set(i()&&o.length?o:null),A(this,Lp,a)},Cp=new WeakSet,DC=function(){const{src:t}=this.$props,{alt:i}=this.$state,{poster:s}=u(this,Pi).$state;i.set(t()||s()?this.$props.alt():null)},Ip=new WeakSet,OC=function(){const{crossOrigin:t}=this.$props,{crossOrigin:i}=this.$state,{crossOrigin:s,poster:r}=u(this,Pi).$state,a=t()!==null?t():s();i.set(/ytimg\.com|vimeo/.test(r()||"")?null:a===!0?"anonymous":a)},AS=new WeakSet,uF=function(){const{loading:t,error:i}=this.$state,{canLoadPoster:s,poster:r}=u(this,Pi).$state;t.set(s()&&!!r()),i.set(null)},kp=new WeakSet,MC=function(){const{loading:t,error:i}=this.$state;t.set(!1),i.set(null)},xS=new WeakSet,hF=function(t){const{loading:i,error:s}=this.$state;i.set(!1),s.set(t)},L(IC,"props",{src:null,alt:null,crossOrigin:null}),L(IC,"state",new Ea({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1}));var Fs;class $C extends le(HTMLElement,IC){constructor(){super(...arguments);p(this,Fs,document.createElement("img"))}onSetup(){this.$state.img.set(u(this,Fs))}onConnect(){const{src:t,alt:i,crossOrigin:s}=this.$state;D(()=>{const{loading:r,hidden:a}=this.$state;u(this,Fs).style.display=r()||a()?"none":""}),D(()=>{J(u(this,Fs),"alt",i()),J(u(this,Fs),"crossorigin",s()),J(u(this,Fs),"src",t())}),u(this,Fs).parentNode!==this&&this.prepend(u(this,Fs))}}Fs=new WeakMap,L($C,"tagName","media-poster"),L($C,"attrs",{crossOrigin:"crossorigin"});re(V4);re(k4);re(R4);re($C);re(I4);re(K4);re(j4);re(W4);re(h4);re(c4);re(a4);re(o4);re(u4);re(d4);re(r4);re(q4);re(G4);re(X4);re(eF);re(L4);re(A4);re(tF);re(iF);re(sF);re(rF);re(x4);re(wC);re(S4);re(Z4);re(m4);re(g4);re(CC);re(v4);re(y4);re(f4);re(p4);re(T4);re(z4);re(b4);re(Y4);re(Q4);re(E4);re(C4);re(cy);re(w4);re(l4);re(n4);re(P4);re(M4);re(B4);const cR={play:()=>se(()=>Promise.resolve().then(()=>KW),void 0,import.meta.url),pause:()=>se(()=>Promise.resolve().then(()=>WW),void 0,import.meta.url),mute:()=>se(()=>Promise.resolve().then(()=>zW),void 0,import.meta.url),"volume-low":()=>se(()=>Promise.resolve().then(()=>XW),void 0,import.meta.url),"volume-high":()=>se(()=>Promise.resolve().then(()=>JW),void 0,import.meta.url),"seek-backward-10":()=>se(()=>Promise.resolve().then(()=>tY),void 0,import.meta.url),"seek-forward-10":()=>se(()=>Promise.resolve().then(()=>sY),void 0,import.meta.url),next:()=>se(()=>Promise.resolve().then(()=>rY),void 0,import.meta.url),previous:()=>se(()=>Promise.resolve().then(()=>oY),void 0,import.meta.url),"picture-in-picture":()=>se(()=>Promise.resolve().then(()=>cY),void 0,import.meta.url),"picture-in-picture-exit":()=>se(()=>Promise.resolve().then(()=>hY),void 0,import.meta.url),fullscreen:()=>se(()=>Promise.resolve().then(()=>fY),void 0,import.meta.url),"fullscreen-exit":()=>se(()=>Promise.resolve().then(()=>mY),void 0,import.meta.url),settings:()=>se(()=>Promise.resolve().then(()=>yY),void 0,import.meta.url),accessibility:()=>se(()=>Promise.resolve().then(()=>TY),void 0,import.meta.url),"closed-captions":()=>se(()=>Promise.resolve().then(()=>EY),void 0,import.meta.url),"closed-captions-on":()=>se(()=>Promise.resolve().then(()=>_Y),void 0,import.meta.url),subtitles:()=>se(()=>Promise.resolve().then(()=>xY),void 0,import.meta.url),odometer:()=>se(()=>Promise.resolve().then(()=>wY),void 0,import.meta.url),chapters:()=>se(()=>Promise.resolve().then(()=>IY),void 0,import.meta.url),"chevron-right":()=>se(()=>Promise.resolve().then(()=>RY),void 0,import.meta.url),"chevron-down":()=>se(()=>Promise.resolve().then(()=>DY),void 0,import.meta.url),"chevron-left":()=>se(()=>Promise.resolve().then(()=>MY),void 0,import.meta.url),check:()=>se(()=>Promise.resolve().then(()=>NY),void 0,import.meta.url),search:()=>se(()=>Promise.resolve().then(()=>BY),void 0,import.meta.url),"x-mark":()=>se(()=>Promise.resolve().then(()=>VY),void 0,import.meta.url),playlist:()=>se(()=>Promise.resolve().then(()=>DR),void 0,import.meta.url),info:()=>se(()=>Promise.resolve().then(()=>DR),void 0,import.meta.url)};function AG(n){const e=document.createElement("template");return e.innerHTML=n,e.content}function xG(n){return n.cloneNode(!0).firstElementChild}
22const LG=AG('<svg width="100%" height="100%" viewBox="0 0 32 32" fill="none" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"></svg>');class wG extends HTMLElement{constructor(){super(),this._svg=this._createSVG(),this._type=null}static get observedAttributes(){return["type"]}get type(){return this._type}set type(e){this._type!==e&&(e?this.setAttribute("type",e):this.removeAttribute("type"),this._onTypeChange(e))}attributeChangedCallback(e,t,i){if(e==="type"){const s=i||null;this._type!==s&&this._onTypeChange(s)}}connectedCallback(){this.classList.add("vds-icon"),this._svg.parentNode!==this&&this.prepend(this._svg)}_createSVG(){return xG(LG)}_loadIcon(){const e=this._type;e&&cR[e]?cR[e]().then(({default:t})=>{e===this._type&&this._onPathsChange(t)}):this._onPathsChange("")}_onTypeChange(e){this._type=e,this._loadIcon()}_onPathsChange(e){this._svg.innerHTML=e}}window.customElements.get("media-icon")||window.customElements.define("media-icon",wG);function Re(n){var r;n=(((r=window.fluent_player)==null?void 0:r.trans)||{})[n]||n;const t=Array.prototype.slice.call(arguments,1);if(t.length===0)return n;const i=/%(\d+)?\$?([sd])/g;let s=0;return n=n.replace(i,(a,o,l)=>{if(o){const c=parseInt(o,10)-1;return c>=0&&c<t.length?t[c]:a}else return s<t.length?t[s++]:a}),n}const Rx={1:{title:"Playback aborted",detail:"Video playback was interrupted."},2:{title:"Network error",detail:"Please check your internet connection and try again."},3:{title:"Playback error",detail:"The video could not be decoded. The file may be corrupted."},4:{title:"Video unavailable",detail:"The video source could not be loaded. Please verify the video URL is correct."}},CG=[{test:n=>n.includes("network")||n.includes("fetch"),title:"Network error",detail:"Please check your internet connection and try again."},{test:n=>n.includes("404")||n.includes("not found"),title:"Video not found",detail:"The requested video could not be found."},{test:n=>n.includes("403")||n.includes("forbidden"),title:"Access denied",detail:"You do not have permission to view this video."},{test:n=>n.includes("401")||n.includes("unauthorized"),title:"Authentication required",detail:"You need to be signed in to view this video."},{test:n=>n.includes("timeout")||n.includes("timed out"),title:"Request timed out",detail:"The server took too long to respond. Please try again."},{test:n=>n.includes("hls")||n.includes("manifest"),title:"Streaming error",detail:"Unable to load video stream. Please try again."},{test:n=>n.includes("decode")||n.includes("format")||n.includes("codec"),title:"Format not supported",detail:"This video format is not supported by your browser."},{test:n=>n.includes("cors")||n.includes("cross-origin"),title:"Video blocked",detail:"The video could not be loaded due to cross-origin restrictions."},{test:n=>n.includes("500")||n.includes("server error"),title:"Server error",detail:"The video server encountered an error. Please try again later."}
22],IG=`<svg class="fluent-player-error-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
23    <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"/>
24    <line x1="12" y1="8" x2="12" y2="13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
25    <circle cx="12" cy="16.5" r="1" fill="currentColor" stroke="none"/>
26</svg>`;function kG(n){var t;if(!n)return{title:Re("Unable to play video"),detail:Re("Please check your internet connection or verify the video source.")};const e=(n==null?void 0:n.code)??((t=n==null?void 0:n.detail)==null?void 0:t.code);if(e&&Rx[e])return{title:Re(Rx[e].title),detail:Re(Rx[e].detail)};if(n!=null&&n.message){const i=n.message.toLowerCase();for(const s of CG)if(s.test(i))return{title:Re(s.title),detail:Re(s.detail)}}return{title:Re("Unable to play video"),detail:Re("Please check your internet connection or verify the video source.")}}function RG(n){const e=document.createElement("div");e.className="fluent-player-error-overlay";const t=document.createElement("div");
26t.className="fluent-player-error-content",t.innerHTML=IG;const i=document.createElement("div");i.className="fluent-player-error-title",i.textContent=n.title||"";const s=document.createElement("div");s.className="fluent-player-error-detail",s.textContent=n.detail||"";const r=document.createElement("button");return r.className="fluent-player-error-retry",r.textContent=Re("Try Again"),t.appendChild(i),t.appendChild(s),t.appendChild(r),e.appendChild(t),e}function uR(n){var t;return(t=n==null?void 0:n.email_capture)!=null&&t.enabled?!0:(Array.isArray(n==null?void 0:n.layers)?n.layers:[]).some(i=>i&&(i.type==="email"||i.type==="cta"&&i.cta_type==="email"))}function PG(n){const e=(n==null?void 0:n.type)||"";return e==="cta"&&(n==null?void 0:n.cta_type)==="email"?"email":e}function DG(n,e,t=[]){if(!n||!n.active)return null;const i=n.media||{},s=i[e]||i[String(e)]||{},r=n.any||{},a={...r.layers||{}},o=Array.isArray(r.layers_all)?r.layers_all:[],l=r.layer_types||{};if(o.length||Object.keys(l).length)for(const c of Array.isArray(t)?t:[]){const h=c==null?void 0:c.id;if(!h)continue;const d=[...o,...l[PG(c)]||[]];d.length&&(a[String(h)]=Array.from(new Set([...a[String(h)]||[],...d])))}for(const[c,h]of Object.entries(s.layers||{})){const d=a[c]||[];a[c]=Array.from(new Set([...d,...Array.isArray(h)?h:[]]))}return Object.keys(a).length?a:null}function OG(n,e){if(!n||!n.active)return null;const t=n.media||{},i=t[e]||t[String(e)]||null,s=n.any||null;if(!i&&!s)return null;const r=i||{},a=s||{},o=(l,c)=>Array.from(new Set([...Array.isArray(l)?l:[],...Array.isArray(c)?c:[]]));return{started:!!(r.started||a.started),quartiles:o(r.quartiles,a.quartiles),completions:o(r.completions,a.completions)}}function dF(){var n;return window.fluent_player||((n=window.fluentCommunityPortalVars)==null?void 0:n.fluent_player)||{}}function Pk(){const n=dF().ajax_url;return n||(console.error("FluentPlayer: ajax_url not found. Please ensure wp_localize_script is called properly."),null)}function fF(){return dF().nonce||""}function Dk(n,e={}){const t=new FormData;t.append("action",n);const i=e.nonce||fF();t.append("nonce",i);for(const[s,r]of Object.entries(e))s!=="nonce"&&r!==void 0&&r!==null&&t.append(s,r);return t}async function pF(n,e={}){const t=Pk();if(!t)return null;const i=Dk(n,e);return(await fetch(t,{method:"POST",body:i})).json()}let ah=null;const Px=new Set(["viewer.is_logged_in","viewer.is_crm_contact","viewer.email_submitted","layer.seen","layer.completed"]);function mF(n){return!!(n!=null&&n.enabled)&&Array.isArray(n==null?void 0:n.rules)&&n.rules.length>0}function MG(n={},e={}){return{...n,...e,viewer:{...n.viewer||{},...e.viewer||{}},page:{...n.page||{},...e.page||{},query:{...n.page&&n.page.query||{},...e.page&&e.page.query||{}}},layer:{...n.layer||{},...e.layer||{}}}}function $G(n,e={}){if(!mF(n))return!0;const t=n.rules.map(i=>FG(i,e));return n.match==="any"?t.some(Boolean):t.every(Boolean)}function NG(n,e={}){var t,i,s,r,a,o,l;switch(n.field){case"viewer.is_logged_in":return!!((t=e==null?void 0:e.viewer)!=null&&t.is_logged_in);case"viewer.is_crm_contact":return!!((i=e==null?void 0:e.viewer)!=null&&i.is_crm_contact);case"viewer.crm_tag":return Array.isArray((s=e==null?void 0:e.viewer)==null?void 0:s.crm_tags)?e.viewer.crm_tags:[];case"viewer.crm_list":return Array.isArray((r=e==null?void 0:e.viewer)==null?void 0:r.crm_lists)?e.viewer.crm_lists:[];case"viewer.email_submitted":return!!((a=e==null?void 0:e.viewer)!=null&&a.email_submitted);case"layer.seen":return!!((o=e==null?void 0:e.layer)!=null&&o.seen);case"layer.completed":return!!((l=e==null?void 0:e.layer)!=null&&l.completed);case"page.query":return BG(n.key,e);default:return null}}function FG(n,e){const t=NG(n,e),i=Px.has(n.field)?UG(n.value):rn(n.value);switch(n.operator){case"=":return Array.isArray(t)?t.map(rn).includes(rn(i)):Px.has(n.field)?!!t===i:rn(t)===i;case"!=":return Array.isArray(t)?!t.map(rn).includes(rn(i)):Px.has(n.field)?!!t!==i:rn(t)!==i;case"contains":{const s=rn(t).toLowerCase(),r=rn(i).toLowerCase();return!s||!r?!1:s.includes(r)}default:return!1}}function BG(n,e){var t;return n?(t=e==null?void 0:e.page)!=null&&t.query&&Object.prototype.hasOwnProperty.call(e.page.query,n)?e.page.query[n]:typeof window>"u"||!window.location?null:(ah===null&&(ah={},new URLSearchParams(window.location.search||"").forEach((s,r)=>{ah[r]=s})),Object.prototype.hasOwnProperty.call(ah,n)?ah[n]:null):null}function rn(n){return n==null?"":String(n)}function UG(n){if(typeof n=="boolean")return n;if(typeof n=="number")return n!==0;
26if(typeof n=="string"){const e=n.trim().toLowerCase();if(e==="true"||e==="1")return!0;if(e==="false"||e==="0"||e==="")return!1}return!!n}const VG=200,HG=5e3;let Nl=null,hR=!1;function dR(){return typeof window<"u"&&typeof window.gtag=="function"}function qG(n){return n.ready?Nl=Promise.resolve(n):Nl=null,n}function GG({pollIntervalMs:n=VG,pollMaxMs:e=HG}={}){return dR()?Promise.resolve({ready:!0,source:"existing"}):Nl||(Nl=new Promise(t=>{const i=Date.now()+e;let s=null;const r=o=>{s&&(clearInterval(s),s=null),t(qG(o))},a=()=>{if(dR()){r({ready:!0,source:"existing"});return}Date.now()<i||(s&&(clearInterval(s),s=null),r({ready:!1,source:null}))};s=setInterval(a,n),a()}),Nl)}function KG(){return hR?!1:(hR=!0,!0)}function jG(n){if(!n)return;n.querySelectorAll("media-play-button, media-mute-button, media-fullscreen-button, media-seek-button").forEach(i=>{i.removeAttribute("disabled"),i.setAttribute("tabindex","0")});const t=n.querySelector("media-time-slider");t&&(t.removeAttribute("disabled"),t.setAttribute("tabindex","0"),t.style.pointerEvents="auto")}function WG(n){if(!n)return;n.querySelectorAll("media-play-button, media-mute-button, media-fullscreen-button, media-seek-button").forEach(i=>{i.setAttribute("disabled","true"),i.setAttribute("tabindex","-1")});const t=n.querySelector("media-time-slider");t&&(t.setAttribute("disabled","true"),t.setAttribute("tabindex","-1"),t.style.pointerEvents="none")}function gF(n,e){if(!n||!e||typeof n!="string")return n;let t="";const i=n.indexOf("#");i!==-1&&(t=n.slice(i),n=n.slice(0,i));const s=n.indexOf("?");let r=n,a=[];s!==-1&&(r=n.slice(0,s),a=n.slice(s+1).split("&").filter(l=>{if(!l)return!1;const c=decodeURIComponent(l.split("=")[0]).toLowerCase();return c!=="token"&&c!=="expires"&&c!=="token_path"}));const o=a.length?a.join("&")+"&"+e:e;return r+"?"+o+t}function YG(n,e){!n||n.type!=="hls"||!e||(n.config={...n.config,xhrSetup:(t,i)=>{i&&t.open("GET",gF(i,e),!0)}})}function zG(n){var t,i;if(!n||n.type!=="youtube")return;const e=((i=(t=window.fluent_player)==null?void 0:t.youtube)==null?void 0:i.privacy_mode)||!1;n.cookies=!e}function QG(n){var t,i;if(!n||n.type!=="vimeo")return;const e=((i=(t=window.fluent_player)==null?void 0:t.vimeo)==null?void 0:i.privacy_mode)??!0;n.cookies=!e}function fR(n){var e;!n||n.type!=="youtube"&&n.type!=="vimeo"||(e=n.iframe)==null||e.setAttribute("referrerpolicy","strict-origin-when-cross-origin")}function pR(n){var t,i;return!n||!(((i=(t=window.fluent_player)==null?void 0:t.youtube)==null?void 0:i.privacy_mode)||!1)?n:n.replace(/^https?:\/\/img\.youtube\.com\//i,"https://i.ytimg.com/")}const XG=["subtitles","captions"],Bh="https://player.vimeo.com";function uy(n,e){return JSON.stringify(e===void 0?{method:n}:{method:n,value:e})}function ZG(n){for(const e of n||[])if(XG.includes(e.kind)&&e.mode==="showing")return e.language||"";return""}function yF(n){var e;return((e=n==null?void 0:n.querySelector)==null?void 0:e.call(n,'iframe[src*="vimeo.com"]'))||null}
26function JG(n,e,t="subtitles"){n!=null&&n.contentWindow&&(e?n.contentWindow.postMessage(uy("enableTextTrack",{language:e,kind:t}),Bh):n.contentWindow.postMessage(uy("disableTextTrack"),Bh))}function eK(n,{findIframe:e=yF,hasPro:t=typeof window<"u"?(i=>(i=window.fluent_player)==null?void 0:i.has_pro)():!1}={}){var r;if(!t||!(n!=null&&n.textTracks))return;const s=()=>{const a=e(n);return a?(JG(a,ZG(n.textTracks)),!0):!1};if(((r=n.dataset)==null?void 0:r.fpVimeoCaptionSync)!=="done"&&(n.dataset&&(n.dataset.fpVimeoCaptionSync="done"),n.textTracks.addEventListener("mode-change",s)),!s()&&typeof setInterval=="function"){let a=0;const o=setInterval(()=>{(s()||++a>=15)&&clearInterval(o)},1e3)}}function tK({canSetPlaybackRate:n}={}){return!!n}function iK(n){return Number(n)>1}function mR(n,e,t){const i=n.querySelector(e),s=i==null?void 0:i.closest("media-menu");s&&(s.style.display=t?"":"none")}function gR(n){var i,s;if(!n||((i=n.provider)==null?void 0:i.type)!=="vimeo")return;const e=n.canSetPlaybackRate??((s=n.state)==null?void 0:s.canSetPlaybackRate);mR(n,"media-speed-radio-group",tK({canSetPlaybackRate:e}));const t=[...n.qualities||[]].length;mR(n,"media-quality-radio-group",iK(t))}function sK({auto:n,height:e}={}){return n?"auto":e?`${e}p`:"auto"}function nK(n,e=1500){return new Promise(t=>{let i=!1,s=null;const r=o=>{i||(i=!0,window.removeEventListener("message",a),clearTimeout(s),t(o))},a=o=>{if(!(o.origin!==Bh||o.source!==n.contentWindow))try{const l=JSON.parse(o.data);(l==null?void 0:l.method)==="getQuality"&&r(l.value)}catch{}};window.addEventListener("message",a),n.contentWindow.postMessage(uy("getQuality"),Bh),s=setTimeout(()=>r(null),e)})}function rK(n,e){n.querySelectorAll("media-quality-radio-group media-radio").forEach(t=>{var i;(i=t.textContent)!=null&&i.trim().startsWith(`${e}p`)&&(t.style.display="none")})}function aK(n,{findIframe:e=yF}={}){var r,a;if(!(n!=null&&n.qualities)||((r=n.provider)==null?void 0:r.type)!=="vimeo"||((a=n.dataset)==null?void 0:a.fpVimeoQuality)==="done")return;n.dataset&&(n.dataset.fpVimeoQuality="done");let t=0,i=Promise.resolve();const s=async()=>{var y,v,T;const o=e(n);if(!(o!=null&&o.contentWindow))return;const l=!!((y=n.qualities)!=null&&y.auto),c=(T=(v=n.qualities)==null?void 0:v.selected)==null?void 0:T.height,h=sK({auto:l,height:c});o.contentWindow.postMessage(uy("setQuality",h),Bh);const d=++t;if(l)return;const f=i,g=(async()=>{var E,_;if(await f,d!==t)return;const b=await nK(o);d===t&&b&&b!==h&&(rK(n,c),(_=(E=n.qualities)==null?void 0:E.autoSelect)==null||_.call(E))})();i=g,await g};n.addEventListener("quality-change",s)}const Ca={enabled:!0,items:{copy_link:!0,copy_link_at_time:!0,loop:!0,playback_speed:!0,captions:!0,pip:!0}},oK=[.5,.75,1,1.25,1.5,2],lK='<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M28.8 0H3.2C1.43269 0 0 1.43269 0 3.2V28.8C0 30.5673 1.43269 32 3.2 32H28.8C30.5673 32 32 30.5673 32 28.8V3.2C32 1.43269 30.5673 0 28.8 0Z" fill="#DD1F13"/><path d="M19.2289 11.3156L11.9206 7.09616C10.5631 6.31241 8.86624 7.29209 8.86624 8.85959V13.7716C8.86624 15.3391 10.5631 16.3188 11.9206 15.535L19.2289 11.3156ZM22.7029 18.6774C24.7644 17.4872 24.7644 14.5115 22.7028 13.3213C22.488 13.1973 22.2234 13.1973 22.0086 13.3213L10.1126 20.1895C9.34137 20.6348 8.86624 21.4577 8.86624 22.3483C8.86624 24.2673 10.9436 25.4667 12.6054 24.5072L22.7029 18.6774Z" fill="white"/></svg>',nr={link:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M18.364 15.536L16.95 14.12l1.414-1.414a5 5 0 0 0-7.071-7.071L9.878 7.05L8.464 5.636l1.414-1.414a7 7 0 0 1 9.9 9.9zm-2.829 2.828l-1.414 1.414a7 7 0 0 1-9.9-9.9l1.415-1.414L7.05 9.88l-1.414 1.414a5 5 0 0 0 7.07 7.071l1.415-1.414zm-.707-10.607l1.415 1.415l-7.072 7.07l-1.414-1.414z"/></svg>',repeat:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M6 4h15a1 1 0 0 1 1 1v7h-2V6H6v3L1 5l5-4zm12 16H3a1 1 0 0 1-1-1v-7h2v6h14v-3l5 4l-5 4z"/></svg>',speed:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M20 13c0 2.21-.895 4.21-2.343 5.657l1.414 1.414A9.97 9.97 0 0 0 22 13c0-5.523-4.477-10-10-10S2 7.477 2 13a9.97 9.97 0 0 0 2.929 7.071l1.414-1.414A8 8 0 1 1 20 13m-4.707-4.707l-4.5 4.5l1.414 1.414l4.5-4.5z"/></svg>',captions:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
26<path fill="currentColor" d="M21 3a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm-1 2H4v14h16zM9 8c1.104 0 2.105.448 2.829 1.173l-1.414 1.414a2 2 0 1 0 0 2.828l1.413 1.413A4.001 4.001 0 0 1 5 12c0-2.208 1.792-4 4-4m7 0c1.105 0 2.105.448 2.829 1.173l-1.414 1.414a2 2 0 1 0 0 2.828l1.413 1.413A4.001 4.001 0 0 1 12 12c0-2.208 1.792-4 4-4"/></svg>',pip:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M21 3a1 1 0 0 1 1 1v7h-2V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm0 10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zm-1 2h-6v4h6zM6.707 6.293l2.25 2.25L11 6.5V12H5.5l2.043-2.043l-2.25-2.25z"/></svg>',back:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M7.828 11H20v2H7.828l5.364 5.364l-1.414 1.414L4 12l7.778-7.778l1.414 1.414z"/></svg>'};function Ia(n,e=!1){return typeof n=="boolean"?n:e}function cK(n){return typeof n=="number"&&Number.isFinite(n)}async function yR(n){var i;if(!n)return!1;try{if((i=navigator==null?void 0:navigator.clipboard)!=null&&i.writeText)return await navigator.clipboard.writeText(n),!0}catch{}const e=document.createElement("textarea");e.value=n,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e),e.select();let t=!1;try{t=document.execCommand("copy")}catch{t=!1}return e.remove(),t}function vR(n){const e=document.createElement("button");if(e.type="button",e.className="fp-context-menu__item",e.setAttribute("role",n.role||"menuitem"),n.role==="menuitemcheckbox"&&e.setAttribute("aria-checked",n.checked?"true":"false"),n.icon){const i=document.createElement("span");i.className="fp-context-menu__icon",i.setAttribute("aria-hidden","true"),i.innerHTML=n.icon,e.appendChild(i)}const t=document.createElement("span");if(t.className="fp-context-menu__label",t.textContent=n.label,e.appendChild(t),n.checked){const i=document.createElement("span");i.className="fp-context-menu__meta",i.textContent="✓",e.appendChild(i)}else if(n.meta){const i=document.createElement("span");i.className="fp-context-menu__meta",i.textContent=n.meta,e.appendChild(i)}return e}function uK(){const n=document.createElement("div");n.className="fp-context-menu__footer",n.setAttribute("role","presentation");const e=document.createElement("span");e.className="fp-context-menu__footer-logo",e.setAttribute("aria-hidden","true"),e.innerHTML=lK;const t=document.createElement("span");return t.className="fp-context-menu__footer-label",t.textContent=Re("Powered by FluentPlayer"),n.appendChild(e),n.appendChild(t),n}function hK(n){const e=(n==null?void 0:n.items)||{};return{enabled:Ia(n==null?void 0:n.enabled,Ca.enabled),items:{copy_link:Ia(e.copy_link,Ca.items.copy_link),copy_link_at_time:Ia(e.copy_link_at_time,Ca.items.copy_link_at_time),loop:Ia(e.loop,Ca.items.loop),playback_speed:Ia(e.playback_speed,Ca.items.playback_speed),captions:Ia(e.captions,Ca.items.captions),pip:Ia(e.pip,Ca.items.pip)}}}class dK{constructor(e){this.adapter=e,this.rootElement=(e==null?void 0:e.rootElement)||null,this.menuElement=null,this.activeSurface=null,this.activePosition=null,this.currentView="root",this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePointerDown=this.handlePointerDown.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleWindowChange=this.handleWindowChange.bind(this)}init(){this.rootElement&&this.rootElement.addEventListener("contextmenu",this.handleContextMenu)}destroy(){this.rootElement&&this.rootElement.removeEventListener("contextmenu",this.handleContextMenu),this.close()}handleContextMenu(e){var s,r;const t=(r=(s=this.adapter)==null?void 0:s.getSurfaceFromTarget)==null?void 0:r.call(s,e.target);!t||!this.getRootItems(t).length||(e.preventDefault(),this.activeSurface=t,this.activePosition={x:e.clientX,y:e.clientY},this.currentView="root",this.render(),this.bindGlobalListeners())}bindGlobalListeners(){document.addEventListener("pointerdown",this.handlePointerDown,!0),document.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("resize",this.handleWindowChange,!0),window.addEventListener("scroll",this.handleWindowChange,!0)}unbindGlobalListeners(){document.removeEventListener("pointerdown",this.handlePointerDown,!0),document.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("resize",this.handleWindowChange,!0),window.removeEventListener("scroll",this.handleWindowChange,!0)}handlePointerDown(e){this.menuElement&&(this.menuElement.contains(e.target)||this.close())}handleKeyDown(e){e.key==="Escape"&&(e.preventDefault(),this.close())}handleWindowChange(){this.close()}close(){this.unbindGlobalListeners(),this.menuElement&&(this.menuElement.remove(),this.menuElement=null),this.activeSurface=null,this.activePosition=null,this.currentView="root"}ensureMenuElement(){if(this.menuElement)return this.menuElement;const e=document.createElement("div");return e.className="fp-context-menu",e.setAttribute("role","menu"),e.addEventListener("contextmenu",t=>{t.preventDefault()}),document.body.appendChild(e),this.menuElement=e,e}render(){var i;if(!this.activeSurface||!this.activePosition)return;const e=this.ensureMenuElement(),t=this.getItemsForCurrentView();if(!t.length){this.close();return}if(e.replaceChildren(),this.currentView!=="root"){const s=vR({label:Re("Back"),icon:nr.back});s.classList.add("fp-context-menu__item--back"),s.addEventListener("click",()=>{this.currentView="root",this.render()}),e.appendChild(s)}t.forEach(s=>{const r=vR(s);s.type==="submenu"&&r.classList.add("fp-context-menu__item--submenu"),r.addEventListener("click",async()=>{var a;if(s.type==="submenu"){this.currentView=s.view,this.render();return}try{await((a=s.action)==null?void 0:a.call(s))}finally{this.close()}}),e.appendChild(r)}),this.currentView==="root"&&(((i=window.fluent_player)==null?void 0:i.show_powered_by)??!0)&&e.appendChild(uK()),this.positionMenu(e)}positionMenu(e){const{x:t,y:i}=this.activePosition,s=window.innerWidth||document.documentElement.clientWidth||0,r=window.innerHeight||document.documentElement.clientHeight||0;e.style.left="0px",e.style.top="0px",requestAnimationFrame(()=>{if(!this.menuElement)return;const a=e.getBoundingClientRect(),o=Math.max(8,Math.min(t,s-a.width-8)),l=Math.max(8,Math.min(i,r-a.height-8));e.style.left=`${o}px`,e.style.top=`${l}px`})}getContextMenuConfig(e){var t,i;return hK(((i=(t=this.adapter)==null?void 0:t.getContextMenuConfig)==null?void 0:i.call(t,e))||{})}getRootItems(e){var r,a,o,l,c,h,d,f,g,y,v,T,b,E,_,x,w,R;const t=this.getContextMenuConfig(e);
26if(!t.enabled)return[];const i=[],s=(a=(r=this.adapter)==null?void 0:r.buildPlaybackUrl)==null?void 0:a.call(r,e,{includeTime:!1});if(t.items.copy_link&&s&&i.push({label:Re("Copy Link"),icon:nr.link,action:()=>yR(s)}),t.items.copy_link_at_time&&((l=(o=this.adapter)==null?void 0:o.canCopyPlaybackUrlAtTime)!=null&&l.call(o,e))&&i.push({label:Re("Copy Link at Current Time"),icon:nr.link,action:()=>{var C,k;return yR(((k=(C=this.adapter)==null?void 0:C.buildPlaybackUrl)==null?void 0:k.call(C,e,{includeTime:!0}))||"")}}),t.items.loop&&((h=(c=this.adapter)==null?void 0:c.supportsLoop)!=null&&h.call(c,e))&&i.push({label:Re("Loop"),icon:nr.repeat,role:"menuitemcheckbox",checked:!!((f=(d=this.adapter)==null?void 0:d.isLoopEnabled)!=null&&f.call(d,e)),action:()=>{var C,k,P,I;return(I=(C=this.adapter)==null?void 0:C.setLoopEnabled)==null?void 0:I.call(C,e,!((P=(k=this.adapter)==null?void 0:k.isLoopEnabled)!=null&&P.call(k,e)))}}),t.items.playback_speed&&((y=(g=this.adapter)==null?void 0:g.canSetPlaybackSpeed)!=null&&y.call(g,e))){const C=((T=(v=this.adapter)==null?void 0:v.getPlaybackRate)==null?void 0:T.call(v,e))||1;i.push({type:"submenu",view:"speed",label:Re("Playback Speed"),icon:nr.speed,meta:`${C}x`})}if(t.items.captions){const C=((E=(b=this.adapter)==null?void 0:b.getCaptionTracks)==null?void 0:E.call(b,e))||[];C.length===1?i.push({label:Re("Captions"),icon:nr.captions,role:"menuitemcheckbox",checked:!!C[0].selected,action:()=>{var k,P;return(P=(k=this.adapter)==null?void 0:k.toggleSingleCaptionTrack)==null?void 0:P.call(k,e)}}):C.length>1&&i.push({type:"submenu",view:"captions",label:Re("Captions"),icon:nr.captions})}return t.items.pip&&((x=(_=this.adapter)==null?void 0:_.canTogglePictureInPicture)!=null&&x.call(_,e))&&i.push({label:Re("Picture-in-Picture"),icon:nr.pip,role:"menuitemcheckbox",checked:!!((R=(w=this.adapter)==null?void 0:w.isPictureInPictureActive)!=null&&R.call(w,e)),action:()=>{var C,k;return(k=(C=this.adapter)==null?void 0:C.togglePictureInPicture)==null?void 0:k.call(C,e)}}),i}getItemsForCurrentView(){return this.activeSurface?this.currentView==="speed"?this.getPlaybackSpeedItems(this.activeSurface):this.currentView==="captions"?this.getCaptionItems(this.activeSurface):this.getRootItems(this.activeSurface):[]}getPlaybackSpeedItems(e){var s,r,a,o,l,c;if(!((r=(s=this.adapter)==null?void 0:s.canSetPlaybackSpeed)!=null&&r.call(s,e)))return[];const t=((o=(a=this.adapter)==null?void 0:a.getPlaybackRate)==null?void 0:o.call(a,e))||1;return(((c=(l=this.adapter)==null?void 0:l.getPlaybackSpeedOptions)==null?void 0:c.call(l,e))||oK).filter(h=>cK(h)&&h>0).map(h=>({label:`${h}x`,role:"menuitemcheckbox",checked:Math.abs(t-h)<.01,action:()=>{var d,f;return(f=(d=this.adapter)==null?void 0:d.setPlaybackRate)==null?void 0:f.call(d,e,h)}}))}getCaptionItems(e){var s,r;const t=((r=(s=this.adapter)==null?void 0:s.getCaptionTracks)==null?void 0:r.call(s,e))||[];if(!t.length)return[];const i=[{label:Re("Off"),role:"menuitemcheckbox",checked:!t.some(a=>a.selected),action:()=>{var a,o;return(o=(a=this.adapter)==null?void 0:a.setActiveCaptionTrack)==null?void 0:o.call(a,e,null)}}];return t.forEach(a=>{i.push({label:a.label,role:"menuitemcheckbox",checked:!!a.selected,action:()=>{var o,l;return(l=(o=this.adapter)==null?void 0:o.setActiveCaptionTrack)==null?void 0:l.call(o,e,a.id)}})}),i}}function fK(n){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)}function pK({overlayEl:n,onDismiss:e}){var v;let t=null,i=!1;const s=()=>{i||(i=!0,t&&clearInterval(t),typeof e=="function"&&e())},r=n&&n.matches&&n.matches(".media-email-capture-overlay")?n:n&&n.querySelector&&n.querySelector(".media-email-capture-overlay")||n,a=(((v=r==null?void 0:r.dataset)==null?void 0:v.confirmationMessage)||"").trim();if(!r||!a){s();return}const o=r.querySelector(".email-capture-container")||r,l=(r.dataset.confirmationDismissText||"").trim();let c=parseInt(r.dataset.confirmationCountdown??"10",10);(!Number.isFinite(c)||c<0)&&(c=10),o.querySelectorAll(".email-capture-headline, .email-capture-form, .email-capture-bottom-text, .email-capture-message").forEach(T=>{T.style.display="none"}
26),(r.closest(".fluent-player-layer-cta-email-content")||o).querySelectorAll(".email-capture-skip, .fluent-player-skip-button").forEach(T=>{T.style.display="none"});const d=o.querySelector(".email-capture-confirmation");d&&d.remove();const f=document.createElement("div");f.className="email-capture-confirmation";const g=document.createElement("p");if(g.className="email-capture-confirmation-text",g.setAttribute("role","status"),g.setAttribute("aria-live","polite"),g.textContent=a,f.appendChild(g),c>0){const T=document.createElement("p");T.className="email-capture-countdown-text",T.setAttribute("aria-hidden","true");const b=C=>{T.textContent=Re("Media will resume in %ds",C)};b(c),f.appendChild(T);let E=c;const _=()=>{if(E-=1,E<=0){s();return}b(E)},x=()=>{t=setInterval(_,1e3)},w=()=>{i||t===null||(clearInterval(t),t=null)},R=()=>{i||t!==null||E<=0||x()};x(),f.addEventListener("focusin",w),f.addEventListener("focusout",R)}const y=document.createElement("button");y.type="button",y.className="email-capture-confirmation-dismiss",y.textContent=l||Re("Continue"),y.addEventListener("click",()=>s()),f.appendChild(y),o.appendChild(f),c<=0&&setTimeout(()=>y.focus({preventScroll:!0}),0)}async function mK({emailInput:n,messageTarget:e,ajaxUrl:t,resolveRequestData:i,showMessage:s,onSuccess:r}){var c;const a=n.value.trim();if(!a){n.classList.add("error");const h=Re("Please enter your email address");return s(e,h,"error"),{success:!1,message:h}}if(!fK(a)){n.classList.add("error");const h=Re("Please enter a valid email address");return s(e,h,"error"),{success:!1,message:h}}n.classList.remove("error");const o=e.querySelector(".email-capture-button");if(o&&(o.disabled=!0),s(e,Re("Submitting..."),"info",!0),!t){o&&(o.disabled=!1),n.classList.add("error");const h=Re("Error: Unable to submit email. Please try again later.");return s(e,h,"error"),{success:!1,message:h}}const l=Dk("fluent_player_email_submit",{email:a,...i(o)});try{const d=await(await fetch(t,{method:"POST",body:l})).json();if(d.success)return r(d.data),{success:!0,data:d.data};o&&(o.disabled=!1),n.classList.add("error");const f=((c=d.data)==null?void 0:c.message)||Re("Error submitting email. Please try again.");return s(e,f,"error"),{success:!1,message:f}}catch{o&&(o.disabled=!1),n.classList.add("error");const d=Re("Error submitting email. Please try again.");return s(e,d,"error"),{success:!1,message:d}}}function Dx(n,e){if(n)try{n.keyDisabled=!!e}catch{}}const gK=['input:not([type="hidden"])',"textarea","select","button","a[href]",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function yK(n){var t,i,s;if(n.disabled||n.getAttribute("aria-hidden")==="true")return!1;if(typeof n.offsetParent>"u")return!0;const e=(s=(i=(t=n.ownerDocument)==null?void 0:t.defaultView)==null?void 0:i.getComputedStyle)==null?void 0:s.call(i,n);return!(e&&(e.display==="none"||e.visibility==="hidden"))}function Ox(n){if(!n)return null;const e=n.querySelectorAll(gK);for(const t of e)if(yK(t))return t.focus({preventScroll:!0}),t;return n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus({preventScroll:!0}),n}function vK(n,e,t=null){var i;return!n||!n.isConnected||e&&n.contains(e)?!1:!!(!e||e===((i=e.ownerDocument)==null?void 0:i.body)||t&&t.contains(e))}class TK{constructor(e){this.player=e,this.openLayers=[],this._guard=null}_topLayer(){for(let e=this.openLayers.length-1;e>=0;e--)if(this.openLayers[e].isConnected)return this.openLayers[e];return null}open(e,{focusDelay:t=0}={}){var i;e&&(this.openLayers.includes(e)||this.openLayers.push(e),Dx(this.player,!0),(i=this.player)==null||i.classList.add("overlay-active"),this._installGuard(),t>0?setTimeout(()=>{this.openLayers.includes(e)&&e.isConnected&&Ox(e)},t):Ox(e))}close(e){var i,s,r;const t=this.openLayers.includes(e);this.openLayers=this.openLayers.filter(a=>a!==e&&a.isConnected),!(!t||this.openLayers.length)&&(Dx(this.player,!1),(i=this.player)==null||i.classList.remove("overlay-active"),this._removeGuard(),(r=(s=this.player)==null?void 0:s.focus)==null||r.call(s,{preventScroll:!0}))}teardown(){var e;this.openLayers=[],this._removeGuard(),Dx(this.player,!1),(e=this.player)==null||e.classList.remove("overlay-active")}_installGuard(){this._guard||(this._guard=()=>{setTimeout(()=>{const e=this._topLayer();e&&vK(e,document.activeElement,this.player)&&Ox(e)},0)},document.addEventListener("focusout",this._guard,!0))}_removeGuard(){this._guard&&(document.removeEventListener("focusout",this._guard,!0),this._guard=null)}}const TR=new WeakMap;function Mx(n){if(!n)return null;let e=TR.get(n);return e||(e=new TK(n),TR.set(n,e)),e}const vF=.25,bK=150,EK=3e3;function SK(n,e){var i,s,r;if((s=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-reduced-motion: reduce)"))!=null&&s.matches||(n==null?void 0:n.viewT
26ype)==="audio"||n!=null&&n.streamType&&n.streamType!=="on-demand")return!0;const t=(r=e==null?void 0:e.ownerDocument)==null?void 0:r.body;return!!(t&&(t.classList.contains("elementor-editor-active")||t.classList.contains("block-editor-page")||t.classList.contains("et-fb")||/(\?|&)et_fb=1(&|$)/.test(window.location.search)))}function _K(n){var e,t,i;n.container.classList.remove("fp-muted-preview"),(e=n.container.querySelector(".fp-muted-preview-overlay"))==null||e.remove(),(t=n.player)==null||t.removeAttribute("autoplay"),n.player&&!((i=n.settings)!=null&&i.muted)&&(n.player.muted=!1)}function AK(n){var s;const e=((s=n==null?void 0:n.mutedPreviewConfig)==null?void 0:s.range)||{},t=Math.max(0,parseFloat(e.start)||0);let i=parseFloat(e.end)||0;return i<=t&&(i=0),{start:t,end:i}}function xK(n,e){const t=n.start,i=n.end>0?Math.min(n.end,e):e;return t>=e-vF||i-t<1?{start:0,end:e}:{start:t,end:i}}function LK(n,e,t){let i=null;const s=()=>{const o=n==null?void 0:n.textTracks;return o?[...o].filter(l=>l.kind==="captions"||l.kind==="subtitles"):[]},r=()=>{if(t()){clearInterval(a);return}const o=s();o.length&&(i||(i=o.map(l=>l.mode)),e?o.some(l=>l.mode==="showing")||((o.find(l=>l.default)||o[0]).mode="showing"):o.forEach((l,c)=>{l.mode==="showing"&&(i[c]="showing",l.mode="disabled")}))},a=setInterval(r,bK);return r(),()=>{clearInterval(a),i&&s().forEach((o,l)=>{o.mode=i[l]||"disabled"})}}function wK(n){var h,d;const e=n.container.querySelector(".fp-muted-preview-overlay");if(!n.player||!e)return!1;if(SK(n.settings,n.container))return _K(n),!1;const t=AK(n.settings),i=f=>xK(t,f),s=()=>{const f=n.player.duration;if(!f)return;const{start:g,end:y}=i(f);n.player.currentTime>=y-vF&&(n.player.currentTime=g)};n.addEventListener(n.player,"time-update",s);const r=()=>{if(!n.previewActive)return;const f=n.player.duration,g=f?i(f).start:t.start;g>0&&n.player.currentTime<g&&(n.player.currentTime=g)};n.addEventListener(n.player,"playing",r,{once:!0});let a=!1;const o=LK(n.player,!!((d=(h=n.settings)==null?void 0:h.mutedPreviewConfig)!=null&&d.captions),()=>a||n._isDestroyed),l=()=>{var g,y,v,T,b,E,_,x,w,R,C,k;if(a||n._isDestroyed)return;a=!0,n.previewActive=!1,n._autoplayVerifyDisarmed=!0,n.player.removeEventListener("time-update",s),n.container.classList.remove("fp-muted-preview"),e.remove(),o(),((y=(g=n.settings)==null?void 0:g.mutedPreviewConfig)==null?void 0:y.showLogo)===!1&&((v=n.container.querySelector(".fp-media-logo-overlay"))==null||v.style.setProperty("display","block","important"));const f=!!((T=n.settings)!=null&&T.muted);if(((E=(b=n.settings)==null?void 0:b.mutedPreviewConfig)==null?void 0:E.clickBehavior)!=="continue"&&(n.player.currentTime=0),!f){const P=parseInt((x=(_=n.settings)==null?void 0:_.mutedPreviewConfig)==null?void 0:x.volume,10);P>=10&&P<=100&&(n.player.volume=P/100),n.player.muted=!1;const I=()=>{n.player.muted=!1},O=()=>{var G,j,K;(G=n.player)==null||G.removeEventListener("playing",I),(j=n.container)==null||j.removeEventListener("pointerdown",O,!0),(K=n.container)==null||K.removeEventListener("keydown",O,!0)};n.addEventListener(n.player,"playing",I,{once:!0}),n.container.addEventListener("pointerdown",O,!0),n.container.addEventListener("keydown",O,!0),setTimeout(O,EK)}n.player.play().catch(()=>{}),(w=n._armDeferredFeatures)==null||w.call(n),n._armDeferredFeatures=null,n.mediaId&&((R=n.isSavePlayPositionEnabled)!=null&&R.call(n))&&n.setupSaveResume(),(k=(C=n.container.querySelector("media-play-button")||n.player).focus)==null||k.call(C),n.container.dispatchEvent(new CustomEvent("fluentPlayer/mutedPreviewConverted",{bubbles:!0,detail:{mediaId:n.mediaId}}))};n.addEventListener(e,"click",l);const c=()=>{var f,g,y,v;!a&&!n._isDestroyed&&((v=(y=(g=(f=n.player).play)==null?void 0:g.call(f))==null?void 0:y.catch)==null||v.call(y,()=>{}))};return n.player.hasAttribute("data-can-play")?c():n.addEventListener(n.player,"can-play",c,{once:!0}),!0}function mr(n,e){let t=-1/0;return function(...s){const r=Date.now();if(!(r-t<e))return t=r,n.apply(this,s)}}const Fm="__flpUrlPlaybackTarget",bR="__flpUrlPlaybackScrolledKeys";function Ok(){return typeof window<"u"?window:null}
26function dl(n){if(typeof n!="string")return null;const e=n.trim().toLowerCase();return!e||!/^[a-z0-9_-]{1,80}$/.test(e)?null:e}function TF(n){if(typeof n!="string"||!/^\d+$/.test(n))return null;const e=Number.parseInt(n,10);return!Number.isSafeInteger(e)||e<0?null:e}function bF(n){if(typeof n=="number"&&Number.isFinite(n)&&n>=0){const e=Math.floor(n);return Number.isSafeInteger(e)?e:null}return typeof n=="string"?TF(n):null}function CK(n){if(!n||typeof n.getBoundingClientRect!="function")return!0;const e=n.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight||0,i=window.innerWidth||document.documentElement.clientWidth||0;return e.bottom>0&&e.right>0&&e.top<t&&e.left<i}function IK(){var o;const n=Ok();if(!n)return null;if(Object.prototype.hasOwnProperty.call(n,Fm))return n[Fm];const e=typeof((o=n.location)==null?void 0:o.search)=="string"?n.location.search:"",t=new URLSearchParams(e),i=dl(t.get("flp_r")),s=dl(t.get("flp_v")),r=TF(t.get("flp_t")),a=t.has("flp_r")||t.has("flp_v")||t.has("flp_t");return n[Fm]=a?{playerRef:i,mediaRef:s,time:r}:null,n[Fm]}function kK(n,{isLiveStream:e=!1}={}){if(e)return null;const t=bF(n==null?void 0:n.startTime);return t===null||t<=0?null:{playerRef:null,mediaRef:null,time:t}}function RK(n,e){const t=dl(n),i=dl(e);return!!t&&t===i}function PK(n,e){const t=Ok(),i=dl(e);if(!t||!n||!i)return!1;const s=t[bR]||new Set;return t[bR]=s,s.has(i)||(s.add(i),CK(n))?!1:(requestAnimationFrame(()=>{document.body.contains(n)&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),!0)}function DK({playerRef:n,mediaRef:e=null,time:t=null,currentUrl:i=null}={}){var h,d;const s=dl(n),r=dl(e),a=bF(t),o=Ok(),l=i||((h=o==null?void 0:o.location)==null?void 0:h.href);if(!s||!l)return"";const c=new URL(l,(d=o==null?void 0:o.location)==null?void 0:d.origin);return c.searchParams.set("flp_r",s),r?c.searchParams.set("flp_v",r):c.searchParams.delete("flp_v"),a!==null?c.searchParams.set("flp_t",String(a)):c.searchParams.delete("flp_t"),c.toString()}const $e={SAVE_THROTTLE_MS:1e4,MIN_SAVE_TIME_SECONDS:3,RESUME_VERIFY_DELAY_MS:120,RESUME_TIME_TOLERANCE_SECONDS:.5,RESUME_MAX_ATTEMPTS:3,UI_DELAY_MS:100,UI_ANIMATION_MS:200,TIME_UPDATE_THROTTLE_MS:500,AUTOPLAY_COUNTDOWN_SECONDS:3,AUTOPLAY_FINAL_DELAY_MS:600,AUTOPLAY_VERIFY_DELAY_MS:1500,AUTOPLAY_VERIFY_MAX_CHECKS:4,GA_POLL_INTERVAL_MS:200,GA_POLL_MAX_MS:5e3};class Mk{constructor(e,t={}){var s,r,a;this.container=e,this.mediaId=(s=t==null?void 0:t.media)==null?void 0:s.ID,this.instanceId=e.id||this.mediaId+"_"+Math.random().toString(36).slice(2,8),this.settings=(r=t==null?void 0:t.media)==null?void 0:r.settings,this._playerInitTime=Date.now(),this.analyticsNonce=(t==null?void 0:t.analytics_nonce)||"",this.defaultSettings=(t==null?void 0:t.default_settings)||{},this.languageMediaSources=(t==null?void 0:t.languageMediaSources)||{},this.conditionState=(t==null?void 0:t.condition_state)||((a=this.settings)==null?void 0:a.condition_state)||{},this.player=this.container.querySelector("media-player"),this.emailCaptureShown=!1,this.emailSubmitted=!1,this.ctaShown=!1,this.ctaCompleted=!1,this.actionBarShown=!1;const i=this.settings.loadStrategy==="poster"?"play":this.settings.loadStrategy||"visible";this.isLoading=i!=="play",this.closedActionBar=!1,this.layersManager=null,this.eventListeners=[],this.beforeUnloadHandler=null,this.countdownTimeouts=[],this._resumeRetryTimeout=null,this._resumeFrame=null,this._resumeVerifyAttempts=0,this._pendingResumeTime=null,this._initialPlaybackTarget=null,this._loopOverride=null,this.contextMenuController=null,this.gaTrackedPoints=new Set,this._gaSetupRequested=!1,this._isDestroyed=!1,!(!this.player||!this.settings)&&(this.init(),this.player.hasAttribute("data-fp-load-deferred")&&typeof this.player.startLoading=="function"&&this.player.startLoading())}applyBrandingStyles(){var o,l,c,h,d,f;if(!this.container||!this.settings||(this.container.getAttribute("data-media-id")||this.mediaId,!!document.querySelector('style[id*="fluent_player_css"], style[id="fluent-player
26-lesson-css"]')))return;const t=!!this.settings.useCustomBranding,i=t?this.settings.brandingColor||"#DD1F13":((o=this.defaultSettings)==null?void 0:o.brandColor)||"",s=t?this.settings.controlBarColor||"":((l=this.defaultSettings)==null?void 0:l.controlBarColor)||"";i&&(this.container.style.setProperty("--media-brand",i),this.container.style.setProperty("--media-focus-ring",`0 0 0 2px color-mix(in srgb, ${i} 72%, white), 0 0 0 4px color-mix(in srgb, ${i} 32%, transparent)`)),s&&this.container.style.setProperty("--fp-control-bar-bg",s);const r=this.container.querySelector(".fp-chapters")?this.container.querySelector(".fluent-player-container"):this.container,a=r?getComputedStyle(r).aspectRatio:"auto";if(r&&(!a||a==="auto")&&((c=this.settings)==null?void 0:c.viewType)!=="audio"){const g=(h=this.settings)==null?void 0:h.aspectRatio,y=((d=this.defaultSettings)==null?void 0:d.aspectRatio)||((f=this.defaultSettings)==null?void 0:f.defaultAspectRatio),v=g&&g!=="default"?g:y;if(v&&v!=="original"){const T=v.includes("/")?v:v.replace(":"," / ");r.style.aspectRatio=T}}}applyCaptionStyles(){var i,s;const e=(s=(i=this.settings)==null?void 0:i.styles)==null?void 0:s.captions;if(!this.player)return;if(e&&e.enabled===!1){this.player.classList.add("fp-captions-hidden");return}this.player.classList.remove("fp-captions-hidden"),e&&(e.color&&this.player.style.setProperty("--media-cue-color",e.color),e.background&&this.player.style.setProperty("--media-cue-bg",e.background),e.font_size!=null&&this.player.style.setProperty("--media-cue-font-size",`${e.font_size}px`))}setupLazySettingsMenu(){this.setupAccessibilityControls()}setupAccessibilityControls(){if(!this.player||!this.container)return;const e=this.container.querySelectorAll("[data-fp-toggle]");if(!e.length)return;const t="fluent_player_accessibility",i={announcements:!1,"keyboard-animations":!0};let s;try{const o=localStorage.getItem(t);s=o?{...i,...JSON.parse(o)}:{...i}}catch{s={...i}}const r=()=>{try{localStorage.setItem(t,JSON.stringify(s))}catch{}},a=(o,l,c)=>{if(o.setAttribute("aria-checked",c?"true":"false"),l==="announcements"){const h=this.player.querySelector("media-announcer");h&&(h.style.display=c?"":"none")}else l==="keyboard-animations"&&this.player.classList.toggle("fp-no-keyboard-animations",!c)};e.forEach(o=>{const l=o.getAttribute("data-fp-toggle");let c=s[l]??i[l]??!0;a(o,l,c);const h=f=>{f.button&&f.button!==0||(c=!c,s[l]=c,a(o,l,c),r())},d=f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),h(f))};this.addEventListener(o,"pointerup",h),this.addEventListener(o,"keydown",d)})}setupSeekBezel(){if(!this.player)return;const e={backward:"seek-backward-10",forward:"seek-forward-10",play:"play",pause:"pause","volume-up":"volume-high","volume-down":"volume-low",mute:"mute",unmute:"volume-high"},t=document.createElement("div");t.className="fp-seek-bezel",t.setAttribute("aria-hidden","true");const i=document.createElement("media-icon");i.className="fp-seek-bezel-icon",t.appendChild(i),this.player.appendChild(t);let s=null;const r=a=>{s&&(clearTimeout(s),t.classList.remove("is-active")),i.type=e[a]||a,a==="forward"?t.dataset.action="seek-forward":a==="backward"?t.dataset.action="seek-backward":t.dataset.action=a,t.offsetWidth,t.classList.add("is-active"),s=setTimeout(()=>{t.classList.remove("is-active"),s=null},500)};this.addEventListener(this.player,"keydown",a=>{var h,d;const o=a.target,l=o&&(o.isContentEditable||o.matches&&o.matches('input, textarea, select, [contenteditable="true"]')),c=this.player.keyDisabled||((d=(h=this.player).querySelector)==null?void 0:d.call(h,".layer-active.blocking-layer"));l||c||(a.key==="ArrowRight"||a.key==="l"||a.key==="L"?r("forward"):a.key==="ArrowLeft"||a.key==="j"||a.key==="J"?r("backward"):a.key==="k"||a.key==="K"||a.key===" "?r(this.player.paused?"play":"pause"):a.key==="ArrowUp"?r("volume-up"):a.key==="ArrowDown"?r("volume-down"):(a.key==="m"||a.key==="M")&&r(this.player.muted?"unmute":"mute"))}),this.addEventListener(this.player,"media-play-request",a=>{const o=a.trigger;if(!o)return;let l=o;for(;l!=null&&l.trigger;)l=l.trigger;((l==null?void 0:l.type)==="pointerup"||(l==null?void 0:l.type)==="click")&&r("play")}
26),this.addEventListener(this.player,"media-pause-request",a=>{const o=a.trigger;if(!o)return;let l=o;for(;l!=null&&l.trigger;)l=l.trigger;((l==null?void 0:l.type)==="pointerup"||(l==null?void 0:l.type)==="click")&&r("pause")}),this.addEventListener(this.player,"media-seek-request",a=>{const o=a.trigger;if(!o)return;let l=o;for(;l!=null&&l.trigger;)l=l.trigger;if((l==null?void 0:l.type)!=="dblpointerup")return;const c=a.detail,h=this.player.currentTime||0;c>h?r("forward"):c<h&&r("backward")})}addEventListener(e,t,i,s){e.addEventListener(t,i,s),this.eventListeners.push({target:e,event:t,handler:i,options:s})}destroy(){var e,t,i;this._isDestroyed=!0,this.mediaId&&this.isSavePlayPositionEnabled()&&((e=this.player)==null?void 0:e.currentTime)!==((t=this.player)==null?void 0:t.duration)&&this.saveCurrentPosition(!0),this.analyticsTracker&&(this.analyticsTracker.destroy(),this.analyticsTracker=null),this.milestoneReporter&&(this.milestoneReporter.destroy(),this.milestoneReporter=null),this.layerReporter&&(this.layerReporter.destroy(),this.layerReporter=null),this._sharedWatchTracker&&(this._sharedWatchTracker.destroy(),this._sharedWatchTracker=null),this._sharedWatchTrackerPromise=null,this.eventListeners.forEach(({target:s,event:r,handler:a,options:o})=>{s.removeEventListener(r,a,o)}),this.eventListeners=[],this.beforeUnloadHandler&&(window.removeEventListener("beforeunload",this.beforeUnloadHandler),this.beforeUnloadHandler=null);try{(i=Mx(this.player))==null||i.teardown()}catch(s){console.error("FluentPlayer: modal gate teardown failed:",s)}this.countdownTimeouts&&this.countdownTimeouts.length&&(this.countdownTimeouts.forEach(s=>clearTimeout(s)),this.countdownTimeouts=[]),this.clearPendingResumeWork(),this.layersManager&&(this.layersManager.destroy(),this.layersManager=null),this.contextMenuController&&(this.contextMenuController.destroy(),this.contextMenuController=null),this._dynamicOverlayIntervals&&(this._dynamicOverlayIntervals.forEach(s=>clearInterval(s)),this._dynamicOverlayIntervals.clear(),this._dynamicOverlayIntervals=null),this.gaTrackedPoints&&this.gaTrackedPoints.clear()}init(){var i;this.applyBrandingStyles(),this.applyCaptionStyles(),this._initialPlaybackTarget=this.resolveInitialPlaybackTarget(),this.setupHLSProvider(),this.setupVideoErrorHandling(),this.setupLoadingTransition(),this.setupPlayerEvents(),this.previewActive=!!((i=this.settings)!=null&&i.mutedPreview)&&wK(this),this.mediaId&&this.isSavePlayPositionEnabled()&&!this.previewActive&&this.setupSaveResume();const e=()=>{var a,o;this.setupVideoEndBehavior(),this.setupAutoplay(),this.setupTimestamps();let s=!1;this.previewActive&&((a=this.settings.mutedPreviewConfig)!=null&&a.showOverlays)&&((o=this.settings.overlays)!=null&&o.length)&&(this.handleOverlays(),s=!0);const r=()=>{var l,c,h,d,f,g,y,v;((l=this.settings.layers)==null?void 0:l.length)>0&&this.initializeLayersManager(),!s&&((c=this.settings.overlays)!=null&&c.length)&&this.handleOverlays(),(h=this.settings.email_capture)!=null&&h.enabled&&this.handleEmailCapture(),(d=this.settings.cta)!=null&&d.enabled&&this.handleCTA(),(f=this.settings.action_bar)!=null&&f.enabled&&this.handleActionBar(),this.mediaId&&(this.setupAnalyticsTracking(),this.setupMilestoneTracking()),this.setupGoogleAnalytics(),((g=this.settings)==null?void 0:g.show_language_switcher)===!0&&setTimeout(()=>this.setupLanguageSwitcher(),$e.UI_DELAY_MS),(v=(y=this.settings)==null?void 0:y.mux_data)!=null&&v.env_key&&this.setupMuxData()};this.previewActive?this._armDeferredFeatures=r:r()};typeof requestIdleCallback<"u"?requestIdleCallback(e,{timeout:300}):setTimeout(e,0),this.setupPauseOtherVideos(),this.setupLazySettingsMenu(),this.setupContextMenu();const t=()=>{this.player.removeEventListener("pointerdown",t),this.player.removeEventListener("focusin",t),this.setupSeekBezel()};this.player.addEventListener("pointerdown",t,{once:!0}),this.player.addEventListener("focusin",t,{once:!0})}async initializeLayersManager(){this.layersManager&&this.layersManager.destroy();const{default:e}=await se(()=>import("./fp-LayersManager.js?ver=1.4.0"),[],import.meta.url);this.layersManager=new e(this.player,this.container,this.mediaId,this.settings,this),this.setupLayerTracking()}async setupLayerTracking(){var s,r,a,o;const e=(s=window.fluent_player)==null?void 0:s.crm_behavior;if(!this.mediaId||!this.layersManager||!e||!e.active)return;this.layerReporter&&(this.layerReporter.destroy(),this.layerReporter=null);const t=DG(e,this.mediaId,((r=this.settings)==null?void 0:r.layers)||[]);if(!t)return;const{default:i}=await se(()=>Promise.resolve().then(()=>YY),void 0,import.meta.url);this.layersManager&&(this.layerReporter=new i(this.layersManager,{mediaId:this.mediaId,nonce:e.nonce,armed:t,isLoggedIn:!!((a=e.identity)!=null&&a.isLoggedIn),hasContact:!!((o=e.identity)!=null&&o.hasContact),hasEmailCapture:uR(this.settings)}))}setupContextMenu(){this.contextMenuController&&this.contextMenuController.destroy(),this.contextMenuController=new dK({rootElement:this.container,getSurfaceFromTarget:e=>this.getContextMenuSurfaceFromTarget(e),getContextMenuConfig:()=>{var e;return(e=this.settings)==null?void 0:e.context_menu},buildPlaybackUrl:(e,t)=>
26this.buildPlaybackUrl(t),canCopyPlaybackUrlAtTime:()=>this.canCopyPlaybackUrlAtTime(),supportsLoop:()=>!this.isLiveStream(),isLoopEnabled:()=>this.isLoopEnabled(),setLoopEnabled:(e,t)=>this.setLoopEnabled(t),canSetPlaybackSpeed:()=>{var e,t;return!!((t=(e=this.player)==null?void 0:e.state)!=null&&t.canSetPlaybackRate)},getPlaybackRate:()=>{var e;return((e=this.player)==null?void 0:e.playbackRate)||1},setPlaybackRate:(e,t)=>{this.player&&(this.player.playbackRate=t)},getCaptionTracks:()=>this.getCaptionTracks(),toggleSingleCaptionTrack:()=>this.toggleSingleCaptionTrack(),setActiveCaptionTrack:(e,t)=>this.setActiveCaptionTrack(t),canTogglePictureInPicture:()=>{var e,t,i;return!!this.player&&((e=this.settings)==null?void 0:e.viewType)!=="audio"&&!!((i=(t=this.player)==null?void 0:t.state)!=null&&i.canPictureInPicture)},isPictureInPictureActive:()=>{var e,t;return!!((t=(e=this.player)==null?void 0:e.state)!=null&&t.pictureInPicture)},togglePictureInPicture:()=>this.togglePictureInPicture()}),this.contextMenuController.init()}getContextMenuSurfaceFromTarget(e){var i;const t=(i=this.container)==null?void 0:i.querySelector(".fluent-player
26-container");return!t||!e||!t.contains(e)?null:t}canCopyPlaybackUrlAtTime(){var e;return!this.isLiveStream()&&Number.isFinite((e=this.player)==null?void 0:e.currentTime)}buildPlaybackUrl({includeTime:e=!1}={}){var s,r,a,o;const t=(r=(s=this.container)==null?void 0:s.dataset)==null?void 0:r.flpRef;if(!t)return"";const i=typeof((a=this.settings)==null?void 0:a.share_url)=="string"?this.settings.share_url:"";return DK({playerRef:t,currentUrl:i||null,time:e?Math.max(0,Math.floor(((o=this.player)==null?void 0:o.currentTime)||0)):null})}isLiveStream(){var e;return String(((e=this.settings)==null?void 0:e.streamType)||"").toLowerCase().includes("live")}isLoopEnabled(){var e;return typeof this._loopOverride=="boolean"?this._loopOverride:((e=this.settings)==null?void 0:e.video_end_option)==="loop"}setLoopEnabled(e){var t;this._loopOverride=!!e,(t=this.player)==null||t.removeAttribute("loop"),e||this.cancelAutoplay()}getCaptionTracks(){var s,r,a,o;if(((a=(r=(s=this.settings)==null?void 0:s.styles)==null?void 0:r.captions)==null?void 0:a.enabled)===!1)return[];const e=(o=this.player)==null?void 0:o.textTracks;if(!e)return[];const t=[];let i=0;for(const l of e)l.kind!=="captions"&&l.kind!=="subtitles"||(t.push({id:`caption-${i}`,label:l.label||l.language||`${Re("Caption")} ${i+1}`,selected:l.mode==="showing"}),i++);return t}setActiveCaptionTrack(e){var s;const t=(s=this.player)==null?void 0:s.textTracks;if(!t)return;let i=0;for(const r of t)r.kind!=="captions"&&r.kind!=="subtitles"||(r.mode=e===`caption-${i}`?"showing":"disabled",i++)}toggleSingleCaptionTrack(){const e=this.getCaptionTracks();e.length===1&&this.setActiveCaptionTrack(e[0].selected?null:e[0].id)}async togglePictureInPicture(){var e,t;if((t=(e=this.player)==null?void 0:e.state)!=null&&t.canPictureInPicture)try{this.player.state.pictureInPicture?await this.player.exitPictureInPicture():await this.player.enterPictureInPicture()}catch{}}
26setupHLSProvider(){if(!this.player)return;const e=async r=>{var a,o,l;if(r&&eq(r)){const{default:c}=await se(()=>Promise.resolve().then(()=>$J),void 0,import.meta.url);r.library=c,YG(r,(a=this.settings)==null?void 0:a.bunny_token_query);const h=(l=(o=this.settings)==null?void 0:o.drm)==null?void 0:l.mux_token;h&&(r.config={...r.config,emeEnabled:!0,drmSystems:{"com.widevine.alpha":{licenseUrl:"https://license.mux.com"},"com.apple.fps":{licenseUrl:"https://license.mux.com"}},licenseXhrSetup:d=>{d.setRequestHeader("Authorization","Bearer "+h)}})}},t=r=>{var h,d,f;if(!r||r.type!=="youtube")return;zG(r);const a=r.buildParams.bind(r);r.buildParams=()=>{const g=a(),y={};for(const v in g)g[v]!==void 0&&g[v]!==null&&(y[v]=g[v]);return{...y,rel:0,iv_load_policy:3,origin:window.location.origin}};const l=((h=window.fluent_player)==null?void 0:h.context)==="fluent-community"&&((d=r.src)==null?void 0:d.call(r)),c=l&&((f=l.match(/\/embed\/([^?&/]+)/))==null?void 0:f[1]);c&&(r.src.set(""),r.src.set(`${r.getOrigin()}/embed/${c}`))},i=async r=>{const a=r.detail;t(a),QG(a),fR(a),(a==null?void 0:a.type)==="vimeo"&&(eK(this.player),aK(this.player),this.addEventListener(this.player,"can-play",()=>{gR(this.player),setTimeout(()=>gR(this.player),2e3)},{once:!0})),await e(a)};this.addEventListener(this.player,"provider-change",i),this.addEventListener(this.player,"hls-level-switched",()=>{var o;const r=(o=this.player)==null?void 0:o.querySelector("video");if(!r||r.paused)return;const a=r.playbackRate;r.playbackRate=a||1});const s=this.player.provider;s&&(e(s),t(s),fR(s))}setupVideoErrorHandling(){if(!this.player)return;const e=t=>{var c,h,d,f,g,y;const i=t.detail,s=((c=this.settings)==null?void 0:c.src)||"",r=s.includes("bunny/storage/stream"),a=((h=this.settings)==null?void 0:h.provider)==="bunny"&&s.includes(".m3u8"),o=(g=(f=(d=this.settings)==null?void 0:d.bunny)==null?void 0:f.mp4_urls)==null?void 0:g[0];if(a&&o&&!this.mp4FallbackAttempted){this.mp4FallbackAttempted=!0;const v=gF(o,(y=this.settings)==null?void 0:y.bunny_token_query);this.player.src=v,this.player.startLoading();return}if(r){const T=setTimeout(()=>
26{const _=this.container.querySelector(".fluent-player-loader");_&&_.classList.add("is-hidden"),this.showVideoError(i)},2500),b=()=>{clearTimeout(T),this.player.removeEventListener("canplay",b),this.player.removeEventListener("loadeddata",E)},E=()=>{clearTimeout(T),this.player.removeEventListener("canplay",b),this.player.removeEventListener("loadeddata",E)};this.player.addEventListener("canplay",b,{once:!0}),this.player.addEventListener("loadeddata",E,{once:!0});return}console.error("FluentPlayer: Video load error:",i);const l=this.container.querySelector(".fluent-player-loader");l&&l.classList.add("is-hidden"),this.showVideoError(i)};this.addEventListener(this.player,"error",e)}showVideoError(e){const t=this.container.querySelector(".fluent-player-error-overlay");t&&t.remove();const i=kG(e),s=RG(i),r=s.querySelector(".fluent-player-error-retry"),a=()=>{var l;s.remove();const o=this.container.querySelector(".fluent-player-loader");if(o&&o.classList.remove("is-hidden"),this.player&&((l=this.settings)!=null&&l.src)){const c=this.player.src;this.player.src="",setTimeout(()=>{this.player.src=c||this.settings.src},$e.UI_DELAY_MS)}};this.addEventListener(r,"click",a),this.container.querySelector(".fluent-player
26-container").appendChild(s)}setupAutoplay(){if(!this.player||!this.settings.autoplay&&!this.settings.mutedAutoplay&&!this.previewActive)return;const e=()=>{this.player&&(this.player.muted=!0,this.player.play().catch(r=>{console.error("FluentPlayer: Autoplay failed:",r)}))},t=()=>{if(this._autoplayVerifyScheduled)return;this._autoplayVerifyScheduled=!0;let r=0;const a=()=>{var o;if(!(!this.player||this._isDestroyed||this.player.currentTime)&&!this._autoplayVerifyDisarmed){if((o=this.player.state)!=null&&o.canPlay){e();return}++r<$e.AUTOPLAY_VERIFY_MAX_CHECKS&&setTimeout(a,$e.AUTOPLAY_VERIFY_DELAY_MS)}};setTimeout(a,$e.AUTOPLAY_VERIFY_DELAY_MS)},i=()=>{setTimeout(()=>{var a;const r=(a=this.player)==null?void 0:a.play();r!==void 0&&r.catch(()=>{this.player.muted||e()}),t()},$e.AUTOPLAY_FINAL_DELAY_MS)},s=()=>{var r;(r=this.player)!=null&&r.paused&&e(),t()};this.addEventListener(this.player,"provider-change",i),this.addEventListener(this.player,"can-play",s)}setupLoadingTransition(){var y,v;const e=this.container.querySelector(".fluent-player
26-loader"),t=e==null?void 0:e.querySelector(".fluent-player-loader-overlay");if(!e)return;const i=this.settings.loadStrategy==="poster"?"play":this.settings.loadStrategy||"visible",s=()=>{this.isLoading=!1,e.classList.add("is-hidden")},r=()=>{this.isLoading=!0,e.classList.remove("is-hidden")},a=()=>{t&&(t.style.opacity="0")},o=()=>{t&&(t.style.opacity="1")};if(i==="play"){e.classList.remove("is-hidden"),a();let T=!1;const b=()=>{T||o()},E=()=>{T=!0,s()},_=()=>{T&&o()},x=()=>{T&&a()},w=()=>{T&&a()};this.addEventListener(this.player,"play",b,{once:!0}),this.addEventListener(this.player,"can-play",E,{once:!0}),this.addEventListener(this.player,"waiting",_),this.addEventListener(this.player,"playing",x),this.addEventListener(this.player,"pause",w),this.addEventListener(this.player,"end",w),(y=this.player)!=null&&y.hasAttribute("data-can-play")&&E();return}r();const l=()=>{s()},c=()=>{this.isLoading&&s()};if(this.addEventListener(this.player,"can-play",l,{once:!0}),this.addEventListener(this.player,"loadeddata",c,{once:!0}),(v=this.player)!=null&&v.hasAttribute("data-can-play")&&s(),this.player.hasAttribute("autoplay")){const T=setTimeout(()=>{var b,E,_;(b=this.player)!=null&&b.hasAttribute("data-can-play")&&!((E=this.player)!=null&&E.hasAttribute("data-playing"))&&!((_=this.player)!=null&&_.hasAttribute("data-started"))&&(this.player.removeAttribute("autoplay"),s())},3e3);this.addEventListener(this.player,"playing",()=>clearTimeout(T),{once:!0})}const h=()=>{var E;const T=this.player.querySelector("iframe.vds-youtube");if(!T||!T.src)return;const b=(E=T.src.split("/embed/")[1])==null?void 0:E.split("?")[0];b&&T.contentWindow.postMessage(JSON.stringify({event:"command",func:"cueVideoById",args:[b]}),"*")};let d=null;const f=()=>{d&&(clearTimeout(d),d=null)},g=T=>{const b=this.player.querySelector(".vds-buffering-indicator");b&&(b.style.display=T?"":"none")};this.addEventListener(this.player,"waiting",()=>{if(!this.player.hasAttribute("data-started")){r();return}f(),d=setTimeout(()=>{d=null,this.player.hasAttribute("data-waiting")&&!this.player.hasAttribute("data-playing")&&g(!1)},5e3)}),this.addEventListener(this.player,"playing",()=>{s(),f(),g(!0)}),this.addEventListener(this.player,"seeked",()=>{s(),f(),g(!0)}),this.addEventListener(this.player,"pause",s),this.addEventListener(this.player,"end",()=>{s(),f(),h()})}handleOverlays(){var f;let e=this.container.querySelectorAll(".fp-media-custom-overlay:not(.fp-media-logo-overlay)");const t=new Map;let i=((f=this.player)==null?void 0:f.currentTime)||0;const s=g=>{const v=(this.container.querySelector("media-player")||this.container).getBoundingClientRect(),T=g.getBoundingClientRect(),b=Math.max(0,Math.floor((v.height-T.height)/v.height*100)),E=Math.max(0,Math.floor((v.width-T.width)/v.width*100));return{top:Math.floor(Math.random()*(b+1)),left:Math.floor(Math.random()*(E+1))}},r=(g,y,v)=>{g.style.top=y+"%",g.style.left=v+"%",g.style.right="auto",g.style.bottom="auto"};e.forEach(g=>{if(g.classList.contains("position-dynamic")){const y=s(g);r(g,y.top,y.left)}});const a=(g,y)=>{var b;if((b=this.player)!=null&&b.paused)return;const{top:v,left:T}=s(g);y==="fade"?(g.style.transition="opacity 0.5s ease",g.style.opacity="0",setTimeout(()=>{r(g,v,T),g.style.opacity="1"},500)):y==="instant"?(g.style.transition="none",r(g,v,T)):(g.style.transition="top 1.5s ease, left 1.5s ease",r(g,v,T))},o=(g,y,v,T)=>{if(t.has(y))return;a(g,T);const b=(v||10)*1e3,E=setInterval(()=>a(g,T),b);t.set(y,E)},l=(g,y,v,T)=>{c(g,y),o(g,y,v,T)},c=(g,y)=>{const v=t.get(y);v&&(clearInterval(v),t.delete(y)),g.style.transition=""},h=mr(()=>{var g;if(e.length){const y=(g=this.player)==null?void 0:g.currentTime;if(typeof y!="number"||!this.settings.overlays)return;this.settings.overlays.forEach((v,T)=>{const b=e[T];if(!b)return;const E=v.displayTime||0,_=E+(v.duration||5),x=y>=E&&y<=_;if(b.classList.toggle("active",x),v.dynamic_position){const w=v.reposition_interval||10,R=v.reposition_animation||"fade";x?o(b,T,w,R):c(b,T)}})}},$e.TIME_UPDATE_THROTTLE_MS),d=()=>{var v;const g=(v=this.player)==null?void 0:v.currentTime;if(typeof g!="number"||!this.settings.overlays)return;const y=Math.abs(g-i);i=g,this.settings.overlays.forEach((T,b)=>{const E=e[b];if(!E||!T.dynamic_position)return;const _=T.reposition_interval||10,x=T.reposition_animation||"fade";y>=_&&E.classList.contains("active")&&l(E,b,_,x)})};this.addEventListener(this.player,"time-update",h),this.addEventListener(this.player,"seeked",d),this._dynamicOverlayIntervals=t}isSavePlayPositionEnabled(){var i,s;if(!((i=window.fluent_player)!=null&&i.has_pro)||this.isLiveStream())return!1;const e=this.settings||{};if(Object.prototype.hasOwnProperty.call(e,"save_play_position"))return!!e.save_play_position;const t=e.behaviors;return t&&Object.prototype.hasOwnProperty.call(t,"save_play_position")?!!t.save_play_position:!!((s=window.fluent_player)!=null&&s.resume_playback)}clearPendingResumeWork(){this._resumeRetryTimeout&&(clearTimeout(this._resumeRetryTimeout),this._resumeRetryTimeout=null),this._resumeFrame&&(cancelAnimationFrame(this._resumeFrame),this._resumeFrame=null)}abandonPendingResume(){this.clearPendingResumeWork(),this._pendingResumeTime=null,this._resumeVerifyAttempts=0}finalizePendingResume(){var t;
26if(this._pendingResumeTime===null||!this.player)return!1;const e=this.player.currentTime;return typeof e!="number"||Math.abs(e-this._pendingResumeTime)>$e.RESUME_TIME_TOLERANCE_SECONDS?!1:(((t=this.settings)==null?void 0:t.provider)==="youtube"&&this._pendingResumeTime>0&&(this.player.setAttribute("data-started",""),this.player.removeAttribute("data-ended")),this.clearPendingResumeWork(),this._pendingResumeTime=null,this._resumeVerifyAttempts=0,!0)}queueResumeSeek(){this._pendingResumeTime===null||!this.player||this._resumeFrame||(this._resumeFrame=requestAnimationFrame(()=>{this._resumeFrame=requestAnimationFrame(()=>{if(this._resumeFrame=null,this._pendingResumeTime===null||!this.player||this._isDestroyed)return;const e=this.player.remoteControl;e!=null&&e.seeking&&(e!=null&&e.seek)?(e.seeking(this._pendingResumeTime),e.seek(this._pendingResumeTime)):this.player.currentTime=this._pendingResumeTime,this.verifyPendingResume()})}))}verifyPendingResume(){if(!(this._pendingResumeTime===null||!this.player)&&!this.finalizePendingResume()){if(this._resumeVerifyAttempts>=$e.RESUME_MAX_ATTEMPTS){this.abandonPendingResume();return}this._resumeRetryTimeout&&clearTimeout(this._resumeRetryTimeout),this._resumeRetryTimeout=setTimeout(()=>{this._resumeRetryTimeout=null,!(this._pendingResumeTime===null||!this.player||this._isDestroyed)&&(this.finalizePendingResume()||(this._resumeVerifyAttempts++,this.queueResumeSeek()))},$e.RESUME_VERIFY_DELAY_MS)}}setupPlayerEvents(){const e=()=>{var i;!this.previewActive&&!this.consumeInitialPlaybackTime()&&this.isSavePlayPositionEnabled()&&this.loadSavedPosition();const t=(i=this.player)==null?void 0:i.querySelector("media-provider iframe");t&&!t.hasAttribute("inert")&&(t.setAttribute("inert",""),t.setAttribute("tabindex","-1"))};this.addEventListener(this.player,"can-play",e),this.addEventListener(this.player,"volume-change",()=>{this.player&&this.player.volume<=.01&&!this.player.muted&&(this.player.muted=!0)})}setupSaveResume(){const e=()=>{var r,a;((r=this.player)==null?void 0:r.currentTime)!==((a=this.player)==null?void 0:a.duration)&&this.saveCurrentPosition(!0)},t=()=>{var r,a;((r=this.player)==null?void 0:r.currentTime)===((a=this.player)==null?void 0:a.duration)&&this.clearSavedPosition()},i=()=>{var r,a;((r=this.player)==null?void 0:r.currentTime)!==((a=this.player)==null?void 0:a.duration)&&this.saveCurrentPosition()};this.beforeUnloadHandler=()=>{var r,a;((r=this.player)==null?void 0:r.currentTime)!==((a=this.player)==null?void 0:a.duration)&&this.saveCurrentPosition(!0)};const s=()=>{var r,a;document.visibilityState==="hidden"&&((r=this.player)==null?void 0:r.currentTime)!==((a=this.player)==null?void 0:a.duration)&&this.saveCurrentPosition(!0)};this.addEventListener(this.player,"pause",e),this.addEventListener(this.player,"ended",t),this.addEventListener(this.player,"time-update",i),this.addEventListener(document,"visibilitychange",s),window.addEventListener("beforeunload",this.beforeUnloadHandler)}getAjaxUrl(){return Pk()}getNonce(){return fF()}saveCurrentPosition(e=!1){var s,r;const t=(s=this.player)==null?void 0:s.currentTime;if(!this.mediaId||typeof t!="number"||!isFinite(t)||t<$e.MIN_SAVE_TIME_SECONDS||!e&&this.lastSaveTime&&Date.now()-this.lastSaveTime<$e.SAVE_THROTTLE_MS)return;this.lastSaveTime=Date.now();const i=window.FluentBrowserStorage;if(i){const a=((r=this.player)==null?void 0:r.duration)||0;a>0&&t/a>=.95?i.removePosition(this.mediaId):i.savePosition(this.mediaId,t,a)}}loadSavedPosition(){if(!this.mediaId)return;const e=window.FluentBrowserStorage;if(!e)return;const t=e.getPosition(this.mediaId);if(!t||t.position<=0||!this.player)return;const i=t.duration||0;if(i>0&&t.position/i>=.95){e.removePosition(this.mediaId);return}i>0&&t.position<i&&this.applyPendingResumeTime(t.position)}resolveInitialPlaybackTarget(){var s,r;const e=IK(),t=(r=(s=this.container)==null?void 0:s.dataset)==null?void 0:r.flpRef,i=!!(e!=null&&e.playerRef);return e?i&&!RK(e.playerRef,t)||!i&&!this.isImplicitDedicatedPageTarget()?null:(PK(this.container,t||e.playerRef||"dedicated-single-player"),e):kK(this.settings,{isLiveStream:this.isLiveStream()})}isImplicitDedicatedPageTarget(){return document.querySelectorAll(".fluent-player").length!==1?!1:!!document.querySelector(".fluent-player
26-media-page, .fluent-player-dedicated-page")}isLiveStream(){var e;return String(((e=this.settings)==null?void 0:e.streamType)||"").toLowerCase().includes("live")}consumeInitialPlaybackTime(){const e=this._initialPlaybackTarget;return!e||(this._initialPlaybackTarget=null,typeof e.time!="number"||this.isLiveStream())?!1:this.applyPendingResumeTime(e.time)}applyPendingResumeTime(e){var r,a;if(!this.player||typeof e!="number"||e<0)return!1;if(this._pendingResumeTime!==null&&Math.abs(this._pendingResumeTime-e)<=$e.RESUME_TIME_TOLERANCE_SECONDS)return(((r=this.player.state)==null?void 0:r.seekableEnd)??0)>0&&this.queueResumeSeek(),!0;if(this._pendingResumeTime=e,this._resumeVerifyAttempts=0,(((a=this.player.state)==null?void 0:a.seekableEnd)??0)>0)return this.queueResumeSeek(),!0;const t=()=>{this.finalizePendingResume()},i=()=>{this.finalizePendingResume()||this.abandonPendingResume()},s=()=>{var o;this._pendingResumeTime!==null&&(((o=this.player.state)==null?void 0:o.seekableEnd)??0)>0&&this.queueResumeSeek()};return this.addEventListener(this.player,"seeked",t,{once:!0}),this.addEventListener(this.player,"play",i,{once:!0}),this.addEventListener(this.player,"progress",s),!0}clearSavedPosition(){if(!this.mediaId)return;const e=window.FluentBrowserStorage;e&&e.removePosition(this.mediaId)}handleEmailCapture(){var o;const e=this.container.querySelector(".media-email-capture-overlay");if(!e)return;const t=((o=this.settings.email_capture)==null?void 0:o.percentage)||0;if(t>0){const l=mr(()=>{var d,f;const c=(d=this.player)==null?void 0:d.currentTime,h=(f=this.player)==null?void 0:f.duration;typeof h=="number"&&h>0&&typeof c=="number"&&c/h*100>=t&&!this.emailCaptureShown&&this.shouldShowEmailCapture()&&(this.emailCapturePercentageTime=t/100*h,this.showEmailCapture(e))},$e.TIME_UPDATE_THROTTLE_MS);this.addEventListener(this.player,"time-update",l)}else{const l=()=>{!this.emailCaptureShown&&this.shouldShowEmailCapture()&&(this.emailCapturePercentageTime=0,this.showEmailCapture(e))};this.addEventListener(this.player,"play",l)}const i=e.querySelector(".email-capture-skip");if(i){const l=()=>{this.hideEmailCapture(e)};this.addEventListener(i,"click",l)}const s=e.querySelector(".email-capture-input"),r=e.querySelector(".email-capture-button");if(s&&r){const l=()=>{s.value.trim(),s.classList.remove("error"),this.hideMessage(e)},c=()=>{this.handleEmailSubmit(s,e)},h=d=>{d.key==="Enter"&&(d.preventDefault(),this.handleEmailSubmit(s,e))};this.addEventListener(s,"input",l),this.addEventListener(r,"click",c),this.addEventListener(s,"keypress",h)}const a=l=>{if(e.classList.contains("active")){if(l.key==="Escape"){e.getAttribute("data-allow-skip")!=="0"&&(l.preventDefault(),this.hideEmailCapture(e));return}l.key===" "&&(l.preventDefault(),l.stopPropagation())}};this.addEventListener(document,"keydown",a)}showEmailCapture(e){var t,i,s;e.classList.add("active"),this.emailCaptureResumeTime=((t=this.player)==null?void 0:t.currentTime)??this.emailCapturePercentageTime,(i=this.player)==null||i.pause(),this.emailCaptureShown=!0,(s=Mx(this.player))==null||s.open(e,{focusDelay:$e.UI_DELAY_MS}),this.disablePlayerControls()}hideEmailCapture(e){var t;e.classList.remove("active"),this.emailCaptureShown=!0,(t=Mx(this.player))==null||t.close(e),this.enablePlayerControls(),this.emailCaptureResumeTime!==void 0&&(this.player.currentTime=this.emailCaptureResumeTime),this.player.play()}disablePlayerControls(){this.preventPlayHandler&&this.player.removeEventListener("play",this.preventPlayHandler),this.preventSeekHandler&&this.player.removeEventListener("seeking",this.preventSeekHandler,!0),this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler),WG(this.player),this.preventPlayHandler=()=>{var e;return this.emailCaptureShown&&!this.emailSubmitted||this.ctaShown&&!this.ctaCompleted?((e=this.player)==null||e.pause(),!1):!0},this.preventSeekHandler=e=>this.emailCaptureShown&&!this.emailSubmitted||this.ctaShown&&!this.ctaCompleted?(e.preventDefault(),e.stopPropagation(),!1):!0,this.addEventListener(this.player,"play",this.preventPlayHandler),this.addEventListener(this.player,"seeking",this.preventSeekHandler,!0),this.keydownHandler=e=>
26{["ArrowLeft","ArrowRight"," ","Space"].includes(e.key)&&(e.preventDefault(),e.stopPropagation())},this.addEventListener(document,"keydown",this.keydownHandler)}enablePlayerControls(){jG(this.player),this.preventPlayHandler&&this.player.removeEventListener("play",this.preventPlayHandler),this.preventSeekHandler&&this.player.removeEventListener("seeking",this.preventSeekHandler,!0),this.keydownHandler&&document.removeEventListener("keydown",this.keydownHandler)}async handleEmailSubmit(e,t,i=null,s=null){return mK({emailInput:e,messageTarget:t,ajaxUrl:this.getAjaxUrl(),showMessage:(r,a,o,l)=>this.showMessage(r,a,o,l),resolveRequestData:r=>{var a;return{media_id:(r==null?void 0:r.dataset.mediaId)||this.mediaId,preset_slug:(r==null?void 0:r.dataset.presetSlug)||this.settings.preset_slug,video_time:this.player.currentTime,type:(r==null?void 0:r.dataset.type)||(i==null?void 0:i.type)||"preset",nonce:(r==null?void 0:r.dataset.nonce)||((a=window.fluent_player)==null?void 0:a.nonce)||"",...i}},onSuccess:()=>{this.emailSubmitted=!0,pK({overlayEl:t,onDismiss:()=>{var r,a;if(s){s();return}this.hideEmailCapture(t),(a=this.layersManager)==null||a.checkLayersAtTime(((r=this.player)==null?void 0:r.currentTime)||0)}})}})}showMessage(e,t,i="info",s=!1){const r=e.querySelector(".email-capture-message");if(!r)return;const a=document.activeElement,o=a&&a.classList.contains("email-capture-input");if(r.textContent="",s){const l=document.createElement("span");l.className="email-capture-loader",r.appendChild(l)}if(r.appendChild(document.createTextNode(t)),r.className="email-capture-message",r.classList.add(`email-capture-message--${i}`),r.style.display="block",o){const l=e.querySelector(".email-capture-input");l&&setTimeout(()=>l.focus({preventScroll:!0}),$e.UI_DELAY_MS)}}hideMessage(e){const t=e.querySelector(".email-capture-message");if(!t)return;const i=document.activeElement,s=i&&i.classList.contains("email-capture-input");if(t.style.display="none",s){const r=e.querySelector(".email-capture-input");r&&setTimeout(()=>r.focus({preventScroll:!0}),$e.UI_DELAY_MS)}}getSharedWatchTracker(){return this._sharedWatchTrackerPromise||(this._sharedWatchTrackerPromise=se(()=>Promise.resolve().then(()=>UJ),void 0,import.meta.url).then(({default:e})=>(this._sharedWatchTracker=new e(this.player,{completionThreshold:100,mediaId:this.mediaId,segmentUpdateInterVal:5}),this._sharedWatchTracker))),this._sharedWatchTrackerPromise}async setupAnalyticsTracking(){if(this._isDestroyed||!this.mediaId||!this.analyticsNonce||!this.isAnalyticsEnabled()||this.isExternallyTracked())return;const{default:e}=await se(()=>import("./fp-AnalyticsTracker.js?ver=1.4.0"),[],import.meta.url);this._isDestroyed||(this.analyticsTracker=new e(this.player,this.mediaId,{nonce:this.analyticsNonce,watchTracker:await this.get
26SharedWatchTracker()}))}async setupMilestoneTracking(){var r,a,o;const e=(r=window.fluent_player)==null?void 0:r.crm_behavior;if(!this.mediaId||!e||!e.active)return;const t=OG(e,this.mediaId);if(!t)return;const{default:i}=await se(()=>Promise.resolve().then(()=>XJ),void 0,import.meta.url),s=await this.getSharedWatchTracker();this._isDestroyed||!s||(this.milestoneReporter=new i(s,{mediaId:this.mediaId,nonce:e.nonce,armed:t,isLoggedIn:!!((a=e.identity)!=null&&a.isLoggedIn),hasContact:!!((o=e.identity)!=null&&o.hasContact),hasEmailCapture:uR(this.settings)}))}isAnalyticsEnabled(){var e,t,i;return!!((t=(e=window.fluent_player)==null?void 0:e.analytics)!=null&&t.enabled)&&((i=window.fluent_player)==null?void 0:i.has_pro)}isExternallyTracked(){var t;const e=(t=window.fluent_player)==null?void 0:t.external_tracked_media;return Array.isArray(e)&&e.some(i=>String(i)===String(this.mediaId))}async setupMuxData(){var s;const e=(s=this.player)==null?void 0:s.querySelector("video");if(!e)return;let t;try{({default:t}=await se(()=>Promise.resolve().then(()=>Eie),void 0,import.meta.url))}catch(r){console.debug("FluentPlayer: mux-embed unavailable, skipping Mux Data.",r);return}const i=this.settings.mux_data||{};try{t.monitor(e,{data:{...i,player_name:"Fluent Player",player_init_time:this._playerInitTime,video_id:String(this.mediaId||""),video_title:this.settings.title||"",video_duration:this.settings.duration||0,video_source_url:this.settings.src||e.currentSrc||"",video_cdn:"mux"}})}catch(r){console.warn("FluentPlayer: mux.monitor() failed; Mux Data will not report for this player.",r)}}setupGoogleAnalytics(){var s,r;const e=(s=window.fluent_player)==null?void 0:s.google_analytics,t=(e==null?void 0:e.enabled)===!0||(e==null?void 0:e.enabled)==="true",i=(e==null?void 0:e.use_existing_tag)===!0||(e==null?void 0:e.use_existing_tag)==="true";this._isDestroyed||!t||!((r=window.fluent_player)!=null&&r.has_pro)||this._gaListenersAttached||this._gaSetupRequested||(this._gaSetupRequested=!0,GG({pollIntervalMs:$e.GA_POLL_INTERVAL_MS,pollMaxMs:$e.GA_POLL_MAX_MS}).then(({ready:a})=>{this._gaSetupRequested=!1,!this._isDestroyed&&(a?this.attachGoogleAnalyticsListeners():this.warnGoogleAnalyticsMissing(i))}))}warnGoogleAnalyticsMissing(e){KG()&&console.warn(e?"Fluent Player: Google Analytics gtag was not found after waiting. Make sure your site-level GA4 tag is loaded before the player initializes.":"Fluent Player: Google Analytics gtag was not found after waiting. Check the GA settings and confirm the frontend GA script is enqueued.")}attachGoogleAnalyticsListeners(){if(this._isDestroyed||this._gaListenersAttached||!this.player)return;this._gaListenersAttached=!0;const e=()=>{this.trackGoogleAnalyticsEvent("play")},t=()=>{this.trackGoogleAnalyticsEvent("pause")},i=()=>{this.trackGoogleAnalyticsEvent("ended")},s=[25,50,75,100],r=mr(()=>{const a=this.player.duration;if(!a)return;const o=this.player.currentTime,l=Math.floor(o/a*100);s.forEach(c=>{l>=c&&!this.gaTrackedPoints.has(c)&&(this.gaTrackedPoints.add(c),this.trackGoogleAnalyticsEvent(`progress_${c}`))})},$e.TIME_UPDATE_THROTTLE_MS);this.addEventListener(this.player,"play",e),this.addEventListener(this.player,"pause",t),this.addEventListener(this.player,"ended",i),this.addEventListener(this.player,"time-update",r),this.player.paused===!1&&e()}trackGoogleAnalyticsEvent(e){var i,s;if(this._isDestroyed||!window.gtag||!this.mediaId)return!1;const t=this.getVideoData();return window.gtag("event",e,{event_category:"Fluent Player",event_label:`#${this.mediaId} - ${((i=this.settings)==null?void 0:i.title)||Re("Untitled")}`,value:Math.round(this.player.currentTime||0),video_id:this.mediaId,video_title:((s=this.settings)==null?void 0:s.title)||Re("Untitled"),video_current_time:Math.round(this.player.currentTime||0),video_duration:this.player.duration?Math.round(this.player.duration):null,video_provider:t.provider,video_url:t.url}),!0}getVideoData(){const e=this.getVideoProvider(),t=this.getVideoUrl();return{provider:e,url:t}}getVideoProvider(){var e;if((e=this.settings)!=null&&e.src){const t=this.settings.src.toLowerCase();if(t.includes("youtube.com")||t.includes("youtu.be"))return"youtube";if(t.includes("vimeo.com"))return"vimeo";if(t.includes("bunny.net")||t.includes("bunnycdn.com"))return"bunny";if(t.includes("amazonaws.com")||t.includes("s3."))return"aws";if(t.includes("cloudflare.com")||t.includes("stream."))return"cloudflare"}return"html5"}getVideoUrl(){var e;return(e=this.settings)!=null&&e.src?this.settings.src:null}getConditionState(e={}){return MG(this.conditionState,e)}matchesConditions(e,t={}){return mF(e)?$G(e,this.getConditionState(t)):!0}getEmailSubmittedConditionState(){return this.emailSubmitted?{viewer:{email_submitted:!0}}:{}}shouldShowEmailCapture(){var e,t;return this.matchesConditions((t=(e=this.settings)==null?void 0:e.email_capture)==null?void 0:t.conditionals,this.getEmailSubmittedConditionState())}shouldShowCTA(){var e,t;return this.matchesConditions((t=(e=this.settings)==null?void 0:e.cta)==null?void 0:t.conditionals,this.getEmailSubmittedConditionState())}handleCTA(){var a;const e=this.container.querySelector(".cta-overlay");if(!e)return;const t=(a=this.settings.cta)==null?void 0:a.percentage,i=mr(()=>{var h,d;const o=(h=this.player)==null?void 0:h.currentTime,l=(d=this.player)==null?void 0:d.duration;if(typeof o!="number"||typeof l!="number"||l<=0)return;o/l*100>=t&&!this.ctaShown&&!this.ctaCompleted&&this.shouldShowCTA()&&(this.ctaPercentageTime=t/100*l,this.showCTA(e))},$e.TIME_UPDATE_THROTTLE_MS);this.addEventListener(this.player,"time-update",i);const s=e.querySelector(".cta-skip");if(s){const o=()=>{this.hideCTA(e)};this.addEventListener(s,"click",o)}const r=e.dataset.completionType||"link_click";if(r==="link_click")e.querySelectorAll(".cta-text-content a").forEach(l=>{this.addEventListener(l,"click",()=>{this.hideCTA(e,{skipResume:!0})})});else if(r==="auto_dismiss"){const o=(parseInt(e.dataset.autoDismiss)||5)*1e3;this.ctaAutoDismissTimer=null;const l=this.showCTA.bind(this);this.showCTA=c=>{l(c),this.ctaAutoDismissTimer=setTimeout(()=>{this.hideCTA(c)},o)}}}showCTA(e){var i;e.classList.add("active"),e.style.display="flex",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),this.ctaResumeTime=((i=this.player)==null?void 0:i.currentTime)??this.ctaPercentageTime,this.player.pause(),this.ctaShown=!0,this.player.classList.add("overlay-active"),this.disablePlayerControls(),this._ctaPreviousFocus=document.activeElement;const t=e.querySelector(".cta-button, .cta-skip, button, a");t&&setTimeout(()=>t.focus({preventScroll:!0}),$e.UI_DELAY_MS)}hideCTA(e,{skipResume:t=!1}={}){this.ctaAutoDismissTimer&&(clearTimeout(this.ctaAutoDismissTimer),this.ctaAutoDismissTimer=null),e.classList.remove("active"),e.style.display="none",e.removeAttribute("role"),e.removeAttribute("aria-modal"),this.ctaShown=!1,this.ctaCompleted=!0,this.player.classList.remove("overlay-active"),this.enablePlayerControls(),this._ctaPreviousFocus&&document.contains(this._ctaPreviousFocus)&&this._ctaPreviousFocus.focus(),this._ctaPreviousFocus=null,this.ctaResumeTime!==void 0&&(this.player.currentTime=this.ctaResumeTime),t||this.player.play()}handleActionBar(){var o;const e=this.container.querySelector(".action-bar-overlay");if(!e)return;const t=((o=this.settings.action_bar)==null?void 0:o.percentage_start)||0,i=mr(()=>{var d,f;const l=(d=this.player)==null?void 0:d.currentTime,c=(f=this.player)==null?void 0:f.duration;if(typeof l!="number"||typeof c!="number"||c<=0)return;const h=l/c*100;h>=t&&!this.actionBarShown&&!this.closedActionBar&&this.showActionBar(e),h<t&&this.actionBarShown&&this.hideActionBar(e)},$e.TIME_UPDATE_THROTTLE_MS);this.addEventListener(this.player,"time-update",i);const s=e.querySelector(".action-bar-button");if(s){const l=()=>{const c=s.dataset.link,h=s.dataset.target;c&&window.open(c,h)};this.addEventListener(s,"click",l)}const r=e.querySelector(".action-bar-youtube-button");if(r){const l=()=>{const c=r.dataset.channel;c&&window.open(`https://www.youtube.com/channel/${c}?sub_confirmation=1`,"_blank")};this.addEventListener(r,"click",l)}const a=e.querySelector(".action-bar-close");if(a){const l=()=>{this.hideActionBar(e),this.closedActionBar=!0};this.addEventListener(a,"click",l)}}setupTimestamps(){document.querySelectorAll(`fluentplayer-timestamp[media_id='${this.mediaId}']`).forEach(t=>{const i=()=>{var l;if(t.getAttribute("media_id")!==this.mediaId.toString())return;const r=t.getAttribute("time");if(!r||!r.includes(":")){console.warn("FluentPlayer: Invalid timestamp format. Use MM:SS or HH:MM:SS format.");return}let a=0;try{const c=r.split(":").map(h=>parseInt(h,10)||0);if(c.length===2)a=c[0]*60+c[1];else if(c.length===3)a=c[0]*3600+c[1]*60+c[2];else{console.warn("FluentPlayer: Invalid timestamp format. Use MM:SS or HH:MM:SS format.");return}}catch(c){console.error("FluentPlayer: Error parsing timestamp",c);return}if(a<0){console.warn("FluentPlayer: Timestamp cannot be negative");return}const o=(l=this.player)==null?void 0:l.duration;if(!this.player||typeof o!="number"||o<=0){console.warn("FluentPlayer: Player not ready or duration not available");return}if(a>o){console.warn(`FluentPlayer: Timestamp (${a}s) exceeds video duration (${o}s)`);return}this.player.currentTime=a,this.player.play().catch(c=>{c.name==="NotAllowedError"&&(this.player.muted=!0,this.player.play().catch(h=>console.error("FluentPlayer: Cannot play video:",h)))}),this.player.scrollIntoView({behavior:"smooth",block:"center"})};this.addEventListener(t,"click",i),this.addEventListener(t,"keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())}),t.style.cursor="pointer",t.style.textDecoration="underline",t.setAttribute("role","button"),t.setAttribute("tabindex","0")})}setupLanguageSwitcher(){const e=this.container.querySelector(".fluent-player
26-language-switcher-radio-group");if(!e){setTimeout(()=>{const t=this.container.querySelector(".fluent-player-language-switcher-radio-group");t&&this.initializeLanguageSwitcher(t)},$e.UI_ANIMATION_MS);return}this.initializeLanguageSwitcher(e)}initializeLanguageSwitcher(e){this.loadLanguage(e),this.setupLanguageMenuAutoClose();const t=i=>{const s=i.target.value||i.detail;s&&s!=this.mediaId&&this.loadMediaById(s,e),this.closeLanguageMenu()};this.addEventListener(e,"change",t)}loadLanguage(e){let t=this.detectUserLanguage();const i=this.getLanguageMediaSources();let s=null;if(i[t])s=i[t].mediaId;else{const r=t.split("_")[0];for(const[a,o]of Object.entries(i))if(a===r||a.startsWith(r+"_")){s=o.mediaId;break}}s&&s!=this.mediaId&&(e.value=s,this.loadMediaById(s,e))}detectUserLanguage(){var t;let e=null;if(navigator.language){const i=navigator.language;i.includes("-")?e=i.replace("-","_"):i.length===2?e=i.toLowerCase():e=i}return e||(e=(t=window.fluent_player)==null?void 0:t.serverLang),e||(e="en_US"),e}loadMediaById(e,t){if(!e)return;const i=String(e),s=String(this.mediaId);if(i===s)return;t&&(t.style.opacity="0.5",t.style.pointerEvents="none");const r=this.getLanguageMediaSources();let a=null;for(const[o,l]of Object.entries(r))if(l.mediaId==e){a=l;break}if(a&&this.player)try{if(this.abandonPendingResume(),a.src&&(this.player.src=a.src),a.posterSrc){const l=this.player.querySelector("media-poster");l&&(l.src=pR(a.posterSrc))}a.title&&(this.player.title=a.title),this.mediaId=e,this.updateLanguageButton(a);const o=this.getLanguageNameFromSource(a)}catch{}t&&(t.style.opacity="1",t.style.pointerEvents="auto")}getLanguageMediaSources(){const e=this.container.dataset.var_name;if(e&&window[e]){const t=window[e].languageMediaSources||{};if(Object.keys(t).length>0)return t}return this.languageMediaSources&&Object.keys(this.languageMediaSources).length>0?this.languageMediaSources:{}}getLanguageNameFromSource(e){const t=this.container.querySelector(`media-radio[value="${e.mediaId}"]`);
26if(t){const i=t.querySelector(".fluent-player-language-radio-label");if(i)return i.textContent.trim()}return e.title||Re("Selected Language")}updateLanguageButton(e){const t=this.container.querySelector(".fluent-player-language-button");if(!t)return;const i=t.querySelector(".fluent-player-language-flag"),s=t.querySelector(".fluent-player-language-code");if(!i||!s)return;const r=this.container.querySelector(`media-radio[value="${e.mediaId}"]`);if(!r)return;const a=r.querySelector(".fluent-player-language-flag-option"),o=r.getAttribute("data-lang");if(a&&o){i.textContent=a.textContent;const l=o.split("_")[0].toUpperCase();s.textContent=l,t.style.transform="scale(1.05)",setTimeout(()=>{t.style.transform="scale(1)"},$e.UI_ANIMATION_MS)}}closeLanguageMenu(){const e=this.container.querySelector("media-menu.fluent-player-language-menu"),t=this.container.querySelector("media-menu-button.fluent-player-language-button");e&&t&&t.getAttribute("aria-expanded")==="true"&&(e.close&&typeof e.close=="function"?e.close():t.click())}setupLanguageMenuAutoClose(){["play","pause","seeked"].forEach(i=>{const s=()=>{setTimeout(()=>this.closeLanguageMenu(),$e.UI_DELAY_MS)};this.addEventListener(this.player,i,s)});const t=i=>
26{const s=this.container.querySelector(".fluent-player-language-controls");s&&!s.contains(i.target)&&this.closeLanguageMenu()};this.addEventListener(this.player,"click",t)}setupVideoEndBehavior(){if(!this.player)return;this.player.removeAttribute("loop"),this.setupEndScreenCSS();const e=this.settings.mutedAutoplay?null:this.setupAutoplayOverlay();this.addEventListener(this.player,"ended",()=>{if(this.isLoopEnabled()){if(this.settings.mutedAutoplay){setTimeout(()=>{this.player.currentTime=0,this.player.paused=!1,this.player.play().catch(()=>{})},500);return}e&&(e.style.display="flex",this.startAutoplayCountdown(e))}})}setupAutoplayOverlay(){let e=this.container.querySelector(".fluent-player-autoplay-overlay");if(!e){e=document.createElement("div"),e.className="fluent-player-autoplay-overlay",e.style.display="none",e.innerHTML=`
27            <div class="fluent-player-autoplay-container">
28                <div class="fluent-player-autoplay-info">
29                    <div class="fluent-player-autoplay-title" aria-live="polite" aria-atomic="true">${Re("Playing again in")}</div>
30                    <div class="fluent-player-autoplay-countdown">
31                        <svg viewBox="0 0 36 36" aria-hidden="true" focusable="false">
32                            <circle class="fluent-player-countdown-bg" cx="18" cy="18" r="16" />
33                            <circle class="fluent-player-countdown-progress" cx="18" cy="18" r="16" stroke-dasharray="100 100" />
34                        </svg>
35                        <span class="fluent-player-countdown-number">${$e.AUTOPLAY_COUNTDOWN_SECONDS}</span>
36                    </div>
37                </div>
38                <button class="fluent-player-autoplay-cancel" aria-label="${Re("Cancel autoplay")}">${Re("Cancel")}</button>
39            </div>
40        `,this.container.appendChild(e);const t=e.querySelector(".fluent-player-autoplay-cancel"),i=()=>{this.cancelAutoplay()};this.addEventListener(t,"click",i)}return e}startAutoplayCountdown(e){const t=e.querySelector(".fluent-player-countdown-number"),i=e.querySelector(".fluent-player-countdown-progress");let s=$e.AUTOPLAY_COUNTDOWN_SECONDS;t.textContent=s,i.style.strokeDasharray="100, 100",this.countdownTimeouts&&this.countdownTimeouts.length&&this.countdownTimeouts.forEach(r=>clearTimeout(r)),this.countdownTimeouts=[];for(let r=0;r<$e.AUTOPLAY_COUNTDOWN_SECONDS;r++){const a=setTimeout(()=>{if(s--,s>=0){t.textContent=s;const o=($e.AUTOPLAY_COUNTDOWN_SECONDS-s)/$e.AUTOPLAY_COUNTDOWN_SECONDS*100;i.style.strokeDasharray=`${o} 100`}if(s===0){const o=setTimeout(()=>{e.style.display="none",this.player&&(this.player.currentTime=0,this.player.play().catch(l=>{console.warn("FluentPlayer: Auto-restart failed:",l)}))},$e.AUTOPLAY_FINAL_DELAY_MS);this.countdownTimeouts.push(o)}},r*1e3);this.countdownTimeouts.push(a)}}cancelAutoplay(){this.countdownTimeouts&&this.countdownTimeouts.length&&this.countdownTimeouts.forEach(t=>clearTimeout(t));
40const e=this.container.querySelector(".fluent-player-autoplay-overlay");e&&(e.style.display="none")}setupEndScreenCSS(){const e=this.container.querySelector(".vds-blocker");if(!e)return;const t=()=>{e.style.display="block",e.style.backgroundColor="transparent",e.style.backgroundImage=`url("${pR(this.settings.posterSrc)}")`,e.style.backgroundSize="cover",e.style.backgroundPosition="center"},i=()=>{e&&(e.style.display="none")};this.addEventListener(this.player,"ended",t),this.addEventListener(this.player,"play",i)}showActionBar(e){e.classList.add("active"),e.style.display="flex",this.actionBarShown=!0}hideActionBar(e){e.classList.remove("active"),e.style.display="none",this.actionBarShown=!1}setupPauseOtherVideos(){var i;if(((i=this.defaultSettings)==null?void 0:i.pauseOthersOnPlay)===!1||this._pauseOthersBound)return;this._pauseOthersBound=!0;const e=()=>{if(this.previewActive)return;const s=new CustomEvent("fluent-player-play",{detail:{playerId:this.instanceId}});document.dispatchEvent(s)},t=s=>{this.previewActive||s.detail.playerId!==this.instanceId&&this.player&&this.player.pause()};this.addEventListener(this.player,"play",e),this.addEventListener(document,"fluent-player
40-play",t)}}const NC=new Map,OK=8e3,EF=()=>window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function MK(n,e){n.scrollTo({...e,behavior:EF()?"auto":"smooth"})}function $x(n,e){n.scrollIntoView({inline:e,block:"nearest",behavior:EF()?"auto":"smooth"})}function $K(n){if(n.dataset.fpStripBound)return;const e=n.querySelector(".fp-chapters-rail"),t=n.closest(".fluent-player-container")||n.closest(".fluent-player"),i=t&&t.querySelector("media-player");if(!e||!i)return;n.dataset.fpStripBound="1";const s=[],r=(F,N,H,ne)=>{F.addEventListener(N,H,ne),s.push(()=>F.removeEventListener(N,H,ne))},a=Array.from(e.querySelectorAll(".fp-chapter-pill")).map(F=>({pill:F,start:parseFloat(F.dataset.fpStart)||0})).sort((F,N)=>F.start-N.start);if(!a.length)return;const o=n.querySelector(".fp-chapters-prev"),l=n.querySelector(".fp-chapters-next"),c=n.querySelector(".fp-chapters-jump"),h=c&&c.querySelector(".fp-chapters-jump-title"),d=getComputedStyle(e).direction==="rtl",f=F=>{if(!F)return"";const N=F.getAttribute("title");if(N)return N;const H=F.querySelector(".fp-chapter-title");return H?H.textContent.trim():""},g=F=>{if(!h)return;const N=f(F);N&&(h.textContent=N,c.setAttribute("title",N),c.setAttribute("aria-label",Re("Jump to the chapter now playing: %s",N)))},y=()=>d?-e.scrollLeft:e.scrollLeft,v=()=>e.scrollWidth-e.clientWidth-1;let T=0;const b=()=>performance.now()<T,E=()=>{T=performance.now()+OK,U()},_=F=>{if(!(!F||typeof F.play!="function"))try{Promise.resolve(F.play()).catch(()=>{})}catch{}};let x=null;const w=F=>{const N=i.remoteControl;if(N&&typeof N.seek=="function"){N.seeking(F),N.seek(F),i.paused&&typeof N.play=="function"&&_(N);return}try{i.currentTime=F,i.paused&&_(i)}catch{}};let R=null;const C=()=>{x&&x.classList.remove("is-pending"),x=null,R=null};r(i,"can-play",()=>{const F=R;C(),F!==null&&w(F)}),r(i,"error",C),r(i,"abort",C);const P=()=>i.state?i.state.canPlay:i.hasAttribute("data-can-play"),I=(F,N)=>{if(T=0,P()){C(),w(F);return}x&&x!==N&&x.classList.remove("is-pending"),x=N,R=F,N&&N.classList.add("is-pending"),_(i)};r(e,"click",F=>{const N=F.target.closest(".fp-chapter-pill");N&&I(parseFloat(N.dataset.fpStart)||0,N)});let O=a.findIndex(F=>F.pill.classList.contains("is-active"));const G=F=>{if(F===O||F<0)return;a.forEach(({pill:H})=>{H.classList.remove("is-active"),H.removeAttribute("aria-current")}),O=F;const N=a[F]&&a[F].pill;N&&(N.classList.add("is-active"),N.setAttribute("aria-current","true"),g(N),b()||$x(N,"center")),U()},j=mr(()=>{const F=i.currentTime||0;let N=0;for(let H=0;H<a.length&&F>=a[H].start;H++)N=H;G(N)},400);r(i,"time-update",j),a.forEach(({pill:F})=>r(F,"focus",()=>$x(F,"nearest"))),["wheel","touchstart","pointerdown","keydown"].forEach(F=>r(e,F,E,{passive:!0}));const K=()=>Math.max(160,Math.round(e.clientWidth*.8)),W=F=>{E();const N=F?K():-K();MK(e,{left:e.scrollLeft+(d?-N:N)})};o&&r(o,"click",()=>W(!1)),l&&r(l,"click",()=>W(!0));function U(){if(!n.isConnected){q();return}const F=v(),N=y()<=0,H=y()>=F;o&&(o.disabled=N),l&&(l.disabled=H||F<=0),n.classList.toggle("fp-chapters--scrollable",F>0),e.classList.toggle("fp-fade-start",F>0&&!N),e.classList.toggle("fp-fade-end",F>0&&!H);const ne=a[O]&&a[O].pill;if(c&&ne){const be=e.getBoundingClientRect(),ue=ne.getBoundingClientRect(),ye=ue.right<be.left+1||ue.left>be.right-1;c.hidden=!ye}else c&&(c.hidden=!0)}if(r(e,"scroll",mr(U,120),{passive:!0}),r(window,"resize",mr(U,200)),window.ResizeObserver){const F=new ResizeObserver(()=>U());F.observe(e),s.push(()=>F.disconnect())}const V=setTimeout(U,300);s.push(()=>clearTimeout(V)),c&&r(c,"click",()=>{T=0;const F=a[O]&&a[O].pill;F&&$x(F,"center"),U()});const q=()=>{s.forEach(F=>F()),s.length=0,document.removeEventListener("DestroyFluentPlayer",z),NC.delete(n),delete n.dataset.fpStripBound},z=F=>{const N=F.detail&&F.detail.container;N&&(N===t||N.contains(n))&&q()};document.addEventListener("DestroyFluentPlayer",z),NC.set(n,q),g(a[O]&&a[O].pill),U()}function Bm(n=document){for(const[e,t]of NC)e.isConnected||t();n.querySelectorAll(".fp-chapters[data-fp-chapters]").forEach($K)}const Nx="fluent_player_positions",ER="fluent_player_layer_states",SR=100;class NK{constructor(){this.positions=this._load(Nx),this.layerConditionStates=this._load(ER)}getPosition(e){return this.positions[String(e)]||null}savePosition(e,t,i){this.positions[String(e)]={position:t,duration:i,last_saved:Date.now()},this._persistBucket("positions",Nx)}removePosition(e){delete this.positions[String(e)],this._persistBucket("positions",Nx)}getLayerConditionStates(e){const t=this.layerConditionStates[String(e)];return!t||typeof t!="object"?null:t.layers&&typeof t.layers=="object"?t.layers:null}updateLayerConditionState(e,t,i={}){const s=String(e),r=String(t),a=this.layerConditionStates[s],o={...this.getLayerConditionStates(s)||{}},l=o[r]||{},c={seen:!!l.seen||!!i.seen,completed:!!l.completed||!!i.completed};c.seen||c.completed?(o[r]=c,this.layerConditionStates[s]={...a&&typeof a=="object"?a:{},last_saved:Date.now(),layers:o}):(delete o[r],Object.keys(o).length?this.layerConditionStates[s]={...a&&typeof a=="object"?a:{},last_saved:Date.now(),layers:o}:delete this.layerConditionStates[s]),this._persistBucket("layerConditionStates",ER)}_load(e){try{const t=localStorage.getItem(e);if(!t)return{};const i=JSON.parse(t);return typeof i=="object"&&i!==null?i:{}}catch{return{}}}
40_persistBucket(e,t){(!this[e]||typeof this[e]!="object")&&(this[e]={}),Object.keys(this[e]).length>SR&&this._cleanup(e);try{localStorage.setItem(t,JSON.stringify(this[e]))}catch{this._cleanup(e);try{localStorage.setItem(t,JSON.stringify(this[e]))}catch{}}}_cleanup(e){const t=this[e];if(!t||typeof t!="object"){this[e]={};return}const i=Object.entries(t).sort(([,s],[,r])=>{const a=Number((s==null?void 0:s.last_saved)||0);return Number((r==null?void 0:r.last_saved)||0)-a}).slice(0,SR);this[e]=Object.fromEntries(i)}}window.FluentBrowserStorage=new NK;async function FK(n,e){try{return await pF("fluent_player_unlock",{id:n,password:e})||{success:!1,data:{message:"Unlock failed"}}}catch{return{success:!1,data:{message:"Network error"}}}}async function BK(n,e,t){const i=n.querySelector('[name="password"]'),s=n.querySelector(".fp-unlock-error"),r=n.querySelector('button[type="submit"]');s&&(s.hidden=!0,s.textContent=""),r&&(r.disabled=!0);const a=await FK(e,i?i.value:"");if(a&&a.success){t();return}r&&(r.disabled=!1);const o=a&&a.data&&a.data.message||"Unlock failed";s&&(s.textContent=o,s.hidden=!1)}let _R=!1;function UK(){_R||(_R=!0,document.addEventListener("submit",n=>{const e=n.target&&n.target.closest?n.target.closest(".fp-media-locked .fp-unlock-form"):null;if(!e)return;const t=e.closest(".fp-media-locked"),i=t&&t.dataset.mediaId;i&&(n.preventDefault(),BK(e,i,()=>window.location.reload()))}))}const VK="#DD1F13",HK=[/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,/^hsla?\(\s*\d{1,3}(?:\.\d+)?\s*,\s*\d{1,3}(?:\.\d+)?%\s*,\s*\d{1,3}(?:\.\d+)?%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,/^var\(\s*--[a-z0-9-]+\s*\)$/i];function qK(n){if(typeof n!="string")return"";const e=n.trim();return e&&(HK.some(t=>t.test(e))||/^[a-z]+$/i.test(e))?e:""}function GK(n,e={}){if(!n)return{};const t=!!n.useCustomBranding,i=(c,h,d="")=>{const f=t?n[c]||d:e[h]||"";return qK(f)},s=i("brandingColor","brandColor",VK),r=i("controlBarColor","controlBarColor"),a=i("playButtonColor","playButtonColor"),o=i("playButtonBgColor","playButtonBgColor"),l={};return s&&(l["--media-brand"]=s,l["--media-focus-ring"]=`0 0 0 2px color-mix(in srgb, ${s} 72%, white), 0 0 0 4px color-mix(in srgb, ${s} 32%, transparent)`),r&&(l["--fp-control-bar-bg"]=r),a&&(l["--media-play-color"]=a),o&&(l["--media-play-bg"]=o),l}function SF(n,e){if(!n)return null;const t=e||document;for(const i of t.querySelectorAll("script.fp-inline-config"))if(i.getAttribute("data-var-name")===n)try{const s=JSON.parse(i.textContent);return s&&typeof s=="object"?s:null}catch{return null}return null}function KK(n,e){const t=e||document.body,i=new MutationObserver(s=>{for(const r of s)for(const a of r.addedNodes){if(a.nodeType!==1)continue;const o=a.classList&&a.classList.contains("fluent-player"),l=a.querySelector&&a.querySelector(".fluent-player");if(o||l){n();return}}});return i.observe(t,{childList:!0,subtree:!0}),()=>i.disconnect()}function _F(n){if(!n||!n.settings)return;const e=String(n.mediaId),t=GK(n.settings,n.defaultSettings||{});document.querySelectorAll("[data-media-id]").forEach(i=>{if(String(i.getAttribute("data-media-id"))!==e)return;const s=i.closest(".fluent-player");Object.keys(t).forEach(r=>{i.style.setProperty(r,t[r]),s&&s.style.setProperty(r,t[r])})})}const ls=new Map;function $k(n){if(n!=null&&n.instance&&typeof n.instance.destroy=="function")try{n.instance.destroy()}catch(e){console.error("FluentPlayer: instance destroy failed:",e)}}function AF(n){const e=ls.get(n);if(!e)return;$k(e),ls.delete(n);const t=[...ls.values()].some(i=>i.varName===e.varName);if(e.varName&&!t&&window[e.varName])try{delete window[e.varName]}catch{}}function jK(){for(const n of[...ls.keys()])document.body.contains(n)||AF(n)}async function Um(n=!1){jK();
40for(const e of document.querySelectorAll(".fluent-player")){if(ls.has(e)&&!n||e.hasAttribute("data-fp-defer"))continue;const t=e.dataset.var_name;let i=window[t];if(i&&(i.nodeType||!i.media)&&(i=null),i||(i=SF(t,e.ownerDocument)),i||(i=await YK(e)),!i)continue;window[t]=i;const s=i&&i.media&&i.media.settings;if(s){const r=(e.querySelector("[data-media-id]")||{}).getAttribute?e.querySelector("[data-media-id]").getAttribute("data-media-id"):i.media&&i.media.ID;r&&_F({mediaId:String(r),settings:s,defaultSettings:i.default_settings})}ls.has(e)&&$k(ls.get(e)),document.body.contains(e)&&ls.set(e,{instance:new Mk(e,i),varName:t})}}async function WK(n){const e=n.detail.container;if(!e||e.hasAttribute("data-fp-defer"))return;let t=n.detail.playerData;const i=e.dataset.var_name;if(!t){if(!i)return;t=window[i],t&&(t.nodeType||!t.media)&&(t=SF(i,e.ownerDocument))}t&&(ls.has(e)&&$k(ls.get(e)),ls.set(e,{instance:new Mk(e,t),varName:i}))}async function YK(n){var e;try{const t=n.querySelector("[data-media-id]"),i=(t==null?void 0:t.dataset.mediaId)||n.dataset.mediaId;if(!i)return console.warn("FluentPlayer: No media ID found for container",n),null;const s=(t==null?void 0:t.dataset.accessKey)||n.dataset.accessKey||"",r=window.fluent_player||((e=window.fluentCommunityPortalVars)==null?void 0:e.fluent_player)||{},a=r.ajax_url||"/wp-admin/admin-ajax.php",o=r.nonce||r.rest_nonce,l=await fetch(a,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"fluent_player_get_media_data",media_id:i,nonce:o,access_key:s,context:r.context||"frontend"})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const c=await l.json();return c.error?(console.error("FluentPlayer: Failed to fetch media data:",c.error),null):c.media?c:(console.error("FluentPlayer: Invalid response format:",c),null)}catch(t){return console.error("FluentPlayer: Error fetching media data:",t),null}}window.__fluentPlayerBootstrapped||(window.__fluentPlayerBootstrapped=!0,UK(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Um(),Bm()}):(Um(),Bm()),document.addEventListener("FComMediaReady",function(n){Um(!0),Bm()}),KK(()=>{Um(),Bm()}),document.addEventListener("InitSingleFluentPlayer",WK),document.addEventListener("fluentPlayer/settingsPreview",n=>_F(n.detail)),document.addEventListener("DestroyFluentPlayer",n=>{const e=n.detail&&n.detail.container;e&&AF(e)}),window.FluentPlayer=Mk);const jie="",Ts={LoadFail:0,BadSignature:1,BadTimestamp:2,BadSettingValue:3,BadFormat:4,UnknownSetting:5};class bs extends Error{constructor(t){super(t.reason);L(this,"code");L(this,"line");
40this.code=t.code,this.line=t.line}}const xF=/\r?\n|\r/gm;class zK{constructor(e){L(this,"writable");L(this,"readable");const t=new QK(e);this.writable=new WritableStream({write(i){t.transform(i)},close(){t.close()}}),this.readable=new ReadableStream({start(i){t.onLine=s=>i.enqueue(s),t.onClose=()=>i.close()}})}}class QK{constructor(e){L(this,"a","");L(this,"b");L(this,"onLine");L(this,"onClose");this.b=new TextDecoder(e)}transform(e){this.a+=this.b.decode(e,{stream:!0});const t=this.a.split(xF);this.a=t.pop()||"";for(let i=0;i<t.length;i++)this.onLine(t[i].trim())}close(){this.a&&this.onLine(this.a.trim()),this.a="",this.onClose()}}async function XK(n,e){const t=new ReadableStream({start(i){const s=n.split(xF);for(const r of s)i.enqueue(r);i.close()}});return Nk(t,e)}async function Nk(n,e){const t=(e==null?void 0:e.type)??"vtt";let i;if(typeof t=="string")switch(t){case"srt":i=(await se(()=>Promise.resolve().then(()=>xie),void 0,import.meta.url)).default;break;case"ssa":case"ass":i=(await se(()=>Promise.resolve().then(()=>wie),void 0,import.meta.url)).default;break;default:i=(await Promise.resolve().then(function(){return gj})).default}else i=t;let s;const r=n.getReader(),a=i(),o=!!(e!=null&&e.strict)||!!(e!=null&&e.errors);await a.init({strict:!1,...e,errors:o,type:t,cancel(){r.cancel(),s=a.done(!0)}});let l=1;for(;;){const{value:c,done:h}=await r.read();if(h){a.parse("",l),s=a.done(!1);break}a.parse(c,l),l++}return s}async function ZK(n,e){var a,o;const t=await n;if(!t.ok||!t.body){let l;return{metadata:{},cues:[],regions:[],errors:[l]}}const i=t.headers.get("content-type")||"",s=(a=i.match(/text\/(.*?)(?:;|$)/))==null?void 0:a[1],r=(o=i.match(/charset=(.*?)(?:;|$)/))==null?void 0:o[1];return LF(t.body,{type:s,encoding:r,...e})}async function LF(n,{encoding:e="utf-8",...t}={}){const i=n.pipeThrough(new zK(e));return Nk(i,t)}class wF extends EventTarget{constructor(t,i,s){super();L(this,"id","");L(this,"startTime");L(this,"endTime");L(this,"text");L(this,"pauseOnExit",!1);this.startTime=t,this.endTime=i,this.text=s}addEventListener(t,i,s){super.addEventListener(t,i,s)}removeEventListener(t,i,s){super.removeEventListener(t,i,s)}}const Fk=typeof document>"u",JK=Fk?wF:window.VTTCue;let cx=class extends JK{constructor(){super(...arguments);L(this,"region",null);L(this,"vertical","");L(this,"snapToLines",!0);L(this,"line","auto");L(this,"lineAlign","start");L(this,"position","auto");L(this,"positionAlign","auto");L(this,"size",100);L(this,"align","center");L(this,"style")}};class CF{constructor(){L(this,"id","");L(this,"width",100);L(this,"lines",3);L(this,"regionAnchorX",0);L(this,"regionAnchorY",100);L(this,"viewportAnchorX",0);L(this,"viewportAnchorY",100);L(this,"scroll","")}}const AR=",",ej="%";function tj(n){const e=parseInt(n,10);return Number.isNaN(e)?null:e}function yh(n){const e=parseInt(n.replace(ej,""),10);return!Number.isNaN(e)&&e>=0&&e<=100?e:null}function xR(n){if(!n.includes(AR))return null;const[e,t]=n.split(AR).map(yh);return e!==null&&t!==null?[e,t]:null}function ij(n){const e=parseFloat(n);return Number.isNaN(e)?null:e}const sj="WEBVTT",LR=",",nj="%",xl=/[:=]/,rj=/^[\s\t]*(region|vertical|line|position|size|align)[:=]/,aj="NOTE",oj="REGION",lj=/^REGION:?[\s\t]+/,oh=/[\s\t]+/,cj="-->",uj=/[\s\t]*-->[\s\t]+/,hj=/start|center|end|left|right/,dj=/start|center|end/,fj=/line-(?:left|right)|center|auto/,pj=/^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/;var Lh=(n=>(n[n.None=0]="None",n[n.Header=1]="Header",n[n.Cue=2]="Cue",n[n.Region=3]="Region",n[n.Note=4]="Note",n))(Lh||{});let Bk=class{constructor(){L(this,"h");L(this,"e",0);L(this,"i",{});L(this,"j",{});L(this,"l",[]);L(this,"c",null);L(this,"d",null);L(this,"m",[]);L(this,"f");L(this,"n","")}async init(e){this.h=e,e.strict&&(this.e=1),e.errors&&(this.f=(await se(()=>Promise.resolve().then(()=>uU),void 0,import.meta.url)).ParseErrorBuilder)}parse(e,t){var i,s,r,a,o,l;if(e==="")this.c?(this.l.push(this.c),(s=(i=this.h).onCue)==null||s.call(i,this.c),this.c=null):this.d?(this.j[this.d.id]=this.d,(a=(r=this.h).onRegion)==null||a.call(r,this.d),this.d=null):this.e===1&&(this.k(e,t),(l=(o=this.h).onHeaderMetadata)==null||l.call(o,this.i)),this.e=0;else if(this.e)switch(this.e){case 1:this.k(e,t);break;case 2:if(this.c){const c=this.c.text.length>0;!c&&rj.test(e)?this.o(e.split(oh),t):this.c.text+=(c?`
41`:"")+e}break;case 3:this.p(e.split(oh),t);break}else if(e.startsWith(aj))this.e=4;else if(e.startsWith(oj))this.e=3,this.d=new CF,this.p(e.replace(lj,"").split(oh),t);else if(e.includes(cj)){const c=this.q(e,t);c&&(this.c=new cx(c[0],c[1],""),this.c.id=this.n,this.o(c[2],t)),this.e=2}else t===1&&this.k(e,t);this.n=e}done(){return{metadata:this.i,cues:this.l,regions:Object.values(this.j),errors:this.m}}k(e,t){var i;if(t>1){if(xl.test(e)){const[s,r]=e.split(xl);s&&(this.i[s]=(r||"").replace(oh,""))}}else e.startsWith(sj)?this.e=1:this.g((i=this.f)==null?void 0:i.r())}q(e,t){var c,h,d;const[i,s=""]=e.split(uj),[r,...a]=s.split(oh),o=fl(i),l=fl(r);if(o!==null&&l!==null&&l>o)return[o,l,a];o===null&&this.g((c=this.f)==null?void 0:c.s(i,t)),l===null&&this.g((h=this.f)==null?void 0:h.t(r,t)),o!=null&&l!==null&&l>o&&this.g((d=this.f)==null?void 0:d.u(o,l,t))}p(e,t){var s,r;let i;for(let a=0;a<e.length;a++)if(xl.test(e[a])){i=!1;const[o,l]=e[a].split(xl);switch(o){case"id":this.d.id=l;break;case"width":const c=yh(l);c!==null?this.d.width=c:i=!0;break;case"lines":const h=tj(l);h!==null?this.d.lines=h:i=!0;break;case"regionanchor":const d=xR(l);
vendor: 9,665 bytes, lines 41-43
41d!==null?(this.d.regionAnchorX=d[0],this.d.regionAnchorY=d[1]):i=!0;break;case"viewportanchor":const f=xR(l);f!==null?(this.d.viewportAnchorX=f[0],this.d.viewportAnchorY=f[1]):i=!0;break;case"scroll":l==="up"?this.d.scroll="up":i=!0;break;default:this.g((s=this.f)==null?void 0:s.v(o,l,t))}i&&this.g((r=this.f)==null?void 0:r.w(o,l,t))}}o(e,t){var s,r;let i;for(let a=0;a<e.length;a++)if(i=!1,xl.test(e[a])){const[o,l]=e[a].split(xl);switch(o){case"region":const c=this.j[l];c&&(this.c.region=c);break;case"vertical":l==="lr"||l==="rl"?(this.c.vertical=l,this.c.region=null):i=!0;break;case"line":const[h,d]=l.split(LR);if(h.includes(nj)){const T=yh(h);T!==null?(this.c.line=T,this.c.snapToLines=!1):i=!0}else{const T=ij(h);T!==null?this.c.line=T:i=!0}dj.test(d)?this.c.lineAlign=d:d&&(i=!0),this.c.line!=="auto"&&(this.c.region=null);break;case"position":const[f,g]=l.split(LR),y=yh(f);y!==null?this.c.position=y:i=!0,g&&fj.test(g)?this.c.positionAlign=g:g&&(i=!0);break;case"size":const v=yh(l);v!==null?(this.c.size=v,v<100&&(this.c.region=null)):i=!0;break;case"align":hj.test(l)?this.c.align=l:i=!0;break;default:this.g((s=this.f)==null?void 0:s.x(o,l,t))}i&&this.g((r=this.f)==null?void 0:r.y(o,l,t))}}g(e){var t,i;if(e){if(this.m.push(e),this.h.strict)throw this.h.cancel(),e;(i=(t=this.h).onError)==null||i.call(t,e)}}};function fl(n){const e=n.match(pj);if(!e)return null;const t=e[1]?parseInt(e[1],10):0,i=parseInt(e[2],10),s=parseInt(e[3],10),r=e[4]?parseInt(e[4].padEnd(3,"0"),10):0,a=t*3600+i*60+s+r/1e3;return t<0||i<0||s<0||r<0||i>59||s>59?null:a}function mj(){return new Bk}var gj=Object.freeze({__proto__:null,VTTBlock:Lh,VTTParser:Bk,default:mj,parseVTTTimestamp:fl});const yj=/[0-9]/,vj=/[\s\t]+/,IF={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span",timestamp:"span"},Tj={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":" ","&lrm;":"‎","&rlm;":"‏"},bj=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,Ej=new Set(["white","lime","cyan","red","yellow","magenta","blue","black"]),Sj=new Set(Object.keys(IF));function kF(n){var c,h;let e="",t=1,i=[],s=[],r;for(let d=0;d<n.text.length;d++){const f=n.text[d];switch(t){case 1:f==="<"?(l(),t=2):e+=f;break;case 2:switch(f){case`
42`:case"	":case" ":a(),t=4;break;case".":a(),t=3;break;case"/":t=5;break;case">":a(),t=1;break;default:!e&&yj.test(f)&&(t=6),e+=f;break}break;case 3:switch(f){case"	":case" ":case`
43`:o(),r&&((c=r.class)==null||c.trim()),t=4;break;case".":o();break;case">":o(),r&&((h=r.class)==null||h.trim()),t=1;break;default:e+=f}break;case 4:f===">"?(e=e.replace(vj," "),(r==null?void 0:r.type)==="v"?r.voice=Fx(e):(r==null?void 0:r.type)==="lang"&&(r.lang=Fx(e)),e="",t=1):e+=f;break;case 5:f===">"&&(e="",r=s.pop(),t=1);break;case 6:if(f===">"){const g=fl(e);g!==null&&g>=n.startTime&&g<=n.endTime&&(e="timestamp",a(),r.time=g),e="",t=1}else e+=f;break}}function a(){if(Sj.has(e)){const d=r;r=_j(e),d?(s[s.length-1]!==d&&s.push(d),d.children.push(r)):i.push(r)}e="",t=1}function o(){if(r&&e){const d=e.replace("bg_","");Ej.has(d)?r[e.startsWith("bg_")?"bgColor":"color"]=d:r.class=r.class?r.class+" "+e:e}e=""}function l(){if(!e)return;const d={type:"text",data:Fx(e)};r?r.children.push(d):i.push(d),e=""}return t===1&&l(),i}function _j(n){return{tagName:IF[n],type:n,children:[]}}function Fx(n){return n.replace(bj,e=>Tj[e]||"'")}function Wt(n,e,t){n.style.setProperty(`--${e}`,t+"")}function hr(n,e,t=!0){n.setAttribute(`data-${e}`,t===!0?"":t+"")}function Vm(n,e){n.setAttribute("data-part",e)}function Aj(n){return parseFloat(getComputedStyle(n).lineHeight)||0}function xj(n){if(Fk)throw Error("[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`");const e=document.createElement("template");return e.innerHTML=Uk(n),{cue:n,content:e.content}}function Uk(n,e=0){return Vk(kF(n),e)}function Vk(n,e=0){let t,i="";for(const s of n)if(s.type==="text")i+=s.data;else{const r=s.type==="timestamp";t={},t.class=s.class,t.title=s.type==="v"&&s.voice,t.lang=s.type==="lang"&&s.lang,t["data-part"]=s.type==="v"&&"voice",r&&(t["data-part"]="timed",t["data-time"]=s.time,t["data-future"]=s.time>e,t["data-past"]=s.time<e),t.style=`${s.color?`color: ${s.color};`:""}${s.bgColor?`background-color: ${s.bgColor};`:""}`;const a=Object.entries(t).filter(o=>o[1]).map(o=>`${o[0]}="${o[1]===!0?"":o[1]}"`).join(" ");i+=`<${s.tagName}${a?" "+a:""}>${Vk(s.children)}</${s.tagName}>`}return i}function RF(n,e){if(!Fk)for(const t of n.querySelectorAll('[data-part="timed"]')){const i=Number(t.getAttribute("data-time"));Number.isNaN(i)||(i>e?hr(t,"future"):t.removeAttribute("data-future"),i<e?hr(t,"past"):t.removeAttribute("data-past"))}}function Lj(n,e){let t=null,i;function s(){r(),n(...i),i=void 0}function r(){clearTimeout(t),t=null}function a(){i=[].slice.call(arguments),r(),t=setTimeout(s,e)}return a}const fa=Symbol(0);function Hk(n){return n instanceof HTMLElement?{top:n.offsetTop,width:n.clientWidth,height:n.clientHeight,left:n.offsetLeft,right:n.offsetLeft+n.clientWidth,bottom:n.offsetTop+n.clientHeight}:{...n}}function Ig(n,e,t){switch(e){case"+x":n.left+=t,n.right+=t;break;case"-x":n.left-=t,n.right-=t;break;case"+y":n.top+=t,n.bottom+=t;break;case"-y":n.top-=t,n.bottom-=t;break}}function wj(n,e){return n.left<=e.right&&n.right>=e.left&&n.top<=e.bottom&&n.bottom>=e.top}function Cj(n,e){for(let t=0;t<e.length;t++)if(wj(n,e[t]))return e[t];return null}function wR(n,e){return e.top>=0&&e.bottom<=n.height&&e.left>=0&&e.right<=n.width}function Ij(n,e,t){switch(t){case"+x":return e.left<0;case"-x":return e.right>n.width;case"+y":return e.top<0;case"-y":return e.bottom>n.height}}function kj(n,e){const t=Math.max(0,Math.min(n.width,e.right)-Math.max(0,e.left)),i=Math.max(0,Math.min(n.height,e.bottom)-Math.max(0,e.top));return t*i/(n.height*n.width)}function qk(n,e){return{top:e.top/n.height,left:e.left/n.width,right:(n.width-e.right)/n.width,bottom:(n.height-e.bottom)/n.height}}function PF(n,e){return e.top=e.top*n.height,e.left=e.left*n.width,e.right=n.width-e.right*n.width,e.bottom=n.height-e.bottom*n.height,e}const DF=["top","left","right","bottom"];function OF(n,e,t,i){const s=qk(e,t);for(const r of DF)Wt(n,`${i}-${r}`,s[r]*100+"%")}function MF(n,e,t,i){let s=1,r,a={...e};for(let o=0;o<i.length;o++){for(;Ij(n,e,i[o])||wR(n,e)&&Cj(e,t);)Ig(e,i[o],1);if(wR(n,e))return e;const l=kj(n,e);s>l&&(r={...e},s=l),e={...a}}return r||a}const wh=Symbol(0);function Rj(n,e,t,i){let s=t.firstElementChild,r=Oj(e),a,o=[];if(t[fa]||(t[fa]=Pj(n,t)),a=PF(n,{...t[fa]}),t[wh])o=[t[wh]==="top"?"+y":"-y","+x","-x"];else if(e.snapToLines){let l;switch(e.vertical){case"":o=["+y","-y"],l="height";break;case"rl":o=["+x","-x"],l="width";break;case"lr":o=["-x","+x"],l="width";break}let c=Aj(s),h=c*Math.round(r),d=n[l]+c,f=o[0];Math.abs(h)>d&&(h=h<0?-1:1,h*=Math.ceil(d/c)*c),r<0&&(h+=e.vertical===""?n.height:n.width,o=o.reverse()),Ig(a,f,h)}else{const l=e.vertical==="",c=l?"+y":"+x",h=l?a.height:a.width;Ig(a,c,(l?n.height:n.width)*r/100),Ig(a,c,e.lineAlign==="center"?h/2:e.lineAlign==="end"?h:0),o=l?["-y","+y","-x","+x"]:["-x","+x","-y","+y"]}return a=MF(n,a,i,o),OF(t,n,a,"cue"),a}function Pj(n,e){const t=Hk(e),i=Dj(e);if(e[wh]=!1,i.top&&(t.top=i.top,t.bottom=i.top+t.height,e[wh]="top"),i.bottom){const s=n.height-i.bottom;t.top=s-t.height,t.bottom=s,e[wh]="bottom"}return i.left&&(t.left=i.left),i.right&&(t.right=n.width-i.right),qk(n,t)}function Dj(n){const e={};for(const t of DF)e[t]=parseFloat(n.style.getPropertyValue(`--cue-${t}`));return e}function Oj(n){return n.line==="auto"?n.snapToLines?-1:100:n.line}function Mj(n){if(n.position==="auto")switch(n.align){case"start":case"left":return 0;case"right":case"end":return 100;default:return 50}return n.position}function $j(n,e){if(n.positionAlign==="auto")switch(n.align){case"start":return e==="ltr"?"line-left":"line-right";case"end":return e==="ltr"?"line-right":"line-left";case"center":return"center";default:return`line-${n.align}`}return n.positionAlign}const Nj=["-y","+y","-x","+x"];function Fj(n,e,t,i){let s=Array.from(t.querySelectorAll('[data-part="cue-display"]')),r=0,a=Math.max(0,s.length-e.lines);for(let l=s.length-1;l>=a;l--)r+=s[l].offsetHeight;Wt(t,"region-height",r+"px"),t[fa]||(t[fa]=qk(n,Hk(t)));let o={...t[fa]};return o=PF(n,o),o.width=t.clientWidth,o.height=r,o.right=o.left+o.width,o.bottom=o.top+r,o=MF(n,o,i,Nj),OF(t,n,o,"region"),o}class Bj{constructor(e,t){L(this,"overlay");L(this,"z");L(this,"A",0);L(this,"C","ltr");L(this,"B",[]);L(this,"D",!1);L(this,"E");L(this,"j",new Map);L(this,"l",new Map);L(this,"K",Lj(()=>{this.D=!1,this.G();for(const e of this.j.values())e[fa]=null;for(const e of this.l.values())e&&(e[fa]=null);this.H(!0)},50));this.overlay=e,this.dir=(t==null?void 0:t.dir)??"ltr",e.setAttribute("translate","yes"),e.setAttribute("aria-live","off"),e.setAttribute("aria-atomic","true"),Vm(e,"captions"),this.G(),this.E=new ResizeObserver(this.I.bind(this)),this.E.observe(e)}get dir(){return this.C}set dir(e){this.C=e,hr(this.overlay,"dir",e)}get currentTime(){return this.A}set currentTime(e){this.A=e,this.update()}changeTrack({regions:e,cues:t}){this.reset(),this.J(e);for(const i of t)this.l.set(i,null);this.update()}addCue(e){this.l.set(e,null),this.update()}removeCue(e){this.l.delete(e),this.update()}update(e=!1){this.H(e)}reset(){this.l.clear(),this.j.clear(),this.B=[],this.overlay.textContent=""}destroy(){this.reset(),this.E.disconnect()}I(){this.D=!0,this.K()}G(){this.z=Hk(this.overlay),Wt(this.overlay,"overlay-width",this.z.width+"px"),Wt(this.overlay,"overlay-height",this.z.height+"px")}H(e=!1){if(!this.l.size||this.D)return;let t,i=[...this.l.keys()].filter(r=>this.A>
43=r.startTime&&this.A<=r.endTime).sort((r,a)=>r.startTime!==a.startTime?r.startTime-a.startTime:r.endTime-a.endTime),s=i.map(r=>r.region);for(let r=0;r<this.B.length;r++){if(t=this.B[r],i[r]===t)continue;if(t.region&&!s.includes(t.region)){const o=this.j.get(t.region.id);o&&(o.removeAttribute("data-active"),e=!0)}const a=this.l.get(t);a&&(a.remove(),e=!0)}for(let r=0;r<i.length;r++){t=i[r];let a=this.l.get(t);a||this.l.set(t,a=this.L(t));const o=this.F(t)&&this.j.get(t.region.id);o&&!o.hasAttribute("data-active")&&(requestAnimationFrame(()=>hr(o,"active")),e=!0),a.isConnected||((o||this.overlay).append(a),e=!0)}if(e){const r=[],a=new Set;for(let o=i.length-1;o>=0;o--){if(t=i[o],a.has(t.region||t))continue;const l=this.F(t),c=l?this.j.get(t.region.id):this.l.get(t);l?r.push(Fj(this.z,t.region,c,r)):r.push(Rj(this.z,t,c,r)),a.add(l?t.region:t)}}RF(this.overlay,this.A),this.B=i}J(e){if(e)for(const t of e){const i=this.M(t);this.j.set(t.id,i),this.overlay.append(i)}}M(e){const t=document.createElement("div");return Vm(t,"region"),hr(t,"id",e.id),hr(t,"scroll",e.scroll),Wt(t,"region-width",e.width+"%"),Wt(t,"region-anchor-x",e.regionAnchorX),Wt(t,"region-anchor-y",e.regionAnchorY),Wt(t,"region-viewport-anchor-x",e.viewportAnchorX),Wt(t,"region-viewport-anchor-y",e.viewportAnchorY),Wt(t,"region-lines",e.lines),t}L(e){var a;const t=document.createElement("div"),i=Mj(e),s=$j(e,this.C);if(Vm(t,"cue-display"),e.vertical!==""&&hr(t,"vertical"),Wt(t,"cue-text-align",e.align),e.style)for(const o of Object.keys(e.style))t.style.setProperty(o,e.style[o]);if(this.F(e))Wt(t,"cue-offset",`${i-(s==="line-right"?100:s==="center"?50:0)}%`);else if(Wt(t,"cue-writing-mode",e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl"),!((a=e.style)!=null&&a["--cue-width"])){let o=i;s==="line-left"?o=100-i:s==="center"&&i<=50?o=i*2:s==="center"&&i>50&&(o=(100-i)*2);const l=e.size<o?e.size:o;e.vertical===""?Wt(t,"cue-width",l+"%"):Wt(t,"cue-height",l+"%")}const r=document.createElement("div");return Vm(r,"cue"),e.id&&hr(r,"id",e.id),r.innerHTML=Uk(e),t.append(r),t}F(e){return e.region&&e.size===100&&e.vertical===""&&e.line==="auto"}}const hy=Object.freeze(Object.defineProperty({__proto__:null,CaptionsRenderer:Bj,ParseError:bs,ParseErrorCode:Ts,TextCue:wF,VTTCue:cx,VTTRegion:CF,createVTTCueTemplate:xj,parseByteStream:LF,parseResponse:ZK,parseText:XK,parseTextStream:Nk,parseVTTTimestamp:fl,renderVTTCueString:Uk,renderVTTTokensString:Vk,tokenizeVTTCue:kF,updateTimedVTTCueNodes:RF},Symbol.toStringTag,{value:"Module"}));var Hn,Rp,Pp,FC;class km{constructor(e){p(this,Pp);p(this,Hn,void 0);p(this,Rp,void 0);A(this,Rp,e)}start(){Vt(u(this,Hn))&&m(this,Pp,FC).call(this)}stop(){At(u(this,Hn))&&window.cancelAnimationFrame(u(this,Hn)),A(this,Hn,void 0)}}Hn=new WeakMap,Rp=new WeakMap,Pp=new WeakSet,FC=function(){A(this,Hn,window.requestAnimationFrame(()=>{Vt(u(this,Hn))||(u(this,Rp).call(this),m(this,Pp,FC).call(this))}))};let kg=null,dy=[],fy=[];function Gk(){return kg??(kg=new AudioContext)}function Uj(){const n=Gk(),e=n.createGain();return e.connect(n.destination),dy.push(e),e}function Vj(n,e){const t=Gk(),i=t.createMediaElementSource(n);return e&&i.connect(e),fy.push(i),i}function Hj(n){const e=dy.indexOf(n);e!==-1&&(dy.splice(e,1),n.disconnect(),$F())}function qj(n){const e=fy.indexOf(n);e!==-1&&(fy.splice(e,1),n.disconnect(),$F())}function $F(){kg&&dy.length===0&&fy.length===0&&kg.close().then(()=>{kg=null})}var Dp,cu,bi,Di,LS,NF,Op,BC;class Gj{constructor(e,t){p(this,LS);p(this,Op);p(this,Dp,void 0);p(this,cu,void 0);p(this,bi,null);p(this,Di,null);A(this,Dp,e),A(this,cu,t)}get currentGain(){var e,t;return((t=(e=u(this,bi))==null?void 0:e.gain)==null?void 0:t.value)??null}get supported(){return!0}setGain(e){const t=this.currentGain;if(e!==this.currentGain){if(e===1&&t!==1){this.removeGain();return}u(this,bi)||(A(this,bi,Uj()),u(this,Di)&&u(this,Di).connect(u(this,bi))),u(this,Di)||A(this,Di,Vj(u(this,Dp),u(this,bi))),u(this,bi).gain.value=e,u(this,cu).call(this,e)}}removeGain(){u(this,bi)&&(u(this,Di)&&u(this,Di).connect(Gk().destination),m(this,Op,BC).call(this),u(this,cu).call(this,null))}destroy(){m(this,LS,NF).call(this),m(this,Op,BC).call(this)}}Dp=new WeakMap,cu=new WeakMap,bi=new WeakMap,Di=new WeakMap,LS=new WeakSet,NF=function(){if(u(this,Di))try{qj(u(this,Di))}catch{}finally{A(this,Di,null)}},Op=new WeakSet,BC=function(){if(u(this,bi))try{Hj(u(this,bi))}catch{}finally{A(this,bi,null)}};const Kj=["focus","blur","visibilitychange","pageshow","pagehide"];var Uo,uu,Mp,wS,FF;
43class jj{constructor(){p(this,wS);p(this,Uo,ae(CR()));p(this,uu,ae(document.visibilityState));p(this,Mp,void 0)}connect(){const e=new Ve(window),t=m(this,wS,FF).bind(this);for(const i of Kj)e.add(i,t);Qg&&e.add("beforeunload",i=>{A(this,Mp,setTimeout(()=>{i.defaultPrevented||i.returnValue.length>0||(u(this,Uo).set("hidden"),u(this,uu).set("hidden"))},0))})}get pageState(){return u(this,Uo).call(this)}get visibility(){return u(this,uu).call(this)}}Uo=new WeakMap,uu=new WeakMap,Mp=new WeakMap,wS=new WeakSet,FF=function(e){Qg&&window.clearTimeout(u(this,Mp)),(e.type!=="blur"||u(this,Uo).call(this)==="active")&&(u(this,Uo).set(CR(e)),u(this,uu).set(document.visibilityState=="hidden"?"hidden":"visible"))};function CR(n){return(n==null?void 0:n.type)==="blur"||document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}var $p,Le,Qr,hu,du,Vo,Np,fu,Ce,Me,CS,BF,pu,mu,IS,UF,kS,VF,RS,HF,PS,qF,DS,qI,it,lt,GI,Yj,qn,Na,OS,GF,Fp,UC,MS,KF,$S,jF,NS,WF,gu,Rg,FS,YF,BS,zF,US,QF,VS,XF,HS,ZF,qS,JF,GS,e5,KS,t5,jS,i5,WS,s5,YS,n5,zS,r5,QS,a5,XS,o5,ZS,l5,JS,c5,e_,u5,t_,h5;class Wj{constructor(e,t){p(this,Ce);p(this,CS);p(this,IS);p(this,kS);p(this,RS);p(this,PS);p(this,it);p(this,GI);p(this,qn);p(this,OS);p(this,Fp);p(this,MS);p(this,$S);p(this,NS);p(this,gu);p(this,FS);p(this,BS);p(this,US);p(this,VS);p(this,HS);p(this,qS);p(this,GS);p(this,KS);p(this,jS);p(this,WS);p(this,YS);p(this,zS);p(this,QS);p(this,XS);p(this,ZS);p(this,JS);p(this,e_);p(this,t_);p(this,$p,void 0);p(this,Le,void 0);p(this,Qr,!1);p(this,hu,!1);p(this,du,!1);p(this,Vo,new km(m(this,IS,UF).bind(this)));p(this,Np,new jj);p(this,fu,void 0);p(this,pu,0);p(this,mu,-1);p(this,DS,void 0);p(this,qI,void 0);A(this,$p,e),A(this,Le,t),A(this,fu,new Ve(e.media)),m(this,kS,VF).call(this),u(this,Np).connect(),D(m(this,jS,i5).bind(this)),ge(m(this,CS,BF).bind(this))}}$p=new WeakMap,Le=new WeakMap,Qr=new WeakMap,hu=new WeakMap,du=new WeakMap,Vo=new WeakMap,Np=new WeakMap,fu=new WeakMap,Ce=new WeakSet,Me=function(){return u(this,$p).media},CS=new WeakSet,BF=function(){var e;A(this,hu,!1),A(this,du,!1),u(this,Vo).stop(),u(this,fu).abort(),(e=u(this,DS))==null||e.clear()},pu=new WeakMap,mu=new WeakMap,IS=new WeakSet,UF=function(){const e=u(this,Ce,Me).currentTime;!(Qg&&e-u(this,mu)<.35)&&u(this,pu)!==e&&(m(this,qn,Na).call(this,e),A(this,pu,e))},kS=new WeakSet,VF=function(){m(this,it,lt).call(this,"loadstart",m(this,OS,GF)),m(this,it,lt).call(this,"abort",m(this,Fp,UC)),m(this,it,lt).call(this,"emptied",m(this,MS,KF)),m(this,it,lt).call(this,"error",m(this,t_,h5)),m(this,it,lt).call(this,"volumechange",m(this,zS,r5))},RS=new WeakSet,HF=function(){u(this,hu)||(m(this,it,lt).call(this,"loadeddata",m(this,$S,jF)),m(this,it,lt).call(this,"loadedmetadata",m(this,NS,WF)),m(this,it,lt).call(this,"canplay",m(this,US,QF)),m(this,it,lt).call(this,"canplaythrough",m(this,VS,XF)),m(this,it,lt).call(this,"durationchange",m(this,YS,n5)),m(this,it,lt).call(this,"play",m(this,FS,YF)),m(this,it,lt).call(this,"progress",m(this,ZS,l5)),m(this,it,lt).call(this,"stalled",m(this,qS,JF)),m(this,it,lt).call(this,"suspend",m(this,JS,c5)),m(this,it,lt).call(this,"ratechange",m(this,e_,u5)),A(this,hu,!0))},PS=new WeakSet,qF=function(){u(this,du)||(m(this,it,lt).call(this,"pause",m(this,BS,zF)),m(this,it,lt).call(this,"playing",m(this,HS,ZF)),m(this,it,lt).call(this,"seeked",m(this,QS,a5)),m(this,it,lt).call(this,"seeking",m(this,XS,o5)),m(this,it,lt).call(this,"ended",m(this,KS,t5)),m(this,it,lt).call(this,"waiting",m(this,GS,e5)),A(this,du,!0))},DS=new WeakMap,qI=new WeakMap,it=new WeakSet,lt=function(e,t){u(this,fu).add(e,t.bind(this))},GI=new WeakSet,Yj=function(e){},qn=new WeakSet,Na=function(e,t){const i=Math.min(e,u(this,Le).$state.seekableEnd());u(this,Le).notify("time-change",i,t)},OS=new WeakSet,GF=function(e){if(u(this,Ce,Me).networkState===3){m(this,Fp,UC).call(this,e);return}m(this,RS,HF).call(this),u(this,Le).notify("load-start",void 0,e)},Fp=new WeakSet,UC=function(e){u(this,Le).notify("abort",void 0,e)},MS=new WeakSet,KF=function(){u(this,Le).notify("emptied",void 0,event)},$S=new WeakSet,jF=function(e){u(this,Le).notify("loaded-data",void 0,e)},NS=new WeakSet,WF=function(e){A(this,pu,0),A(this,mu,-1),m(this,PS,qF).call(this),u(this,Le).notify("loaded-metadata",void 0,e),(ZA||Qg&&Zu(u(this,Le).$state.source()))&&u(this,Le).delegate.ready(m(this,gu,Rg).call(this),e)},gu=new WeakSet,Rg=function(){return{provider:Y(u(this,Le).$provider),duration:u(this,Ce,Me).duration,buffered:u(this,Ce,Me).buffered,seekable:u(this,Ce,Me).seekable}},FS=new WeakSet,YF=function(e){u(this,Le).$state.canPlay&&u(this,Le).notify("play",void 0,e)},BS=new WeakSet,zF=function(e){u(this,Ce,Me).readyState===1&&!u(this,Qr)||(A(this,Qr,!1),u(this,Vo).stop(),u(this,Le).notify("pause",void 0,e))},US=new WeakSet,QF=function(e){u(this,Le).delegate.ready(m(this,gu,Rg).call(this),e)},VS=new WeakSet,XF=function(e){u(this,Le).$state.started()||u(this,Le).notify("can-play-through",m(this,gu,Rg).call(this),e)},HS=new WeakSet,ZF=function(e){u(this,Ce,Me).paused||(A(this,Qr,!1),u(this,Le).notify("playing",void 0,e),u(this,Vo).start())},qS=new WeakSet,JF=function(e){u(this,Le).notify("stalled",void 0,e),u(this,Ce,Me).readyState<3&&(A(this,Qr,!0),u(this,Le).notify("waiting",void 0,e))},GS=new WeakSet,e5=function(e){u(this,Ce,Me).readyState<3&&(A(this,Qr,!0),u(this,Le).notify("waiting",void 0,e))},KS=new WeakSet,t5=function(e){u(this,Vo).stop(),m(this,qn,Na).call(this,u(this,Ce,Me).duration,e),u(this,Le).notify("end",void 0,e),u(this,Le).$state.loop()&&HU(u(this,Ce,Me).controls)&&
43(u(this,Ce,Me).controls=!1)},jS=new WeakSet,i5=function(){const e=u(this,Le).$state.paused(),t=u(this,Np).visibility==="hidden";(e||t)&&Fe(u(this,Ce,Me),"timeupdate",m(this,WS,s5).bind(this))},WS=new WeakSet,s5=function(e){m(this,qn,Na).call(this,u(this,Ce,Me).currentTime,e)},YS=new WeakSet,n5=function(e){u(this,Le).$state.ended()&&m(this,qn,Na).call(this,u(this,Ce,Me).duration,e),u(this,Le).notify("duration-change",u(this,Ce,Me).duration,e)},zS=new WeakSet,r5=function(e){const t={volume:u(this,Ce,Me).volume,muted:u(this,Ce,Me).muted};u(this,Le).notify("volume-change",t,e)},QS=new WeakSet,a5=function(e){A(this,mu,u(this,Ce,Me).currentTime),m(this,qn,Na).call(this,u(this,Ce,Me).currentTime,e),u(this,Le).notify("seeked",u(this,Ce,Me).currentTime,e),Math.trunc(u(this,Ce,Me).currentTime)===Math.trunc(u(this,Ce,Me).duration)&&IL(u(this,Ce,Me).duration)>IL(u(this,Ce,Me).currentTime)&&(m(this,qn,Na).call(this,u(this,Ce,Me).duration,e),u(this,Ce,Me).ended||u(this,Le).player.dispatch(new ve("media-play-request",{trigger:e})))},XS=new WeakSet,o5=function(e){u(this,Le).notify("seeking",u(this,Ce,Me).currentTime,e)},ZS=new WeakSet,l5=function(e){const t={buffered:u(this,Ce,Me).buffered,seekable:u(this,Ce,Me).seekable};u(this,Le).notify("progress",t,e)},JS=new WeakSet,c5=function(e){u(this,Le).notify("suspend",void 0,e)},e_=new WeakSet,u5=function(e){u(this,Le).notify("rate-change",u(this,Ce,Me).playbackRate,e)},t_=new WeakSet,h5=function(e){const t=u(this,Ce,Me).error;if(!t)return;const i={message:t.message,code:t.code,mediaError:t};u(this,Le).notify("error",i,e)};var Bp,is,Xr,Dl,i_,d5,s_,f5,n_,p5,Up,VC,r_,m5;class zj{constructor(e,t){p(this,Xr);p(this,i_);p(this,s_);p(this,n_);p(this,Up);p(this,r_);p(this,Bp,void 0);p(this,is,void 0);A(this,Bp,e),A(this,is,t),u(this,Xr,Dl).onaddtrack=m(this,i_,d5).bind(this),u(this,Xr,Dl).onremovetrack=m(this,s_,f5).bind(this),u(this,Xr,Dl).onchange=m(this,n_,p5).bind(this),Fe(u(this,is).audioTracks,"change",m(this,r_,m5).bind(this))}}Bp=new WeakMap,is=new WeakMap,Xr=new WeakSet,Dl=function(){return u(this,Bp).media.audioTracks},i_=new WeakSet,d5=function(e){const t=e.track;if(t.label==="")return;const i=t.id.toString()||`native-audio-${u(this,is).audioTracks.length}`,s={id:i,label:t.label,language:t.language,kind:t.kind,selected:!1};u(this,is).audioTracks[he.add](s,e),t.enabled&&(s.selected=!0)},s_=new WeakSet,f5=function(e){const t=u(this,is).audioTracks.getById(e.track.id);t&&u(this,is).audioTracks[he.remove](t,e)},n_=new WeakSet,p5=function(e){let t=m(this,Up,VC).call(this);if(!t)return;const i=u(this,is).audioTracks.getById(t.id);i&&u(this,is).audioTracks[he.select](i,!0,e)},Up=new WeakSet,VC=function(){return Array.from(u(this,Xr,Dl)).find(e=>e.enabled)},r_=new WeakSet,m5=function(e){const{current:t}=e.detail;if(!t)return;const i=u(this,Xr,Dl).getTrackById(t.id);if(i){const s=m(this,Up,VC).call(this);s&&(s.enabled=!1),i.enabled=!0}};var Vp,HC;class g5{constructor(e,t){p(this,Vp);L(this,"scope",ma());L(this,"currentSrc",null);L(this,"audioGain");this.media=e,this.ctx=t,this.audioGain=new Gj(e,i=>{this.ctx.notify("audio-gain-change",i)})}setup(){new Wj(this,this.ctx),"audioTracks"in this.media&&new zj(this,this.ctx),ge(()=>{this.audioGain.destroy(),this.media.srcObject=null,this.media.removeAttribute("src");for(const e of this.media.querySelectorAll("source"))e.remove();this.media.load()})}get type(){return""}setPlaybackRate(e){this.media.playbackRate=e}async play(){return this.media.play()}async pause(){return this.media.pause()}setMuted(e){this.media.muted=e}setVolume(e){this.media.volume=e}setCurrentTime(e){this.media.currentTime=e}setPlaysInline(e){J(this.media,"playsinline",e)}async loadSource({src:e,type:t},i){this.media.preload=i||"",$V(e)?(this.removeSource(),this.media.srcObject=e):(this.media.srcObject=null,te(e)?t!=="?"?this.appendSource({src:e,type:t}):(this.removeSource(),this.media.src=m(this,Vp,HC).call(this,e)):(this.removeSource(),this.media.src=window.URL.createObjectURL(e))),this.media.load(),this.currentSrc={src:e,type:t}}appendSource(e,t){const i=this.media.querySelector("source[data-vds]"),s=i??document.createElement("source");J(s,"src",m(this,Vp,HC).call(this,e.src)),J(s,"type",e.type!=="?"?e.type:t),J(s,"data-vds",""),i||this.media.append(s)}removeSource(){var e;(e=this.media.querySelector("source[data-vds]"))==null||e.remove()}}Vp=new WeakSet,HC=function(e){const{clipStartTime:t,clipEndTime:i}=this.ctx.$state,s=t(),r=i();return s>0&&r>0?`${e}#t=${s},${r}`:s>0?`${e}#t=${s}`:r>0?`${e}#t=0,${r}`:e};var Oi,Hp,qp,Ho,a_,y5,o_,v5,l_,T5;class Qj{constructor(e,t){p(this,a_);p(this,o_);p(this,l_);p(this,Oi,void 0);p(this,Hp,void 0);p(this,qp,void 0);p(this,Ho,ae(!1));A(this,Oi,e),A(this,Hp,t),m(this,a_,y5).call(this)}get supported(){return u(this,Ho).call(this)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return this.type==="airplay"&&u(this,Oi).webkitShowPlaybackTargetPicker?u(this,Oi).webkitShowPlaybackTargetPicker():u(this,Oi).remote.prompt()}}Oi=new WeakMap,Hp=new WeakMap,qp=new WeakMap,Ho=new WeakMap,a_=new WeakSet,y5=function(){var e;!((e=u(this,Oi))!=null&&e.remote)||!this.canPrompt||(u(this,Oi).remote.watchAvailability(t=>{u(this,Ho).set(t)}).catch(()=>{u(this,Ho).set(!1)}),D(m(this,o_,v5).bind(this)))},o_=new WeakSet,v5=function(){if(!u(this,Ho).call(this))return;const e=["connecting","connect","disconnect"],t=m(this,l_,T5).bind(this);t(),Fe(u(this,Oi),"playing",t);const i=new Ve(u(this,Oi).remote);for(const s of e)i.add(s,t)},l_=new WeakSet,T5=function(e){const t=u(this,Oi).remote.state;if(t===u(this,qp))return;
43const i={type:this.type,state:t};u(this,Hp).notify("remote-playback-change",i,e),A(this,qp,t)};class b5 extends Qj{constructor(){super(...arguments);L(this,"type","airplay")}get canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}}class Xj extends g5{constructor(t,i){super(t,i);L(this,"$$PROVIDER_TYPE","AUDIO");L(this,"airPlay");Gt(()=>{this.airPlay=new b5(this.media,i)},this.scope)}get type(){return"audio"}setup(){super.setup(),this.type==="audio"&&this.ctx.notify("provider-setup",this)}get audio(){return this.media}}const Zj=Object.freeze(Object.defineProperty({__proto__:null,AudioProvider:Xj},Symbol.toStringTag,{value:"Module"}));var yu,vu,c_,E5,u_,S5;class Jj{constructor(e,t){p(this,c_);p(this,u_);p(this,yu,void 0);p(this,vu,void 0);A(this,yu,e),A(this,vu,t),e.textTracks.onaddtrack=m(this,c_,E5).bind(this),ge(m(this,u_,S5).bind(this))}}yu=new WeakMap,vu=new WeakMap,c_=new WeakSet,E5=function(e){const t=e.track;if(!t||eW(u(this,yu),t))return;const i=new ga({id:t.id,kind:t.kind,label:t.label??"",language:t.language,type:"vtt"});i[de.native]={track:t},i[de.readyState]=2,i[de.nativeHLS]=!0;let s=0;const r=a=>{if(t.cues)for(let o=s;o<t.cues.length;o++)i.addCue(t.cues[o],a),s++};r(e),t.oncuechange=r,u(this,vu).textTracks.add(i,e),i.setMode(t.mode,e)},u_=new WeakSet,S5=function(){var e;u(this,yu).textTracks.onaddtrack=null;for(const t of u(this,vu).textTracks){const i=(e=t[de.native])==null?void 0:e.track;i!=null&&i.oncuechange&&(i.oncuechange=null)}};function eW(n,e){return Array.from(n.children).find(t=>t.track===e)}var qo,Gp,h_,_5,d_,A5,Kp;class tW{constructor(e,t){p(this,h_);p(this,d_);p(this,qo,void 0);p(this,Gp,void 0);p(this,Kp,(e,t)=>{u(this,Gp).notify("picture-in-picture-change",e,t)});A(this,qo,e),A(this,Gp,t),new Ve(e).add("enterpictureinpicture",m(this,h_,_5).bind(this)).add("leavepictureinpicture",m(this,d_,A5).bind(this))}get active(){return document.pictureInPictureElement===u(this,qo)}get supported(){return F2(u(this,qo))}async enter(){return u(this,qo).requestPictureInPicture()}exit(){return document.exitPictureInPicture()}}qo=new WeakMap,Gp=new WeakMap,h_=new WeakSet,_5=function(e){u(this,Kp).call(this,!0,e)},d_=new WeakSet,A5=function(e){u(this,Kp).call(this,!1,e)},Kp=new WeakMap;var Go,Tu,Bs,f_,x5;class iW{constructor(e,t){p(this,f_);p(this,Go,void 0);p(this,Tu,void 0);p(this,Bs,"inline");A(this,Go,e),A(this,Tu,t),Fe(e,"webkitpresentationmodechanged",m(this,f_,x5).bind(this))}get mode(){return u(this,Bs)}get supported(){return B2(u(this,Go))}async setPresentationMode(e){u(this,Bs)!==e&&u(this,Go).webkitSetPresentationMode(e)}}Go=new WeakMap,Tu=new WeakMap,Bs=new WeakMap,f_=new WeakSet,x5=function(e){var i;const t=u(this,Bs);A(this,Bs,u(this,Go).webkitPresentationMode),(i=u(this,Tu).player)==null||i.dispatch(new ve("video-presentation-change",{detail:u(this,Bs),trigger:e})),["fullscreen","picture-in-picture"].forEach(s=>{(u(this,Bs)===s||t===s)&&u(this,Tu).notify(`${s}-change`,u(this,Bs)===s,e)})};var Zr;class sW{constructor(e){p(this,Zr,void 0);A(this,Zr,e)}get active(){return u(this,Zr).mode==="fullscreen"}get supported(){return u(this,Zr).supported}async enter(){u(this,Zr).setPresentationMode("fullscreen")}async exit(){u(this,Zr).setPresentationMode("inline")}}Zr=new WeakMap;var Jr;class nW{constructor(e){p(this,Jr,void 0);A(this,Jr,e)}get active(){return u(this,Jr).mode==="picture-in-picture"}get supported(){return u(this,Jr).supported}async enter(){u(this,Jr).setPresentationMode("picture-in-picture")}async exit(){u(this,Jr).setPresentationMode("inline")}}Jr=new WeakMap;class Kk extends g5{constructor(t,i){super(t,i);L(this,"$$PROVIDER_TYPE","VIDEO");L(this,"airPlay");L(this,"fullscreen");L(this,"pictureInPicture");Gt(()=>{if(this.airPlay=new b5(t,i),B2(t)){const s=new iW(t,i);this.fullscreen=new sW(s),this.pictureInPicture=new nW(s)}else F2(t)&&(this.pictureInPicture=new tW(t,i))},this.scope)}get type(){return"video"}setup(){super.setup(),N2(this.video)&&new Jj(this.video,this.ctx),this.ctx.textRenderers.attachVideo(this.video),ge(()=>{this.ctx.textRenderers.attachVideo(null)}),this.type==="video"&&this.ctx.notify("provider-setup",this)}get video(){return this.media}}const rW=Object.freeze(Object.defineProperty({__proto__:null,VideoProvider:Kk},Symbol.toStringTag,{value:"Module"})),aW=n=>XA(n);var Ko,Ke,Ie,bu,Eu,Gn,Fa,p_,L5,m_,w5,g_,C5,y_,I5,v_,k5,T_,R5,b_,P5,E_,D5,S_,O5,__,M5,A_,$5,x_,N5,L_,F5,w_,B5;class oW{constructor(e,t){p(this,Gn);p(this,p_);p(this,m_);p(this,g_);p(this,y_);p(this,v_);p(this,T_);p(this,b_);p(this,E_);p(this,S_);p(this,__);p(this,A_);p(this,x_);p(this,L_);p(this,w_);p(this,Ko,void 0);p(this,Ke,void 0);p(this,Ie,null);p(this,bu,null);L(this,"config",{});p(this,Eu,new Set);A(this,Ko,e),A(this,Ke,t)}get instance(){return u(this,Ie)}setup(e){const{streamType:t}=u(this,Ke).$state,i=Y(t).includes("live"),s=Y(t).includes("ll-");A(this,Ie,new e({lowLatencyMode:s,backBufferLength:s?4:i?8:void 0,renderTextTracksNatively:!1,...this.config}));const r=m(this,g_,C5).bind(this);for(const a of Object.values(e.Events))u(this,Ie).on(a,r);u(this,Ie).on(e.Events.ERROR,m(this,__,M5).bind(this));for(const a of u(this,Eu))a(u(this,Ie));
43u(this,Ke).player.dispatch("hls-instance",{detail:u(this,Ie)}),u(this,Ie).attachMedia(u(this,Ko)),u(this,Ie).on(e.Events.AUDIO_TRACK_SWITCHED,m(this,T_,R5).bind(this)),u(this,Ie).on(e.Events.LEVEL_SWITCHED,m(this,b_,P5).bind(this)),u(this,Ie).on(e.Events.LEVEL_LOADED,m(this,S_,O5).bind(this)),u(this,Ie).on(e.Events.LEVEL_UPDATED,m(this,E_,D5).bind(this)),u(this,Ie).on(e.Events.NON_NATIVE_TEXT_TRACKS_FOUND,m(this,y_,I5).bind(this)),u(this,Ie).on(e.Events.CUES_PARSED,m(this,v_,k5).bind(this)),u(this,Ke).qualities[Ft.enableAuto]=m(this,x_,N5).bind(this),Fe(u(this,Ke).qualities,"change",m(this,L_,F5).bind(this)),Fe(u(this,Ke).audioTracks,"change",m(this,w_,B5).bind(this)),A(this,bu,D(m(this,p_,L5).bind(this)))}onInstance(e){return u(this,Eu).add(e),()=>u(this,Eu).delete(e)}loadSource(e){var t;te(e.src)&&((t=u(this,Ie))==null||t.loadSource(e.src))}destroy(){var e,t;(e=u(this,Ie))==null||e.destroy(),A(this,Ie,null),(t=u(this,bu))==null||t.call(this),A(this,bu,null)}}Ko=new WeakMap,Ke=new WeakMap,Ie=new WeakMap,bu=new WeakMap,Eu=new WeakMap,Gn=new WeakSet,Fa=function(e,t){return new ve(aW(e),{detail:t})},p_=new WeakSet,L5=function(){if(!u(this,Ke).$state.live())return;const e=new km(m(this,m_,w5).bind(this));return e.start(),e.stop.bind(e)},m_=new WeakSet,w5=function(){var e;u(this,Ke).$state.liveSyncPosition.set(((e=u(this,Ie))==null?void 0:e.liveSyncPosition)??1/0)},g_=new WeakSet,C5=function(e,t){var i;(i=u(this,Ke).player)==null||i.dispatch(m(this,Gn,Fa).call(this,e,t))},y_=new WeakSet,I5=function(e,t){const i=m(this,Gn,Fa).call(this,e,t);let s=-1;for(let r=0;r<t.tracks.length;r++){const a=t.tracks[r],o=a.subtitleTrack??a.closedCaptions,l=new ga({id:`hls-${a.kind}-${r}`,src:o==null?void 0:o.url,label:a.label,language:o==null?void 0:o.lang,kind:a.kind,default:a.default});l[de.readyState]=2,l[de.onModeChange]=()=>{l.mode==="showing"?(u(this,Ie).subtitleTrack=r,s=r):s===r&&(u(this,Ie).subtitleTrack=-1,s=-1)},u(this,Ke).textTracks.add(l,i)}},v_=new WeakSet,k5=function(e,t){var a;const i=(a=u(this,Ie))==null?void 0:a.subtitleTrack,s=u(this,Ke).textTracks.getById(`hls-${t.type}-${i}`);if(!s)return;const r=m(this,Gn,Fa).call(this,e,t);for(const o of t.cues)o.positionAlign="auto",s.addCue(o,r)},T_=new WeakSet,R5=function(e,t){const i=u(this,Ke).audioTracks[t.id];if(i){const s=m(this,Gn,Fa).call(this,e,t);u(this,Ke).audioTracks[he.select](i,!0,s)}},b_=new WeakSet,P5=function(e,t){const i=u(this,Ke).qualities[t.level];if(i){const s=m(this,Gn,Fa).call(this,e,t);u(this,Ke).qualities[he.select](i,!0,s)}},E_=new WeakSet,D5=function(e,t){t.details.totalduration>0&&u(this,Ke).$state.inferredLiveDVRWindow.set(t.details.totalduration)},S_=new WeakSet,O5=function(e,t){var c;if(u(this,Ke).$state.canPlay())return;const{type:i,live:s,totalduration:r,targetduration:a}=t.details,o=m(this,Gn,Fa).call(this,e,t);u(this,Ke).notify("stream-type-change",s?i==="EVENT"&&Number.isFinite(r)&&a>=10?"live:dvr":"live":"on-demand",o),u(this,Ke).notify("duration-change",r,o);const l=u(this,Ie).media;u(this,Ie).currentLevel===-1&&u(this,Ke).qualities[Ft.setAuto](!0,o);for(const h of u(this,Ie).audioTracks){const d={id:h.id.toString(),label:h.name,language:h.lang||"",kind:"main"};u(this,Ke).audioTracks[he.add](d,o)}for(const h of u(this,Ie).levels){const d={id:((c=h.id)==null?void 0:c.toString())??h.height+"p",width:h.width,height:h.height,codec:h.codecSet,bitrate:h.bitrate};u(this,Ke).qualities[he.add](d,o)}l.dispatchEvent(new ve("canplay",{trigger:o}))},__=new WeakSet,M5=function(e,t){var i;if(t.fatal)switch(t.type){case"mediaError":(i=u(this,Ie))==null||i.recoverMediaError();break;default:m(this,A_,$5).call(this,t.error);break}},A_=new WeakSet,$5=function(e){u(this,Ke).notify("error",{message:e.message,code:1,error:e})},x_=new WeakSet,N5=function(){u(this,Ie)&&(u(this,Ie).currentLevel=-1)},L_=new WeakSet,F5=function(){const{qualities:e}=u(this,Ke);!u(this,Ie)||e.auto||(u(this,Ie)[e.switch+"Level"]=e.selectedIndex,JA&&(u(this,Ko).currentTime=u(this,Ko).currentTime))},w_=new WeakSet,B5=function(){const{audioTracks:e}=u(this,Ke);u(this,Ie)&&u(this,Ie).audioTrack!==e.selectedIndex&&(u(this,Ie).audioTrack=e.selectedIndex)};var jo,Us,jp,C_,U5,I_,V5,k_,H5,R_,q5;class lW{constructor(e,t,i){p(this,C_);p(this,I_);p(this,k_);p(this,R_);p(this,jo,void 0);p(this,Us,void 0);p(this,jp,void 0);A(this,jo,e),A(this,Us,t),A(this,jp,i),m(this,C_,U5).call(this)}}jo=new WeakMap,Us=new WeakMap,jp=new WeakMap,C_=new WeakSet,U5=async function(){const e={onLoadStart:m(this,I_,V5).bind(this),onLoaded:m(this,k_,H5).bind(this),onLoadError:m(this,R_,q5).bind(this)};let t=await uW(u(this,jo),e);if(Vt(t)&&!te(u(this,jo))&&(t=await cW(u(this,jo),e)),!t)return null;if(!t.isSupported()){const i="[vidstack] `hls.js` is not supported in this environment";
43return u(this,Us).player.dispatch(new ve("hls-unsupported")),u(this,Us).notify("error",{message:i,code:4}),null}return t},I_=new WeakSet,V5=function(){u(this,Us).player.dispatch(new ve("hls-lib-load-start"))},k_=new WeakSet,H5=function(e){u(this,Us).player.dispatch(new ve("hls-lib-loaded",{detail:e})),u(this,jp).call(this,e)},R_=new WeakSet,q5=function(e){const t=Ah(e);u(this,Us).player.dispatch(new ve("hls-lib-load-error",{detail:t})),u(this,Us).notify("error",{message:t.message,code:4,error:t})};async function cW(n,e={}){var t,i,s,r,a;if(!Vt(n)){if((t=e.onLoadStart)==null||t.call(e),n.prototype&&n.prototype!==Function)return(i=e.onLoaded)==null||i.call(e,n),n;try{const o=(s=await n())==null?void 0:s.default;if(o&&o.isSupported)(r=e.onLoaded)==null||r.call(e,o);else throw Error("");return o}catch(o){(a=e.onLoadError)==null||a.call(e,o)}}}async function uW(n,e={}){var t,i,s;if(te(n)){(t=e.onLoadStart)==null||t.call(e);try{if(await ik(n),!hs(window.Hls))throw Error("");const r=window.Hls;return(i=e.onLoaded)==null||i.call(e,r),r}catch(r){(s=e.onLoadError)==null||s.call(e,r)}}}const hW="https://cdn.jsdelivr.net";var Wp,ss,ea;class G5 extends Kk{constructor(){super(...arguments);L(this,"$$PROVIDER_TYPE","HLS");p(this,Wp,null);p(this,ss,new oW(this.video,this.ctx));p(this,ea,`${hW}/npm/hls.js@^1.5.0/dist/hls.min.js`)}get ctor(){return u(this,Wp)}get instance(){return u(this,ss).instance}get type(){return"hls"}get canLiveSync(){return!0}get config(){return u(this,ss).config}set config(t){u(this,ss).config=t}get library(){return u(this,ea)}set library(t){A(this,ea,t)}preconnect(){te(u(this,ea))&&tr(u(this,ea))}setup(){super.setup(),new lW(u(this,ea),this.ctx,t=>{A(this,Wp,t),u(this,ss).setup(t),this.ctx.notify("provider-setup",this);const i=Y(this.ctx.$state.source);i&&this.loadSource(i)})}async loadSource(t,i){if(!te(t.src)){this.removeSource();return}this.media.preload=i||"",this.appendSource(t,"application/x-mpegurl"),u(this,ss).loadSource(t),this.currentSrc=t}onInstance(t){const i=u(this,ss).instance;return i&&t(i),u(this,ss).onInstance(t)}destroy(){u(this,ss).destroy()}}Wp=new WeakMap,ss=new WeakMap,ea=new WeakMap,L(G5,"supported",ex());const dW=Object.freeze(Object.defineProperty({__proto__:null,HLSProvider:G5},Symbol.toStringTag,{value:"Module"}));function IR(n){try{return new Intl.DisplayNames(navigator.languages,{type:"language"}).of(n)??null}catch{return null}}const fW=n=>`dash-${XA(n)}`;var ta,je,_e,Su,_u,Kn,Ba,P_,K5,D_,j5,O_,W5,jn,Au,M_,Y5,$_,z5,N_,Q5,F_,X5,B_,Z5,U_,J5,V_,e8,H_,t8,ia,q_,i8,xu,Pg,Yp,qC,G_,s8,zp,GC,K_,n8,j_,r8,Qp,KC;class pW{constructor(e,t){p(this,Kn);p(this,P_);p(this,D_);p(this,O_);p(this,M_);p(this,$_);p(this,N_);p(this,F_);p(this,B_);p(this,U_);p(this,V_);p(this,H_);p(this,q_);p(this,xu);p(this,Yp);p(this,G_);p(this,zp);p(this,K_);p(this,j_);p(this,Qp);p(this,ta,void 0);p(this,je,void 0);p(this,_e,null);p(this,Su,new Set);p(this,_u,null);L(this,"config",{});p(this,jn,null);p(this,Au,{});p(this,ia,-1);A(this,ta,e),A(this,je,t)}get instance(){return u(this,_e)}setup(e){A(this,_e,e().create());const t=m(this,O_,W5).bind(this);for(const i of Object.values(e.events))u(this,_e).on(i,t);u(this,_e).on(e.events.ERROR,m(this,U_,J5).bind(this));for(const i of u(this,Su))i(u(this,_e));u(this,je).player.dispatch("dash-instance",{detail:u(this,_e)}),u(this,_e).initialize(u(this,ta),void 0,!1),u(this,_e).updateSettings({streaming:{text:{defaultEnabled:!1,dispatchForManualRendering:!0},buffer:{fastSwitchEnabled:!0}},...this.config}),u(this,_e).on(e.events.FRAGMENT_LOADING_STARTED,m(this,V_,e8).bind(this)),u(this,_e).on(e.events.FRAGMENT_LOADING_COMPLETED,m(this,H_,t8).bind(this)),u(this,_e).on(e.events.MANIFEST_LOADED,m(this,B_,Z5).bind(this)),u(this,_e).on(e.events.QUALITY_CHANGE_RENDERED,m(this,F_,X5).bind(this)),u(this,_e).on(e.events.TEXT_TRACKS_ADDED,m(this,$_,z5).bind(this)),u(this,_e).on(e.events.TRACK_CHANGE_RENDERED,m(this,N_,Q5).bind(this)),u(this,je).qualities[Ft.enableAuto]=m(this,G_,s8).bind(this),Fe(u(this,je).qualities,"change",m(this,K_,n8).bind(this)),Fe(u(this,je).audioTracks,"change",m(this,j_,r8).bind(this)),A(this,_u,D(m(this,P_,K5).bind(this)))}onInstance(e){return u(this,Su).add(e),()=>u(this,Su).delete(e)}loadSource(e){var t;m(this,Qp,KC).call(this),te(e.src)&&((t=u(this,_e))==null||t.attachSource(e.src))}destroy(){var e,t;m(this,Qp,KC).call(this),(e=u(this,_e))==null||e.destroy(),A(this,_e,null),(t=u(this,_u))==null||t.call(this),A(this,_u,null)}}ta=new WeakMap,je=new WeakMap,_e=new WeakMap,Su=new WeakMap,_u=new WeakMap,Kn=new WeakSet,Ba=function(e){return new ve(fW(e.type),{detail:e})},P_=new WeakSet,K5=function(){if(!u(this,je).$state.live())return;const e=new km(m(this,D_,j5).bind(this));return e.start(),e.stop.bind(e)},D_=new WeakSet,j5=function(){if(!u(this,_e))return;const e=u(this,_e).duration()-u(this,_e).time();u(this,je).$state.liveSyncPosition.set(isNaN(e)?1/0:e)},O_=new WeakSet,W5=function(e){var t;
43(t=u(this,je).player)==null||t.dispatch(m(this,Kn,Ba).call(this,e))},jn=new WeakMap,Au=new WeakMap,M_=new WeakSet,Y5=function(e){var o;const t=(o=u(this,jn))==null?void 0:o[de.native],i=(t==null?void 0:t.track).cues;if(!t||!i)return;const s=u(this,jn).id,r=u(this,Au)[s]??0,a=m(this,Kn,Ba).call(this,e);for(let l=r;l<i.length;l++){const c=i[l];c.positionAlign||(c.positionAlign="auto"),u(this,jn).addCue(c,a)}u(this,Au)[s]=i.length},$_=new WeakSet,z5=function(e){var r;if(!u(this,_e))return;const t=e.tracks,i=[...u(this,ta).textTracks].filter(a=>"manualMode"in a),s=m(this,Kn,Ba).call(this,e);for(let a=0;a<i.length;a++){const o=t[a],l=i[a],c=`dash-${o.kind}-${a}`,h=new ga({id:c,label:(o==null?void 0:o.label)??((r=o.labels.find(d=>d.text))==null?void 0:r.text)??((o==null?void 0:o.lang)&&IR(o.lang))??(o==null?void 0:o.lang)??void 0,language:o.lang??void 0,kind:o.kind,default:o.defaultTrack});h[de.native]={managed:!0,track:l},h[de.readyState]=2,h[de.onModeChange]=()=>{u(this,_e)&&(h.mode==="showing"?(u(this,_e).setTextTrack(a),A(this,jn,h)):(u(this,_e).setTextTrack(-1),A(this,jn,null)))},u(this,je).textTracks.add(h,s)}},N_=new WeakSet,Q5=function(e){const{mediaType:t,newMediaInfo:i}=e;if(t==="audio"){const s=u(this,je).audioTracks.getById(`dash-audio-${i.index}`);if(s){const r=m(this,Kn,Ba).call(this,e);u(this,je).audioTracks[he.select](s,!0,r)}}},F_=new WeakSet,X5=function(e){if(e.mediaType!=="video")return;const t=u(this,je).qualities[e.newQuality];if(t){const i=m(this,Kn,Ba).call(this,e);u(this,je).qualities[he.select](t,!0,i)}},B_=new WeakSet,Z5=function(e){if(u(this,je).$state.canPlay()||!u(this,_e))return;const{type:t,mediaPresentationDuration:i}=e.data,s=m(this,Kn,Ba).call(this,e);u(this,je).notify("stream-type-change",t!=="static"?"live":"on-demand",s),u(this,je).notify("duration-change",i,s),u(this,je).qualities[Ft.setAuto](!0,s);const r=u(this,_e).getVideoElement(),a=u(this,_e).getTracksForTypeFromManifest("video",e.data),o=[...new Set(a.map(d=>d.mimeType))].find(d=>d&&$2(r,d)),l=a.filter(d=>o===d.mimeType)[0];let c=u(this,_e).getTracksForTypeFromManifest("audio",e.data);const h=[...new Set(c.map(d=>d.mimeType))].find(d=>d&&M2(r,d));if(c=c.filter(d=>h===d.mimeType),l.bitrateList.forEach((d,f)=>{var y;const g={id:((y=d.id)==null?void 0:y.toString())??`dash-bitrate-${f}`,width:d.width??0,height:d.height??0,bitrate:d.bandwidth??0,codec:l.codec,index:f};u(this,je).qualities[he.add](g,s)}),At(l.index)){const d=u(this,je).qualities[l.index];d&&u(this,je).qualities[he.select](d,!0,s)}c.forEach((d,f)=>{const y=d.labels.find(T=>navigator.languages.some(b=>T.lang&&b.toLowerCase().startsWith(T.lang.toLowerCase())))||d.labels[0],v={id:`dash-audio-${d==null?void 0:d.index}`,label:(y==null?void 0:y.text)??(d.lang&&IR(d.lang))??d.lang??"",language:d.lang??"",kind:"main",mimeType:d.mimeType,codec:d.codec,index:f};u(this,je).audioTracks[he.add](v,s)}),r.dispatchEvent(new ve("canplay",{trigger:s}))},U_=new WeakSet,J5=function(e){const{type:t,error:i}=e;switch(i.code){case 27:m(this,q_,i8).call(this,i);break;default:m(this,Yp,qC).call(this,i);break}},V_=new WeakSet,e8=function(){u(this,ia)>=0&&m(this,xu,Pg).call(this)},H_=new WeakSet,t8=function(e){e.mediaType==="text"&&requestAnimationFrame(m(this,M_,Y5).bind(this,e))},ia=new WeakMap,q_=new WeakSet,i8=function(e){var t;m(this,xu,Pg).call(this),(t=u(this,_e))==null||t.play(),A(this,ia,window.setTimeout(()=>{A(this,ia,-1),m(this,Yp,qC).call(this,e)},5e3))},xu=new WeakSet,Pg=function(){clearTimeout(u(this,ia)),A(this,ia,-1)},Yp=new WeakSet,qC=function(e){u(this,je).notify("error",{message:e.message??"",code:1,error:e})},G_=new WeakSet,s8=function(){var t;m(this,zp,GC).call(this,"video",!0);const{qualities:e}=u(this,je);(t=u(this,_e))==null||t.setQualityFor("video",e.selectedIndex,!0)},zp=new WeakSet,GC=function(e,t){var i;(i=u(this,_e))==null||i.updateSettings({streaming:{abr:{autoSwitchBitrate:{[e]:t}}}})},K_=new WeakSet,n8=function(){const{qualities:e}=u(this,je);!u(this,_e)||e.auto||!e.selected||(m(this,zp,GC).call(this,"video",!1),u(this,_e).setQualityFor("video",e.selectedIndex,e.switch==="current"),JA&&(u(this,ta).currentTime=u(this,ta).currentTime))},j_=new WeakSet,r8=function(){if(!u(this,_e))return;const{audioTracks:e}=u(this,je),t=u(this,_e).getTracksFor("audio").find(i=>e.selected&&e.selected.id===`dash-audio-${i.index}`);t&&u(this,_e).setCurrentTrack(t)},Qp=new WeakSet,KC=function(){m(this,xu,Pg).call(this),A(this,jn,null),A(this,Au,{})};var Wo,Vs,Xp,W_,a8,Y_,o8,z_,l8,Q_,c8;class mW{constructor(e,t,i){p(this,W_);p(this,Y_);p(this,z_);p(this,Q_);p(this,Wo,void 0);p(this,Vs,void 0);p(this,Xp,void 0);A(this,Wo,e),A(this,Vs,t),A(this,Xp,i),m(this,W_,a8).call(this)}}Wo=new WeakMap,Vs=new WeakMap,Xp=new WeakMap,W_=new WeakSet,a8=async function(){const e={onLoadStart:m(this,Y_,o8).bind(this),onLoaded:m(this,z_,l8).bind(this),onLoadError:m(this,Q_,c8).bind(this)};let t=await yW(u(this,Wo),e);if(Vt(t)&&!te(u(this,Wo))&&(t=await gW(u(this,Wo),e)),!t)return null;if(!window.dashjs.supportsMediaSource()){const i="[vidstack] `dash.js` is not supported in this environment";
43return u(this,Vs).player.dispatch(new ve("dash-unsupported")),u(this,Vs).notify("error",{message:i,code:4}),null}return t},Y_=new WeakSet,o8=function(){u(this,Vs).player.dispatch(new ve("dash-lib-load-start"))},z_=new WeakSet,l8=function(e){u(this,Vs).player.dispatch(new ve("dash-lib-loaded",{detail:e})),u(this,Xp).call(this,e)},Q_=new WeakSet,c8=function(e){const t=Ah(e);u(this,Vs).player.dispatch(new ve("dash-lib-load-error",{detail:t})),u(this,Vs).notify("error",{message:t.message,code:4,error:t})};async function gW(n,e={}){var t,i,s,r,a,o,l;if(!Vt(n)){if((t=e.onLoadStart)==null||t.call(e),vW(n))return(i=e.onLoaded)==null||i.call(e,n),n;if(kR(n)){const c=n.MediaPlayer;return(s=e.onLoaded)==null||s.call(e,c),c}try{const c=(r=await n())==null?void 0:r.default;if(kR(c))return(a=e.onLoaded)==null||a.call(e,c.MediaPlayer),c.MediaPlayer;if(c)(o=e.onLoaded)==null||o.call(e,c);else throw Error("");return c}catch(c){(l=e.onLoadError)==null||l.call(e,c)}}}async function yW(n,e={}){var t,i,s;if(te(n)){(t=e.onLoadStart)==null||t.call(e);try{if(await ik(n),!hs(window.dashjs.MediaPlayer))throw Error("");const r=window.dashjs.MediaPlayer;return(i=e.onLoaded)==null||i.call(e,r),r}catch(r){(s=e.onLoadError)==null||s.call(e,r)}}}function vW(n){return n&&n.prototype&&n.prototype!==Function}function kR(n){return n&&"MediaPlayer"in n}const TW="https://cdn.jsdelivr.net";var Zp,ns,sa;class u8 extends Kk{constructor(){super(...arguments);L(this,"$$PROVIDER_TYPE","DASH");p(this,Zp,null);p(this,ns,new pW(this.video,this.ctx));p(this,sa,`${TW}/npm/[email protected]/dist/dash.all.min.js`)}get ctor(){return u(this,Zp)}get instance(){return u(this,ns).instance}get type(){return"dash"}get canLiveSync(){return!0}get config(){return u(this,ns).config}set config(t){u(this,ns).config=t}get library(){return u(this,sa)}set library(t){A(this,sa,t)}preconnect(){te(u(this,sa))&&tr(u(this,sa))}setup(){super.setup(),new mW(u(this,sa),this.ctx,t=>{A(this,Zp,t),u(this,ns).setup(t),this.ctx.notify("provider-setup",this);const i=Y(this.ctx.$state.source);i&&this.loadSource(i)})}async loadSource(t,i){if(!te(t.src)){this.removeSource();return}this.media.preload=i||"",this.appendSource(t,"application/x-mpegurl"),u(this,ns).loadSource(t),this.currentSrc=t}onInstance(t){const i=u(this,ns).instance;return i&&t(i),u(this,ns).onInstance(t)}destroy(){u(this,ns).destroy()}}Zp=new WeakMap,ns=new WeakMap,sa=new WeakMap,L(u8,"supported",U2());const bW=Object.freeze(Object.defineProperty({__proto__:null,DASHProvider:u8},Symbol.toStringTag,{value:"Module"}));var Hs,X_,d8,Z_,f8;class h8{constructor(e){p(this,X_);p(this,Z_);p(this,Hs,void 0);L(this,"src",ae(""));L(this,"referrerPolicy",null);A(this,Hs,e),e.setAttribute("frameBorder","0"),e.setAttribute("aria-hidden","true"),e.setAttribute("allow","autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"),this.referrerPolicy!==null&&e.setAttribute("referrerpolicy",this.referrerPolicy)}get iframe(){return u(this,Hs)}setup(){Fe(window,"message",m(this,Z_,f8).bind(this)),Fe(u(this,Hs),"load",this.onLoad.bind(this)),D(m(this,X_,d8).bind(this))}postMessage(e,t){var i;(i=u(this,Hs).contentWindow)==null||i.postMessage(JSON.stringify(e),t??"*")}}Hs=new WeakMap,X_=new WeakSet,d8=function(){const e=this.src();if(!e.length){u(this,Hs).setAttribute("src","");return}const t=Y(()=>this.buildParams());u(this,Hs).setAttribute("src",BV(e,t))},Z_=new WeakSet,f8=function(e){var s;const t=this.getOrigin();if((e.source===null||e.source===((s=u(this,Hs))==null?void 0:s.contentWindow))&&(!te(t)||t===e.origin)){try{const r=JSON.parse(e.data);r&&this.onMessage(r,e);return}catch{}e.data&&this.onMessage(e.data,e)}};const EW=/(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/,Bx=new Map,Hm=new Map;function p8(n){const e=n.match(EW);return{videoId:e==null?void 0:e[1],hash:e==null?void 0:e[2]}}async function m8(n,e,t){if(Bx.has(n))return Bx.get(n);if(Hm.has(n))return Hm.get(n);let i=`https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${n}`;t&&(i=i.concat(`?h=${t}`));const s=window.fetch(i,{mode:"cors",signal:e.signal}).then(r=>r.json()).then(r=>{var h,d;const a=/vimeocdn.com\/video\/(.*)?_/,o=(d=(h=r==null?void 0:r.thumbnail_url)==null?void 0:h.match(a))==null?void 0:d[1],l=o?`https://i.vimeocdn.com/video/${o}_1920x1080.webp`:"",c={title:(r==null?void 0:r.title)??"",duration:(r==null?void 0:r.duration)??0,poster:l,pro:r.account_type!=="basic"};return Bx.set(n,c),c}).finally(()=>Hm.delete(n));return Hm.set(n,s),s}const SW=Object.freeze(Object.defineProperty({__proto__:null,getVimeoVideoInfo:m8,resolveVimeoVideoId:p8},Symbol.toStringTag,{value:"Module"})),_W=["bufferend","bufferstart","durationchange","ended","enterpictureinpicture","error","fullscreenchange","leavepictureinpicture","loaded","playProgress","loadProgress","pause","play","playbackratechange","qualitychange","seeked","seeking","timeupdate","volumechange","waiting"];var ie,qs,na,Yo,Lu,Jp,ra,wu,J_,zo,aa,Cu,eA,g8,tA,y8,iA,v8,sA,T8,Qo,nA,b8,rA,E8,aA,S8,em,jC,oA,_8,lA,A8,cA,x8,uA,L8,hA,w8,tm,WC,dA,C8,fA,I8,pA,k8,im,YC,mA,R8,sm,zC,gA,P8,nm,QC,yA,D8,vA,O8,ht,gt,rm,XC,am,ZC;class AW extends h8{constructor(t,i){super(t);p(this,eA);p(this,tA);p(this,iA);p(this,sA);p(this,nA);p(this,rA);p(this,aA);p(this,em);p(this,oA);p(this,lA);p(this,cA);p(this,uA);p(this,hA);p(this,tm);p(this,dA);p(this,fA);p(this,pA);p(this,im);p(this,mA);p(this,sm);p(this,gA);p(this,nm);p(this,yA);p(this,vA);p(this,ht);p(this,rm);p(this,am);L(this,"$$PROVIDER_TYPE","VIMEO");L(this,"scope",ma());L(this,"fullscreen");p(this,ie,void 0);p(this,qs,ae(""));p(this,na,ae(!1));p(this,Yo,null);p(this,Lu,null);p(this,Jp,!1);p(this,ra,new yt(0,0));p(this,wu,new km(m(this,sA,T8).bind(this)));p(this,J_,null);p(this,zo,null);p(this,aa,new Map);p(this,Cu,null);L(this,"cookies",!1);L(this,"title",!0);L(this,"byline",!0);L(this,"portrait",!0);L(this,"color","00ADEF");p(this,Qo,!1);A(this,ie,i);const s=this;this.fullscreen={get active(){return u(s,Jp)}
43,supported:!0,enter:()=>m(this,ht,gt).call(this,"requestFullscreen"),exit:()=>m(this,ht,gt).call(this,"exitFullscreen")}}get type(){return"vimeo"}get currentSrc(){return u(this,Lu)}get videoId(){return u(this,qs).call(this)}get hash(){return u(this,Yo)}get isPro(){return u(this,na).call(this)}preconnect(){tr(this.getOrigin())}setup(){super.setup(),D(m(this,eA,g8).bind(this)),D(m(this,tA,y8).bind(this)),D(m(this,iA,v8).bind(this)),u(this,ie).notify("provider-setup",this)}destroy(){m(this,rm,XC).call(this),this.fullscreen=void 0;const t="provider destroyed";for(const i of u(this,aa).values())for(const{reject:s}of i)s(t);u(this,aa).clear(),m(this,ht,gt).call(this,"destroy")}async play(){return m(this,ht,gt).call(this,"play")}async pause(){return m(this,ht,gt).call(this,"pause")}setMuted(t){m(this,ht,gt).call(this,"setMuted",t)}setCurrentTime(t){m(this,ht,gt).call(this,"seekTo",t),u(this,ie).notify("seeking",t)}setVolume(t){m(this,ht,gt).call(this,"setVolume",t),m(this,ht,gt).call(this,"setMuted",Y(u(this,ie).$state.muted))}setPlaybackRate(t){m(this,ht,gt).call(this,"setPlaybackRate",t)}async loadSource(t){if(!te(t.src)){A(this,Lu,null),A(this,Yo,null),u(this,qs).set("");return}const{videoId:i,hash:s}=p8(t.src);u(this,qs).set(i??""),A(this,Yo,s??null),A(this,Lu,t)}getOrigin(){return"https://player.vimeo.com"}buildParams(){const{keyDisabled:t}=u(this,ie).$props,{playsInline:i,nativeControls:s}=u(this,ie).$state,r=s();return{title:this.title,byline:this.byline,color:this.color,portrait:this.portrait,controls:r,h:this.hash,keyboard:r&&!t(),transparent:!0,playsinline:i(),dnt:!this.cookies}}onMessage(t,i){t.event?m(this,yA,D8).call(this,t.event,t.data,i):t.method&&m(this,oA,_8).call(this,t.method,t.value,i)}onLoad(){}}ie=new WeakMap,qs=new WeakMap,na=new WeakMap,Yo=new WeakMap,Lu=new WeakMap,Jp=new WeakMap,ra=new WeakMap,wu=new WeakMap,J_=new WeakMap,zo=new WeakMap,aa=new WeakMap,Cu=new WeakMap,eA=new WeakSet,g8=function(){m(this,rm,XC).call(this);const t=u(this,qs).call(this);if(!t){this.src.set("");return}this.src.set(`${this.getOrigin()}/video/${t}`),u(this,ie).notify("load-start")},tA=new WeakSet,y8=function(){const t=u(this,qs).call(this);if(!t)return;const i=Bu(),s=new AbortController;return A(this,Cu,i),m8(t,s,u(this,Yo)).then(r=>{i.resolve(r)}).catch(r=>{i.reject()}),()=>{i.reject(),s.abort()}},iA=new WeakSet,v8=function(){const t=u(this,na).call(this),{$state:i,qualities:s}=u(this,ie);if(i.canSetPlaybackRate.set(t),s[he.setReadonly](!t),t)return Fe(s,"change",()=>{var a;if(s.auto)return;const r=(a=s.selected)==null?void 0:a.id;r&&m(this,ht,gt).call(this,"setQuality",r)})},sA=new WeakSet,T8=function(){m(this,ht,gt).call(this,"getCurrentTime")},Qo=new WeakMap,nA=new WeakSet,b8=function(t,i){if(u(this,Qo)&&t===0)return;const{realCurrentTime:s,paused:r,bufferedEnd:a,seekableEnd:o,live:l}=u(this,ie).$state;if(s()===t)return;const c=s();u(this,ie).notify("time-change",t,i),Math.abs(c-t)>1.5&&(u(this,ie).notify("seeking",t,i),!r()&&a()<t&&u(this,ie).notify("waiting",void 0,i)),!l()&&o()-t<.01&&(u(this,ie).notify("end",void 0,i),A(this,Qo,!0),setTimeout(()=>{A(this,Qo,!1)},500))},rA=new WeakSet,E8=function(t,i){u(this,ie).notify("seeked",t,i)},aA=new WeakSet,S8=function(t){var s;const i=u(this,qs).call(this);(s=u(this,Cu))==null||s.promise.then(r=>{if(!r)return;const{title:a,poster:o,duration:l,pro:c}=r;u(this,na).set(c),u(this,ie).notify("title-change",a,t),u(this,ie).notify("poster-change",o,t),u(this,ie).notify("duration-change",l,t),m(this,em,jC).call(this,l,t)}).catch(()=>{i===u(this,qs).call(this)&&(m(this,ht,gt).call(this,"getVideoTitle"),m(this,ht,gt).call(this,"getDuration"))})},em=new WeakSet,jC=function(t,i){const{nativeControls:s}=u(this,ie).$state,r=s();A(this,ra,new yt(0,t));const a={buffered:new yt(0,0),seekable:u(this,ra),duration:t};u(this,ie).delegate.ready(a,i),r||m(this,ht,gt).call(this,"_hideOverlay"),m(this,ht,gt).call(this,"getQualities"),m(this,ht,gt).call(this,"getChapters")},oA=new WeakSet,_8=function(t,i,s){var r;switch(t){case"getVideoTitle":const a=i;u(this,ie).notify("title-change",a,s);break;case"getDuration":const o=i;
43u(this,ie).$state.canPlay()?u(this,ie).notify("duration-change",o,s):m(this,em,jC).call(this,o,s);break;case"getCurrentTime":m(this,nA,b8).call(this,i,s);break;case"getBuffered":Ut(i)&&i.length&&m(this,tm,WC).call(this,i[i.length-1][1],s);break;case"setMuted":m(this,im,YC).call(this,Y(u(this,ie).$state.volume),i,s);break;case"getChapters":m(this,mA,R8).call(this,i);break;case"getQualities":m(this,gA,P8).call(this,i,s);break}(r=m(this,am,ZC).call(this,t))==null||r.resolve()},lA=new WeakSet,A8=function(){for(const t of _W)m(this,ht,gt).call(this,"addEventListener",t)},cA=new WeakSet,x8=function(t){u(this,wu).stop(),u(this,ie).notify("pause",void 0,t)},uA=new WeakSet,L8=function(t){u(this,wu).start(),u(this,ie).notify("play",void 0,t)},hA=new WeakSet,w8=function(t){const{paused:i}=u(this,ie).$state;!i()&&!u(this,Qo)&&u(this,ie).notify("playing",void 0,t)},tm=new WeakSet,WC=function(t,i){const s={buffered:new yt(0,t),seekable:u(this,ra)};u(this,ie).notify("progress",s,i)},dA=new WeakSet,C8=function(t){u(this,ie).notify("waiting",void 0,t)},fA=new WeakSet,I8=function(t){const{paused:i}=u(this,ie).$state;i()||u(this,ie).notify("playing",void 0,t)},pA=new WeakSet,k8=function(t){const{paused:i}=u(this,ie).$state;i()&&u(this,ie).notify("play",void 0,t),u(this,ie).notify("waiting",void 0,t)},im=new WeakSet,YC=function(t,i,s){const r={volume:t,muted:i};u(this,ie).notify("volume-change",r,s)},mA=new WeakSet,R8=function(t){if(m(this,sm,zC).call(this),!t.length)return;const i=new ga({kind:"chapters",default:!0}),{seekableEnd:s}=u(this,ie).$state;for(let r=0;r<t.length;r++){const a=t[r],o=t[r+1];i.addCue(new window.VTTCue(a.startTime,(o==null?void 0:o.startTime)??s(),a.title))}A(this,zo,i),u(this,ie).textTracks.add(i)},sm=new WeakSet,zC=function(){u(this,zo)&&(u(this,ie).textTracks.remove(u(this,zo)),A(this,zo,null))},gA=new WeakSet,P8=function(t,i){u(this,ie).qualities[Ft.enableAuto]=t.some(s=>s.id==="auto")?()=>m(this,ht,gt).call(this,"setQuality","auto"):void 0;for(const s of t){if(s.id==="auto")continue;const r=+s.id.slice(0,-1);isNaN(r)||u(this,ie).qualities[he.add]({id:s.id,width:r*(16/9),height:r,codec:"avc1,h.264",bitrate:-1},i)}m(this,nm,QC).call(this,t.find(s=>s.active),i)},nm=new WeakSet,QC=function({id:t}={},i){if(!t)return;const s=t==="auto",r=u(this,ie).qualities.getById(t);s?(u(this,ie).qualities[Ft.setAuto](s,i),u(this,ie).qualities[he.select](void 0,!0,i)):u(this,ie).qualities[he.select](r??void 0,!0,i)},yA=new WeakSet,D8=function(t,i,s){switch(t){case"ready":m(this,lA,A8).call(this);break;case"loaded":m(this,aA,S8).call(this,s);break;case"play":m(this,uA,L8).call(this,s);break;case"playProgress":m(this,hA,w8).call(this,s);break;case"pause":m(this,cA,x8).call(this,s);break;case"loadProgress":m(this,tm,WC).call(this,i.seconds,s);break;case"waiting":m(this,pA,k8).call(this,s);break;case"bufferstart":m(this,dA,C8).call(this,s);break;case"bufferend":m(this,fA,I8).call(this,s);break;case"volumechange":m(this,im,YC).call(this,i.volume,Y(u(this,ie).$state.muted),s);break;case"durationchange":A(this,ra,new yt(0,i.duration)),u(this,ie).notify("duration-change",i.duration,s);break;case"playbackratechange":u(this,ie).notify("rate-change",i.playbackRate,s);break;case"qualitychange":m(this,nm,QC).call(this,i,s);break;case"fullscreenchange":A(this,Jp,i.fullscreen),u(this,ie).notify("fullscreen-change",i.fullscreen,s);break;case"enterpictureinpicture":u(this,ie).notify("picture-in-picture-change",!0,s);break;case"leavepictureinpicture":u(this,ie).notify("picture-in-picture-change",!1,s);break;case"ended":u(this,ie).notify("end",void 0,s);break;case"error":m(this,vA,O8).call(this,i,s);break;case"seek":case"seeked":m(this,rA,E8).call(this,i.seconds,s);break}},vA=new WeakSet,O8=function(t,i){var a;const{message:s,method:r}=t;r==="setPlaybackRate"&&u(this,na).set(!1),r&&((a=m(this,am,ZC).call(this,r))==null||a.reject(s))},ht=new WeakSet,gt=async function(t,i){let s=Bu(),r=u(this,aa).get(t);return r||u(this,aa).set(t,r=[]),r.push(s),this.postMessage({method:t,value:i}),s.promise},rm=new WeakSet,XC=function(){u(this,wu).stop(),A(this,ra,new yt(0,0)),A(this,Cu,null),A(this,J_,null),u(this,na).set(!1),m(this,sm,zC).call(this)},am=new WeakSet,ZC=function(t){var i;return(i=u(this,aa).get(t))==null?void 0:i.shift()};const xW=Object.freeze(Object.defineProperty({__proto__:null,VimeoProvider:AW},Symbol.toStringTag,{value:"Module"})),LW=/(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11}
43)/,Ux=new Map,qm=new Map;function M8(n){var e;return(e=n.match(LW))==null?void 0:e[1]}async function wW(n,e){if(Ux.has(n))return Ux.get(n);if(qm.has(n))return qm.get(n);const t=new Promise(async i=>{const s=["maxresdefault","sddefault","hqdefault"];for(const r of s)for(const a of[!0,!1]){const o=CW(n,r,a);if((await fetch(o,{mode:"no-cors",signal:e.signal})).status<400){Ux.set(n,o),i(o);return}}}).catch(()=>"").finally(()=>qm.delete(n));return qm.set(n,t),t}function CW(n,e,t){return`https://i.ytimg.com/${t?"vi_webp":"vi"}/${n}/${e}.${t?"webp":"jpg"}`}const IW=Object.freeze(Object.defineProperty({__proto__:null,findYouTubePoster:wW,resolveYouTubeVideoId:M8},Symbol.toStringTag,{value:"Module"})),ka={Ended:0,Playing:1,Paused:2,Buffering:3,Cued:5};var Oe,Xo,Zo,Iu,Jo,oa,Wn,KI,RW,jI,PW,TA,$8,Gs,ur,bA,N8,EA,F8,SA,B8,om,JC,ku,Dg,_A,U8,AA,V8,lm,eI,el,vh,xA,H8;class kW extends h8{constructor(t,i){super(t);p(this,KI);p(this,jI);p(this,TA);p(this,Gs);p(this,bA);p(this,EA);p(this,SA);p(this,om);p(this,ku);p(this,_A);p(this,AA);p(this,lm);p(this,el);p(this,xA);L(this,"$$PROVIDER_TYPE","YOUTUBE");L(this,"scope",ma());p(this,Oe,void 0);p(this,Xo,ae(""));p(this,Zo,-1);p(this,Iu,null);p(this,Jo,-1);p(this,oa,!1);p(this,Wn,new Map);L(this,"language","en");L(this,"color","red");L(this,"cookies",!1);A(this,Oe,i)}get currentSrc(){return u(this,Iu)}get type(){return"youtube"}get videoId(){return u(this,Xo).call(this)}preconnect(){tr(this.getOrigin())}setup(){super.setup(),D(m(this,TA,$8).bind(this)),u(this,Oe).notify("provider-setup",this)}destroy(){m(this,lm,eI).call(this);const t="provider destroyed";for(const i of u(this,Wn).values())for(const{reject:s}of i)s(t);u(this,Wn).clear()}async play(){return m(this,Gs,ur).call(this,"playVideo")}async pause(){return m(this,Gs,ur).call(this,"pauseVideo")}setMuted(t){t?m(this,Gs,ur).call(this,"mute"):m(this,Gs,ur).call(this,"unMute")}setCurrentTime(t){m(this,Gs,ur).call(this,"seekTo",t),u(this,Oe).notify("seeking",t)}setVolume(t){m(this,Gs,ur).call(this,"setVolume",t*100)}setPlaybackRate(t){m(this,Gs,ur).call(this,"setPlaybackRate",t)}async loadSource(t){if(!te(t.src)){A(this,Iu,null),u(this,Xo).set("");return}const i=M8(t.src);u(this,Xo).set(i??""),A(this,Iu,t)}getOrigin(){return this.cookies?"https://www.youtube.com":"https://www.youtube-nocookie.com"}buildParams(){const{keyDisabled:t}=u(this,Oe).$props,{muted:i,playsInline:s,nativeControls:r}=u(this,Oe).$state,a=r();return{rel:0,autoplay:0,cc_lang_pref:this.language,cc_load_policy:a?1:void 0,color:this.color,controls:a?1:0,disablekb:!a||t()?1:0,enablejsapi:1,fs:1,hl:this.language,iv_load_policy:a?1:3,mute:i()?1:0,playsinline:s()?1:0}}onLoad(){window.setTimeout(()=>this.postMessage({event:"listening"}),100)}onMessage({info:t},i){var o;if(!t)return;const{title:s,intrinsicDuration:r,playbackRate:a}=u(this,Oe).$state;if(T2(t.videoData)&&t.videoData.title!==s()&&u(this,Oe).notify("title-change",t.videoData.title,i),At(t.duration)&&t.duration!==r()){if(At(t.videoLoadedFraction)){const l=((o=t.progressState)==null?void 0:o.loaded)??t.videoLoadedFraction*t.duration,c=new yt(0,t.duration);m(this,om,JC).call(this,l,c,i)}u(this,Oe).notify("duration-change",t.duration,i)}if(At(t.playbackRate)&&t.playbackRate!==a()&&u(this,Oe).notify("rate-change",t.playbackRate,i),t.progressState){const{current:l,seekableStart:c,seekableEnd:h,loaded:d,duration:f}=t.progressState;m(this,SA,B8).call(this,l,i),m(this,om,JC).call(this,d,new yt(c,h),i),f!==r()&&u(this,Oe).notify("duration-change",f,i)}if(At(t.volume)&&b2(t.muted)&&!u(this,oa)){const l={muted:t.muted,volume:t.volume/100};u(this,Oe).notify("volume-change",l,i)}At(t.playerState)&&t.playerState!==u(this,Zo)&&m(this,AA,V8).call(this,t.playerState,i)}}Oe=new WeakMap,Xo=new WeakMap,Zo=new WeakMap,Iu=new WeakMap,Jo=new WeakMap,oa=new WeakMap,Wn=new WeakMap,KI=new WeakSet,RW=function(t){var i;(i=m(this,el,vh).call(this,"playVideo"))==null||i.reject(t)},jI=new WeakSet,PW=function(t){var i;(i=m(this,el,vh).call(this,"pauseVideo"))==null||i.reject(t)},TA=new WeakSet,$8=function(){m(this,lm,eI).call(this);const t=u(this,Xo).call(this);if(!t){this.src.set("");return}this.src.set(`${this.getOrigin()}/embed/${t}`),u(this,Oe).notify("load-start")},Gs=new WeakSet,ur=function(t,i){let s=Bu(),r=u(this,Wn).get(t);return r||u(this,Wn).set(t,r=[]),r.push(s),this.postMessage({event:"command",func:t,args:i?[i]:void 0}),s.promise},bA=new WeakSet,N8=function(t){u(this,Oe).notify("loaded-metadata"),u(this,Oe).notify("loaded-data"),u(this,Oe).delegate.ready(void 0,t)},EA=new WeakSet,F8=function(t){var i;(i=m(this,el,vh).call(this,"pauseVideo"))==null||i.resolve(),u(this,Oe).notify("pause",void 0,t)},SA=new WeakSet,B8=function(t,i){const{duration:s,realCurrentTime:r}=u(this,Oe).$state,a=u(this,Zo)===ka.Ended,o=a?s():t;u(this,Oe).notify("time-change",o,i),!a&&Math.abs(o-r())>1&&u(this,Oe).notify("seeking",o,i)},om=new WeakSet,JC=function(t,i,s){const r={buffered:new yt(0,t),seekable:i};u(this,Oe).notify("progress",r,s);const{seeking:a,realCurrentTime:o}=u(this,Oe).$state;a()&&t>o()&&m(this,ku,Dg).call(this,s)}
43,ku=new WeakSet,Dg=function(t){const{paused:i,realCurrentTime:s}=u(this,Oe).$state;window.clearTimeout(u(this,Jo)),A(this,Jo,window.setTimeout(()=>{u(this,Oe).notify("seeked",s(),t),A(this,Jo,-1)},i()?100:0))},_A=new WeakSet,U8=function(t){const{seeking:i}=u(this,Oe).$state;i()&&m(this,ku,Dg).call(this,t),u(this,Oe).notify("pause",void 0,t),u(this,Oe).notify("end",void 0,t)},AA=new WeakSet,V8=function(t,i){var h;const{paused:s,seeking:r}=u(this,Oe).$state,a=t===ka.Playing,o=t===ka.Buffering,l=m(this,xA,H8).call(this,"playVideo"),c=s()&&(o||a);if(o&&u(this,Oe).notify("waiting",void 0,i),r()&&a&&m(this,ku,Dg).call(this,i),u(this,oa)&&a){this.pause(),A(this,oa,!1),this.setMuted(u(this,Oe).$state.muted());return}if(!l&&c){A(this,oa,!0),this.setMuted(!0);return}switch(c&&((h=m(this,el,vh).call(this,"playVideo"))==null||h.resolve(),u(this,Oe).notify("play",void 0,i)),t){case ka.Cued:m(this,bA,N8).call(this,i);break;case ka.Playing:u(this,Oe).notify("playing",void 0,i);break;case ka.Paused:m(this,EA,F8).call(this,i);break;case ka.Ended:m(this,_A,U8).call(this,i);break}A(this,Zo,t)},lm=new WeakSet,eI=function(){A(this,Zo,-1),A(this,Jo,-1),A(this,oa,!1)},el=new WeakSet,vh=function(t){var i;return(i=u(this,Wn).get(t))==null?void 0:i.shift()},xA=new WeakSet,H8=function(t){var i;return!!((i=u(this,Wn).get(t))!=null&&i.length)};const DW=Object.freeze(Object.defineProperty({__proto__:null,YouTubeProvider:kW},Symbol.toStringTag,{value:"Module"}));function OW(){return"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"}function MW(){var n;return!!((n=window.cast)!=null&&n.framework)}function $W(){var n,e;return!!((e=(n=window.chrome)==null?void 0:n.cast)!=null&&e.isAvailable)}function RR(){return Rm().getCastState()==={CastContext:{getInstance:function(){return{}}}}.CastState.CONNECTED}function Rm(){return window.cast.framework.CastContext.getInstance()}function jk(){return Rm().getCurrentSession()}function Wk(){var n;return(n=jk())==null?void 0:n.getSessionObj().media[0]}function PR(n){var t;return((t=Wk())==null?void 0:t.media.contentId)===(n==null?void 0:n.src)}function NW(){return{language:"en-US",autoJoinPolicy:{media:{TrackType:{TEXT:"text",AUDIO:"audio"}}}.AutoJoinPolicy.ORIGIN_SCOPED,receiverApplicationId:{TrackType:{TEXT:"text",AUDIO:"audio"}}.DEFAULT_MEDIA_RECEIVER_APP_ID,resumeSavedSession:!0,androidReceiverCompatible:!0}}function q8(n){return`Google Cast Error Code: ${n}`}function FW(n,e){return Fe(Rm(),n,e)}var la,LA,G8,wA,K8,CA,j8,Ru,Og,Pu,Mg;class BW{constructor(){p(this,LA);p(this,wA);p(this,CA);p(this,Ru);p(this,Pu);L(this,"name","google-cast");L(this,"target");p(this,la,void 0)}get cast(){return Rm()}mediaType(){return"video"}canPlay(e){return JA&&!ZA&&q2(e)}async prompt(e){var r;let t,i,s;try{t=await m(this,LA,G8).call(this,e),u(this,la)||(A(this,la,new{CastContext:{getInstance:function(){return{}}}}.RemotePlayer),new{CastContext:{getInstance:function(){return{}}}}.RemotePlayerController(u(this,la))),i=e.player.createEvent("google-cast-prompt-open",{trigger:t}),e.player.dispatchEvent(i),m(this,Ru,Og).call(this,e,"connecting",i),await m(this,wA,K8).call(this,Y(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:(r=jk())==null?void 0:r.getCastDevice().friendlyName}),RR()&&m(this,Ru,Og).call(this,e,"connected",i)}catch(a){const o=a instanceof Error?a:m(this,Pu,Mg).call(this,(a+"").toUpperCase(),"Prompt failed.");throw s=e.player.createEvent("google-cast-prompt-error",{detail:o,trigger:i??t,cancelable:!0}),e.player.dispatch(s),m(this,Ru,Og).call(this,e,RR()?"connected":"disconnected",s),o}finally{e.player.dispatch("google-cast-prompt-close",{trigger:s??i??t})}}async load(e){if(!u(this,la))throw Error("[vidstack] google cast player was not initialized");return new(await se(()=>Promise.resolve().then(()=>Pie),void 0,import.meta.url)).DisabledCastProvider(u(this,la),e)}}la=new WeakMap,LA=new WeakSet,G8=async function(e){if(MW())return;const t=e.player.createEvent("google-cast-load-start");e.player.dispatch(t),await ik(OW()),await customElements.whenDefined("google-cast-launcher");const i=e.player.createEvent("google-cast-loaded",{trigger:t});
43if(e.player.dispatch(i),!$W())throw m(this,Pu,Mg).call(this,"CAST_NOT_AVAILABLE","Google Cast not available on this platform.");return i},wA=new WeakSet,K8=async function(e){m(this,CA,j8).call(this,e);const t=await this.cast.requestSession();if(t)throw m(this,Pu,Mg).call(this,t.toUpperCase(),q8(t))},CA=new WeakSet,j8=function(e){var t;(t=this.cast)==null||t.setOptions({...NW(),...e})},Ru=new WeakSet,Og=function(e,t,i){const s={type:"google-cast",state:t};e.notify("remote-playback-change",s,i)},Pu=new WeakSet,Mg=function(e,t){const i=Error(t);return i.code=e,i};const UW=Object.freeze(Object.defineProperty({__proto__:null,GoogleCastLoader:BW},Symbol.toStringTag,{value:"Module"})),VW=hk('<svg viewBox="0 0 32 32" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"></svg>');function HW(n,e){const t=dk(VW);t.innerHTML=SV,n.append(t);const i=document.createElement("span");i.classList.add("vds-google-cast-info"),n.append(i);const s=document.createElement("span");s.classList.add("vds-google-cast-device-name"),D(()=>{const{remotePlaybackInfo:r}=e,a=r();return a!=null&&a.deviceName&&(s.textContent=a.deviceName,i.append("Google Cast on ",s)),()=>{i.textContent=""}})}const qW=Object.freeze(Object.defineProperty({__proto__:null,insertContent:HW},Symbol.toStringTag,{value:"Module"}));var GW='<path d="M10.6667 6.6548C10.6667 6.10764 11.2894 5.79346 11.7295 6.11862L24.377 15.4634C24.7377 15.7298 24.7377 16.2692 24.3771 16.5357L11.7295 25.8813C11.2895 26.2065 10.6667 25.8923 10.6667 25.3451L10.6667 6.6548Z" fill="currentColor"/>';const KW=Object.freeze(Object.defineProperty({__proto__:null,default:GW},Symbol.toStringTag,{value:"Module"}));var jW='<path d="M8.66667 6.66667C8.29848 6.66667 8 6.96514 8 7.33333V24.6667C8 25.0349 8.29848 25.3333 8.66667 25.3333H12.6667C13.0349 25.3333 13.3333 25.0349 13.3333 24.6667V7.33333C13.3333 6.96514 13.0349 6.66667 12.6667 6.66667H8.66667Z" fill="currentColor"/> <path d="M19.3333 6.66667C18.9651 6.66667 18.6667 6.96514 18.6667 7.33333V24.6667C18.6667 25.0349 18.9651 25.3333 19.3333 25.3333H23.3333C23.7015 25.3333 24 25.0349 24 24.6667V7.33333C24 6.96514 23.7015 6.66667 23.3333 6.66667H19.3333Z" fill="currentColor"/>';const WW=Object.freeze(Object.defineProperty({__proto__:null,default:jW},Symbol.toStringTag,{value:"Module"}));var YW='<path d="M17.5091 24.6594C17.5091 25.2066 16.8864 25.5208 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9991 9.36923 19.9991H4.66667C4.29848 19.9991 4 19.7006 4 19.3325V12.6658C4 12.2976 4.29848 11.9991 4.66667 11.9991H9.37115C9.39967 11.9991 9.42745 11.99 9.45039 11.973L16.4463 6.8036C16.8863 6.47842 17.5091 6.79259 17.5091 7.33977L17.5091 24.6594Z" fill="currentColor"/> <path d="M28.8621 13.6422C29.1225 13.3818 29.1225 12.9597 28.8621 12.6994L27.9193 11.7566C27.659 11.4962 27.2368 11.4962 26.9765 11.7566L24.7134 14.0197C24.6613 14.0717 24.5769 14.0717 24.5248 14.0197L22.262 11.7568C22.0016 11.4964 21.5795 11.4964 21.3191 11.7568L20.3763 12.6996C20.116 12.9599 20.116 13.382 20.3763 13.6424L22.6392 15.9053C22.6913 15.9573 22.6913 16.0418 22.6392 16.0938L20.3768 18.3562C20.1165 18.6166 20.1165 19.0387 20.3768 19.299L21.3196 20.2419C21.58 20.5022 22.0021 20.5022 22.2624 20.2418L24.5248 17.9795C24.5769 17.9274 24.6613 17.9274 24.7134 17.9795L26.976 20.2421C27.2363 20.5024 27.6585 20.5024 27.9188 20.2421L28.8616 19.2992C29.122 19.0389 29.122 18.6168 28.8616 18.3564L26.599 16.0938C26.547 16.0418 26.547 15.9573 26.599 15.9053L28.8621 13.6422Z" fill="currentColor"/>';const zW=Object.freeze(Object.defineProperty({__proto__:null,default:YW},Symbol.toStringTag,{value:"Module"}));var QW='<path d="M17.5091 24.6594C17.5091 25.2066 16.8864 25.5207 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9991 9.36923 19.9991H4.66667C4.29848 19.9991 4 19.7006 4 19.3324V12.6658C4 12.2976 4.29848 11.9991 4.66667 11.9991H9.37115C9.39967 11.9991 9.42745 11.99 9.45039 11.973L16.4463 6.80358C16.8863 6.4784 17.5091 6.79258 17.5091 7.33975L17.5091 24.6594Z" fill="currentColor"/> <path d="M22.8424 12.6667C22.8424 12.2985 22.544 12 22.1758 12H20.8424C20.4743 12 20.1758 12.2985 20.1758 12.6667V19.3333C20.1758 19.7015 20.4743 20 20.8424 20H22.1758C22.544 20 22.8424 19.7015 22.8424 19.3333V12.6667Z" fill="currentColor"/>';const XW=Object.freeze(Object.defineProperty({__proto__:null,default:QW},Symbol.toStringTag,{value:"Module"}));var ZW='<path d="M17.5091 24.6595C17.5091 25.2066 16.8864 25.5208 16.4463 25.1956L9.44847 20.0252C9.42553 20.0083 9.39776 19.9992 9.36923 19.9992H4.66667C4.29848 19.9992 4 19.7007 4 19.3325V12.6658C4 12.2976 4.29848 11.9992 4.66667 11.9992H9.37115C9.39967 11.9992 9.42745 11.99 9.45039 11.9731L16.4463 6.80363C16.8863 6.47845 17.5091 6.79262 17.5091 7.3398L17.5091 24.6595Z" fill="currentColor"/> <path d="M27.5091 9.33336C27.8773 9.33336 28.1758 9.63184 28.1758 10V22C28.1758 22.3682 27.8773 22.6667 27.5091 22.6667H26.1758C25.8076 22.6667 25.5091 22.3682 25.5091 22V10C25.5091 9.63184 25.8076 9.33336 26.1758 9.33336L27.5091 9.33336Z" fill="currentColor"/> <path d="M22.1758 12C22.544 12 22.8424 12.2985 22.8424 12.6667V19.3334C22.8424 19.7016 22.544 20 22.1758 20H20.8424C20.4743 20 20.1758 19.7016 20.1758 19.3334V12.6667C20.1758 12.2985 20.4743 12 20.8424 12H22.1758Z" fill="currentColor"/>';const JW=Object.freeze(Object.defineProperty({__proto__:null,default:ZW},Symbol.toStringTag,{value:"Module"}));var eY='<path d="M16.6667 10.3452C16.6667 10.8924 16.0439 11.2066 15.6038 10.8814L11.0766 7.5364C10.7159 7.26993 10.7159 6.73054 11.0766 6.46405L15.6038 3.11873C16.0439 2.79356 16.6667 3.10773 16.6667 3.6549V5.22682C16.6667 5.29746 16.7223 5.35579 16.7927 5.36066C22.6821 5.76757 27.3333 10.674 27.3333 16.6667C27.3333 22.9259 22.2592 28 16 28C9.96483 28 5.03145 23.2827 4.68601 17.3341C4.66466 16.9665 4.96518 16.6673 5.33339 16.6673H7.3334C7.70157 16.6673 7.99714 16.9668 8.02743 17.3337C8.36638 21.4399 11.8064 24.6667 16 24.6667C20.4183 24.6667 24 21.085 24 16.6667C24 12.5225 20.8483 9.11428 16.8113 8.70739C16.7337 8.69957 16.6667 8.76096 16.6667 8.83893V10.3452Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0879 19.679C17.4553 19.9195 17.8928 20.0398 18.4004 20.0398C18.9099 20.0398 19.3474 19.9205 19.7129 19.6818C20.0803 19.4413 20.3635 19.0938 20.5623 18.6392C20.7612 18.1847 20.8606 17.6373 20.8606 16.9972C20.8625 16.3608 20.764 15.8192 20.5652 15.3722C20.3663 14.9252 20.0822 14.5853 19.7129 14.3523C19.3455 14.1175 18.908 14 18.4004 14C17.8928 14 17.4553 14.1175 17.0879 14.3523C16.7224 14.5853 16.4402 14.9252 16.2413 15.3722C16.0443 15.8173 15.9449 16.3589 15.943 16.9972C15.9411 17.6354 16.0396 18.1818 16.2385 18.6364C16.4373 19.089 16.7205 19.4366 17.0879 19.679ZM19.1362 18.4262C18.9487 18.7349 18.7034 18.8892 18.4004 18.8892C18.1996 18.8892 18.0226 18.8211 17.8691 18.6847C17.7157 18.5464 17.5964 18.3372 17.5112 18.0568C17.4279 17.7765 17.3871 17.4233 17.389 16.9972C17.3909 16.3684 17.4847 15.9025 17.6703 15.5995C17.8559 15.2945 18.0993 15.1421 18.4004 15.1421C18.603 15.1421 18.7801 15.2093 18.9316 15.3438C19.0832 15.4782 19.2015 15.6828 19.2868 15.9574C19.372 16.2301 19.4146 16.5767 19.4146 16.9972C19.4165 17.6392 19.3237 18.1156 19.1362 18.4262Z" fill="currentColor"/> <path d="M13.7746 19.8978C13.8482 19.8978 13.9079 19.8381 13.9079 19.7644V14.2129C13.9079 14.1393 13.8482 14.0796 13.7746 14.0796H12.642C12.6171 14.0796 12.5927 14.0865 12.5716 14.0997L11.2322 14.9325C11.1931 14.9568 11.1693 14.9996 11.1693 15.0457V15.9497C11.1693 16.0539 11.2833 16.1178 11.3722 16.0635L12.464 15.396C12.4682 15.3934 12.473 15.3921 12.4779 15.3921C12.4926 15.3921 12.5045 15.404 12.5045 15.4187V19.7644C12.5045 19.8381 12.5642 19.8978 12.6378 19.8978H13.7746Z" fill="currentColor"/>';const tY=Object.freeze(Object.defineProperty({__proto__:null,default:eY},Symbol.toStringTag,{value:"Module"}));var iY='<path d="M15.3333 10.3452C15.3333 10.8924 15.9561 11.2066 16.3962 10.8814L20.9234 7.5364C21.2841 7.26993 21.2841 6.73054 20.9235 6.46405L16.3962 3.11873C15.9561 2.79356 15.3333 3.10773 15.3333 3.6549V5.22682C15.3333 5.29746 15.2778 5.35579 15.2073 5.36066C9.31791 5.76757 4.66667 10.674 4.66667 16.6667C4.66667 22.9259 9.74078 28 16 28C22.0352 28 26.9686 23.2827 27.314 17.3341C27.3354 16.9665 27.0348 16.6673 26.6666 16.6673H24.6666C24.2984 16.6673 24.0029 16.9668 23.9726 17.3337C23.6336 21.4399 20.1937 24.6667 16 24.6667C11.5817 24.6667 8 21.085 8 16.6667C8 12.5225 11.1517 9.11428 15.1887 8.70739C15.2663 8.69957 15.3333 8.76096 15.3333 8.83893V10.3452Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0879 19.679C17.4553 19.9195 17.8928 20.0398 18.4004 20.0398C18.9099 20.0398 19.3474 19.9205 19.7129 19.6818C20.0803 19.4413 20.3635 19.0938 20.5623 18.6392C20.7612 18.1847 20.8606 17.6373 20.8606 16.9972C20.8625 16.3608 20.764 15.8192 20.5652 15.3722C20.3663 14.9252 20.0822 14.5853 19.7129 14.3523C19.3455 14.1175 18.908 14 18.4004 14C17.8928 14 17.4553 14.1175 17.0879 14.3523C16.7224 14.5853 16.4402 14.9252 16.2413 15.3722C16.0443 15.8173 15.9449 16.3589 15.943 16.9972C15.9411 17.6354 16.0396 18.1818 16.2385 18.6364C16.4373 19.089 16.7205 19.4366 17.0879 19.679ZM19.1362 18.4262C18.9487 18.7349 18.7034 18.8892 18.4004 18.8892C18.1996 18.8892 18.0225 18.8211 17.8691 18.6847C17.7157 18.5464 17.5964 18.3372 17.5112 18.0568C17.4278 17.7765 17.3871 17.4233 17.389 16.9972C17.3909 16.3684 17.4847 15.9025 17.6703 15.5995C17.8559 15.2945 18.0992 15.1421 18.4004 15.1421C18.603 15.1421 18.7801 15.2093 18.9316 15.3438C19.0831 15.4782 19.2015 15.6828 19.2867 15.9574C19.372 16.2301 19.4146 16.5767 19.4146 16.9972C19.4165 17.6392 19.3237 18.1156 19.1362 18.4262Z" fill="currentColor"/> <path d="M13.7746 19.8978C13.8482 19.8978 13.9079 19.8381 13.9079 19.7644V14.2129C13.9079 14.1393 13.8482 14.0796 13.7746 14.0796H12.642C12.6171 14.0796 12.5927 14.0865 12.5716 14.0997L11.2322 14.9325C11.1931 14.9568 11.1693 14.9996 11.1693 15.0457V15.9497C11.1693 16.0539 11.2833 16.1178 11.3722 16.0635L12.464 15.396C12.4682 15.3934 12.473 15.3921 12.4779 15.3921C12.4926 15.3921 12.5045 15.404 12.5045 15.4187V19.7644C12.5045 19.8381 12.5642 19.8978 12.6378 19.8978H13.7746Z" fill="currentColor"/>';const sY=Object.freeze(Object.defineProperty({__proto__:null,default:iY},Symbol.toStringTag,{value:"Module"}));var nY='<path d="M6.39617 6.78532C5.9561 6.46017 5.33334 6.77434 5.33334 7.32151V24.6785C5.33334 25.2257 5.95612 25.5398 6.39619 25.2147L18.1415 16.5358C18.5021 16.2693 18.5021 15.7299 18.1415 15.4634L6.39617 6.78532Z" fill="currentColor"/> <path d="M23.5339 6.6667C23.1657 6.6667 22.8672 6.96518 22.8672 7.33337V24.6667C22.8672 25.0349 23.1657 25.3334 23.5339 25.3334H25.5339C25.902 25.3334 26.2005 25.0349 26.2005 24.6667V7.33337C26.2005 6.96518 25.902 6.6667 25.5339 6.6667H23.5339Z" fill="currentColor"/>';const rY=Object.freeze(Object.defineProperty({__proto__:null,default:nY},Symbol.toStringTag,{value:"Module"}));var aY='<path d="M25.1377 6.78532C25.5778 6.46017 26.2005 6.77434 26.2005 7.32151V24.6785C26.2005 25.2257 25.5777 25.5398 25.1377 25.2147L13.3924 16.5358C13.0317 16.2693 13.0317 15.7299 13.3924 15.4634L25.1377 6.78532Z" fill="currentColor"/> <path d="M8 6.6667C8.36819 6.6667 8.66667 6.96518 8.66667 7.33337V24.6667C8.66667 25.0349 8.36819 25.3334 8 25.3334H6C5.63181 25.3334 5.33333 25.0349 5.33333 24.6667V7.33337C5.33333 6.96518 5.63181 6.6667 6 6.6667H8Z" fill="currentColor"/>';const oY=Object.freeze(Object.defineProperty({__proto__:null,default:aY},Symbol.toStringTag,{value:"Module"}));var lY='<path d="M16 15.3333C15.6318 15.3333 15.3333 15.6318 15.3333 16V20C15.3333 20.3682 15.6318 20.6667 16 20.6667H21.3333C21.7015 20.6667 22 20.3682 22 20V16C22 
4315.6318 21.7015 15.3333 21.3333 15.3333H16Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.33333 7.33334C5.33333 6.96515 5.63181 6.66667 5.99999 6.66667H26C26.3682 6.66667 26.6667 6.96515 26.6667 7.33334V24.6667C26.6667 25.0349 26.3682 25.3333 26 25.3333H5.99999C5.63181 25.3333 5.33333 25.0349 5.33333 24.6667V7.33334ZM7.99999 10C7.99999 9.63182 8.29847 9.33334 8.66666 9.33334H23.3333C23.7015 9.33334 24 9.63182 24 10V22C24 22.3682 23.7015 22.6667 23.3333 22.6667H8.66666C8.29847 22.6667 7.99999 22.3682 7.99999 22V10Z" fill="currentColor"/>';const cY=Object.freeze(Object.defineProperty({__proto__:null,default:lY},Symbol.toStringTag,{value:"Module"}));var uY='<path d="M5.33334 26V19.4667C5.33334 19.393 5.39304 19.3333 5.46668 19.3333H7.86668C7.94031 19.3333 8.00001 19.393 8.00001 19.4667V23.3333C8.00001 23.7015 8.29849 24 8.66668 24H23.3333C23.7015 24 24 23.7015 24 23.3333V8.66666C24 8.29847 23.7015 7.99999 23.3333 7.99999H19.4667C19.393 7.99999 19.3333 7.9403 19.3333 7.86666V5.46666C19.3333 5.39302 19.393 5.33333 19.4667 5.33333H26C26.3682 5.33333 26.6667 5.63181 26.6667 5.99999V26C26.6667 26.3682 26.3682 26.6667 26 26.6667H6.00001C5.63182 26.6667 5.33334 26.3682 5.33334 26Z" fill="currentColor"/> <path d="M14.0098 8.42359H10.806C10.6872 8.42359 10.6277 8.56721 10.7117 8.6512L16.5491 14.4886C16.8094 14.7489 16.8094 15.171 16.5491 15.4314L15.3234 16.657C15.0631 16.9174 14.641 16.9174 14.3806 16.657L8.63739 10.9138C8.55339 10.8298 8.40978 10.8893 8.40978 11.0081V14.0236C8.40978 14.3918 8.1113 14.6903 7.74311 14.6903H6.00978C5.64159 14.6903 5.34311 14.3918 5.34311 14.0236L5.34311 6.02359C5.34311 5.6554 5.64159 5.35692 6.00978 5.35692L14.0098 5.35692C14.378 5.35692 14.6764 5.6554 14.6764 6.02359V7.75692C14.6764 8.12511 14.378 8.42359 14.0098 8.42359Z" fill="currentColor"/>';const hY=Object.freeze(Object.defineProperty({__proto__:null,default:uY},Symbol.toStringTag,{value:"Module"}));var dY='<path d="M25.3299 7.26517C25.2958 6.929 25.0119 6.66666 24.6667 6.66666H19.3334C18.9652 6.66666 18.6667 6.96514 18.6667 7.33333V9.33333C18.6667 9.70152 18.9652 10 19.3334 10L21.8667 10C21.9403 10 22 10.0597 22 10.1333V12.6667C22 13.0349 22.2985 13.3333 22.6667 13.3333H24.6667C25.0349 13.3333 25.3334 13.0349 25.3334 12.6667V7.33333C25.3334 7.31032 25.3322 7.28758 25.3299 7.26517Z" fill="currentColor"/> <path d="M22 21.8667C22 21.9403 21.9403 22 21.8667 22L19.3334 22C18.9652 22 18.6667 22.2985 18.6667 22.6667V24.6667C18.6667 25.0349 18.9652 25.3333 19.3334 25.3333L24.6667 25.3333C25.0349 25.3333 25.3334 25.0349 25.3334 24.6667V19.3333C25.3334 18.9651 25.0349 18.6667 24.6667 18.6667H22.6667C22.2985 18.6667 22 18.9651 22 19.3333V21.8667Z" fill="currentColor"/> <path d="M12.6667 22H10.1334C10.0597 22 10 21.9403 10 21.8667V19.3333C10 18.9651 9.70154 18.6667 9.33335 18.6667H7.33335C6.96516 18.6667 6.66669 18.9651 6.66669 19.3333V24.6667C6.66669 25.0349 6.96516 25.3333 7.33335 25.3333H12.6667C13.0349 25.3333 13.3334 25.0349 13.3334 24.6667V22.6667C13.3334 22.2985 13.0349 22 12.6667 22Z" fill="currentColor"/> <path d="M10 12.6667V10.1333C10 10.0597 10.0597 10 10.1334 10L12.6667 10C13.0349 10 13.3334 9.70152 13.3334 9.33333V7.33333C13.3334 6.96514 13.0349 6.66666 12.6667 6.66666H7.33335C6.96516 6.66666 6.66669 6.96514 6.66669 7.33333V12.6667C6.66669 13.0349 6.96516 13.3333 7.33335 13.3333H9.33335C9.70154 13.3333 10 13.0349 10 12.6667Z" fill="currentColor"/>';const fY=Object.freeze(Object.defineProperty({__proto__:null,default:dY},Symbol.toStringTag,{value:"Module"}));var pY='<path d="M19.3334 13.3333C18.9652 13.3333 18.6667 13.0349 18.6667 12.6667L18.6667 7.33333C18.6667 6.96514 18.9652 6.66666 19.3334 6.66666H21.3334C21.7015 6.66666 22 6.96514 22 7.33333V9.86666C22 9.9403 22.0597 10 22.1334 10L24.6667 10C25.0349 10 25.3334 10.2985 25.3334 10.6667V12.6667C25.3334 13.0349 25.0349 13.3333 24.6667 13.3333L19.3334 13.3333Z" fill="currentColor"/> <path d="M13.3334 19.3333C13.3334 18.9651 13.0349 18.6667 12.6667 18.6667H7.33335C6.96516 18.6667 6.66669 18.9651 6.66669 19.3333V21.3333C6.66669 21.7015 6.96516 22 7.33335 22H9.86669C9.94032 22 10 22.0597 10 22.1333L10 24.6667C10 25.0349 10.2985 25.3333 10.6667 25.3333H12.6667C13.0349 25.3333 13.3334 25.0349 13.3334 24.6667L13.3334 19.3333Z" fill="currentColor"/> <path d="M18.6667 24.6667C18.6667 25.0349 18.9652 25.3333 19.3334 25.3333H21.3334C21.7015 25.3333 22 25.0349 22 24.6667V22.1333C22 22.0597 22.0597 22 22.1334 22H24.6667C25.0349 22 25.3334 21.7015 25.3334 21.3333V19.3333C25.3334 18.9651 25.0349 18.6667 24.6667 18.6667L19.3334 18.6667C18.9652 18.6667 18.6667 18.9651 18.6667 19.3333L18.6667 24.6667Z" fill="currentColor"/> <path d="M10.6667 13.3333H12.6667C13.0349 13.3333 13.3334 13.0349 13.3334 12.6667L13.3334 10.6667V7.33333C13.3334 6.96514 13.0349 6.66666 12.6667 6.66666H10.6667C10.2985 6.66666 10 6.96514 10 7.33333L10 9.86666C10 9.9403 9.94033 10 9.86669 10L7.33335 10C6.96516 10 6.66669 10.2985 6.66669 10.6667V12.6667C6.66669 13.0349 6.96516 13.3333 7.33335 13.3333L10.
436667 13.3333Z" fill="currentColor"/>';const mY=Object.freeze(Object.defineProperty({__proto__:null,default:pY},Symbol.toStringTag,{value:"Module"}));var gY='<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5722 5.33333C13.2429 5.33333 12.9629 5.57382 12.9132 5.89938L12.4063 9.21916C12.4 9.26058 12.3746 9.29655 12.3378 9.31672C12.2387 9.37118 12.1409 9.42779 12.0444 9.48648C12.0086 9.5083 11.9646 9.51242 11.9255 9.49718L8.79572 8.27692C8.48896 8.15732 8.14083 8.27958 7.9762 8.56472L5.5491 12.7686C5.38444 13.0538 5.45271 13.4165 5.70981 13.6223L8.33308 15.7225C8.3658 15.7487 8.38422 15.7887 8.38331 15.8306C8.38209 15.8867 8.38148 15.9429 8.38148 15.9993C8.38148 16.0558 8.3821 16.1121 8.38332 16.1684C8.38423 16.2102 8.36582 16.2503 8.33313 16.2765L5.7103 18.3778C5.45334 18.5836 5.38515 18.9462 5.54978 19.2314L7.97688 23.4352C8.14155 23.7205 8.48981 23.8427 8.79661 23.723L11.926 22.5016C11.9651 22.4864 12.009 22.4905 12.0449 22.5123C12.1412 22.5709 12.2388 22.6274 12.3378 22.6818C12.3745 22.7019 12.4 22.7379 12.4063 22.7793L12.9132 26.0993C12.9629 26.4249 13.2429 26.6654 13.5722 26.6654H18.4264C18.7556 26.6654 19.0356 26.425 19.0854 26.0995L19.5933 22.7801C19.5997 22.7386 19.6252 22.7027 19.6619 22.6825C19.7614 22.6279 19.8596 22.5711 19.9564 22.5121C19.9923 22.4903 20.0362 22.4862 20.0754 22.5015L23.2035 23.7223C23.5103 23.842 23.8585 23.7198 24.0232 23.4346L26.4503 19.2307C26.6149 18.9456 26.5467 18.583 26.2898 18.3771L23.6679 16.2766C23.6352 16.2504 23.6168 16.2104 23.6177 16.1685C23.619 16.1122 23.6196 16.0558 23.6196 15.9993C23.6196 15.9429 23.619 15.8866 23.6177 15.8305C23.6168 15.7886 23.6353 15.7486 23.668 15.7224L26.2903 13.623C26.5474 13.4172 26.6156 13.0544 26.451 12.7692L24.0239 8.56537C23.8592 8.28023 23.5111 8.15797 23.2043 8.27757L20.0758 9.49734C20.0367 9.51258 19.9927 9.50846 19.9569 9.48664C19.8599 9.42762 19.7616 9.37071 19.6618 9.31596C19.6251 9.2958 19.5997 9.25984 19.5933 9.21843L19.0854 5.89915C19.0356 5.57369 18.7556 5.33333 18.4264 5.33333H13.5722ZM16.0001 20.2854C18.3672 20.2854 20.2862 18.3664 20.2862 15.9993C20.2862 13.6322 18.3672 11.7132 16.0001 11.7132C13.6329 11.7132 11.714 13.6322 11.714 15.9993C11.714 18.3664 13.6329 20.2854 16.0001 20.2854Z" fill="currentColor"/>';const yY=Object.freeze(Object.defineProperty({__proto__:null,default:gY},Symbol.toStringTag,{value:"Module"}));var vY='<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0007 28.7923C15.0007 29.0152 14.9774 29.096 14.9339 29.1775C14.8903 29.259 14.8263 29.323 14.7449 29.3665C14.6634 29.4101 14.5826 29.4333 14.3597 29.4333H12.575C12.3521 29.4333 12.2713 29.4101 12.1898 29.3665C12.1083 29.323 12.0443 29.259 12.0008 29.1775C11.9572 29.096 11.934 29.0152 11.934 28.7923V12.2993L5.97496 12.3C5.75208 12.3 5.67125 12.2768 5.58977 12.2332C5.50829 12.1896 5.44434 12.1257 5.40077 12.0442C5.35719 11.9627 5.33398 11.8819 5.33398 11.659V9.87429C5.33398 9.65141 5.35719 9.57059 5.40077 9.48911C5.44434 9.40762 5.50829 9.34368 5.58977 9.3001C5.67125 9.25652 5.75208 9.23332 5.97496 9.23332H26.0263C26.2492 9.23332 26.33 9.25652 26.4115 9.3001C26.493 9.34368 26.557 9.40762 26.6005 9.48911C26.6441 9.57059 26.6673 9.65141 26.6673 9.87429V11.659C26.6673 11.8819 26.6441 11.9627 26.6005 12.0442C26.557 12.1257 26.493 12.1896 26.4115 12.2332C26.33 12.2768 26.2492 12.3 26.0263 12.3L20.067 12.2993L20.0673 28.7923C20.0673 29.0152 20.0441 29.096 20.0005 29.1775C19.957 29.259 19.893 29.323 19.8115 29.3665C19.73 29.4101 19.6492 29.4333 19.4263 29.4333H17.6416C17.4187 29.4333 17.3379 29.4101 17.2564 29.3665C17.175 29.323 17.111 29.259 17.0674 29.1775C17.0239 29.096 17.0007 29.0152 17.0007 28.7923L17 22.7663H15L15.0007 28.7923Z" fill="currentColor"/> <path d="M16.0007 7.89998C17.4734 7.89998 18.6673 6.70608 18.6673 5.23332C18.6673 3.76056 17.4734 2.56665 16.0007 2.56665C14.5279 2.56665 13.334 3.76056 13.334 5.23332C13.334 6.70608 14.5279 7.89998 16.0007 7.89998Z" fill="currentColor"/>';const TY=Object.freeze(Object.defineProperty({__proto__:null,default:vY},Symbol.toStringTag,{value:"Module"}));var bY='<path fill-rule="evenodd" clip-rule="evenodd" d="M4.6661 6.66699C4.29791 6.66699 3.99943 6.96547 3.99943 7.33366V24.667C3.99943 25.0352 4.29791 25.3337 4.6661 25.3337H27.3328C27.701 25.3337 27.9994 25.0352 27.9994 24.667V7.33366C27.9994 6.96547 27.701 6.66699 27.3328 6.66699H4.6661ZM8.66667 21.3333C8.29848 21.3333 8 21.0349 8 20.6667V11.3333C8 10.9651 8.29848 10.6667 8.66667 10.6667H14C14.3682 10.6667 14.6667 10.9651 14.6667 11.3333V12.6667C14.6667 13.0349 14.3682 13.3333 14 13.3333H10.8C10.7264 13.3333 10.6667 13.393 10.6667 13.4667V18.5333C10.6667 18.607 10.7264 18.6667 10.8 18.6667H14C14.3682 18.6667 14.6667 18.9651 14.6667 19.3333V20.6667C14.6667 21.0349 14.3682 21.3333 14 21.3333H8.66667ZM18 21.3333C17.6318 21.3333 17.3333 21.0349 17.3333 20.6667V11.3333C17.3333 10.9651 17.6318 10.6667 18 10.6667H23.3333C23.7015 10.6667 24 10.9651 24 11.3333V12.6667C24 13.0349 23.7015 13.3333 23.3333 13.3333H20.1333C20.0597 13.3333 20 13.393 20 13.4667V18.5333C20 18.607 20.0597 18.6667 20.1333 18.6667H23.3333C23.7015 18.6667 24 18.9651 24 19.3333V20.6667C24 21.0349 23.7015 21.3333 23.3333 21.3333H18Z" fill="currentColor"/>';const EY=Object.freeze(Object.defineProperty({__proto__:null,default:bY},Symbol.toStringTag,{value:"Module"}));var SY='<path d="M8 28.0003C8 27.6321 8.29848 27.3336 8.66667 27.3336H23.3333C23.7015 27.3336 24 27.
436321 24 28.0003V29.3336C24 29.7018 23.7015 30.0003 23.3333 30.0003H8.66667C8.29848 30.0003 8 29.7018 8 29.3336V28.0003Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M4.66602 6.66699C4.29783 6.66699 3.99935 6.96547 3.99935 7.33366V24.667C3.99935 25.0352 4.29783 25.3337 4.66602 25.3337H27.3327C27.7009 25.3337 27.9994 25.0352 27.9994 24.667V7.33366C27.9994 6.96547 27.7009 6.66699 27.3327 6.66699H4.66602ZM8.66659 21.3333C8.2984 21.3333 7.99992 21.0349 7.99992 20.6667V11.3333C7.99992 10.9651 8.2984 10.6667 8.66659 10.6667H13.9999C14.3681 10.6667 14.6666 10.9651 14.6666 11.3333V12.6667C14.6666 13.0349 14.3681 13.3333 13.9999 13.3333H10.7999C10.7263 13.3333 10.6666 13.393 10.6666 13.4667V18.5333C10.6666 18.607 10.7263 18.6667 10.7999 18.6667H13.9999C14.3681 18.6667 14.6666 18.9651 14.6666 19.3333V20.6667C14.6666 21.0349 14.3681 21.3333 13.9999 21.3333H8.66659ZM17.9999 21.3333C17.6317 21.3333 17.3333 21.0349 17.3333 20.6667V11.3333C17.3333 10.9651 17.6317 10.6667 17.9999 10.6667H23.3333C23.7014 10.6667 23.9999 10.9651 23.9999 11.3333V12.6667C23.9999 13.0349 23.7014 13.3333 23.3333 13.3333H20.1333C20.0596 13.3333 19.9999 13.393 19.9999 13.4667V18.5333C19.9999 18.607 20.0596 18.6667 20.1333 18.6667H23.3333C23.7014 18.6667 23.9999 18.9651 23.9999 19.3333V20.6667C23.9999 21.0349 23.7014 21.3333 23.3333 21.3333H17.9999Z" fill="currentColor"/>';const _Y=Object.freeze(Object.defineProperty({__proto__:null,default:SY},Symbol.toStringTag,{value:"Module"}));var AY='<path d="M14.6667 17.3333C14.6667 16.9651 14.9652 16.6667 15.3333 16.6667H20.6667C21.0349 16.6667 21.3333 16.9651 21.3333 17.3333V18.6667C21.3333 19.0349 21.0349 19.3333 20.6667 19.3333H15.3333C14.9652 19.3333 14.6667 19.0349 14.6667 18.6667V17.3333Z" fill="currentColor"/> <path d="M11.3333 12C10.9652 12 10.6667 12.2985 10.6667 12.6667V14C10.6667 14.3682 10.9652 14.6667 11.3333 14.6667H16.6667C17.0349 14.6667 17.3333 14.3682 17.3333 14V12.6667C17.3333 12.2985 17.0349 12 16.6667 12H11.3333Z" fill="currentColor"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.33334 7.33334C5.33334 6.96515 5.63182 6.66667 6.00001 6.66667H26C26.3682 6.66667 26.6667 6.96515 26.6667 7.33334V24C26.6667 24.3682 26.3682 24.6667 26 24.6667H24.1333C24.0597 24.6667 24 24.7264 24 24.8V27.3452C24 27.8924 23.3772 28.2065 22.9372 27.8814L18.6216 24.6928C18.5986 24.6758 18.5709 24.6667 18.5423 24.6667H6.00001C5.63182 24.6667 5.33334 24.3682 5.33334 24V7.33334ZM8.66668 9.33334C8.29849 9.33334 8.00001 9.63181 8.00001 10V21.3333C8.00001 21.7015 8.29849 22 8.66668 22H23.3333C23.7015 22 24 21.7015 24 21.3333V10C24 9.63182 23.7015 9.33334 23.3333 9.33334H8.66668Z" fill="currentColor"/>';const xY=Object.freeze(Object.defineProperty({__proto__:null,default:AY},Symbol.toStringTag,{value:"Module"}));var LY='<path d="M25.14 25.1089C25.0171 25.2532 24.8356 25.3333 24.646 25.3333H22.8124C22.1084 25.3333 21.7734 24.1872 22.2745 23.6927C23.9161 22.0729 24.9336 19.822 24.9336 17.3333C24.9336 12.3997 20.9336 8.39973 16 8.39973C11.0664 8.39973 7.06641 12.3997 7.06641 17.3333C7.06641 19.822 8.08389 22.0729 9.72555 23.6927C10.2266 24.1872 9.89155 25.3333 9.18762 25.3333H7.35398C7.16436 25.3333 6.98294 25.2532 6.86001 25.1089C5.07703 23.015 4 20.2991 4 17.3333C4 10.7057 9.3724 5.33333 16 5.33333C22.6276 5.33333 28 10.7057 28 17.3333C28 20.2991 26.923 23.015 25.14 25.1089Z" fill="currentColor"/> <path d="M21.1992 14.3399C21.4595 14.0796 21.4595 13.6575 21.1992 13.3971L20.2564 12.4543C19.996 12.194 19.5739 12.194 19.3136 12.4543L16.4492 15.3187C16.4185 15.3493 16.3749 15.3629 16.332 15.3568C16.2236 15.3414 16.1127 15.3334 16 15.3334C14.7113 15.3334 13.6667 16.378 13.6667 17.6667C13.6667 18.9554 14.7113 20 16 20C17.2887 20 18.3333 18.9554 18.3333 17.6667C18.3333 17.5464 18.3242 17.4283 18.3067 17.313C18.3001 17.2696 18.3136 17.2255 18.3446 17.1945L21.1992 14.3399Z" fill="currentColor"/>';const wY=Object.freeze(Object.defineProperty({__proto__:null,default:LY},Symbol.toStringTag,{value:"Module"}));var CY='<path d="M16.6927 25.3346C16.3245 25.3346 16.026 25.0361 16.026 24.6679L16.026 7.3346C16.026 6.96641 16.3245 6.66794 16.6927 6.66794L18.6927 6.66794C19.0609 6.66794 19.3594 6.96642 19.3594 7.3346L19.3594 24.6679C19.3594 25.0361 19.0609 25.3346 18.6927 25.3346H16.6927Z" fill="currentColor"/> <path d="M24.026 25.3346C23.6578 25.3346 23.3594 25.0361 23.3594 24.6679L23.3594 7.3346C23.3594 6.96641 23.6578 6.66794 24.026 6.66794L26.026 6.66794C26.3942 6.66794 26.6927 6.96642 26.6927 7.3346V24.6679C26.6927 25.0361 26.3942 25.3346 26.026 25.3346H24.026Z" fill="currentColor"/> <path d="M5.48113 23.9407C5.38584 24.2963 5.59689 24.6619 5.95254 24.7572L7.88439 25.2748C8.24003 25.3701 8.60559 25.159 8.70089 24.8034L13.1871 8.06067C13.2824 7.70503 13.0713 7.33947 12.7157 7.24417L10.7838 6.72654C10.4282 6.63124 10.0626 6.8423 9.96733 7.19794L5.48113 23.9407Z" fill="currentColor"/>';const IY=Object.freeze(Object.defineProperty({__proto__:null,default:CY},Symbol.toStringTag,{value:"Module"}));var kY='<path d="M17.947 16.095C17.999 16.043 17.999 15.9585 17.947 15.9065L11.6295 9.58899C11.3691 9.32864 11.3691 8.90653 11.6295 8.64618L13.2323 7.04341C13.4926 6.78306 13.9147 6.78306 14.1751 7.04341L21.0289 13.8973C21.0392 13.9064 21.0493 13.9158 21.0591 13.9257L22.6619 15.5285C22.9223 15.7888 22.9223 16.2109 22.6619 16.4713L14.1766 24.9565C13.9163 25.2169 13.4942 25.2169 13.2338 24.9565L11.631 23.3538C11.3707 23.0934 11.3707 22.6713 11.631 22.411L17.947 16.095Z" fill="currentColor"/>';const RY=Object.freeze(Object.defineProperty({__proto__:null,default:kY},Symbol.toStringTag,{value:"Module"}));var PY='<path d="M15.905 17.4809C15.9571 17.533 16.0415 17.533 16.0936 17.4809L22.4111 11.1635C22.6714 10.9031 23.0935 10.9031 23.3539 11.1635L24.9567 12.7662C25.217 13.0266 25.217 13.4487 24.9567 13.709L18.1028 20.5629C18.0937 20.5732 18.0842 20.5833 18.0744 20.5931L16.4716 22.1959C16.2113 22.4562 15.7892 22.4562 15.5288 22.1959L7.04353 13.7106C6.78318 13.4503 6.78318 13.0281 7.04353 12.7678L8.6463 11.165C8.90665 10.9047 9.32876 10.9047 9.58911 11.165L15.905 17.4809Z" fill="currentColor"/>';const DY=Object.freeze(Object.defineProperty({__proto__:null,default:PY},Symbol.toStringTag,{value:"Module"}));var OY='<path d="M14.8206 15.9049C14.7685 15.9569 14.7685 16.0413 14.8206 16.0934L21.1381 22.4109C21.3984 22.6712 21.3984 23.0934 21.1381 23.3537L19.5353 24.9565C19.275 25.2168 18.8529 25.2168 18.5925 24.9565L11.7386 18.1026C11.7283 18.0935 11.7183 18.084 
4311.7084 18.0742L10.1057 16.4714C9.84531 16.2111 9.84531 15.789 10.1057 15.5286L18.5909 7.04335C18.8513 6.783 19.2734 6.783 19.5338 7.04335L21.1365 8.64612C21.3969 8.90647 21.3969 9.32858 21.1365 9.58893L14.8206 15.9049Z" fill="currentColor"/>';const MY=Object.freeze(Object.defineProperty({__proto__:null,default:OY},Symbol.toStringTag,{value:"Module"}));var $Y='<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9266 7.57992C25.015 7.60672 25.0886 7.64746 25.2462 7.80506L26.956 9.51488C27.1136 9.67248 27.1543 9.74604 27.1811 9.83447C27.2079 9.9229 27.2079 10.0133 27.1811 10.1018C27.1543 10.1902 27.1136 10.2638 26.956 10.4214L13.1822 24.1951C13.0246 24.3527 12.951 24.3935 12.8626 24.4203C12.797 24.4402 12.7304 24.4453 12.6642 24.4357L12.7319 24.4203C12.6435 24.4471 12.553 24.4471 12.4646 24.4203C12.3762 24.3935 12.3026 24.3527 12.145 24.1951L5.04407 17.0942C4.88647 16.9366 4.84573 16.863 4.81893 16.7746C4.79213 16.6862 4.79213 16.5957 4.81893 16.5073C4.84573 16.4189 4.88647 16.3453 5.04407 16.1877L6.7539 14.4779C6.9115 14.3203 6.98506 14.2796 7.07349 14.2528C7.16191 14.226 7.25235 14.226 7.34078 14.2528C7.42921 14.2796 7.50277 14.3203 7.66037 14.4779L12.6628 19.4808L24.3397 7.80506C24.4973 7.64746 24.5709 7.60672 24.6593 7.57992C24.7477 7.55311 24.8382 7.55311 24.9266 7.57992Z" fill="currentColor"/>';const NY=Object.freeze(Object.defineProperty({__proto__:null,default:$Y},Symbol.toStringTag,{value:"Module"}));var FY='<path fill-rule="evenodd" clip-rule="evenodd" d="M20.1724 22.3417C20.1263 22.2956 20.0536 22.2897 20.0001 22.327C18.4883 23.3815 16.6497 24 14.6666 24C9.51199 24 5.33331 19.8213 5.33331 14.6667C5.33331 9.51202 9.51199 5.33334 14.6666 5.33334C19.8213 5.33334 24 9.51202 24 14.6667C24 16.6502 23.3813 18.4891 22.3263 20.0011C22.289 20.0546 22.2949 20.1273 22.341 20.1734L26.195 24.0274C26.4554 24.2878 26.4554 24.7099 26.195 24.9702L24.9694 26.1959C24.709 26.4562 24.2869 26.4562 24.0266 26.1959L20.1724 22.3417ZM20.9336 14.6667C20.9336 18.1278 18.1278 20.9336 14.6666 20.9336C11.2055 20.9336 8.39972 18.1278 8.39972 14.6667C8.39972 11.2055 11.2055 8.39975 14.6666 8.39975C18.1278 8.39975 20.9336 11.2055 20.9336 14.6667Z" fill="currentColor"/>';const BY=Object.freeze(Object.defineProperty({__proto__:null,default:FY},Symbol.toStringTag,{value:"Module"}));var UY='<path d="M10.2017 23.401C10.462 23.6613 10.8841 23.6613 11.1445 23.401L15.9057 18.6398C15.9577 18.5877 16.0422 18.5877 16.0942 18.6398L20.8555 23.401C21.1158 23.6613 21.5379 23.6613 21.7983 23.401L23.401 21.7982C23.6614 21.5378 23.6614 21.1157 23.401 20.8554L18.6398 16.0942C18.5878 16.0421 18.5878 15.9577 18.6398 15.9056L23.401 11.1444C23.6613 10.8841 23.6613 10.462 23.401 10.2016L21.7982 8.59886C21.5379 8.33851 21.1158 8.33851 20.8554 8.59886L16.0942 13.36C16.0422 13.4121 15.9577 13.4121 15.9057 13.36L11.1445 8.59887C10.8842 8.33852 10.4621 8.33852 10.2017 8.59887L8.59894 10.2016C8.33859 10.462 8.33859 10.8841 8.59894 11.1445L13.3601 15.9056C13.4122 15.9577 13.4122 16.0421 13.3601 16.0942L8.59889 20.8554C8.33854 21.1157 8.33854 21.5378 8.59889 21.7982L10.2017 23.401Z" fill="currentColor"/>';const VY=Object.freeze(Object.defineProperty({__proto__:null,default:UY},Symbol.toStringTag,{value:"Module"}));var HY='<path d="M12 7.66667C12 7.29848 12.2985 7 12.6666 7H26C26.3682 7 26.6666 7.29848 26.6666 7.66667V9.66667C26.6666 10.0349 26.3682 10.3333 26 10.3333H12.6666C12.2985 10.3333 12 10.0349 12 9.66667V7.66667Z" fill="currentColor"/> <path d="M12 15C12 14.6318 12.2985 14.3333 12.6666 14.3333H26C26.3682 14.3333 26.6666 14.6318 26.6666 15V17C26.6666 17.3682 26.3682 17.6667 26 17.6667H12.6666C12.2985 17.6667 12 17.3682 12 17V15Z" fill="currentColor"/> <path d="M5.99998 21.6667C5.63179 21.6667 5.33331 21.9651 5.33331 22.3333V24.3333C5.33331 24.7015 5.63179 25 5.99998 25H7.99998C8.36817 25 8.66665 24.7015 8.66665 24.3333V22.3333C8.66665 21.9651 8.36817 21.6667 7.99998 21.6667H5.99998Z" fill="currentColor"/> <path d="M12.6666 21.6667C12.2985 21.6667 12 21.9651 12 22.3333V24.3333C12 24.7015 12.2985 25 12.6666 25H26C26.3682 25 26.6666 24.7015 26.6666 24.3333V22.3333C26.6666 21.9651 26.3682 21.6667 26 21.6667H12.6666Z" fill="currentColor"/> <path d="M5.99998 14.3333C5.63179 14.3333 5.33331 14.6318 5.33331 15V17C5.33331 17.3682 5.63179 17.6667 5.99998 17.6667H7.99998C8.36817 17.6667 8.66665 17.3682 8.66665 17V15C8.66665 14.6318 8.36817 14.3333 7.99998 14.3333H5.99998Z" fill="currentColor"/> <path d="M5.99998 7C5.63179 7 5.33331 7.29848 5.33331 7.66667V9.66667C5.33331 10.0349 5.63179 10.3333 5.99998 10.3333H7.99998C8.36817 10.3333 8.66665 10.0349 8.66665 9.66667V7.66667C8.66665 7.29848 8.36817 7 7.99998 7H5.99998Z" fill="currentColor"/>';const DR=Object.freeze(Object.defineProperty({__proto__:null,default:HY},Symbol.toStringTag,{value:"Module"})),qY=8;function W8(n={}){return!!(n.isLoggedIn||n.hasContact||n.hasEmailCapture)}class Y8{constructor({action:e,nonce:t,mediaId:i,buildEvidence:s}){this.action=e,this.nonce=t||"",this.mediaId=i,this.buildEvidence=s,this.fired=new Set,this.pending=new Set,this.attempts={},this.sending=!1}claim(e){for(const t of e)this.fired.has(t)||(this.pending.add(t),this.sending&&(this._claimedWhileSending=!0))}flush(e=!1){this.pending.size!==0&&(this.sending&&!e||this.ping(Array.from(this.pending),e))}
43ping(e,t=!1){const i=Pk();if(!i)return;const s={nonce:this.nonce,media_id:this.mediaId,crossed:JSON.stringify(e),...this.buildEvidence?this.buildEvidence():{}};if(t&&navigator.sendBeacon){navigator.sendBeacon(i,Dk(this.action,s));return}this.sending=!0,pF(this.action,s).then(r=>{var o;const a=(o=r==null?void 0:r.data)==null?void 0:o.reached;if(!Array.isArray(a)){this._confirm(e);return}this._confirm(a);for(const l of e)this.fired.has(l)||(this.attempts[l]=(this.attempts[l]||0)+1,this.attempts[l]>=qY&&this._confirm([l]))}).catch(()=>{}).finally(()=>{this.sending=!1,this._claimedWhileSending&&(this._claimedWhileSending=!1,this.flush(!1))})}_confirm(e){for(const t of e)this.pending.delete(t),this.fired.add(t)}}const GY="fluent_player_layer_event",KY=["seen","completed","skipped"];function jY(n){if(!n||typeof n!="object")return{};const e={};for(const[t,i]of Object.entries(n)){const s=Array.isArray(i)?i.filter(r=>KY.includes(r)):[];s.length&&(e[String(t)]=s)}return e}class WY{constructor(e,t={}){this.layersManager=e,this.mediaId=t.mediaId,this.armed=jY(t.armed),this.canReport=W8(t),this.channel=new Y8({action:GY,nonce:t.nonce,mediaId:t.mediaId}),!(!e||!this.mediaId||!this.canReport||!Object.keys(this.armed).length)&&(this._unsubscribe=e.subscribeLayerEvents((i,s)=>this._onEvent(i,s)),this._flushedOnHide=!1,this._onUnload=()=>{this._flushedOnHide||(this._flushedOnHide=!0,this.channel.flush(!0))},this._onVisibility=()=>{document.visibilityState==="hidden"?this._onUnload():this._flushedOnHide=!1},window.addEventListener("beforeunload",this._onUnload),window.addEventListener("pagehide",this._onUnload),document.addEventListener("visibilitychange",this._onVisibility),this._attached=!0)}get fired(){return this.channel.fired}get pending(){return this.channel.pending}get sending(){return this.channel.sending}_onEvent(e,t){const i=this.armed[String(e)];i&&(t!=="seen"&&!i.includes(t)||(this.channel.claim([String(e)+":"+t]),this.channel.flush(!1)))}destroy(){this._attached&&(this.channel.pending.size>0&&this.channel.flush(!0),this._unsubscribe(),window.removeEventListener("beforeunload",this._onUnload),window.removeEventListener("pagehide",this._onUnload),document.removeEventListener("visibilitychange",this._onVisibility),this._attached=!1),this.layersManager=null}}const YY=Object.freeze(Object.defineProperty({__proto__:null,default:WY},Symbol.toStringTag,{value:"Module"})),X=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},zY=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=QY},QY=Number.MAX_SAFE_INTEGER||9007199254740991;let ee=function(n){return n.NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n}({}),$=function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ER
43ROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.ASSET_LIST_LOAD_ERROR="assetListLoadError",n.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",n.ASSET_LIST_PARSING_ERROR="assetListParsingError",n.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.ATTACH_MEDIA_ERROR="attachMediaError",n.UNKNOWN="unknown",n}({}),S=function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.MEDIA_ENDED="hlsMediaEnded",n.STALL_RESOLVED="hlsStallResolved",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFERED_TO_END="hlsBufferedToEnd",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n.ASSET_LIST_LOADING="hlsAssetListLoading",n.ASSET_LIST_LOADED="hlsAssetListLoaded",n.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",n.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",n.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",n.INTERSTITIAL_STARTED="hlsInterstitialStarted",n.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",n.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",n.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",n.INTERSTITIAL_ENDED="hlsInterstitialEnded",n.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",n.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",n.EVENT_CUE_ENTER="hlsEventCueEnter",n}({});var xe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Z={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class Ll{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}
vendor: 4,105 bytes, line 43
43getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class XY{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Ll(e),this.fast_=new Ll(t),this.defaultTTFB_=s,this.ttfb_=new Ll(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new Ll(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Ll(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new Ll(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,s=e/1e3,r=i/s;this.fast_.sample(s,r),this.slow_.sample(s,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function ZY(n,e,t){return(e=ez(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function We(){return We=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},We.apply(null,arguments)}function OR(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,i)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?OR(Object(t),!0).forEach(function(i){ZY(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):OR(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function JY(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ez(n){var e=JY(n,"string");return typeof e=="symbol"?e:e+""}class Bi{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=dr,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const dr=function(){},tz={trace:dr,debug:dr,log:dr,warn:dr,info:dr,error:dr};function tI(){return We({},tz)}function iz(n,e){const t=self.console[n];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${n}] >`):dr}function MR(n,e,t){return e[n]?e[n].bind(e):iz(n,t)}const iI=tI();function sz(n,e,t){const i=tI();if(typeof console=="object"&&n===!0||typeof n=="object"){const s=["debug","log","info","warn","error"];s.forEach(r=>{i[r]=MR(r,n,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return tI()}s.forEach(r=>{iI[r]=MR(r,n)})}else We(iI,i);return i}const qe=iI;function Jn(n=!0){return typeof self>"u"?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function nz(n){return typeof self<"u"&&n===self.ManagedMediaSource}function z8(n,e){const t=Object.keys(n),i=Object.keys(e),s=t.length,r=i.length;return!s||!r||s===r&&!t.some(a=>i.indexOf(a)===-1)}function Ai(n,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(n);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const t=n.length;let i,s,r,a="",o=0;for(;o<t;){if(i=n[o++],i===0&&e)return a;
vendor: 30,322 bytes, line 43
43if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=n[o++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=n[o++],r=n[o++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(r&63)<<0);break}}return a}function Bt(n){let e="";for(let t=0;t<n.length;t++){let i=n[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function Q8(n){return Uint8Array.from(n.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function rz(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vx={exports:{}},$R;function az(){return $R||($R=1,function(n,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,h){if(h=h||{},l=l.trim(),c=c.trim(),!c){if(!h.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var f=o.parseURL(c);if(!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return h.alwaysNormalize?(f.path=o.normalizePath(f.path),o.buildURLFromParts(f)):c;var g=o.parseURL(l);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var y=s.exec(g.path);g.netLoc=y[1],g.path=y[2]}g.netLoc&&!g.path&&(g.path="/");var v={scheme:g.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment};if(!f.netLoc&&(v.netLoc=g.netLoc,f.path[0]!=="/"))if(!f.path)v.path=g.path,f.params||(v.params=g.params,f.query||(v.query=g.query));else{var T=g.path,b=T.substring(0,T.lastIndexOf("/")+1)+f.path;v.path=o.normalizePath(b)}return v.path===null&&(v.path=h.alwaysNormalize?o.normalizePath(f.path):f.path),o.buildURLFromParts(v)},parseURL:function(l){var c=i.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};n.exports=o})()}(Vx)),Vx.exports}var Yk=az();class ux{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Qe={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class zk{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,oz(this,"stats")}setByteRange(e,t){const i=e.split("@",2);let s;i.length===1?s=(t==null?void 0:t.byteRangeEndOffset)||0:s=parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[Qe.AUDIO]:null,[Qe.VIDEO]:null,[Qe.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new ux),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Yk.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Qe.AUDIO]=null,e[Qe.VIDEO]=null,e[Qe.AUDIOVIDEO]=null}}function pt(n){return n.sn!=="initSegment"}class $g extends zk{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(X(e)&&X(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const s=this._decryptdata=t[i[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=X(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const i=Object.keys(this.levelkeys),s=i.length;if(s>1||s===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!X(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return pt(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var i;const s=t[e];s&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,s,r,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,i),l.startDTS=Math.min(l.startDTS,s),l.endDTS=Math.max(l.endDTS,r)}}class X8 extends zk{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Z8(n,e){const t=Object.getPrototypeOf(n);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Z8(t,e)}}function oz(n,e){const t=Z8(n,e);t&&(t.enumerable=!0,Object.defineProperty(n,e,t))}const NR=Math.pow(2,32)-1,lz=[].push,J8={video:1,audio:2,id3:3,text:4};function bt(n){return String.fromCharCode.apply(null,n)}function e7(n,e){const t=n[e]<<8|n[e+1];return t<0?65536+t:t}function fe(n,e){const t=t7(n,e);return t<0?4294967296+t:t}function FR(n,e){let t=fe(n,e);return t*=Math.pow(2,32),t+=fe(n,e+4),t}function t7(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function cz(n){const e=n.byteLength;for(let t=0;t<e;){const i=fe(n,t);if(i>8&&n[t+4]===109&&n[t+5]===111&&n[t+6]===111&&n[t+7]===102)return!0;t=i>1?t+i:e}return!1}function Ae(n,e){const t=[];if(!e.length)return t;const i=n.byteLength;for(let s=0;s<i;){const r=fe(n,s),a=bt(n.subarray(s+4,s+8)),o=r>1?s+r:i;if(a===e[0])if(e.length===1)t.push(n.subarray(s+8,o));else{const l=Ae(n.subarray(s+8,o),e.slice(1));l.length&&lz.apply(t,l)}s=o}return t}function uz(n){const e=[],t=n[0];let i=8;const s=fe(n,i);i+=4;let r=0,a=0;t===0?(r=fe(n,i),a=fe(n,i+4),i+=8):(r=FR(n,i),a=FR(n,i+8),i+=16),i+=2;let o=n.length+a;const l=e7(n,i);i+=2;for(let c=0;c<l;c++){let h=i;const d=fe(n,h);h+=4;const f=d&2147483647;if((d&2147483648)>>>31===1)return qe.warn("SIDX has hierarchical references (not supported)"),null;const y=fe(n,h);h+=4,e.push({referenceSize:f,subsegmentDuration:y,info:{duration:y/s,start:o,end:o+f-1}}),o+=f,h+=4,i=h}return{earliestPresentationTime:r,timescale:s,version:t,referencesCount:l,references:e}}function i7(n){const e=[],t=Ae(n,["moov","trak"]);for(let s=0;s<t.length;s++){const r=t[s],a=Ae(r,["tkhd"])[0];if(a){let o=a[0];const l=fe(a,o===0?12:20),c=Ae(r,["mdia","mdhd"])[0];if(c){o=c[0];const h=fe(c,o===0?12:20),d=Ae(r,["mdia","hdlr"])[0];if(d){const f=bt(d.subarray(8,12)),g={soun:Qe.AUDIO,vide:Qe.VIDEO}[f],y=Ae(r,["mdia","minf","stbl","stsd"])[0],v=hz(y);g?(e[l]={timescale:h,type:g,stsd:v},e[g]=He({timescale:h,id:l},v)):e[l]={timescale:h,type:f,stsd:v}}}}}return Ae(n,["moov","mvex","trex"]).forEach(s=>{const r=fe(s,4),a=e[r];a&&(a.default={duration:fe(s,12),flags:fe(s,20)})}),e}function hz(n){const e=n.subarray(8),t=e.subarray(8+78),i=bt(e.subarray(4,8));let s=i,r;const a=i==="enca"||i==="encv";if(a){const c=Ae(e,[i])[0].subarray(i==="enca"?28:78);Ae(c,["sinf"]).forEach(d=>{const f=Ae(d,["schm"])[0];if(f){const g=bt(f.subarray(4,8));if(g==="cbcs"||g==="cenc"){const y=Ae(d,["frma"])[0];y&&(s=bt(y))}}})}const o=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const l=Ae(t,["avcC"])[0];l&&l.length>3&&(s+="."+Km(l[1])+Km(l[2])+Km(l[3]),r=Gm(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=Ae(e,[i])[0],c=Ae(l.subarray(28),["esds"])[0];if(c&&c.length>7){let h=4;if(c[h++]!==3)break;h=Hx(c,h),h+=2;const d=c[h++];if(d&128&&(h+=2),d&64&&(h+=c[h++]),c[h++]!==4)break;h=Hx(c,h);const f=c[h++];if(f===64)s+="."+Km(f);else break;if(h+=12,c[h++]!==5)break;h=Hx(c,h);const g=c[h++];let y=(g&248)>>3;y===31&&(y+=1+((g&7)<<3)+((c[h]&224)>>5)),s+="."+y}break}case"hvc1":case"hev1":{const l=Ae(t,["hvcC"])[0];if(l&&l.length>12){const c=l[1],h=["","A","B","C"][c>>6],d=c&31,f=fe(l,2),g=(c&32)>>5?"H":"L",y=l[12],v=l.subarray(6,12);s+="."+h+d,s+="."+dz(f).toString(16).toUpperCase(),s+="."+g+y;let T="";for(let b=v.length;b--;){const E=v[b];(E||T)&&(T="."+E.toString(16).toUpperCase()+T)}s+=T}r=Gm(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=Gm(s,t)||s;break}case"vp09":{const l=Ae(t,["vpcC"])[0];if(l&&l.length>6){const c=l[4],h=l[5],d=l[6]>>4&15;s+="."+Es(c)+"."+Es(h)+"."+Es(d)}break}case"av01":{const l=Ae(t,["av1C"])[0];if(l&&l.length>2){const c=l[1]>>>5,h=l[1]&31,d=l[2]>>>7?"H":"M",f=(l[2]&64)>>6,g=(l[2]&32)>>5,y=c===2&&f?g?12:10:f?10:8,v=(l[2]&16)>>4,T=(l[2]&8)>>3,b=(l[2]&4)>>2,E=l[2]&3,_=1,x=1,w=1,R=0;s+="."+c+"."+Es(h)+d+"."+Es(y)+"."+v+"."+T+b+E+"."+Es(_)+"."+Es(x)+"."+Es(w)+"."+R,r=Gm("dav1",t)}break}}return{codec:s,encrypted:a,supplemental:r}}function Gm(n,e){const t=Ae(e,["dvvC"]),i=t.length?t[0]:Ae(e,["dvcC"])[0];if(i){const s=i[2]>>1&127,r=i[2]<<5&32|i[3]>>3&31;return n+"."+Es(s)+"."+Es(r)}}function dz(n){let e=0;for(let t=0;t<32;t++)e|=(n>>t&1)<<32-1-t;return e>>>0}function Hx(n,e){const t=e+5;for(;n[e++]&128&&e<t;);return e}function Km(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function Es(n){return(n<10?"0":"")+n}function fz(n,e){if(!n||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&s7(n,(i,s)=>{const r=i.subarray(8,24);r.some(a=>a!==0)||(qe.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${Bt(r)} -> ${Bt(t)}`),i.set(t,8))})}function pz(n){const e=[];return s7(n,t=>e.push(t.subarray(8,24))),e}function s7(n,e){Ae(n,["moov","trak"]).forEach(i=>{const s=Ae(i,["mdia","minf","stbl","stsd"])[0];if(!s)return;const r=s.subarray(8);let a=Ae(r,["enca"]);const o=a.length>0;o||(a=Ae(r,["encv"])),a.forEach(l=>{const c=o?l.subarray(28):l.subarray(78);Ae(c,["sinf"]).forEach(d=>{const f=n7(d);f&&e(f,o)})})})}function n7(n){const e=Ae(n,["schm"])[0];if(e){const t=bt(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=Ae(n,["schi","tenc"])[0];if(i)return i}}}function mz(n,e,t){const i={},s=Ae(n,["moof","traf"]);for(let r=0;r<s.length;r++){const a=s[r],o=Ae(a,["tfhd"])[0],l=fe(o,4),c=e[l];if(!c)continue;i[l]||(i[l]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});const h=i[l],d=Ae(a,["tfdt"])[0];if(d){const _=d[0];let x=fe(d,4);_===1&&(x===NR?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(x*=NR+1,x+=fe(d,8))),X(x)&&(!X(h.start)||x<h.start)&&(h.start=x)}const f=c.default,g=fe(o,0)|(f==null?void 0:f.flags);let y=(f==null?void 0:f.duration)||0;g&8&&(g&2?y=fe(o,12):y=fe(o,8));const v=Ae(a,["trun"]);let T=h.start||0,b=0,E=y;for(let _=0;_<v.length;_++){const x=v[_],w=fe(x,4),R=h.sampleCount;h.sampleCount+=w;const C=x[3]&1,k=x[3]&4,P=x[2]&1,I=x[2]&2,O=x[2]&4,G=x[2]&8;let j=8,K=w;for(C&&(j+=4),k&&w&&(!(x[j+1]&1)&&h.keyFrameIndex===void 0&&(h.keyFrameIndex=R),j+=4,P?(E=fe(x,j),j+=4):E=y,I&&(j+=4),G&&(j+=4),T+=E,b+=E,K--);K--;)P?(E=fe(x,j),j+=4):E=y,I&&(j+=4),O&&(x[j+1]&1||h.keyFrameIndex===void 0&&(h.keyFrameIndex=h.sampleCount-(K+1),h.keyFrameStart=T),j+=4),G&&(j+=4),T+=E,b+=E;!b&&y&&(b+=y*w)}h.duration+=b}if(!Object.keys(i).some(r=>i[r].duration)){let r=1/0,a=0;const o=Ae(n,["sidx"]);for(let l=0;l<o.length;l++){const c=uz(o[l]);if(c!=null&&c.references){r=Math.min(r,c.earliestPresentationTime/c.timescale);const h=c.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,h+c.earliestPresentationTime/c.timescale)}}a&&X(a)&&Object.keys(i).forEach(l=>{i[l].duration||(i[l].duration=a*i[l].timescale-i[l].start)})}return i}function gz(n){const e={valid:null,remainder:null},t=Ae(n,["moof"]);if(t.length<2)return e.remainder=n,e;const i=t[t.length-1];return e.valid=n.slice(0,i.byteOffset-8),e.remainder=n.slice(i.byteOffset-8),e}function Ni(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function BR(n,e){const t=[],i=e.samples,s=e.timescale,r=e.id;let a=!1;return Ae(i,["moof"]).map(l=>{const c=l.byteOffset-8;Ae(l,["traf"]).map(d=>{const f=Ae(d,["tfdt"]).map(g=>{const y=g[0];let v=fe(g,4);return y===1&&(v*=Math.pow(2,32),v+=fe(g,8)),v/s})[0];return f!==void 0&&(n=f),Ae(d,["tfhd"]).map(g=>{const y=fe(g,4),v=fe(g,0)&16777215,T=(v&1)!==0,b=(v&2)!==0,E=(v&8)!==0;let _=0;const x=(v&16)!==0;let w=0;const R=(v&32)!==0;let C=8;y===r&&(T&&(C+=8),b&&(C+=4),E&&(_=fe(g,C),C+=4),x&&(w=fe(g,C),C+=4),R&&(C+=4),e.type==="video"&&(a=hx(e.codec)),Ae(d,["trun"]).map(k=>{const P=k[0],I=fe(k,0)&16777215,O=(I&1)!==0;let G=0;const j=(I&4)!==0,K=(I&256)!==0;let W=0;const U=(I&512)!==0;let V=0;const q=(I&1024)!==0,z=(I&2048)!==0;let F=0;const N=fe(k,4);let H=8;O&&(G=fe(k,H),H+=4),j&&(H+=4);let ne=G+c;for(let be=0;be<N;be++){if(K?(W=fe(k,H),H+=4):W=_,U?(V=fe(k,H),H+=4):V=w,q&&(H+=4),z&&(P===0?F=fe(k,H):F=t7(k,H),H+=4),e.type===Qe.VIDEO){let ue=0;for(;ue<V;){const ye=fe(i,ne);if(ne+=4,yz(a,i[ne])){const dt=i.subarray(ne,ne+ye);Qk(dt,a?2:1,n+F/s,t)}ne+=ye,ue+=ye+4}}n+=W/s}}))})})}),t}function hx(n){if(!n)return!1;const e=n.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function yz(n,e){if(n){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Qk(n,e,t,i){const s=r7(n);let r=0;r+=e;let a=0,o=0,l=0;for(;r<s.length;){a=0;do{if(r>=s.length)break;l=s[r++],a+=l}while(l===255);o=0;do{if(r>=s.length)break;l=s[r++],o+=l}while(l===255);const c=s.length-r;let h=r;if(o<c)r+=o;else if(o>c){qe.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(a===4){if(s[h++]===181){const f=e7(s,h);if(h+=2,f===49){const g=fe(s,h);if(h+=4,g===1195456820){const y=s[h++];if(y===3){const v=s[h++],T=31&v,b=64&v,E=b?2+T*3:0,_=new Uint8Array(E);if(b){_[0]=v;for(let x=1;x<E;x++)_[x]=s[h++]}i.push({type:y,payloadType:a,pts:t,bytes:_})}}}}}else if(a===5&&o>16){const d=[];for(let y=0;y<16;y++){const v=s[h++].toString(16);d.push(v.length==1?"0"+v:v),(y===3||y===5||y===7||y===9)&&d.push("-")}const f=o-16,g=new Uint8Array(f);for(let y=0;y<f;y++)g[y]=s[h++];i.push({payloadType:a,pts:t,uuid:d.join(""),userData:Ai(g),userDataBytes:g})}}}function r7(n){const e=n.byteLength,t=[];let i=1;for(;i<e-2;)n[i]===0&&n[i+1]===0&&n[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return n;const s=e-t.length,r=new Uint8Array(s);let a=0;for(i=0;i<s;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=n[a];return r}function vz(n){const e=n[0];let t="",i="",s=0,r=0,a=0,o=0,l=0,c=0;if(e===0){for(;bt(n.subarray(c,c+1))!=="\0";)t+=bt(n.subarray(c,c+1)),c+=1;for(t+=bt(n.subarray(c,c+1)),c+=1;bt(n.subarray(c,c+1))!=="\0";)i+=bt(n.subarray(c,c+1)),c+=1;i+=bt(n.subarray(c,c+1)),c+=1,s=fe(n,12),r=fe(n,16),o=fe(n,20),l=fe(n,24),c=28}else if(e===1){c+=4,s=fe(n,c),c+=4;const d=fe(n,c);c+=4;const f=fe(n,c);for(c+=4,a=2**32*d+f,zY(a)||(a=Number.MAX_SAFE_INTEGER,qe.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=fe(n,c),c+=4,l=fe(n,c),c+=4;bt(n.subarray(c,c+1))!=="\0";)t+=bt(n.subarray(c,c+1)),c+=1;for(t+=bt(n.subarray(c,c+1)),c+=1;bt(n.subarray(c,c+1))!=="\0";)i+=bt(n.subarray(c,c+1)),c+=1;i+=bt(n.subarray(c,c+1)),c+=1}const h=n.subarray(c,n.byteLength);return{schemeIdUri:t,value:i,timeScale:s,presentationTime:a,presentationTimeDelta:r,eventDuration:o,id:l,payload:h}}function Tz(n,...e){const t=e.length;let i=8,s=t;for(;s--;)i+=e[s].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(n,4),s=0,i=8;s<t;s++)r.set(e[s],i),i+=e[s].byteLength;return r}function bz(n,e,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");let i,s;i=0,s=new Uint8Array;let r;i>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),Tz([112,115,115,104],new Uint8Array([i,0,0,0]),n,r,s,a,t)}function Ez(n){const e=[];if(n instanceof ArrayBuffer){const t=n.byteLength;let i=0;for(;i+32<t;){const s=new DataView(n,i),r=Sz(s);e.push(r),i+=r.size}}return e}function Sz(n){const e=n.getUint32(0),t=n.byteOffset,i=n.byteLength;if(i<e)return{offset:t,size:i};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};const r=n.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};const a=n.buffer,o=Bt(new Uint8Array(a,t+12,16));let l=null,c=null,h=0;if(r===0)h=28;else{const f=n.getUint32(28);if(!f||i<32+f*16)return{offset:t,size:e};l=[];for(let g=0;g<f;g++)l.push(new Uint8Array(a,t+32+g*16,16));h=32+f*16}if(!h)return{offset:t,size:e};const d=n.getUint32(h);return e-32<d?{offset:t,size:e}:(c=new Uint8Array(a,t+h+4,d),{version:r,systemId:o,kids:l,data:c,offset:t,size:e})}const a7=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ku={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Xk(n,e){const t=Ku[e];return!!t&&!!t[n.slice(0,4)]}function Uh(n,e,t=!0){return!n.split(",").some(i=>!Zk(i,e,t))}function Zk(n,e,t=!0){var i;const s=Jn(t);return(i=s==null?void 0:s.isTypeSupported(Vh(n,e)))!=null?i:!1}function Vh(n,e){return`${e}/mp4;codecs=${n}`}function UR(n){if(n){const e=n.substring(0,4);return Ku.video[e]}return 2}function py(n){const e=a7();return n.split(",").reduce((t,i)=>{const r=e&&hx(i)?9:Ku.video[i];return r?(r*2+t)/(t?3:2):(Ku.audio[i]+t)/(t?2:1)},0)}const qx={};function _z(n,e=!0){if(qx[n])return qx[n];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[n];for(let s=0;s<t.length;s++){var i;if(Zk(t[s],"audio",e))return qx[n]=t[s],t[s];if(t[s]==="mp3"&&(i=Jn(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return n}const Az=/flac|opus|mp4a\.40\.34/i;function my(n,e=!0){return n.replace(Az,t=>_z(t.toLowerCase(),e))}function xz(n,e){const t=[];if(n){const i=n.split(",");for(let s=0;s<i.length;s++)Xk(i[s],"video")||t.push(i[s])}return e&&t.push(e),t.join(",")}function Ng(n,e){if(n&&(n.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(n)!==-1)&&(VR(n,"audio")||VR(n,"video")))return n;if(e){const t=e.split(",");if(t.length>1){if(n){for(let i=t.length;i--;)if(t[i].substring(0,4)===n.substring(0,4))return t[i]}return t[0]}}return e||n}function VR(n,e){return Xk(n,e)&&Zk(n,e)}function Lz(n){const e=n.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function wz(n){if(n.startsWith("av01.")){const e=n.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return n}function HR(n){const e=Jn(n)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function sI(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Cz={supported:!0,powerEfficient:!0,smooth:!0},Iz={supported:!1,smooth:!1,powerEfficient:!1},o7={supported:!0,configurations:[],decodingInfoResults:[Cz]};function l7(n,e){return{supported:!1,configurations:e,decodingInfoResults:[Iz],error:n}}function kz(n,e,t,i,s,r){const a=n.videoCodec,o=n.audioCodec?n.audioGroups:null,l=r==null?void 0:r.audioCodec,c=r==null?void 0:r.channels,h=c?parseInt(c):l?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((f,g)=>{if(g){const y=e.groups[g];if(!y)throw new Error(`Audio track group ${g} not found`);Object.keys(y.channels).forEach(v=>{f[v]=(f[v]||0)+y.channels[v]})}return f},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(f=>hx(f))||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(i,30)||n.videoRange!=="SDR"&&n.videoRange!==t||n.bitrate>Math.max(s,8e6))||!!d&&X(h)&&Object.keys(d).some(f=>parseInt(f)>h)}function c7(n,e,t,i={}){const s=n.videoCodec;if(!s&&!n.audioCodec||!t)return Promise.resolve(o7);const r=[],a=Rz(n),o=a.length,l=Pz(n,e,o>0),c=l.length;for(let h=o||1*c||1;h--;){const d={type:"media-source"};if(o&&(d.video=a[h%o]),c){d.audio=l[h%c];const f=d.audio.bitrate;d.video&&f&&(d.video.bitrate-=f)}r.push(d)}if(s){const h=navigator.userAgent;if(s.split(",").some(d=>hx(d))&&a7())return Promise.resolve(l7(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${h})`),r))}return Promise.all(r.map(h=>{const d=Oz(h);return i[d]||(i[d]=t.decodingInfo(h))})).then(h=>({supported:!h.some(d=>!d.supported),configurations:r,decodingInfoResults:h})).catch(h=>({supported:!1,configurations:r,decodingInfoResults:[],error:h}))}function Rz(n){var e;const t=(e=n.videoCodec)==null?void 0:e.split(","),i=u7(n),s=n.width||640,r=n.height||480,a=n.frameRate||30,o=n.videoRange.toLowerCase();return t?t.map(l=>{const c={contentType:Vh(wz(l),"video"),width:s,height:r,bitrate:i,framerate:a};return o!=="sdr"&&(c.transferFunction=o),c}):[]}function Pz(n,e,t){var i;const s=(i=n.audioCodec)==null?void 0:i.split(","),r=u7(n);return s&&n.audioGroups?n.audioGroups.reduce((a,o)=>{var l;const c=o?(l=e.groups[o])==null?void 0:l.tracks:null;return c?c.reduce((h,d)=>{if(d.groupId===o){const f=parseFloat(d.channels||"");s.forEach(g=>{const y={contentType:Vh(g,"audio"),bitrate:t?Dz(g,r):r};f&&(y.channels=""+f),h.push(y)})}return h},a):a},[]):[]}function Dz(n,e){if(e<=1)return 1;let t=128e3;return n==="ec-3"?t=768e3:n==="ac-3"&&(t=64e4),Math.min(e/2,t)}function u7(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function Oz(n){let e="";const{audio:t,video:i}=n;if(i){const s=sI(i.contentType);e+=`${s}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const s=sI(t.contentType);e+=`${i?"_":""}${s}_c${t.channels}`}return e}const nI=["NONE","TYPE-0","TYPE-1",null];function Mz(n){return nI.indexOf(n)>-1}const gy=["SDR","PQ","HLG"];function $z(n){return!!n&&gy.indexOf(n)>-1}var Ch={No:"",Yes:"YES",v2:"v2"};function qR(n){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=n,s=i<e/2;return e&&s?t?Ch.v2:Ch.Yes:Ch.No}class rI{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class ju{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return GR(this._audioGroups,e)}hasSubtitleGroup(e){return GR(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function GR(n,e){return!e||!n?!1:n.indexOf(e)!==-1}function Nz(){if(typeof matchMedia=="function"){const n=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(n.media!==e.media)return n.matches===!0}return!1}function Fz(n,e){let t=!1,i=[];if(n&&(t=n!=="SDR",i=[n]),e){i=e.allowedVideoRanges||gy.slice(0);const s=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:s&&Nz(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Bz=n=>{const e=new WeakSet;return(t,i)=>{if(n&&(i=n(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Xe=(n,e)=>JSON.stringify(n,Bz(e));function Uz(n,e,t,i,s){const r=Object.keys(n),a=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,l=s==null?void 0:s.videoCodec,c=a&&parseInt(a)===2;let h=!1,d=!1,f=1/0,g=1/0,y=1/0,v=1/0,T=0,b=[];const{preferHDR:E,allowedVideoRanges:_}=Fz(e,s);for(let k=r.length;k--;){const P=n[r[k]];h||(h=P.channels[2]>0),f=Math.min(f,P.minHeight),g=Math.min(g,P.minFramerate),y=Math.min(y,P.minBitrate),_.filter(O=>P.videoRanges[O]>0).length>0&&(d=!0)}f=X(f)?f:0,g=X(g)?g:0;const x=Math.max(1080,f),w=Math.max(30,g);y=X(y)?y:t,t=Math.max(y,t),d||(e=void 0);const R=r.length>1;return{codecSet:r.reduce((k,P)=>{const I=n[P];if(P===k)return k;if(b=d?_.filter(O=>I.videoRanges[O]>0):[],R){if(I.minBitrate>t)return ys(P,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),k;if(!I.hasDefaultAudio)return ys(P,"no renditions with default or auto-select sound found"),k;if(o&&P.indexOf(o.substring(0,4))%5!==0)return ys(P,`audio codec preference "${o}" not found`),k;if(a&&!c){if(!I.channels[a])return ys(P,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),k}else if((!o||c)&&h&&I.channels[2]===0)return ys(P,"no renditions with stereo sound found"),k;if(I.minHeight>x)return ys(P,`min resolution of ${I.minHeight} > maximum of ${x}`),k;if(I.minFramerate>w)return ys(P,`min framerate of ${I.minFramerate} > maximum of ${w}`),k;if(!b.some(O=>I.videoRanges[O]>0))return ys(P,`no variants with VIDEO-RANGE of ${Xe(b)} found`),k;if(l&&P.indexOf(l.substring(0,4))%5!==0)return ys(P,`video codec preference "${l}" not found`),k;if(I.maxScore<T)return ys(P,`max score of ${I.maxScore} < selected max of ${T}`),k}return k&&(py(P)>=py(k)||I.fragmentError>n[k].fragmentError)?k:(v=I.minIndex,T=I.maxScore,P)},void 0),videoRanges:b,preferHDR:E,minFramerate:g,minBitrate:y,minIndex:v}}function ys(n,e){qe.log(`[abr] start candidates with "${n}" ignored because ${e}`)}function h7(n){return n.reduce((e,t)=>
vendor: 3,298 bytes, line 43
43{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Vz(n,e,t,i){return n.slice(t,i+1).reduce((s,r,a)=>{if(!r.codecSet)return s;const o=r.audioGroups;let l=s[r.codecSet];l||(s[r.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,r.bitrate);const c=Math.min(r.height,r.width);return l.minHeight=Math.min(l.minHeight,c),l.minFramerate=Math.min(l.minFramerate,r.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,r.score),l.fragmentError+=r.fragmentError,l.videoRanges[r.videoRange]=(l.videoRanges[r.videoRange]||0)+1,o&&o.forEach(h=>{if(!h)return;const d=e.groups[h];d&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(f=>{l.channels[f]=(l.channels[f]||0)+d.channels[f]}))}),s},{})}function KR(n){if(!n)return n;const{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:r}=n;return{lang:e,assocLang:t,characteristics:i,channels:s,audioCodec:r}}function Ws(n,e,t){if("attrs"in n){const i=e.indexOf(n);if(i!==-1)return i}for(let i=0;i<e.length;i++){const s=e[i];if(al(n,s,t))return i}return-1}function al(n,e,t){const{groupId:i,name:s,lang:r,assocLang:a,default:o}=n,l=n.forced;return(i===void 0||e.groupId===i)&&(s===void 0||e.name===s)&&(r===void 0||Hz(r,e.lang))&&(r===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in n)||qz(n.characteristics||"",e.characteristics))&&(t===void 0||t(n,e))}function Hz(n,e="--"){return n.length===e.length?n===e:n.startsWith(e)||e.startsWith(n)}function qz(n,e=""){const t=n.split(","),i=e.split(",");return t.length===i.length&&!t.some(s=>i.indexOf(s)===-1)}function Ua(n,e){const{audioCodec:t,channels:i}=n;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function Gz(n,e,t,i,s){const r=e[i],o=e.reduce((f,g,y)=>{const v=g.uri;return(f[v]||(f[v]=[])).push(y),f},{})[r.uri];o.length>1&&(i=Math.max.apply(Math,o));const l=r.videoRange,c=r.frameRate,h=r.codecSet.substring(0,4),d=jR(e,i,f=>{if(f.videoRange!==l||f.frameRate!==c||f.codecSet.substring(0,4)!==h)return!1;const g=f.audioGroups,y=t.filter(v=>!g||g.indexOf(v.groupId)!==-1);return Ws(n,y,s)>-1});return d>-1?d:jR(e,i,f=>{const g=f.audioGroups,y=t.filter(v=>!g||g.indexOf(v.groupId)!==-1);return Ws(n,y,s)>-1})}function jR(n,e,t){for(let i=e;i>-1;i--)if(t(n[i]))return i;for(let i=e+1;i<n.length;i++)if(t(n[i]))return i;return-1}function yy(n,e){var t;return!!n&&n!==((t=e.loadLevelObj)==null?void 0:t.uri)}class d7 extends Bi{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
vendor: 4,848 bytes, lines 43-53
43decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:s,partCurrent:r,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!s||!l)return;const c=performance.now(),h=r?r.stats:s.stats,d=r?r.duration:s.duration,f=c-h.loading.start,g=a.minAutoLevel,y=s.level,v=this._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||y<=g){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const T=v>-1&&v!==y,b=!!t||T;if(!b&&(l.paused||!l.playbackRate||!l.readyState))return;const E=a.mainForwardBufferInfo;if(!b&&E===null)return;const _=this.bwEstimator.getEstimateTTFB(),x=Math.abs(l.playbackRate);if(f<=Math.max(_,1e3*(d/(x*2))))return;const w=E?E.len/x:0,R=h.loading.first?h.loading.first-h.loading.start:-1,C=h.loaded&&R>-1,k=this.getBwEstimate(),P=a.levels,I=P[y],O=Math.max(h.loaded,Math.round(d*(s.bitrate||I.averageBitrate)/8));let G=C?f-R:f;G<1&&C&&(G=Math.min(f,h.loaded*8/k));const j=C?h.loaded*1e3/G:0,K=_/1e3,W=j?(O-h.loaded)/j:O*8/k+K;if(W<=w)return;const U=j?j*8:k,V=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,q=this.hls.config.abrBandWidthUpFactor;let z=Number.POSITIVE_INFINITY,F;for(F=y-1;F>g;F--){const be=P[F].maxBitrate,ue=!P[F].details||V;if(z=this.getTimeToLoadFrag(K,U,d*be,ue),z<Math.min(w,d+K))break}if(z>=W||z>d*10)return;C?this.bwEstimator.sample(f-Math.min(_,R),h.loaded):this.bwEstimator.sampleTTFB(f);const N=P[F].maxBitrate;this.getBwEstimate()*q>N&&this.resetEstimator(N);const H=this.findBestLevel(N,g,F,0,w,1,1);H>-1&&(F=H),this.warn(`Fragment ${s.sn}${r?" part "+r.index:""} of level ${y} is loading too slowly;
44      Fragment duration: ${s.duration.toFixed(3)}
45      Time to underbuffer: ${w.toFixed(3)} s
46      Estimated load time for current fragment: ${W.toFixed(3)} s
47      Estimated load time for down switch fragment: ${z.toFixed(3)} s
48      TTFB estimate: ${R|0} ms
49      Current BW estimate: ${X(k)?k|0:"Unknown"} bps
50      New BW estimate: ${this.getBwEstimate()|0} bps
51      Switching to level ${F} @ ${N|0} bps`),a.nextLoadLevel=a.nextAutoLevel=F,this.clearTimer();const ne=()=>{if(this.clearTimer(),this.fragCurrent===s&&this.hls.loadLevel===F&&F>0){const be=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${F>0?"and switching down":""}
52      Fragment duration: ${s.duration.toFixed(3)} s
53      Time to underbuffer: ${be.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,F>g){let ue=this.findBestLevel(this.hls.levels[g].bitrate,g,F,0,be,1,1);ue===-1&&(ue=g),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ue,this.resetEstimator(this.hls.levels[ue].bitrate)}}};T||W>z*2?ne():this.timer=self.setInterval(ne,z*1e3),a.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:r,stats:h})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new XY(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(S.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;
vendor: 3,234 bytes, line 53
53if(!this.ignoreFragment(i)){if(!i.bitrateTest){var s;this.fragCurrent=i,this.partCurrent=(s=t.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:s,partCurrent:r}=this;if(i&&s&&i.sn===s.sn&&i.level===s.level){const a=performance.now(),o=r?r.stats:i.stats,l=a-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(d,c),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,i,s){const r=e+i/t,a=s?e+this.lastLevelLoadSec:0;return r+a}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.first;X(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===Z.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=i?i.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+s.loaded,l=(a.loaded?a.loaded.duration:0)+r;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const r={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(S.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=s!=null&&s.stats.loaded?s.stats:i.stats;if(r.aborted||this.ignoreFragment(i))return;const a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Z.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=i&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,r)&&a[e].loadError<=a[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}
53_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:s,config:r,minAutoLevel:a}=i,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay();let h=r.abrBandWidthFactor,d=r.abrBandWidthUpFactor;if(c){const T=this.findBestLevel(l,a,s,c,0,h,d);if(T>=0)return this.rebufferNotice=-1,T}let f=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!c){const T=this.bitrateTestDelay;T&&(f=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-T,this.info(`bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*f)} ms`),h=d=1)}const g=this.findBestLevel(l,a,s,c,f,h,d);if(this.rebufferNotice!==g&&(this.rebufferNotice=g,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${g}`)),g>-1)return g;const y=i.levels[a],v=i.loadLevelObj;return v&&(y==null?void 0:y.bitrate)<v.bitrate?a:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,a,o){var l;const c=s+r,h=this.lastLoadedFragLevel,d=h===-1?this.hls.firstLevel:h,{fragCurrent:f,partCurrent:g}=this,{levels:y,allAudioTracks:v,loadLevel:T,config:b}=this.hls;if(y.length===1)return 0;const E=y[d],_=!!((l=this.hls.latestLevelDetails)!=null&&l.live),x=T===-1||h===-1;let w,R="SDR",C=(E==null?void 0:E.frameRate)||0;const{audioPreference:k,videoPreference:P}=b,I=this.audioTracksByGroup||(this.audioTracksByGroup=h7(v));let O=-1;if(x){if(this.firstSelection!==-1)return this.firstSelection;const U=this.codecTiers||(this.codecTiers=Vz(y,I,t,i)),V=Uz(U,R,e,k,P),{codecSet:q,videoRanges:z,minFramerate:F,minBitrate:N,minIndex:H,preferHDR:ne}=V;O=H,w=q,R=ne?z[z.length-1]:z[0],C=F,e=Math.max(e,N),this.log(`picked start tier ${Xe(V)}`)}else w=E==null?void 0:E.codecSet,R=E==null?void 0:E.videoRange;const G=g?g.duration:f?f.duration:0,j=this.bwEstimator.getEstimateTTFB()/1e3,K=[];for(let U=i;U>=t;U--){var W;const V=y[U],q=U>d;if(!V)continue;if(b.useMediaCapabilities&&!V.supportedResult&&!V.supportedPromise){const ue=navigator.mediaCapabilities;typeof(ue==null?void 0:ue.decodingInfo)=="function"&&kz(V,I,R,C,e,k)?(V.supportedPromise=c7(V,I,ue,this.supportedCache),V.supportedPromise.then(ye=>{if(!this.hls)return;V.supportedResult=ye;const dt=this.hls.levels,ot=dt.indexOf(V);ye.error?this.warn(`MediaCapabilities decodingInfo error: "${ye.error}" for level ${ot} ${Xe(ye)}`):ye.supported?ye.decodingInfoResults.some(ft=>ft.smooth===!1||ft.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${ot} not smooth or powerEfficient: ${Xe(ye)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${ot} ${Xe(ye)}`),ot>-1&&dt.length>1&&(this.log(`Removing unsupported level ${ot}`),this.hls.removeLevel(ot),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(ye=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${ye}`)})):V.supportedResult=o7}if((w&&V.codecSet!==w||R&&V.videoRange!==R||q&&C>V.frameRate||!q&&C>0&&C<V.frameRate||(W=V.supportedResult)!=null&&(W=W.decodingInfoResults)!=null&&W.some(ue=>ue.smooth===!1))&&(!x||U!==O)){K.push(U);continue}const z=V.details,F=(g?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||G;let N;q?N=o*e:N=a*e;const H=G&&s>=G*2&&r===0?V.averageBitrate:V.maxBitrate,ne=this.getTimeToLoadFrag(j,N,H*F,z===void 0);if(N>=H&&(U===h||V.loadError===0&&V.fragmentError===0)&&(ne<=j||!X(ne)||_&&!this.bitrateTestDelay||ne<c)){const ue=this.forcedAutoLevel;return U!==T&&(ue===-1||ue!==T)&&(K.length&&this.trace(`Skipped level(s) ${K.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${y[K[0]].codecs}" ${y[K[0]].videoRange}; not compatible with "${w}" ${R}`),this.info(`switch candidate:${d}->${U} adjustedbw(${Math.round(N)})-bitrate=${Math.round(N-H)} ttfb:${j.toFixed(1)} avgDuration:${F.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${ne.toFixed(1)}
53 firstSelection:${x} codecSet:${V.codecSet} videoRange:${V.videoRange} hls.loadLevel:${T}`)),x&&(this.firstSelection=U),U}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const f7={search:function(n,e){let t=0,i=n.length-1,s=null,r=null;for(;t<=i;){s=(t+i)/2|0,r=n[s];const a=e(r);if(a>0)t=s+1;else if(a<0)i=s-1;else return r}return null}};function Kz(n,e,t){if(e===null||!Array.isArray(n)||!n.length||!X(e))return null;const i=n[0].programDateTime;if(e<(i||0))return null;const s=n[n.length-1].endProgramDateTime;if(e>=(s||0))return null;for(let r=0;r<n.length;++r){const a=n[r];if(Wz(e,t,a))return a}return null}function pl(n,e,t=0,i=0,s=.005){let r=null;if(n){r=e[1+n.sn-e[0].sn]||null;const o=n.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),r&&n.level!==r.level&&r.end<=n.end&&(r=e[2+n.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!n||n.level===r.level)&&WR(t,i,r)===0||jz(r,n,Math.min(s,i))))return r;const a=f7.search(e,WR.bind(null,t,i));return a&&(a!==n||!r)?a:r}function jz(n,e,t){if(e&&e.start===0&&e.level<n.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((s,r)=>(r[0]==="INF"&&(s+=parseFloat(r[1])),s),t);return n.start<=i}return!1}function WR(n=0,e=0,t){if(t.start<=n&&t.start+t.duration>n)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=n?1:t.start-i>n&&t.start?-1:0}function Wz(n,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>n}function p7(n,e,t){if(n&&n.startCC<=e&&n.endCC>=e){let i=n.fragments;const{fragmentHint:s}=n;s&&(i=i.concat(s));let r;return f7.search(i,a=>a.cc<e?1:a.cc>e?-1:(r=a,a.end<=t?1:a.start>t?-1:0)),r||null}return null}function vy(n){switch(n.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function m7(n){return n.details.startsWith("key")}function g7(n){return m7(n)&&!!n.frag&&!n.frag.decryptdata}function YR(n,e){const t=vy(e);return n.default[`${t?"timeout":"error"}Retry`]}function Jk(n,e){const t=n.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function zR(n){return He(He({},n),{errorRetry:null,timeoutRetry:null})}function Ty(n,e,t,i){if(!n)return!1;const s=i==null?void 0:i.code,r=e<n.maxNumRetry&&(Yz(s)||!!t);return n.shouldRetry?n.shouldRetry(n,e,t,i,r):r}function Yz(n){return aI(n)||!!n&&(n<400||n>499)}function aI(n){return n===0&&navigator.onLine===!1}var Et={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},ci={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class y7 extends Bi{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(S.ERROR,this.onError,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(S.ERROR,this.onError,this),e.off(S.ERROR,this.onErrorOut,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Z.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const s=e.audioGroups;if(s)return this.hls.allAudioTracks.filter(a=>s.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const s=this.hls,r=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.
vendor: 4,736 bytes, line 53
53KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Vl();return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Et.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var a;const l=t.parent===Z.MAIN?t.level:s.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(r==null?void 0:r.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){const l=s.loadLevelObj;if(l&&(r.type===xe.AUDIO_TRACK&&l.hasAudioGroup(r.groupId)||r.type===xe.SUBTITLE_TRACK&&l.hasSubtitleGroup(r.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=Et.SendAlternateToPenaltyBox,t.errorAction.flags=ci.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Et.SendAlternateToPenaltyBox,flags:ci.MoveAllAlternatesMatchingHDCP};return;case $.KEY_SYSTEM_SESSION_UPDATE_FAILED:case $.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case $.KEY_SYSTEM_NO_SESSION:t.errorAction={action:Et.SendAlternateToPenaltyBox,flags:ci.MoveAllAlternatesMatchingKey};return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:s.loadLevel)}return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction=Vl();return}t.type===ee.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Vl())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,s=YR(i.config.playlistLoadPolicy,e),r=this.playlistError++;if(Ty(s,r,vy(e),e.response))return{action:Et.RetryRequest,flags:ci.None,retryConfig:s,retryCount:r};const o=this.getLevelSwitchAction(e,t);return s&&(o.retryConfig=s,o.retryCount=r),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,o=YR(m7(e)?a:r,e),l=t.levels.reduce((h,d)=>h+d.fragmentError,0);if(s&&(e.details!==$.FRAG_GAP&&s.fragmentError++,!g7(e)&&Ty(o,l,vy(e),e.response)))return{action:Et.RetryRequest,flags:ci.None,retryConfig:o,retryCount:l};const c=this.getLevelSwitchAction(e,i);return o&&(c.retryConfig=o,c.retryCount=l),c}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,a;const c=e.details;s.loadError++,c===$.BUFFER_APPEND_ERROR&&s.fragmentError++;let h=-1;const{levels:d,loadLevel:f,minAutoLevel:g,maxAutoLevel:y}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const v=(r=e.frag)==null?void 0:r.type,b=(v===Z.AUDIO&&c===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:R})=>s.audioCodec!==R),_=e.sourceBufferName==="video"&&(c===$.BUFFER_ADD_CODEC_ERROR||c===$.BUFFER_APPEND_ERROR)&&d.some(({codecSet:R,audioCodec:C})=>s.codecSet!==R&&s.audioCodec===C),{type:x,groupId:w}=(a=e.context)!=null?a:{};for(let R=d.length;R--;){const C=(R+f)%d.length;if(C!==f&&C>=g&&C<=y&&d[C].loadError===0){var o,l;const k=d[C];if(c===$.FRAG_GAP&&v===Z.MAIN&&e.frag){const P=d[C].details;if(P){const I=pl(e.frag,P.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(x===xe.AUDIO_TRACK&&k.hasAudioGroup(w)||x===xe.SUBTITLE_TRACK&&k.hasSubtitleGroup(w))continue;if(v===Z.AUDIO&&(o=s.audioGroups)!=null&&o.some(P=>k.hasAudioGroup(P))||v===Z.SUBTITLE&&(l=s.subtitleGroups)!=null&&l.some(P=>k.hasSubtitleGroup(P))||b&&s.audioCodec===k.audioCodec||_&&s.codecSet===k.codecSet||!b&&s.codecSet!==k.codecSet)continue}h=C;break}}if(h>-1&&i.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:Et.SendAlternateToPenaltyBox,flags:ci.None,nextAutoLevel:h}}return{action:Et.SendAlternateToPenaltyBox,flags:ci.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Et.DoNothing:break;case Et.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}
53" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case Et.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s}=i,r=i.nextAutoLevel;switch(s){case ci.None:this.switchLevel(e,r);break;case ci.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),c=t.levels[l],h=c==null?void 0:c.attrs["HDCP-LEVEL"];if(i.hdcpLevel=h,h==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(h){t.maxHdcpLevel=nI[nI.indexOf(h)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case ci.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const c=this.hls.levels,h=c.length;for(let f=h;f--;)if(this.variantHasKey(c[f],l)){var a,o;this.log(`Banned key found in level ${f} (${c[f].bitrate}bps) or audio group "${(a=c[f].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${Bt(l.keyId||[])}`),c[f].fragmentError++,c[f].loadError++,this.log(`Removing level ${f} with key error (${e.error})`),this.hls.removeLevel(f)}const d=e.frag;if(this.hls.levels.length<h)i.resolved=!0;else if(d&&d.type!==Z.MAIN){const f=d.decryptdata;f&&!l.matches(f)&&(i.resolved=!0)}}break}}i.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=sI(e.mimeType),s=this.hls.levels;for(let r=s.length;r--;)s[r][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${r} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(r))}}}function Vl(n){const e={action:Et.DoNothing,flags:ci.None};return n&&(e.resolved=!0),e}var St={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class zz{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let s=i.length;s--;){const r=i[s];if(!r)break;if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:s}=this,r=Object.keys(s);for(let a=r.length;a--;){const o=s[r[a]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const l=o.body;if(l.start<=e&&e<=l.end)return l}}return null}detectEvictedFragments(e,t,i,s,r){this.timeRanges&&(this.timeRanges[e]=t);const a=(s==null?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l||a>=l.body.sn)return;if(!l.buffered&&(!l.loaded||r)){l.body.type===i&&this.removeFragment(l.body);return}const c=l.range[e];if(c){if(c.time.length===0){this.removeFragment(l.body);return}c.time.some(h=>{const d=!this.isTimeBuffered(h.startPTS,h.endPTS,t);return d&&this.removeFragment(l.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,s=wl(i),r=this.fragments[s];if(!r||r.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(o=>{const l=i.elementaryStreams[o];if(!l)return;
vendor: 5,318 bytes, line 53
53const c=t[o],h=a||l.partial===!0;r.range[o]=this.getBufferedTimes(i,e.part,h,c)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,i),jm(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=QR(i,s=>s.fragment.sn>=e))}fragBuffered(e,t){const i=wl(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,this.bufferedEnd(s,e))}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},a=e.start,o=e.end,l=e.minEndPTS||o,c=e.maxStartPTS||a;for(let h=0;h<s.length;h++){const d=s.start(h)-this.bufferPadding,f=s.end(h)+this.bufferPadding;if(c>=d&&l<=f){r.time.push({startPTS:Math.max(a,s.start(h)),endPTS:Math.min(o,s.end(h))});break}else if(a<f&&o>d){const g=Math.max(a,s.start(h)),y=Math.min(o,s.end(h));y>g&&(r.partial=!0,r.time.push({startPTS:g,endPTS:y}))}else if(o<=d)break}return r}getPartialFragment(e){let t=null,i,s,r,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(c=>{const h=l[c];h&&jm(h)&&(s=h.body.start-o,r=h.body.end+o,e>=s&&e<=r&&(i=Math.min(e-s,r-e),a<=i&&(t=h.body,a=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||jm(t))}getState(e){const t=wl(e),i=this.fragments[t];return i?i.buffered?jm(i)?St.PARTIAL:St.OK:St.APPENDING:St.NOT_LOADED}isTimeBuffered(e,t,i){let s,r;for(let a=0;a<i.length;a++){if(s=i.start(a)-this.bufferPadding,r=i.end(a)+this.bufferPadding,e>=s&&t<=r)return!0;if(t<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,s=t.part?null:t,r=wl(i);this.fragments[r]={body:i,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r,type:a}=t;if(i.sn==="initSegment")return;const o=i.type;if(s){let c=this.activePartLists[o];c||(this.activePartLists[o]=c=[]),c.push(s)}this.timeRanges=r;const l=r[a];this.detectEvictedFragments(a,l,o,s)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=wl(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let s=i.length;s--;){const r=t[i[s]];if((r==null?void 0:r.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==i||s&&!l.gap||l.start<t&&l.end>e&&(o.buffered||r)&&this.removeFragment(l)})}removeFragment(e){const t=wl(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const s=e.sn;this.activePartLists[e.type]=QR(i,r=>r.fragment.sn!==s)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function jm(n){var e,t,i;return n.buffered&&!!(n.body.gap||(e=n.range.video)!=null&&e.partial||(t=n.range.audio)!=null&&t.partial||(i=n.range.audiovideo)!=null&&i.partial)}function wl(n){return`${n.type}_${n.level}_${n.sn}`}function QR(n,e){return n.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Ta={cbc:0,ctr:1};class Qz{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Ta.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Ta.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Xz(n){const e=n.byteLength,t=e&&new DataView(n.buffer).getUint8(e-1);return t?n.slice(0,e-t):n}class Zz{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let s=0;s<4;s++)i[s]=t.getUint32(s*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],a=i[2],o=i[3],l=this.invSubMix,c=l[0],h=l[1],d=l[2],f=l[3],g=new Uint32Array(256);let y=0,v=0,T=0;for(T=0;T<256;T++)T<128?g[T]=T<<1:g[T]=T<<1^283;for(T=0;T<256;T++){let b=v^v<<1^v<<2^v<<3^v<<4;b=b>>>8^b&255^99,e[y]=b,t[b]=y;const E=g[y],_=g[E],x=g[_];let w=g[b]*257^b*16843008;s[y]=w<<24|w>>>8,r[y]=w<<16|w>>>16,a[y]=w<<8|w>>>24,o[y]=w,w=x*16843009^_*65537^E*257^y*16843008,c[b]=w<<24|w>>>8,h[b]=w<<16|w>>>16,d[b]=w<<8|w>>>24,f[b]=w,y?(y=E^g[g[g[x^E]]],v^=g[g[v]]):y=v=1}}
vendor: 1,397 bytes, line 53
53expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s<t.length&&i;)i=t[s]===this.key[s],s++;if(i)return;this.key=t;const r=this.keySize=t.length;if(r!==4&&r!==6&&r!==8)throw new Error("Invalid aes key size="+r);const a=this.ksRows=(r+6+1)*4;let o,l;const c=this.keySchedule=new Uint32Array(a),h=this.invKeySchedule=new Uint32Array(a),d=this.sBox,f=this.rcon,g=this.invSubMix,y=g[0],v=g[1],T=g[2],b=g[3];let E,_;for(o=0;o<a;o++){if(o<r){E=c[o]=t[o];continue}_=E,o%r===0?(_=_<<8|_>>>24,_=d[_>>>24]<<24|d[_>>>16&255]<<16|d[_>>>8&255]<<8|d[_&255],_^=f[o/r|0]<<24):r>6&&o%r===4&&(_=d[_>>>24]<<24|d[_>>>16&255]<<16|d[_>>>8&255]<<8|d[_&255]),c[o]=E=(c[o-r]^_)>>>0}for(l=0;l<a;l++)o=a-l,l&3?_=c[o]:_=c[o-4],l<4||o<=4?h[l]=_:h[l]=y[d[_>>>24]]^v[d[_>>>16&255]]^T[d[_>>>8&255]]^b[d[_&255]],h[l]=h[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const s=this.keySize+6,r=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],c=o[1],h=o[2],d=o[3],f=this.uint8ArrayToUint32Array_(i);let g=f[0],y=f[1],v=f[2],T=f[3];const b=new Int32Array(e),E=new Int32Array(b.length);let _,x,w,R,C,k,P,I,O,G,j,K,W,U;const V=this.networkToHostOrderSwap;for(;t<b.length;){for(O=V(b[t]),G=V(b[t+1]),j=V(b[t+2]),K=V(b[t+3]),C=O^r[0],k=K^r[1],P=j^r[2],I=G^r[3],W=4,U=1;U<s;U++)_=l[C>>>24]^c[k>>16&255]^h[P>>8&255]^d[I&255]^r[W],x=l[k>>>24]^c[P>>16&255]^h[I>>
vendor: 16,801 bytes, line 53
538&255]^d[C&255]^r[W+1],w=l[P>>>24]^c[I>>16&255]^h[C>>8&255]^d[k&255]^r[W+2],R=l[I>>>24]^c[C>>16&255]^h[k>>8&255]^d[P&255]^r[W+3],C=_,k=x,P=w,I=R,W=W+4;_=a[C>>>24]<<24^a[k>>16&255]<<16^a[P>>8&255]<<8^a[I&255]^r[W],x=a[k>>>24]<<24^a[P>>16&255]<<16^a[I>>8&255]<<8^a[C&255]^r[W+1],w=a[P>>>24]<<24^a[I>>16&255]<<16^a[C>>8&255]<<8^a[k&255]^r[W+2],R=a[I>>>24]<<24^a[C>>16&255]<<16^a[k>>8&255]<<8^a[P&255]^r[W+3],E[t]=V(_^g),E[t+1]=V(R^y),E[t+2]=V(w^v),E[t+3]=V(x^T),g=O,y=G,v=j,T=K,t=t+4}return E.buffer}}class Jz{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=eQ(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function eQ(n){switch(n){case Ta.cbc:return"AES-CBC";case Ta.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${n}`)}}const tQ=16;class e3{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Xz(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,s){return this.useSoftware?new Promise((r,a)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,s);const l=this.flush();l?r(l.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,s)}softwareDecrypt(e,t,i,s){const{currentIV:r,currentResult:a,remainderData:o}=this;if(s!==Ta.cbc||t.byteLength!==16)return qe.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ni(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;r&&(i=r);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new Zz),c.expandKey(t);const h=a;return this.currentResult=c.decrypt(l.buffer,0,i),this.currentIV=l.slice(-16).buffer,h||null}webCryptoDecrypt(e,t,i,s){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,s));this.key=t,this.fastAesKey=new Jz(this.subtle,t,s)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Qz(this.subtle,new Uint8Array(i),s).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(qe.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i,s)))}onWebCryptoError(e,t,i,s){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,s);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%tQ;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(qe.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const XR=Math.pow(2,17);class iQ{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new cn({type:ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,r=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(y=>y[0]==="GAP")){l(JR(e));return}else e.gap=!1;const c=this.loader=r?new r(s):new a(s),h=ZR(e);e.loader=c;const d=zR(s.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:XR};e.stats=c.stats;const g={onSuccess:(y,v,T,b)=>{this.resetLoader(e,c);let E=y.data;T.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(E.slice(0,16)),E=E.slice(16)),o({frag:e,part:null,payload:E,networkDetails:b})},onError:(y,v,T,b)=>{this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:He({url:i,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:T,stats:b}))},onAbort:(y,v,T)=>{this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:T,stats:y}))},onTimeout:(y,v,T)=>{this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:T,stats:y}))}};t&&(g.onProgress=(y,v,T,b)=>t({frag:e,part:null,payload:T,networkDetails:b})),c.load(h,f,g)})}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(JR(e,t));return}const c=this.loader=r?new r(s):new a(s),h=ZR(e,t);e.loader=c;const d=zR(s.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:XR};t.stats=c.stats,c.load(h,f,{onSuccess:(g,y,v,T)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const b={frag:e,part:t,payload:g.data,networkDetails:T};i(b),o(b)},onError:(g,y,v,T)=>{this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:He({url:h.url,data:void 0},g),error:new Error(`HTTP Error ${g.code} ${g.text}`),networkDetails:v,stats:T}))},onAbort:(g,y,v)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:v,stats:g}))},onTimeout:(g,y,v)=>{this.resetLoader(e,c),l(new cn({type:ee.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${f.timeout}ms`),networkDetails:v,stats:g}))}})})}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const l=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/r),l),d=(l-c)*Math.round(i.loaded/c);i.total=i.loaded+d}else i.total=Math.max(i.loaded,i.total);const a=i.loading,o=s.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function ZR(n,e=null){const t=e||n,i={frag:n,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},s=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(X(s)&&X(r)){var a;let o=s,l=r;if(n.sn==="initSegment"&&sQ((a=n.decryptdata)==null?void 0:a.method)){const c=r-s;c%16&&(l=r+(16-c%16)),s!==0&&(i.resetIV=!0,o=s-16)}i.rangeStart=o,i.rangeEnd=l}return i}function JR(n,e){const t=new Error(`GAP ${n.gap?"tag":"attribute"} found`),i={type:ee.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:n,error:t,networkDetails:null};return e&&(i.part=e),(e||n).stats.aborted=!0,new cn(i)}function sQ(n){return n==="AES-128"||n==="AES-256"}class cn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class v7 extends Bi{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class dx{constructor(e,t,i,s=0,r=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Wm(),this.buffering={audio:Wm(),video:Wm(),audiovideo:Wm()},this.level=e,this.sn=t,this.id=i,this.size=s,this.part=r,this.partial=a}}function Wm(){return{start:0,executeStart:0,executeEnd:0,end:0}}const eP={length:0,start:()=>0,end:()=>0};class me{static isBuffered(e,t){if(e){const i=me.getBuffered(e);for(let s=i.length;s--;)if(t>=i.start(s)&&t<=i.end(s))return!0}return!1}static bufferedRanges(e){if(e){const t=me.getBuffered(e);return me.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const s=me.bufferedRanges(e);if(s.length)return me.bufferedInfo(s,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((h,d)=>h.start-d.start||d.end-h.end);let s=-1,r=[];if(i)for(let h=0;h<e.length;h++){t>=e[h].start&&t<=e[h].end&&(s=h);const d=r.length;if(d){const f=r[d-1].end;e[h].start-f<i?e[h].end>f&&(r[d-1].end=e[h].end):r.push(e[h])}else r.push(e[h])}else r=e;let a=0,o,l=t,c=t;for(let h=0;h<r.length;h++){const d=r[h].start,f=r[h].end;if(s===-1&&t>=d&&t<=f&&(s=h),t+i>=d&&t<f)l=d,c=f,a=c-t;else if(t+i<d){o=d;break}}return{len:a,start:l||0,end:c||0,nextStart:o,buffered:e,bufferedIndex:s}}static getBuffered(e){try{return e.buffered||eP}catch(t){return qe.log("failed to get media.buffered",t),eP}}}const T7=/\{\$([a-zA-Z0-9-_]+)\}/g;function tP(n){return T7.test(n)}function oI(n,e){if(n.variableList!==null||n.hasVariableRefs){const t=n.variableList;return e.replace(T7,i=>{const s=i.substring(2,i.length-1),r=t==null?void 0:t[s];return r===void 0?(n.playlistParsingError||(n.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),i):r})}return e}function iP(n,e,t){let i=n.variableList;i||(n.variableList=i={});let s,r;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(s))r=a.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${t}"`)}catch(a){n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,r=e.VALUE;s in i?n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):i[s]=r||""}function nQ(n,e,t){const i=e.IMPORT;if(t&&i in t){let s=n.variableList;s||(n.variableList=s={}),s[i]=t[i]}else n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const rQ=/^(\d+)x(\d+)$/,sP=/(.+?)=(".*?"|.*?)(?:,|$)/g;class st{constructor(e,t){typeof e=="string"&&(e=st.parseAttrList(e,t)),We(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let s=0;s<t.length/2;s++)i[s]=parseInt(t.slice(s*2,s*2+2),16);return i}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((s,r)=>(s[r.toLowerCase()]=!0,s),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=rQ.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const s={},r='"';for(sP.lastIndex=0;(i=sP.exec(e))!==null;){const a=i[1].trim();let o=i[2];const l=o.indexOf(r)===0&&o.lastIndexOf(r)===o.length-1;let c=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(t&&(l||c))o=oI(t,o);else if(!c&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":qe.warn(`${e}: attribute ${a} is missing quotes`)}s[a]=o}return s}}const aQ="com.apple.hls.interstitial";function oQ(n){return n!=="ID"&&n!=="CLASS"&&n!=="CUE"&&n!=="START-DATE"&&n!=="DURATION"&&n!=="END-DATE"&&n!=="END-ON-NEXT"}function lQ(n){return n==="SCTE35-OUT"||n==="SCTE35-IN"||n==="SCTE35-CMD"}class t3{constructor(e,t,i=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(s=t==null?void 0:t.tagOrder)!=null?s:i,t){const r=t.attr;for(const a in r)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==r[a]){qe.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=We(new st({}),r,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);X(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(qe.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(X(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===aQ}get isValid(){return!!this.id&&!this._badValueForSameId&&X(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const cQ=10;class b7{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 4,535 bytes, line 53
53StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?X(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||cQ}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function by(n,e){return n.length===e.length?!n.some((t,i)=>t!==e[i]):!1}function nP(n,e){return!n&&!e?!0:!n||!e?!1:by(n,e)}function Hl(n){return n==="AES-128"||n==="AES-256"||n==="AES-256-CTR"}function i3(n){switch(n){case"AES-128":case"AES-256":return Ta.cbc;case"AES-256-CTR":return Ta.ctr;default:throw new Error(`invalid full segment method ${n}`)}}function s3(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function lI(n){return Uint8Array.from(unescape(encodeURIComponent(n)),e=>e.charCodeAt(0))}function uQ(n){const e=lI(n).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function E7(n){const e=function(i,s,r){const a=i[s];i[s]=i[r],i[r]=a};e(n,0,3),e(n,1,2),e(n,4,5),e(n,6,7)}function S7(n){const e=n.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),s=i[i.length-1].split(",");if(s.length===2){const r=s[0]==="base64",a=s[1];r?(i.splice(-1,1),t=s3(a)):t=uQ(a)}}return t}const Ey=typeof self<"u"?self:void 0;var nt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Fg(n){switch(n){case Rt.FAIRPLAY:return nt.FAIRPLAY;case Rt.PLAYREADY:return nt.PLAYREADY;case Rt.WIDEVINE:return nt.WIDEVINE;case Rt.CLEARKEY:return nt.CLEARKEY}}function Gx(n){switch(n){case nt.FAIRPLAY:return Rt.FAIRPLAY;case nt.PLAYREADY:return Rt.PLAYREADY;case nt.WIDEVINE:return Rt.WIDEVINE;case nt.CLEARKEY:return Rt.CLEARKEY}}function Th(n){const{drmSystems:e,widevineLicenseUrl:t}=n,i=e?[nt.FAIRPLAY,nt.WIDEVINE,nt.PLAYREADY,nt.CLEARKEY].filter(s=>!!e[s]):[];return!i[nt.WIDEVINE]&&t&&i.push(nt.WIDEVINE),i}const n3=function(n){return Ey!=null&&(n=Ey.navigator)!=null&&n.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function hQ(n,e,t,i){let s;switch(n){case nt.FAIRPLAY:s=["cenc","sinf"];break;case nt.WIDEVINE:case nt.PLAYREADY:s=["cenc"];break;case nt.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${n}`)}return dQ(s,e,t,i)}function dQ(n,e,t,i){return[{initDataTypes:n,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs=${r}
53`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs=${r}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function fQ(n){var e;return!!n&&(n.sessionType==="persistent-license"||!!((e=n.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function _7(n){const e=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=s3(o).subarray(0,16);return E7(l),l}}return null}let Cl={};class Xn{static clearKeyUriToKeyIdMap(){Cl={}}static setKeyIdForUri(e,t){Cl[e]=t}static addKeyIdForUri(e){const t=Object.keys(Cl).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),Cl[e]=i,i}constructor(e,t,i,s=[1],r=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=s,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Hl(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(Q8(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&by(e.keyFormatVersions,this.keyFormatVersions)&&nP(e.iv,this.iv)&&nP(e.keyId,this.keyId)}isSupported(){if(this.method){if(Hl(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Rt.FAIRPLAY:case Rt.WIDEVINE:case Rt.PLAYREADY:case Rt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Hl(this.method)){let r=this.iv;return r||(typeof e!="number"&&(qe.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),r=mQ(e)),new Xn(this.method,this.uri,"identity",this.keyFormatVersions,r)}if(this.keyId){const r=Cl[this.uri];if(r&&!by(this.keyId,r)&&Xn.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=S7(this.uri);if(i)switch(this.keyFormat){case Rt.WIDEVINE:if(this.pssh=i,!this.keyId){const r=Ez(i.buffer);if(r.length){var s;const a=r[0];this.keyId=(s=a.kids)!=null&&s.length?a.kids[0]:null}}this.keyId||(this.keyId=rP(t));break;case Rt.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=bz(r,null,i),this.keyId=_7(i);break}default:{let r=i.subarray(0,16);if(r.length!==16){const a=new Uint8Array(16);a.set(r,16-r.length),r=a}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r;r=pQ(t),r||(r=rP(t),r||(r=Cl[this.uri])),r&&(this.keyId=r,Xn.setKeyIdForUri(this.uri,r))}return this}}function pQ(n){const e=n==null?void 0:n[Rt.WIDEVINE];return e?e.keyId:null}function rP(n){const e=n==null?void 0:n[Rt.PLAYREADY];if(e){const t=S7(e.uri);if(t)return _7(t)}return null}function mQ(n){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=n>>8*(15-t)&255;return e}const aP=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,oP=/#EXT-X-MEDIA:(.*)/g,gQ=/^#EXT(?:INF|-X-TARGETDURATION):/m,Kx=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),yQ=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class cs{static findGroup(e,t){for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}}static resolve(e,t){return Yk.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return gQ.test(e)}static parseMasterPlaylist(e,t){const i=tP(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},r=[];if(aP.lastIndex=0,!e.startsWith("#EXTM3U"))return s.playlistParsingError=new Error("no EXTM3U delimiter"),s;let a;for(;(a=aP.exec(e))!=null;)if(a[1]){var o;const c=new st(a[1],s),h=oI(s,a[2]),d={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:cs.resolve(h,t)},f=c.decimalResolution("RESOLUTION");f&&(d.width=f.width,d.height=f.height),uP(c.CODECS,d);const g=c["SUPPLEMENTAL-CODECS"];g&&(d.supplemental={},uP(g,d.supplemental)),(o=d.unknownCodecs)!=null&&o.length||r.push(d),s.levels.push(d)}else if(a[3]){const c=a[3],h=a[4];switch(c){case"SESSION-DATA":{const d=new st(h,s),f=d["DATA-ID"];f&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[f]=d);break}case"SESSION-KEY":{const d=lP(h,t,s);d.encrypted&&d.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(d)):qe.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const d=new st(h,s);iP(s,d,t)}break}case"CONTENT-STEERING":{const d=new st(h,s);s.contentSteering={uri:cs.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=cP(h);break}}}const l=r.length>0&&r.length<s.levels.length;return s.levels=l?r:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,i){let s;const r={},a=i.levels,o={AUDIO:a.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:a.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(oP.lastIndex=0;(s=oP.exec(e))!==null;){const c=new st(s[1],i),h=c.TYPE;if(h){const d=o[h],f=r[h]||[];r[h]=f;
vendor: 51,799 bytes, lines 53-58
53const g=c.LANGUAGE,y=c["ASSOC-LANGUAGE"],v=c.CHANNELS,T=c.CHARACTERISTICS,b=c["INSTREAM-ID"],E={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||g||"",type:h,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:g,url:c.URI?cs.resolve(c.URI,t):""};if(y&&(E.assocLang=y),v&&(E.channels=v),T&&(E.characteristics=T),b&&(E.instreamId=b),d!=null&&d.length){const _=cs.findGroup(d,E.groupId)||d[0];hP(E,_,"audioCodec"),hP(E,_,"textCodec")}f.push(E)}}return r}static parseLevelPlaylist(e,t,i,s,r,a){var o;const l={url:t},c=new b7(t),h=c.fragments,d=[];let f=null,g=0,y=0,v=0,T=0,b=0,E=null,_=new $g(s,l),x,w,R,C=-1,k=!1,P=null,I;if(Kx.lastIndex=0,c.m3u8=e,c.hasVariableRefs=tP(e),((o=Kx.exec(e))==null?void 0:o[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(x=Kx.exec(e))!==null;){k&&(k=!1,_=new $g(s,l),_.playlistOffset=v,_.setStart(v),_.sn=g,_.cc=T,b&&(_.bitrate=b),_.level=i,f&&(_.initSegment=f,f.rawProgramDateTime&&(_.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),P&&(_.setByteRange(P),P=null)));const K=x[1];if(K){_.duration=parseFloat(K);const W=(" "+x[2]).slice(1);_.title=W||null,_.tagList.push(W?["INF",K,W]:["INF",K])}else if(x[3]){if(X(_.duration)){_.playlistOffset=v,_.setStart(v),R&&fP(_,R,c),_.sn=g,_.level=i,_.cc=T,h.push(_);const W=(" "+x[3]).slice(1);_.relurl=oI(c,W),cI(_,E,d),E=_,v+=_.duration,g++,y=0,k=!0}}else{if(x=x[0].match(yQ),!x){qe.warn("No matches on slow regex match for level playlist!");continue}for(w=1;w<x.length&&x[w]===void 0;w++);const W=(" "+x[w]).slice(1),U=(" "+x[w+1]).slice(1),V=x[w+2]?(" "+x[w+2]).slice(1):null;switch(W){case"BYTERANGE":E?_.setByteRange(U,E):_.setByteRange(U);break;case"PROGRAM-DATE-TIME":_.rawProgramDateTime=U,_.tagList.push(["PROGRAM-DATE-TIME",U]),C===-1&&(C=h.length);break;case"PLAYLIST-TYPE":c.type&&an(c,W,x),c.type=U.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?an(c,W,x):h.length>0&&pP(c,W,x),g=c.startSN=parseInt(U);break;case"SKIP":{c.skippedSegments&&an(c,W,x);const q=new st(U,c),z=q.decimalInteger("SKIPPED-SEGMENTS");if(X(z)){c.skippedSegments+=z;for(let N=z;N--;)h.push(null);g+=z}const F=q.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(F.split("	")));break}case"TARGETDURATION":c.targetduration!==0&&an(c,W,x),c.targetduration=Math.max(parseInt(U),1);break;case"VERSION":c.version!==null&&an(c,W,x),c.version=parseInt(U);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||an(c,W,x),c.live=!1;break;case"#":(U||V)&&_.tagList.push(V?[U,V]:[U]);break;case"DISCONTINUITY":T++,_.tagList.push(["DIS"]);break;case"GAP":_.gap=!0,_.tagList.push([W]);break;case"BITRATE":_.tagList.push([W,U]),b=parseInt(U)*1e3,X(b)?_.bitrate=b:b=0;break;case"DATERANGE":{const q=new st(U,c),z=new t3(q,c.dateRanges[q.ID],c.dateRangeTagCount);c.dateRangeTagCount++,z.isValid||c.skippedSegments?c.dateRanges[z.id]=z:qe.warn(`Ignoring invalid DATERANGE tag: "${U}"`),_.tagList.push(["EXT-X-DATERANGE",U]);break}case"DEFINE":{{const q=new st(U,c);"IMPORT"in q?nQ(c,q,a):iP(c,q,t)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?an(c,W,x):h.length>0&&pP(c,W,x),c.startCC=T=parseInt(U);break;case"KEY":{const q=lP(U,t,c);if(q.isSupported()){if(q.method==="NONE"){R=void 0;break}R||(R={});const z=R[q.keyFormat];z!=null&&z.matches(q)||(z&&(R=We({},R)),R[q.keyFormat]=q)}else qe.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${U}"`);break}case"START":c.startTimeOffset=cP(U);break;case"MAP":{const q=new st(U,c);if(_.duration){const z=new $g(s,l);dP(z,q,i,R),f=z,_.initSegment=f,f.rawProgramDateTime&&!_.rawProgramDateTime&&(_.rawProgramDateTime=f.rawProgramDateTime)}else{const z=_.byteRangeEndOffset;if(z){const F=_.byteRangeStartOffset;P=`${z-F}@${F}`}else P=null;dP(_,q,i,R),f=_,k=!0}f.cc=T;break}case"SERVER-CONTROL":{I&&an(c,W,x),I=new st(U),c.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),c.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&an(c,W,x);const q=new st(U);c.partTarget=q.decimalFloatingPoint("PART-TARGET");break}case"PART":{let q=c.partList;q||(q=c.partList=[]);const z=y>0?q[q.length-1]:void 0,F=y++,N=new st(U,c),H=new X8(N,_,l,F,z);q.push(H),_.duration+=H.duration;break}case"PRELOAD-HINT":{const q=new st(U,c);c.preloadHint=q;break}case"RENDITION-REPORT":{const q=new st(U,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(q);break}default:qe.warn(`line parsed but not handled: ${x}`);break}}}E&&!E.relurl?(h.pop(),v-=E.duration,c.partList&&(c.fragmentHint=E)):c.partList&&(cI(_,E,d),_.cc=T,c.fragmentHint=_,R&&fP(_,R,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));const O=h.length,G=h[0],j=h[O-1];if(v+=c.skippedSegments*c.targetduration,v>0&&O&&j){c.averagetargetduration=v/O;const K=j.sn;c.endSN=K!=="initSegment"?K:0,c.live||(j.endList=!0),C>0&&(TQ(h,C),G&&d.unshift(G))}return c.fragmentHint&&(v+=c.fragmentHint.duration),c.totalduration=v,d.length&&c.dateRangeTagCount&&G&&A7(d,c),c.endCC=T,c}}function A7(n,e){let t=n.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];n.push(o),t++}else return;const i=n[t-1],s=e.live?1/0:e.totalduration,r=Object.keys(e.dateRanges);for(let o=r.length;o--;){const l=e.dateRanges[r[o]],c=l.startDate.getTime();l.tagAnchor=i.ref;for(let h=t;h--;){var a;if(((a=n[h])==null?void 0:a.sn)<e.startSN)break;const d=vQ(e,c,n,h,s);if(d!==-1){l.tagAnchor=e.fragments[d].ref;break}}}}function vQ(n,e,t,i,s){const r=t[i];if(r){const o=r.programDateTime;if(e>=o||i===0){var a;const l=(((a=t[i+1])==null?void 0:a.start)||s)-r.start;if(e<=o+l*1e3){const c=t[i].sn-n.startSN;if(c<0)return-1;const h=n.fragments;if(h.length>t.length){const f=(t[i+1]||h[h.length-1]).sn-n.startSN;for(let g=f;g>c;g--){const y=h[g].programDateTime;if(e>=y&&e<y+h[g].duration*1e3)return g}}return c}}}return-1}function lP(n,e,t){var i,s;const r=new st(n,t),a=(i=r.METHOD)!=null?i:"",o=r.URI,l=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,h=(s=r.KEYFORMAT)!=null?s:"identity";o&&r.IV&&!l&&qe.error(`Invalid IV: ${r.IV}`);const d=o?cs.resolve(o,e):"",f=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Xn(a,d,h,f,l,r.KEYID)}function cP(n){const t=new st(n).decimalFloatingPoint("TIME-OFFSET");return X(t)?t:null}function uP(n,e){let t=(n||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const s=t.filter(r=>Xk(r,i));s.length&&(e[`${i}Codec`]=s.map(r=>r.split("/")[0]).join(","),t=t.filter(r=>s.indexOf(r)===-1))}),e.unknownCodecs=t}function hP(n,e,t){const i=e[t];i&&(n[t]=i)}function TQ(n,e){let t=n[e];for(let i=e;i--;){const s=n[i];if(!s)return;s.programDateTime=t.programDateTime-s.duration*1e3,t=s}}function cI(n,e,t){n.rawProgramDateTime?t.push(n):e!=null&&e.programDateTime&&(n.programDateTime=e.endProgramDateTime)}function dP(n,e,t,i){n.relurl=e.URI,e.BYTERANGE&&n.setByteRange(e.BYTERANGE),n.level=t,n.sn="initSegment",i&&(n.levelkeys=i),n.initSegment=null}function fP(n,e,t){n.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&i.push(n)}function an(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function pP(n,e,t){n.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function jx(n,e){const t=e.startPTS;if(X(t)){let i=0,s;e.sn>n.sn?(i=t-n.start,s=n):(i=n.start-t,s=e),s.duration!==i&&s.setDuration(i)}else e.sn>n.sn?n.cc===e.cc&&n.minEndPTS?e.setStart(n.start+(n.minEndPTS-n.start)):e.setStart(n.start+n.duration):e.setStart(Math.max(n.start-e.duration,0))}function x7(n,e,t,i,s,r,a){i-t<=0&&(a.warn("Fragment should have a positive duration",e),i=t+e.duration,r=s+e.duration);let l=t,c=i;const h=e.startPTS,d=e.endPTS;if(X(h)){const b=Math.abs(h-t);n&&b>n.totalduration?a.warn(`media timestamps and playlist times differ by ${b}s for level ${e.level} ${n.url}`):X(e.deltaPTS)?e.deltaPTS=Math.max(b,e.deltaPTS):e.deltaPTS=b,l=Math.max(t,h),t=Math.min(t,h),s=e.startDTS!==void 0?Math.min(s,e.startDTS):s,c=Math.min(i,d),i=Math.max(i,d),r=e.endDTS!==void 0?Math.max(r,e.endDTS):r}const f=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=s,e.endPTS=i,e.minEndPTS=c,e.endDTS=r;const g=e.sn;if(!n||g<n.startSN||g>n.endSN)return 0;let y;const v=g-n.startSN,T=n.fragments;for(T[v]=e,y=v;y>0;y--)jx(T[y],T[y-1]);for(y=v;y<T.length-1;y++)jx(T[y],T[y+1]);return n.fragmentHint&&jx(T[T.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,f}function bQ(n,e,t){if(n===e)return;let i=null;const s=n.fragments;for(let h=s.length-1;h>=0;h--){const d=s[h].initSegment;if(d){i=d;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;let r;_Q(n,e,(h,d,f,g)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==h.cc){const y=h.cc-d.cc;for(let v=f;v<g.length;v++)g[v].cc+=y;e.endCC=g[g.length-1].cc}X(h.startPTS)&&X(h.endPTS)&&(d.setStart(d.startPTS=h.startPTS),d.startDTS=h.startDTS,d.maxStartPTS=h.maxStartPTS,d.endPTS=h.endPTS,d.endDTS=h.endDTS,d.minEndPTS=h.minEndPTS,d.setDuration(h.endPTS-h.startPTS),d.duration&&(r=d),e.PTSKnown=e.alignedSliding=!0),h.hasStreams&&(d.elementaryStreams=h.elementaryStreams),d.loader=h.loader,h.hasStats&&(d.stats=h.stats),h.initSegment&&(d.initSegment=h.initSegment,i=h.initSegment)});const a=e.fragments,o=e.fragmentHint?a.concat(e.fragmentHint):a;if(i&&o.forEach(h=>{var d;h&&(!h.initSegment||h.initSegment.relurl===((d=i)==null?void 0:d.relurl))&&(h.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(h=>!h),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let h=e.skippedSegments;h--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=EQ(n.dateRanges,e,t));const h=n.fragments.filter(d=>d.rawProgramDateTime);if(n.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<o.length;d++)o[d].programDateTime===null&&cI(o[d],o[d-1],h);A7(h,e)}e.endCC=a[a.length-1].cc}if(!e.startCC){var l;const h=C7(n,e.startSN-1);e.startCC=(l=h==null?void 0:h.cc)!=null?l:a[0].cc}SQ(n.partList,e.partList,(h,d)=>{d.elementaryStreams=h.elementaryStreams,d.stats=h.stats}),r?x7(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,t):L7(n,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=n.driftStartTime,e.driftStart=n.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const h=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=h),e.driftEndTime=c,e.driftEnd=h}else e.driftEndTime=n.driftEndTime,e.driftEnd=n.driftEnd,e.advancedDateTime=n.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=n.requestScheduled)}function EQ(n,e,t){const{dateRanges:i,recentlyRemovedDateranges:s}=e,r=We({},n);s&&s.forEach(l=>{delete r[l]});const o=Object.keys(r).length;return o?(Object.keys(i).forEach(l=>{const c=r[l],h=new t3(i[l].attr,c);h.isValid?(r[l]=h,c||(h.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Xe(i[l].attr)}"`)}),r):i}function SQ(n,e,t){if(n&&e){let i=0;for(let s=0,r=n.length;s<=r;s++){const a=n[s],o=e[s+i];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):i--}}}function _Q(n,e,t){const i=e.skippedSegments,s=Math.max(n.startSN,e.startSN)-e.startSN,r=(n.fragmentHint?1:0)+(i?e.endSN:Math.min(n.endSN,e.endSN))-e.startSN,a=e.startSN-n.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments;for(let c=s;c<=r;c++){const h=l[a+c];let d=o[c];if(i&&!d&&h&&(d=e.fragments[c]=h),h&&d){t(h,d,c,o);const f=h.relurl,g=d.relurl;if(f&&AQ(f,g)){e.playlistParsingError=mP(`media sequence mismatch ${d.sn}:`,n,e,h,d);return}else if(h.cc!==d.cc){e.playlistParsingError=mP(`discontinuity sequence mismatch (${h.cc}!=${d.cc})`,n,e,h,d);return}}}}function mP(n,e,t,i,s){return new Error(`${n} ${s.url}
54Playlist starting @${e.startSN}
55${e.m3u8}
56
57Playlist starting @${t.startSN}
58${t.m3u8}`)}function L7(n,e,t=!0){const i=e.startSN+e.skippedSegments-n.startSN,s=n.fragments,r=i>=0;let a=0;if(r&&i<s.length)a=s[i].start;else if(r&&e.startSN===n.endSN+1)a=n.fragmentEnd;else if(r&&t)a=n.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)a=n.fragmentStart;else return;uI(e,a)}function uI(n,e){if(e){const t=n.fragments;for(let i=n.skippedSegments;i<t.length;i++)t[i].addStart(e);n.fragmentHint&&n.fragmentHint.addStart(e)}}function w7(n,e=1/0){let t=1e3*n.targetduration;if(n.updated){const i=n.fragments,s=4;if(i.length&&t*s>e){const r=i[i.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function C7(n,e,t){if(!n)return null;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e)?i:e<n.startSN&&t&&t.sn===e?t:null}function gP(n,e,t){return n?I7(n.partList,e,t):null}function I7(n,e,t){if(n)for(let i=n.length;i--;){const s=n[i];if(s.index===t&&s.fragment.sn===e)return s}return null}function k7(n){n.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(s=>{s.level=t,s.initSegment&&(s.initSegment.level=t)})})}function AQ(n,e){return n!==e&&e?yP(n)!==yP(e):!1}function yP(n){return n.replace(/\?[^?]*$/,"")}function Ih(n,e){for(let i=0,s=n.length;i<s;i++){var t;if(((t=n[i])==null?void 0:t.cc)===e)return n[i]}return null}function xQ(n,e){return!!(n&&e.startCC<n.endCC&&e.endCC>n.startCC)}function vP(n,e){const t=n.start+e;n.startPTS=t,n.setStart(t),n.endPTS=t+n.duration}function R7(n,e){const t=e.fragments;for(let i=0,s=t.length;i<s;i++)vP(t[i],n);e.fragmentHint&&vP(e.fragmentHint,n),e.alignedSliding=!0}function LQ(n,e){n&&(P7(e,n),e.alignedSliding||Sy(e,n),!e.alignedSliding&&!e.skippedSegments&&L7(n,e,!1))}function P7(n,e){if(!xQ(e,n))return;const t=Math.min(e.endCC,n.endCC),i=Ih(e.fragments,t),s=Ih(n.fragments,t);if(!i||!s)return;qe.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const r=i.start-s.start;R7(r,n)}function Sy(n,e){if(!n.hasProgramDateTime||!e.hasProgramDateTime)return;const t=n.fragments,i=e.fragments;if(!t.length||!i.length)return;let s,r;const a=Math.min(e.endCC,n.endCC);e.startCC<a&&n.startCC<a&&(s=Ih(i,a),r=Ih(t,a)),(!s||!r)&&(s=i[Math.floor(i.length/2)],r=Ih(t,s.cc)||t[Math.floor(t.length/2)]);const o=s.programDateTime,l=r.programDateTime;if(!o||!l)return;const c=(l-o)/1e3-(r.start-s.start);R7(c,n)}function Jt(n,e,t){hi(n,e,t),n.addEventListener(e,t)}function hi(n,e,t){n.removeEventListener(e,t)}const wQ={toString:function(n){let e="";const t=n.length;for(let i=0;i<t;i++)e+=`[${n.start(i).toFixed(3)}-${n.end(i).toFixed(3)}]`;return e}},B={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class fx extends v7{constructor(e,t,i,s,r){super(s,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=B.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:a,fragCurrent:o,media:l,mediaBuffer:c,state:h}=this,d=l?l.currentTime:0,f=me.bufferInfo(c||l,d,a.maxBufferHole),g=!f.len;if(this.log(`Media seeking to ${X(d)?d.toFixed(3):d}, state: ${h}, ${g?"out of":"in"} buffer`),this.state===B.ENDED)this.resetLoadingState();else if(o){const y=a.maxFragLookUpTolerance,v=o.start-y,T=o.start+o.duration+y;if(g||T<f.start||v>f.end){const b=d>T;(d<v||b)&&(b&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(l){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const y=this.lastCurrentTime;if(d>y&&(this.lastCurrentTime=d),!this.loadingParts){const v=Math.max(f.end,d),T=this.shouldLoadParts(this.getLevelDetails(),v);T&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${v.toFixed(2)}`),this.loadingParts=T)}}this.hls.hasEnoughToStart||(this.log(`Setting ${g?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,g&&(this.startPosition=d)),g&&this.state===B.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=e,this.fragmentLoader=new iQ(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new e3(e.config)}registerListeners(){const{hls:e}=this;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===B.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=B.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,s=this.config.timelineOffset||0;if(i<=s)return!1;const r=e.buffered;this.config.maxBufferHole&&r&&r.length>1&&(e=me.bufferedInfo(r,e.start,0));const a=e.nextStart;if(a&&a>s&&a<t.edge||this.media.currentTime<e.start)return!1;const l=t.partList;if(l!=null&&l.length){const h=l[l.length-1];return me.isBuffered(this.media,h.start+h.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;Jt(i,"seeking",this.onMediaSeeking),Jt(i,"ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===B.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),hi(s,"seeking",this.onMediaSeeking),hi(s,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=B.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const s=r=>{const a=r.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${r.part?" part: "+r.part.index:""} of ${this.fragInfo(a,!1,r.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,i,s).then(r=>{if(!r)return;const a=this.state,o=r.frag;if(this.fragContextChanged(o)){(a===B.FRAG_LOADING||!this.fragCurrent&&a===B.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=B.IDLE);return}"payload"in r&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(S.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===B.STOPPED||this.state===B.ERROR||(this.warn(`Frag error: ${(r==null?void 0:r.message)||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===St.APPENDING){const r=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,r),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===St.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(S.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:s}=this,{frag:r,payload:a}=i,o=r.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Hl(o.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,i3(o.method)).catch(c=>{throw s.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:r}),c}).then(c=>{const h=self.performance.now();return s.trigger(S.FRAG_DECRYPTED,{frag:r,payload:c,stats:{tstart:l,tdecrypt:h}}),i.payload=c,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===B.STOPPED||this.state===B.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state!==B.STOPPED&&(this.state=B.IDLE),e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var i,s;const r=e.tracks;if(r&&!t.encrypted&&((i=r.audio)!=null&&i.encrypted||(s=r.video)!=null&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(S.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?wQ.toString(me.getBuffered(i)):"(detached)"})`),pt(e)){var s;if(e.type!==Z.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=B.IDLE;return}}const r=(s=this.levels)==null?void 0:s[e.level];r!=null&&r.fragmentError&&(this.log(`Resetting level fragment error count of ${r.fragmentError} on frag buffered`),r.fragmentError=0)}this.state=B.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,a=!r||r.length===0||r.some(l=>!l),o=new dx(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=B.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(f=>{if(!this.fragContextChanged(f.frag))return this.hls.trigger(S.KEY_LOADED,f),this.state===B.KEY_LOADING&&(this.state=B.IDLE),f}),this.hls.trigger(S.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(pt(e)&&(!l||e.sn!==l.sn)){const f=this.shouldLoadParts(t.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${l==null?void 0:l.sn}->${e.sn}`),this.loadingParts=f)}if(i=Math.max(e.start,i||0),this.loadingParts&&pt(e)){const f=a.partList;if(f&&s){i>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const g=this.getNextPart(f,e,i);if(g>-1){const y=f[g];e=this.fragCurrent=y.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${y.index} (${g}/${f.length-1}) of ${this.fragInfo(e,!1,y)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=y.start+y.duration,this.state=B.FRAG_LOADING;let v;return o?v=o.then(T=>!T||this.fragContextChanged(T.frag)?null:this.doFragPartsLoad(e,y,t,s)).catch(T=>this.handleFragLoadError(T)):v=this.doFragPartsLoad(e,y,t,s).catch(T=>this.handleFragLoadError(T)),this.hls.trigger(S.FRAG_LOADING,{frag:e,part:y,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):v}else if(!e.url||this.loadedEndOfParts(f,i))return Promise.resolve(null)}}if(pt(e)&&this.loadingParts){var c;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(c=a.partList)==null?void 0:c.filter(f=>f.loaded).map(f=>`[${f.start}-${f.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),X(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=B.FRAG_LOADING;const h=this.config.progressive&&e.type!==Z.SUBTITLE;let d;return h&&o?d=o.then(f=>!f||this.fragContextChanged(f.frag)?null:this.fragmentLoader.load(e,s)).catch(f=>this.handleFragLoadError(f)):d=Promise.all([this.fragmentLoader.load(e,h?s:void 0),o]).then(([f])=>(!h&&s&&s(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(S.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,s){return new Promise((r,a)=>{var o;const l=[],c=(o=i.details)==null?void 0:o.partList,h=d=>{this.fragmentLoader.loadPart(e,d,s).then(f=>{l[d.index]=f;const g=f.part;this.hls.trigger(S.FRAG_LOADED,f);const y=gP(i.details,e.sn,d.index+1)||I7(c,e.sn,d.index+1);if(y)h(y);else return r({frag:e,part:g,partsLoaded:l})}).catch(a)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ee.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(S.ERROR,t)}else this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==B.PARSING){!this.fragCurrent&&this.state!==B.STOPPED&&this.state!==B.ERROR&&(this.state=B.IDLE);return}const{frag:i,part:s,level:r}=t,a=self.performance.now();i.stats.parsing.end=a,s&&(s.stats.parsing.end=a);const o=this.getLevelDetails(),c=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(i,s,r,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const r=e.partList[0];if(r.fragment.type===Z.SUBTITLE)return!1;const a=r.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=a){var s;if((this.hls.hasEnoughToStart?((s=this.media)==null?void 0:s.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:a}=e;if(!(t!=null&&t[s]))return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const o=t[s],l=o.details,c=a>-1?gP(l,r,a):null,h=c?c.fragment:C7(l,r,i);return h?(i&&i!==h&&(h.stats=i.stats),{frag:h,part:c,level:o}):null}bufferFragmentData(e,t,i,s,r){if(this.state!==B.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=Ni(a,o)),!l.length)return;const c=this.initPTS[t.cc],h=c?-c.baseTime/c.timescale:void 0,d={type:e.type,frag:t,part:i,chunkMeta:s,offset:h,parent:t.type,data:l};if(this.hls.trigger(S.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!me.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,s=me.bufferInfo(t,i,0),r=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),o=Math.max(Math.min(e.start-a,s.end-a),i+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const s=this.getLoadPosition();if(!X(s))return null;const a=this.lastCurrentTime>s||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,t,a)}getFwdBufferInfoAtPos(e,t,i,s){const r=me.bufferInfo(e,t,s);if(r.len===0&&r.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(r.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(r.nextStart,a.end)-t,s);return me.bufferInfo(e,t,o)}}return r}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,s=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-t*3,i.maxMaxBufferLength/2,s);return r>=s?(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=Z.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,a=i[0].start,o=r.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const d=r.initialLiveManifestSize;if(s<d)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a){var c;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),l=this.getInitialLiveFragment(t);const f=this.hls.startPosition,g=this.hls.liveSyncPosition,y=l?(f!==-1&&f>=a?f:g)||l.start:e;this.log(`Setting startPosition to ${y} to match start frag at live edge. mainStart: ${f} liveSyncPosition: ${g} frag.start: ${(c=l)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=y}}else e<=a&&(l=i[0]);if(!l){const d=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,d,t)}let h=this.filterReplacedPrimary(l,t);if(!h&&l){const d=l.sn-t.startSN;h=this.filterReplacedPrimary(i[d+1]||null,t)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===St.OK||i===St.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,s,r){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s,0);if(o!==null&&i.len+o.len>=r){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(TP(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(TP(this.config)&&e.type!==Z.SUBTITLE){const i=this.hls.interstitialsManager,s=i==null?void 0:i.bufferingItem;if(s){const a=s.event;if(a){if(a.appendInPlace||Math.abs(e.start-s.start)>1||s.start===0)return null}else if(e.end<=s.start&&(t==null?void 0:t.live)===!1||e.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||e.start-s.end>1))return null}const r=i==null?void 0:i.playerQueue;if(r)for(let a=r.length;a--;){const o=r[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let s=-1,r=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const c=e[o];if(a=a&&!c.independent,s>-1&&i<c.start)break;const h=c.loaded;h?s=-1:(r||(c.independent||a)&&c.fragment===t)&&(c.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${c.start}`),s=o),r=h}return s}loadedEndOfParts(e,t){let i;for(let s=e.length;s--;){if(i=e[s],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=Kz(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){const a=t[r-e.startSN];i.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=p7(e,i.cc,i.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(s=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:a,endSN:o}=i;const{fragmentHint:l}=i,{maxFragLookUpTolerance:c}=s,h=i.partList,d=!!(this.loadingParts&&h!=null&&h.length&&l);d&&!this.bitrateTest&&h[h.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let f;if(e<t){var g;const v=e<this.lastCurrentTime||e>t-c||(g=this.media)!=null&&g.paused||!this.startFragRequested?0:c;f=pl(r,a,e,v)}else f=a[a.length-1];if(f){const y=f.sn-i.startSN,v=this.fragmentTracker.getState(f);if((v===St.OK||v===St.PARTIAL&&f.gap)&&(r=f),r&&f.sn===r.sn&&(!d||h[0].fragment.sn>f.sn||!i.live)&&f.level===r.level){const b=a[y+1];f.sn<o&&this.fragmentTracker.getState(b)!==St.OK?f=b:f=null}}return f}alignPlaylists(e,t,i){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const r=e.fragmentStart,a=!t,o=e.alignedSliding&&X(r);if(a||!o&&!r){LQ(i,e);const l=e.fragmentStart;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${s}`),l}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);const s=this.timelineOffset;if(i===-1){const r=this.startTimeOffset!==null,a=r?this.startTimeOffset:e.startTimeOffset;a!==null&&X(a)?(i=t+a,a<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${a} found in ${r?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+s}this.nextLoadPosition=i+s}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&pt(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==B.FRAG_LOADING_WAITING_RETRY)&&(this.state=B.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const b=this.getCurrentContext(t.chunkMeta);b&&(t.frag=b.frag)}const s=t.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var r;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const a=t.details===$.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(s,!0);const o=t.errorAction;if(!o){this.state=B.ERROR;return}const{action:l,flags:c,retryCount:h=0,retryConfig:d}=o,f=!!d,g=f&&l===Et.RetryRequest,y=f&&!o.resolved&&c===ci.MoveAllAlternatesMatchingHost,v=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!g&&y&&pt(s)&&!s.endList&&v&&!g7(t))this.resetFragmentErrors(e),this.treatAsGap(s),o.resolved=!0;else if((g||y)&&h<d.maxNumRetry){var T;const b=aI((T=t.response)==null?void 0:T.code),E=Jk(d,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+E,this.state=B.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,b){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${t.details}, retrying loading ${h+1}/${d.maxNumRetry} in ${E}ms`)}else if(d)if(this.resetFragmentErrors(e),h<d.maxNumRetry)!a&&l!==Et.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${h})`);return}else l===Et.SendAlternateToPenaltyBox?this.state=B.WAITING_LEVEL:this.state=B.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!aI(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=B.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===B.PARSING||this.state===B.PARSED){const t=e.frag,i=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,i),r=s&&s.len>.5;r&&this.reduceMaxBufferLength(s.len,(t==null?void 0:t.duration)||10);const a=!r;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===Z.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==B.STOPPED&&(this.state=B.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const s=me.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===B.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==B.STOPPED&&(this.state=B.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){const r=i.details;if(!r){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,c)=>{const h=e.elementaryStreams[c];if(h){const d=h.endPTS-h.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${d})`),l||!1;const f=s?0:x7(r,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS,this);return this.hls.trigger(S.LEVEL_PTS_UPDATED,{details:r,level:i,drift:f,type:c,frag:e,start:h.startPTS,end:h.endPTS}),!0}return l},!1)){var o;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((i.fragmentError===0||l&&(i.fragmentError<2||e.endList))&&this.treatAsGap(e,i),l){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=B.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(S.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===Z.MAIN?"level":"track"}fragInfo(e,t=!0,i){var s,r;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((s=t&&!i?e.startPTS:(i||e).start)!=null?s:NaN).toFixed(3)}-${((r=t&&!i?e.endPTS:(i||e).end)!=null?r:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function TP(n){return!!n.interstitialsController&&n.enableInterstitialPlayback!==!1}class D7{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=CQ(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function CQ(n,e){const t=new Uint8Array(e);let i=0;for(let s=0;s<n.length;s++){const r=n[s];t.set(r,i),i+=r.length}return t}var Wx={exports:{}},bP;function IQ(){return bP||(bP=1,function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(l,c,h){this.fn=l,this.context=c,this.once=h||!1}function r(l,c,h,d,f){if(typeof h!="function")throw new TypeError("The listener must be a function");var g=new s(h,d||l,f),y=t?t+c:c;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],g]:l._events[y].push(g):(l._events[y]=g,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new i:delete l._events[c]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],h,d;if(this._eventsCount===0)return c;for(d in h=this._events)e.call(h,d)&&c.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},o.prototype.listeners=function(c){var h=t?t+c:c,d=this._events[h];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,g=d.length,y=new Array(g);f<g;f++)y[f]=d[f].fn;return y},o.prototype.listenerCount=function(c){var h=t?t+c:c,d=this._events[h];return d?d.fn?1:d.length:0},o.prototype.emit=function(c,h,d,f,g,y){var v=t?t+c:c;if(!this._events[v])return!1;var T=this._events[v],b=arguments.length,E,_;if(T.fn){switch(T.once&&this.removeListener(c,T.fn,void 0,!0),b){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,h),!0;case 3:return T.fn.call(T.context,h,d),!0;case 4:return T.fn.call(T.context,h,d,f),!0;case 5:return T.fn.call(T.context,h,d,f,g),!0;case 6:return T.fn.call(T.context,h,d,f,g,y),!0}for(_=1,E=new Array(b-1);_<b;_++)E[_-1]=arguments[_];T.fn.apply(T.context,E)}else{var x=T.length,w;for(_=0;_<x;_++)switch(T[_].once&&this.removeListener(c,T[_].fn,void 0,!0),b){case 1:T[_].fn.call(T[_].context);break;case 2:T[_].fn.call(T[_].context,h);break;case 3:T[_].fn.call(T[_].context,h,d);break;case 4:T[_].fn.call(T[_].context,h,d,f);break;default:if(!E)for(w=1,E=new Array(b-1);w<b;w++)E[w-1]=arguments[w];T[_].fn.apply(T[_].context,E)}}return!0},o.prototype.on=function(c,h,d){return r(this,c,h,d,!1)},o.prototype.once=function(c,h,d){return r(this,c,h,d,!0)},o.prototype.removeListener=function(c,h,d,f){var g=t?t+c:c;if(!this._events[g])return this;if(!h)return a(this,g),this;var y=this._events[g];if(y.fn)y.fn===h&&(!f||y.once)&&(!d||y.context===d)&&a(this,g);else{for(var v=0,T=[],b=y.length;v<b;v++)(y[v].fn!==h||f&&!y[v].once||d&&y[v].context!==d)&&T.push(y[v]);T.length?this._events[g]=T.length===1?T[0]:T:a(this,g)}return this},o.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&a(this,h)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,n.exports=o}(Wx)),Wx.exports}var kQ=IQ(),r3=rz(kQ);const Hh="1.6.15",Wu={};function RQ(){return typeof __HLS_WORKER_BUNDLE__=="function"}function PQ(){const n=Wu[Hh];if(n)return n.clientCount++,n;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),s={worker:new self.Worker(t),objectURL:t,clientCount:1};return Wu[Hh]=s,s}function DQ(n){const e=Wu[n];if(e)return e.clientCount++,e;const t=new self.URL(n,self.location.href).href,s={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Wu[n]=s,s}function OQ(n){const e=Wu[n||Hh];if(e&&e.clientCount--===1){const{worker:i,objectURL:s}=e;delete Wu[n||Hh],s&&self.URL.revokeObjectURL(s),i.terminate()}}function O7(n,e){return e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function a3(n,e){return e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128}function px(n,e){let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t}function qh(n,e){const t=e;let i=0;for(;a3(n,e);){i+=10;const s=px(n,e+6);i+=s,O7(n,e+10)&&(i+=10),e+=i}if(i>0)return n.subarray(t,t+i)}function MQ(n,e,t,i){const s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],r=e[t+2],a=r>>2&15;if(a>12){const g=new Error(`invalid ADTS sampling index:${a}`);n.emit(S.ERROR,S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:g,reason:g.message});return}const o=(r>>6&3)+1,l=e[t+3]>>6&3|(r&1)<<2,c="mp4a.40."+o,h=s[a];let d=a;(o===5||o===29)&&(d-=3);const f=[o<<3|(d&14)>>1,(d&1)<<7|l<<3];return qe.log(`manifest codec:${i}, parsed codec:${c}, channels:${l}, rate:${h} (ADTS object type:${o} sampling index:${a})`),{config:f,samplerate:h,channelCount:l,codec:c,parsedCodec:c,manifestCodec:i}}function M7(n,e){return n[e]===255&&(n[e+1]&246)===240}function $7(n,e){return n[e+1]&1?7:9}function o3(n,e){return(n[e+3]&3)<<11|n[e+4]<<3|(n[e+5]&224)>>>5}function $Q(n,e){return e+5<n.length}function _y(n,e){return e+1<n.length&&M7(n,e)}function NQ(n,e){return $Q(n,e)&&M7(n,e)&&o3(n,e)<=n.length-e}function FQ(n,e){if(_y(n,e)){const t=$7(n,e);if(e+t>=n.length)return!1;const i=o3(n,e);if(i<=t)return!1;const s=e+i;return s===n.length||_y(n,s)}return!1}function N7(n,e,t,i,s){if(!n.samplerate){const r=MQ(e,t,i,s);if(!r)return;We(n,r)}}function F7(n){return 1024*9e4/n}function BQ(n,e){const t=$7(n,e);if(e+t<=n.length){const i=o3(n,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function B7(n,e,t,i,s){const r=F7(n.samplerate),a=i+s*r,o=BQ(e,t);let l;if(o){const{frameLength:d,headerLength:f}=o,g=f+d,y=Math.max(0,t+g-e.length);y?(l=new Uint8Array(g-f),l.set(e.subarray(t+f,e.length),0)):l=e.subarray(t+f,t+g);const v={unit:l,pts:a};return y||n.samples.push(v),{sample:v,length:g,missing:y}}const c=e.length-t;return l=new Uint8Array(c),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:c,missing:-1}}function UQ(n,e){return a3(n,e)&&px(n,e+6)+10<=n.length-e}function VQ(n){return n instanceof ArrayBuffer?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function Yx(n,e=0,t=1/0){return HQ(n,e,t,Uint8Array)}function HQ(n,e,t,i){const s=qQ(n);let r=1;"BYTES_PER_ELEMENT"in i&&(r=i.BYTES_PER_ELEMENT);const a=GQ(n)?n.byteOffset:0,o=(a+n.byteLength)/r,l=(a+e)/r,c=Math.floor(Math.max(0,Math.min(l,o))),h=Math.floor(Math.min(c+Math.max(t,0),o));return new i(s,c,h-c)}function qQ(n){return n instanceof ArrayBuffer?n:n.buffer}function GQ(n){return n&&n.buffer instanceof ArrayBuffer&&n.byteLength!==void 0&&n.byteOffset!==void 0}function KQ(n){const e={key:n.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(n.size<2)return;if(n.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=n.data.subarray(1).indexOf(0);if(i===-1)return;const s=Ai(Yx(n.data,1,i)),r=n.data[2+i],a=n.data.subarray(3+i).indexOf(0);if(a===-1)return;const o=Ai(Yx(n.data,3+i,a));let l;return s==="-->"?l=Ai(Yx(n.data,4+i+a)):l=VQ(n.data.subarray(4+i+a)),e.mimeType=s,e.pictureType=r,e.description=o,e.data=l,e}function jQ(n){if(n.size<2)return;const e=Ai(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}}function WQ(n){if(n.size<2)return;if(n.type==="TXXX"){let t=1;const i=Ai(n.data.subarray(t),!0);t+=i.length+1;const s=Ai(n.data.subarray(t));return{key:n.type,info:i,data:s}}const e=Ai(n.data.subarray(1));return{key:n.type,info:"",data:e}}function YQ(n){if(n.type==="WXXX"){if(n.size<2)return;let t=1;const i=Ai(n.data.subarray(t),!0);t+=i.length+1;const s=Ai(n.data.subarray(t));return{key:n.type,info:i,data:s}}const e=Ai(n.data);return{key:n.type,info:"",data:e}}function zQ(n){return n.type==="PRIV"?jQ(n):n.type[0]==="W"?YQ(n):n.type==="APIC"?KQ(n):WQ(n)}function QQ(n){const e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=px(n,4),i=10;return{type:e,size:t,data:n.subarray(i,i+t)}}const Ym=10,XQ=10;function U7(n){let e=0;const t=[];for(;a3(n,e);){const i=px(n,e+6);n[e+5]>>6&1&&(e+=Ym),e+=Ym;
vendor: 8,370 bytes, line 58
58const s=e+i;for(;e+XQ<s;){const r=QQ(n.subarray(e)),a=zQ(r);a&&t.push(a),e+=r.size+Ym}O7(n,e)&&(e+=Ym)}return t}function V7(n){return n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp"}function ZQ(n){if(n.data.byteLength===8){const e=new Uint8Array(n.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}}function l3(n){const e=U7(n);for(let t=0;t<e.length;t++){const i=e[t];if(V7(i))return ZQ(i)}}let ui=function(n){return n.audioId3="org.id3",n.dateRange="com.apple.quicktime.HLS",n.emsg="https://aomedia.org/emsg/ID3",n.misbklv="urn:misb:KLV:bin:1910.1",n}({});function js(n="",e=9e4){return{type:n,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class c3{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=Ni(this.cachedData,e),this.cachedData=null);let i=qh(e,0),s=i?i.length:0,r;const a=this._audioTrack,o=this._id3Track,l=i?l3(i):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&X(l))&&(this.basePTS=JQ(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ui.audioId3,duration:Number.POSITIVE_INFINITY});s<c;){if(this.canParse(e,s)){const h=this.appendFrame(a,e,s);h?(this.frameIndex++,this.lastPTS=h.sample.pts,s+=h.length,r=s):s=c}else UQ(e,s)?(i=qh(e,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ui.audioId3,duration:Number.POSITIVE_INFINITY}),s+=i.length,r=s):s++;if(s===c&&r!==c){const h=e.slice(r);this.cachedData?this.cachedData=Ni(this.cachedData,h):this.cachedData=h}}return{audioTrack:a,videoTrack:js(),id3Track:o,textTrack:js()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:js(),id3Track:this._id3Track,textTrack:js()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const JQ=(n,e,t)=>{if(X(n))return n*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let zm=null;const eX=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],tX=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],iX=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],sX=[0,1,1,4];function H7(n,e,t,i,s){if(t+24>e.length)return;const r=q7(e,t);if(r&&t+r.frameLength<=e.length){const a=r.samplesPerFrame*9e4/r.sampleRate,o=i+s*a,l={unit:e.subarray(t,t+r.frameLength),pts:o,dts:o};return n.config=[],n.channelCount=r.channelCount,n.samplerate=r.sampleRate,n.samples.push(l),{sample:l,length:r.frameLength,missing:0}}}function q7(n,e){const t=n[e+1]>>3&3,i=n[e+1]>>1&3,s=n[e+2]>>4&15,r=n[e+2]>>2&3;if(t!==1&&s!==0&&s!==15&&r!==3){const a=n[e+2]>>1&1,o=n[e+3]>>6,l=t===3?3-i:i===3?3:4,c=eX[l*14+s-1]*1e3,d=tX[(t===3?0:t===2?1:2)*3+r],f=o===3?1:2,g=iX[t][i],y=sX[i],v=g*8*y,T=Math.floor(g*c/d+a)*y;if(zm===null){const _=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);zm=_?parseInt(_[1]):0}return!!zm&&zm<=87&&i===2&&c>=224e3&&o===0&&(n[e+3]=n[e+3]|128),{sampleRate:d,channelCount:f,frameLength:T,samplesPerFrame:v}}}function u3(n,e){return n[e]===255&&(n[e+1]&224)===224&&(n[e+1]&6)!==0}function G7(n,e){return e+1<n.length&&u3(n,e)}function nX(n,e){return u3(n,e)&&4<=n.length-e}function K7(n,e){if(e+1<n.length&&u3(n,e)){const i=q7(n,e);let s=4;i!=null&&i.frameLength&&(s=i.frameLength);const r=e+s;return r===n.length||G7(n,r)}return!1}class rX extends c3{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const i=qh(e,0);let s=(i==null?void 0:i.length)||0;if(K7(e,s))return!1;for(let r=e.length;s<r;s++)if(FQ(e,s))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return NQ(e,t)}appendFrame(e,t,i){N7(e,this.observer,t,i,e.manifestCodec);const s=B7(e,t,i,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}}const j7=(n,e)=>{let t=0,i=5;e+=i;const s=new Uint32Array(1),r=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=n[e];const o=Math.min(i,8),l=8-o;r[0]=4278190080>>>24+l<<l,s[0]=(a[0]&r[0])>>l,t=t?t<<o|s[0]:s[0],e+=1,i-=o}return t};class aX extends c3{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const s=W7(e,t,i,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const t=qh(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&l3(t)!==void 0&&j7(e,i)<16}}function W7(n,e,t,i,s){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const o=[48e3,44100,32e3][r],l=e[t+4]&63,h=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+r]*2;if(t+h>e.length)return-1;const d=e[t+6]>>5;let f=0;d===2?f+=2:(d&1&&d!==1&&(f+=2),d&4&&(f+=2));const g=(e[t+6]<<8|e[t+7])>>12-f&1,v=[2,1,2,3,3,4,4,5][d]+g,T=e[t+5]>>3,b=e[t+5]&7,E=new Uint8Array([r<<6|T<<1|b>>2,(b&3)<<6|d<<3|g<<2|l>>4,l<<4&224]),_=1536/o*9e4,x=i+s*_,w=e.subarray(t,t+h);return n.config=E,n.channelCount=v,n.samplerate=o,n.samples.push({unit:w,pts:x}),h}class oX extends c3{resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=qh(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&l3(t)!==void 0&&j7(e,i)<=16)return!1;for(let s=e.length;i<s;i++)if(K7(e,i))return qe.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return nX(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return H7(e,t,i,this.basePTS,this.frameIndex)}}const lX=/\/emsg[-/]ID3/i;class cX{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=js("video",1),a=this.audioTrack=js("audio",1),o=this.txtTrack=js("text",1);if(this.id3Track=js("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=i7(e);if(l.video){const{id:c,timescale:h,codec:d,supplemental:f}=l.video;r.id=c,r.timescale=o.timescale=h,r.codec=d,r.supplemental=f}if(l.audio){const{id:c,timescale:h,codec:d}=l.audio;a.id=c,a.timescale=h,a.codec=d}o.id=J8.text,r.sampleDuration=0,r.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return cz(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ni(this.remainderData,e));const o=gz(i);this.remainderData=o.remainder,s.samples=o.valid||new Uint8Array}else s.samples=i;const a=this.extractID3Track(s,t);
vendor: 4,621 bytes, line 58
58return r.samples=BR(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=BR(e,t),{videoTrack:t,audioTrack:js(),id3Track:s,textTrack:js()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=Ae(e.samples,["emsg"]);s&&s.forEach(r=>{const a=vz(r);if(lX.test(a.schemeIdUri)){const o=EP(a,t);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const c=a.payload;i.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:ui.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=EP(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:ui.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function EP(n,e){return X(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale}class uX{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new e3(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Ta.cbc)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);s.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let s=0;for(let r=32;r<e.length-16;r+=160,s+=16)i.set(e.subarray(r,r+16),s);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let s=0;for(let r=32;r<e.length-16;r+=160,s+=16)e.set(i.subarray(s,s+16),r);return e}decryptAvcSample(e,t,i,s,r){const a=r7(r.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{r.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}).catch(s)}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){s();return}const r=e[t].units;for(;!(i>=r.length);i++){const a=r[i];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,i,s,a),!this.decrypter.isSync()))return}}}}class Y7{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,s;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const r=i.units;s=r[r.length-1]}return s}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,s=i.length;if(s){const r=i[s-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const s=t.byteLength;let r=e.naluState||0;const a=r,o=[];let l=0,c,h,d,f=-1,g=0;for(r===-1&&(f=0,g=this.getNALuType(t,0),r=0,l=1);l<s;){if(c=t[l++],!r){r=c?0:1;continue}if(r===1){r=c?0:2;continue}if(!c)r=3;else if(c===1){if(h=l-r-1,f>=0){const y={data:t.subarray(f,h),type:g};o.push(y)}else{const y=this.getLastNalUnit(e.samples);y&&(a&&l<=4-a&&y.state&&(y.data=y.data.subarray(0,y.data.byteLength-a)),h>0&&(y.data=Ni(y.data,t.subarray(0,h)),y.state=0))}l<s?(d=this.getNALuType(t,l),f=l,g=d,r=0):r=-1}else r=0}if(f>=0&&r>=0){const y={data:t.subarray(f,s),type:g,state:r};o.push(y)}if(o.length===0){const y=this.getLastNalUnit(e.samples);y&&(y.data=Ni(y.data,t))}return e.naluState=r,o}}class kh{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>
vendor: 4,199 bytes, line 58
58e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&qe.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class hX extends Y7{parsePES(e,t,i,s){const r=this.parseNALu(e,i.data,s);let a=this.VideoSample,o,l=!1;i.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(c=>{var h,d;switch(c.type){case 1:{let v=!1;o=!0;const T=c.data;if(l&&T.length>4){const b=this.readSliceType(T);(b===2||b===4||b===7||b===9)&&(v=!0)}if(v){var f;(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.frame=!0,a.key=v;break}case 5:o=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 6:{o=!0,Qk(c.data,1,i.pts,t.samples);break}case 7:{var g,y;o=!0,l=!0;const v=c.data,T=this.readSPS(v);if(!e.sps||e.width!==T.width||e.height!==T.height||((g=e.pixelRatio)==null?void 0:g[0])!==T.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==T.pixelRatio[1]){e.width=T.width,e.height=T.height,e.pixelRatio=T.pixelRatio,e.sps=[v];const b=v.subarray(1,4);let E="avc1.";for(let _=0;_<3;_++){let x=b[_].toString(16);x.length<2&&(x="0"+x),E+=x}e.codec=E}break}case 8:o=!0,e.pps=[c.data];break;case 9:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(c)}),s&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new kh(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,s=8,r;for(let a=0;a<e;a++)s!==0&&(r=t.readEG(),s=(i+r+256)%256),i=s===0?i:s}readSPS(e){const t=new kh(e);let i=0,s=0,r=0,a=0,o,l,c;const h=t.readUByte.bind(t),d=t.readBits.bind(t),f=t.readUEG.bind(t),g=t.readBoolean.bind(t),y=t.skipBits.bind(t),v=t.skipEG.bind(t),T=t.skipUEG.bind(t),b=this.skipScalingList.bind(this);h();const E=h();if(d(5),y(3),h(),T(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){const k=f();if(k===3&&y(1),T(),T(),y(1),g())for(l=k!==3?8:12,c=0;c<l;c++)g()&&(c<6?b(16,t):b(64,t))}T();const _=f();if(_===0)f();else if(_===1)for(y(1),v(),v(),o=f(),c=0;c<o;c++)v();T(),y(1);const x=f(),w=f(),R=d(1);R===0&&y(1),y(1),g()&&(i=f(),s=f(),r=f(),a=f());let C=[1,1];if(g()&&g())switch(h()){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[h()<<8|h(),h()<<8|h()];break}}return{width:Math.ceil((x+1)*16-i*2-s*2),height:(2-R)*(w+1)*16-(R?2:4)*(r+a),pixelRatio:C}}}class dX extends Y7{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,s){const r=this.parseNALu(e,i.data,s);let a=this.VideoSample,o,l=!1;i.data=null,a&&r.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.forEach(c=>{var h,d;
vendor: 18,157 bytes, line 58
58switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,l){var f;(f=a)!=null&&f.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,Qk(c.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=We(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const g=this.readSPS(c.data);e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.codec=g.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const y in g.params)e.params[y]=g.params[y]}this.pushParameterSet(e.sps,c.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const g=this.readPPS(c.data);for(const y in g)e.params[y]=g[y]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=a)!=null&&d.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}a&&o&&a.units.push(c)}),s&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(t[i]=e[s],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new kh(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),s=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:s}}readSPS(e){const t=new kh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const s=t.readBits(2),r=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),l=t.readUByte(),c=t.readUByte(),h=t.readUByte(),d=t.readUByte(),f=t.readUByte(),g=t.readUByte(),y=t.readUByte(),v=t.readUByte(),T=t.readUByte(),b=t.readUByte(),E=[],_=[];for(let we=0;we<i;we++)E.push(t.readBoolean()),_.push(t.readBoolean());if(i>0)for(let we=i;we<8;we++)t.readBits(2);for(let we=0;we<i;we++)E[we]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),_[we]&&t.readUByte();t.readUEG();const x=t.readUEG();x==3&&t.skipBits(1);const w=t.readUEG(),R=t.readUEG(),C=t.readBoolean();let k=0,P=0,I=0,O=0;C&&(k+=t.readUEG(),P+=t.readUEG(),I+=t.readUEG(),O+=t.readUEG());const G=t.readUEG(),j=t.readUEG(),K=t.readUEG(),W=t.readBoolean();for(let we=W?0:i;we<=i;we++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let qt=0;qt<4;qt++)for(let Ii=0;Ii<(qt===3?2:6);Ii++)if(!t.readBoolean())t.readUEG();else{const Vi=Math.min(64,1<<4+(qt<<1));qt>1&&t.readEG();for(let Al=0;Al<Vi;Al++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const q=t.readUEG();let z=0;for(let we=0;we<q;we++){let qt=!1;if(we!==0&&(qt=t.readBoolean()),qt){we===q&&t.readUEG(),t.readBoolean(),t.readUEG();let Ii=0;for(let xa=0;xa<=z;xa++){const Vi=t.readBoolean();let Al=!1;Vi||(Al=t.readBoolean()),(Vi||Al)&&Ii++}z=Ii}else{const Ii=t.readUEG(),xa=t.readUEG();z=Ii+xa;for(let Vi=0;Vi<Ii;Vi++)t.readUEG(),t.readBoolean();for(let Vi=0;Vi<xa;Vi++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const we=t.readUEG();for(let qt=0;qt<we;qt++){for(let Ii=0;Ii<K+4;Ii++)t.readBits(1);t.readBits(1)}}let N=0,H=1,ne=1,be=!0,ue=1,ye=0;t.readBoolean(),t.readBoolean();let dt=!1;if(t.readBoolean()){if(t.readBoolean()){const La=t.readUByte(),S3=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Pm=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];La>0&&La<16?(H=S3[La-1],ne=Pm[La-1]):La===255&&(H=t.readBits(16),ne=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),dt=t.readBoolean(),dt&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(ue=t.readBits(32),ye=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Pm=t.readBoolean(),_3=t.readBoolean();let th=!1;(Pm||_3)&&(th=t.readBoolean(),th&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),th&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let A3=0;A3<=i;A3++){be=t.readBoolean();const IU=be||t.readBoolean();let x3=!1;IU?t.readEG():x3=t.readBoolean();const L3=x3?1:t.readUEG()+1;if(Pm)for(let ih=0;ih<L3;ih++)t.readUEG(),t.readUEG(),th&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(_3)for(let ih=0;ih<L3;ih++)t.readUEG(),t.readUEG(),th&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),N=t.readUEG())}let ft=w,Tt=R;if(C){let we=1,qt=1;x===1?we=qt=2:x==2&&(we=2),ft=w-we*P-we*k,Tt=R-qt*O-qt*I}const Ci=s?["A","B","C"][s]:"",_l=o<<24|l<<16|c<<8|h;let _a=0;for(let we=0;we<32;we++)_a=(_a|(_l>>we&1)<<31-we)>>>0;let Aa=_a.toString(16);return a===1&&Aa==="2"&&(Aa="6"),{codecString:`hvc1.${Ci}${a}.${Aa}.${r?"H":"L"}${b}.B0`,params:{general_tier_flag:r,general_profile_idc:a,general_profile_space:s,general_profile_compatibility_flags:[o,l,c,h],general_constraint_indicator_flags:[d,f,g,y,v,T],general_level_idc:b,bit_depth:G+8,bit_depth_luma_minus8:G,bit_depth_chroma_minus8:j,min_spatial_segmentation_idc:N,chroma_format_idc:x,frame_rate:{fixed:be,fps:ye/ue}},width:ft,height:Tt,pixelRatio:[H,ne]}}readPPS(e){const t=new kh(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const s=t.readBoolean(),r=t.readBoolean();let a=1;return r&&s?a=0:r?a=3:s&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const wt=188;class fr{constructor(e,t,i,s){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=s,this.videoParser=null}static probe(e,t){const i=fr.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(wt*5,t-wt)+1,s=0;for(;s<i;){let r=!1,a=-1,o=0;for(let l=s;l<t;l+=wt)if(e[l]===71&&(t-l===wt||e[l+wt]===71)){if(o++,a===-1&&(a=l,a!==0&&(i=Math.min(a+wt*99,e.length-wt)+1)),r||(r=hI(e,l)===0),r&&o>1&&(a===0&&o>2||l+wt>i))return a}else{if(o)return-1;break}s++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:J8[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=fr.createTrack("video"),this._videoTrack.duration=s,this._audioTrack=fr.createTrack("audio",s),this._id3Track=fr.createTrack("id3"),this._txtTrack=fr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){i||(this.sampleAes=null);let r;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack;let h=a.pid,d=a.pesData,f=o.pid,g=l.pid,y=o.pesData,v=l.pesData,T=null,b=this.pmtParsed,E=this._pmtId,_=e.length;if(this.remainderData&&(e=Ni(this.remainderData,e),_=e.length,this.remainderData=null),_<wt&&!s)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};const x=Math.max(0,fr.syncOffset(e));_-=(_-x)%wt,_<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,_,e.buffer.byteLength-_));let w=0;for(let C=x;C<_;C+=wt)if(e[C]===71){const k=!!(e[C+1]&64),P=hI(e,C),I=(e[C+3]&48)>>4;let O;if(I>1){if(O=C+5+e[C+4],O===C+wt)continue}else O=C+4;switch(P){case h:k&&(d&&(r=Il(d,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,c,r,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(O,C+wt)),d.size+=C+wt-O);break;case f:if(k){if(y&&(r=Il(y,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r);break}y={data:[],size:0}}y&&(y.data.push(e.subarray(O,C+wt)),y.size+=C+wt-O);break;case g:k&&(v&&(r=Il(v,this.logger))&&this.parseID3PES(l,r),v={data:[],size:0}),v&&(v.data.push(e.subarray(O,C+wt)),v.size+=C+wt-O);break;case 0:k&&(O+=e[O]+1),E=this._pmtId=fX(e,O);break;case E:{k&&(O+=e[O]+1);const G=pX(e,O,this.typeSupported,i,this.observer,this.logger);h=G.videoPid,h>0&&(a.pid=h,a.segmentCodec=G.segmentVideoCodec),f=G.audioPid,f>0&&(o.pid=f,o.segmentCodec=G.segmentAudioCodec),g=G.id3Pid,g>0&&(l.pid=g),T!==null&&!b&&(this.logger.warn(`MPEG-TS PMT found at ${C} after unknown PID '${T}'. Backtracking to sync byte @${x} to parse all TS packets.`),T=null,C=x-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=P;break}}else w++;w>0&&dI(this.observer,new Error(`Found ${w} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=d,o.pesData=y,l.pesData=v;const R={audioTrack:o,videoTrack:a,id3Track:l,textTrack:c};return s&&this.extractRemainingSamples(R),R}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,a=i.pesData,o=t.pesData,l=s.pesData;let c;if(a&&(c=Il(a,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,r,c,!0),i.pesData=null)):i.pesData=a,o&&(c=Il(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(c=Il(l,this.logger))?(this.parseID3PES(s,c),s.pesData=null):s.pesData=l}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new uX(this.observer,this.config,t);return this.decrypt(s,r)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new hX:e==="hevc"&&(this.videoParser=new dX))}decrypt(e,t){return new Promise(i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&s.segmentCodec==="aac"?t.decryptAacSamples(s.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{i(e)}):i(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r=t.data;if(s){this.aacOverFlow=null;const d=s.missing,f=s.sample.unit.byteLength;if(d===-1)r=Ni(s.sample.unit,r);else{const g=f-d;s.sample.unit.set(r.subarray(0,d),g),e.samples.push(s.sample),i=s.missing}}let a,o;for(a=i,o=r.length;a<o-1&&!_y(r,a);a++);if(a!==i){let d;const f=a<o-1;if(f?d=`AAC PES did not start with ADTS header,offset:${a}`:d="No ADTS header found in AAC PES",dI(this.observer,new Error(d),f,this.logger),!f)return}N7(e,this.observer,r,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(s){const d=F7(e.samplerate);l=s.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,h;for(;a<o;)if(h=B7(e,r,a,l,c),a+=h.length,h.missing){this.aacOverFlow=h;break}else for(c++;a<o-1&&!_y(r,a);a++);}parseMPEGPES(e,t){const i=t.data,s=i.length;let r=0,a=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<s;)if(G7(i,a)){const l=H7(e,i,a,o,r);if(l)a+=l.length,r++;else break}else a++}parseAC3PES(e,t){{const i=t.data,s=t.pts;if(s===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const r=i.length;let a=0,o=0,l;for(;o<r&&(l=W7(e,i,o,s,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=We({},t,{type:this._videoTrack?ui.emsg:ui.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function hI(n,e){return((n[e+1]&31)<<8)+n[e+2]}function fX(n,e){return(n[e+10]&31)<<8|n[e+11]}function pX(n,e,t,i,s,r){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(n[e+1]&15)<<8|n[e+2],l=e+3+o-4,c=(n[e+10]&15)<<8|n[e+11];for(e+=12+c;e<l;){const h=hI(n,e),d=(n[e+3]&15)<<8|n[e+4];switch(n[e]){case 207:if(!i){zx("ADTS AAC",r);break}case 15:a.audioPid===-1&&(a.audioPid=h);break;case 21:a.id3Pid===-1&&(a.id3Pid=h);break;case 219:if(!i){zx("H.264",r);break}case 27:a.videoPid===-1&&(a.videoPid=h);break;case 3:case 4:!t.mpeg&&!t.mp3?r.log("MPEG audio found, not supported in this browser"):a.audioPid===-1&&(a.audioPid=h,a.segmentAudioCodec="mp3");break;case 193:if(!i){zx("AC-3",r);break}case 129:t.ac3?a.audioPid===-1&&(a.audioPid=h,a.segmentAudioCodec="ac3"):r.log("AC-3 audio found, not supported in this browser");break;case 6:if(a.audioPid===-1&&d>0){let f=e+5,g=d;for(;g>2;){switch(n[f]){case 106:t.ac3!==!0?r.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=h,a.segmentAudioCodec="ac3");break}const v=n[f+1]+2;f+=v,g-=v}}break;case 194:case 135:return dI(s,new Error("Unsupported EC-3 in M2TS found"),void 0,r),a;case 36:a.videoPid===-1&&(a.videoPid=h,a.segmentVideoCodec="hevc",r.log("HEVC in M2TS found"));break}e+=d+5}return a}function dI(n,e,t,i){i.warn(`parsing error: ${e.message}`),n.emit(S.ERROR,S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function zx(n,e){e.log(`${n} with AES-128-CBC encryption found in unencrypted stream`)}function Il(n,e){let t=0,i,s,r,a,o;const l=n.data;if(!n||n.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=Ni(l[0],l[1]),l.splice(1,1);if(i=l[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(s=(i[4]<<8)+i[5],s&&s>n.size-6)return null;const h=i[7];h&192&&(a=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,h&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),r=i[8];let d=r+9;if(n.size<=d)return null;n.size-=d;const f=new Uint8Array(n.size);for(let g=0,y=l.length;g<y;g++){i=l[g];let v=i.byteLength;if(d)if(d>v){d-=v;continue}else i=i.subarray(d),v-=d,d=0;f.set(i,t),t+=v}return s&&(s-=r+3),{data:f,pts:a,dts:o,len:s}}return null}class mX{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const rr=Math.pow(2,32)-1;class M{static init(){M.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in M.types)M.types.hasOwnProperty(e)&&(M.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new 
vendor: 4,361 bytes, line 58
58Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=r,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,a,l,a,o),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=i&255,a.set(e,4),s=0,i=8;s<r;s++)a.set(t[s],i),i+=t[s].byteLength;return a}static hdlr(e){return M.box(M.types.hdlr,M.HDLR_TYPES[e])}static mdat(e){return M.box(M.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(rr+1)),s=Math.floor(t%(rr+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return M.box(M.types.mdia,M.mdhd(e.timescale||0,e.duration||0),M.hdlr(e.type),M.minf(e))}static mfhd(e){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(e)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(e))}static moof(e,t,i){return M.box(M.types.moof,M.mfhd(e),M.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=M.trak(e[t]);return M.box.apply(null,[M.types.moov,M.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(M.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=M.trex(e[t]);return M.box.apply(null,[M.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(rr+1)),s=Math.floor(t%(rr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s<t.length;s++)r=t[s].flags,i[s+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return M.box(M.types.sdtp,i)}static stbl(e){return M.box(M.types.stbl,M.stsd(e),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))}static avc1(e){let t=[],i=[],s,r,a;for(s=0;s<e.sps.length;s++)r=e.sps[s],a=r.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(r));for(s=0;s<e.pps.length;s++)r=e.pps[s],a=r.byteLength,i.push(a>>>8&255),i.push(a&255),i=i.concat(Array.prototype.slice.call(r));const o=M.box(M.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),l=e.width,c=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return M.box(M.types.mp4a,M.audioStsd(e),M.box(M.types.esds,M.esds(e)))}static mp3(e){return M.box(M.types[".mp3"],M.audioStsd(e))}static ac3(e){return M.box(M.types["ac-3"],M.audioStsd(e),M.box(M.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return M.box(M.types.stsd,M.STSD,M.mp4a(e));if(t==="ac3"&&e.config)return M.box(M.types.stsd,M.STSD,M.ac3(e));if(t==="mp3"&&e.codec==="mp3")return M.box(M.types.stsd,M.STSD,M.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return M.box(M.types.stsd,M.STSD,M.avc1(e));if(t==="hevc"&&e.vps)return M.box(M.types.stsd,M.STSD,M.hvc1(e))}
vendor: 24,057 bytes, line 58
58else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),s=e.width||0,r=e.height||0,a=Math.floor(i/(rr+1)),o=Math.floor(i%(rr+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,s&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const i=M.sdtp(e),s=e.id,r=Math.floor(t/(rr+1)),a=Math.floor(t%(rr+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255])),M.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,M.box(M.types.trak,M.tkhd(e),M.mdia(e))}static trex(e){const t=e.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,a=new Uint8Array(r);let o,l,c,h,d,f;for(t+=8+r,a.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<s;o++)l=i[o],c=l.duration,h=l.size,d=l.flags,f=l.cts,a.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,f>>>24&255,f>>>16&255,f>>>8&255,f&255],12+16*o);return M.box(M.types.trun,a)}static initSegment(e){M.types||M.init();const t=M.moov(e);return Ni(M.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],s=4,r=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),s-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let a=r.length;for(let y=0;y<i.length;y+=1){a+=3;for(let v=0;v<i[y].length;v+=1)a+=2+i[y][v].length}const o=new Uint8Array(a);o.set(r,0),a=r.length;const l=i.length-1;for(let y=0;y<i.length;y+=1){o.set(new Uint8Array([32+y|(y===l?128:0),0,i[y].length]),a),a+=3;for(let v=0;v<i[y].length;v+=1)o.set(new Uint8Array([i[y][v].length>>8,i[y][v].length&255]),a),a+=2,o.set(i[y][v],a),a+=i[y][v].length}const c=M.box(M.types.hvcC,o),h=e.width,d=e.height,f=e.pixelRatio[0],g=e.pixelRatio[1];return M.box(M.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,h&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,g>>24,g>>16&255,g>>8&255,g&255])))}}M.types=void 0;M.HDLR_TYPES=void 0;M.STTS=void 0;M.STSC=void 0;M.STCO=void 0;M.STSZ=void 0;M.VMHD=void 0;M.SMHD=void 0;M.STSD=void 0;M.FTYP=void 0;M.DINF=void 0;const z7=9e4;function h3(n,e,t=1,i=!1){const s=n*e*t;return i?Math.round(s):s}function gX(n,e,t=1,i=!1){return h3(n,e,1/t,i)}function lh(n,e=!1){return h3(n,1e3,1/z7,e)}function yX(n,e=1){return h3(n,z7,1/e)}function SP(n){const{baseTime:e,timescale:t,trackId:i}=n;return`${e/t} (${e}/${t}) trackId: ${i}`}const vX=10*1e3,TX=1024,bX=1152,EX=1536;let kl=null,Qx=null;function _P(n,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:n?2:1,isNonSync:n?0:1}}}class Bg extends Bi{constructor(e,t,i,s){if(super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,kl===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);kl=a?parseInt(a[1]):0}if(Qx===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);Qx=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&SP(t)} > ${e&&SP(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,s=e.reduce((r,a)=>{let o=a.pts,l=o-r;return l<-4294967296&&(t=!0,o=Ei(o,i),l=o-r),l>0?r:o},i);return t&&this.debug("PTS rollover detected"),s}remux(e,t,i,s,r,a,o,l){let c,h,d,f,g,y,v=r,T=r;const b=e.pid>-1,E=t.pid>-1,_=t.samples.length,x=e.samples.length>0,w=o&&_>0||_>1;if((!b||x)&&(!E||w)||this.ISGenerated||o){if(this.ISGenerated){var C,k,P,I;const K=this.videoTrackConfig;(K&&(t.width!==K.width||t.height!==K.height||((C=t.pixelRatio)==null?void 0:C[0])!==((k=K.pixelRatio)==null?void 0:k[0])||((P=t.pixelRatio)==null?void 0:P[1])!==((I=K.pixelRatio)==null?void 0:I[1]))||!K&&w||this.nextAudioTs===null&&x)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,r,a));const O=this.isVideoContiguous;let G=-1,j;if(w&&(G=SX(t.samples),!O&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,G>0){this.warn(`Dropped ${G} out of ${_} video samples due to a missing keyframe`);const K=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(G),t.dropped+=G,T+=(t.samples[0].pts-K)/t.inputTimeScale,j=T}else G===-1&&(this.warn(`No keyframe found out of ${_} video samples`),y=!1);if(this.ISGenerated){if(x&&w){const K=this.getVideoStartPts(t.samples),U=(Ei(e.samples[0].pts,K)-K)/t.inputTimeScale;v+=Math.max(0,U),T+=Math.max(0,-U)}if(x){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,r,a)),h=this.remuxAudio(e,v,this.isAudioContiguous,a,E||w||l===Z.AUDIO?T:void 0),w){const K=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,r,a)),c=this.remuxVideo(t,T,O,K)}}else w&&(c=this.remuxVideo(t,T,O,0));c&&(c.firstKeyFrame=G,c.independent=G!==-1,c.firstKeyFramePTS=j)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(g=Q7(i,r,this._initPTS,this._initDTS)),s.samples.length&&(f=X7(s,r,this._initPTS))),{audio:h,video:c,initSegment:d,independent:y,text:f,id3:g}}computeInitPts(e,t,i,s){const r=Math.round(i*t);let a=Ei(e,r);if(a<r+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(r-a)/t} ${s}`);a<r+t;)a+=8589934592;return a-r}generateIS(e,t,i,s){const r=e.samples,a=t.samples,o=this.typeSupported,l={},c=this._initPTS;let h=!c||s,d="audio/mp4",f,g,y,v=-1;if(h&&(f=g=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):M.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(v=e.id,y=e.inputTimeScale,!c||y!==c.timescale?f=g=this.computeInitPts(r[0].pts,y,i,"audio"):h=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:M.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(v=t.id,y=t.inputTimeScale,!c||y!==c.timescale){const T=this.getVideoStartPts(a),b=Ei(a[0].dts,T),E=this.computeInitPts(b,y,i,"video"),_=this.computeInitPts(T,y,i,"video");g=Math.min(g,E),f=Math.min(f,_)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,h?(c&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${i} ${f/y} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${f/y} (${f}/${y}) trackId: ${v}`),this._initPTS={baseTime:f,timescale:y,trackId:v},this._initDTS={baseTime:g,timescale:y,trackId:v}):f=y=void 0,{tracks:l,initPTS:f,timescale:y,trackId:v}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,a=e.samples,o=[],l=a.length,c=this._initPTS,h=c.baseTime*r/c.timescale;let d=this.nextVideoTs,f=8,g=this.videoSampleDuration,y,v,T=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,E=!1;if(!i||d===null){const N=h+t*r,H=a[0].pts-Ei(a[0].dts,a[0].pts);kl&&d!==null&&Math.abs(N-H-(d+h))<15e3?i=!0:d=N-H-h}const _=d+h;for(let N=0;N<l;N++){const H=a[N];H.pts=Ei(H.pts,_),H.dts=Ei(H.dts,_),H.dts<a[N>0?N-1:N].dts&&(E=!0)}E&&a.sort(function(N,H){const ne=N.dts-H.dts,be=N.pts-H.pts;return ne||be}),y=a[0].dts,v=a[a.length-1].dts;const x=v-y,w=x?Math.round(x/(l-1)):g||e.inputTimeScale/30;if(i){const N=y-_,H=N>w,ne=N<-1;if((H||ne)&&(H?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${lh(N,!0)} ms (${N}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${lh(-N,!0)} ms (${N}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!ne||_>=a[0].pts||kl)){y=_;const be=a[0].pts-N;if(H)a[0].dts=y,a[0].pts=be;else{let ue=!0;for(let ye=0;ye<a.length&&!(a[ye].dts>be&&ue);ye++){const dt=a[ye].pts;if(a[ye].dts-=N,a[ye].pts-=N,ye<a.length-1){const ot=a[ye+1].pts,ft=a[ye].pts,Tt=ot<=ft,Ci=ot<=dt;ue=Tt==Ci}}}this.log(`Video: Initial PTS/DTS adjusted: ${lh(be,!0)}/${lh(y,!0)}, delta: ${lh(N,!0)} ms`)}}y=Math.max(0,y);let R=0,C=0,k=y;for(let N=0;N<l;N++){const H=a[N],ne=H.units,be=ne.length;let ue=0;for(let ye=0;ye<be;ye++)ue+=ne[ye].data.length;C+=ue,R+=be,H.length=ue,H.dts<k?(H.dts=k,k+=w/4|0||1):k=H.dts,T=Math.min(H.pts,T),b=Math.max(H.pts,b)}v=a[l-1].dts;const P=C+4*R+8;let I;try{I=new Uint8Array(P)}catch(N){this.observer.emit(S.ERROR,S.ERROR,{type:ee.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:N,bytes:P,reason:`fail allocating video mdat ${P}`});return}const O=new DataView(I.buffer);O.setUint32(0,P),I.set(M.types.mdat,4);let G=!1,j=Number.POSITIVE_INFINITY,K=Number.POSITIVE_INFINITY,W=Number.NEGATIVE_INFINITY,U=Number.NEGATIVE_INFINITY;for(let N=0;N<l;N++){const H=a[N],ne=H.units;let be=0;for(let dt=0,ot=ne.length;dt<ot;dt++){const ft=ne[dt],Tt=ft.data,Ci=ft.data.byteLength;O.setUint32(f,Ci),f+=4,I.set(Tt,f),f+=Ci,be+=4+Ci}let ue;if(N<l-1)g=a[N+1].dts-H.dts,ue=a[N+1].pts-H.pts;else{const dt=this.config,ot=N>0?H.dts-a[N-1].dts:w;if(ue=N>0?H.pts-a[N-1].pts:w,dt.stretchShortVideoTrack&&this.nextAudioTs!==null){const ft=Math.floor(dt.maxBufferHole*r),Tt=(s?T+s*r:this.nextAudioTs+h)-H.pts;Tt>ft?(g=Tt-ot,g<0?g=ot:G=!0,this.log(`It is approximately ${Tt/90} ms to the next segment; using duration ${g/90} ms for the last video frame.`)):g=ot}else g=ot}const ye=Math.round(H.pts-H.dts);j=Math.min(j,g),W=Math.max(W,g),K=Math.min(K,ue),U=Math.max(U,ue),o.push(_P(H.key,g,be,ye))}if(o.length){if(kl){if(kl<70){const N=o[0].flags;N.dependsOn=2,N.isNonSync=0}}else if(Qx&&U-K<W-j&&w/W<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let N=y;for(let H=0,ne=o.length;H<ne;H++){const be=N+o[H].duration,ue=N+o[H].cts;if(H<ne-1){const ye=be+o[H+1].cts;o[H].duration=ye-ue}else o[H].duration=H?o[H-1].duration:w;o[H].cts=0,N=be}}}g=G||!g?w:g;const V=v+g;this.nextVideoTs=d=V-h,this.videoSampleDuration=g,this.isVideoContiguous=!0;const q=M.moof(e.sequenceNumber++,y,We(e,{samples:o})),z="video",F={data1:q,data2:I,startPTS:(T-h)/r,endPTS:(b+g-h)/r,startDTS:(y-h)/r,endDTS:d/r,type:z,hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,F}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return bX;case"ac3":return EX;default:return TX}}remuxAudio(e,t,i,s,r){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,c=this.getSamplesPerFrame(e),h=c*l,d=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,g=[],y=r!==void 0;let v=e.samples,T=f?0:8,b=this.nextAudioTs||-1;const E=d.baseTime*a/d.timescale,_=E+t*a;if(this.isAudioContiguous=i=i||v.length&&b>0&&(s&&Math.abs(_-(b+E))<9e3||Math.abs(Ei(v[0].pts,_)-(b+E))<20*h),v.forEach(function(U){U.pts=Ei(U.pts,_)}),!i||b<0){const U=v.length;if(v=v.filter(V=>V.pts>=0),U!==v.length&&this.warn(`Removed ${v.length-U} of ${U} samples (initPTS ${E} / ${a})`),!v.length)return;r===0?b=0:s&&!y?b=Math.max(0,_-E):b=v[0].pts-E}if(e.segmentCodec==="aac"){const U=this.config.maxAudioFramesDrift;for(let V=0,q=b+E;V<v.length;V++){const z=v[V],F=z.pts,N=F-q,H=Math.abs(1e3*N/a);if(N<=-U*h&&y)V===0&&(this.warn(`Audio frame @ ${(F/a).toFixed(3)}s overlaps marker by ${Math.round(1e3*N/a)} ms.`),this.nextAudioTs=b=F-E,q=F);else if(N>=U*h&&H<vX&&y){let ne=Math.round(N/h);for(q=F-ne*h;q<0&&ne&&h;)ne--,q+=h;V===0&&(this.nextAudioTs=b=q-E),this.warn(`Injecting ${ne} audio frames @ ${((q-E)/a).toFixed(3)}s due to ${Math.round(1e3*N/a)} ms gap.`);for(let be=0;be<ne;be++){let ue=mX.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);ue||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),ue=z.unit.subarray()),v.splice(V,0,{unit:ue,pts:q}),q+=h,V++}}z.pts=q,q+=h}}let x=null,w=null,R,C=0,k=v.length;for(;k--;)C+=v[k].unit.byteLength;for(let U=0,V=v.length;U<V;U++){const q=v[U],z=q.unit;let F=q.pts;if(w!==null){const H=g[U-1];H.duration=Math.round((F-w)/l)}else if(i&&e.segmentCodec==="aac"&&(F=b+E),x=F,C>0){C+=T;try{R=new Uint8Array(C)}catch(H){this.observer.emit(S.ERROR,S.ERROR,{type:ee.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:H,bytes:C,reason:`fail allocating audio mdat ${C}`});return}f||(new DataView(R.buffer).setUint32(0,C),R.set(M.types.mdat,4))}else return;R.set(z,T);const N=z.byteLength;T+=N,g.push(_P(!0,c,N,0)),w=F}const P=g.length;if(!P)return;const I=g[g.length-1];b=w-E,this.nextAudioTs=b+l*I.duration;const O=f?new Uint8Array(0):M.moof(e.sequenceNumber++,x/l,We({},e,{samples:g}));e.samples=[];const G=(x-E)/a,j=this.nextAudioTs/a,W={data1:O,data2:R,startPTS:G,endPTS:j,startDTS:G,endDTS:j,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,W}}function Ei(n,e){let t;if(e===null)return n;for(e<n?t=-8589934592:t=8589934592;Math.abs(n-e)>4294967296;)n+=t;return n}function SX(n){for(let e=0;e<n.length;e++)if(n[e].key)return e;return-1}function Q7(n,e,t,i){const s=n.samples.length;if(!s)return;const r=n.inputTimeScale;for(let o=0;o<s;o++){const l=n.samples[o];l.pts=Ei(l.pts-t.baseTime*r/t.timescale,e*r)/r,l.dts=Ei(l.dts-i.baseTime*r/i.timescale,e*r)/r}const a=n.samples;return n.samples=[],{samples:a}}function X7(n,e,t){const i=n.samples.length;if(!i)return;const s=n.inputTimeScale;for(let a=0;a<i;a++){const o=n.samples[a];o.pts=Ei(o.pts-t.baseTime*s/t.timescale,e*s)/s}n.samples.sort((a,o)=>a.pts-o.pts);const r=n.samples;return n.samples=[],{samples:r}}class _X extends Bi{constructor(e,t,i,s){super("passthrough-remuxer",s),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,s),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:r,video:a}=this.initData=i7(e);if(t)fz(e,t);else{const l=r||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}r&&(i=AP(r,Qe.AUDIO,this)),a&&(s=AP(a,Qe.VIDEO,this));const o={};r&&a?o.audiovideo={container:"video/mp4",codec:i+","+s,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:r?o.audio={container:"audio/mp4",codec:i,encrypted:r.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:s,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,i,s,r,a){var o,l;let{initPTS:c,lastEndTime:h}=this;const d={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};X(h)||(h=this.lastEndTime=r||0);const f=t.samples;if(!f.length)return d;const g={initPTS:void 0,timescale:void 0,trackId:void 0};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(f),y=this.initData),!((l=y)!=null&&l.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1);const v=mz(f,y,this),T=y.audio?v[y.audio.id]:null,b=y.video?v[y.video.id]:null,E=Qm(b,1/0),_=Qm(T,1/0),x=Qm(b,0,!0),w=Qm(T,0,!0);let R=r,C=0;const k=T&&(!b||!c&&_<E||c&&c.trackId===y.audio.id),P=k?T:b;if(P){const q=P.timescale,z=P.start-r*q,F=k?y.audio.id:y.video.id;R=P.start/q,C=k?w-_:x-E,(a||!c)&&(AX(c,R,r,C)||q!==c.timescale)&&(c&&this.warn(`Timestamps at playlist time: ${a?"":"~"}${r} ${z/q} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${R-r} (${z}/${q}) trackId: ${F}`),c=null,g.initPTS=z,g.timescale=q,g.trackId=F)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${r}`);c?(g.initPTS=c.baseTime,g.timescale=c.timescale,g.trackId=c.trackId):((!g.timescale||g.trackId===void 0||g.initPTS===void 0)&&(this.warn("Could not set initPTS"),g.initPTS=R,g.timescale=1,g.trackId=-1),this.initPTS=c={baseTime:g.initPTS,timescale:g.timescale,trackId:g.trackId});const I=R-c.baseTime/c.timescale,O=I+C;C>0?this.lastEndTime=O:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const G=!!y.audio,j=!!y.video;let K="";G&&(K+="audio"),j&&(K+="video");const W=(y.audio?y.audio.encrypted:!1)||(y.video?y.video.encrypted:!1),U={data1:f,startPTS:I,startDTS:I,endPTS:O,endDTS:O,type:K,hasAudio:G,hasVideo:j,nb:1,dropped:0,encrypted:W};d.audio=G&&!j?U:void 0,d.video=j?U:void 0;const V=b==null?void 0:b.sampleCount;if(V){const q=b.keyFrameIndex,z=q!==-1;U.nb=V,U.dropped=q===0||this.isVideoContiguous?0:z?q:V,U.independent=z,U.firstKeyFrame=q,z&&b.keyFrameStart&&(U.firstKeyFramePTS=(b.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(d.independent=z),this.isVideoContiguous||(this.isVideoContiguous=z),U.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${q}/${V} dropped: ${U.dropped} start: ${U.firstKeyFramePTS||"NA"}`)}return d.initSegment=g,d.id3=Q7(i,r,c,c),s.samples.length&&(d.text=X7(s,r,c)),d}}function Qm(n,e,t=!1){return(n==null?void 0:n.start)!==void 0?(n.start+(t?n.duration:0))/n.timescale:e}function AX(n,e,t,i){if(n===null)return!0;const s=Math.max(i,1),r=e-n.baseTime/n.timescale;return Math.abs(r-t)>s}function AP(n,e,t){const i=n.codec;return i&&i.length>4?i:e===Qe.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?my(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let un;try{un=self.performance.now.bind(self.performance)}catch{un=Date.now}const Ug=[{demux:cX,remux:_X},{demux:fr,remux:Bg},{demux:rX,remux:Bg},{demux:oX,remux:Bg}];Ug.splice(2,0,{demux:aX,remux:Bg});class xP{constructor(e,t,i,s,r,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=r,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,s){const r=i.transmuxing;r.executeStart=un();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;s&&(this.currentTransmuxState=s);const{contiguous:c,discontinuity:h,trackSwitch:d,accurateTimeOffset:f,timeOffset:g,initSegmentChange:y}=s||o,{audioCodec:v,videoCodec:T,defaultInitPts:b,duration:E,initSegmentData:_}=l,x=xX(a,t);if(x&&Hl(x.method)){const k=this.getDecrypter(),P=i3(x.method);if(k.isSync()){let I=k.softwareDecrypt(a,x.key.buffer,x.iv.buffer,P);if(i.part>-1){const G=k.flush();I=G&&G.buffer}if(!I)return r.executeEnd=un(),Xx(i);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=k.webCryptoDecrypt(a,x.key.buffer,x.iv.buffer,P).then(I=>{const O=this.push(I,null,i);return this.decryptionPromise=null,O}),this.decryptionPromise}const w=this.needsProbing(h,d);if(w){const k=this.configureTransmuxer(a);if(k)return this.logger.warn(`[transmuxer] ${k.message}`),this.observer.emit(S.ERROR,S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:k,reason:k.message}),r.executeEnd=un(),Xx(i)}(h||d||y||w)&&this.resetInitSegment(_,v,T,E,t),(h||y||w)&&this.resetInitialTimestamp(b),c||this.resetContiguity();const R=this.transmux(a,x,g,f,i);this.asyncResult=Gh(R);const C=this.currentTransmuxState;return C.contiguous=!0,C.discontinuity=!1,C.trackSwitch=!1,r.executeEnd=un(),R}flush(e){const t=e.transmuxing;t.executeStart=un();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return this.asyncResult=!0,r.then(()=>this.flush(e));const a=[],{timeOffset:o}=s;if(i){const d=i.flush();d&&a.push(this.push(d.buffer,null,e))}const{demuxer:l,remuxer:c}=this;if(!l||!c){t.executeEnd=un();const d=[Xx(e)];return this.asyncResult?Promise.resolve(d):d}const h=l.flush(o);return Gh(h)?(this.asyncResult=!0,h.then(d=>(this.flushRemux(a,d,e),a))):(this.flushRemux(a,h,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===Z.MAIN?"level":"track"} ${i.level}`);const h=this.remuxer.remux(s,r,a,o,c,l,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=un()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,i,s),o.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,i,s,r):a=this.transmuxUnencrypted(e,i,s,r),a}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,o,l,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,i,s,!1,this.id),chunkMeta:r}))}
vendor: 3,951 bytes, line 58
58configureTransmuxer(e){const{config:t,observer:i,typeSupported:s}=this;let r;for(let d=0,f=Ug.length;d<f;d++){var a;if((a=Ug[d].demux)!=null&&a.probe(e,this.logger)){r=Ug[d];break}}if(!r)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,c=r.remux,h=r.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,s,this.logger)),(!o||!(o instanceof h))&&(this.demuxer=new h(i,t,s,this.logger),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new e3(this.config)),e}}function xX(n,e){let t=null;return n.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Xx=n=>({remuxResult:{},chunkMeta:n});function Gh(n){return"then"in n&&n.then instanceof Function}class LX{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class wX{constructor(e,t,i,s,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=a}}let LP=0;class Z7{constructor(e,t,i,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=LP++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const c=l.data,h=this.hls;if(!(!h||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case"init":{var d;const f=(d=this.workerContext)==null?void 0:d.objectURL;f&&self.URL.revokeObjectURL(f);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{h.logger[c.data.logType]&&h.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,h.trigger(c.event,c.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const c=new Error(`${l.message}  (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=s;const a=(l,c)=>{c=c||{},c.frag=this.frag||void 0,l===S.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(l,c)};this.observer=new r3,this.observer.on(S.FRAG_DECRYPTED,a),this.observer.on(S.ERROR,a);const o=HR(r.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(r.workerPath||RQ()){try{r.workerPath?(l.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=DQ(r.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=PQ());const{worker:h}=this.workerContext;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Xe(r)})}catch(h){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.terminateWorker(),this.error=null,this.transmuxer=new xP(this.observer,o,r,"",t,e.logger)}return}}this.transmuxer=new xP(this.observer,o,r,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=LP++;const t=this.hls.config,i=HR(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,c
vendor: 25,201 bytes, lines 58-64
58onfig:Xe(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),OQ(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,s,r,a,o,l,c,h){var d,f;c.transmuxing.start=self.performance.now();const{instanceNo:g,transmuxer:y}=this,v=a?a.start:r.start,T=r.decryptdata,b=this.frag,E=!(b&&r.cc===b.cc),_=!(b&&c.level===b.level),x=b?c.sn-b.sn:-1,w=this.part?c.part-this.part.index:-1,R=x===0&&c.id>1&&c.id===(b==null?void 0:b.stats.chunkCount),C=!_&&(x===1||x===0&&(w===1||R&&w<=0)),k=self.performance.now();(_||x||r.stats.parsing.start===0)&&(r.stats.parsing.start=k),a&&(w||!C)&&(a.stats.parsing.start=k);const P=!(b&&((d=r.initSegment)==null?void 0:d.url)===((f=b.initSegment)==null?void 0:f.url)),I=new wX(E,C,l,_,v,P);if(!C||E||P){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${r.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===Z.MAIN?"level":"track"}: ${c.level} id: ${c.id}
59        discontinuity: ${E}
60        trackSwitch: ${_}
61        contiguous: ${C}
62        accurateTimeOffset: ${l}
63        timeOffset: ${v}
64        initSegmentChange: ${P}`);const O=new LX(i,s,t,o,h);this.configureTransmuxer(O)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:g,cmd:"demux",data:e,decryptdata:T,chunkMeta:c,state:I},e instanceof ArrayBuffer?[e]:[]);else if(y){const O=y.push(e,T,c,I);Gh(O)?O.then(G=>{this.handleTransmuxComplete(G)}).catch(G=>{this.transmuxerError(G,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(O)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const s=i.flush(e);Gh(s)?s.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")}):this.handleFlushResult(s,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const wP=100;class J7 extends fx{constructor(e,t,i){super(e,t,i,"audio-stream-controller",Z.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r,trackId:a}){if(i===Z.MAIN){const o=t.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:s,timescale:r,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${s/r} (${s}/${r}) trackId: ${a}`),this.mainAnchor=t,this.state===B.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==o)&&this.syncWithAnchor(t,c==null?void 0:c.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===B.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const s=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(s==null?void 0:s.cc)===t.cc)return;const r=(s||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=p7(a,r,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===B.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=B.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(wP),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=B.IDLE):this.state=B.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case B.IDLE:this.doTickIdle();break;case B.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e==null?void 0:e[t],s=i==null?void 0:i.details;if(s&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(s))break;this.state=B.WAITING_INIT_PTS}break}case B.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case B.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=B.FRAG_LOADING;const o=s.flush().buffer,l={frag:t,part:i,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),r&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=B.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:s,trackId:r}=this,a=t.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(i!=null&&i[r]))return;const o=i[r],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=B.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,Qe.AUDIO,Z.AUDIO));const h=this.getFwdBufferInfo(c,Z.AUDIO);if(h===null)return;if(!this.switchingTrack&&this._streamEnded(h,l)){t.trigger(S.BUFFER_EOS,{type:"audio"}),this.state=B.ENDED;return}const d=h.len,f=t.maxBufferLength,g=l.fragments,y=g[0].start,v=this.getLoadPosition(),T=this.flushing?v:h.end;if(this.switchingTrack&&s){const _=v;l.PTSKnown&&_<y&&(h.end>y||h.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=y+.05)}if(d>=f&&!this.switchingTrack&&T<g[g.length-1].start)return;let b=this.getNextFragment(T,l);if(b&&this.isLoopLoading(b,T)&&(b=this.getNextFragmentLoopLoading(b,l,h,Z.MAIN,f)),!b){this.bufferFlushed=!0;return}let E=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&E&&pt(b)&&!b.endList&&(!l.live||!this.loadingParts&&T<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(E)===St.OK&&(this.mainFragLoading=E=null),E&&pt(E))){if(b.start>E.end){const x=this.fragmentTracker.getFragAtPos(T,Z.MAIN);x&&x.end>E.end&&(E=x,this.mainFragLoading={frag:x,targetBufferTime:null})}if(b.start>E.end)return}this.loadFragment(b,o,T)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new ju(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==B.STOPPED&&(this.setInterval(wP),this.state=B.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(S.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:s}=this,{details:r,id:a,groupId:o,track:l}=t;if(!s){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const c=this.mainDetails;if(!c||r.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==B.STOPPED&&(this.state=B.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const h=s[a];let d=0;if(r.live||(i=h.details)!=null&&i.live){if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;if(h.details){var f;d=this.alignPlaylists(r,h.details,(f=this.levelLastLoaded)==null?void 0:f.details)}r.alignedSliding||(P7(r,c),r.alignedSliding||Sy(r,c),d=r.fragmentStart)}h.details=r,this.levelLastLoaded=h,this.startFragRequested||this.setStartPosition(c,d),this.hls.trigger(S.AUDIO_TRACK_UPDATED,{details:r,id:a,groupId:t.groupId}),this.state===B.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=B.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:r}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const c=l[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const d=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let f=this.transmuxer;f||(f=this.transmuxer=new Z7(this.hls,Z.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const g=this.initPTS[i.cc],y=(t=i.initSegment)==null?void 0:t.data;if(g!==void 0){const T=s?s.index:-1,b=T!==-1,E=new dx(i.level,i.sn,i.stats.chunkCount,r.byteLength,T,b);f.push(r,y,d,"",i,s,h.totalduration,!1,E,g)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:v}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new D7,complete:!1};v.push(new Uint8Array(r)),this.state!==B.STOPPED&&(this.state=B.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===Z.MAIN&&pt(t.frag)&&(this.mainFragLoading=t,this.state===B.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type!==Z.AUDIO){!this.audioOnly&&i.type===Z.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(pt(i)){this.fragPrevious=i;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(S.AUDIO_TRACK_SWITCHED,He({},r)))}this.fragBufferedComplete(i,s),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=B.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Z.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===B.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===xe.AUDIO_TRACK&&(this.state=B.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Qe.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Qe.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===B.ENDED&&(this.state=B.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,Z.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:c,level:h}=o,{details:d}=h,{audio:f,text:g,id3:y,initSegment:v}=r;if(this.fragContextChanged(l)||!d){this.fragmentTracker.removeFragment(l);return}if(this.state=B.PARSING,this.switchingTrack&&f&&this.completeAudioSwitch(this.switchingTrack),v!=null&&v.tracks){const T=l.initSegment||l;if(this.unhandledEncryptionError(v,l))return;this._bufferInitSegment(h,v.tracks,T,a),s.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:i,tracks:v.tracks})}if(f){const{startPTS:T,endPTS:b,startDTS:E,endDTS:_}=f;c&&(c.elementaryStreams[Qe.AUDIO]={startPTS:T,endPTS:b,startDTS:E,endDTS:_}),l.setElementaryStreamInfo(Qe.AUDIO,T,b,E,_),this.bufferFragmentData(f,l,c,a)}if(y!=null&&(t=y.samples)!=null&&t.length){const T=We({id:i,frag:l,details:d},y);s.trigger(S.FRAG_PARSING_METADATA,T)}if(g){const T=We({id:i,frag:l,details:d},g);s.trigger(S.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,i,s){if(this.state!==B.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const r=t.audio;r.id=Z.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&a.split(",").length===1&&(r.levelCodec=a),this.hls.trigger(S.BUFFER_CODECS,t);const o=r.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:o};this.hls.trigger(S.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===St.NOT_LOADED||s===St.PARTIAL){var r;if(!pt(e))this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=B.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Sy(t.details,a)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:s,characteristics:r,audioCodec:a,channels:o}=this.bufferedTrack;al({name:t,lang:i,assocLang:s,characteristics:r,audioCodec:a,channels:o},e,Ua)||(yy(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(S.AUDIO_TRACK_SWITCHED,He({},e))}}class mx extends Bi{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const s=t==null?void 0:t.renditionReports;if(s){let r=-1;for(let a=0;a<s.length;a++){const o=s[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),l=o.URI||""}if(l===e){r=a;break}else l===e.substring(0,l.length)&&(r=a)}if(r!==-1){const a=s[r],o=parseInt(a["LAST-MSN"])||t.lastPartSn;let l=parseInt(a["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&h>t.partTarget&&(l+=1)}const c=i&&qR(i);return new rI(o,l>=0?l:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:s,stats:r}=t,a=self.performance.now(),o=r.loading.first?Math.max(0,a-r.loading.first):0;s.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==s.appliedTimelineOffset){const h=Math.max(l||0,0);s.appliedTimelineOffset=h,s.fragments.forEach(d=>{d.setStart(d.playlistOffset+h)})}if(s.live||i!=null&&i.live){const h="levelInfo"in t?t.levelInfo:t.track;if(s.reloaded(i),i&&s.fragments.length>0){bQ(i,s,this);const E=s.playlistParsingError;if(E){this.warn(E);const _=this.hls;if(!_.config.ignorePlaylistParsingErrors){var c;const{networkDetails:x}=t;_.trigger(S.ERROR,{type:ee.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:E,reason:E.message,level:t.level||void 0,parent:(c=s.fragments[0])==null?void 0:c.type,networkDetails:x,stats:r});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=r.loading.start);const d=this.hls.mainForwardBufferInfo,f=d?d.end-d.len:0,g=(s.edge-f)*1e3,y=w7(s,g);if(s.requestScheduled+y<a?s.requestScheduled=a:s.requestScheduled+=y,this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),!this.canLoad||!s.live)return;let v,T,b;if(s.canBlockReload&&s.endSN&&s.advanced){const E=this.hls.config.lowLatencyMode,_=s.lastPartSn,x=s.endSN,w=s.lastPartIndex,R=w!==-1,C=_===x;R?C?(T=x+1,b=E?0:w):(T=_,b=E?w+1:s.maxPartIndex):T=x+1;const k=s.age,P=k+s.ageHeader;let I=Math.min(P-s.partTarget,s.targetduration*1.5);if(I>0){if(P>s.targetduration*3)this.log(`Playlist last advanced ${k.toFixed(2)}s ago. Omitting segment and part directives.`),T=void 0,b=void 0;else if(i!=null&&i.tuneInGoal&&P-s.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${I} with playlist age: ${s.age}`),I=0;else{const O=Math.floor(I/s.targetduration);if(T+=O,b!==void 0){const G=Math.round(I%s.targetduration/s.partTarget);b+=G}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${k.toFixed(2)}s goal: ${I} skip sn ${O} to part ${b}`)}s.tuneInGoal=I}if(v=this.getDeliveryDirectives(s,t.deliveryDirectives,T,b),E||!C){s.requestScheduled=a,this.loadingPlaylist(h,v);return}}else(s.canBlockReload||s.canSkipUntil)&&(v=this.getDeliveryDirectives(s,t.deliveryDirectives,T,b));v&&T!==void 0&&s.canBlockReload&&(s.requestScheduled=r.loading.first+Math.max(y-o*2,y/2)),this.scheduleLoading(h,v,s)}else this.clearTimer()}scheduleLoading(e,t,i){const s=i||e.details;if(!s){this.loadingPlaylist(e,t);return}const r=self.performance.now(),a=s.requestScheduled;if(r>=a){this.loadingPlaylist(e,t);return}const o=a-r;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,s){let r=qR(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,s=t.part,r=Ch.No),new rI(i,s,r)}checkRetry(e){const t=e.details,i=vy(e),s=e.errorAction,{action:r,retryCount:a=0,retryConfig:o}=s||{},l=!!s&&!!o&&(r===Et.RetryRequest||!s.resolved&&r===Et.SendAlternateToPenaltyBox);if(l){var c;if(a>=o.maxNumRetry)return!1;if(i&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=Jk(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,s.resolved=!0}return l}}function eB(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!Kh(n[t].attrs,e[t].attrs))return!1;return!0}function Kh(n,e,t){const i=n["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>n[s]!==e[s])}function fI(n,e){return e.label.toLowerCase()===n.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(n.lang||"").toLowerCase())}class tB extends mx{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s){this.warn(`Audio track with id:${i} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(s==null?void 0:s.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(s==null?void 0:s.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(f=>!i||i.indexOf(f.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(f=>f.default)&&(this.selectDefaultTrack=!1),o.forEach((f,g)=>{f.id=g});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!r&&l){const f=Ws(l,o,Ua);if(f>-1)r=o[f];else{const g=Ws(l,this.tracks);r=this.tracks[g]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(S.AUDIO_TRACKS_UPDATED,h);const d=this.trackId;if(c!==-1&&d===-1)this.setAudioTrack(c);else if(o.length&&d===-1){var a;const f=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(f.message),this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}}onError(e,t){t.fatal||!t.context||t.context.type===xe.AUDIO_TRACK&&t.context.
vendor: 8,871 bytes, lines 64-67
64id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&al(e,s,Ua))return s;const r=Ws(e,this.tracksInGroup,Ua);if(r>-1){const a=this.tracksInGroup[r];return this.setAudioTrack(r),a}else if(s){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=Gz(e,t.levels,i,a,Ua);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Ws(e,i);if(a>-1)return i[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(S.AUDIO_TRACK_SWITCHING,He({},s)),r))return;const a=this.switchParams(s.url,i==null?void 0:i.details,s.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const s=t[i];if(!(this.selectDefaultTrack&&!s.default)&&(!e||al(e,s,Ua)))return i}if(e){const{name:i,lang:s,assocLang:r,characteristics:a,audioCodec:o,channels:l}=e;for(let c=0;c<t.length;c++){const h=t[c];if(al({name:i,lang:s,assocLang:r,characteristics:a,audioCodec:o,channels:l},h,Ua))return c}for(let c=0;c<t.length;c++){const h=t[c];if(Kh(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const h=t[c];if(Kh(e.attrs,h.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&yy(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,s=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,o=a==null?void 0:a.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${r}`),this.hls.trigger(S.AUDIO_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:t||null,track:e})}}class CX{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const s=this.queues[t];s.push(e),s.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const s=t[0];try{s.execute()}catch(r){var i;if(s.onError(r),this.queues===null||this.tracks===null)return;const a=(i=this.tracks[e])==null?void 0:i.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
65${this.list("video")}
66${this.list("audio")}
67${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],s=i==null?void 0:i.buffer;return s?`SourceBuffer${s.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const CP=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,iB="HlsJsTrackRemovedError";class IX extends Error{constructor(e){super(e),this.name=iB}}class sB extends Bi{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var s;this.hls&&((s=this.mediaSource)==null?void 0:s.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:s,mediaSource:r}=this;i&&this.log("Media source opened"),!(!s||!r)&&(r.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(S.MEDIA_ATTACHED,{media:s,mediaSource:r}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:s}=this;i!==s&&this.error(`Media element src was set while attaching MediaSource (${s} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=nz(Jn(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_APPENDING,this.onBufferAppending,this),e.on(S.BUFFER_CODECS,this.onBufferCodecs,this),e.on(S.BUFFER_EOS,this.onBufferEos,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.FRAG_PARSED,this.onFragParsed,this),e.on(S.FRAG_CHANGED,this.onFragChanged,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_APPENDING,this.onBufferAppending,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_EOS,this.onBufferEos,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.FRAG_PARSED,this.onFragParsed,this),e.off(S.FRAG_CHANGED,this.onFragChanged,this),e.off(S.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const r=this.isUpdating();r||this.operationQueue.removeBlockers();const a=this.isQueued();(r||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${r?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===t?We(i,s.tracks):this.sourceBuffers.forEach(r=>{const[a]=r;a&&(i[a]=We({},this.tracks[a]),this.removeBuffer(a)),r[0]=r[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s}
67 bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const s=Jn(this.appendSource);if(s){const r=!!t.mediaSource;(r||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new s;if(this.assignMediaSource(a),r)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{i.removeAttribute("src");const l=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||l&&a instanceof l,IP(i),kX(i,o),i.load()}catch{i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,s=t.tracks,r=s?Object.keys(s):null,a=r?r.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(s&&r&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
68required tracks: ${Xe(i,(l,c)=>l==="initSegment"?void 0:c)};
69transfer tracks: ${Xe(s,(l,c)=>l==="initSegment"?void 0:c)}}`),!z8(s,i)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,c=this.details,h=Math.max(l,(c==null?void 0:c.fragments[0].start)||0);if(h-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${h}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(i)}") start time: ${h} currentTime: ${l}`),this.onMediaDetaching(S.MEDIA_DETACHING,{}),this.onMediaAttaching(S.MEDIA_ATTACHING,t),e.currentTime=h;return}this.transferData=void 0,r.forEach(l=>{const c=l,h=s[c];if(h){const d=h.buffer;if(d){const f=this.fragmentTracker,g=h.id;if(f.hasFragments(g)||f.hasParts(g)){const T=me.getBuffered(d);f.detectEvictedFragments(c,T,g,null,!0)}const y=Zx(c),v=[c,d];this.sourceBuffers[y]=v,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,h)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:r,_objectUrl:a}=this;if(r){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=r.readyState==="open";try{const l=r.sourceBuffers;for(let c=l.length;c--;)o&&l[c].abort(),r.removeSourceBuffer(l[c]);o&&r.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}r.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("sourceended",this._onMediaSourceEnded),r.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(r.removeEventListener("startstreaming",this._onStartStreaming),r.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(s.removeEventListener("emptied",this._onMediaEmptied),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(s.removeAttribute("src"),this.appendSource&&IP(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(S.MEDIA_DETACHED,t)}
vendor: 1,598 bytes, line 69
69onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(r){this.warn(`onBufferReset ${e}`,r)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Zx(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new CX(this.tracks)}onBufferCodecs(e,t){var i;const s=this.tracks,r=Object.keys(t);this.log(`BUFFER_CODECS: "${r}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(s.audio||s.video)||s.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&r.some(l=>!s[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${r}" SourceBuffers`);return}r.forEach(l=>{var c,h;const d=t[l],{id:f,codec:g,levelCodec:y,container:v,metadata:T,supplemental:b}=d;let E=s[l];const _=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[l],x=_!=null&&_.buffer?_:E,w=(x==null?void 0:x.pendingCodec)||(x==null?void 0:x.codec),R=x==null?void 0:x.levelCodec;E||(E=s[l]={buffer:void 0,listeners:[],codec:g,supplemental:b,container:v,levelCodec:y,metadata:T,id:f});const C=Ng(w,R),k=C==null?void 0:C.replace(CP,"$1");let P=Ng(g,y);const I=(h=P)==null?void 0:h.replace(CP,"$1");P&&C&&k!==I&&(l.slice(0,5)==="audio"&&(P=my(P,this.appendSource)),this.log(`switching codec ${w} to ${P}
69`),P!==(E.pendingCodec||E.codec)&&(E.pendingCodec=P),E.container=v,this.appendChangeType(l,v,P))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const s=`${t};codecs=${i}`,r={label:`change-type=${s}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${s}`),o.changeType(s),a.codec=i,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(r,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,s=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,Z.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o;const l=this.tracks.video;(this.lastVideoAppendEnd>s||l!=null&&l.buffer&&me.isBuffered(l.buffer,s)||((o=this.fragmentTracker.getAppendedFrag(s,Z.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:s,type:r,parent:a,frag:o,part:l,chunkMeta:c,offset:h}=t,d=c.buffering[r],{sn:f,cc:g}=o,y=self.performance.now();d.start=y;const v=o.stats.buffering,T=l?l.stats.buffering:null;v.start===0&&(v.start=y),T&&T.start===0&&(T.start=y);const b=i.audio;let E=!1;r==="audio"&&(b==null?void 0:b.container)==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const _=i.video,x=_==null?void 0:_.buffer;if(x&&f!=="initSegment"){const C=l||o,k=this.blockedAudioAppend;if(r==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(_.ending||_.ended)){const I=C.start+C.duration*.05,O=x.buffered,G=this.currentOp("video");!O.length&&!G?this.blockAudio(C):!G&&!me.isBuffered(x,I)&&this.lastVideoAppendEnd<I&&this.blockAudio(C)}else if(r==="video"){const P=C.end;if(k){const I=k.frag.start;(P>I||P<this.lastVideoAppendEnd||me.isBuffered(x,I))&&this.unblockAudio()}this.lastVideoAppendEnd=P}}const w=(l||o).start,R={label:`append-${r}`,execute:()=>{var C;d.executeStart=self.performance.now();const k=(C=this.tracks[r])==null?void 0:C.buffer;k&&(E?this.updateTimestampOffset(k,w,.1,r,f,g):h!==void 0&&X(h)&&this.updateTimestampOffset(k,h,1e-6,r,f,g)),this.appendExecutor(s,r)},onStart:()=>{},onComplete:()=>{const C=self.performance.now();d.executeEnd=d.end=C,v.first===0&&(v.first=C),T&&T.first===0&&(T.first=C);const k={};this.sourceBuffers.forEach(([P,I])=>{P&&(k[P]=me.getBuffered(I))}),this.appendErrors[r]=0,r==="audio"||r==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(S.BUFFER_APPENDED,{type:r,frag:o,part:l,chunkMeta:c,parent:o.type,timeRanges:k})},onError:C=>{var k;const P={type:ee.MEDIA_ERROR,parent:o.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:r,frag:o,part:l,chunkMeta:c,error:C,err:C,fatal:!1},I=(k=this.media)==null?void 0:k.error;if(C.code===DOMException.QUOTA_EXCEEDED_ERR||C.name=="QuotaExceededError"||"quota"in C)P.details=$.BUFFER_FULL_ERROR;else if(C.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)P.errorAction=Vl(!0);else if(C.name===iB&&this.sourceBufferCount===0)P.errorAction=Vl(!0);else{const O=++this.appendErrors[r];this.warn(`Failed ${O}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${r}" sourceBuffer (${I||"no media error"}
69)`),(O>=this.hls.config.appendErrorMaxRetry||I)&&(P.fatal=!0)}this.hls.trigger(S.ERROR,P)}};this.log(`queuing "${r}" append sn: ${f}${l?" p: "+l.index:""} of ${o.type===Z.MAIN?"level":"track"} ${o.level} cc: ${g}`),this.append(R,r,this.isPending(this.tracks[r]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(S.BUFFER_FLUSHED,{type:e})},onError:s=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,s)}}}onBufferFlushing(e,t){const{type:i,startOffset:s,endOffset:r}=t;i?this.append(this.getFlushOp(i,s,r),i):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,s,r),a)})}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],a=s?s.elementaryStreams:i.elementaryStreams;a[Qe.AUDIOVIDEO]?r.push("audiovideo"):(a[Qe.AUDIO]&&r.push("audio"),a[Qe.VIDEO]&&r.push("video"));const o=()=>{const l=self.performance.now();i.stats.buffering.end=l,s&&(s.stats.buffering.end=l);const c=s?s.stats:i.stats;this.hls.trigger(S.FRAG_BUFFERED,{frag:i,part:s,stats:c,id:i.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,r).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const s=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(S.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(S.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===$.BUFFER_APPEND_ERROR&&t.frag){var i;const s=(i=t.errorAction)==null?void 0:i.nextAutoLevel;X(s)&&s!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const s=e.config,r=i.currentTime,a=t.levelTargetDuration,o=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(X(o)&&o>=0){const c=Math.max(o,a),h=Math.floor(r/a)*a-c;this.flushBackBuffer(r,a,h)}const l=s.frontBufferFlushThreshold;if(X(l)&&l>0){const c=Math.max(s.maxBufferLength,l),h=Math.max(c,a),d=Math.floor(r/a)*a+h;this.flushFrontBuffer(r,a,d)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([s,r])=>{if(r){const o=me.getBuffered(r);if(o.length>0&&i>o.start(0)){var a;this.hls.trigger(S.BACK_BUFFER_REACHED,{bufferEnd:i});const l=this.tracks[s];if((a=this.details)!=null&&a.live)this.hls.trigger(S.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(l!=null&&l.ended){this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([s,r])=>{if(r){const a=me.getBuffered(r),o=a.length;if(o<2)return;const l=a.start(o-1),c=a.end(o-1);if(i>l||e>=l&&e<=c)return;this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:s})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const s=t.edge;
vendor: 5,169 bytes, line 69
69if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart),h=Math.max(c,s);return{duration:1/0,start:c,end:h}}return{duration:1/0}}const r=(e=this.overrides)==null?void 0:e.duration;if(r)return X(r)?{duration:r}:null;const a=this.media.duration,o=X(i.duration)?i.duration:0;return s>o&&s>a||!X(a)?{duration:s}:null}updateMediaSource({duration:e,start:t,end:i}){const s=this.mediaSource;!this.media||!s||s.readyState!=="open"||(s.duration!==e&&(X(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),s.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${t}-${i}.`),s.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Xe(i)}`),this.tracksReady){var s;const r=(s=this.transferData)==null?void 0:s.tracks;r&&Object.keys(r).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const s=this.tracks[t];e[t]={buffer:i,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(S.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const r in e){const a=r,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),c=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${c})${this.currentOp(a)?" Queued":""} ${Xe(o)}`);try{const h=i.addSourceBuffer(c),d=Zx(a),f=[a,h];t[d]=f,o.buffer=h}catch(h){var s;this.error(`error while trying to add sourceBuffer: ${h.message}`),this.shiftAndExecuteNext(a),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[a],this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,sourceBufferName:a,mimeType:c,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let s=e.codec;i&&(t==="video"||t==="audiovideo")&&Uh(i,"video")&&(s=xz(s,i));const r=Ng(s,e.levelCodec);return r?t.slice(0,5)==="audio"?my(r,this.appendSource):r:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const s=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:s,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(r,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(S.BUFFER_FLUSHED,{type:r})})}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.currentOp(e);r&&r.onError(s)}updateTimestampOffset(e,t,i,s,r,a){const o=t-e.timestampOffset;Math.abs(o)>=i&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${t} (sn: ${r} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:s,mediaSource:r}=this,a=this.tracks[e],o=a==null?void 0:a.buffer;if(!s||!r||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=X(s.duration)?s.duration:1/0,c=X(r.duration)?r.duration:1/0,h=Math.max(0,t),d=Math.min(i,l,c);d>h&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${h},${d}] from the ${e} SourceBuffer`),o.remove(h,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],s=i==null?void 0:i.buffer;if(!s)throw new IX(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,s.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}
69`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map(a=>this.appendBlocker(a));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(a=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const s=(i=this.tracks[t])==null?void 0:i.buffer;!s||s.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const s=this.tracks[e];if(!s)return;const r=s.buffer;if(!r)return;const a=i.bind(this,e);s.listeners.push({event:t,listener:a}),r.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(s=>{i.removeEventListener(s.event,s.listener)}),t.listeners.length=0)}}function IP(n){const e=n.querySelectorAll("source");[].slice.call(e).forEach(t=>{n.removeChild(t)})}function kX(n,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,n.appendChild(t)}function Zx(n){return n==="audio"?1:0}class gx{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.BUFFER_CODECS,this.onBufferCodecs,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&X(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((s,r)=>this.isLevelAllowed(s)&&r<=e);return this.clientRect=null,gx.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.
vendor: 4,893 bytes, line 69
69width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const s=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let r=e.length-1;const a=Math.max(t,i);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&s(l,e[o+1])){r=o;break}}return r}}const RX={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ei=RX,PX={HLS:"h"},DX=PX;class Zs{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof Zs?i:new Zs(i))),this.value=e,this.params=t}}const OX="Dict";function MX(n){return Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":typeof n=="object"?JSON.stringify(n):String(n)}function $X(n,e,t,i){return new Error(`failed to ${n} "${MX(e)}" as ${t}`,{cause:i})}function Js(n,e,t){return $X("serialize",n,e,t)}class nB{constructor(e){this.description=e}}const kP="Bare Item",NX="Boolean";function FX(n){if(typeof n!="boolean")throw Js(n,NX);return n?"?1":"?0"}function BX(n){return btoa(String.fromCharCode(...n))}const UX="Byte Sequence";function VX(n){if(ArrayBuffer.isView(n)===!1)throw Js(n,UX);return`:${BX(n)}:`}const HX="Integer";function qX(n){return n<-999999999999999||999999999999999<n}function rB(n){if(qX(n))throw Js(n,HX);return n.toString()}function GX(n){return`@${rB(n.getTime()/1e3)}`}function aB(n,e){if(n<0)return-aB(-n,e);const t=Math.pow(10,e);if(Math.abs(n*t%1-.5)<Number.EPSILON){const s=Math.floor(n*t);return(s%2===0?s:s+1)/t}else return Math.round(n*t)/t}const KX="Decimal";function jX(n){const e=aB(n,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Js(n,KX);const t=e.toString();return t.includes(".")?t:`${t}.0`}const WX="String",YX=/[\x00-\x1f\x7f]+/;function zX(n){if(YX.test(n))throw Js(n,WX);return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function QX(n){return n.description||n.toString().slice(7,-1)}const XX="Token";function RP(n){const e=QX(n);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Js(e,XX);return e}function pI(n){switch(typeof n){case"number":if(!X(n))throw Js(n,kP);return Number.isInteger(n)?rB(n):jX(n);case"string":return zX(n);case"symbol":return RP(n);case"boolean":return FX(n);case"object":if(n instanceof Date)return GX(n);if(n instanceof Uint8Array)return VX(n);if(n instanceof nB)return RP(n);default:throw Js(n,kP)}}const ZX="Key";function mI(n){if(/^[a-z*][a-z0-9\-_.*]*$/.test(n)===!1)throw Js(n,ZX);return n}function d3(n){return n==null?"":Object.entries(n).map(([e,t])=>t===!0?`;${mI(e)}`:`;${mI(e)}=${pI(t)}`).join("")}function oB(n){return n instanceof Zs?`${pI(n.value)}${d3(n.params)}`:pI(n)}function JX(n){return`(${n.value.map(oB).join(" ")})${d3(n.params)}`}function eZ(n,e={whitespace:!0}){if(typeof n!="object"||n==null)throw Js(n,OX);const t=n instanceof Map?n.entries():Object.entries(n),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([s,r])=>{r instanceof Zs||(r=new Zs(r));let a=mI(s);return r.value===!0?a+=d3(r.params):(a+="=",Array.isArray(r.value)?a+=JX(r):a+=oB(r)),a}).join(`,${i}`)}function lB(n,e){return eZ(n,e)}const vs="CMCD-Object",ct="CMCD-Request",Ra="CMCD-Session",ar="CMCD-Status",tZ={br:vs,ab:vs,d:vs,ot:vs,tb:vs,tpb:vs,lb:vs,tab:vs,lab:vs,url:vs,pb:ct,bl:ct,tbl:ct,dl:ct,ltc:ct,mtp:ct,nor:ct,nrr:ct,rc:ct,sn:ct,sta:ct,su:ct,ttfb:ct,ttfbb:ct,ttlb:ct,cmsdd:ct,cmsds:ct,smrt:ct,df:ct,cs:ct,ts:ct,cid:Ra,pr:Ra,sf:Ra,sid:Ra,st:Ra,v:Ra,msd:Ra,bs:ar,bsd:ar,cdn:ar,rtp:ar,bg:ar,pt:ar,ec:ar,e:ar},iZ={REQUEST:ct};function sZ(n){return Object.keys(n).reduce((e,t)=>{var i;return(i=n[t])===null||i===void 0||i.forEach(s=>e[s]=t),e},{})}function nZ(n,e){const t={};if(!n)return t;const i=Object.keys(n),s=e?sZ(e):{};return i.reduce((r,a)=>{var o;const l=tZ[a]||s[a]||iZ.REQUEST,c=(o=r[l])!==null&&o!==void 0?o:r[l]={};return c[a]=n[a],r},t)}function rZ(n){return["ot","sf","st","e","sta"].includes(n)}function aZ(n){return typeof n=="number"?X(n):n!=null&&n!==""&&n!==!1}const cB="event";function oZ(n,e){const t=new URL(n),i=new URL(e);if(t.origin!==i.origin)return n;const s=t.pathname.split("/").slice(1),r=i.pathname.split("/").slice(1,-1);for(;s[0]===r[0];)s.shift(),r.shift();for(;r.length;)r.shift(),s.unshift("..");return s.join("/")+t.search+t.hash}const Vg=n=>Math.round(n),gI=(n,e)=>Array.isArray(n)?n.map(t=>gI(t,e)):n instanceof Zs&&typeof n.value=="string"?new Zs(gI(n.value,e),n.params):(e.baseUrl&&(n=oZ(n,e.baseUrl)),e.ver
69sion===1?encodeURIComponent(n):n),Xm=n=>Vg(n/100)*100,lZ=(n,e)=>{let t=n;return e.version>=2&&(n instanceof Zs&&typeof n.value=="string"?t=new Zs([n]):typeof n=="string"&&(t=[n])),gI(t,e)},cZ={br:Vg,d:Vg,bl:Xm,dl:Xm,mtp:Xm,nor:lZ,rtp:Xm,tb:Vg},uB="request",hB="response",f3=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],uZ=["e"],hZ=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function yx(n){return hZ.test(n)}function dZ(n){return f3.includes(n)||uZ.includes(n)||yx(n)}const dB=["d","dl","nor","ot","rtp","su"];function fZ(n){return f3.includes(n)||dB.includes(n)||yx(n)}const pZ=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function mZ(n){return f3.includes(n)||dB.includes(n)||pZ.includes(n)||yx(n)}const gZ=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function yZ(n){return gZ.includes(n)||yx(n)}const vZ={[hB]:mZ,[cB]:dZ,[uB]:fZ};function fB(n,e={}){const t={};if(n==null||typeof n!="object")return t;const i=e.version||n.v||1,s=e.reportingMode||uB,r=i===1?yZ:vZ[s];let a=Object.keys(n).filter(r);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=s===hB||s===cB;l&&!a.includes("ts")&&a.push("ts"),i>1&&!a.includes("v")&&a.push("v");const c=We({},cZ,e.formatters),h={version:i,reportingMode:s,baseUrl:e.baseUrl};return a.sort().forEach(d=>{let f=n[d];const g=c[d];if(typeof g=="function"&&(f=g(f,h)),d==="v"){if(i===1)return;f=i}d=="pr"&&f===1||(l&&d==="ts"&&!X(f)&&(f=Date.now()),aZ(f)&&(rZ(d)&&typeof f=="string"&&(f=new nB(f)),t[d]=f))}),t}function TZ(n,e={}){const t={};if(!n)return t;const i=fB(n,e),s=nZ(i,e==null?void 0:e.customHeaderMap);return Object.entries(s).reduce((r,[a,o])=>{const l=lB(o,{whitespace:!1});return l&&(r[a]=l),r},t)}function bZ(n,e,t){return We(n,TZ(e,t))}const EZ="CMCD";function SZ(n,e={}){return n?lB(fB(n,e),{whitespace:!1}):""}function _Z(n,e={}){if(!n)return"";const t=SZ(n,e);return encodeURIComponent(t)}function AZ(n,e={}){if(!n)return"";const t=_Z(n,e);return`${EZ}=${t}`}const PP=/CMCD=[^&#]+/;function xZ(n,e,t){const i=AZ(e,t);if(!i)return n;if(PP.test(n))return n.replace(PP,i);const s=n.includes("?")?"&":"?";return`${n}${s}${i}`}class pB{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:ei.MANIFEST,su:!this.initialized})}catch(r){this.hls.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=s=>{try{const{frag:r,part:a}=s,o=this.hls.levels[r.level],l=this.getObjectType(r),c={d:(a||r).duration*1e3,ot:l};(l===ei.VIDEO||l===ei.AUDIO||l==ei.MUXED)&&(c.br=o.bitrate/1e3,c.tb=this.getTopBandwidth(l)/1e3,c.bl=this.getBufferLength(l));const h=a?this.getNextPart(a):this.getNextFrag(r);h!=null&&h.url&&h.url!==r.url&&(c.nor=h.url),this.apply(s,c)}catch(r){this.hls.logger.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHED,this.onMediaDetached,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHED,this.onMediaDetached,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:DX.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){We(t,this.createData());const i=t.ot===ei.INIT||t.ot===ei.VIDEO||t.ot===ei.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((a,o)=>(s.includes(o)&&(a[o]=t[o]),a),{}));const r={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),bZ(e.headers,t,r)):e.url=xZ(e.url,t,r)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const s=e.sn-i.startSN;return i.fragments[s+1]}}getNextPart(e){var t;const{index:i,fragment:s}=e,r=(t=this.hls.levels[s.level])==null||(t=t.details)==null?void 0:t.partList;if(r){const{sn:a}=s;for(let o=r.length-1;o>=0;
vendor: 4,772 bytes, line 69
69o--){const l=r[o];if(l.index===i&&l.fragment.sn===a)return r[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ei.TIMED_TEXT;if(e.sn==="initSegment")return ei.INIT;if(t==="audio")return ei.AUDIO;if(t==="main")return this.hls.audioTracks.length?ei.VIDEO:ei.MUXED}getTopBandwidth(e){let t=0,i;const s=this.hls;if(e===ei.AUDIO)i=s.audioTracks;else{const r=s.maxAutoLevel,a=r>-1?r+1:s.levels.length;i=s.levels.slice(0,a)}return i.forEach(r=>{r.bitrate>t&&(t=r.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===ei.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:me.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,o){t(r),this.loader.load(r,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,a,o){t(r),this.loader.load(r,a,o)}}}}const LZ=3e5;class mB extends Bi{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===Et.SendAlternateToPenaltyBox&&i.flags===ci.MoveAllAlternatesMatchingHost){const s=this.levels;let r=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:c}=t.context;o&&s?a=this.getPathwayForGroupId(o,c,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!r&&s&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==a),t.details===$.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.length} priorities: ${Xe(r)} penalized: ${Xe(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const i=this.penalizedPathways,s=performance.now();
vendor: 4,390 bytes, line 69
69Object.keys(i).forEach(r=>{s-i[r]>LZ&&delete i[r]});for(let r=0;r<e.length;r++){const a=e[r];if(a in i)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,k7(t),this.hls.trigger(S.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r<s.length;r++)if(t===xe.AUDIO_TRACK&&s[r].hasAudioGroup(e)||t===xe.SUBTITLE_TRACK&&s[r].hasSubtitleGroup(e))return s[r].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},s={};e.forEach(r=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=r;if(t.some(h=>h.pathwayId===a))return;const c=this.getLevelsForPathway(o).map(h=>{const d=new st(h.attrs);d["PATHWAY-ID"]=a;const f=d.AUDIO&&`${d.AUDIO}_clone_${a}`,g=d.SUBTITLES&&`${d.SUBTITLES}_clone_${a}`;f&&(i[d.AUDIO]=f,d.AUDIO=f),g&&(s[d.SUBTITLES]=g,d.SUBTITLES=g);const y=gB(h.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),v=new ju({attrs:d,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:y,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let T=1;T<h.audioGroups.length;T++)v.addGroupId("audio",`${h.audioGroups[T]}_clone_${a}`);if(h.subtitleGroups)for(let T=1;T<h.subtitleGroups.length;T++)v.addGroupId("text",`${h.subtitleGroups[T]}_clone_${a}`);return v});t.push(...c),DP(this.audioTracks,i,l,a),DP(this.subtitleTracks,s,l,a)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+h)}const r={responseType:"json",url:s.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(h,d,f,g)=>{this.log(`Loaded steering manifest: "${s}"`);const y=h.data;if((y==null?void 0:y.VERSION)!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":v,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":b}=y;if(v)try{this.uri=new self.URL(v,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${v}`);return}this.scheduleRefresh(this.uri||f.url),T&&this.clonePathways(T);const E={steeringManifest:y,url:s.toString()};this.hls.trigger(S.STEERING_MANIFEST_LOADED,E),b&&this.updatePathwayPriority(b)},onError:(h,d,f,g)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${d.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let y=this.timeToLoad*1e3;if(h.code===429){const v=this.loader;if(typeof(v==null?void 0:v.getResponseHeader)=="function"){const T=v.getResponseHeader("Retry-After");T&&(y=parseFloat(T)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,y)},onTimeout:(h,d,f)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,l,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const s=(i=this.hls)==null?void 0:i.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function DP(n,e,t,i){n&&Object.keys(e).forEach(s=>{const r=n.filter(a=>a.groupId===s).map(a=>{const o=We({},a);return o.details=void 0,o.attrs=new st(o.attrs),o.url=o.attrs.URI=gB(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=i,o});n.push(...r)})}function gB(n,e,t,i){const{HOST:s,PARAMS:r,[t]:a}=i;let o;e&&(o=a==null?void 0:a[e],o&&(n=o));const l=new self.URL(n);
69return s&&!o&&(l.host=s),r&&Object.keys(r).sort().forEach(c=>{c&&l.searchParams.set(c,r[c])}),l.href}class ol extends Bi{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=ol.CDMCleanupPromise?[ol.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:s}=t,r=`"${t.type}" event: init data type: "${i}"`;if(this.debug(r),s!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=Th(this.config));const o=a.map(Gx).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=Fg(a);if(i!=="sinf"||o!==nt.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let l;try{const g=bt(new Uint8Array(s)),y=s3(JSON.parse(g).sinf),v=n7(y);if(!v)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(v.subarray(8,24))}catch(g){this.warn(`${r} Failed to parse sinf: ${g}`);return}const c=Bt(l),{keyIdToKeySessionPromise:h,mediaKeySessions:d}=this;let f=h[c];for(let g=0;g<d.length;g++){const y=d[g],v=y.decryptdata;if(!v.keyId)continue;const T=Bt(v.keyId);if(by(l,v.keyId)||v.uri.replace(/-/g,"").indexOf(c)!==-1){if(f=h[T],!f)continue;if(v.pssh)break;delete h[T],v.pssh=new Uint8Array(s),v.keyId=l,f=h[c]=f.then(()=>this.generateRequestWithPreferredKeySession(y,i,s,"encrypted-event-key-match")),f.catch(b=>this.handleError(b));break}}f||this.handleError(new Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(S.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(S.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t==null?void 0:t[e];if(s)return s.licenseUrl;if(e===nt.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t==null?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(a,o,l)=>!!a&&l.indexOf(a)===o,s=t.map(a=>a.audioCodec).filter(i),r=t.map(a=>a.videoCodec).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise((a,o)=>{const l=c=>{const h=c.shift();this.getMediaKeysPromise(h,s,r).then(d=>a({keySystem:h,mediaKeys:d})).catch(d=>{c.length?l(c):d instanceof gi?o(d):o(new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${i}`;return n3===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return i(e,t)}getMediaKeysPromise(e,t,i){var s;const r=hQ(e,t,i,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(s=a)==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Xe(r)}`),o=this.requestMediaKeySystemAccess(e,r);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),o.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const h=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=l.mediaKeys=c.createMediaKeys().then(f=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,h.then(g=>g?this.setMediaKeysServerCertificate(f,e,g):f)));return d.catch(f=>{this.error(`Failed to create media-keys for "${e}"}: ${f}`)}),d})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${Bt(e.keyId||[])} keyUri: ${e.uri}`);
vendor: 19,191 bytes, lines 69-70
69const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=Zm(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${Bt(e.decryptdata.keyId||[])}
70      } (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Gx(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:s})=>{const r=Gx(s);r?t(r):i(new Error(`Unable to find format for key-system "${s}"`))}).catch(i)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Th(this.config),i=e.map(Fg).filter(s=>!!s&&t.indexOf(s)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const s=wZ(e,t[i]);if(s)return s}}loadKey(e){const t=e.keyInfo.decryptdata,i=Zm(t),s=this.bannedKeyIds[i];if(s||this.getKeyStatus(t)==="internal-error"){const o=OP(s||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);const a=this.keyIdToKeySessionPromise[i];if(!a){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:l,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(l,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:t}))))).then(l=>{const c="cenc",h=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,c,h,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[i]=o,o}return a.catch(o=>{if(o instanceof gi){const l=He({},o.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const c=new gi(l,o.message);this.handleError(c,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof gi){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${Bt(i.keyId||[])})`:""}`),this.hls.trigger(S.ERROR,e.data)}else this.error(e.message),this.hls.trigger(S.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Zm(e),i=this.keyIdToKeySessionPromise[t];if(!i){const s=Fg(e.keyFormat),r=s?[s]:Th(this.config);return this.attemptKeySystemAccess(r)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Th(this.config)),e.length===0)throw new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Xe({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((r,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(r).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>i.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,i,s){var r;const a=(r=this.config.drmSystems)==null||(r=r[e.keySystem])==null?void 0:r.generateRequest;if(a)try{const y=a.call(this.hls,t,i,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,i=y.initData?y.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(y){if(this.warn(y.message),this.hls&&this.hls.config.debug)throw y}if(i===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const o=Zm(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${s}" keyId: ${o} URI: ${l} (init data type: ${t} length: ${i.byteLength})`);const c=new r3,h=e._onmessage=y=>{const v=e.mediaKeysSession;if(!v){c.emit("error",new Error("invalid state"));return}const{messageType:T,message:b}=y;this.log(`"${T}" message event for session "${v.sessionId}" message size: ${b.byteLength}`),T==="license-request"||T==="license-renewal"?this.renewLicense(e,b).catch(E=>{c.eventNames().length?c.emit("error",E):this.handleError(E)}):T==="license-release"?e.keySystem===nt.FAIRPLAY&&this.updateKeySession(e,lI("acknowledged")).then(()=>this.removeSession(e)).catch(E=>this.handleError(E)):this.warn(`unhandled media key message type "${T}"`)},d=(y,v)=>{v.keyStatus=y;let T;y.startsWith("usable")?c.emit("resolved"):y==="internal-error"||y==="output-restricted"||y==="output-downscaled"?T=OP(y,v.decryptdata):y==="expired"?T=new Error(`key expired (keyId: ${o})`):y==="released"?T=new Error("key released"):y==="status-pending"||this.warn(`unhandled key status change "${y}" (keyId: ${o})`),T&&(c.eventNames().length?c.emit("error",T):this.handleError(T))},f=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const T=this.getKeyStatuses(e);if(!Object.keys(T).some(x=>T[x]!=="status-pending"))return;if(T[o]==="expired"){this.log(`Expired key ${Xe(T)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let E=T[o];if(E)d(E,e);else{var _;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(_=e.keyStatusTimeouts)[o]||(_[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const w=this.getKeyStatus(e.decryptdata);if(w&&w!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${w} from other session.`),d(w,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),E="internal-error",d(E,e)},1e3)),this.log(`No status for keyId ${o} (${Xe(T)}).`)}};Jt(e.mediaKeysSession,"message",h),Jt(e.mediaKeysSession,"keystatuseschange",f);const g=new Promise((y,v)=>{c.on("error",v),c.on("resolved",y)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`)}).catch(y=>{throw new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:y,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>g).catch(y=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw y}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,s)=>{if(typeof s=="string"&&typeof i=="object"){const o=s;s=i,i=o}const r="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(e.keySystem===nt.PLAYREADY&&r.length===16){const o=Bt(r);t[o]=i,E7(r)}const a=Bt(r);i==="internal-error"&&(this.bannedKeyIds[a]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=i}),t}fetchServerCertificate(e){const t=this.config,i=t.loader,s=new i(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:r},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,g,y,v)=>{a(f.data)},onError:(f,g,y,v)=>{o(new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:He({url:l.url,data:void 0},f)},`"${e}" certificate request failed (${r}). Status: ${f.code} (${f.text})`))},onTimeout:(f,g,y)=>{o(new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(f,g,y)=>{o(new Error("aborted"))}};s.load(l,h,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((s,r)=>{e.setServerCertificate(i).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),s(e)}).catch(a=>{r(new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(s=>{throw new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:s,fatal:!1},s.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=new DOMParser().parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let h;for(let d=0,f=r.length;d<f;d++){var a,o;h=r[d];const g=(a=h.querySelector("name"))==null?void 0:a.textContent,y=(o=h.querySelector("value"))==null?void 0:o.textContent;g&&y&&e.setRequestHeader(g,y)}}const l=s.querySelector("Challenge"),c=l==null?void 0:l.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return lI(atob(c))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)}).catch(a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((s,r)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const c=this.config.licenseResponseCallback;if(c)try{l=c.call(this.hls,o,a,e)}catch(h){this.error(h)}s(l)}else{const l=i.errorRetry,c=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)r(new gi({type:ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:c})=>{e.keySystem==nt.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(l,c)),l.send(c)}).catch(r)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,Jt(i,"encrypted",this.onMediaEncrypted),Jt(i,"waitingforkey",this.onWaitingForKey);const s=this.mediaResolved;s?s():this.mediaKeys=i.mediaKeys}onMediaDetached(){const e=this.media;e&&(hi(e,"encrypted",this.onMediaEncrypted),hi(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const i=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Xn.clearKeyUriToKeyIdMap();const r=s.length;ol.CDMCleanupPromise=Promise.all(s.map(a=>this.removeSession(a)).concat((i==null||(e=i.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{r&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((s,r)=>(s.indexOf(r.keyFormat)===-1&&s.push(r.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:s}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${Bt((s==null?void 0:s.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(c=>self.clearTimeout(a[c]));const{drmSystemOptions:o}=this.config;return(fQ(o)?new Promise((c,h)=>{self.setTimeout(()=>h(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(h)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}return Promise.resolve()}}ol.CDMCleanupPromise=void 0;function Zm(n){if(!n)throw new Error("Could not read keyId of undefined decryptdata");if(n.keyId===null)throw new Error("keyId is null");return Bt(n.keyId)}function wZ(n,e){if(n.keyId&&e.mediaKeysSession.keyStatuses.has(n.keyId))return e.mediaKeysSession.keyStatuses.get(n.keyId);if(n.matches(e.decryptdata))return e.keyStatus}class gi extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function OP(n,e){const t=n==="output-restricted",i=t?$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new gi({type:ee.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${n}"`)}class yB{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const r=s-this.lastTime,a=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/r,c=this.hls;if(c.trigger(S.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:i}),l>0&&a>c.config.fpsDroppedMonitoringThreshold*o){let h=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(S.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function vB(n,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=n,e.dispatchEvent(t)}function TB(n,e){const t=n.mode;if(t==="disabled"&&(n.mode="hidden"),n.cues&&!n.cues.getCueById(e.id))try{if(n.addCue(e),!n.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){qe.debug(`[texttrack-utils]: ${i}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,n.addCue(s)}catch(s){qe.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}t==="disabled"&&(n.mode=t)}function Fl(n,e){const t=n.mode;if(t==="disabled"&&(n.mode="hidden"),n.cues)for(let i=n.cues.length;i--;)e&&n.cues[i].removeEventListener("enter",e),n.removeCue(n.cues[i]);t==="disabled"&&(n.mode=t)}function yI(n,e,t,i){const s=n.mode;if(s==="disabled"&&(n.mode="hidden"),n.cues&&n.cues.length>0){const r=IZ(n.cues,e,t);for(let a=0;a<r.length;a++)(!i||i(r[a]))&&n.removeCue(r[a])}s==="disabled"&&(n.mode=s)}function CZ(n,e){if(e<=n[0].startTime)return 0;const t=n.length-1;if(e>n[t].endTime)return-1;let i=0,s=t,r;for(;i<=s;
vendor: 6,151 bytes, line 70
70)if(r=Math.floor((s+i)/2),e<n[r].startTime)s=r-1;else if(e>n[r].startTime&&i<t)i=r+1;else return r;return n[i].startTime-e<e-n[s].startTime?i:s}function IZ(n,e,t){const i=[],s=CZ(n,e);if(s>-1)for(let r=s,a=n.length;r<a;r++){const o=n[r];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Hg(n){const e=[];for(let t=0;t<n.length;t++){const i=n[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(n[t])}return e}class bB extends mx{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Hg(this.media.textTracks);for(let r=0;r<i.length;r++)if(i[r].mode==="hidden")t=i[r];else if(i[r].mode==="showing"){t=i[r];break}const s=this.findTrackForTextTrack(t);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const i=this.media;if(!i)return;const s=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,s)return;Hg(i.textTracks).forEach(a=>{Fl(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s){this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(s==null?void 0:s.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(s==null?void 0:s.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!i||i.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,d)=>{h.id=d});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!r&&o){this.selectDefaultTrack=!1;const h=Ws(o,a);if(h>-1)r=a[h];else{const d=Ws(o,this.tracks);r=this.tracks[d]}}let l=this.findTrackId(r);l===-1&&r&&(l=this.findTrackId(null));const c={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED,c),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s<t.length;s++){const r=t[s];if(!(i&&!r.default||!i&&!e)&&(!e||al(r,e)))return s}if(e){for(let s=0;s<t.length;s++){const r=t[s];if(Kh(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<t.length;s++){const r=t[s];if(Kh(e.attrs,r.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const s=t[i];if(fI(s,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===xe.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;
vendor: 18,364 bytes, line 70
70if(i&&al(e,i))return i;const s=Ws(e,this.tracksInGroup);if(s>-1){const r=this.tracksInGroup[s];return this.setSubtitleTrack(s),r}else{if(i)return null;{const r=Ws(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,s=e.groupId,r=this.getUrlWithDirectives(e.url,t),a=e.details,o=a==null?void 0:a.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${r}`),this.hls.trigger(S.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Hg(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter(r=>fI(i,r))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==s&&(r.mode="disabled")}),s){const r=this.subtitleDisplay?"showing":"hidden";s.mode!==r&&(s.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!X(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:l,type:c,url:h}=s;this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:c,url:h});const d=this.switchParams(s.url,i==null?void 0:i.details,s.details);this.loadPlaylist(d)}}function kZ(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?r:r&3|8).toString(16)})}}}function Rh(n){let e=5381,t=n.length;for(;t;)e=e*33^n.charCodeAt(--t);return(e>>>0).toString()}const ql=.025;let Ay=function(n){return n[n.Point=0]="Point",n[n.Range=1]="Range",n}({});function RZ(n,e,t){return`${n.identifier}-${t+1}-${Rh(e)}`}class PZ{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return Jx(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=Jx(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=X(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return Jx(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<ql))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Ay.Range:Ay.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return DZ(this)}}function Jx(n,e){return n-e.start<e.duration/2&&!(Math.abs(n-(e.start+e.duration))<ql)?e.start:e.start+e.duration}function EB(n,e,t){const i=new self.URL(n,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function eL(n,e){for(;(t=n.assetList[++e])!=null&&t.error;)var t;return e}function DZ(n){return`["${n.identifier}" ${n.cue.pre?"<pre>":n.cue.post?"<post>":""}${n.timelineStart.toFixed(2)}-${n.resumeTime.toFixed(2)}]`}function Ol(n){const e=n.timelineStart,t=n.duration||0;return`["${n.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class OZ{constructor(e,t,i,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(S.PLAYOUT_LIMIT_REACHED,{})};const r=this.hls=new e(t);this.interstitial=i,this.assetItem=s;const a=()=>{this.hasDetails=!0};r.once(S.LEVEL_LOADED,a),r.once(S.AUDIO_TRACK_LOADED,a),r.once(S.SUBTITLE_TRACK_LOADED,a),r.on(S.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&r.on(S.BUFFER_APPENDED,()=>{const h=this.bufferedEnd;this.reachedPlayout(h)&&(this._bufferedEosTime=h,r.trigger(S.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=EB(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),s=this.timelineOffset,r=me.bufferInfo(e,s,0);return this.getAssetTime(r.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=me.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var s;(s=this.hls)==null||s.on(e,t)}once(e,t,i){var s;(s=this.hls)==null||s.once(e,t)}off(e,t,i){var s;(s=this.hls)==null||s.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Ol(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const MP=.033;class MZ extends Bi{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,s)=>e<=s.startOffset&&t>s.startOffset?(delete s.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const s=this.items;if(s)for(s[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(r=s[i])!=null&&r.event;){var r;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let s=0;s<i.length;s++){let r=i[s];if(t&&t!=="primary"&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return s}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let s=e;s<=t&&i[s];s++){const r=i[s].event;if(r!=null&&r.restrictions.jump&&!r.appendInPlace)return s}return-1}findEventIndex(e){const t=this.items;if(t)for(let s=t.length;s--;){var i;if(((i=t[s].event)==null?void 0:i.identifier)===e)return s}return-1}findAssetIndex(e,t){const i=e.assetList,s=i.length;if(s>1)for(let r=0;r<s;r++){const a=i[r];if(!a.error){const o=a.timelineStart;if(t===o||t>o&&(t<o+(a.duration||0)||r===s-1))return r}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const i=t.assetList,s=i[i.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:s}=i,r=this.events,a=this.parseDateRanges(s,{url:i.url},t),o=Object.keys(s),l=r?r.filter(c=>!o.includes(c.identifier)):[];a.length&&a.sort((c,h)=>{const d=c.cue.pre,f=c.cue.post,g=h.cue.pre,y=h.cue.post;if(d&&!g)return-1;if(g&&!d||f&&!y)return 1;if(y&&!f)return-1;if(!d&&!g&&!f&&!y){const v=c.startTime,T=h.startTime;if(v!==T)return v-T}return c.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=a,l.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,l)}updateSchedule(e,t=[],i=!1){const s=this.events||[];if(s.length||t.length||this.length<2){const r=this.items,a=this.parseSchedule(s,e);(i||t.length||(r==null?void 0:r.length)!==a.length||a.some((l,c)=>Math.abs(l.playout.start-r[c].playout.start)>.005||Math.abs(l.playout.end-r[c].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,r))}}parseDateRanges(e,t,i){const s=[],r=Object.keys(e);for(let a=0;a<r.length;a++){const o=r[a],l=e[o];if(l.isInterstitial){let c=this.eventMap[o];c?c.setDateRange(l):(c=new PZ(l,t),this.eventMap[o]=c,i===!1&&(c.appendInPlace=i)),s.push(c)}}return s}parseSchedule(e,t){const i=[],s=t.main.details,r=s.live?1/0:s.edge;let a=0;if(e=e.filter(l=>!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,c=0;if(e.forEach((h,d)=>{const f=h.cue.pre,g=h.cue.post,y=e[d-1]||null,v=h.appendInPlace,T=g?r:h.startOffset,b=h.duration,E=h.timelineOccupancy===Ay.Range?b:0,_=h.resumptionOffset,x=(y==null?void 0:y.startTime)===T,w=T+h.cumulativeDuration;let R=v?w+b:T+_;if(f||!g&&T<=0){const k=c;c+=E,h.timelineStart=w;const P=a;a+=b,i.push({event:h,start:w,end:R,playout:{start:P,end:a},integrated:{start:k,end:c}})}else if(T<=r){if(!x){const I=T-l;if(I>MP){const O=l,G=c;c+=I;const j=a;a+=I;const K={previousEvent:e[d-1]||null,nextEvent:h,start:O,end:O+I,playout:{start:j,end:a},integrated:{start:G,end:c}};i.push(K)}else I>0&&y&&(y.cumulativeDuration+=I,i[i.length-1].end=T)}g&&(R=w),h.timelineStart=w;const k=c;c+=E;const P=a;a+=b,i.push({event:h,start:w,end:R,playout:{start:P,end:a},integrated:{start:k,end:c}})}else return;const C=h.resumeTime;g||C>r?l=r:l=C}),l<r){var o;const h=l,d=c,f=r-l;c+=f;const g=a;a+=f,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:l,end:h+f,playout:{start:g,end:a},integrated:{start:d,end:c}})}this.setDurations(r,a,c)}else i.push({previousEvent:null,nextEvent:null,start:0,end:r,playout:{start:0,end:r},integrated:{start:0,end:r}}),this.setDurations(r,r,r);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,s=i.live?1/0:i.edge;let r=0,a=-1;e.forEach((o,l)=>{const c=o.cue.pre,h=o.cue.post,d=c?0:h?s:o.startTime;this.updateAssetDurations(o),a===d?o.cumulativeDuration=r:(r=0,a=d),!h&&o.snapOptions.in&&(o.resumeAnchor=pl(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<MP&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const g=X(o.resumeOffset)?o.resumeOffset:o.duration;r+=g})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,s=e.startTime+e.resumptionOffset;return Math.abs(i-s)>ql?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${s}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(i>=l)return this.log(`"${e.identifier}" resumption ${i} past ${a} playlist end ${l}`),!1;const c=pl(null,o.fragments,i);if(!c)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const h=a==="audio"?.175:0;return Math.abs(c.start-i)<ql+h||Math.abs(c.end-i)<ql+h?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${a} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,s=!1,r=!1;for(let a=0;a<e.assetList.length;a++){const o=e.assetList[a],l=t+i;o.startOffset=i,o.timelineStart=l,s||(s=o.duration===null),r||(r=!!o.error);const c=o.error?0:o.duration||0;i+=c}s&&!r?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Hi(n){return`[${n.event?'"'+n.event.identifier+'"':"primary"}: ${n.start.toFixed(2)}-${n.end.toFixed(2)}]`}class $Z{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let s;try{s=EB(i,this.hls.sessionId,e.baseUrl)}catch(f){const g=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,f,i);this.hls.trigger(S.ERROR,g);return}t&&s.protocol!=="data:"&&s.searchParams.set("_HLS_start_offset",""+t);const r=this.hls.config,a=r.loader,o=new a(r),l={responseType:"json",url:s.href},c=r.interstitialAssetListLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,g,y,v)=>{const T=f.data,b=T==null?void 0:T.ASSETS;if(!Array.isArray(b)){const E=this.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),y.url,g,v);this.hls.trigger(S.ERROR,E);return}e.assetListResponse=T,this.hls.trigger(S.ASSET_LIST_LOADED,{event:e,assetListResponse:T,networkDetails:v})},onError:(f,g,y,v)=>{const T=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${f.code} ${f.text} (${g.url})`),g.url,v,y);this.hls.trigger(S.ERROR,T)},onTimeout:(f,g,y)=>{const v=this.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${g.url})`),g.url,f,y);this.hls.trigger(S.ERROR,v)}};return o.load(l,h,d),this.hls.trigger(S.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,s,r,a){return e.error=i,{type:ee.NETWORK_E
vendor: 2,571 bytes, line 70
70RROR,details:t,fatal:!1,interstitial:e,url:s,error:i,networkDetails:a,stats:r}}}function $P(n){var e;n==null||(e=n.play())==null||e.catch(()=>{})}function Jm(n,e){return`[${n}] Advancing timeline position to ${e}`}class NZ extends Bi{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const s=i-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const a=s<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(i,i-s)&&this.updateSchedule(!0),this.checkBuffer(),a&&i<o.start||i>=o.end){var l;const g=this.findItemIndex(o);let y=this.schedule.findItemIndexAtTime(i);if(y===-1&&(y=g+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${i} (resolving from ${g} to ${y})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&y>g){const v=this.schedule.findJumpRestrictedIndex(g+1,y);if(v>g){this.setSchedulePosition(v);return}}this.setSchedulePosition(y);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(o)){const g=o.event.assetList[0];g&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,g))}return}const h=c.timelineStart,d=c.duration||0;if(a&&i<h||i>=h+d){var f;(f=o.event)!=null&&f.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,c)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const s=this.playingItem;if(!s||this.playingLastItem)return;if(i>=s.end){this.timelinePos=s.end;const o=this.findItemIndex(s);this.setSchedulePosition(o+1)}const r=this.playingAsset;if(!r)return;const a=r.timelineStart+(r.duration||0);i>=a&&this.setScheduleToAssetAtTime(i,r)},this.onScheduleUpdate=(i,s)=>{const r=this.schedule;if(!r)return;
vendor: 41,005 bytes, lines 70-71
70const a=this.playingItem,o=r.events||[],l=r.items||[],c=r.durations,h=i.map(v=>v.identifier),d=!!(o.length||h.length);(d||s)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
71Schedule: ${l.map(v=>Hi(v))} pos: ${this.timelinePos}`),h.length&&this.log(`Removed events ${h}`);let f=null,g=null;a&&(f=this.updateItem(a,this.timelinePos),this.itemsMatch(a,f)?this.playingItem=f:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const y=this.bufferingItem;if(y&&(g=this.updateItem(y,this.bufferedPos),this.itemsMatch(y,g)?this.bufferingItem=g:y.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(y.event,null))),i.forEach(v=>{v.assetList.forEach(T=>{this.clearAssetPlayer(T.identifier,null)})}),this.playerQueue.forEach(v=>{if(v.interstitial.appendInPlace){const T=v.assetItem.timelineStart,b=v.timelineOffset-T;if(b)try{v.timelineOffset=T}catch(E){Math.abs(b)>ql&&this.warn(`${E} ("${v.assetId}" ${v.timelineOffset}->${T})`)}}}),d||s){if(this.hls.trigger(S.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:c,removedIds:h}),this.isInterstitial(a)&&h.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(f,a),y&&g!==f&&this.trimInPlace(g,y),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new $Z(e),this.schedule=new MZ(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(S.MEDIA_ENDED,this.onMediaEnded,this),e.on(S.ERROR,this.onError,this),e.on(S.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(S.MEDIA_ENDED,this.onMediaEnded,this),e.off(S.ERROR,this.onError,this),e.off(S.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){hi(e,"play",this.onPlay),hi(e,"pause",this.onPause),hi(e,"seeking",this.onSeeking),hi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;Jt(i,"seeking",this.onSeeking),Jt(i,"timeupdate",this.onTimeupdate),Jt(i,"play",this.onPlay),Jt(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!s){this.clearScheduleState();const r=this.findItemIndex(i);this.setSchedulePosition(r)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,s=this.media;if(this.media=null,!i&&(s&&this.removeMediaListeners(s),this.detachedData)){const r=this.getBufferingPlayer();r&&(this.log(`Removing schedule state for detachedData and ${r}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,r.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=d=>d&&e.getAssetPlayer(d.identifier),s=(d,f,g,y,v)=>{if(d){let T=d[f].start;const b=d.event;if(b){if(f==="playout"||b.timelineOccupancy!==Ay.Point){const E=i(g);(E==null?void 0:E.interstitial)===b&&(T+=E.assetItem.startOffset+E[v])}}else{const E=y==="bufferedPos"?a():e[y];T+=E-d.start}return T}return 0},r=(d,f)=>{var g;if(d!==0&&f!=="primary"&&(g=e.schedule)!=null&&g.length){var y;const v=e.schedule.findItemIndexAtTime(d),T=(y=e.schedule.items)==null?void 0:y[v];if(T){const b=T[f].start-T.start;return d+b}}return d},a=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var f,g;return(f=e.primaryDetails)!=null&&f.live?e.primaryDetails.edge:((g=e.schedule)==null?void 0:g.durations[d])||0},l=(d,f)=>{var g,y;const v=e.effectivePlayingItem;if(v!=null&&(g=v.event)!=null&&g.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${f}"`);const T=e.effectivePlayingItem,b=e.schedule.findItemIndexAtTime(d,f),E=(y=e.schedule.items)==null?void 0:y[b],_=e.getBufferingPlayer(),x=_==null?void 0:_.interstitial,w=x==null?void 0:x.appendInPlace,R=T&&e.itemsMatch(T,E);if(T&&(w||R)){const C=i(e.playingAsset),k=(C==null?void 0:C.media)||e.primaryMedia;if(k){const P=f==="primary"?k.currentTime:s(T,f,e.playingAsset,"timelinePos","currentTime"),I=d-P,O=(w?P:k.currentTime)+I;if(O>=0&&(!C||w||O<=C.duration)){k.currentTime=O;return}}}if(E){let C=d;if(f!=="primary"){const P=E[f].start,I=d-P;C=E.start+I}const k=!e.isInterstitial(E);if((!e.isInterstitial(T)||T.event.appendInPlace)&&(k||E.event.appendInPlace)){const P=e.media||(w?_==null?void 0:_.media:null);P&&(P.currentTime=C)}else if(T){const P=e.findItemIndex(T);if(b>P){const O=e.schedule.findJumpRestrictedIndex(P+1,b);if(O>P){e.setSchedulePosition(O);return}}let I=0;if(k)e.timelinePos=C,e.checkBuffer();else{const O=E.event.assetList,G=d-(E[f]||E).start;for(let j=O.length;j--;){const K=O[j];if(K.duration&&G>=K.startOffset&&G<K.startOffset+K.duration){I=j;break}}}e.setSchedulePosition(b,I)}}},c=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const f=t();return e.isInterstitial(f)?f:null},h={get bufferedEnd(){const d=t(),f=e.bufferingItem;if(f&&f===d){var g;return s(f,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-f.playout.start||((g=e.bufferingAsset)==null?void 0:g.startOffset)||0}return 0},get currentTime(){const d=c(),f=e.effectivePlayingItem;return f&&f===d?s(f,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-f.playout.start:0},set currentTime(d){const f=c(),g=e.effectivePlayingItem;g&&g===f&&l(d+g.playout.start,"playout")},get duration(){const d=c();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const f=(d=c())==null?void 0:d.event.assetList;return f?f.map(g=>e.getAssetPlayer(g.identifier)):[]},get playingIndex(){var d;const f=(d=c())==null?void 0:d.event;return f&&e.effectivePlayingAsset?f.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return c()?h:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return a()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){l(d,"primary")},get duration(){return o("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){l(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return r(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,f=d==null?void 0:d.event;if(f&&!f.restrictions.skip){const g=e.findItemIndex(d);if(f.appendInPlace){const y=d.playout.start+d.event.duration;l(y+.001,"playout")}else e.advanceAfterAssetEnded(f,g,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(s=this.primaryMedia);const r=(t=s)==null?void 0:t.currentTime;if(!(r===void 0||!X(r)))return r}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,s=e.media;if(i&&s===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&s){this.detachedData={media:s};return}const r=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Xe(r)}`),this.detachedData=r}else t&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(e,t){var i,s;if(e.media===t)return;let r=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,c=(i=this.detachedData)==null?void 0:i.mediaSource;let h;if(a.media)l&&(r=a.transferMedia(),this.detachedData=r),h="Primary";else if(c){const y=this.getBufferingPlayer();y?(r=y.transferMedia(),h=`${y}`):h="detached MediaSource"}else h="detached media";if(!r){if(c)r=this.detachedData,this.log(`using detachedData: MediaSource ${Xe(r)}`);else if(!this.detachedData||a.media===t){const y=this.playerQueue;y.length>1&&y.forEach(v=>{if(o&&v.interstitial.appendInPlace!==l){const T=v.interstitial;this.clearInterstitial(v.interstitial,null),T.appendInPlace=!1,T.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${T}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=r&&"mediaSource"in r&&((s=r.mediaSource)==null?void 0:s.readyState)!=="closed",f=d&&r?r:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${h} (media.currentTime: ${t.currentTime})`);const g=this.schedule;if(f===r&&g){const y=o&&e.assetId===g.assetIdAtEnd;f.overrides={duration:g.duration,endOfStream:!o||y,cueRemoval:!o}}e.attachMedia(f)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e==null?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,s=this.effectivePlayingItem;if(i===-1){const r=this.hls.startPosition;if(this.log(Jm("checkStart",r)),this.timelinePos=r,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(r>=0||!this.primaryLive){const a=this.timelinePos=r>0?r:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(s&&!this.playingItem){const r=e.findItemIndex(s);this.setSchedulePosition(r)}}advanceAssetBuffering(e,t){const i=e.event,s=i.findAssetIndex(t),r=eL(i,s);if(!i.isAssetPastPlayoutLimit(r))this.bufferedToEvent(e,r);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,i){const s=eL(e,i);if(e.isAssetPastPlayoutLimit(s)){if(this.schedule){const r=this.schedule.items;if(r){const a=t+1,o=r.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos<l&&(this.log(Jm("advanceAfterAssetEnded",l)),this.timelinePos=l,e.appendInPlace&&this.advanceInPlace(l),this.checkBuffer(this.bufferedPos<l)),this.setSchedulePosition(a)}}}else{if(e.appendInPlace){const r=e.assetList[s];r&&this.advanceInPlace(r.timelineStart)}this.setSchedulePosition(t,s)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const s=t.parentIdentifier,r=i.getEvent(s);if(r){const a=i.findEventIndex(s),o=i.findAssetIndex(r,e);this.advanceAfterAssetEnded(r,a,o-1)}}setSchedulePosition(e,t){var i;const s=(i=this.schedule)==null?void 0:i.items;if(!s||this.playbackDisabled)return;const r=e>=0?s[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${r&&Hi(r)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const h=a.event,d=this.playingAsset,f=d==null?void 0:d.identifier,g=f?this.getAssetPlayer(f):null;if(g&&f&&(!this.eventItemsMatch(a,r)||t!==void 0&&f!==h.assetList[t].identifier)){var l;const y=h.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${y+1}/${h.assetList.length} ${Ol(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(S.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:y,event:h,schedule:s.slice(0),scheduleIndex:e,player:g}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),y);return}this.retreiveMediaSource(f,r),g.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&g.detachMedia()}if(!this.eventItemsMatch(a,r)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${Hi(a)}`),h.hasPlayed=!0,this.hls.trigger(S.INTERSTITIAL_ENDED,{event:h,schedule:s.slice(0),scheduleIndex:e}),h.cue.once)){var c;this.updateSchedule();const y=(c=this.schedule)==null?void 0:c.items;if(r&&y){const v=this.findItemIndex(r);this.advanceSchedule(v,y,t,a,o)}return}}this.advanceSchedule(e,s,t,a,o)}advanceSchedule(e,t,i,s,r){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(h=>{const d=h.interstitial,f=a.findEventIndex(d.identifier);(f<e||f>e+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const h=o.event;if(i===void 0){i=a.findAssetIndex(h,this.timelinePos);const y=eL(h,i-1);if(h.isAssetPastPlayoutLimit(y)||h.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(h,e,i);return}i=y}const d=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let f=this.preloadAssets(h,i);if(this.eventItemsMatch(o,d||s)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Hi(o)} ${h.appendInPlace?"append in place":""}`),this.hls.trigger(S.INTERSTITIAL_STARTED,{event:h,schedule:t.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${h}`);return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${h}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const g=h.assetList[i];if(!g){this.advanceAfterAssetEnded(h,e,i||0);return}if(f||(f=this.getAssetPlayer(g.identifier)),f===null||f.destroyed){const y=h.assetList.length;this.warn(`asset ${i+1}/${y} player destroyed ${h}`),f=this.createAssetPlayer(h,g,i),f.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(g))return;this.startAssetPlayer(f,i,t,e,l),this.shouldPlay&&$P(f.media)}else o?(this.resumePrimary(o,e,s),this.shouldPlay&&$P(this.hls.media)):r&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var s,r;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Hi(e)}`),!((s=this.detachedData)!=null&&s.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Jm("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!i)return;const a=(r=this.schedule)==null?void 0:r.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Hi(e)}`),this.hls.trigger(S.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const s=this.primaryDetails;if(t===0)return this.hls.startPosition;if(s&&(i<s.fragmentStart||i>s.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:me.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,s),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(Jm("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((i=s.mainForwardBufferInfo)==null?void 0:i.start)||s.media.currentTime)-e)>.5?s.startLoad(e,t):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(S.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(S.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level];if(!i.details)return;const s=He(He({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],s=this.mediaSelection;if(!s){this.altSelection=He(He({},this.altSelection),{},{audio:i});return}const r=He(He({},s),{},{audio:i});this.mediaSelection=r}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],s=this.mediaSelection;if(!s){this.altSelection=He(He({},this.altSelection),{},{subtitles:i});return}const r=He(He({},s),{},{subtitles:i});this.mediaSelection=r}onAudioTrackSwitching(e,t){const i=KR(t);this.playerQueue.forEach(({hls:s})=>s&&(s.setAudioOption(t)||s.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=KR(t);this.playerQueue.forEach(({hls:s})=>s&&(s.setSubtitleOption(t)||t.id!==-1&&s.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let s=0;s<t.length;s++){const r=t[s];if(r.cue.post){var i;const a=this.schedule.findEventIndex(r.identifier),o=(i=this.schedule.items)==null?void 0:i[a];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const s=(i=this.schedule)==null?void 0:i.items;if(e&&s){const r=this.findItemIndex(e,t);return s[r]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((r,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(r.identifier,null)});const i=e.end+.25,s=me.bufferInfo(this.primaryMedia,i,0);if(s.end>i||(s.nextStart||0)>i){this.log(`trim buffered interstitial ${Hi(e)} (was ${Hi(t)})`);const r=!0;this.attachPrimary(i,null,r),this.flushFrontBuffer(i)}}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const s=me.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,i,e)}updateBufferedPos(e,t,i){const s=this.schedule,r=this.bufferingItem;if(this.bufferedPos>e||!s)return;if(t.length===1&&this.itemsMatch(t[0],r)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var c;const h=this.findItemIndex(r),d=Math.min(h+1,t.length-1),f=t[d];if((l===-1&&r&&e>=r.end||(c=f.event)!=null&&c.appendInPlace&&e+.01>=f.start)&&(l=d),this.isInterstitial(r)){const g=r.event;if(d-o>1&&g.appendInPlace===!1||g.assetList.length===0&&g.assetListLoader)return}if(this.bufferedPos=e,l>h&&l>o)this.bufferedToItem(f);else{const g=this.primaryDetails;this.primaryLive&&g&&e>g.edge-g.targetduration&&f.start<g.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(f)&&this.preloadAssets(f.event,0)}}else i&&a&&!this.itemsMatch(a,r)&&(l===o?this.bufferedToItem(a):l===o+1&&this.bufferedToItem(t[l]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(s=>{const r=this.getAssetPlayer(s.identifier);return!(r!=null&&r.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:s,events:r}=i;if(!s||!r)return t;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Hi(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const c=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((h,d)=>{const f=this.getAssetPlayer(h.identifier);f&&(d===c&&f.loadSource(),f.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering());this.hls.trigger(S.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:r.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const s=this.detachedData;s?s.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,s=i.assetList.length===0&&!i.assetListLoader,r=i.cue.once;if(s||!r){const a=this.preloadAssets(i,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const i=e.assetUrl,s=e.assetList.length,r=s===0&&!e.assetListLoader,a=e.cue.once;if(r){const l=e.timelineStart;if(e.appendInPlace){var o;const f=this.playingItem;!this.isInterstitial(f)&&(f==null||(o=f.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let c,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){const f=h-l;f>0&&(c=Math.round(f*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:s} ${e}${c?` live-start: ${h} start-offset: ${c}`:""}`),i)return this.createAsset(e,0,0,l,e.duration,i);const d=this.assetListLoader.loadAssetList(e,c);d&&(e.assetListLoader=d)}else if(!a&&s){for(let c=t;c<s;c++){const h=e.assetList[c],d=this.getAssetPlayerQueueIndex(h.identifier);(d===-1||this.playerQueue[d].destroyed)&&!h.error&&this.createAssetPlayer(e,h,c)}const l=e.assetList[t];if(l){const c=this.getAssetPlayer(l.identifier);return c&&c.loadSource(),c}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(s=>{this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:s})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,s,r,a){const o={parentIdentifier:e.identifier,identifier:RZ(e,a,t),duration:r,startOffset:i,timelineStart:s,uri:a};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){const s=this.hls,r=s.userConfig;let a=r.videoPreference;const o=s.loadLevelObj||s.levels[s.currentLevel];(a||o)&&(a=We({},a),o.videoCodec&&(a.videoCodec=o.videoCodec),o.videoRange&&(a.allowedVideoRanges=[o.videoRange]));const l=s.audioTracks[s.audioTrack],c=s.subtitleTracks[s.subtitleTrack];let h=0;if(this.primaryLive||e.appendInPlace){const x=this.timelinePos-t.timelineStart;if(x>1){const w=t.duration;w&&x<w&&(h=x)}}const d=t.identifier,f=He(He({},r),{},{maxMaxBufferLength:Math.min(180,s.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:l||r.audioPreference,subtitlePreference:c||r.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));const g=f.cmcd;g!=null&&g.sessionId&&g.contentId&&(f.cmcd=We({},g,{contentId:Rh(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const y=new OZ(this.HlsPlayerClass,f,e,t);this.playerQueue.push(y),e.assetList[i]=t;let v=!0;const T=x=>{if(x.live){var w;const k=new Error(`Interstitials MUST be VOD assets ${e}`),P={fatal:!0,type:ee.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:k},I=((w=this.schedule)==null?void 0:w.findEventIndex(e.identifier))||-1;this.handleAssetItemError(P,e,I,i,k.message);return}const R=x.edge-x.fragmentStart,C=t.duration;(v||C===null||R>C)&&(v=!1,this.log(`Interstitial asset "${d}" duration change ${C} > ${R}`),t.duration=R,this.updateSchedule())};y.on(S.LEVEL_UPDATED,(x,{details:w})=>T(w)),y.on(S.LEVEL_PTS_UPDATED,(x,{details:w})=>T(w)),y.on(S.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const b=(x,w)=>{const R=this.getAssetPlayer(d);if(R&&w.tracks){R.off(S.BUFFER_CODECS,b),R.tracks=w.tracks;const C=this.primaryMedia;this.bufferingAsset===R.assetItem&&C&&!R.media&&this.bufferAssetPlayer(R,C)}};y.on(S.BUFFER_CODECS,b);const E=()=>{var x;const w=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${w}`),!w||!this.schedule)return;const R=this.schedule.findEventIndex(e.identifier),C=(x=this.schedule.items)==null?void 0:x[R];this.isInterstitial(C)&&this.advanceAssetBuffering(C,t)};y.on(S.BUFFERED_TO_END,E);const _=x=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const R=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,R,x)};return y.once(S.MEDIA_ENDED,_(i)),y.once(S.PLAYOUT_LIMIT_REACHED,_(1/0)),y.on(S.ERROR,(x,w)=>{if(!this.schedule)return;const R=this.getAssetPlayer(d);if(w.details===$.BUFFER_STALLED_ERROR){if(R!=null&&R.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(w,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${w.error} ${e}`)}),y.on(S.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const w=new Error(`Asset player destroyed unexpectedly ${d}`),R={fatal:!0,type:ee.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:w};this.handleAssetItemError(R,e,this.schedule.findEventIndex(e.identifier),i,w.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Ol(t)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:y}),y}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const s=this.playerQueue[i];this.log(`clear ${s} toSegment: ${t&&Hi(t)}`),this.transferMediaFromPlayer(s,t),this.playerQueue.splice(i,1),s.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,s,r){const{interstitial:a,assetItem:o,assetId:l}=e,c=a.assetList.length,h=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!h||h.identifier!==l)&&(h&&(this.clearAssetPlayer(h.identifier,i[s]),delete h.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${Ol(o)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,r)}bufferAssetPlayer(e,t){var i,s;if(!this.schedule)return;const{interstitial:r,assetItem:a}=e,o=this.schedule.findEventIndex(r.identifier),l=(i=this.schedule.items)==null?void 0:i[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const c=this.getBufferingPlayer();if(c===e)return;const h=r.appendInPlace;if(h&&(c==null?void 0:c.interstitial.appendInPlace)===!1)return;const d=(c==null?void 0:c.tracks)||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(h&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!z8(d,e.tracks)){const f=new Error(`Asset ${Ol(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),g={fatal:!0,type:ee.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:f},y=r.findAssetIndex(a);this.handleAssetItemError(g,r,o,y,f.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const s=i.currentTime,r=t.findAssetIndex(e,s),a=e.assetList[r];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||s-a.timelineStart,c=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+c} in ${o} ${e} (media.currentTime: ${s})`),l&&(c/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&o.hls){const h=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,h,r)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,s,r){if(e.details===$.BUFFER_STALLED_ERROR)return;const a=t.assetList[s]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${a&&Ol(a)} ${e.error}`),!this.schedule)return;const o=(a==null?void 0:a.identifier)||"",l=this.getAssetPlayerQueueIndex(o),c=this.playerQueue[l]||null,h=this.schedule.items,d=We({},e,{fatal:!1,errorAction:Vl(!0),asset:a,assetListIndex:s,event:t,schedule:h,scheduleIndex:i,player:c});if(this.hls.trigger(S.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const f=this.playingAsset,g=this.bufferingAsset,y=new Error(r);if(a&&(this.clearAssetPlayer(o,null),a.error=y),!t.assetList.some(v=>!v.error))t.error=y;else for(let v=s;v<t.assetList.length;v++)this.resetAssetPlayer(t.assetList[v].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):f&&f.identifier===o?this.advanceAfterAssetEnded(t,i,s):g&&g.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,g)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;let s=this.timelinePos;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${s} playing: ${Hi(i)} error: ${e.error}`),s===-1&&(s=this.hls.startPosition);const a=this.updateItem(i,s);this.itemsMatch(i,a)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(s===-1){this.checkStart();return}if(!this.schedule)return;const r=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(r)}onAssetListLoaded(e,t){var i,s;const r=t.event,a=r.identifier,o=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(a)))return;const l=r.timelineStart,c=r.duration;let h=0;o.forEach((v,T)=>{const b=parseFloat(v.DURATION);this.createAsset(r,T,h,l+h,b,v.URI),h+=b}),r.duration=h,this.log(`Loaded asset-list with duration: ${h} (was: ${c}) ${r}`);const d=this.waitingItem,f=(d==null?void 0:d.event.identifier)===a;this.updateSchedule();const g=(s=this.bufferingItem)==null?void 0:s.event;if(f){var y;const v=this.schedule.findEventIndex(a),T=(y=this.schedule.items)==null?void 0:y[v];if(T){if(!this.playingItem&&this.timelinePos>T.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==v){r.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${r}`),this.log(r.error.message),this.updateSchedule(!0),this.primaryFallback(r);return}this.setBufferingItem(T)}this.setSchedulePosition(v)}else if((g==null?void 0:g.identifier)===a){const v=r.assetList[0];if(v){const T=this.getAssetPlayer(v.identifier);if(g.appendInPlace){const b=this.primaryMedia;T&&b&&this.bufferAssetPlayer(T,b)}else T&&T.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case $.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const NP=500;class SB extends fx{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",Z.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=B.IDLE,this.setInterval(NP),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragContextChanged(i)||(pt(i)&&(this.fragPrevious=i),this.state=B.IDLE),!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a;const o=i.start;for(let c=0;c<r.length;c++)if(o>=r[c].start&&o<=r[c].end){a=r[c];break}const l=i.start+i.duration;a?a.end=l:(a={start:o,end:l},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(i===0&&s!==Number.POSITIVE_INFINITY){const r=s-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=r){a.shift();continue}else if(a[o].start<r)a[o].start=r;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,r,Z.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===Z.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==B.STOPPED&&(this.state=B.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&eB(this.levels,t)){this.levels=t.map(i=>new ju(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const s=new ju(i);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Z.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==B.STOPPED&&this.setInterval(NP)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:a,id:o}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=r[o];if(o>=r.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(a.live||(i=l.details)!=null&&i.live){if(a.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const f=d.fragments[0];if(!l.details)a.hasProgramDateTime&&d.hasProgramDateTime?(Sy(a,d),c=a.fragmentStart):f&&(c=f.start,uI(a,c));else{var h;c=this.alignPlaylists(a,l.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&f&&(c=f.start,uI(a,c))}d&&!this.startFragRequested&&this.setStartPosition(d,c)}l.details=a,this.levelLastLoaded=l,o===s&&(this.hls.trigger(S.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===B.IDLE&&(pl(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&s!=null&&s.key&&s.iv&&Hl(s.method)){const a=performance.now();
vendor: 26,910 bytes, lines 71-82
71this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer,i3(s.method)).catch(o=>{throw r.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();r.trigger(S.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=B.IDLE})}}doTick(){if(!this.media){this.state=B.IDLE;return}if(this.state===B.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:s}=this,r=this.getLoadPosition(),a=me.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:o,len:l}=a,c=i.details,h=this.hls.maxBufferLength+c.levelTargetDuration;if(l>h)return;const d=c.fragments,f=d.length,g=c.edge;let y=null;const v=this.fragPrevious;if(o<g){const E=s.maxFragLookUpTolerance,_=o>g-E?0:E;y=pl(v,d,Math.max(d[0].start,o),_),!y&&v&&v.start<d[0].start&&(y=d[0])}else y=d[f-1];if(y=this.filterReplacedPrimary(y,i.details),!y)return;const T=y.sn-c.startSN,b=d[T-1];if(b&&b.cc===y.cc&&this.fragmentTracker.getState(b)===St.NOT_LOADED&&(y=b),this.fragmentTracker.getState(y)===St.NOT_LOADED){const E=this.mapToInitFragWhenRequired(y);E&&this.loadFragment(E,i,o)}}}loadFragment(e,t,i){pt(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new FZ(this.tracksBuffered[this.currentTrackId]||[])}}class FZ{constructor(e){this.buffered=void 0;const t=(i,s,r)=>{if(s=s>>>0,s>r-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${r})`);return e[s][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}const BZ={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},_B=n=>String.fromCharCode(BZ[n]||n),Ki=15,on=100,UZ={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},VZ={17:2,18:4,21:6,22:8,23:10,19:13,20:15},HZ={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},qZ={25:2,26:4,29:6,30:8,31:10,27:13,28:15},GZ=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class KZ{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;qe.log(`${this.time} [${e}] ${i}`)}}}const Pa=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class AB{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){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const s=t[i];e.hasOwnProperty(s)&&(this[s]=e[s])}}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}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class jZ{constructor(){this.uchar=" ",this.penState=new AB}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()}}class WZ{constructor(e){this.chars=[],this.pos=0,this.currPenState=new AB,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<on;t++)this.chars.push(new jZ);this.logger=e}equals(e){for(let t=0;t<on;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<on;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<on;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>on&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=on)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=_B(e);if(this.pos>=on){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<on;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<on;i++){const s=this.chars[i].uchar;s!==" "&&(t=!1),e.push(s)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class tL{constructor(e){this.rows=[],this.currRow=Ki-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ki;t++)this.rows.push(new WZ(e));this.logger=e}reset(){for(let e=0;e<Ki;e++)this.rows[e].clear();this.currRow=Ki-1}equals(e){let t=!0;for(let i=0;i<Ki;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Ki;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ki;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 = "+Xe(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Ki;o++)this.rows[o].clear();const r=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[r].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(a.rows[r+c])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,a=Math.max(r-1,0);i.setCursor(e.indent),e.color=i.chars[a].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+Xe(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const 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=e||!1;const t=[];let i="",s=-1;for(let r=0;r<Ki;r++){const a=this.rows[r].getTextString();a&&(s=r+1,e?t.push("Row "+s+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
72`)),i}getTextAndFormat(){return this.rows}}class FP{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new tL(i),this.nonDisplayedMemory=new tL(i),this.lastOutputScreen=new tL(i),this.currRollUpRow=this.displayedMemory.rows[Ki-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Ki-1],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.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const 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"){const 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){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+Xe(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t: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.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))}}class BP{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=zZ(),this.logger=void 0;const s=this.logger=new KZ;this.channels=[null,new FP(e,t,s),new FP(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const s=t[i]&127,r=t[i+1]&127;let a=!1,o=null;if(s===0&&r===0)continue;this.logger.log(3,()=>"["+Pa([t[i],t[i+1]])+"] -> ("+Pa([s,r])+")");const l=this.cmdHistory;if(s>=16&&s<=31){if(YZ(s,r,l)){eg(null,null,l),this.logger.log(3,()=>"Repeated command ("+Pa([s,r])+") is dropped");continue}eg(s,r,this.cmdHistory),a=this.parseCmd(s,r),a||(a=this.parseMidrow(s,r)),a||(a=this.parsePAC(s,r)),a||(a=this.parseBackgroundAttributes(s,r))}else eg(null,null,l);if(!a&&(o=this.parseChars(s,r),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Pa([s,r])+" orig: "+Pa([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=33&&t<=35;if(!(i||s))return!1;const r=e===20||e===21||e===23?1:2,a=this.channels[r];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return s?(s.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Pa([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const s=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(s||r))return!1;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?UZ[e]:HZ[e]:i=a===1?VZ[e]:qZ[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,s.underline=(i&1)===1,i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((i-16)/2)*4,s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let a;r===17?a=t+80:r===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+_B(a)+"' in channel "+i),s=[a]}else e>=32&&e<=127&&(s=t===0?[e]:[e,t]);return s&&this.logger.log(3,()=>"Char codes =  "+Pa(s).join(",")),s}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=45&&t<=47;if(!(i||s))return!1;let r;const a={};e===16||e===24?(r=Math.floor((t-32)/2),a.background=GZ[r],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}eg(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function eg(n,e,t){t.a=n,t.b=e}function YZ(n,e,t){return t.a===n&&t.b===e}function zZ(){return{a:null,b:null}}var p3=function(){if(Ey!=null&&Ey.VTTCue)return self.VTTCue;const n=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const c=l.toLowerCase();return~o.indexOf(c)?c:!1}function i(o){return t(n,o)}function s(o){return t(e,o)}function r(o,...l){let c=1;for(;c<arguments.length;c++){const h=arguments[c];for(const d in h)o[d]=h[d]}return o}function a(o,l,c){const h=this,d={enumerable:!0};h.hasBeenReset=!1;let f="",g=!1,y=o,v=l,T=c,b=null,E="",_=!0,x="auto",w="start",R=50,C="middle",k=50,P="middle";Object.defineProperty(h,"id",r({},d,{get:function(){return f},set:function(I){f=""+I}})),Object.defineProperty(h,"pauseOnExit",r({},d,{get:function(){return g},set:function(I){g=!!I}})),Object.defineProperty(h,"startTime",r({},d,{get:function(){return y},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");y=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",r({},d,{get:function(){return v},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");v=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",r({},d,{get:function(){return T},set:function(I){T=""+I,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",r({},d,{get:function(){return b},set:function(I){b=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",r({},d,{get:function(){return E},set:function(I){const O=i(I);if(O===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=O,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",r({},d,{get:function(){return _},set:function(I){_=!!I,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",r({},d,{get:function(){return x},set:function(I){if(typeof I!="number"&&I!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");x=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",r({},d,{get:function(){return w},set:function(I){const O=s(I);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");w=O,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",r({},d,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");R=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},d,{get:function(){return C},set:function(I){const O=s(I);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");C=O,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},d,{get:function(){return k},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");k=I,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},d,{get:function(){return P},set:function(I){const O=s(I);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");P=O,this.hasBeenReset=!0}})),h.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class QZ{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function xB(n){function e(i,s,r,a){return(i|0)*3600+(s|0)*60+(r|0)+parseFloat(a||0)}const t=n.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class XZ{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function LB(n,e,t,i){const s=i?n.split(i):[n];for(const r in s){if(typeof s[r]!="string")continue;const a=s[r].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const vI=new p3(0,0,""),tg=vI.align==="middle"?"middle":"center";function ZZ(n,e,t){const i=n;function s(){const o=xB(n);if(o===null)throw new Error("Malformed timestamp: "+i);return n=n.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,l){const c=new XZ;LB(o,function(f,g){let y;switch(f){case"region":for(let v=t.length-1;v>=0;v--)if(t[v].id===g){c.set(f,t[v].region);break}break;case"vertical":c.alt(f,g,["rl","lr"]);break;case"line":y=g.split(","),c.integer(f,y[0]),c.percent(f,y[0])&&c.set("snapToLines",!1),c.alt(f,y[0],["auto"]),y.length===2&&c.alt("lineAlign",y[1],["start",tg,"end"]);break;case"position":y=g.split(","),c.percent(f,y[0]),y.length===2&&c.alt("positionAlign",y[1],["start",tg,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,g);break;case"align":c.alt(f,g,["start",tg,"end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");let h=c.get("line","auto");h==="auto"&&vI.line===-1&&(h=-1),l.line=h,l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100),l.align=c.get("align",tg);let d=c.get("position","auto");d==="auto"&&vI.position===50&&(d=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=d}function a(){n=n.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),n.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);n=n.slice(3),a(),e.endTime=s(),a(),r(n,e)}function wB(n){return n.replace(/<br(?: \/)?>/gi,`
73`)}class JZ{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new QZ,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let r=t.buffer,a=0;for(r=wB(r);a<r.length&&r[a]!=="\r"&&r[a]!==`
74`;)++a;const o=r.slice(0,a);return r[a]==="\r"&&++a,r[a]===`
75`&&++a,t.buffer=r.slice(a),o}function s(r){LB(r,function(a,o){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=i();const o=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?s(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new p3(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{ZZ(r,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=r.indexOf("-->")!==-1;if(!r||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
76`),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
77
78`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const eJ=/\r\n|\n\r|\n|\r/g,iL=function(e,t,i=0){return e.slice(i,i+t.length)===t},tJ=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!X(t)||!X(i)||!X(s)||!X(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*s,t+=60*60*1e3*r,t};function m3(n,e,t){return Rh(n.toString())+Rh(e.toString())+Rh(t)}const iJ=function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(a=r)!=null&&a.new;){var a;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i};function sJ(n,e,t,i,s,r,a){const o=new JZ,l=Ai(new Uint8Array(n)).trim().replace(eJ,`
79`).split(`
80`),c=[],h=e?yX(e.baseTime,e.timescale):0;let d="00:00.000",f=0,g=0,y,v=!0;o.oncue=function(T){const b=t[i];let E=t.ccOffset;const _=(f-h)/9e4;if(b!=null&&b.new&&(g!==void 0?E=t.ccOffset=b.start:iJ(t,i,_)),_){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}E=_-t.presentationOffset}const x=T.endTime-T.startTime,w=Ei((T.startTime+E-g)*9e4,s*9e4)/9e4;T.startTime=Math.max(w,0),T.endTime=Math.max(w+x,0);const R=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(R)),T.id||(T.id=m3(T.startTime,T.endTime,R)),T.endTime>0&&c.push(T)},o.onparsingerror=function(T){y=T},o.onflush=function(){if(y){a(y);return}r(c)},l.forEach(T=>{if(v)if(iL(T,"X-TIMESTAMP-MAP=")){v=!1,T.slice(16).split(",").forEach(b=>{iL(b,"LOCAL:")?d=b.slice(6):iL(b,"MPEGTS:")&&(f=parseInt(b.slice(7)))});try{g=tJ(d)/1e3}catch(b){y=b}return}else T===""&&(v=!1);o.parse(T+`
81`)}),o.flush()}const sL="stpp.ttml.im1t",CB=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,IB=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,nJ={left:"start",center:"center",right:"end",start:"start",end:"end"};function UP(n,e,t,i){const s=Ae(new Uint8Array(n),["mdat"]);if(s.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=s.map(o=>Ai(o)),a=gX(e.baseTime,1,e.timescale);try{r.forEach(o=>t(rJ(o,a)))}catch(o){i(o)}}function rJ(n,e){const s=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce((d,f)=>(d[f]=s.getAttribute(`ttp:${f}`)||r[f],d),{}),o=s.getAttribute("xml:space")!=="preserve",l=VP(nL(s,"styling","style")),c=VP(nL(s,"layout","region")),h=nL(s,"body","[begin]");return[].map.call(h,d=>{const f=kB(d,o);if(!f||!d.hasAttribute("begin"))return null;const g=aL(d.getAttribute("begin"),a),y=aL(d.getAttribute("dur"),a);let v=aL(d.getAttribute("end"),a);if(g===null)throw HP(d);if(v===null){if(y===null)throw HP(d);v=g+y}const T=new p3(g-e,v-e,f);T.id=m3(T.startTime,T.endTime,T.text);const b=c[d.getAttribute("region")],E=l[d.getAttribute("style")],_=aJ(b,E,l),{textAlign:x}=_;if(x){const w=nJ[x];w&&(T.lineAlign=w),T.align=x}return We(T,_),T}).filter(d=>d!==null)}function nL(n,e,t){const i=n.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function VP(n){return n.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function kB(n,e){return[].slice.call(n.childNodes).reduce((t,i,s)=>{var r;return i.nodeName==="br"&&s?t+`
82`:(r=i.childNodes)!=null&&r.length?kB(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function aJ(n,e,t){const i="http://www.w3.org/ns/ttml#styling";let s=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=n!=null&&n.hasAttribute("style")?n.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(s=t[a]),r.reduce((o,l)=>{const c=rL(e,i,l)||rL(n,i,l)||rL(s,i,l);return c&&(o[l]=c),o},{})}
vendor: 5,678 bytes, line 82
82function rL(n,e,t){return n&&n.hasAttributeNS(e,t)?n.getAttributeNS(e,t):null}function HP(n){return new Error(`Could not parse ttml timestamp ${n}`)}function aL(n,e){if(!n)return null;let t=xB(n);return t===null&&(CB.test(n)?t=oJ(n,e):IB.test(n)&&(t=lJ(n,e))),t}function oJ(n,e){const t=CB.exec(n),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function lJ(n,e){const t=IB.exec(n),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class ig{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class RB{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=GP(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new ig(this,"textTrack1"),t=new ig(this,"textTrack2"),i=new ig(this,"textTrack3"),s=new ig(this,"textTrack4");this.cea608Parser1=new BP(1,e,t),this.cea608Parser2=new BP(3,i,s)}addCues(e,t,i,s,r){let a=!1;for(let o=r.length;o--;){const l=r[o],c=cJ(l[0],l[1],t,i);if(c>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],i),a=!0,c/(i-t)>.5))return}if(a||r.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,s)}else{const o=this.Cues.newCue(null,t,i,s);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r,trackId:a}){const{unparsedVttFrags:o}=this;i===Z.MAIN&&(this.initPTS[t.cc]={baseTime:s,timescale:r,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,l):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s<i.textTracks.length;s++){const r=i.textTracks[s];if(qP(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:s}=this,{label:r,languageCode:a}=t[e],o=this.getExistingTrack(r,a);if(o)i[e]=o,Fl(i[e]),vB(i[e],s);else{const l=this.createTextTrack("captions",r,a);l&&(l[e]=!0,i[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,s={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,i){const s=this.media;if(s)return s.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:s}=this;
vendor: 19,674 bytes, line 82
82Object.keys(s).forEach(r=>{Fl(s[r]),delete s[r]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=GP(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Fl(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],s=i.some(r=>r.textCodec===sL);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(eB(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const a=this.media,o=a?Hg(a.textTracks):null;if(this.tracks.forEach((l,c)=>{let h;if(o){let d=null;for(let f=0;f<o.length;f++)if(o[f]&&qP(o[f],l)){d=o[f],o[f]=null;break}d&&(h=d)}if(h)Fl(h);else{const d=PB(l);h=this.createTextTrack(d,l.name,l.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),o!=null&&o.length){const l=o.filter(c=>c!==null).map(c=>c.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const s=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!s)return;const r=`textTrack${s[1]}`,a=this.captionsProperties[r];a&&(a.label=i.name,i.lang&&(a.languageCode=i.lang),a.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===Z.MAIN){var i,s;const{cea608Parser1:r,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:c}=t.frag,h=(i=(s=t.part)==null?void 0:s.index)!=null?i:-1;r&&a&&(c!==o+1||c===o&&h!==this.lastPartIndex+1||l!==this.lastCc)&&(r.reset(),a.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===Z.SUBTITLE)if(s.byteLength){const r=i.decryptdata,a="stats"in t;if(r==null||!r.encrypted||a){const o=this.tracks[i.level],l=this.vttCCs;l[i.cc]||(l[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===sL?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;UP(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{i.logger.log(`Failed to parse IMSC1: ${s}`),i.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:a}=this,o=r.length-1;if(!r[i.cc]&&o===-1){a.push(e);return}const l=this.hls,c=(t=i.initSegment)!=null&&t.data?Ni(i.initSegment.data,new Uint8Array(s)).buffer:s;sJ(c,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,h=>{this._appendCues(h,i.level),l.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},h=>{const d=h.message==="Missing initPTS for VTT MPEGTS";d?a.push(e):this._fallbackToIMSC1(i,s),l.logger.log(`Failed to parse VTT cue: ${h}`),!(d&&o>i.cc)&&l.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:h})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||UP(t,this.initPTS[e.cc],()=>{i.textCodec=sL,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(r=>TB(s,r))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(S.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Z.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:s}=t;if(!(i.type===Z.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let r=0;r<s.length;r++){const a=s[r].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(a);this.cea608Parser1.addData(s[r].pts,o[0]),this.cea608Parser2.addData(s[r].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:s,type:r}){const{media:a}=this;if(!(!a||a.currentTime<i)){if(!r||r==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>yI(o[l],t,i))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>yI(o[l],t,s))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let s=2;for(let r=0;r<i;r++){const a=e[s++],o=127&e[s++],l=127&e[s++];if(o===0&&l===0)continue;if((4&a)!==0){const h=3&a;(h===0||h===1)&&(t[h].push(o),t[h].push(l))}}return t}}function PB(n){return n.characteristics&&/transcribes-spoken-dialog/gi.test(n.characteristics)&&/describes-music-and-sound/gi.test(n.characteristics)?"captions":"subtitles"}function qP(n,e){return!!n&&n.kind===PB(e)&&fI(e,n)}function cJ(n,e,t,i){return Math.min(e,i)-Math.max(n,t)}function GP(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const uJ=/\s/,DB={newCue(n,e,t,i){const s=[];let r,a,o,l,c;const h=self.VTTCue||self.TextTrackCue;for(let f=0;f<i.rows.length;f++)if(r=i.rows[f],o=!0,l=0,c="",!r.isEmpty()){var d;for(let v=0;v<r.chars.length;v++)uJ.test(r.chars[v].uchar)&&o?l++:(c+=r.chars[v].uchar,o=!1);r.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const g=wB(c.trim()),y=m3(e,t,g);n!=null&&(d=n.cues)!=null&&d.getCueById(y)||(a=new h(e,t,g),a.id=y,a.line=f+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),s.push(a))}return n&&s.length&&(s.sort((f,g)=>f.line==="auto"||g.line==="auto"?0:f.line>8&&g.line>8?g.line-f.line:f.line-g.line),s.forEach(f=>TB(n,f))),s}};function OB(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const hJ=/(\d+)-(\d+)\/(\d+)/;class TI{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||mJ,this.controller=new self.AbortController,this.stats=new ux}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=dJ(e,this.controller.signal),a=e.responseType==="arraybuffer",o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&X(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},t.timeout),(Gh(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var f;this.response=this.loader=d;const g=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},c-(g-s.loading.start)),!d.ok){const{status:v,statusText:T}=d;throw new gJ(T||"fetch, bad network response",v,d)}s.loading.first=g,s.total=pJ(d.headers)||s.total;const y=(f=this.callbacks)==null?void 0:f.onProgress;return y&&X(t.highWaterMark)?this.loadProgressively(d,s,e,t.highWaterMark,y):a?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var f,g;const y=this.response;if(!y)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const v=d[o];v&&(s.loaded=s.total=v);const T={url:y.url,data:d,code:y.status},b=(f=this.callbacks)==null?void 0:f.onProgress;b&&!X(t.highWaterMark)&&b(s,e,d,y),(g=this.callbacks)==null||g.onSuccess(T,s,e,y)}).catch(d=>{var f;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const g=d&&d.code||0,y=d?d.message:null;(f=this.callbacks)==null||f.onError({code:g,text:y},e,d?d.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const a=new D7,o=e.body.getReader(),l=()=>o.read().then(c=>{if(c.done)return a.dataLength&&r(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const h=c.value,d=h.length;return t.loaded+=d,d<s||a.dataLength?(a.push(h),a.dataLength>=s&&r(t,i,a.flush().buffer,e)):r(t,i,h.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function dJ(n,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(We({},n.headers))};return n.rangeEnd&&t.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),t}function fJ(n){const e=hJ.exec(n);if(e)return parseInt(e[2])-parseInt(e[1])+1}function pJ(n){const e=n.get("Content-Range");if(e){const i=fJ(e);if(X(i))return i}const t=n.get("Content-Length");if(t)return parseInt(t)}function mJ(n,e){return new self.Request(n.url,e)}class gJ extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const yJ=/^age:\s*[\d.]+\s*$/im;class g3{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new ux,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(a=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:a.message},t,i,s)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=i.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&X(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const c=t.status,h=t.responseType==="text"?t.responseText:null;if(c>=200&&c<300){const y=h??t.response;if(y!=null){var a,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const v=t.responseType==="arraybuffer"?y.byteLength:y.length;i.loaded=i.total=v,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const T=(a=this.callbacks)==null?void 0:a.onProgress;T&&T(i,e,y,t);const b={url:t.responseURL,data:y,code:c};(o=this.callbacks)==null||o.onSuccess(b,i,e,t);return}}const d=r.loadPolicy.errorRetry,f=i.retry,g={url:e.url,data:void 0,code:c};if(Ty(d,f,!1,g))this.retry(d);else{var l;qe.error(`${c} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:c,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ty(e,t,!0))this.retry(e);else{var i;qe.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Jk(e,i.retry),i.retry++,qe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&yJ.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const vJ={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},TJ=He(He({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:g3,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:d7,bufferController:sB,capLevelController:gx,errorController:y7,fpsController:yB,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:n3,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:vJ},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},bJ()),{},{subtitleStreamController:SB,subtitleTrackController:bB,timelineController:RB,audioStreamController:J7,audioTrackController:tB,emeController:ol,cmcdController:pB,contentSteeringController:mB,interstitialsController:NZ});function bJ(){return{cueHandler:DB,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function EJ(n,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=bI(n),s=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];
vendor: 24,393 bytes, line 82
82return s.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,c=[];r.forEach(h=>{const d=`${a}Loading${h}`,f=e[d];if(f!==void 0&&l){c.push(d);const g=i[o].default;switch(e[o]={default:g},h){case"TimeOut":g.maxLoadTimeMs=f,g.maxTimeToFirstByteMs=f;break;case"MaxRetry":g.errorRetry.maxNumRetry=f,g.timeoutRetry.maxNumRetry=f;break;case"RetryDelay":g.errorRetry.retryDelayMs=f,g.timeoutRetry.retryDelayMs=f;break;case"MaxRetryTimeout":g.errorRetry.maxRetryDelayMs=f,g.timeoutRetry.maxRetryDelayMs=f;break}}}),c.length&&t.warn(`hls.js config: "${c.join('", "')}" setting(s) are deprecated, use "${o}": ${Xe(e[o])}`)}),He(He({},i),e)}function bI(n){return n&&typeof n=="object"?Array.isArray(n)?n.map(bI):Object.keys(n).reduce((e,t)=>(e[t]=bI(n[t]),e),{}):n}function SJ(n,e){const t=n.loader;t!==TI&&t!==g3?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),n.progressive=!1):OB()&&(n.loader=TI,n.progressive=!0,n.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const qg=2,_J=.1,AJ=.05,xJ=100;class LJ extends v7{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(xJ),this.mediaSource=t.mediaSource;const i=this.media=t.media;Jt(i,"playing",this.onMediaPlaying),Jt(i,"waiting",this.onMediaWaiting),Jt(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(hi(i,"playing",this.onMediaPlaying),hi(i,"waiting",this.onMediaWaiting),hi(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,s;const r=(i=this.hls)==null?void 0:i.config;if(!r)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,c=!this.seeking&&o,h=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,r.nudgeOnVideoHole&&!h&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(c||l){l&&this.stallResolved(e);return}if(h){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!me.getBuffered(a).length){this.nudgeRetry=0;return}const d=me.bufferInfo(a,e,0),f=d.nextStart||0,g=this.fragmentTracker;if(o&&g&&this.hls){const R=KP(this.hls.inFlightFragments,e),C=d.len>qg,k=!f||R||f-e>qg&&!g.getPartialFragment(e);if(C||k)return;this.moved=!1}const y=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&g){if(!(d.len>0)&&!f)return;const C=Math.max(f,d.start||0)-e,P=!!(y!=null&&y.live)?y.targetduration*2:qg,I=sg(e,g);if(C>0&&(C<=P||I)){a.paused||this._trySkipBufferHole(I);return}}const v=r.detectStallWithCurrentTimeMs,T=self.performance.now(),b=this.waiting;let E=this.stalled;if(E===null)if(b>0&&T-b<v)E=this.stalled=b;else{this.stalled=T;return}const _=T-E;if(!o&&(_>=v||b)&&this.hls){var x;if(((x=this.mediaSource)==null?void 0:x.readyState)==="ended"&&!(y!=null&&y.live)&&Math.abs(e-((y==null?void 0:y.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const w=me.bufferInfo(a,e,r.maxBufferHole);this._tryFixBufferStall(w,_,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&s&&s.length>1&&e>s.end(0)){const r=me.bufferedInfo(me.timeRangesToArray(this.buffered.audio),e,0);if(r.len>1&&t>=r.start){const a=me.timeRangesToArray(s),o=me.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&o<a.length-1){const l=me.bufferedInfo(a,e,0).bufferedIndex,c=a[o].end,h=a[o+1].start;if((l===-1||l>o)&&h-c<1&&e-c<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${c} -> ${h} buffered index: ${l}`);this.warn(d.message),this.media.currentTime+=1e-6;let f=sg(e,this.fragmentTracker);f&&"fragment"in f?f=f.fragment:f||(f=void 0);const g=me.bufferInfo(this.media,e,0);this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:f,buffer:g.len,bufferInfo:g})}}}}}_tryFixBufferStall(e,t,i){var s,r;const{fragmentTracker:a,media:o}=this,l=(s=this.hls)==null?void 0:s.config;if(!o||!a||!l)return;const c=(r=this.hls)==null?void 0:r.latestLevelDetails,h=sg(i,a);if((h||c!=null&&c.live&&i<c.fragmentStart)&&(this._trySkipBufferHole(h)||!this.media))return;const d=e.buffered,f=this.adjacentTraversal(e,i);(d&&d.length>1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-i<l.maxBufferHole||f))&&(t>l.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,s=e.nextStart;if(i&&s){const r=i.getFragAtPos(t,Z.MAIN),a=i.getFragAtPos(s,Z.MAIN);if(r&&a)return a.sn-r.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:s,stalled:r}=this;if(!s&&r!==null&&i&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${Xe(e)})`);this.warn(a.message),t.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:r}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:s}=this,r=(t=this.hls)==null?void 0:t.config;if(!s||!i||!r)return 0;const a=s.currentTime,o=me.bufferInfo(s,a,0),l=a<o.start?o.start:o.nextStart;if(l&&this.hls){const h=o.len<=r.maxBufferHole,d=o.len>0&&o.len<1&&s.readyState<3,f=l-a;if(f>0&&(h||d)){if(f>r.maxBufferHole){let y=!1;if(a===0){const v=i.getAppendedFrag(0,Z.MAIN);v&&l<v.end&&(y=!0)}if(!y&&e){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||KP(this.hls.inFlightFragments,l))return 0;let T=!1,b=e.end;for(;b<l;){const E=sg(b,i);if(E)b+=E.duration;else{T=!0;break}}if(T)return 0}}const g=Math.max(l+AJ,a+_J);if(this.warn(`skipping hole, adjusting currentTime from ${a} to ${g}`),this.moved=!0,s.currentTime=g,!(e!=null&&e.gap)){const y=new Error(`fragment loaded with buffer holes, seeking from ${a} to ${g}`),v={type:ee.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?v.part=e:v.frag=e),this.hls.trigger(S.ERROR,v)}return g}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:s}=this,r=t==null?void 0:t.config;if(!i||!r)return 0;const a=i.currentTime;if(this.nudgeRetry++,s<r.nudgeMaxRetry){const o=a+(s+1)*r.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${a} to ${o}`);this.warn(l.message),i.currentTime=o,t.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${a} after ${r.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function KP(n,e){const t=jP(n.main);if(t&&t.start<=e)return t;const i=jP(n.audio);return i&&i.start<=e?i:null}function jP(n){if(!n)return null;switch(n.state){case B.IDLE:case B.STOPPED:case B.ENDED:case B.ERROR:return null}return n.frag}function sg(n,e){return e.getAppendedFrag(n,Z.MAIN)||e.getPartialFragment(n)}const wJ=.25;function EI(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function oL(n,e,t,i,s){let r=new n(e,t,"");try{r.value=i,s&&(r.type=s)}catch{r=new n(e,t,Xe(s?He({type:s},i):i))}return r}const ng=(()=>{const n=EI();try{n&&new n(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class CJ{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(S.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Fl(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return vB(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:s}=this.hls.config;if(!i&&!s)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=EI();if(a)for(let o=0;o<r.length;o++){const l=r[o].type;if(l===ui.emsg&&!i||!s)continue;const c=U7(r[o].data),h=r[o].pts;let d=h+r[o].duration;d>ng&&(d=ng),d-h<=0&&(d=h+wJ);for(let g=0;g<c.length;g++){const y=c[g];if(!V7(y)){this.updateId3CueEnds(h,l);const v=oL(a,h,d,y,l);v&&this.id3Track.addCue(v)}}}}updateId3CueEnds(e,t){var i;const s=(i=this.id3Track)==null?void 0:i.cues;if(s)for(let r=s.length;r--;){const a=s[r];a.type===t&&a.startTime<e&&a.endTime===ng&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:s}){const{id3Track:r,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(r&&(o||l)){let c;s==="audio"?c=h=>h.type===ui.audioId3&&l:s==="video"?c=h=>h.type===ui.emsg&&o:c=h=>h.type===ui.audioId3&&l||h.type===ui.emsg&&o,yI(r,t,i,c)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:s,enableDateRangeMetadataCues:r,interstitialsController:a}=this.hls.config;if(!r)return;const o=EI();if(i&&s&&!a){const{fragmentStart:v,fragmentEnd:T}=e;let b=this.assetCue;b?(b.startTime=v,b.endTime=T):o&&(b=this.assetCue=oL(o,v,T,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),b&&(b.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(b),b.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:c}=e,h=Object.keys(c);let d=this.dateRangeCuesAppended;if(l&&t){var f;if((f=l.cues)!=null&&f.length){const v=Object.keys(d).filter(T=>!h.includes(T));for(let T=v.length;T--;){var g;const b=v[T],E=(g=d[b])==null?void 0:g.cues;delete d[b],E&&Object.keys(E).forEach(_=>{const x=E[_];if(x){x.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(x)}catch{}}})}}else d=this.dateRangeCuesAppended={}}const y=e.fragments[e.fragments.length-1];if(!(h.length===0||!X(y==null?void 0:y.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let v=0;v<h.length;v++){const T=h[v],b=c[T],E=b.startTime,_=d[T],x=(_==null?void 0:_.cues)||{};let w=(_==null?void 0:_.durationKnown)||!1,R=ng;const{duration:C,endDate:k}=b;if(k&&C!==null)R=E+C,w=!0;else if(b.endOnNext&&!w){const I=h.reduce((O,G)=>{if(G!==b.id){const j=c[G];if(j.class===b.class&&j.startDate>b.startDate&&(!O||b.startDate<O.startDate))return j}return O},null);I&&(R=I.startTime,w=!0)}const P=Object.keys(b.attr);for(let I=0;I<P.length;I++){const O=P[I];if(!oQ(O))continue;const G=x[O];if(G)w&&!(_!=null&&_.durationKnown)?G.endTime=R:Math.abs(G.startTime-E)>.01&&(G.startTime=E,G.endTime=R);else if(o){let j=b.attr[O];lQ(O)&&(j=Q8(j));const W=oL(o,E,R,{key:O,data:j},ui.dateRange);W&&(W.id=T,this.id3Track.addCue(W),x[O]=W,a&&(O==="X-ASSET-LIST"||O==="X-ASSET-URL")&&W.addEventListener("enter",this.onEventCueEnter))}}d[T]={cues:x,dateRange:b,durationKnown:w}}}}}class IJ{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:a}=this.config;if(!r||a===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const l=s-o,c=Math.min(this.maxLatency,o+i.targetduration);if(l<c&&l>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,a)),f=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,g=Math.min(d,Math.max(1,f));this.changeMediaPlaybackRate(t,g)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let c=o&&i||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||c===0)&&(c=r!==void 0?r:a*s);const h=s;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,h)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const s=i.edge,r=e-t-this.edgeStalled,a=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,s;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class kJ extends mx{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},a={};let o=!1,l=!1,c=!1;t.levels.forEach(h=>{const d=h.attrs;let{audioCodec:f,videoCodec:g}=h;f&&(h.audioCodec=f=my(f,i)||void 0),g&&(g=h.videoCodec=Lz(g));const{width:y,height:v,unknownCodecs:T}=h,b=(T==null?void 0:T.length)||0;if(o||(o=!!(y&&v)),l||(l=!!g),c||(c=!!f),b||f&&!this.isAudioSupported(f)||g&&!this.isVideoSupported(g)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:E,"FRAME-RATE":_,"HDCP-LEVEL":x,"PATHWAY-ID":w,RESOLUTION:R,"VIDEO-RANGE":C}=d,P=`${`${w||"."}-`}${h.bitrate}-${R}-${_}-${E}-${C}-${x}`;if(r[P])if(r[P].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const I=a[P]+=1;h.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const O=this.createLevel(h);r[P]=O,s.push(O)}else r[P].addGroupId("audio",d.AUDIO),r[P].addGroupId("text",d.SUBTITLES);else{const I=this.createLevel(h);r[P]=I,a[P]=1,s.push(I)}}),this.filterAndSortMediaOptions(s,t,o,l,c)}createLevel(e){const t=new ju(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(s.message),t.supportedResult=l7(s,[])}return t}isAudioSupported(e){return Uh(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Uh(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,s,r){var a;let o=[],l=[],c=e;const h=((a=t.stats)==null?void 0:a.parsing)||{};if((i||s)&&r&&(c=c.filter(({videoCodec:E,videoRange:_,width:x,height:w})=>(!!E||!!(x&&w))&&$z(_))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let E="no level with compatible codecs found in manifest",_=E;t.levels.length&&(_=`one or more CODECS in variant not supported: ${Xe(t.levels.map(w=>w.attrs.CODECS).filter((w,R,C)=>C.indexOf(w)===R))}`,this.warn(_),E+=` (${_})`);const x=new Error(E);this.hls.trigger(S.ERROR,{type:ee.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:x,reason:_})}}),h.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(E=>!E.audioCodec||this.isAudioSupported(E.audioCodec)),WP(o)),t.subtitles&&(l=t.subtitles,WP(l));const d=c.slice(0);c.sort((E,_)=>{if(E.attrs["HDCP-LEVEL"]!==_.attrs["HDCP-LEVEL"])return(E.attrs["HDCP-LEVEL"]||"")>(_.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&E.height!==_.height)return E.height-_.height;if(E.frameRate!==_.frameRate)return E.frameRate-_.frameRate;if(E.videoRange!==_.videoRange)return gy.indexOf(E.videoRange)-gy.indexOf(_.videoRange);if(E.videoCodec!==_.videoCodec){const x=UR(E.videoCodec),w=UR(_.videoCodec);if(x!==w)return w-x}if(E.uri===_.uri&&E.codecSet!==_.codecSet){const x=py(E.codecSet),w=py(_.codecSet);if(x!==w)return w-x}return E.averageBitrate!==_.averageBitrate?E.averageBitrate-_.averageBitrate:0});let f=d[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==d.length)){for(let E=0;E<d.length;E++)if(d[E].pathwayId===c[0].pathwayId){f=d[E];break}}this._levels=c;for(let E=0;E<c.length;E++)if(c[E]===f){var g;this._firstLevel=E;const _=f.bitrate,x=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${_}`),((g=this.hls.userConfig)==null?void 0:g.abrEwmaDefaultEstimate)===void 0){const w=Math.min(_,this.hls.config.abrEwmaDefaultEstimateMax);w>x&&x===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=w)}break}const y=r&&!s,v=this.hls.config,T=!!(v.audioStreamController&&v.audioTrackController),b={levels:c,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:T&&!y&&o.some(E=>!!E.url)};h.end=performance.now(),this.hls.trigger(S.MANIFEST_PARSED,b)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:h,reason:h.message}),d)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];
vendor: 4,386 bytes, line 82
82if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&s&&r===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,l);const c=a.details;if(!c||c.live){const h=this.switchParams(a.uri,s==null?void 0:s.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(s=>t.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===xe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Z.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${s}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(s,t,l)}else(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),s=this.currentLevelIndex,r=e.attrs["PATHWAY-ID"],a=e.details,o=a==null?void 0:a.age;this.log(`Loading level index ${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${r?" Pathway "+r:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${i}`),this.hls.trigger(S.LEVEL_LOADING,{url:i,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((r,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));k7(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=i.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(S.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function WP(n){const e={};
vendor: 38,088 bytes, line 82
82n.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function MB(){return self.SourceBuffer||self.WebKitSourceBuffer}function y3(){if(!Jn())return!1;const e=MB();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function $B(){if(!y3())return!1;const n=Jn();return typeof(n==null?void 0:n.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>n.isTypeSupported(Vh(e,"video")))||["mp4a.40.2","fLaC"].some(e=>n.isTypeSupported(Vh(e,"audio"))))}function RJ(){var n;const e=MB();return typeof(e==null||(n=e.prototype)==null?void 0:n.changeType)=="function"}const PJ=100;class DJ extends fx{constructor(e,t,i){super(e,t,i,"stream-controller",Z.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,r=s?s.currentTime:null;if(r===null||!X(r)||(this.log(`Media seeked to ${r.toFixed(3)}`),!this.getBufferedFrag(r)))return;const a=this.getFwdBufferInfoAtPos(s,r,Z.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${r} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:s}=this;if(this.stopLoad(),this.setInterval(PJ),this.level=-1,!this.startFragRequested){let r=s.startLevel;r===-1&&(s.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=s.firstAutoLevel),s.nextLoadLevel=r,this.level=s.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=B.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=B.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case B.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(s))break;this.state=B.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=B.IDLE;break}break}case B.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===B.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(t===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const a=i[r],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const v={};this.altAudio===2&&(v.type="video"),this.hls.trigger(S.BUFFER_EOS,v),this.state=B.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const c=a.details;if(!c||this.state===B.WAITING_LEVEL||this.waitForLive(a)){this.level=r,this.state=B.WAITING_LEVEL,this.startFragRequested=!1;return}const h=o.len,d=this.getMaxBufferLength(a.maxBitrate);if(h>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:o.end;let g=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&pt(g)&&this.fragmentTracker.getState(g)!==St.OK){var y;const T=((y=this.backtrackFragment)!=null?y:g).sn-c.startSN,b=c.fragments[T-1];b&&g.cc===b.cc&&(g=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,f)){if(!g.gap){const T=this.audioOnly&&!this.altAudio?Qe.AUDIO:Qe.VIDEO,b=(T===Qe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,T,Z.MAIN)}g=this.getNextFragmentLoopLoading(g,c,o,Z.MAIN,d)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,a,f))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);s===St.NOT_LOADED||s===St.PARTIAL?pt(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Z.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<r.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],c=this.fragLastKbps;c&&this.fragCurrent?i=this.fragCurrent.duration*l.maxBitrate/(1e3*c)+1:i=0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,h=Math.max(a.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case B.KEY_LOADING:case B.FRAG_LOADING:case B.FRAG_LOADING_WAITING_RETRY:case B.PARSING:case B.PARSED:this.state=B.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;Jt(i,"playing",this.onMediaPlaying),Jt(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(hi(i,"playing",this.onMediaPlaying),hi(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,s=!1;for(let r=0;r<t.levels.length;r++){const a=t.levels[r].audioCodec;a&&(i=i||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&s&&!RJ(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==B.IDLE)return;const s=t.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=B.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:s,startFragRequested:r}=this,a=t.level,o=t.details,l=o.totalduration;if(!s){this.warn(`Levels were reset while loading level ${a}`);return}this.log(`Level ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${l}`);const c=t.levelInfo,h=this.fragCurrent;h&&(this.state===B.FRAG_LOADING||this.state===B.FRAG_LOADING_WAITING_RETRY)&&h.level!==t.level&&h.loader&&this.abortCurrentFrag();let d=0;if(o.live||(i=c.details)!=null&&i.live){var f;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,c.details,(f=this.levelLastLoaded)==null?void 0:f.details)}if(c.details=o,this.levelLastLoaded=c,r||this.setStartPosition(o,d),this.hls.trigger(S.LEVEL_UPDATED,{details:o,level:a}),this.state===B.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=B.IDLE}r&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const s=this.hls.liveSyncPosition,r=this.getLoadPosition(),a=e.fragmentStart,o=e.edge,l=r>=a-t.maxFragLookUpTolerance&&r<=o;if(s!==null&&i.duration>s&&(r<s||!l)){const h=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!l&&i.readyState<4||r<o-h)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),i.readyState))if(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var c;const d=me.bufferInfo(i,s,0);if(!((c=d.buffered)!=null&&c.length)){i.currentTime=s;return}if(d.start<=r){i.currentTime=s;return}const{nextStart:g}=me.bufferedInfo(d.buffered,r,0);g&&(i.currentTime=g)}else i.currentTime=s}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:s,payload:r}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=a[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const l=o.details;if(!l){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const c=o.videoCodec,h=l.PTSKnown||!l.live,d=(t=i.initSegment)==null?void 0:t.data,f=this._getAudioCodec(o),g=this.transmuxer=this.transmuxer||new Z7(this.hls,Z.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=s?s.index:-1,v=y!==-1,T=new dx(i.level,i.sn,i.stats.chunkCount,r.byteLength,y,v),b=this.initPTS[i.cc];g.push(r,d,f,c,i,s,l.totalduration,h,T,b)}onAudioTrackSwitching(e,t){const i=this.hls,s=this.altAudio!==0;if(yy(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=0,this.fragmentTracker.removeAllFragments(),i.once(S.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(S.AUDIO_TRACK_SWITCHED,t)}),i.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(S.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=yy(t.url,this.hls);if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,a=!1;for(const o in i){const l=i[o];if(l.id==="main"){if(r=o,s=l,o==="video"){const c=i[o];c&&(this.videoBuffer=c.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t,r=i.type===Z.MAIN;if(r){if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===B.PARSED&&(this.state=B.IDLE);return}const o=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),pt(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}const a=this.media;a&&(!this._hasEnoughToStart&&me.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=B.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Z.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===B.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===xe.LEVEL&&(this.state=B.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=B.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Qe.AUDIO||!this.altAudio){const i=(t===Qe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,Z.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const s=this.timelineOffset;s&&i&&(i+=s);const r=this.getLevelDetails(),a=me.getBuffered(e),o=a.length?a.start(0):0,l=o-i,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||l>0&&(l<c||this.loadingParts&&l<2*((r==null?void 0:r.partTarget)||0)))&&(this.log(`adjusting start position by ${l} to match buffer start`),i+=l,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:s}=this,r=i==null?void 0:i.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=B.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),s.trigger(S.FRAG_LOADED,i),r.bitrateTest=!1}).catch(i=>{this.state===B.STOPPED||this.state===B.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:s,chunkMeta:r}=e,a=this.getCurrentContext(r);if(!a){this.resetWhenMissingContext(r);return}const{frag:o,part:l,level:c}=a,{video:h,text:d,id3:f,initSegment:g}=s,{details:y}=c,v=this.altAudio?void 0:s.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=B.PARSING,g){const T=g.tracks;if(T){const x=o.initSegment||o;if(this.unhandledEncryptionError(g,o))return;this._bufferInitSegment(c,T,x,r),i.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:x,id:t,tracks:T})}const b=g.initPTS,E=g.timescale,_=this.initPTS[o.cc];if(X(b)&&(!_||_.baseTime!==b||_.timescale!==E)){const x=g.trackId;this.initPTS[o.cc]={baseTime:b,timescale:E,trackId:x},i.trigger(S.INIT_PTS_FOUND,{frag:o,id:t,initPTS:b,timescale:E,trackId:x})}}if(h&&y){v&&h.type==="audiovideo"&&this.logMuxedErr(o);const T=y.fragments[o.sn-1-y.startSN],b=o.sn===y.startSN,E=!T||o.cc>T.cc;if(s.independent!==!1){const{startPTS:_,endPTS:x,startDTS:w,endDTS:R}=h;if(l)l.elementaryStreams[h.type]={startPTS:_,endPTS:x,startDTS:w,endDTS:R};else if(h.firstKeyFrame&&h.independent&&r.id===1&&!E&&(this.couldBacktrack=!0),h.dropped&&h.independent){const C=this.getMainFwdBufferInfo(),k=(C?C.end:this.getLoadPosition())+this.config.maxBufferHole,P=h.firstKeyFramePTS?h.firstKeyFramePTS:_;if(!b&&k<P-this.config.maxBufferHole&&!E){this.backtrack(o);return}else E&&(o.gap=!0);o.setElementaryStreamInfo(h.type,o.start,x,o.start,R,!0)}else b&&_-(y.appliedTimelineOffset||0)>qg&&(o.gap=!0);o.setElementaryStreamInfo(h.type,_,x,w,R),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,l,r,b||E)}else if(b||E)o.gap=!0;else{this.backtrack(o);return}}if(v){const{startPTS:T,endPTS:b,startDTS:E,endDTS:_}=v;l&&(l.elementaryStreams[Qe.AUDIO]={startPTS:T,endPTS:b,startDTS:E,endDTS:_}),o.setElementaryStreamInfo(Qe.AUDIO,T,b,E,_),this.bufferFragmentData(v,o,l,r)}if(y&&f!=null&&f.samples.length){const T={id:t,frag:o,details:y,samples:f.samples};i.trigger(S.FRAG_PARSING_METADATA,T)}if(y&&d){const T={id:t,frag:o,details:y,samples:d.samples};i.trigger(S.FRAG_PARSING_USERDATA,T)}}logMuxedErr(e){this.warn(`${pt(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,s){if(this.state!==B.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:r,video:a,audiovideo:o}=t;if(r){const c=e.audioCodec;let h=Ng(r.codec,c);h==="mp4a"&&(h="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){h&&(h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5");const f=r.metadata;f&&"channelCount"in f&&(f.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(h="mp4a.40.5")}h&&h.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(h="mp4a.40.2",this.log(`Android: force audio codec to ${h}`)),c&&c!==h&&this.log(`Swapping manifest audio codec "${c}" for "${h}"`),r.levelCodec=h,r.id=Z.MAIN,this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${h||""}/${c||""}/${r.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=Z.MAIN;const c=a.codec;if((c==null?void 0:c.length)===4)switch(c){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${c}]${a.codec!==c?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(S.BUFFER_CODECS,t),!this.hls)return;l.forEach(c=>{const d=t[c].initSegment;d!=null&&d.byteLength&&this.hls.trigger(S.BUFFER_APPENDING,{type:c,data:d,frag:i,part:null,chunkMeta:s,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Z.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=B.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(me.isBuffered(e,i)?t=this.getAppendedFrag(i):me.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,r=t.level;(!s||t.sn!==s.sn||s.level!==r)&&(this.fragPlaying=t,this.hls.trigger(S.FRAG_CHANGED,{frag:t}),(!s||s.level!==r)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return X(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(X(t)){const i=this.getLevelDetails(),s=this.currentFrag||(i?pl(null,i.fragments,t):null);if(s){const r=s.programDateTime;if(r!==null){const a=r+(t-s.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class OJ extends Bi{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[i].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=$.KEY_LOAD_ERROR,i,s,r){return new cn({type:ee.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let s=0,r=t.length;s<r;s++){const a=t[s];if(e.cc<=a.cc&&(!pt(e)||!pt(a)||e.sn<a.sn)||!i&&s==r-1)return this.emeController.selectKeySystemFormat(a).then(o=>{if(!this.emeController)return;a.setKeyFormat(o);const l=Fg(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const s=Th(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,c))}const a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=lL(r);let l=this.keyIdToKeyInfo[o];if((i=l)!=null&&i.decryptdata.key)return r.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(s=l)!=null&&s.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(h=>{const{keyInfo:d}=h;return r.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${r.keyId?" keyId: "+Bt(r.keyId):""} URI: ${r.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=t.initSegment)!=null&&s.data){const a=pz(t.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${Bt(o)}`),Xn.setKeyIdForUri(e.decryptdata.uri,o)):(o=Xn.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Bt(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!pt(t))return Promise.resolve(i);const r=this.emeController.loadKey(i);return(e.keyLoadPromise=r.then(a=>(e.mediaKeySessionContext=a,i))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=i.loader,r=new s(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=i.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(f,g,y,v)=>{const{frag:T,keyInfo:b}=y,E=lL(b.decryptdata);if(!T.decryptdata||b!==this.keyIdToKeyInfo[E])return o(this.createKeyLoadError(T,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),v));b.decryptdata.key=T.decryptdata.key=new Uint8Array(f.data),T.keyLoader=null,b.loader=null,a({frag:T,keyInfo:b})},onError:(f,g,y,v)=>{this.resetLoader(g),o(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),y,He({url:l.url,data:void 0},f)))},onTimeout:(f,g,y)=>{this.resetLoader(g),o(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(f,g,y)=>{this.resetLoader(g),o(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};r.load(l,h,d)})}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null);const a=lL(i.decryptdata)||s;delete this.keyIdToKeyInfo[a],r&&r.destroy()}}function lL(n){if(n.keyFormat!==Rt.FAIRPLAY){const e=n.keyId;if(e)return Bt(e)}return n.uri}function YP(n){const{type:e}=n;switch(e){case xe.AUDIO_TRACK:return Z.AUDIO;case xe.SUBTITLE_TRACK:return Z.SUBTITLE;default:return Z.MAIN}}function cL(n,e){let t=n.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class MJ{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=i||s,a=new r(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:xe.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:a,deliveryDirectives:o,levelInfo:l}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:xe.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:xe.AUDIO_TRACK,url:r,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a,track:o}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:xe.SUBTITLE_TRACK,url:r,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[xe.LEVEL];if(i){const s=i.context;s&&!t.levels.some(r=>r===s.levelOrTrack)&&(i.abort(),delete this.loaders[xe.LEVEL])}}load(e){var t;const i=this.hls.config;let s=this.getInternalLoader(e);if(s){const c=this.hls.logger,h=s.context;if(h&&h.levelOrTrack===e.levelOrTrack&&(h.url===e.url||h.deliveryDirectives&&!e.deliveryDirectives)){h.url===e.url?c.log(`[playlist-loader]: ignore ${e.url} ongoing request`):c.log(`[playlist-loader]: ignore ${e.url} in favor of ${h.url}`);return}c.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let r;if(e.type===xe.MANIFEST?r=i.manifestLoadPolicy.default:r=We({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),X((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===xe.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===xe.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===xe.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const h=c.partTarget,d=c.targetduration;if(h&&d){const f=Math.max(h*3,d*.8)*1e3;r=We({},r,{maxTimeToFirstByteMs:Math.min(f,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(f,r.maxTimeToFirstByteMs)})}}}const a=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,d,f)=>{const g=this.getInternalLoader(d);this.resetInternalLoader(d.type);const y=c.data;h.parsing.start=performance.now(),cs.isMediaPlaylist(y)||d.type!==xe.MANIFEST?this.handleTrackOrLevelPlaylist(c,h,d,f||null,g):this.handleMasterPlaylist(c,h,d,f)},onError:(c,h,d,f)=>{this.handleNetworkError(h,d,!1,c,f)},onTimeout:(c,h,d)=>{this.handleNetworkError(h,d,!0,void 0,c)}};s.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,s){const r=this.hls,a=e.data,o=cL(e,i),l=cs.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,l.playlistParsingError,s,t);return}const{contentSteering:c,levels:h,sessionData:d,sessionKeys:f,startTimeOffset:g,variableList:y}=l;this.variableList=y,h.forEach(E=>{const{unknownCodecs:_}=E;if(_){const{preferManagedMediaSource:x}=this.hls.config;let{audioCodec:w,videoCodec:R}=E;for(let C=_.length;C--;){const k=_[C];Uh(k,"audio",x)?(E.audioCodec=w=w?`${w},${k}`:k,Ku.audio[w.substring(0,4)]=2,_.splice(C,1)):Uh(k,"video",x)&&(E.videoCodec=R=R?`${R},${k}`:k,Ku.video[R.substring(0,4)]=2,_.splice(C,1))}}});const{AUDIO:v=[],SUBTITLES:T,"CLOSED-CAPTIONS":b}=cs.parseMasterPlaylistMedia(a,o,l);v.length&&!v.some(_=>!_.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new st({}),bitrate:0,url:""})),r.trigger(S.MANIFEST_LOADED,{levels:h,audioTracks:v,subtitles:T,captions:b,contentSteering:c,url:o,stats:t,networkDetails:s,sessionData:d,sessionKeys:f,startTimeOffset:g,variableList:y})}handleTrackOrLevelPlaylist(e,t,i,s,r){const a=this.hls,{id:o,level:l,type:c}=i,h=cL(e,i),d=X(l)?l:X(o)?o:0,f=YP(i),g=cs.parseLevelPlaylist(e.data,h,d,f,0,this.variableList);if(c===xe.MANIFEST){const y={attrs:new st({}),bitrate:0,details:g,name:"",url:h};g.requestScheduled=t.loading.start+w7(g,0),a.trigger(S.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(S.ERROR,{type:ee.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===xe.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let a=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===xe.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===xe.AUDIO_TRACK||e.type===xe.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=$.UNKNOWN,c=!1;const h=this.getInternalLoader(e);switch(e.type){case xe.MANIFEST:l=i?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,c=!0;break;case xe.LEVEL:l=i?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,c=!1;break;case xe.AUDIO_TRACK:l=i?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case xe.SUBTITLE_TRACK:l=i?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,c=!1;break}h&&this.resetInternalLoader(e.type);const d={type:ee.NETWORK_ERROR,details:l,fatal:c,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:r};if(s){const f=(t==null?void 0:t.url)||e.url;d.response=He({url:f,data:void 0},s)}this.hls.trigger(S.ERROR,d)}handlePlaylistLoaded(e,t,i,s,r,a){const o=this.hls,{type:l,level:c,levelOrTrack:h,id:d,groupId:f,deliveryDirectives:g}=s,y=cL(t,s),v=YP(s);let T=typeof s.level=="number"&&v===Z.MAIN?c:void 0;const b=e.playlistParsingError;if(b){if(this.hls.logger.warn(`${b} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(S.ERROR,{type:ee.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:y,error:b,reason:b.message,response:t,context:s,level:T,parent:v,networkDetails:r,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const E=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(S.ERROR,{type:ee.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:y,error:E,reason:E.message,response:t,context:s,level:T,parent:v,networkDetails:r,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case xe.MANIFEST:case xe.LEVEL:if(T){if(!h)T=0;else if(h!==o.levels[T]){const E=o.levels.indexOf(h);E>-1&&(T=E)}}o.trigger(S.LEVEL_LOADED,{details:e,levelInfo:h||o.levels[0],level:T||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:g,withoutMultiVariant:l===xe.MANIFEST});break;case xe.AUDIO_TRACK:o.trigger(S.AUDIO_TRACK_LOADED,{details:e,track:h,id:d||0,groupId:f||"",stats:i,networkDetails:r,deliveryDirectives:g});break;case xe.SUBTITLE_TRACK:o.trigger(S.SUBTITLE_TRACK_LOADED,{details:e,track:h,id:d||0,groupId:f||"",stats:i,networkDetails:r,deliveryDirectives:g});break}}}class Yn{static get version(){return Hh}static isMSESupported(){return y3()}static isSupported(){return $B()}static getMediaSource(){return Jn()}static get Events(){return S}static get MetadataSchema(){return ui}static get ErrorTypes(){return ee}static get ErrorDetails(){return $}static get DefaultConfig(){return Yn.defaultConfig?Yn.defaultConfig:TJ}static set DefaultConfig(e){Yn.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new r3,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=sz(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=EJ(Yn.DefaultConfig,e,t);this.userConfig=e,i.progressive&&SJ(i,t);const{abrController:s,bufferController:r,capLevelController:a,errorController:o,fpsController:l}=i,c=new o(this),h=this.abrController=new s(this),d=new zz(this),f=i.interstitialsController,g=f?this.interstitialsController=new f(this,Yn):null,y=this.bufferController=new r(this,d),v=this.capLevelController=new a(this),T=new l(this),b=new MJ(this),E=i.contentSteeringController,_=E?new E(this):null,x=this.levelController=new kJ(this,_),w=new CJ(this),R=new OJ(this.config,this.logger),C=this.streamController=new DJ(this,d,R),k=this.gapController=new LJ(this,d);v.setStreamController(C),T.setStreamController(C);const P=[b,x,C];g&&P.splice(1,0,g),_&&P.splice(1,0,_),this.networkControllers=P;
vendor: 8,029 bytes, line 82
82const I=[h,y,k,v,T,w,d];this.audioTrackController=this.createController(i.audioTrackController,P);const O=i.audioStreamController;O&&P.push(this.audioStreamController=new O(this,d,R)),this.subtitleTrackController=this.createController(i.subtitleTrackController,P);const G=i.subtitleStreamController;G&&P.push(this.subtititleStreamController=new G(this,d,R)),this.createController(i.timelineController,I),R.emeController=this.emeController=this.createController(i.emeController,I),this.cmcdController=this.createController(i.cmcdController,I),this.latencyController=this.createController(IJ,I),this.coreComponents=I,P.push(c);const j=c.onErrorOut;typeof j=="function"&&this.on(S.ERROR,j,c),this.on(S.MANIFEST_LOADED,b.onManifestLoaded,b)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const s=e===S.ERROR;this.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:s,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const r=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(S.ERROR,{type:ee.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:r});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,s=t?e:{media:i};this._media=i,this.trigger(S.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,s=this._url=Yk.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(S.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Z.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Z.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Z.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=kZ()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Mz(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s<i;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,i)for(let r=s;r--;){const a=e[r].attrs["HDCP-LEVEL"];if(a&&a<=i)return r}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}
82setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=h7(t);return c7(e,i,navigator.mediaCapabilities)}}Yn.defaultConfig=void 0;const $J=Object.freeze(Object.defineProperty({__proto__:null,AbrController:d7,AttrList:st,AudioStreamController:J7,AudioTrackController:tB,BasePlaylistController:mx,BaseSegment:zk,BaseStreamController:fx,BufferController:sB,CMCDController:pB,CapLevelController:gx,ChunkMetadata:dx,ContentSteeringController:mB,Cues:DB,DateRange:t3,EMEController:ol,ErrorActionFlags:ci,ErrorController:y7,ErrorDetails:$,ErrorTypes:ee,Events:S,FPSController:yB,FetchLoader:TI,Fragment:$g,Hls:Yn,HlsSkip:Ch,HlsUrlParameters:rI,KeySystemFormats:Rt,KeySystems:nt,Level:ju,LevelDetails:b7,LevelKey:Xn,LoadStats:ux,M3U8Parser:cs,MetadataSchema:ui,NetworkErrorAction:Et,Part:X8,PlaylistLevelType:Z,SubtitleStreamController:SB,SubtitleTrackController:bB,TimelineController:RB,XhrLoader:g3,default:Yn,fetchSupported:OB,getMediaSource:Jn,isMSESupported:y3,isSupported:$B,requestMediaKeySystemAccess:n3},Symbol.toStringTag,{value:"Module"})),NJ=.1;function NB(n,e=NJ){if(!Array.isArray(n)||n.length===0)return[];const t=n.filter(s=>s&&s.end>s.start).map(s=>({start:s.start,end:s.end})).sort((s,r)=>s.start-r.start);if(t.length===0)return[];const i=[t[0]];for(let s=1;s<t.length;s++){const r=i[i.length-1],a=t[s];a.start<=r.end+e?r.end=Math.max(r.end,a.end):i.push(a)}return i}function FB(n){return NB(n).reduce((e,t)=>e+(t.end-t.start),0)}function FJ(n,e){return!e||e<=0?0:Math.min(FB(n)/e,1)}class BJ{constructor(e,t={}){this.player=e,this.options={completionThreshold:80,onComplete:null,onProgressUpdate:null,mediaId:null,segmentUpdateInterVal:5,...t},this.segments=[],this.duration=0,this.startTime=0,this.endTime=0,this.seeking=!1,this.completed=!1,this.isPlaying=!1,this.attachEventListeners()}attachEventListeners(){this._handleSeeking=this.handleSeeking.bind(this),this._handleSeeked=this.handleSeeked.bind(this),this._handleTimeUpdate=this.handleTimeUpdate.bind(this),this._handleEnded=this.handleEnded.bind(this),this._handlePause=this.handlePause.bind(this),this._handlePlay=this.handlePlay.bind(this),this.player.addEventListener("seeking",this._handleSeeking),this.player.addEventListener("seeked",this._handleSeeked),this.player.addEventListener("time-update",this._handleTimeUpdate),this.player.addEventListener("ended",this._handleEnded),this.player.addEventListener("pause",this._handlePause),this.player.addEventListener("play",this._handlePlay),this.handleLoadedMetadata()}handleLoadedMetadata(){this.duration=this.getPlayerDuration(),this.startTime=this.getPlayerCurrentTime(),this.endTime=this.startTime}ensureDuration(){this.duration||(this.duration=this.getPlayerDuration())}handleSeeking(){this.isPlaying&&this.addWatchedSegment(),this.seeking=!0}handleSeeked(){this.startTime=this.getPlayerCurrentTime(),this.endTime=this.startTime,this.seeking=!1}handlePlay(){this.ensureDuration(),this.startTime=this.getPlayerCurrentTime(),this.endTime=this.startTime,this.isPlaying=!0}handlePause(){this.endTime=this.getPlayerCurrentTime(),this.addWatchedSegment(),this.isPlaying=!1}handleTimeUpdate(){if(!this.seeking&&this.isPlaying){const e=this.getPlayerCurrentTime(),t=e-this.endTime;this.endTime>this.startTime&&Math.abs(t)>2&&(this.addWatchedSegment(),this.startTime=e),this.endTime=e,this.endTime-this.startTime>this.options.segmentUpdateInterVal&&(this.addWatchedSegment(),this.notifyProgressUpdate())}this.checkCompletion()}handleEnded(){this.ensureDuration(),this.endTime=this.getPlayerCurrentTime(),this.addWatchedSegment(),this.isPlaying=!1,this.checkCompletion(),this.notifyProgressUpdate()}getPlayerCurrentTime(){try{const e=typeof this.player.currentTime=="function"?this.player.currentTime():this.player.currentTime||0;return this._lastCurrentTime=e,e}catch{return this._lastCurrentTime||this.endTime||this.startTime||0}}getPlayerDuration(){try{return typeof this.player.duration=="function"?this.player.duration():this.player.duration||0}catch{return this.duration||0}}addWatchedSegment(){if(this.ensureDuration(),!this.duration||this.startTime>=this.endTime)return;const e=Math.max(0,Math.min(this.startTime,this.duration)),t=Math.max(0,Math.min(this.endTime,this.duration));t-e>.1&&(this.segments.push({start:e,end:t}),this.mergeOverlappingSegments()),this.startTime=this.endTime}mergeOverlappingSegments(){this.segments=NB(this.segments)}checkCompletion(){const e=this.getWatchedPercentage();e>=this.options.completionThreshold&&!this.completed&&(this.completed=!0,typeof this.options.onComplete=="function"&&this.options.onComplete({mediaId:this.options.mediaId,percentage:e,watchedTime:this.getTotalWatchedTime(),segments:this.segments}),this.dispatchCompletionEvent(e),this.notifyProgressUpdate())}notifyProgressUpdate(){typeof this.options.onProgressUpdate=="function"&&this.options.onProgressUpdate({mediaId:this.options.mediaId,percentage:this.getWatchedPercentage(),watchedTime:this.getTotalWatchedTime(),segments:this.segments,completed:this.completed})}dispatchCompletionEvent(e){try{const t=new CustomEvent("playlist-media-completed",{detail:{mediaId:this.options.mediaId,percentage:e,watchedTime:this.getTotalWatchedTime(),segments:this.segments}});
82this.player.dispatchEvent(t)}catch(t){console.warn("Could not dispatch completion event",t)}}getWatchedPercentage(){return FJ(this.segments,this.duration)*100}getTotalWatchedTime(){return FB(this.segments)}loadProgress(e){Array.isArray(e)&&(this.segments=e,this.mergeOverlappingSegments()),this.checkCompletion()}reset(){this.segments=[],this.startTime=0,this.endTime=0,this.completed=!1}destroy(){this.player.removeEventListener("seeking",this._handleSeeking),this.player.removeEventListener("seeked",this._handleSeeked),this.player.removeEventListener("time-update",this._handleTimeUpdate),this.player.removeEventListener("ended",this._handleEnded),this.player.removeEventListener("pause",this._handlePause),this.player.removeEventListener("play",this._handlePlay)}}const UJ=Object.freeze(Object.defineProperty({__proto__:null,default:BJ},Symbol.toStringTag,{value:"Module"})),zP={q25:.25,q50:.5,q75:.75},VJ=["q25","q50","q75"];function HJ(n,e){return n-e}function qJ(n,e){const t=QP(n&&n.coverage),i=!!(n&&n.durationKnown),s=!!(n&&n.started),r=!!(n&&n.ended);let a=QP(n&&n.maxCoverage);a>0||(a=1);const o=Array.isArray(e&&e.quartiles)?e.quartiles:[],l=Array.isArray(e&&e.completions)?e.completions:[],c=[];if(e&&e.started&&s&&c.push({key:"started",boundary:null}),i){for(const h of VJ)o.includes(h)&&t>=zP[h]&&c.push({key:h,boundary:zP[h]});for(const h of[...l].sort(HJ))KJ(h)&&t>=Math.min(h,a)&&c.push({key:"completed",boundary:h})}else r&&l.length>0&&c.push({key:"completed",boundary:null});return c}function GJ(n){const e=n.boundary===null||n.boundary===void 0?"x":Number(n.boundary).toFixed(4);return`${n.key}:${e}`}function QP(n){return typeof n!="number"||Number.isNaN(n)?0:Math.max(0,Math.min(n,1))}function KJ(n){return typeof n=="number"&&n>0&&n<=1}const jJ="fluent_player_media_milestone",WJ=1e3,YJ=["q25","q50","q75"];function zJ(n){const e=n&&typeof n=="object"?n:{},t=Array.isArray(e.quartiles)?e.quartiles.filter(s=>YJ.includes(s)):[],i=Array.isArray(e.completions)?e.completions.map(Number).filter(s=>s>0&&s<=1):[];return{started:!!e.started,quartiles:t,completions:i}}class QJ{constructor(e,t={}){this.watchTracker=e,this.player=e?e.player:null,this.mediaId=t.mediaId,this.armed=zJ(t.armed),this.canReport=W8(t),this.channel=new Y8({action:jJ,nonce:t.nonce,mediaId:t.mediaId,buildEvidence:()=>{var i,s;return{segments:JSON.stringify(((i=this.watchTracker)==null?void 0:i.segments)||[]),duration:Math.round(Number((s=this.watchTracker)==null?void 0:s.duration)||0),ended:this.ended?1:0}}}),this.started=!1,this.ended=!1,this._lastEvalAt=0,this._onPlay=this._handlePlay.bind(this),this._onTimeUpdate=this._handleTimeUpdate.bind(this),this._onPause=this._handlePause.bind(this),this._onEnded=this._handleEnded.bind(this),this._onVisibility=this._handleVisibility.bind(this),this._onBeforeUnload=this._handleBeforeUnload.bind(this),this._attach()}get fired(){return this.channel.fired}get pending(){return this.channel.pending}get attempts(){return this.channel.attempts}get sending(){return this.channel.sending}hasArmedMilestones(){return this.armed.started||this.armed.quartiles.length>0||this.armed.completions.length>0}_attach(){!this.watchTracker||!this.player||!this.mediaId||!this.canReport||!this.hasArmedMilestones()||(this.player.addEventListener("play",this._onPlay),this.player.addEventListener("time-update",this._onTimeUpdate),this.player.addEventListener("pause",this._onPause),this.player.addEventListener("ended",this._onEnded),document.addEventListener("visibilitychange",this._onVisibility),window.addEventListener("beforeunload",this._onBeforeUnload),this._attached=!0,this.player.paused===!1&&this._handlePlay())}_handlePlay(){this.started=!0,this._tick(!0,!1),this._baselineSent||(this._baselineSent=!0,this.channel.pending.size===0&&(this._captureNow(),this.channel.ping([],!1)))}_handleTimeUpdate(){this._tick(!1,!1)}_handlePause(){this._tick(!0,!1)}_handleEnded(){this.ended=!0,this._tick(!0,!1)}_handleVisibility(){document.visibilityState==="hidden"&&(this._tick(!0,!0),this._persistEvidence())}_handleBeforeUnload(){this._tick(!0,!0),this._persistEvidence()}_persistEvidence(){if(!this._attached||!this.started||this.channel.pending.size>0)return;const e=this.watchTracker?this.watchTracker.getTotalWatchedTime():0;e<=(this._lastPersistedWatched||0)||(this._lastPersistedWatched=e,this._captureNow(),this.channel.ping([],!0))}_tick(e,t){if(!this._attached)return;const i=Date.now();!e&&i-this._lastEvalAt<WJ||(this._lastEvalAt=i,this._captureNow(),this.channel.claim(qJ(this._evidence(),this.armed).map(GJ)),this.channel.flush(t))}_captureNow(){const e=this.watchTracker;e&&e.isPlaying&&(e.endTime=e.getPlayerCurrentTime(),e.addWatchedSegment())}_evidence(){const e=Number(this.watchTracker.duration)||0,t=this.watchTracker.getWatchedPercentage()/100,i=this.watchTracker.getTotalWatchedTime();return{coverage:t,durationKnown:e>0,started:this.started&&(e>0?i>=1:!0),ended:this.ended,maxCoverage:e>1?(e-1)/e:1}}destroy(){this.channel.pending.size>0?this._tick(!0,!0):this._persistEvidence(),this._attached&&(this.player.removeEventListener("play",this._onPlay),this.player.removeEventListener("time-update",this._onTimeUpdate),this.player.removeEventListener("pause",this._onPause),this.player.removeEventListener("ended",this._onEnded),document.removeEventListener("visibilitychange",this._onVisibility),window.removeEventListener("beforeunload",this._onBeforeUnload),this._attached=!1),this.watchTracker=null}}const XJ=Object.freeze(Object.defineProperty({__proto__:null,default:QJ},Symbol.toStringTag,{value:"Module"}));var ZJ=Object.create,BB=Object.defineProperty,JJ=Object.getOwnPropertyDescriptor,eee=Object.getOwnPropertyNames,tee=Object.getPrototypeOf,iee=Object.prototype.hasOwnProperty,UB=function(n,e){return function(){return n&&(e=n(n=0)),e}},fi=function(n,e){return function(){return e||n((e={exports:{}}).exports,e),e.exports}},see=function(n,e,t,i){if(e&&typeof e=="object"||typeof e=="function")for(var s=eee(e),r=0,a=s.length,o;r<a;r++)o=s[r],!iee.call(n,o)&&o!==t&&BB(n,o,{get:(function(l){return e[l]}).bind(null,o),enumerable:!(i=JJ(e,o))||i.enumerable});return n},Ui=function(n,e,t){return t=n!=null?ZJ(tee(n)):{},see(e||!n||!n.__esModule?BB(t,"default",{value:n,enumerable:!0}):t,n)},tn=fi(function(n,e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={},e.exports=t});function El(n,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](n):El(n,e)}var Sl=UB(function(){Sl()});function VB(n){"@swc/helpers - typeof";return n&&typeof Symbol<"u"&&n.constructor===Symbol?"symbol":typeof n}var HB=UB(function(){}),qB=fi(function(n,e){var t=Array.prototype.slice;e.exports=i;function i(s,r){for(("length"in s)||(s=[s]),s=t.call(s);s.length;){var a=s.shift(),o=r(a);if(o)return o;a.childNodes&&a.childNodes.length&&(s=t.call(a.childNodes).concat(s))}}}),nee=fi(function(n,e){Sl(),e.exports=t;
vendor: 21,794 bytes, lines 82-93
82function t(i,s){if(!El(this,t))return new t(i,s);this.data=i,this.nodeValue=i,this.length=i.length,this.ownerDocument=s||null}t.prototype.nodeType=8,t.prototype.nodeName="#comment",t.prototype.toString=function(){return"[object Comment]"}}),ree=fi(function(n,e){Sl(),e.exports=t;function t(i,s){if(!El(this,t))return new t(i);this.data=i||"",this.length=this.data.length,this.ownerDocument=s||null}t.prototype.type="DOMTextNode",t.prototype.nodeType=3,t.prototype.nodeName="#text",t.prototype.toString=function(){return this.data},t.prototype.replaceData=function(i,s,r){var a=this.data,o=a.substring(0,i),l=a.substring(i+s,a.length);this.data=o+r+l,this.length=this.data.length}}),GB=fi(function(n,e){e.exports=t;function t(i){var s=this,r=i.type;i.target||(i.target=s),s.listeners||(s.listeners={});var a=s.listeners[r];if(a)return a.forEach(function(o){i.currentTarget=s,typeof o=="function"?o(i):o.handleEvent(i)});s.parentNode&&s.parentNode.dispatchEvent(i)}}),KB=fi(function(n,e){e.exports=t;function t(i,s){var r=this;r.listeners||(r.listeners={}),r.listeners[i]||(r.listeners[i]=[]),r.listeners[i].indexOf(s)===-1&&r.listeners[i].push(s)}}),jB=fi(function(n,e){e.exports=t;function t(i,s){var r=this;if(r.listeners&&r.listeners[i]){var a=r.listeners[i],o=a.indexOf(s);o!==-1&&a.splice(o,1)}}}),aee=fi(function(n,e){HB(),e.exports=i;var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function i(f){switch(f.nodeType){case 3:return h(f.data);case 8:return"<!--"+f.data+"-->";default:return s(f)}}function s(f){var g=[],y=f.tagName;return f.namespaceURI==="http://www.w3.org/1999/xhtml"&&(y=y.toLowerCase()),g.push("<"+y+c(f)+o(f)),t.indexOf(y)>-1?g.push(" />"):(g.push(">"),f.childNodes.length?g.push.apply(g,f.childNodes.map(i)):f.textContent||f.innerText?g.push(h(f.textContent||f.innerText)):f.innerHTML&&g.push(f.innerHTML),g.push("</"+y+">")),g.join("")}function r(f,g){var y=VB(f[g]);return g==="style"&&Object.keys(f.style).length>0?!0:f.hasOwnProperty(g)&&(y==="string"||y==="boolean"||y==="number")&&g!=="nodeName"&&g!=="className"&&g!=="tagName"&&g!=="textContent"&&g!=="innerText"&&g!=="namespaceURI"&&g!=="innerHTML"}function a(f){if(typeof f=="string")return f;var g="";return Object.keys(f).forEach(function(y){var v=f[y];y=y.replace(/[A-Z]/g,function(T){return"-"+T.toLowerCase()}),g+=y+":"+v+";"}),g}function o(f){var g=f.dataset,y=[];for(var v in g)y.push({name:"data-"+v,value:g[v]});return y.length?l(y):""}function l(f){var g=[];return f.forEach(function(y){var v=y.name,T=y.value;v==="style"&&(T=a(T)),g.push(v+'="'+d(T)+'"')}),g.length?" "+g.join(" "):""}function c(f){var g=[];for(var y in f)r(f,y)&&g.push({name:y,value:f[y]});for(var v in f._attributes)for(var T in f._attributes[v]){var b=f._attributes[v][T],E=(b.prefix?b.prefix+":":"")+T;g.push({name:E,value:b.value})}return f.className&&g.push({name:"class",value:f.className}),g.length?l(g):""}function h(f){var g="";return typeof f=="string"?g=f:f&&(g=f.toString()),g.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d(f){return h(f).replace(/"/g,"&quot;")}}),WB=fi(function(n,e){Sl();var t=qB(),i=GB(),s=KB(),r=jB(),a=aee(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(c,h,d){if(!El(this,l))return new l(c);var f=d===void 0?o:d||null;this.tagName=f===o?String(c).toUpperCase():c,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=h||null,this.namespaceURI=f,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(c){return c.parentNode&&c.parentNode.removeChild(c),this.childNodes.push(c),c.parentNode=this,c},l.prototype.replaceChild=function(c,h){c.parentNode&&c.parentNode.removeChild(c);var d=this.childNodes.indexOf(h);return h.parentNode=null,this.childNodes[d]=c,c.parentNode=this,h},l.prototype.removeChild=function(c){var h=this.childNodes.indexOf(c);return this.childNodes.splice(h,1),c.parentNode=null,c},l.prototype.insertBefore=function(c,h){c.parentNode&&c.parentNode.removeChild(c);var d=h==null?-1:this.childNodes.indexOf(h);return d>-1?this.childNodes.splice(d,0,c):this.childNodes.push(c),c.parentNode=this,c},l.prototype.setAttributeNS=function(c,h,d){var f=null,g=h,y=h.indexOf(":");if(y>-1&&(f=h.substr(0,y),g=h.substr(y+1)),this.tagName==="INPUT"&&h==="type")this.type=d;else{var v=this._attributes[c]||(this._attributes[c]={});v[g]={value:d,prefix:f}}},l.prototype.getAttributeNS=function(c,h){var d=this._attributes[c],f=d&&d[h]&&d[h].value;return this.tagName==="INPUT"&&h==="type"?this.type:typeof f!="string"?null:f},l.prototype.removeAttributeNS=function(c,h){var d=this._attributes[c];d&&delete d[h]},l.prototype.hasAttributeNS=function(c,h){var d=this._attributes[c];return!!d&&h in d},l.prototype.setAttribute=function(c,h){return this.setAttributeNS(null,c,h)},l.prototype.getAttribute=function(c){return this.getAttributeNS(null,c)},l.prototype.removeAttribute=function(c){return this.removeAttributeNS(null,c)},l.prototype.hasAttribute=function(c){return this.hasAttributeNS(null,c)},l.prototype.removeEventListener=r,l.prototype.addEventListener=s,l.prototype.dispatchEvent=i,l.prototype.focus=function(){},l.prototype.toString=function(){return a(this)},l.prototype.getElementsByClassName=function(c){var h=c.split(" "),d=[];return t(this,function(f){if(f.nodeType===1){var g=f.className||"",y=g.split(" ");h.every(function(v){return y.indexOf(v)!==-1})&&d.push(f)}}),d},l.prototype.getElementsByTagName=function(c){c=c.toLowerCase();var h=[];return t(this.childNodes,function(d){d.nodeType===1&&(c==="*"||d.tagName.toLowerCase()===c)&&h.push(d)}),h},l.prototype.contains=function(c){return t(this,function(h){return c===h})||!1}}),oee=fi(function(n,e){Sl();var t=WB();e.exports=i;function i(s){if(!El(this,i))return new i;this.childNodes=[],this.parentNode=null,this.ownerDocument=s||null}i.prototype.type="DocumentFragment",i.prototype.nodeType=11,i.prototype.nodeName="#document-fragment",i.prototype.appendChild=t.prototype.appendChild,i.prototype.replaceChild=t.prototype.replaceChild,i.prototype.removeChild=t.prototype.removeChild,i.prototype.toString=function(){return this.childNodes.map(function(s){return String(s)}).join("")}}),lee=fi(function(n,e){e.exports=t;function t(i){}t.prototype.initEvent=function(i,s,r){this.type=i,this.bubbles=s,this.cancelable=r},t.prototype.preventDefault=function(){}}),cee=fi(function(n,e){Sl();var t=qB(),i=nee(),s=ree(),r=WB(),a=oee(),o=lee(),l=GB(),c=KB(),h=jB();e.exports=d;function d(){if(!El(this,d))return new d;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var f=d.prototype;f.createTextNode=function(g){return new s(g,this)},f.createElementNS=function(g,y){var v=g===null?null:String(g);return new r(y,this,v)},f.createElement=function(g){return new r(g,this)},f.createDocumentFragment=function(){return new a(this)},f.createEvent=function(g){return new o(g)},f.createComment=function(g){return new i(g,this)},f.getElementById=function(g){g=String(g);var y=t(this.childNodes,function(v){if(String(v.id)===g)return v});return y||null},f.getElementsByClassName=r.prototype.getElementsByClassName,f.getElementsByTagName=r.prototype.getElementsByTagName,f.contains=r.prototype.contains,f.removeEventListener=h,f.addEventListener=c,f.dispatchEvent=l}),uee=fi(function(n,e){var t=cee();e.exports=new t}),YB=fi(function(n,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},i=uee(),s;typeof document<"u"?s=document:(s=t["__GLOBAL_DOCUMENT_CACHE@4"],s||(s=t["__GLOBAL_DOCUMENT_CACHE@4"]=i)),e.exports=s});function hee(n){if(Array.isArray(n))return n}function dee(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i=[],s=!0,r=!1,a,o;try{for(t=t.call(n);!(s=(a=t.next()).done)&&(i.push(a.value),!(e&&i.length===e));s=!0);}catch(l){r=!0,o=l}finally{try{!s&&t.return!=null&&t.return()}finally{if(r)throw o}}return i}}function fee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
83In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SI(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=n[t];return i}function zB(n,e){if(n){if(typeof n=="string")return SI(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return SI(n,e)}}function er(n,e){return hee(n)||dee(n,e)||zB(n,e)||fee()}var Ph=Ui(tn()),XP=Ui(tn()),pee=Ui(tn()),mee={now:function(){var n=(pee.default||{}).performance,e=n&&n.timing,t=e&&e.navigationStart,i=typeof t=="number"&&typeof n.now=="function"?t+n.now():Date.now();return Math.round(i)}},Pt=mee,jh=function(){var n,e,t;if(typeof((n=(XP.default||{}).crypto)===null||n===void 0?void 0:n.getRandomValues)=="function"){t=new Uint8Array(32),(XP.default||{}).crypto.getRandomValues(t);for(var i=0;i<32;i++)t[i]=t[i]%16}else{t=[];for(var s=0;s<32;s++)t[s]=Math.random()*16|0}var r=0;e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){var c=l==="x"?t[r]:t[r]&3|8;return r++,c.toString(16)});var a=Pt.now(),o=a==null?void 0:a.toString(16).substring(3);return o?e.substring(0,28)+o:e},QB=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},qi=function(n){if(n&&typeof n.nodeName<"u")return n.muxId||(n.muxId=QB()),n.muxId;var e;try{e=document.querySelector(n)}catch{}return e&&!e.muxId&&(e.muxId=n),(e==null?void 0:e.muxId)||n},xy=function(n){var e;n&&typeof n.nodeName<"u"?(e=n,n=qi(e)):e=document.querySelector(n);var t=e&&e.nodeName?e.nodeName.toLowerCase():"";return[e,n,t]};function gee(n){if(Array.isArray(n))return SI(n)}function yee(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function vee(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
84In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gi(n){return gee(n)||yee(n)||zB(n)||vee()}var Ha={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},Tee=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,t,i,s,r,a,o=n?[console,n]:[console],l=(t=console.trace).bind.apply(t,Gi(o)),c=(i=console.info).bind.apply(i,Gi(o)),h=(s=console.debug).bind.apply(s,Gi(o)),d=(r=console.warn).bind.apply(r,Gi(o)),f=(a=console.error).bind.apply(a,Gi(o)),g=e;return{trace:function(){for(var y=arguments.length,v=new Array(y),T=0;T<y;T++)v[T]=arguments[T];if(!(g>Ha.TRACE))return l.apply(void 0,Gi(v))},debug:function(){for(var y=arguments.length,v=new Array(y),T=0;T<y;T++)v[T]=arguments[T];if(!(g>Ha.DEBUG))return h.apply(void 0,Gi(v))},info:function(){for(var y=arguments.length,v=new Array(y),T=0;T<y;T++)v[T]=arguments[T];if(!(g>Ha.INFO))return c.apply(void 0,Gi(v))},warn:function(){for(var y=arguments.length,v=new Array(y),T=0;T<y;T++)v[T]=arguments[T];if(!(g>Ha.WARN))return d.apply(void 0,Gi(v))},error:function(){for(var y=arguments.length,v=new Array(y),T=0;T<y;T++)v[T]=arguments[T];if(!(g>Ha.ERROR))return f.apply(void 0,Gi(v))},get level(){return g},set level(y){y!==this.level&&(g=y??e)}}},ze=Tee("[mux]"),uL=Ui(tn());function _I(){var n=uL.default.doNotTrack||uL.default.navigator&&uL.default.navigator.doNotTrack;return n==="1"}function ce(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}Sl();function vt(n,e){if(!El(n,e))throw new TypeError("Cannot call a class as a function")}function ZP(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function gs(n,e,t){return e&&ZP(n.prototype,e),t&&ZP(n,t),n}function Q(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yu(n){return Yu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Yu(n)}function bee(n,e){for(;!Object.prototype.hasOwnProperty.call(n,e)&&(n=Yu(n),n!==null););return n}function Gg(n,e,t){return typeof Reflect<"u"&&Reflect.get?Gg=Reflect.get:Gg=function(i,s,r){var a=bee(i,s);if(a){var o=Object.getOwnPropertyDescriptor(a,s);return o.get?o.get.call(r||i):o.value}},Gg(n,e,t||n)}function AI(n,e){return AI=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t},AI(n,e)}function Eee(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&AI(n,e)}function See(n,e){if(n==null)return{};var t={},i=Object.keys(n),s,r;for(r=0;r<i.length;r++)s=i[r],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function _ee(n,e){if(n==null)return{};var t=See(n,e),i,s;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Aee(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}HB();function xee(n,e){return e&&(VB(e)==="object"||typeof e=="function")?e:ce(n)}function Lee(n){var e=Aee();return function(){var t=Yu(n),i;if(e){var s=Yu(this).constructor;i=Reflect.construct(t,arguments,s)}else i=t.apply(this,arguments);return xee(this,i)}}var os=function(n){return Wh(n)[0]},Wh=function(n){if(typeof n!="string"||n==="")return["localhost"];var e=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,t=n.match(e)||[],i=t[4],s;return i&&(s=(i.match(/[^\.]+\.[^\.]+$/)||[])[0]),[i,s]},hL=Ui(tn()),wee={exists:function(){var n=(hL.default||{}).performance,e=n&&n.timing;return e!==void 0},domContentLoadedEventEnd:function(){var n=(hL.default||{}).performance,e=n&&n.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var n=(hL.default||{}).performance,e=n&&n.timing;return e&&e.navigationStart}},Ly=wee;function _t(n,e,t){t=t===void 0?1:t,n[e]=n[e]||0,n[e]+=t}function wy(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable}))),i.forEach(function(s){Q(n,s,t[s])})}return n}function Cee(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,i)}return t}function v3(n,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Cee(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}),n}var Iee=["x-cdn","content-type"],XB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],kee=Iee.concat(XB);function T3(n){n=n||"";var e={},t=n.trim().split(/[\r\n]+/);return t.forEach(function(i){if(i){var s=i.split(": "),r=s.shift();r&&(kee.indexOf(r.toLowerCase())>=0||r.toLowerCase().indexOf("x-litix-")===0)&&(e[r]=s.join(": "))}}),e}function Cy(n){if(n){var e=XB.find(function(t){return n[t]!==void 0});return e?n[e]:void 0}}var Ree=function(n){var e={};for(var t in n){var i=n[t],s=i["DATA-ID"].search("io.litix.data.");if(s!==-1){var r=i["DATA-ID"].replace("io.litix.data.","");e[r]=i.VALUE}}return e},ZB=Ree,rg=function(n){if(!n)return{};var e=Ly.navigationStart(),t=n.loading,i=t?t.start:n.trequest,s=t?t.first:n.tfirst,r=t?t.end:n.tload;return{bytesLoaded:n.total,requestStart:Math.round(e+i),responseStart:Math.round(e+s),responseEnd:Math.round(e+r)}},ch=function(n){if(!(!n||typeof n.getAllResponseHeaders!="function"))return T3(n.getAllResponseHeaders())},Pee=function(n,e,t){var i=arguments.length>4?arguments[4]:void 0,s=n.log,r=n.utils.secondsToMs,a=function(T){var b=parseInt(i.version),E;return b===1&&T.programDateTime!==null&&(E=T.programDateTime),b===0&&T.pdt!==null&&(E=T.pdt),E};if(!Ly.exists()){s.warn("performance timing not supported. Not tracking HLS.js.");return}var o=function(T,b){return n.emit(e,T,b)},l=function(T,b){var E=b.levels,_=b.audioTracks,x=b.url,w=b.stats,R=b.networkDetails,C=b.sessionData,k={},P={};E.forEach(function(W,U){k[U]={width:W.width,height:W.height,bitrate:W.bitrate,attrs:W.attrs}}),_.forEach(function(W,U){P[U]={name:W.name,language:W.lang,bitrate:W.bitrate}});var I=rg(w),O=I.bytesLoaded,G=I.requestStart,j=I.responseStart,K=I.responseEnd;o("requestcompleted",v3(wy({},ZB(C)),{request_event_type:T,request_bytes_loaded:O,request_start:G,request_response_start:j,request_response_end:K,request_type:"manifest",request_hostname:os(x),request_response_headers:ch(R),request_rendition_lists:{media:k,audio:P,video:{}}}))};t.on(i.Events.MANIFEST_LOADED,l);var c=function(T,b){var E=b.details,_=b.level,x=b.networkDetails,w=b.stats,R=rg(w),C=R.bytesLoaded,k=R.requestStart,P=R.responseStart,I=R.responseEnd,O=E.fragments[E.fragments.length-1],G=a(O)+r(O.duration);o("requestcompleted",{request_event_type:T,request_bytes_loaded:C,request_start:k,request_response_start:P,request_response_end:I,request_current_level:_,request_type:"manifest",request_hostname:os(E.url),request_response_headers:ch(x),video_holdback:E.holdBack&&r(E.holdBack),video_part_holdback:E.partHoldBack&&r(E.partHoldBack),video_part_target_duration:E.partTarget&&r(E.partTarget),video_target_duration:E.targetduration&&r(E.targetduration),video_source_is_live:E.live,player_manifest_newest_program_time:isNaN(G)?void 0:G})};t.on(i.Events.LEVEL_LOADED,c);var h=function(T,b){var E=b.details,_=b.networkDetails,x=b.stats,w=rg(x),R=w.bytesLoaded,C=w.requestStart,k=w.responseStart,P=w.responseEnd;o("requestcompleted",{request_event_type:T,request_bytes_loaded:R,request_start:C,request_response_start:k,request_response_end:P,request_type:"manifest",request_hostname:os(E.url),request_response_headers:ch(_)})};t.on(i.Events.AUDIO_TRACK_LOADED,h);var d=function(T,b){var E=b.stats,_=b.networkDetails,x=b.frag;E=E||x.stats;var w=rg(E),R=w.bytesLoaded,C=w.requestStart,k=w.responseStart,P=w.responseEnd,I=_?ch(_):void 0,O={request_event_type:T,request_bytes_loaded:R,request_start:C,request_response_start:k,request_response_end:P,request_hostname:_?os(_.responseURL):void 0,request_id:I?Cy(I):void 0,request_response_headers:I,request_media_duration:x.duration,request_url:_==null?void 0:_.responseURL};x.type==="main"?(O.request_type="media",O.request_current_level=x.level,O.request_video_width=(t.levels[x.level]||{}).width,O.request_video_height=(t.levels[x.level]||{}).height,O.request_labeled_bitrate=(t.levels[x.level]||{}).bitrate):O.request_type=x.type,o("requestcompleted",O)};t.on(i.Events.FRAG_LOADED,d);var f=function(T,b){var E=b.frag,_=E.start,x=a(E),w={currentFragmentPDT:x,currentFragmentStart:r(_)};o("fragmentchange",w)};t.on(i.Events.FRAG_CHANGED,f);var g=function(T,b){var E=b.type,_=b.details,x=b.response,w=b.fatal,R=b.frag,C=b.networkDetails,k=(R==null?void 0:R.url)||b.url||"",P=C?ch(C):void 0;if((_===i.ErrorDetails.MANIFEST_LOAD_ERROR||_===i.ErrorDetails.MANIFEST_LOAD_TIMEOUT||_===i.ErrorDetails.FRAG_LOAD_ERROR||_===i.ErrorDetails.FRAG_LOAD_TIMEOUT||_===i.ErrorDetails.LEVEL_LOAD_ERROR||_===i.ErrorDetails.LEVEL_LOAD_TIMEOUT||_===i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||_===i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||_===i.ErrorDetails.SUBTITLE_LOAD_ERROR||_===i.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||_===i.ErrorDetails.KEY_LOAD_ERROR||_===i.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:_,request_url:k,request_hostname:os(k),request_id:P?Cy(P):void 0,request_type:_===i.ErrorDetails.FRAG_LOAD_ERROR||_===i.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":_===i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||_===i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":_===i.ErrorDetails.SUBTITLE_LOAD_ERROR||_===i.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":_===i.ErrorDetails.KEY_LOAD_ERROR||_===i.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:x==null?void 0:x.code,request_error_text:x==null?void 0:x.text}),w){var I,O="".concat(k?"url: ".concat(k,`
85`):"")+"".concat(x&&(x.code||x.text)?"response: ".concat(x.code,", ").concat(x.text,`
86`):"")+"".concat(b.reason?"failure reason: ".concat(b.reason,`
87`):"")+"".concat(b.level?"level: ".concat(b.level,`
88`):"")+"".concat(b.parent?"parent stream controller: ".concat(b.parent,`
89`):"")+"".concat(b.buffer?"buffer length: ".concat(b.buffer,`
90`):"")+"".concat(b.error?"error: ".concat(b.error,`
91`):"")+"".concat(b.event?"event: ".concat(b.event,`
92`):"")+"".concat(b.err?"error message: ".concat((I=b.err)===null||I===void 0?void 0:I.message,`
93`):"");o("error",{player_error_code:E,player_error_message:_,player_error_context:O})}};t.on(i.Events.ERROR,g);var y=function(T,b){var E=b.frag,_=E&&E._url||"";o("requestcanceled",{request_event_type:T,request_url:_,request_type:"media",request_hostname:os(_)})};t.on(i.Events.FRAG_LOAD_EMERGENCY_ABORTED,y);var v=function(T,b){var E=b.level,_=t.levels[E];if(_&&_.attrs&&_.attrs.BANDWIDTH){var x=_.attrs.BANDWIDTH,w,R=parseFloat(_.attrs["FRAME-RATE"]);isNaN(R)||(w=R),x?o("renditionchange",{video_source_fps:w,video_source_bitrate:x,video_source_width:_.width,video_source_height:_.height,video_source_rendition_name:_.n
vendor: 7,468 bytes, lines 93-95
93ame,video_source_codec:_==null?void 0:_.videoCodec}):s.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(i.Events.LEVEL_SWITCHED,v),t._stopMuxMonitor=function(){t.off(i.Events.MANIFEST_LOADED,l),t.off(i.Events.LEVEL_LOADED,c),t.off(i.Events.AUDIO_TRACK_LOADED,h),t.off(i.Events.FRAG_LOADED,d),t.off(i.Events.FRAG_CHANGED,f),t.off(i.Events.ERROR,g),t.off(i.Events.FRAG_LOAD_EMERGENCY_ABORTED,y),t.off(i.Events.LEVEL_SWITCHED,v),t.off(i.Events.DESTROYING,t._stopMuxMonitor),delete t._stopMuxMonitor},t.on(i.Events.DESTROYING,t._stopMuxMonitor)},Dee=function(n){n&&typeof n._stopMuxMonitor=="function"&&n._stopMuxMonitor()},JP=function(n,e){if(!n||!n.requestEndDate)return{};var t=os(n.url),i=n.url,s=n.bytesLoaded,r=new Date(n.requestStartDate).getTime(),a=new Date(n.firstByteDate).getTime(),o=new Date(n.requestEndDate).getTime(),l=isNaN(n.duration)?0:n.duration,c=typeof e.getMetricsFor=="function"?e.getMetricsFor(n.mediaType).HttpList:e.getDashMetrics().getHttpRequests(n.mediaType),h;c.length>0&&(h=T3(c[c.length-1]._responseHeaders||""));var d=h?Cy(h):void 0;return{requestStart:r,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:s,requestResponseHeaders:h,requestMediaDuration:l,requestHostname:t,requestUrl:i,requestId:d}},Oee=function(n,e){if(typeof e.getCurrentRepresentationForType=="function"){var t=e.getCurrentRepresentationForType(n);return t?{currentLevel:t.absoluteIndex,renditionWidth:t.width||null,renditionHeight:t.height||null,renditionBitrate:t.bandwidth}:{}}var i=e.getQualityFor(n),s=e.getCurrentTrackFor(n).bitrateList;return s?{currentLevel:i,renditionWidth:s[i].width||null,renditionHeight:s[i].height||null,renditionBitrate:s[i].bandwidth}:{}},Mee=function(n){var e;return(e=n.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},$ee=function(n){try{var e,t,i=(t=n.getVersion)===null||t===void 0||(e=t.call(n))===null||e===void 0?void 0:e.split(".").map(function(s){return parseInt(s)})[0];return i}catch{return!1}},Nee=function(n,e,t){var i=n.log;if(!t||!t.on){i.warn("Invalid dash.js player reference. Monitoring blocked.");return}var s=$ee(t),r=function(E,_){return n.emit(e,E,_)},a=function(E){var _=E.type,x=E.data,w=(x||{}).url;r("requestcompleted",{request_event_type:_,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:os(w),request_url:w})};t.on("manifestLoaded",a);var o={},l=function(E){if(typeof E.getRequests!="function")return null;var _=E.getRequests({state:"executed"});return _.length===0?null:_[_.length-1]},c=function(E){var _=E.type,x=E.fragmentModel,w=E.chunk,R=l(x);h({type:_,request:R,chunk:w})},h=function(E){var _=E.type,x=E.chunk,w=E.request,R=(x||{}).mediaInfo,C=R||{},k=C.type,P=C.bitrateList;P=P||[];var I={};P.forEach(function(F,N){I[N]={},I[N].width=F.width,I[N].height=F.height,I[N].bitrate=F.bandwidth,I[N].attrs={}}),k==="video"?o.video=I:k==="audio"?o.audio=I:o.media=I;var O=JP(w,t),G=O.requestStart,j=O.requestResponseStart,K=O.requestResponseEnd,W=O.requestResponseHeaders,U=O.requestMediaDuration,V=O.requestHostname,q=O.requestUrl,z=O.requestId;r("requestcompleted",{request_event_type:_,request_start:G,request_response_start:j,request_response_end:K,request_bytes_loaded:-1,request_type:k+"_init",request_response_headers:W,request_hostname:V,request_id:z,request_url:q,request_media_duration:U,request_rendition_lists:o})};s>=4?t.on("initFragmentLoaded",h):t.on("initFragmentLoaded",c);var d=function(E){var _=E.type,x=E.fragmentModel,w=E.chunk,R=l(x);f({type:_,request:R,chunk:w})},f=function(E){var _=E.type,x=E.chunk,w=E.request,R=x||{},C=R.mediaInfo,k=R.start,P=C||{},I=P.type,O=JP(w,t),G=O.requestStart,j=O.requestResponseStart,K=O.requestResponseEnd,W=O.requestBytesLoaded,U=O.requestResponseHeaders,V=O.requestMediaDuration,q=O.requestHostname,z=O.requestUrl,F=O.requestId,N=Oee(I,t),H=N.currentLevel,ne=N.renditionWidth,be=N.renditionHeight,ue=N.renditionBitrate;r("requestcompleted",{request_event_type:_,request_start:G,request_response_start:j,request_response_end:K,request_bytes_loaded:W,request_type:I,request_response_headers:U,request_hostname:q,request_id:F,request_url:z,request_media_start_time:k,request_media_duration:V,request_current_level:H,request_labeled_bitrate:ue,request_video_width:ne,request_video_height:be})};s>=4?t.on("mediaFragmentLoaded",f):t.on("mediaFragmentLoaded",d);var g={video:void 0,audio:void 0,totalBitrate:void 0},y=function(){if(g.video&&typeof g.video.bitrate=="number"){if(!(g.video.width&&g.video.height)){i.warn("have bitrate info for video but missing width/height");return}var E=g.video.bitrate;if(g.audio&&typeof g.audio.bitrate=="number"&&(E+=g.audio.bitrate),E!==g.totalBitrate)return g.totalBitrate=E,{video_source_bitrate:E,video_source_height:g.video.height,video_source_width:g.video.width,video_source_codec:Mee(g.video.codec)}}},v=function(E,_,x){var w=E.mediaType;if(w==="audio"||w==="video"){var R;if(typeof t.getRepresentationsByType=="function")if(E.newRepresentation)R={bitrate:E.newRepresentation.bandwidth,width:E.newRepresentation.width,height:E.newRepresentation.height,qualityIndex:E.newRepresentation.absoluteIndex};else{var C=t.getRepresentationsByType(w);if(C&&typeof E.newQuality=="number"){var k=C.find(function(I){return I.absoluteIndex===E.newQuality||I.index===E.newQuality});k&&(R={bitrate:k.bandwidth,width:k.width,height:k.height,qualityIndex:E.newQuality})}}else{if(typeof E.newQuality!="number"){i.warn("missing evt.newQuality in qualityChangeRendered event",E);return}R=t.getBitrateInfoListFor(w).find(function(I){var O=I.qualityIndex;return O===E.newQuality})}if(!(R&&typeof R.bitrate=="number")){i.warn("missing bitrate info for ".concat(w));return}g[w]=v3(wy({},R),{codec:t.getCurrentTrackFor(w).codec});var P=y();P&&r("renditionchange",P)}};t.on("qualityChangeRendered",v);var T=function(E){var _=E.request,x=E.mediaType;_=_||{},r("requestcanceled",{request_event_type:_.type+"_"+_.action,request_url:_.url,request_type:x,request_hostname:os(_.url)})};t.on("fragmentLoadingAbandoned",T);var b=function(E){var _=E.error,x,w,R=(_==null||(x=_.data)===null||x===void 0?void 0:x.request)||{},C=(_==null||(w=_.data)===null||w===void 0?void 0:w.response)||{};(_==null?void 0:_.code)===27&&r("requestfailed",{request_error:R.type+"_"+R.action,request_url:R.url,request_hostname:os(R.url),request_type:R.mediaType,request_error_code:C.status,request_error_text:C.statusText});var k="".concat(R!=null&&R.url?"url: ".concat(R.url,`
94`):"")+"".concat(C!=null&&C.status||C!=null&&C.statusText?"response: ".concat(C==null?void 0:C.status,", ").concat(C==null?void 0:C.statusText,`
95`):"");r("error",{player_error_code:_==null?void 0:_.code,player_error_message:_==null?void 0:_.message,player_error_context:k})};t.on("error",b),t._stopMuxMonitor=function(){t.off("manifestLoaded",a),t.off("initFragmentLoaded",h),t.off("mediaFragmentLoaded",f),t.off("qualityChangeRendered",v),t.off("error",b),t.off("fragmentLoadingAbandoned",T),delete t._stopMuxMonitor}},Fee=function(n){n&&typeof n._stopMuxMonitor=="function"&&n._stopMuxMonitor()},e2=0,Bee=function(){function n(){vt(this,n),Q(this,"_listeners",void 0)}return gs(n,[{key:"on",value:function(e,t,i){return t._eventEmitterGuid=t._eventEmitterGuid||++e2,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],i&&(t=t.bind(i)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var i=this._listeners&&this._listeners[e];
vendor: 12,115 bytes, line 95
95i&&i.forEach(function(s,r){s._eventEmitterGuid===t._eventEmitterGuid&&i.splice(r,1)})}},{key:"one",value:function(e,t,i){var s=this;t._eventEmitterGuid=t._eventEmitterGuid||++e2;var r=function(){s.off(e,r),t.apply(i||this,arguments)};r._eventEmitterGuid=t._eventEmitterGuid,this.on(e,r)}},{key:"emit",value:function(e,t){var i=this;if(this._listeners){t=t||{};var s=this._listeners["before"+e]||[],r=this._listeners["before*"]||[],a=this._listeners[e]||[],o=this._listeners["after"+e]||[],l=function(c,h){c=c.slice(),c.forEach(function(d){d.call(i,{type:e},h)})};l(s,t),l(r,t),l(a,t),l(o,t)}}}]),n}(),Uee=Bee,dL=Ui(tn()),Vee=function(){function n(e){var t=this;vt(this,n),Q(this,"_playbackHeartbeatInterval",void 0),Q(this,"_playheadShouldBeProgressing",void 0),Q(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(i,s){t._playbackHeartbeatInterval!==null&&(dL.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:s.viewer_time}),t._playbackHeartbeatInterval=null)})}return gs(n,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=dL.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(dL.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),n}(),Hee=Vee,qee=function n(e){var t=this;vt(this,n),Q(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(i,s){try{var r=e.errorTranslator({player_error_code:s.player_error_code,player_error_message:s.player_error_message,player_error_context:s.player_error_context,player_error_severity:s.player_error_severity,player_error_business_exception:s.player_error_business_exception});r&&(e.data.player_error_code=r.player_error_code||s.player_error_code,e.data.player_error_message=r.player_error_message||s.player_error_message,e.data.player_error_context=r.player_error_context||s.player_error_context,e.data.player_error_severity=r.player_error_severity||s.player_error_severity,e.data.player_error_business_exception=r.player_error_business_exception||s.player_error_business_exception,t.viewErrored=!0)}catch(a){e.mux.log.warn("Exception in error translator callback.",a),t.viewErrored=!0}}),e.on("aftererror",function(){var i,s,r,a,o;(i=e.data)===null||i===void 0||delete i.player_error_code,(s=e.data)===null||s===void 0||delete s.player_error_message,(r=e.data)===null||r===void 0||delete r.player_error_context,(a=e.data)===null||a===void 0||delete a.player_error_severity,(o=e.data)===null||o===void 0||delete o.player_error_business_exception})},Gee=qee,Kee=function(){function n(e){vt(this,n),Q(this,"_watchTimeTrackerLastCheckedTime",void 0),Q(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return gs(n,[{key:"_updateWatchTime",value:function(e,t){var i=t.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=i),_t(this.pm.data,"view_watch_time",i-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=i}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),n}(),jee=Kee,Wee=function(){function n(e){var t=this;vt(this,n),Q(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),Q(this,"_lastTime",void 0),Q(this,"_isAdPlaying",void 0),Q(this,"_callbackUpdatePlaybackTime",void 0),Q(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=Pt.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,e.on("viewinit",function(){t.pm.data.view_playing_time_ms_cumulative=0});var i=this._startPlaybackTimeTracking.bind(this);e.on("playing",i),e.on("adplaying",i);var s=function(){t.pm.data.player_is_paused||i()};e.on("seeked",s),e.on("rebufferend",s);var r=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",r),e.on("seeking",r),e.on("rebufferstart",r),e.on("adplaying",function(){t._isAdPlaying=!0}),e.on("adended",function(){t._isAdPlaying=!1}),e.on("adpause",function(){t._isAdPlaying=!1}),e.on("adbreakstart",function(){t._isAdPlaying=!1}),e.on("adbreakend",function(){t._isAdPlaying=!1}),e.on("adplay",function(){t._isAdPlaying=!1}),e.on("viewinit",function(){t._playbackTimeTrackerLastPlayheadPosition=-1,t._lastTime=Pt.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return gs(n,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=Pt.now(),this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time||0,t=Pt.now(),i=t-this._lastTime,s=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?s=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(s=i),s>0&&s<=1e3&&_t(this.pm.data,"view_content_playback_time",s),this._callbackUpdatePlaybackTime!==null&&i>0&&i<=1e3&&(this._isAdPlaying&&_t(this.pm.data,"ad_playing_time_ms_cumulative",i),_t(this.pm.data,"view_playing_time_ms_cumulative",i)),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),n}(),Yee=Wee,zee=function(){function n(e){vt(this,n),Q(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return gs(n,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position>"u"?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(e,t){var i=this,s=function(){i.pm.currentFragmentPDT&&i.pm.currentFragmentStart&&(i.pm.data.player_program_time=i.pm.currentFragmentPDT+i.pm.data.player_playhead_time-i.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,s(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var r=this.pm.getPlayheadTime();typeof r<"u"&&(this.pm.data.player_playhead_time=r,s(),this._updateMaxPlayheadPosition())}}}]),n}(),Qee=zee,t2=5*60*1e3,Xee=function n(e){if(vt(this,n),!e.disableRebufferTracking){var t,i=function(r,a){s(a),t=void 0},s=function(r){if(t){var a=r.viewer_time-t;_t(e.data,"view_rebuffer_duration",a),t=r.viewer_time,e.data.view_rebuffer_duration>t2&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(t2,"ms, future events will be ignored unless a programchange or videochange occurs.")))}e.data.view_watch_time>=0&&e.data.view_rebuffer_count>0&&(e.data.view_rebuffer_frequency=e.data.view_rebuffer_count/e.data.view_watch_time,e.data.view_rebuffer_percentage=e.data.view_rebuffer_duration/e.data.view_watch_time)};e.on("playbackheartbeat",function(r,a){return s(a)}),e.on("rebufferstart",function(r,a){t||(_t(e.data,"view_rebuffer_count",1),t=a.viewer_time,e.one("rebufferend",i))}),e.on("viewinit",function(){t=void 0,e.off("rebufferend",i)})}},Zee=Xee,Jee=function(){function n(e){var t=this;vt(this,n),Q(this,"_lastCheckedTime",void 0),Q(this,"_lastPlayheadTime",void 0),Q(this,"_lastPlayheadTimeUpdatedTime",void 0),Q(this,"_rebuffering",void 0),Q(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:Pt.now()})}))}return gs(n,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(e,t);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(t.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(e,t,!0);return}var i=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&i>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=t.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(e){this._lastCheckedTime=e,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=e}},{key:"_cleanupRebufferTracker",value:function(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(this._lastCheckedTime===null)return;var s=this.pm.data.player_playhead_time-this._lastPlayheadTime,r=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&s>0&&r-s>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+r-s}))}i?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),n}(),ete=Jee,tte=function(){function n(e){var t=this;vt(this,n),Q(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var i=e.data,s=i.view_id;if(!i.view_program_changed){var r=function(a,o){var l=o.viewer_time;(a.type==="playing"&&typeof e.data.view_time_to_first_frame>"u"||a.type==="adplaying"&&(typeof e.data.view_time_to_first_frame>"u"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(l||Pt.n
vendor: 4,243 bytes, line 95
95ow(),s)};e.one("playing",r),e.one("adplaying",r),e.one("viewend",function(){e.off("playing",r),e.off("adplaying",r)})}})}return gs(n,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(e,t){t===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:e}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),n}(),ite=tte,ste=function n(e){var t=this;vt(this,n),Q(this,"_lastPlayerHeight",void 0),Q(this,"_lastPlayerWidth",void 0),Q(this,"_lastPlayheadPosition",void 0),Q(this,"_lastSourceHeight",void 0),Q(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var i=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"],s=["playing","hb","renditionchange","orientationchange","playbackmodechange"];i.forEach(function(r){e.on(r,function(){if(t._lastPlayheadPosition>=0&&e.data.player_playhead_time>=0&&t._lastPlayerWidth>=0&&t._lastSourceWidth>0&&t._lastPlayerHeight>=0&&t._lastSourceHeight>0){var a=e.data.player_playhead_time-t._lastPlayheadPosition;if(a<0){t._lastPlayheadPosition=-1;return}var o=Math.min(t._lastPlayerWidth/t._lastSourceWidth,t._lastPlayerHeight/t._lastSourceHeight),l=Math.max(0,o-1),c=Math.max(0,1-o);e.data.view_max_upscale_percentage=Math.max(e.data.view_max_upscale_percentage||0,l),e.data.view_max_downscale_percentage=Math.max(e.data.view_max_downscale_percentage||0,c),_t(e.data,"view_total_content_playback_time",a),_t(e.data,"view_total_upscaling",l*a),_t(e.data,"view_total_downscaling",c*a)}t._lastPlayheadPosition=-1})}),s.forEach(function(r){e.on(r,function(){t._lastPlayheadPosition=e.data.player_playhead_time,t._lastPlayerWidth=e.data.player_width,t._lastPlayerHeight=e.data.player_height,t._lastSourceWidth=e.data.video_source_width,t._lastSourceHeight=e.data.video_source_height})})},nte=ste,rte=2e3,ate=function n(e){var t=this;vt(this,n),Q(this,"isSeeking",void 0),this.isSeeking=!1;var i=-1,s=function(){var r=Pt.now(),a=(e.data.viewer_time||r)-(i||r);_t(e.data,"view_seek_duration",a),e.data.view_max_seek_time=Math.max(e.data.view_max_seek_time||0,a),t.isSeeking=!1,i=-1};e.on("seeking",function(r,a){if(Object.assign(e.data,a),t.isSeeking&&a.viewer_time-i<=rte){i=a.viewer_time;return}t.isSeeking&&s(),t.isSeeking=!0,i=a.viewer_time,_t(e.data,"view_seek_count",1),e.send("seeking")}),e.on("seeked",function(){s()}),e.on("viewend",function(){t.isSeeking&&(s(),e.send("seeked")),t.isSeeking=!1,i=-1})},ote=ate,i2=function(n,e){n.push(e),n.sort(function(t,i){return t.viewer_time-i.viewer_time})},lte=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],cte=function(){function n(e){var t=this;vt(this,n),Q(this,"_adHasPlayed",void 0),Q(this,"_adRequests",void 0),Q(this,"_adResponses",void 0),Q(this,"_currentAdRequestNumber",void 0),Q(this,"_currentAdResponseNumber",void 0),Q(this,"_prerollPlayTime",void 0),Q(this,"_wouldBeNewAdPlay",void 0),Q(this,"isAdBreak",void 0),Q(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),lte.forEach(function(s){return e.on(s,t._updateAdData.bind(t))});var i=function(){t.isAdBreak=!1};e.on("adbreakstart",function(){t.isAdBreak=!0}),e.on("play",i),e.on("playing",i),e.on("viewend",i),e.on("adrequest",function(s,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdRequestNumber++},r),i2(t._adRequests,r),_t(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||_t(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(s,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++}
vendor: 24,988 bytes, line 95
95,r),i2(t._adResponses,r);var a=t.findAdRequest(r.ad_request_id);a&&_t(e.data,"view_ad_request_time",Math.max(0,r.viewer_time-a.viewer_time))}),e.on("adplay",function(s,r){t._adHasPlayed=!0,t._wouldBeNewAdPlay&&(t._wouldBeNewAdPlay=!1,_t(e.data,"view_ad_played_count")),t.inPrerollPosition()&&!e.data.view_preroll_played&&(e.data.view_preroll_played=!0,t._adRequests.length>0&&(e.data.view_preroll_request_time=Math.max(0,r.viewer_time-t._adRequests[0].viewer_time)),e.data.view_start&&(e.data.view_startup_preroll_request_time=Math.max(0,r.viewer_time-e.data.view_start)),t._prerollPlayTime=r.viewer_time)}),e.on("adplaying",function(s,r){t.inPrerollPosition()&&typeof e.data.view_preroll_load_time>"u"&&typeof t._prerollPlayTime<"u"&&(e.data.view_preroll_load_time=r.viewer_time-t._prerollPlayTime,e.data.view_startup_preroll_load_time=r.viewer_time-t._prerollPlayTime)}),e.on("adclicked",function(s,r){t._wouldBeNewAdPlay||_t(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(s,r){t._wouldBeNewAdPlay||_t(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return gs(n,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(e){for(var t=0;t<this._adRequests.length;t++)if(this._adRequests[t].ad_request_id===e)return this._adRequests[t]}},{key:"_updateAdData",value:function(e,t){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var i=er(Wh(t.ad_tag_url),2),s=i[0],r=i[1];this.pm.data.view_preroll_ad_tag_domain=r,this.pm.data.view_preroll_ad_tag_hostname=s}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var a=er(Wh(t.ad_asset_url),2),o=a[0],l=a[1];this.pm.data.view_preroll_ad_asset_domain=l,this.pm.data.view_preroll_ad_asset_hostname=o}this.pm.data.ad_type="preroll"}this.pm.data.ad_asset_url=t==null?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=t==null?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=t==null?void 0:t.ad_creative_id,this.pm.data.ad_id=t==null?void 0:t.ad_id,this.pm.data.ad_universal_id=t==null?void 0:t.ad_universal_id,t!=null&&t.ad_type&&(this.pm.data.ad_type=t==null?void 0:t.ad_type)}}]),n}(),ute=cte,hte=function n(e){var t=this;vt(this,n),Q(this,"lastWallClockTime",void 0);var i=function(){t.lastWallClockTime=Pt.now(),e.on("before*",s)},s=function(r){var a=Pt.now(),o=t.lastWallClockTime;t.lastWallClockTime=a,a-o>3e4&&(e.emit("devicesleep",{viewer_time:o}),Object.assign(e.data,{viewer_time:o}),e.send("devicesleep"),e.emit("devicewake",{viewer_time:a}),Object.assign(e.data,{viewer_time:a}),e.send("devicewake"))};e.one("playbackheartbeat",i),e.on("playbackheartbeatend",function(){e.off("before*",s),e.one("playbackheartbeat",i)})},dte=hte,fL=Ui(tn()),JB=function(n){return n()}(function(){var n=function(){for(var t=0,i={};t<arguments.length;t++){var s=arguments[t];for(var r in s)i[r]=s[r]}return i};function e(t){function i(s,r,a){var o;if(typeof document<"u"){if(arguments.length>1){if(a=n({path:"/"},i.defaults,a),typeof a.expires=="number"){var l=new Date;l.setMilliseconds(l.getMilliseconds()+a.expires*864e5),a.expires=l}try{o=JSON.stringify(r),/^[\{\[]/.test(o)&&(r=o)}catch{}return t.write?r=t.write(r,s):r=encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),s=encodeURIComponent(String(s)),s=s.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),s=s.replace(/[\(\)]/g,escape),document.cookie=[s,"=",r,a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}s||(o={});for(var c=document.cookie?document.cookie.split("; "):[],h=/(%[0-9A-Z]{2})+/g,d=0;d<c.length;d++){var f=c[d].split("="),g=f.slice(1).join("=");g.charAt(0)==='"'&&(g=g.slice(1,-1));try{var y=f[0].replace(h,decodeURIComponent);if(g=t.read?t.read(g,y):t(g,y)||g.replace(h,decodeURIComponent),this.json)try{g=JSON.parse(g)}catch{}if(s===y){o=g;break}s||(o[y]=g)}catch{}}return o}}return i.set=i,i.get=function(s){return i.call(i,s)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(s,r){i(s,"",n(r,{expires:-1}))},i.withConverter=e,i}return e(function(){})}),eU="muxData",fte=function(n){return Object.entries(n).map(function(e){var t=er(e,2),i=t[0],s=t[1];return"".concat(i,"=").concat(s)}).join("&")},pte=function(n){return n.split("&").reduce(function(e,t){var i=er(t.split("="),2),s=i[0],r=i[1],a=+r,o=r&&a==r?a:r;return e[s]=o,e},{})},tU=function(){var n;try{n=pte(JB.get(eU)||"")}catch{n={}}return n},iU=function(n){try{JB.set(eU,fte(n),{expires:365})}catch{}},mte=function(){var n=tU();return n.mux_viewer_id=n.mux_viewer_id||jh(),n.msn=n.msn||Math.random(),iU(n),{mux_viewer_id:n.mux_viewer_id,mux_sample_number:n.msn}},gte=function(){var n=tU(),e=Pt.now();return n.session_start&&(n.sst=n.session_start,delete n.session_start),n.session_id&&(n.sid=n.session_id,delete n.session_id),n.session_expires&&(n.sex=n.session_expires,delete n.session_expires),(!n.sex||n.sex<e)&&(n.sid=jh(),n.sst=e),n.sex=e+25*60*1e3,iU(n),{session_id:n.sid,session_start:n.sst,session_expires:n.sex}};function yte(n,e){var t=e.beaconCollectionDomain,i=e.beaconDomain;if(t)return"https://"+t;n=n||"inferred";var s=i||"litix.io";return n.match(/^[a-z0-9]+$/)?"https://"+n+"."+s:"https://img.litix.io/a.gif"}var vte=Ui(tn()),sU=function(){var n;switch(nU()){case"cellular":n="cellular";break;case"ethernet":n="wired";break;case"wifi":n="wifi";break;case void 0:break;default:n="other"}return n},nU=function(){var n=vte.default.navigator,e=n&&(n.connection||n.mozConnection||n.webkitConnection);return e&&e.type};sU.getConnectionFromAPI=nU;var Tte=sU,bte={a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"},Ete=rU(bte),Ste={ad:"ad",af:"affiliate",ag:"aggregate",ap:"api",al:"application",ao:"audio",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",bn:"brand",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ci:"client",ck:"clicked",cl:"canceled",cm:"cmcd",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cv:"cumulative",cx:"connection",cz:"context",da:"data",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",dy:"dynamic",eb:"enabled",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",ep:"experiments",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ez:"exception",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mp:"mode",ms:"ms",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",or:"origin",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pp:"pip",pr:"preload",ps:"position",pt:"part",pv:"previous",py:"property",px:"pop",pz:"plan",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rg:"range",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sh:"shift",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",ss:"status",st:"start",su:"startup",sv:"server",sw:"software",sy:"severity",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"},s2=rU(Ste);function rU(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function xI(n){var e={},t={};return Object.keys(n).forEach(function(i){var s=!1;if(n.hasOwnProperty(i)&&n[i]!==void 0){var r=i.split("_"),a=r[0],o=Ete[a];o||(ze.info("Data key word `"+r[0]+"` not expected in "+i),o=a+"_"),r.splice(1).forEach(function(l){l==="url"&&(s=!0),s2[l]?o+=s2[l]:Number.isInteger(Number(l))?o+=l:(ze.info("Data key word `"+l+"` not expected in "+i),o+="_"+l+"_")}),s?t[o]=n[i]:e[o]=n[i]}}),Object.assign(e,t)}var Wa=Ui(tn()),_te=Ui(YB()),Ate={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},xte=56*1024,Lte=["hb","requestcompleted","requestfailed","requestcanceled"],wte="https://img.litix.io",ir=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=n||wte,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},Ate,e)};ir.prototype.queueEvent=function(n,e){var t=Object.assign({},e);return this._eventQueue.length<=this._options.maxQueueLength||n==="eventrateexceeded"?(this._eventQueue.push(t),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):!1};ir.prototype.flushEvents=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(n&&this._eventQueue.length===1){this._eventQueue.pop();return}this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()};ir.prototype.destroy=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,n?this._clearBeaconQueue():this.flushEvents(),Wa.default.clearTimeout(this._sendTimeout)};ir.prototype._clearBeaconQueue=function(){var n=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,e=this._eventQueue.slice(n);n>0&&Object.assign(e[e.length-1],xI({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);aU(this._beaconUrl,t,!0,function(){})};ir.prototype._sendBeaconQueue=function(){var n=this;if(this._postInFlight){this._resendAfterPost=!0;return}var e=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var t=this._createPayload(e),i=Pt.now();aU(this._beaconUrl,t,!1,function(s,r){r?(n._eventQueue=e.concat(n._eventQueue),n._failureCount+=1,ze.info("Error sending beacon: "+r)):n._failureCount=0,n._roundTripTime=Pt.now()-i,n._postInFlight=!1,n._resendAfterPost&&(n._resendAfterPost=!1,n._eventQueue.length>0&&n._sendBeaconQueue())})};ir.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var n=Math.pow(2,this._failureCount-1);return n=n*Math.random(),(1+n)*this._options.baseTimeBetweenBeacons};ir.prototype._startBeaconSending=function(){var n=this;Wa.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=Wa.default.setTimeout(function(){n._eventQueue.length&&n._sendBeaconQueue(),n._startBeaconSending()},this._getNextBeaconTime()))};ir.prototype._createPayload=function(n){var e=this,t={transmission_timestamp:Math.round(Pt.now())};this._roundTripTime&&(t.rtt_ms=Math.round(this._roundTripTime));var i,s,r,a=function(){i=JSON.stringify({metadata:t,events:s||n}),r=i.length/1024},o=function(){return r<=e._options.maxPayloadKBSize};return a(),o()||(ze.info("Payload size is too big ("+r+" kb). Removing unnecessary events."),s=n.filter(function(l){return Lte.indexOf(l.e)===-1}),a()),o()||(ze.info("Payload size still too big ("+r+" kb). Cropping fields.."),s.forEach(function(l){for(var c in l){var h=l[c],d=50*1024;typeof h=="string"&&h.length>d&&(l[c]=h.substring(0,d))}}),a()),i};var Cte=typeof _te.default.exitPictureInPicture=="function"?function(n){return n.length<=xte}:function(n){return!1},aU=function(n,e,t,i){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(n,e)){i();return}if(Wa.default.fetch){Wa.default.fetch(n,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:Cte(e)}).then(function(r){return i(null,r.ok?null:"Error")}).catch(function(r){return i(null,r)});return}if(Wa.default.XMLHttpRequest){var s=new Wa.default.XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState===4)return i(null,s.status!==200?"error":void 0)},s.open("POST",n),s.setRequestHeader("Content-Type","text/plain"),s.send(e);return}i()},Ite=ir,kte=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],Rte=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],Pte=["ad_id","ad_creative_id","ad_universal_id"],Dte=["viewstart","error","ended","viewend"],Ote=10*60*1e3,Mte=function(){function n(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};vt(this,n);var s,r,a,o,l,c,h,d,f,g,y,v;Q(this,"mux",void 0),Q(this,"envKey",void 0),Q(this,"options",void 0),Q(this,"eventQueue",void 0),Q(this,"sampleRate",void 0),Q(this,"disableCookies",void 0),Q(this,"respectDoNotTrack",void 0),Q(this,"previousBeaconData",void 0),Q(this,"lastEventTime",void 0),Q(this,"rateLimited",void 0),Q(this,"pageLevelData",void 0),Q(this,"viewerData",void 0),this.mux=e,this.envKey=t,this.options=i,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new Ite(yte(this.envKey,this.options));var T;this.sampleRate=(T=this.options.sampleRate)!==null&&T!==void 0?T:1;var b;this.disableCookies=(b=this.options.disableCookies)!==null&&b!==void 0?b:!1;var E;this.respectDoNotTrack=(E=this.options.respectDoNotTrack)!==null&&E!==void 0?E:!1,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(s=this.options.platform)===null||s===void 0?void 0:s.name,viewer_application_version:(r=this.options.platform)===null||r===void 0?void 0:r.version,viewer_application_engine:(a=this.options.platform)===null||a===void 0?void 0:a.layout,viewer_device_name:(o=this.options.platform)===null||o===void 0?void 0:o.product,viewer_device_category:"",viewer_device_manufacturer:(l=this.options.platform)===null||l===void 0?void 0:l.manufacturer,viewer_os_family:(h=this.options.platform)===null||h===void 0||(c=h.os)===null||c===void 0?void 0:c.family,viewer_os_architecture:(f=this.options.platform)===null||f===void 0||(d=f.os)===null||d===void 0?void 0:d.architecture,viewer_os_version:(y=this.options.platform)===null||y===void 0||(g=y.os)===null||g===void 0?void 0:g.version,viewer_connection_type:Tte(),page_url:fL.default===null||fL.default===void 0||(v=fL.default.location)===null||v===void 0?void 0:v.href},this.viewerData=this.disableCookies?{}:mte()}return gs(n,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&_I())return ze.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return ze.error("A data object was expected in send() but was not provided");var i=this.disableCookies?{}:gte(),s=v3(wy({},this.pageLevelData,t,i,this.viewerData),{event:e,env_key:this.envKey});s.user_id&&(s.viewer_user_id=s.user_id,delete s.user_id);var r,a=((r=s.mux_sample_number)!==null&&r!==void 0?r:0)>=this.sampleRate,o=this._deduplicateBeaconData(e,s),l=xI(o);if(this.lastEventTime=this.mux.utils.now(),a)return ze.info("Not sending event due to sample rate restriction",e,s,l);if(this.envKey||ze.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,s,l),!this.rateLimited)if(ze.info("Sending event",e,s,l),this.rateLimited=!this.eventQueue.queueEvent(e,l),this.mux.WINDOW_UNLOADING&&e==="viewend")this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&e==="hb")this.eventQueue.flushEvents(!0);else if(Dte.indexOf(e)>=0){if(e==="error"&&t.player_error_severity==="warning")return;this.eventQueue.flushEvents()}if(this.rateLimited)return s.event="eventrateexceeded",l=xI(s),this.eventQueue.queueEvent(s.event,l),ze.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var i=this,s={},r=t.view_id;if(r==="-1"||e==="viewstart"||e==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=Ote)s=wy({},t),r&&(this.previousBeaconData=s),r&&e==="viewend"&&(this.previousBeaconData=null);else{var a=e.indexOf("request")===0;Object.entries(t).forEach(function(o){var l=er(o,2),c=l[0],h=l[1];i.previousBeaconData&&(h!==i.previousBeaconData[c]||kte.indexOf(c)>-1||i.objectHasChanged(a,c,h,i.previousBeaconData[c])||i.eventRequiresKey(e,c))&&(s[c]=h,i.previousBeaconData[c]=h)})}return s}},{key:"objectHasChanged",value:function(e,t,i,s){return!e||t.indexOf("request_")!==0?!1:t==="request_response_headers"||typeof i!="object"||typeof s!="object"?!0:Object.keys(i||{}).length!==Object.keys(s||{}).length}},{key:"eventRequiresKey",value:function(e,t){return!!(e==="renditionchange"&&t.indexOf("video_source_")===0||Pte.includes(t)&&Rte.includes(e)||e==="playbackmodechange"&&t.indexOf("player_playback_mode")===0)}}]),n}(),$te=function n(e){vt(this,n);var t=0,i=0,s=0,r=0,a=0,o=0,l=0,c=function(f,g){var y=g.request_start,v=g.request_response_start,T=g.request_response_end,b=g.request_bytes_loaded;r++;var E,_;if(v?(E=v-(y??0),_=(T??0)-v):_=(T??0)-(y??0),_>0&&b&&b>0){var x=b/_*8e3;a++,i+=b,s+=_,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,x),e.data.view_average_request_throughput=i/s*8e3,e.data.view_request_count=r,E>0&&(t+=E,e.data.view_max_request_latency=Math.max(e.data.view_max_request_latency||0,E),e.data.view_average_request_latency=t/a)}},h=function(f,g){r++,o++,e.data.view_request_count=r,e.data.view_request_failed_count=o},d=function(f,g){r++,l++,e.data.view_request_count=r,e.data.view_request_canceled_count=l};e.on("requestcompleted",c),e.on("requestfailed",h),e.on("requestcanceled",d)},Nte=$te,Fte=60*60*1e3,Bte=function n(e){var t=this;vt(this,n),Q(this,"_lastEventTime",void 0),e.on("before*",function(i,s){var r=s.viewer_time,a=Pt.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>Fte){var l=Object.keys(e.data).reduce(function(h,d){return d.indexOf("video_")===0?Object.assign(h,Q({},d,e.data[d])):h},{});e.mux.log.info("Received event after at least an hour inactivity, creating a new view");var c=e.playbackHeartbeat._playheadShouldBeProgressing;e._resetView(Object.assign({viewer_time:r},l)),e.playbackHeartbeat._playheadShouldBeProgressing=c,e.playbackHeartbeat._playheadShouldBeProgressing&&i.type!=="play"&&i.type!=="adbreakstart"&&(e.emit("play",{viewer_time:r}),i.type!=="playing"&&e.emit("playing",{viewer_time:r}))}})},Ute=Bte,Vte=function n(e){vt(this,n);var t=function(o){var l=Hte(o),c=qte(o);if(l!=null&&!n2(l,r)&&a<=c){r=l,a=c;var h={video_cdn:l};e.emit("cdnchange",h)}},i=null,s=null,r=null,a=0;e.on("viewinit",function(){i=null,s=null,r=null,a=0}),e.on("beforecdnchange",function(o,l){var c=l==null?void 0:l.video_cdn;c&&(typeof l.video_previous_cdn>"u"||l.video_previous_cdn===null)&&(n2(c,s)?l.video_previous_cdn=i??void 0:(l.video_previous_cdn=s??void 0,i=s,s=c))}),e.on("requestcompleted",function(o,l){t(l)})};function n2(n,e){return(n==null?void 0:n.toLowerCase())===(e==null?void 0:e.toLowerCase())}function Hte(n){var e;return n!=null&&n.request_type&&(n.request_type==="media"||n.request_type==="video")&&!((e=n.request_response_headers)===null||e===void 0)&&e["x-cdn"]?n.request_response_headers["x-cdn"]:n!=null&&n.video_cdn?n.video_cdn:null}function qte(n){return n!=null&&n.request_start?n.request_start:n!=null&&n.viewer_time?n.viewer_time:Date.now()}var Gte=Vte,Kte=function(n){try{return JSON.parse(n),!0}catch{return!1}},jte=function n(e){var t=this;vt(this,n),Q(this,"_emittingAutomaticEvent",!1),Q(this,"_hasInitialized",!1),Q(this,"_currentMode","standard"),e.on("viewstart",function(){t._hasInitialized||(t._hasInitialized=!0,t._currentMode=e.data.player_playback_mode||"standard",t._emittingAutomaticEvent=!0,e.emit("playbackmodechange",{player_playback_mode:t._currentMode,player_playback_mode_data:"{}"}),t._emittingAutomaticEvent=!1)}),e.on("viewend",function(){t._hasInitialized=!1}),e.on("playbackmodechange",function(i,s){t._emittingAutomaticEvent||(s.player_playback_mode_data?Kte(s.player_playback_mode_data)||(e.mux.log.warn("Invalid JSON string for player_playback_mode_data"),s.player_playback_mode_data="{}"):s.player_playback_mode_data="{}",e.data.player_playback_mode_data=s.player_playback_mode_data,e.data.player_playback_mode=s.player_playback_mode,t._currentMode=s.player_playback_mode)})},Wte=jte,Yte=function(){function n(e){vt(this,n),Q(this,"pm",void 0),Q(this,"_currentRangeStart",void 0),Q(this,"_lastPlayheadTime",void 0),this.pm=e,this._currentRangeStart=null,this._lastPlayheadTime=null,e.on("playbackheartbeat",this._updatePlaybackRange.bind(this)),e.on("playbackheartbeatend",this._endPlaybackRange.bind(this))}return gs(n,[{key:"_updateLastRangeEnd",value:function(){var e=this.pm.data.video_playback_ranges;if(e&&e.length>0){var t=this.pm.data.player_playhead_time||0;e[e.length-1][1]=t}}},{key:"_updatePlaybackRange",value:function(){var e,t=this.pm.data.player_playhead_time||0;if(!(!this.pm.disableAdPlaybackRangeFiltering&&!((e=this.pm.adTracker)===null||e===void 0)&&e.isAdBreak&&this._lastPlayheadTime!==null&&t<this._lastPlayheadTime)){if(this._lastPlayheadTime!==null&&this._currentRangeStart!==null){var i=Math.abs(t-this._lastPlayheadTime);if(i>1e3){var s=this.pm.data.video_playback_ranges;s&&s.length>0&&(s[s.length-1][1]=this._lastPlayheadTime),this._currentRangeStart=null}}if(this._currentRangeStart===null){var r=this.pm.data.video_playback_ranges||[];r.length>0&&r[r.length-1][1]===t?this._currentRangeStart=r[r.length-1][0]:(this._currentRangeStart=t,r.push([t,t])),this.pm.data.video_playback_ranges=r}else this._updateLastRangeEnd();this._lastPlayheadTime=t}}},{key:"_endPlaybackRange",value:function(){this._currentRangeStart!==null&&(this._updateLastRangeEnd(),this._currentRangeStart=null,this._lastPlayheadTime=null)}}]),n}(),zte=Yte,Qte=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange","cdnchange","playbackmodechange"],Xte=new Set(["requestcompleted","requestfailed","requestcanceled"]),Zte=function(n){Eee(t,n);var e=Lee(t);function t(i,s,r){vt(this,t);var a;a=e.call(this),Q(ce(a),"pageLoadEndTime",void 0),Q(ce(a),"pageLoadInitTime",void 0),Q(ce(a),"_destroyed",void 0),Q(ce(a),"_heartBeatTimeout",void 0),Q(ce(a),"adTracker",void 0),Q(ce(a),"dashjs",void 0),Q(ce(a),"data",void 0),Q(ce(a),"disablePlayheadRebufferTracking",void 0),Q(ce(a),"disableRebufferTracking",void 0),Q(ce(a),"disableAdPlaybackRangeFiltering",void 0),Q(ce(a),"errorTracker",void 0),Q(ce(a),"errorTranslator",void 0),Q(ce(a),"emitTranslator",void 0),Q(ce(a),"getAdData",void 0),Q(ce(a),"getPlayheadTime",void 0),Q(ce(a),"getStateData",void 0),Q(ce(a),"stateDataTranslator",void 0),Q(ce(a),"hlsjs",void 0),Q(ce(a),"id",void 0),Q(ce(a),"longResumeTracker",void 0),Q(ce(a),"minimumRebufferDuration",void 0),Q(ce(a),"mux",void 0),Q(ce(a),"playbackEventDispatcher",void 0),Q(ce(a),"playbackHeartbeat",void 0),Q(ce(a),"playbackHeartbeatTime",void 0),Q(ce(a),"playheadTime",void 0),Q(ce(a),"seekingTracker",void 0),Q(ce(a),"sustainedRebufferThreshold",void 0),Q(ce(a),"watchTimeTracker",void 0),Q(ce(a),"currentFragmentPDT",void 0),Q(ce(a),"currentFragmentStart",void 0),a.pageLoadInitTime=Ly.navigationStart(),a.pageLoadEndTime=Ly.domContentLoadedEventEnd();var o={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,disableAdPlaybackRangeFiltering:!1,errorTranslator:function(f){return f},emitTranslator:function(){for(var f=arguments.length,g=new Array(f),y=0;y<f;y++)g[y]=arguments[y];return g},stateDataTranslator:function(f){return f}};a.mux=i,a.id=s,r!=null&&r.beaconDomain&&a.mux.log.warn("The `beaconDomain` setting has been deprecated 
95in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),r=Object.assign(o,r),r.data=r.data||{},r.data.property_key&&(r.data.env_key=r.data.property_key,delete r.data.property_key),ze.level=r.debug?Ha.DEBUG:Ha.WARN,a.getPlayheadTime=r.getPlayheadTime,a.getStateData=r.getStateData||function(){return{}},a.getAdData=r.getAdData||function(){},a.minimumRebufferDuration=r.minimumRebufferDuration,a.sustainedRebufferThreshold=r.sustainedRebufferThreshold,a.playbackHeartbeatTime=r.playbackHeartbeatTime,a.disableRebufferTracking=r.disableRebufferTracking,a.disableRebufferTracking&&a.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),a.disablePlayheadRebufferTracking=r.disablePlayheadRebufferTracking,a.disableAdPlaybackRangeFiltering=r.disableAdPlaybackRangeFiltering,a.errorTranslator=r.errorTranslator,a.emitTranslator=r.emitTranslator,a.stateDataTranslator=r.stateDataTranslator,a.playbackEventDispatcher=new Mte(i,r.data.env_key,r),a.data={player_instance_id:jh(),mux_sample_rate:r.sampleRate,beacon_domain:r.beaconCollectionDomain||r.beaconDomain},a.data.view_sequence_number=1,a.data.player_sequence_number=1;var l=(function(){typeof this.data.view_start>"u"&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"),this.emit("renditionchange"))}).bind(ce(a));if(a.on("viewinit",function(f,g){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,g),this._initializeViewData(),this.one("play",l),this.one("adbreakstart",l)}),a.on("videochange",function(f,g){this._resetView(g)}),a.on("programchange",function(f,g){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(g,{view_program_changed:!0})),l(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(f,g){this.currentFragmentPDT=g.currentFragmentPDT,this.currentFragmentStart=g.currentFragmentStart}),a.on("destroy",a.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var c=function(){var f=typeof a.data.view_start<"u";a.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",f&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",c,!1);var h=function(f){f.persisted||a.destroy()};window.addEventListener("pagehide",h,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",c),window.removeEventListener("pagehide",h)})}a.on("playerready",function(f,g){Object.assign(this.data,g)}),Qte.forEach(function(f){a.on(f,function(g,y){f.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,y),this._sanitizeData()}),a.on("after"+f,function(){(f!=="error"||this.errorTracker.viewErrored)&&this.send(f)})}),a.on("viewend",function(f,g){Object.assign(a.data,g)});var d=function(f){var g=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=g-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return a.one("playerready",d),a.longResumeTracker=new Ute(ce(a)),a.errorTracker=new Gee(ce(a)),new dte(ce(a)),a.seekingTracker=new ote(ce(a)),a.playheadTime=new Qee(ce(a)),a.playbackHeartbeat=new Hee(ce(a)),new nte(ce(a)),a.watchTimeTracker=new jee(ce(a)),new Yee(ce(a)),new zte(ce(a)),a.adTracker=new ute(ce(a)),new ete(ce(a)),new Zee(ce(a)),new ite(ce(a)),new Nte(ce(a)),new Gte(ce(a)),new Wte(ce(a)),r.hlsjs&&a.addHLSJS(r),r.dashjs&&a.addD
vendor: 15,267 bytes, lines 95-97
95ashJS(r),a.emit("viewinit",r.data),a}return gs(t,[{key:"emit",value:function(i,s){var r,a=Object.assign({viewer_time:this.mux.utils.now()},s),o=[i,a];if(this.emitTranslator)try{o=this.emitTranslator(i,a)}catch(l){this.mux.log.warn("Exception in emit translator callback.",l)}o!=null&&o.length&&(r=Gg(Yu(t.prototype),"emit",this)).call.apply(r,[this].concat(Gi(o)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start<"u"&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(i){if(this.data.view_id){var s=Object.assign({},this.data),r=["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"];if(s.video_source_is_live===void 0&&(s.player_source_duration===1/0||s.video_source_duration===1/0?s.video_source_is_live=!0:(s.player_source_duration>0||s.video_source_duration>0)&&(s.video_source_is_live=!1)),s.video_source_is_live||r.forEach(function(c){s[c]=void 0}),s.video_source_url=s.video_source_url||s.player_source_url,s.video_source_url){var a=er(Wh(s.video_source_url),2),o=a[0],l=a[1];s.video_source_domain=l,s.video_source_hostname=o}delete s.ad_request_id,s.video_playback_ranges&&(s.video_playback_range=JSON.stringify(s.video_playback_ranges.filter(function(c){return c[0]!==c[1]}).map(function(c){return"".concat(c[0],":").concat(c[1])})),delete s.video_playback_ranges),this.playbackEventDispatcher.send(i,s),this.data.view_sequence_number++,this.data.player_sequence_number++,Xte.has(i)||this._restartHeartBeat(),i==="viewend"&&delete this.data.view_id}}},{key:"_resetView",value:function(i){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",i)}},{key:"_updateStateData",value:function(){var i,s=this.getStateData();if(typeof this.stateDataTranslator=="function")try{s=this.stateDataTranslator(s)}catch(a){this.mux.log.warn("Exception in stateDataTranslator translator callback.",a)}if(!((i=this.data)===null||i===void 0)&&i.video_cdn&&s!=null&&s.video_cdn){s.video_cdn;var r=_ee(s,["video_cdn"]);s=r}Object.assign(this.data,s),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var i=this,s=["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"];s.forEach(function(a){var o=parseInt(i.data[a],10);i.data[a]=isNaN(o)?void 0:o});var r=["player_source_url","video_source_url"];r.forEach(function(a){if(i.data[a]){var o=i.data[a].toLowerCase();(o.indexOf("data:")===0||o.indexOf("blob:")===0)&&(i.data[a]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var i=this;Object.keys(this.data).forEach(function(s){s.indexOf("video_")===0&&delete i.data[s]})}},{key:"_resetViewData",value:function(){var i=this;Object.keys(this.data).forEach(function(s){s.indexOf("view_")===0&&delete i.data[s]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var i=this,s=this.data.view_id=jh(),r=function(){s===i.data.view_id&&_t(i.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",r):r()}},{key:"_restartHeartBeat",value:function(){var i=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){i.data.player_is_paused||i.emit("hb")},1e4)}},{key:"addHLSJS",value:function(i){if(!i.hlsjs){this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");return}if(this.hlsjs){this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");return}this.hlsjs=i.hlsjs,Pee(this.mux,this.id,i.hlsjs,{},i.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&(Dee(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(i){if(!i.dashjs){this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");return}if(this.dashjs){this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");return}this.dashjs=i.dashjs,Nee(this.mux,this.id,i.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(Fee(this.dashjs),this.dashjs=void 0)}}]),t}(Uee),Jte=Zte,uh=Ui(YB());function pL(){return uh.default&&!!(uh.default.fullscreenElement||uh.default.webkitFullscreenElement||uh.default.mozFullScreenElement||uh.default.msFullscreenElement)}var eie=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],tie={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function iie(n,e,t){var i=er(xy(e),3),s=i[0],r=i[1],a=i[2],o=n.log,l=n.utils.getComputedStyle,c=n.utils.secondsToMs,h={automaticErrorTracking:!0};if(s){if(a!=="video"&&a!=="audio")return o.error("The element of `"+r+"` was not a media element.")}else return o.error("No element was found with the `"+r+"` query selector.");s.mux&&(s.mux.destroy(),delete s.mux,o.warn("Already monitoring this video element, replacing existing event listeners"));var d={getPlayheadTime:function(){return c(s.currentTime)},getStateData:function(){var g,y,v,T=((g=(y=this).getPlayheadTime)===null||g===void 0?void 0:g.call(y))||c(s.currentTime),b=this.hlsjs&&this.hlsjs.url,E=this.dashjs&&typeof this.dashjs.getSource=="function"&&this.dashjs.getSource(),_={player_is_paused:s.paused,player_width:parseInt(l(s,"width")),player_height:parseInt(l(s,"height")),player_autoplay_on:s.autoplay,player_preload_on:s.preload,player_language_code:s.lang,player_is_fullscreen:pL(),video_poster_url:s.poster,video_source_url:b||E||s.currentSrc,video_source_duration:c(s.duration),video_source_height:s.videoHeight,video_source_width:s.videoWidth,view_dropped_frame_count:s==null||(v=s.getVideoPlaybackQuality)===null||v===void 0?void 0:v.call(s).droppedVideoFrames};if(s.getStartDate&&T>0){var x=s.getStartDate();if(x&&typeof x.getTime=="function"&&x.getTime()){var w=x.getTime();if(_.player_program_time=w+T,s.seekable.length>0){var R=w+s.seekable.end(s.seekable.length-1);_.player_live_edge_program_time=R}}}return _}};t=Object.assign(h,t,d),t.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:n.VERSION},t.data),s.mux=s.mux||{},s.mux.deleted=!1,s.mux.emit=function(g,y){n.emit(r,g,y)},s.mux.updateData=function(g){s.mux.emit("hb",g)};var f=function(){o.error("The monitor for this video element has already been destroyed.")};s.mux.destroy=function(){Object.keys(s.mux.listeners).forEach(function(g){s.removeEventListener(g,s.mux.listeners[g],!1)}),delete s.mux.listeners,s.mux.fullscreenChangeListener&&(document.removeEventListener("fullscreenchange",s.mux.fullscreenChangeListener,!1),delete s.mux.fullscreenChangeListener),s.mux.destroy=f,s.mux.swapElement=f,s.mux.emit=f,s.mux.addHLSJS=f,s.mux.addDashJS=f,s.mux.removeHLSJS=f,s.mux.removeDashJS=f,s.mux.updateData=f,s.mux.setEmitTranslator=f,s.mux.setStateDataTranslator=f,s.mux.setGetPlayheadTime=f,s.mux.deleted=!0,n.emit(r,"destroy")},s.mux.swapElement=function(g){var y=er(xy(g),3),v=y[0],T=y[1],b=y[2];if(v){if(b!=="video"&&b!=="audio")return n.log.error("The element of `"+T+"` was not a media element.")}else return n.log.error("No element was found with the `"+T+"` query selector.");v.muxId=s.muxId,delete s.muxId,v.mux=v.mux||{},v.mux.listeners=Object.assign({},s.mux.listeners),delete s.mux.listeners,Object.keys(v.mux.listeners).forEach(function(E){s.removeEventListener(E,v.mux.listeners[E],!1),v.addEventListener(E,v.mux.listeners[E],!1)}),v.mux.fullscreenChangeListener=s.mux.fullscreenChangeListener,delete s.mux.fullscreenChangeListener,v.mux.swapElement=s.mux.swapElement,v.mux.destroy=s.mux.destroy,delete s.mux,s=v},s.mux.addHLSJS=function(g){n.addHLSJS(r,g)},s.mux.addDashJS=function(g){n.addDashJS(r,g)},s.mux.removeHLSJS=function(){n.removeHLSJS(r)},s.mux.removeDashJS=function(){n.removeDashJS(r)},s.mux.setEmitTranslator=function(g){n.setEmitTranslator(r,g)},s.mux.setStateDataTranslator=function(g){n.setStateDataTranslator(r,g)},s.mux.setGetPlayheadTime=function(g){g||(g=t.getPlayheadTime),n.setGetPlayheadTime(r,g)},n.init(r,t),n.emit(r,"playerready"),s.paused||(n.emit(r,"play"),s.readyState>2&&n.emit(r,"playing")),s.mux.listeners={},eie.forEach(function(g){g==="error"&&!t.automaticErrorTracking||(s.mux.listeners[g]=function(){var y={};if(g==="error"){if(!s.error||s.error.code===1)return;y.player_error_code=s.error.code,y.player_error_message=tie[s.error.code]||s.error.message}n.emit(r,g,y)},s.addEventListener(g,s.mux.listeners[g],!1))}),s.mux.listeners.enterpictureinpicture=function(){n.emit(r,"playbackmodechange",{player_playback_mode:"pip",player_playback_mode_data:"{}"})},s.mux.listeners.leavepictureinpicture=function(){var g=pL()?"fullscreen":"standard";n.emit(r,"playbackmodechange",{player_playback_mode:g,player_playback_mode_data:"{}"})},s.addEventListener("enterpictureinpicture",s.mux.listeners.enterpictureinpicture,!1),s.addEventListener("leavepictureinpicture",s.mux.listeners.leavepictureinpicture,!1),s.mux.fullscreenChangeListener=function(){var g=pL(),y=document.fullscreenElement;if(g&&(y===s||y!=null&&y.contains(s)))n.emit(r,"playbackmodechange",{player_playback_mode:"fullscreen",player_playback_mode_data:"{}"});else if(!g){var v=document.pictureInPictureElement===s,T=v?"pip":"standard";n.emit(r,"playbackmodechange",{player_playback_mode:T,player_playback_mode_data:"{}"})}},document.addEventListener("fullscreenchange",s.mux.fullscreenChangeListener,!1)}function sie(n,e,t,i){var s=i;if(n&&typeof n[e]=="function")try{s=n[e].apply(n,t)}catch(r){ze.info("safeCall error",r)}return s}var Dh=Ui(tn()),Ml;Dh.default&&Dh.default.WeakMap&&(Ml=new WeakMap);function nie(n,e){if(!n||!e||!Dh.default||typeof Dh.default.getComputedStyle!="function")return"";var t;return Ml&&Ml.has(n)&&(t=Ml.get(n)),t||(t=Dh.default.getComputedStyle(n,null),Ml&&Ml.set(n,t)),t.getPropertyValue(e)}function rie(n){return Math.floor(n*1e3)}var Da={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},vx=function(n){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(n),this.manifest};vx.prototype.process=function(n){var e;for(this.buffer+=n,e=this.buffer.indexOf(`
96`);e>-1;e=this.buffer.indexOf(`
97`))this.processLine(this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)};vx.prototype.processLine=function(n){var e=n.indexOf(":"),t=cie(n,e),i=t[0],s=t.length===2?b3(t[1]):void 0;if(i[0]!=="#")this.currentUri.uri=i,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(i){case Da.TARGET_DURATION:{if(!isFinite(s)||s<0)return;this.manifest.targetDuration=s,this.setHoldBack();break}case Da.PART_INF:{mL(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case Da.SERVER_CONTROL:{mL(this.manifest,t),this.setHoldBack();break}case Da.INF:{s===0?this.currentUri.duration=.01:s>0&&(this.currentUri.duration=s);break}case Da.PROGRAM_DATE_TIME:{var r=s,a=new Date(r);this.manifest.dateTimeString||(this.manifest.dateTimeString=r,this.manifest.dateTimeObject=a),this.currentUri.dateTimeString=r,this.currentUri.dateTimeObject=a;break}case Da.VERSION:{mL(this.manifest,t);break}case Da.SESSION_DATA:{var o=uie(t[1]),l=ZB(o);Object.assign(this.manifest.sessionData,l)}}};vx.prototype.setHoldBack=function(){var n=this.manifest,e=n.serverControl,t=n.targetDuration,i=n.partTargetDuration;if(e){var s="holdBack",r="partHoldBack",a=t&&t*3,o=i&&i*2;t&&!e.hasOwnProperty(s)&&(e[s]=a),a&&e[s]<a&&(e[s]=a),i&&!e.hasOwnProperty(r)&&(e[r]=i*3),i&&e[r]<o&&(e[r]=o)}};var mL=function(n,e){var t=oU(e[0].replace("#EXT-X-","")),i;lie(e[1])?(i={},i=Object.assign(oie(e[1]),i)):i=b3(e[1]),n[t]=i},oU=function(n){return n.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},b3=function(n){if(n.toLowerCase()==="yes"||n.toLowerCase()==="no")return n.toLowerCase()==="yes";var e=n.indexOf(":")!==-1?n:parseFloat(n);return isNaN(e)?n:e},aie=function(n){var e={},t=n.split("=");if(t.length>1){var i=oU(t[0]);e[i]=b3(t[1])}return e},oie=function(n){for(var e=n.split(","),t={},i=0;e.length>i;i++){var s=e[i],r=aie(s);t=Object.assign(r,t)}return t},lie=function(n){return n.indexOf("=")>-1},cie=function(n,e){return e===-1?[n]:[n.substring(0,e),n.substring(e+1)]},uie=function(n){var e={};if(n){var t=n.search(","),i=n.slice(0,t),s=n.slice(t+1),r=[i,s];return r.forEach(function(a,o){for(var l=a.replace(/['"]+/g,"").split("="),c=0;c<l.length;c++)l[c]==="DATA-ID"&&(e["DATA-ID"]=l[1-c]),l[c]==="VALUE"&&(e.VALUE=l[1-c])}),{data:e}}},hie=vx,die={safeCall:sie,safeIncrement:_t,getComputedStyle:nie,secondsToMs:rie,assign:Object.assign,headersStringToObject:T3,cdnHeadersToRequestId:Cy,extractHostnameAndDomain:Wh,extractHostname:os,manifestParser:hie,generateShortID:QB,generateUUID:jh,now:Pt.now,findMediaElement:xy},fie=die,pie={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",PLAYBACK_MODE_CHANGE:"playbackmodechange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled",HEARTBEAT:"hb",DESTROY:"destroy"},mie=pie,gie="mux-embed",yie="5.17.10",vie="2.1",mt={},pa=function(n){var e=arguments;typeof n=="string"?pa.hasOwnProperty(n)?Ph.default.setTimeout(function(){e=Array.prototype.splice.call(e,1),pa[n].apply(null,e)},0):ze.warn("`"+n+"` is an unknown task"):typeof n=="function"?Ph.default.setTimeout(function(){n(pa)},0):ze.warn("`"+n+"` is invalid.")},Tie={loaded:Pt.now(),NAME:gie,VERSION:yie,API_VERSION:vie,PLAYER_TRACKED:!1,monitor:function(n,e){return iie(pa,n,e)},destroyMonitor:function(n){var e=er(xy(n),1),t=e[0];t&&t.mux&&typeof t.mux.destroy=="function"?t.mux.destroy():ze.error("A video element monitor for `"+n+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(n,e){var t=qi(n);mt[t]?mt[t].addHLSJS(e):ze.error("A monitor for `"+t+"` has not been initialized.")},addDashJS:function(n,e){var t=qi(n);
97mt[t]?mt[t].addDashJS(e):ze.error("A monitor for `"+t+"` has not been initialized.")},removeHLSJS:function(n){var e=qi(n);mt[e]?mt[e].removeHLSJS():ze.error("A monitor for `"+e+"` has not been initialized.")},removeDashJS:function(n){var e=qi(n);mt[e]?mt[e].removeDashJS():ze.error("A monitor for `"+e+"` has not been initialized.")},init:function(n,e){_I()&&e&&e.respectDoNotTrack&&ze.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var t=qi(n);mt[t]=new Jte(pa,t,e)},emit:function(n,e,t){var i=qi(n);mt[i]?(mt[i].emit(e,t),e==="destroy"&&delete mt[i]):ze.error("A monitor for `"+i+"` has not been initialized.")},updateData:function(n,e){var t=qi(n);mt[t]?mt[t].emit("hb",e):ze.error("A monitor for `"+t+"` has not been initialized.")},setEmitTranslator:function(n,e){var t=qi(n);mt[t]?mt[t].emitTranslator=e:ze.error("A monitor for `"+t+"` has not been initialized.")},setStateDataTranslator:function(n,e){var t=qi(n);mt[t]?mt[t].stateDataTranslator=e:ze.error("A monitor for `"+t+"` has not been initialized.")},setGetPlayheadTime:function(n,e){var t=qi(n);mt[t]?mt[t].getPlayheadTime=e:ze.error("A monitor for `"+t+"` has not been initialized.")},checkDoNotTrack:_I,log:ze,utils:fie,events:mie,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(pa,Tie);typeof Ph.default<"u"&&typeof Ph.default.addEventListener=="function"&&Ph.default.addEventListener("pagehide",function(n){n.persisted||(pa.WINDOW_UNLOADING=!0)},!1);var bie=pa;/*!
98* JavaScript Cookie v2.1.3
99* https://github.com/js-cookie/js-cookie
100*
101* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
102* Released under the MIT license
103*/const Eie=Object.freeze(Object.defineProperty({__proto__:null,default:bie},Symbol.toStringTag,{value:"Module"})),Sie=/,/g,_ie="-->";class lU extends Bk{parse(e,t){var i,s;if(e==="")this.c&&(this.l.push(this.c),(s=(i=this.h).onCue)==null||s.call(i,this.c),this.c=null),this.e=Lh.None;else if(this.e===Lh.Cue)this.c.text+=(this.c.text?`
104`:"")+e;else if(e.includes(_ie)){const r=this.q(e,t);r&&(this.c=new cx(r[0],r[1],r[2].join(" ")),this.c.id=this.n,this.e=Lh.Cue)}this.n=e}q(e,t){return super.q(e.replace(Sie,"."),t)}}function Aie(){return new lU}const xie=Object.freeze(Object.defineProperty({__proto__:null,SRTParser:lU,default:Aie},Symbol.toStringTag,{value:"Module"})),ag=/^Format:[\s\t]*/,r2=/^Style:[\s\t]*/,a2=/^Dialogue:[\s\t]*/,og=/[\s\t]*,[\s\t]*/,o2=/\{[^}]+\}/g,l2=/\\N/g,c2=/^\[(.*)[\s\t]?Styles\]$/,gL=/^\[(.*)[\s\t]?Events\]$/;class cU{constructor(){L(this,"h");L(this,"O",0);L(this,"c",null);L(this,"l",[]);L(this,"m",[]);L(this,"N",null);L(this,"f");L(this,"P",{})}async init(e){this.h=e,e.errors&&(this.f=(await se(()=>Promise.resolve().then(()=>uU),void 0,import.meta.url)).ParseErrorBuilder)}parse(e,t){var i,s;if(this.O)switch(this.O){case 1:if(e==="")this.O=0;else if(r2.test(e))if(this.N){const r=e.replace(r2,"").split(og);this.S(r)}else this.g((i=this.f)==null?void 0:i.T("Style",t));else ag.test(e)?this.N=e.replace(ag,"").split(og):gL.test(e)&&(this.N=null,this.O=2);break;case 2:if(e==="")this.Q();else if(a2.test(e))if(this.Q(),this.N){const r=e.replace(a2,"").split(og),a=this.U(r,t);a&&(this.c=a)}else this.g((s=this.f)==null?void 0:s.T("Dialogue",t));else this.c?this.c.text+=`
105`+e.replace(o2,"").replace(l2,`
106`):ag.test(e)?this.N=e.replace(ag,"").split(og):c2.test(e)?(this.N=null,this.O=1):gL.test(e)&&(this.N=null)}else e===""||(c2.test(e)?(this.N=null,this.O=1):gL.test(e)&&(this.N=null,this.O=2))}done(){return{metadata:{},cues:this.l,regions:[],errors:this.m}}Q(){var e,t;this.c&&(this.l.push(this.c),(t=(e=this.h).onCue)==null||t.call(e,this.c),this.c=null)}S(e){let t="Default",i={},s,r="center",a="bottom",o,l=1.2,c,h,d=3,f=[];for(let g=0;g<this.N.length;g++){const y=this.N[g],v=e[g];switch(y){case"Name":t=v;break;case"Fontname":i["font-family"]=v;break;case"Fontsize":i["font-size"]=`calc(${v} / var(--overlay-height))`;break;case"PrimaryColour":const T=yL(v);T&&(i["--cue-color"]=T);break;case"BorderStyle":d=parseInt(v,10);break;case"BackColour":h=yL(v);break;case"OutlineColour":const b=yL(v);b&&(c=b);break;case"Bold":parseInt(v)&&(i["font-weight"]="bold");break;case"Italic":parseInt(v)&&(i["font-style"]="italic");break;case"Underline":parseInt(v)&&(i["text-decoration"]="underline");break;case"StrikeOut":parseInt(v)&&(i["text-decoration"]="line-through");break;case"Spacing":i["letter-spacing"]=v+"px";break;
106case"AlphaLevel":i.opacity=parseFloat(v);break;case"ScaleX":f.push(`scaleX(${parseFloat(v)/100})`);break;case"ScaleY":f.push(`scaleY(${parseFloat(v)/100})`);break;case"Angle":f.push(`rotate(${v}deg)`);break;case"Shadow":l=parseInt(v,10)*1.2;break;case"MarginL":i["--cue-width"]="auto",i["--cue-left"]=parseFloat(v)+"px";break;case"MarginR":i["--cue-width"]="auto",i["--cue-right"]=parseFloat(v)+"px";break;case"MarginV":o=parseFloat(v);break;case"Outline":s=parseInt(v,10);break;case"Alignment":const E=parseInt(v,10);switch(E>=4&&(a=E>=7?"top":"center"),E%3){case 1:r="start";break;case 2:r="center";break;case 3:r="end";break}}}if(i.R=a,i["--cue-white-space"]="normal",i["--cue-line-height"]="normal",i["--cue-text-align"]=r,a==="center"?(i["--cue-top"]="50%",f.push("translateY(-50%)")):i[`--cue-${a}`]=(o||0)+"px",d===1&&(i["--cue-padding-y"]="0"),(d===1||h)&&(i["--cue-bg-color"]=d===1?"none":h),d===3&&c&&(i["--cue-outline"]=`${s}px solid ${c}`),d===1&&typeof s=="number"){const g=h??"#000";i["--cue-text-shadow"]=[c&&vL(s*1.2,l*1.2,c),c?vL(s*(s/2),l*(s/2),g):vL(s,l,g)].filter(Boolean).join(", ")}f.length&&(i["--cue-transform"]=f.join(" ")),this.P[t]=i}U(e,t){const i=this.V(e),s=this.q(i.Start,i.End,t);if(!s)return;const r=new cx(s[0],s[1],""),a={...this.P[i.Style]||{}},o=i.Name?`<v ${i.Name}>`:"",l=a.R,c=i.MarginL&&parseFloat(i.MarginL),h=i.MarginR&&parseFloat(i.MarginR),d=i.MarginV&&parseFloat(i.MarginV);return c&&(a["--cue-width"]="auto",a["--cue-left"]=c+"px"),h&&(a["--cue-width"]="auto",a["--cue-right"]=h+"px"),d&&l!=="center"&&(a[`--cue-${l}`]=d+"px"),r.text=o+e.slice(this.N.length-1).join(", ").replace(o2,"").replace(l2,`
107`),delete a.R,Object.keys(a).length&&(r.style=a),r}V(e){const t={};for(let i=0;i<this.N.length;i++)t[this.N[i]]=e[i];return t}q(e,t,i){var a,o,l;const s=fl(e),r=fl(t);if(s!==null&&r!==null&&r>s)return[s,r];s===null&&this.g((a=this.f)==null?void 0:a.s(e,i)),r===null&&this.g((o=this.f)==null?void 0:o.t(t,i)),s!=null&&r!==null&&r>s&&this.g((l=this.f)==null?void 0:l.u(s,r,i))}g(e){var t,i;if(e){if(this.m.push(e),this.h.strict)throw this.h.cancel(),e;(i=(t=this.h).onError)==null||i.call(t,e)}}}function yL(n){const e=parseInt(n.replace("&H",""),16);if(e>=0){const i=(e>>24&255^255)/255,s=e>>16&255,r=e>>8&255;return"rgba("+[e&255,r,s,i].join(",")+")"}return null}function vL(n,e,t){const i=Math.ceil(2*Math.PI*n);let s="";for(let r=0;r<i;r++){const a=2*Math.PI*r/i;s+=n*Math.cos(a)+"px "+e*Math.sin(a)+"px 0 "+t+(r==i-1?"":",")}return s}function Lie(){return new cU}const wie=Object.freeze(Object.defineProperty({__proto__:null,SSAParser:cU,default:Lie},Symbol.toStringTag,{value:"Module"})),Cie={r(){return new bs({code:Ts.BadSignature,reason:"missing WEBVTT file header",line:1})},s(n,e){return new bs({code:Ts.BadTimestamp,reason:`cue start timestamp \`${n}\` is invalid on line ${e}`,line:e})},t(n,e){return new bs({code:Ts.BadTimestamp,reason:`cue end timestamp \`${n}\` is invalid on line ${e}`,line:e})},u(n,e,t){return new bs({code:Ts.BadTimestamp,reason:`cue end timestamp \`${e}\` is greater than start \`${n}\` on line ${t}`,line:t})},y(n,e,t){return new bs({code:Ts.BadSettingValue,reason:`invalid value for cue setting \`${n}\` on line ${t} (value: ${e})`,line:t})},x(n,e,t){return new bs({code:Ts.UnknownSetting,reason:`unknown cue setting \`${n}\` on line ${t} (value: ${e})`,line:t})},w(n,e,t){return new bs({code:Ts.BadSettingValue,reason:`invalid value for region setting \`${n}\` on line ${t} (value: ${e})`,line:t})},v(n,e,t){return new bs({code:Ts.UnknownSetting,reason:`unknown region setting \`${n}\` on line ${t} (value: ${e})`,line:t})},T(n,e){return new bs({code:Ts.BadFormat,reason:`format missing for \`${n}\` block on line ${e}`,line:e})}},uU=Object.freeze(Object.defineProperty({__proto__:null,ParseErrorBuilder:Cie},Symbol.toStringTag,{value:"Module"}));var rs,IA,hU;class Iie{constructor(e){p(this,IA);p(this,rs,void 0);A(this,rs,new{TrackType:{TEXT:"text",AUDIO:"audio"}}.MediaInfo(e.src,e.type))}build(){return u(this,rs)}setStreamType(e){return e.includes("live")?u(this,rs).streamType={TrackType:{TEXT:"text",AUDIO:"audio"}}.StreamType.LIVE:u(this,rs).streamType={TrackType:{TEXT:"text",AUDIO:"audio"}}.StreamType.BUFFERED,this}setTracks(e){return u(this,rs).tracks=e.map(m(this,IA,hU)),this}setMetadata(e,t){return u(this,rs).metadata=new{TrackType:{TEXT:"text",AUDIO:"audio"}}.GenericMediaMetadata,u(this,rs).metadata.title=e,u(this,rs).metadata.images=[{url:t}],this}}rs=new WeakMap,IA=new WeakSet,hU=function(e,t){const i=new{TrackType:{TEXT:"text",AUDIO:"audio"}}.Track(t,"text");return i.name=e.label,i.trackContentId=e.src,i.trackContentType="text/vtt",i.language=e.language,i.subtype=e.kind.toUpperCase(),i};var ca,Ks,cm,um,LI,ua,$l,kA,dU,RA,fU,PA,pU,hm,wI,Du,Kg,dm,CI;class kie{constructor(e,t,i){p(this,um);p(this,ua);p(this,kA);p(this,RA);p(this,PA);p(this,hm);p(this,Du);p(this,dm);p(this,ca,void 0);p(this,Ks,void 0);p(this,cm,void 0);A(this,ca,e),A(this,Ks,t),A(this,cm,i)}setup(){const e=this.syncRemoteActiveIds.bind(this);Fe(u(this,Ks).audioTracks,"change",e),Fe(u(this,Ks).textTracks,"mode-change",e),D(m(this,RA,fU).bind(this))}getLocalTextTracks(){return u(this,Ks).$state.textTracks().filter(e=>e.src&&e.type==="vtt")}syncRemoteTracks(e){if(!u(this,ca).isMediaLoaded)return;const t=m(this,um,LI).call(this),i=this.getLocalTextTracks(),s=m(this,ua,$l).call(this,"audio"),r=m(this,ua,$l).call(this,"text");for(const a of s){if(m(this,hm,wI).call(this,t,a))continue;const l={id:a.trackId.toString(),label:a.name,language:a.language,kind:a.subtype??"main",selected:!1};u(this,Ks).audioTracks[he.add](l,e)}for(const a of r){if(m(this,hm,wI).call(this,i,a))continue;const l={id:a.trackId.toString(),src:a.trackContentId,label:a.name,language:a.language,kind:a.subtype.toLowerCase()};u(this,Ks).textTracks.add(l,e)}}syncRemoteActiveIds(e){if(!u(this,ca).isMediaLoaded)return;const t=m(this,kA,dU).call(this),i=new{TrackType:{TEXT:"text",AUDIO:"audio"}}.EditTracksInfoRequest(t);m(this,PA,pU).call(this,i).catch(s=>{})}}ca=new WeakMap,Ks=new WeakMap,cm=new WeakMap,um=new WeakSet,LI=function(){return u(this,Ks).$state.audioTracks()},ua=new WeakSet,$l=function(e){var i;const t=((i=u(this,ca).mediaInfo)==null?void 0:i.tracks)??[];return e?t.filter(s=>s.type===e):t},kA=new WeakSet,dU=function(){const e=[],t=m(this,um,LI).call(this).find(s=>s.selected),i=this.getLocalTextTracks().filter(s=>s.mode==="showing");if(t){const s=m(this,ua,$l).call(this,"audio"),r=m(this,Du,Kg).call(this,s,t);r&&e.push(r.trackId)}if(i!=null&&i.length){const s=m(this,ua,$l).call(this,"text");if(s.length)for(const r of i){const a=m(this,Du,Kg).call(this,s,r);a&&e.push(a.trackId)}}return e},RA=new WeakSet,fU=function(){const e=this.getLocalTextTracks();if(!u(this,ca).isMediaLoaded)return;const t=m(this,ua,$l).call(this,"text");for(const i of e)if(!m(this,Du,Kg).call(this,t,i)){Nu(()=>{var r;return(r=u(this,cm))==null?void 0:r.call(this)});break}},PA=new WeakSet,pU=function(e){const t=Wk();return new Promise((i,s)=>t==null?void 0:t.editTracksInfo(e,i,s))},hm=new WeakSet,wI=function(e,t){return e.find(i=>m(this,dm,CI).call(this,i,t))},Du=new WeakSet,Kg=function(e,t){return e.find(i=>m(this,dm,CI).call(this,t,i))},dm=new WeakSet,CI=function(e,t){return t.name===e.label&&t.language===e.language&&t.subtype.toLowerCase()===e.kind.toLowerCase()};var Ee,ke,ha,da,fm,Ou,tl,il,Mu,pm,Mi,$u,DA,mU,OA,gU,mm,II,MA,yU,gm,kI,$A,vU,NA,TU,FA,bU,ym,RI,vm,PI,Tm,DI,bm,OI,BA,EU,UA,SU,VA,_U,Em,MI,HA,AU,Sm,$I,qA,xU,_m,NI,as,ln,GA,LU,KA,wU,Am,FI,jA,CU;class Rie{constructor(e,t){p(this,DA);p(this,OA);p(this,mm);p(this,MA);p(this,gm);p(this,$A);p(this,NA);p(this,FA);p(this,ym);p(this,vm);p(this,Tm);p(this,bm);p(this,BA);p(this,UA);p(this,VA);p(this,Em);p(this,HA);p(this,Sm);p(this,qA);p(this,_m);p(this,as);p(this,GA);p(this,KA);p(this,Am);p(this,jA);L(this,"$$PROVIDER_TYPE","GOOGLE_CAST");L(this,"scope",ma());p(this,Ee,void 0);p(this,ke,void 0);p(this,ha,void 0);p(this,da,null);p(this,fm,"disconnected");p(this,Ou,0);p(this,tl,0);p(this,il,new yt(0,0));p(this,Mu,new km(m(this,NA,TU).bind(this)));p(this,pm,void 0);p(this,Mi,null);p(this,$u,!1);A(this,Ee,e),A(this,ke,t),A(this,ha,new kie(e,t,m(this,jA,CU).bind(this)))}get type(){return"google-cast"}get currentSrc(){return u(this,da)}get player(){return u(this,Ee)}get cast(){return Rm()}get session(){return jk()}get media(){return Wk()}get hasActiveSession(){return PR(u(this,da))}setup(){m(this,DA,mU).call(this),m(this,OA,gU).call(this),u(this,ha).setup(),u(this,ke).notify("provider-setup",this)}async play(){var e;
107if(!(!u(this,Ee).isPaused&&!u(this,$u))){if(u(this,$u)){await m(this,Am,FI).call(this,!1,0);return}(e=u(this,Ee).controller)==null||e.playOrPause()}}async pause(){var e;u(this,Ee).isPaused||(e=u(this,Ee).controller)==null||e.playOrPause()}getMediaStatus(e){return new Promise((t,i)=>{var s;(s=this.media)==null||s.getStatus(e,t,i)})}setMuted(e){var i;(e&&!u(this,Ee).isMuted||!e&&u(this,Ee).isMuted)&&((i=u(this,Ee).controller)==null||i.muteOrUnmute())}setCurrentTime(e){var t;u(this,Ee).currentTime=e,u(this,ke).notify("seeking",e),(t=u(this,Ee).controller)==null||t.seek()}setVolume(e){var t;u(this,Ee).volumeLevel=e,(t=u(this,Ee).controller)==null||t.setVolumeLevel()}async loadSource(e){var s;if(((s=u(this,Mi))==null?void 0:s.src)!==e&&A(this,Mi,null),PR(e)){m(this,MA,yU).call(this),A(this,da,e);return}u(this,ke).notify("load-start");const t=m(this,KA,wU).call(this,e),i=await this.session.loadMedia(t);if(i){A(this,da,null),u(this,ke).notify("error",Error(q8(i)));return}A(this,da,e)}destroy(){m(this,mm,II).call(this),m(this,gm,kI).call(this)}}Ee=new WeakMap,ke=new WeakMap,ha=new WeakMap,da=new WeakMap,fm=new WeakMap,Ou=new WeakMap,tl=new WeakMap,il=new WeakMap,Mu=new WeakMap,pm=new WeakMap,Mi=new WeakMap,$u=new WeakMap,DA=new WeakSet,mU=function(){FW({CastContext:{getInstance:function(){return{}}}}.CastContextEventType.CAST_STATE_CHANGED,m(this,ym,RI).bind(this))},OA=new WeakSet,gU=function(){const e={CastContext:{getInstance:function(){return{}}}}.RemotePlayerEventType,t={[e.IS_CONNECTED_CHANGED]:m(this,ym,RI),[e.IS_MEDIA_LOADED_CHANGED]:m(this,vm,PI),[e.CAN_CONTROL_VOLUME_CHANGED]:m(this,Tm,DI),[e.CAN_SEEK_CHANGED]:m(this,bm,OI),[e.DURATION_CHANGED]:m(this,VA,_U),[e.IS_MUTED_CHANGED]:m(this,Em,MI),[e.VOLUME_LEVEL_CHANGED]:m(this,Em,MI),[e.IS_PAUSED_CHANGED]:m(this,HA,AU),[e.LIVE_SEEKABLE_RANGE_CHANGED]:m(this,Sm,$I),[e.PLAYER_STATE_CHANGED]:m(this,qA,xU)};A(this,pm,t);const i=m(this,FA,bU).bind(this);for(const s of R3(t))u(this,Ee).controller.addEventListener(s,i);ge(()=>{for(const s of R3(t))u(this,Ee).controller.removeEventListener(s,i)})},mm=new WeakSet,II=function(){u(this,Mi)||(A(this,tl,0),A(this,il,new yt(0,0))),u(this,Mu).stop(),A(this,Ou,0),A(this,Mi,null)},MA=new WeakSet,yU=function(){const e=new ve("resume-session",{detail:this.session});m(this,vm,PI).call(this,e);const{muted:t,volume:i,savedState:s}=u(this,ke).$state,r=s();this.setCurrentTime(Math.max(u(this,Ee).currentTime,(r==null?void 0:r.currentTime)??0)),this.setMuted(t()),this.setVolume(i()),(r==null?void 0:r.paused)===!1&&this.play()},gm=new WeakSet,kI=function(){this.cast.endCurrentSession(!0);const{remotePlaybackLoader:e}=u(this,ke).$state;e.set(null)},$A=new WeakSet,vU=function(){const{savedState:e}=u(this,ke).$state;e.set({paused:u(this,Ee).isPaused,currentTime:u(this,Ee).currentTime}),m(this,gm,kI).call(this)},NA=new WeakSet,TU=function(){m(this,UA,SU).call(this)},FA=new WeakSet,bU=function(e){u(this,pm)[e.type].call(this,e)},ym=new WeakSet,RI=function(e){const t=this.cast.getCastState(),i=t==={CastContext:{getInstance:function(){return{}}}}.CastState.CONNECTED?"connected":t==={CastContext:{getInstance:function(){return{}}}}.CastState.CONNECTING?"connecting":"disconnected";if(u(this,fm)===i)return;const s={type:"google-cast",state:i},r=m(this,as,ln).call(this,e);A(this,fm,i),u(this,ke).notify("remote-playback-change",s,r),i==="disconnected"&&m(this,$A,vU).call(this)},vm=new WeakSet,PI=function(e){if(!!!u(this,Ee).isMediaLoaded)return;const i=Y(u(this,ke).$state.source);Promise.resolve().then(()=>{if(i!==Y(u(this,ke).$state.source)||!u(this,Ee).isMediaLoaded)return;m(this,mm,II).call(this);const s=u(this,Ee).duration;A(this,il,new yt(0,s));const r={provider:this,duration:s,buffered:new yt(0,0),seekable:m(this,_m,NI).call(this)},a=m(this,as,ln).call(this,e);u(this,ke).notify("loaded-metadata",void 0,a),u(this,ke).notify("loaded-data",void 0,a),u(this,ke).notify("can-play",r,a),m(this,Tm,DI).call(this),m(this,bm,OI).call(this,e);const{volume:o,muted:l}=u(this,ke).$state;this.setVolume(o()),this.setMuted(l()),u(this,Mu).start(),u(this,ha).syncRemoteTracks(a),u(this,ha).syncRemoteActiveIds(a)})},Tm=new WeakSet,DI=function(){u(this,ke).$state.canSetVolume.set(u(this,Ee).canControlVolume)}
107,bm=new WeakSet,OI=function(e){const t=m(this,as,ln).call(this,e);u(this,ke).notify("stream-type-change",m(this,BA,EU).call(this),t)},BA=new WeakSet,EU=function(){var t;return((t=u(this,Ee).mediaInfo)==null?void 0:t.streamType)==={TrackType:{TEXT:"text",AUDIO:"audio"}}.StreamType.LIVE?u(this,Ee).canSeek?"live:dvr":"live":"on-demand"},UA=new WeakSet,SU=function(){if(u(this,Mi))return;const e=u(this,Ee).currentTime;e!==u(this,Ou)&&(u(this,ke).notify("time-change",e),e>u(this,tl)&&(A(this,tl,e),m(this,Sm,$I).call(this)),u(this,ke).$state.seeking()&&u(this,ke).notify("seeked",e),A(this,Ou,e))},VA=new WeakSet,_U=function(e){if(!u(this,Ee).isMediaLoaded||u(this,Mi))return;const t=u(this,Ee).duration,i=m(this,as,ln).call(this,e);A(this,il,new yt(0,t)),u(this,ke).notify("duration-change",t,i)},Em=new WeakSet,MI=function(e){if(!u(this,Ee).isMediaLoaded)return;const t={muted:u(this,Ee).isMuted,volume:u(this,Ee).volumeLevel},i=m(this,as,ln).call(this,e);u(this,ke).notify("volume-change",t,i)},HA=new WeakSet,AU=function(e){const t=m(this,as,ln).call(this,e);u(this,Ee).isPaused?u(this,ke).notify("pause",void 0,t):u(this,ke).notify("play",void 0,t)},Sm=new WeakSet,$I=function(e){const t={seekable:m(this,_m,NI).call(this),buffered:new yt(0,u(this,tl))},i=e?m(this,as,ln).call(this,e):void 0;u(this,ke).notify("progress",t,i)},qA=new WeakSet,xU=function(e){const t=u(this,Ee).playerState,i={TrackType:{TEXT:"text",AUDIO:"audio"}}.PlayerState;if(A(this,$u,t===i.IDLE),t===i.PAUSED)return;const s=m(this,as,ln).call(this,e);switch(t){case i.PLAYING:u(this,ke).notify("playing",void 0,s);break;case i.BUFFERING:u(this,ke).notify("waiting",void 0,s);break;case i.IDLE:u(this,Mu).stop(),u(this,ke).notify("pause"),u(this,ke).notify("end");break}},_m=new WeakSet,NI=function(){return u(this,Ee).liveSeekableRange?new yt(u(this,Ee).liveSeekableRange.start,u(this,Ee).liveSeekableRange.end):u(this,il)},as=new WeakSet,ln=function(e){return e instanceof Event?e:new ve(e.type,{detail:e})},GA=new WeakSet,LU=function(e){const{streamType:t,title:i,poster:s}=u(this,ke).$state;return new Iie(e).setMetadata(i(),s()).setStreamType(t()).setTracks(u(this,ha).getLocalTextTracks()).build()},KA=new WeakSet,wU=function(e){var r,a;const t=m(this,GA,LU).call(this,e),i=new{TrackType:{TEXT:"text",AUDIO:"audio"}}.LoadRequest(t),s=u(this,ke).$state.savedState();return i.autoplay=(((r=u(this,Mi))==null?void 0:r.paused)??(s==null?void 0:s.paused))===!1,i.currentTime=((a=u(this,Mi))==null?void 0:a.time)??(s==null?void 0:s.currentTime)??0,i},Am=new WeakSet,FI=async function(e,t){const i=Y(u(this,ke).$state.source);A(this,Mi,{src:i,paused:e,time:t}),await this.loadSource(i)},jA=new WeakSet,CU=function(){m(this,Am,FI).call(this,u(this,Ee).isPaused,u(this,Ee).currentTime).catch(e=>{})};const Pie=Object.freeze(Object.defineProperty({__proto__:null,DisabledCastProvider:Rie},Symbol.toStringTag,{value:"Module"}));export{Re as $,BJ as M,Pk as a,Dk as b,pF as c,$G as e,jie as f,Mx as g,mF as h,MG as m};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.